refactor: license settings
This commit is contained in:
+13
-8
@@ -3,7 +3,7 @@
|
||||
const BASE_URL = process.env.REACT_APP_RELEASE
|
||||
? `${location.origin}/api`
|
||||
: `https://dev.voce.chat/api`;
|
||||
export const LicensePriceList = [
|
||||
let prices = [
|
||||
{
|
||||
title: "VoceChat Pro",
|
||||
limit: 100,
|
||||
@@ -16,14 +16,19 @@ export const LicensePriceList = [
|
||||
pid: "price_1Lkgc7GGoUDRyc3j49Lqtncs",
|
||||
desc: "User Limit: No Limit"
|
||||
}
|
||||
// {
|
||||
// title: "VoceChat Enterprise",
|
||||
// limit: 500,
|
||||
// // pid: "price_1LkJNsGGoUDRyc3jkVNf4VPE",
|
||||
// pid: "price_1LkQGpGGoUDRyc3jGTh3GYHw",
|
||||
// desc: "User Limit: 500"
|
||||
// }
|
||||
];
|
||||
export const LicensePriceList =
|
||||
process.env.NODE_ENV === "development"
|
||||
? [
|
||||
...prices,
|
||||
{
|
||||
title: "VoceChat Enterprise",
|
||||
limit: 99999,
|
||||
pid: "price_1LkQGpGGoUDRyc3jGTh3GYHw",
|
||||
desc: "test price"
|
||||
}
|
||||
]
|
||||
: prices;
|
||||
export const PAYMENT_URL_PREFIX =
|
||||
process.env.NODE_ENV === "production"
|
||||
? `https://vera.nicegoodthings.com`
|
||||
|
||||
@@ -7,8 +7,13 @@ import {
|
||||
import { useAppSelector } from "../../app/store";
|
||||
|
||||
const useLicense = () => {
|
||||
const userCount = useAppSelector((store) => store.users.ids.length);
|
||||
const { data: license } = useGetLicenseQuery(undefined, { refetchOnMountOrArgChange: true });
|
||||
const { userCount, isGuest } = useAppSelector((store) => {
|
||||
return { userCount: store.users.ids.length, isGuest: store.authData.guest };
|
||||
});
|
||||
const { data: license } = useGetLicenseQuery(undefined, {
|
||||
refetchOnMountOrArgChange: true,
|
||||
skip: isGuest
|
||||
});
|
||||
const [check, { isLoading: isChecking, isSuccess: checked }] = useCheckLicenseMutation();
|
||||
const [upsert, { isSuccess: upserted, isLoading: upserting }] = useUpsertLicenseMutation();
|
||||
const checkLicense = (l: string) => {
|
||||
@@ -24,7 +29,7 @@ const useLicense = () => {
|
||||
}
|
||||
};
|
||||
console.log("uuu", userCount, license);
|
||||
const lUserLimit = license?.user_limit ?? 0;
|
||||
const lUserLimit = license?.user_limit ?? Number.MAX_SAFE_INTEGER;
|
||||
return {
|
||||
reachLimit: userCount >= lUserLimit,
|
||||
license,
|
||||
|
||||
@@ -3,7 +3,10 @@ const StyledWrapper = styled.div`
|
||||
display: flex;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: var(---navs-bg);
|
||||
background: var(---navs-bg);
|
||||
&.guest {
|
||||
background: none;
|
||||
}
|
||||
> .col {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user