diff --git a/services/web/app/src/Features/Subscription/PlansLocator.mjs b/services/web/app/src/Features/Subscription/PlansLocator.mjs index 281fbb329f..2f34492425 100644 --- a/services/web/app/src/Features/Subscription/PlansLocator.mjs +++ b/services/web/app/src/Features/Subscription/PlansLocator.mjs @@ -120,10 +120,19 @@ const recurlyPlanCodeToPlanTypeAndPeriod = { } /** - * @param {RecurlyPlanCode} recurlyPlanCode + * @param {string} key + * @returns {key is RecurlyPlanCode} + */ +function isRecurlyPlanCode(key) { + return Object.hasOwn(recurlyPlanCodeToPlanTypeAndPeriod, key) +} + +/** + * @param {string} recurlyPlanCode * @returns {PlanTypeAndPeriod | undefined} */ function getPlanTypeAndPeriodFromRecurlyPlanCode(recurlyPlanCode) { + if (!isRecurlyPlanCode(recurlyPlanCode)) return undefined return recurlyPlanCodeToPlanTypeAndPeriod[recurlyPlanCode] }