Update partner packages, copy, and demo switcher
This commit is contained in:
@@ -9,7 +9,12 @@ export type PackageComparisonRow =
|
||||
| {
|
||||
id: string;
|
||||
type: 'limit';
|
||||
limitKey: 'max_photos' | 'max_guests' | 'gallery_days';
|
||||
limitKey: 'max_photos' | 'max_guests' | 'gallery_days' | 'max_events_per_year';
|
||||
}
|
||||
| {
|
||||
id: string;
|
||||
type: 'value';
|
||||
valueKey: 'included_package_slug';
|
||||
}
|
||||
| {
|
||||
id: string;
|
||||
@@ -62,6 +67,10 @@ export function classifyPackageChange(pkg: Package, active: Package | null): Pac
|
||||
return { isUpgrade: false, isDowngrade: false };
|
||||
}
|
||||
|
||||
if (pkg.type === 'reseller' || active.type === 'reseller') {
|
||||
return { isUpgrade: false, isDowngrade: false };
|
||||
}
|
||||
|
||||
const activeFeatures = collectFeatures(active);
|
||||
const candidateFeatures = collectFeatures(pkg);
|
||||
|
||||
@@ -106,6 +115,10 @@ export function selectRecommendedPackageId(
|
||||
return null;
|
||||
}
|
||||
|
||||
if (packages.some((pkg) => pkg.type === 'reseller')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const candidates = feature === 'watermark_allowed'
|
||||
? packages.filter((pkg) => pkg.watermark_allowed === true)
|
||||
: packages.filter((pkg) => normalizePackageFeatures(pkg).includes(feature));
|
||||
@@ -121,11 +134,20 @@ export function selectRecommendedPackageId(
|
||||
}
|
||||
|
||||
export function buildPackageComparisonRows(packages: Package[]): PackageComparisonRow[] {
|
||||
const limitRows: PackageComparisonRow[] = [
|
||||
{ id: 'limit.max_photos', type: 'limit', limitKey: 'max_photos' },
|
||||
{ id: 'limit.max_guests', type: 'limit', limitKey: 'max_guests' },
|
||||
{ id: 'limit.gallery_days', type: 'limit', limitKey: 'gallery_days' },
|
||||
];
|
||||
const isResellerCatalog = packages.some(
|
||||
(pkg) => pkg.type === 'reseller' || pkg.max_events_per_year !== undefined || pkg.included_package_slug !== undefined
|
||||
);
|
||||
|
||||
const limitRows: PackageComparisonRow[] = isResellerCatalog
|
||||
? [
|
||||
{ id: 'value.included_package_slug', type: 'value', valueKey: 'included_package_slug' },
|
||||
{ id: 'limit.max_events_per_year', type: 'limit', limitKey: 'max_events_per_year' },
|
||||
]
|
||||
: [
|
||||
{ id: 'limit.max_photos', type: 'limit', limitKey: 'max_photos' },
|
||||
{ id: 'limit.max_guests', type: 'limit', limitKey: 'max_guests' },
|
||||
{ id: 'limit.gallery_days', type: 'limit', limitKey: 'gallery_days' },
|
||||
];
|
||||
|
||||
const featureKeys = new Set<string>();
|
||||
packages.forEach((pkg) => {
|
||||
|
||||
Reference in New Issue
Block a user