mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-28 07:46:36 +00:00
Add final prices and fix logs
This commit is contained in:
@@ -57,7 +57,7 @@ export function getFeatureIdByMetricId(
|
|||||||
export type FeaturePriceSet = Partial<Record<FeatureId, string>>;
|
export type FeaturePriceSet = Partial<Record<FeatureId, string>>;
|
||||||
|
|
||||||
export const homeLabFeaturePriceSet: FeaturePriceSet = {
|
export const homeLabFeaturePriceSet: FeaturePriceSet = {
|
||||||
[FeatureId.TIER1]: "price_1SxgpPDCpkOb237Bfo4rIsoT"
|
[FeatureId.TIER1]: "price_1SzVE3D3Ee2Ir7Wm6wT5Dl3G"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const homeLabFeaturePriceSetSandbox: FeaturePriceSet = {
|
export const homeLabFeaturePriceSetSandbox: FeaturePriceSet = {
|
||||||
@@ -76,7 +76,7 @@ export function getHomeLabFeaturePriceSet(): FeaturePriceSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const tier2FeaturePriceSet: FeaturePriceSet = {
|
export const tier2FeaturePriceSet: FeaturePriceSet = {
|
||||||
[FeatureId.USERS]: "price_1SxaEHDCpkOb237BD9lBkPiR"
|
[FeatureId.USERS]: "price_1SzVCcD3Ee2Ir7Wmn6U3KvPN"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tier2FeaturePriceSetSandbox: FeaturePriceSet = {
|
export const tier2FeaturePriceSetSandbox: FeaturePriceSet = {
|
||||||
@@ -95,7 +95,7 @@ export function getStarterFeaturePriceSet(): FeaturePriceSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const tier3FeaturePriceSet: FeaturePriceSet = {
|
export const tier3FeaturePriceSet: FeaturePriceSet = {
|
||||||
[FeatureId.USERS]: "price_1SxaEODCpkOb237BiXdCBSfs"
|
[FeatureId.USERS]: "price_1SzVDKD3Ee2Ir7WmPtOKNusv"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tier3FeaturePriceSetSandbox: FeaturePriceSet = {
|
export const tier3FeaturePriceSetSandbox: FeaturePriceSet = {
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export async function updateOrg(
|
|||||||
// Determine max allowed retention days based on tier
|
// Determine max allowed retention days based on tier
|
||||||
let maxRetentionDays: number | null = null;
|
let maxRetentionDays: number | null = null;
|
||||||
if (!tier) {
|
if (!tier) {
|
||||||
maxRetentionDays = 0;
|
maxRetentionDays = 3;
|
||||||
} else if (tier === "tier1") {
|
} else if (tier === "tier1") {
|
||||||
maxRetentionDays = 7;
|
maxRetentionDays = 7;
|
||||||
} else if (tier === "tier2") {
|
} else if (tier === "tier2") {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function LogRetentionSectionForm({ org }: SectionFormProps) {
|
|||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { isPaidUser, hasSaasSubscription } = usePaidStatus();
|
const { isPaidUser, subscriptionTier } = usePaidStatus();
|
||||||
|
|
||||||
const [, formAction, loadingSave] = useActionState(performSave, null);
|
const [, formAction, loadingSave] = useActionState(performSave, null);
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
@@ -219,13 +219,31 @@ function LogRetentionSectionForm({ org }: SectionFormProps) {
|
|||||||
<SelectContent>
|
<SelectContent>
|
||||||
{LOG_RETENTION_OPTIONS.filter(
|
{LOG_RETENTION_OPTIONS.filter(
|
||||||
(option) => {
|
(option) => {
|
||||||
if (
|
let maxDays: number;
|
||||||
hasSaasSubscription &&
|
|
||||||
option.value >
|
if (!subscriptionTier) {
|
||||||
30
|
// No tier
|
||||||
) {
|
maxDays = 3;
|
||||||
|
} else if (subscriptionTier == "enterprise") {
|
||||||
|
// Enterprise - no limit
|
||||||
|
return true;
|
||||||
|
} else if (subscriptionTier == "tier3") {
|
||||||
|
maxDays = 90;
|
||||||
|
} else if (subscriptionTier == "tier2") {
|
||||||
|
maxDays = 30;
|
||||||
|
} else if (subscriptionTier == "tier1") {
|
||||||
|
maxDays = 7;
|
||||||
|
} else {
|
||||||
|
// Default to most restrictive
|
||||||
|
maxDays = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter out options that exceed the max
|
||||||
|
// Special values: -1 (forever) and 9001 (end of year) should be filtered
|
||||||
|
if (option.value < 0 || option.value > maxDays) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
).map((option) => (
|
).map((option) => (
|
||||||
@@ -294,7 +312,36 @@ function LogRetentionSectionForm({ org }: SectionFormProps) {
|
|||||||
/>
|
/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{LOG_RETENTION_OPTIONS.map(
|
{LOG_RETENTION_OPTIONS.filter(
|
||||||
|
(option) => {
|
||||||
|
let maxDays: number;
|
||||||
|
|
||||||
|
if (!subscriptionTier) {
|
||||||
|
// No tier
|
||||||
|
maxDays = 3;
|
||||||
|
} else if (subscriptionTier == "enterprise") {
|
||||||
|
// Enterprise - no limit
|
||||||
|
return true;
|
||||||
|
} else if (subscriptionTier == "tier3") {
|
||||||
|
maxDays = 90;
|
||||||
|
} else if (subscriptionTier == "tier2") {
|
||||||
|
maxDays = 30;
|
||||||
|
} else if (subscriptionTier == "tier1") {
|
||||||
|
maxDays = 7;
|
||||||
|
} else {
|
||||||
|
// Default to most restrictive
|
||||||
|
maxDays = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter out options that exceed the max
|
||||||
|
// Special values: -1 (forever) and 9001 (end of year) should be filtered
|
||||||
|
if (option.value < 0 || option.value > maxDays) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
).map(
|
||||||
(
|
(
|
||||||
option
|
option
|
||||||
) => (
|
) => (
|
||||||
@@ -362,7 +409,36 @@ function LogRetentionSectionForm({ org }: SectionFormProps) {
|
|||||||
/>
|
/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{LOG_RETENTION_OPTIONS.map(
|
{LOG_RETENTION_OPTIONS.filter(
|
||||||
|
(option) => {
|
||||||
|
let maxDays: number;
|
||||||
|
|
||||||
|
if (!subscriptionTier) {
|
||||||
|
// No tier
|
||||||
|
maxDays = 3;
|
||||||
|
} else if (subscriptionTier == "enterprise") {
|
||||||
|
// Enterprise - no limit
|
||||||
|
return true;
|
||||||
|
} else if (subscriptionTier == "tier3") {
|
||||||
|
maxDays = 90;
|
||||||
|
} else if (subscriptionTier == "tier2") {
|
||||||
|
maxDays = 30;
|
||||||
|
} else if (subscriptionTier == "tier1") {
|
||||||
|
maxDays = 7;
|
||||||
|
} else {
|
||||||
|
// Default to most restrictive
|
||||||
|
maxDays = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter out options that exceed the max
|
||||||
|
// Special values: -1 (forever) and 9001 (end of year) should be filtered
|
||||||
|
if (option.value < 0 || option.value > maxDays) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
).map(
|
||||||
(
|
(
|
||||||
option
|
option
|
||||||
) => (
|
) => (
|
||||||
|
|||||||
@@ -618,9 +618,9 @@ export default function GeneralPage() {
|
|||||||
isRefreshing={isRefreshing}
|
isRefreshing={isRefreshing}
|
||||||
onExport={() => startTransition(exportData)}
|
onExport={() => startTransition(exportData)}
|
||||||
isExporting={isExporting}
|
isExporting={isExporting}
|
||||||
isExportDisabled={
|
// isExportDisabled={ // not disabling this because the user should be able to click the button and get the feedback about needing to upgrade the plan
|
||||||
!isPaidUser(tierMatrix.accessLogs) || build === "oss"
|
// !isPaidUser(tierMatrix.accessLogs) || build === "oss"
|
||||||
}
|
// }
|
||||||
onDateRangeChange={handleDateRangeChange}
|
onDateRangeChange={handleDateRangeChange}
|
||||||
dateRange={{
|
dateRange={{
|
||||||
start: dateRange.startDate,
|
start: dateRange.startDate,
|
||||||
|
|||||||
@@ -472,9 +472,9 @@ export default function GeneralPage() {
|
|||||||
onRefresh={refreshData}
|
onRefresh={refreshData}
|
||||||
isRefreshing={isRefreshing}
|
isRefreshing={isRefreshing}
|
||||||
onExport={() => startTransition(exportData)}
|
onExport={() => startTransition(exportData)}
|
||||||
isExportDisabled={
|
// isExportDisabled={ // not disabling this because the user should be able to click the button and get the feedback about needing to upgrade the plan
|
||||||
!isPaidUser(tierMatrix.logExport) || build === "oss"
|
// !isPaidUser(tierMatrix.logExport) || build === "oss"
|
||||||
}
|
// }
|
||||||
isExporting={isExporting}
|
isExporting={isExporting}
|
||||||
onDateRangeChange={handleDateRangeChange}
|
onDateRangeChange={handleDateRangeChange}
|
||||||
dateRange={{
|
dateRange={{
|
||||||
|
|||||||
Reference in New Issue
Block a user