refactor: license price list
This commit is contained in:
+29
-8
@@ -10,24 +10,44 @@ let prices: Price[] = [
|
||||
{
|
||||
type: "subscription",
|
||||
// sub_type: "year", //day month year
|
||||
title: i18n.t("price.pro.title"),
|
||||
title: "Pro",
|
||||
limit: 100,
|
||||
pid: "price_1MN8C7GGoUDRyc3jos06bCqM",
|
||||
desc: i18n.t("price.pro.desc"),
|
||||
desc: "Pro Desc",
|
||||
},
|
||||
{
|
||||
type: "payment",
|
||||
title: i18n.t("price.supreme.title"),
|
||||
title: "supreme",
|
||||
limit: 99999,
|
||||
pid: "price_1M5VoGGGoUDRyc3j6xhQou6D",
|
||||
desc: i18n.t("price.supreme.desc"),
|
||||
desc: "supreme desc",
|
||||
}
|
||||
];
|
||||
export const LicensePriceList: Price[] =
|
||||
process.env.NODE_ENV === "development"
|
||||
export const getLicensePriceList = () => {
|
||||
const ps = prices.map((p, idx) => {
|
||||
switch (idx) {
|
||||
// pro
|
||||
case 0: {
|
||||
p.title = i18n.t("price.pro.title");
|
||||
p.desc = i18n.t("price.pro.desc");
|
||||
}
|
||||
break;
|
||||
// supreme
|
||||
case 1: {
|
||||
p.title = i18n.t("price.supreme.title");
|
||||
p.desc = i18n.t("price.supreme.desc");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return p;
|
||||
});
|
||||
return process.env.NODE_ENV === "development"
|
||||
// 开发环境加入两个测试价格
|
||||
? [
|
||||
...prices,
|
||||
...ps,
|
||||
{
|
||||
type: "payment",
|
||||
title: "Test VoceChat Enterprise",
|
||||
@@ -44,7 +64,8 @@ export const LicensePriceList: Price[] =
|
||||
sub_dur: "year", //day month year
|
||||
},
|
||||
]
|
||||
: prices;
|
||||
: ps;
|
||||
};
|
||||
export const PAYMENT_URL_PREFIX =
|
||||
process.env.NODE_ENV === "production"
|
||||
? `https://vera.nicegoodthings.com`
|
||||
|
||||
@@ -6,7 +6,7 @@ import Button from "../../../common/component/styled/Button";
|
||||
import StyledRadio from "../../../common/component/styled/Radio";
|
||||
|
||||
import { useGetLicensePaymentUrlMutation } from "../../../app/services/server";
|
||||
import { LicensePriceList } from "../../../app/config";
|
||||
import { getLicensePriceList } from "../../../app/config";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import dayjs from "dayjs";
|
||||
import { PriceSubscriptionDuration, PriceType } from "../../../types/common";
|
||||
@@ -36,6 +36,7 @@ const getExpireDay = (sub_dur: PriceSubscriptionDuration) => {
|
||||
};
|
||||
return res.format("YYYY-MM-DD");
|
||||
};
|
||||
const LicensePriceList = getLicensePriceList();
|
||||
const LicensePriceListModal: FC<Props> = ({ closeModal }) => {
|
||||
const { t } = useTranslation("setting");
|
||||
const { t: ct } = useTranslation();
|
||||
|
||||
@@ -69,7 +69,7 @@ registerRoute(
|
||||
plugins: [
|
||||
// Ensure that once this runtime cache reaches a maximum size the
|
||||
// least-recently used images are removed.
|
||||
new ExpirationPlugin({ maxEntries: 100, maxAgeSeconds: 30 * 60 })
|
||||
new ExpirationPlugin({ maxEntries: 100, maxAgeSeconds: 5 * 60 })
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user