mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-07 18:40:33 +00:00
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
export enum LicenseId {
|
|
SMALL_LICENSE = "small_license",
|
|
BIG_LICENSE = "big_license"
|
|
}
|
|
|
|
export type LicensePriceSet = {
|
|
[key in LicenseId]: string;
|
|
};
|
|
|
|
export const licensePriceSet: LicensePriceSet = {
|
|
// Free license matches the freeLimitSet
|
|
[LicenseId.SMALL_LICENSE]: "price_1SxKHiD3Ee2Ir7WmvtEh17A8",
|
|
[LicenseId.BIG_LICENSE]: "price_1SxKHiD3Ee2Ir7WmMUiP0H6Y"
|
|
};
|
|
|
|
export const licensePriceSetSandbox: LicensePriceSet = {
|
|
// Free license matches the freeLimitSet
|
|
// when matching license the keys closer to 0 index are matched first so list the licenses in descending order of value
|
|
[LicenseId.SMALL_LICENSE]: "price_1SxDwuDCpkOb237Bz0yTiOgN",
|
|
[LicenseId.BIG_LICENSE]: "price_1SxDy0DCpkOb237BWJxrxYkl"
|
|
};
|
|
|
|
export function getLicensePriceSet(
|
|
environment?: string,
|
|
sandbox_mode?: boolean
|
|
): LicensePriceSet {
|
|
if (
|
|
(process.env.ENVIRONMENT == "prod" &&
|
|
process.env.SANDBOX_MODE !== "true") ||
|
|
(environment === "prod" && sandbox_mode !== true)
|
|
) {
|
|
// THIS GETS LOADED CLIENT SIDE AND SERVER SIDE
|
|
return licensePriceSet;
|
|
} else {
|
|
return licensePriceSetSandbox;
|
|
}
|
|
}
|