Getting swtiching tiers to work

This commit is contained in:
Owen
2026-02-09 17:05:14 -08:00
committed by Owen Schwartz
parent b741306cc4
commit e252d6513b
7 changed files with 81 additions and 20 deletions

View File

@@ -116,6 +116,26 @@ export function getScaleFeaturePriceSet(): FeaturePriceSet {
}
}
export function getFeatureIdByPriceId(priceId: string): FeatureId | undefined {
// Check all feature price sets
const allPriceSets = [
getHomeLabFeaturePriceSet(),
getStarterFeaturePriceSet(),
getScaleFeaturePriceSet()
];
for (const priceSet of allPriceSets) {
const entry = (Object.entries(priceSet) as [FeatureId, string][]).find(
([_, price]) => price === priceId
);
if (entry) {
return entry[0];
}
}
return undefined;
}
export async function getLineItems(
featurePriceSet: FeaturePriceSet,
orgId: string,