@funnelsgrove/runtime 0.1.38 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,37 +7,31 @@ type FunnelExperimentBase = {
7
7
  status?: FunnelExperimentStatus;
8
8
  launchDate: string;
9
9
  };
10
+ type FunnelRouteExperimentVariantDefinition = {
11
+ variantKey?: string;
12
+ stepId: string;
13
+ label?: string;
14
+ trafficPercent: number;
15
+ };
16
+ type FunnelPricingExperimentVariantDefinition = {
17
+ variantKey?: string;
18
+ offerSetKey: string;
19
+ label?: string;
20
+ trafficPercent: number;
21
+ };
10
22
  export type FunnelRouteExperimentDefinition = FunnelExperimentBase & {
11
23
  type: FunnelRouteExperimentType;
12
24
  stepId?: string;
13
- control: {
14
- variantKey?: string;
15
- stepId: string;
16
- label?: string;
17
- trafficPercent: number;
18
- };
19
- variant: {
20
- variantKey?: string;
21
- stepId: string;
22
- label?: string;
23
- trafficPercent: number;
24
- };
25
+ control: FunnelRouteExperimentVariantDefinition;
26
+ variant: FunnelRouteExperimentVariantDefinition;
27
+ variants?: readonly FunnelRouteExperimentVariantDefinition[];
25
28
  };
26
29
  export type FunnelPricingExperimentDefinition = FunnelExperimentBase & {
27
30
  type: 'pricing';
28
31
  paywallStepId: string;
29
- control: {
30
- variantKey?: string;
31
- offerSetKey: string;
32
- label?: string;
33
- trafficPercent: number;
34
- };
35
- variant: {
36
- variantKey?: string;
37
- offerSetKey: string;
38
- label?: string;
39
- trafficPercent: number;
40
- };
32
+ control: FunnelPricingExperimentVariantDefinition;
33
+ variant: FunnelPricingExperimentVariantDefinition;
34
+ variants?: readonly FunnelPricingExperimentVariantDefinition[];
41
35
  };
42
36
  export type FunnelExperimentDefinition = FunnelRouteExperimentDefinition | FunnelPricingExperimentDefinition;
43
37
  export type PaywallExperimentDefinition = FunnelRouteExperimentDefinition & {
@@ -1,6 +1,33 @@
1
+ const getExperimentVariants = (experiment) => {
2
+ var _a;
3
+ return (((_a = experiment.variants) === null || _a === void 0 ? void 0 : _a.length)
4
+ ? experiment.variants
5
+ : [experiment.control, experiment.variant]);
6
+ };
7
+ const getRouteExperimentVariants = (experiment) => {
8
+ var _a;
9
+ return (((_a = experiment.variants) === null || _a === void 0 ? void 0 : _a.length)
10
+ ? experiment.variants
11
+ : [experiment.control, experiment.variant]);
12
+ };
13
+ const getPricingExperimentVariants = (experiment) => {
14
+ var _a;
15
+ return (((_a = experiment.variants) === null || _a === void 0 ? void 0 : _a.length)
16
+ ? experiment.variants
17
+ : [experiment.control, experiment.variant]);
18
+ };
19
+ const getDefaultVariantKey = (experiment, index) => {
20
+ var _a;
21
+ if (index === 0) {
22
+ return 'control';
23
+ }
24
+ return ((_a = experiment.variants) === null || _a === void 0 ? void 0 : _a.length)
25
+ ? `variant_${String.fromCharCode(96 + index)}`
26
+ : 'variant_b';
27
+ };
1
28
  export const defineFunnelExperiments = (experiments) => {
2
29
  for (const experiment of experiments) {
3
- const trafficTotal = experiment.control.trafficPercent + experiment.variant.trafficPercent;
30
+ const trafficTotal = getExperimentVariants(experiment).reduce((sum, variant) => sum + variant.trafficPercent, 0);
4
31
  if (trafficTotal !== 100) {
5
32
  throw new Error(`Experiment "${experiment.id}" traffic must sum to 100`);
6
33
  }
@@ -9,17 +36,17 @@ export const defineFunnelExperiments = (experiments) => {
9
36
  };
10
37
  export const toManifestExperiments = (experiments) => experiments
11
38
  .filter((experiment) => { var _a; return ((_a = experiment.status) !== null && _a !== void 0 ? _a : 'running') === 'running'; })
12
- .map((experiment) => ({
13
- experimentId: experiment.id,
14
- stepId: experiment.type === 'pricing'
15
- ? experiment.paywallStepId
16
- : experiment.stepId || experiment.control.stepId,
17
- variants: [
18
- Object.assign(Object.assign({ variantKey: experiment.control.variantKey || 'control' }, (experiment.control.label ? { label: experiment.control.label } : {})), { trafficPercent: experiment.control.trafficPercent, routeToStepId: experiment.type === 'pricing'
19
- ? experiment.paywallStepId
20
- : experiment.control.stepId }),
21
- Object.assign(Object.assign({ variantKey: experiment.variant.variantKey || 'variant_b' }, (experiment.variant.label ? { label: experiment.variant.label } : {})), { trafficPercent: experiment.variant.trafficPercent, routeToStepId: experiment.type === 'pricing'
22
- ? experiment.paywallStepId
23
- : experiment.variant.stepId }),
24
- ],
25
- }));
39
+ .map((experiment) => {
40
+ if (experiment.type === 'pricing') {
41
+ return {
42
+ experimentId: experiment.id,
43
+ stepId: experiment.paywallStepId,
44
+ variants: getPricingExperimentVariants(experiment).map((variant, index) => (Object.assign(Object.assign({ variantKey: variant.variantKey || getDefaultVariantKey(experiment, index) }, (variant.label ? { label: variant.label } : {})), { trafficPercent: variant.trafficPercent, routeToStepId: experiment.paywallStepId }))),
45
+ };
46
+ }
47
+ return {
48
+ experimentId: experiment.id,
49
+ stepId: experiment.stepId || experiment.control.stepId,
50
+ variants: getRouteExperimentVariants(experiment).map((variant, index) => (Object.assign(Object.assign({ variantKey: variant.variantKey || getDefaultVariantKey(experiment, index) }, (variant.label ? { label: variant.label } : {})), { trafficPercent: variant.trafficPercent, routeToStepId: variant.stepId }))),
51
+ };
52
+ });
@@ -1,10 +1,31 @@
1
1
  import type { RuntimeMode } from '../services/runtime-mode.service.js';
2
2
  export type GeneratedOfferSetItemKind = 'plan' | 'upsell' | 'downsell';
3
+ export type GeneratedOfferSetPlanModeConfig = {
4
+ readonly providerPlanId?: string | null;
5
+ readonly priceLabel?: string | null;
6
+ readonly perDayAmount?: string | null;
7
+ readonly perDayLabel?: string | null;
8
+ readonly amountCents?: number | null;
9
+ readonly checkoutSummaryLabel?: string | null;
10
+ readonly billingInterval?: string | null;
11
+ readonly billingIntervalCount?: number | null;
12
+ };
3
13
  export type GeneratedOfferSetPlanItem = {
4
14
  readonly funnelPlanKey: string;
15
+ readonly runtimePlanKey?: string | null;
5
16
  readonly projectBillingPlanId?: string | null;
6
17
  readonly testProviderPlanId?: string | null;
7
18
  readonly liveProviderPlanId?: string | null;
19
+ readonly title?: string | null;
20
+ readonly description?: string | null;
21
+ readonly priceLabel?: string | null;
22
+ readonly perDayAmount?: string | null;
23
+ readonly perDayLabel?: string | null;
24
+ readonly amountCents?: number | null;
25
+ readonly checkoutSummaryLabel?: string | null;
26
+ readonly billingInterval?: string | null;
27
+ readonly billingIntervalCount?: number | null;
28
+ readonly providerMappingsByMode?: Partial<Record<RuntimeMode, GeneratedOfferSetPlanModeConfig>> | null;
8
29
  readonly analyticsPurchaseValue?: number | null;
9
30
  readonly position?: number | null;
10
31
  readonly isDefault?: boolean | null;
@@ -44,6 +65,14 @@ export type OfferSetRuntimePlanOverrides = {
44
65
  providerPlanId?: string;
45
66
  analyticsPurchaseValue?: number;
46
67
  title?: string;
68
+ description?: string;
69
+ priceLabel?: string;
70
+ perDayAmount?: string;
71
+ perDayLabel?: string;
72
+ amountCents?: number;
73
+ checkoutSummaryLabel?: string;
74
+ billingInterval?: string;
75
+ billingIntervalCount?: number;
47
76
  featuredTag?: string;
48
77
  oldPriceLabel?: string;
49
78
  isDefault?: boolean;
@@ -51,7 +80,7 @@ export type OfferSetRuntimePlanOverrides = {
51
80
  export type OfferSetRuntimeInput<TPlan extends Record<string, unknown>> = {
52
81
  offerSets: readonly GeneratedOfferSet[];
53
82
  offerSetKey?: string;
54
- baseCatalogsByMode: Record<RuntimeMode, Record<string, TPlan>>;
83
+ baseCatalogsByMode?: Partial<Record<RuntimeMode, Record<string, TPlan>>>;
55
84
  fallbackDiscounts?: readonly OfferSetRuntimeDiscount[];
56
85
  };
57
86
  export type OfferSetRuntimeResult<TPlan extends Record<string, unknown>> = {
@@ -68,4 +97,4 @@ export type OfferSetRuntimeResult<TPlan extends Record<string, unknown>> = {
68
97
  export declare const findGeneratedOfferSet: (offerSets: readonly GeneratedOfferSet[], offerSetKey?: string) => GeneratedOfferSet | null;
69
98
  export declare const applyGeneratedOfferSetToPlanCatalog: <TPlan extends Record<string, unknown>>(baseCatalog: Record<string, TPlan>, mode: RuntimeMode, offerSet: GeneratedOfferSet | null) => Record<string, TPlan & OfferSetRuntimePlanOverrides>;
70
99
  export declare const buildGeneratedOfferSetDiscountList: (offerSet: GeneratedOfferSet | null, mode: RuntimeMode, fallbackDiscounts?: readonly OfferSetRuntimeDiscount[]) => readonly OfferSetRuntimeDiscount[];
71
- export declare const resolveGeneratedOfferSetRuntime: <TPlan extends Record<string, unknown>>(input: OfferSetRuntimeInput<TPlan>) => OfferSetRuntimeResult<TPlan>;
100
+ export declare const resolveGeneratedOfferSetRuntime: <TPlan extends Record<string, unknown> = Record<string, unknown>>(input: OfferSetRuntimeInput<TPlan>) => OfferSetRuntimeResult<TPlan>;
@@ -12,6 +12,24 @@ const readFiniteNumber = (value) => {
12
12
  : null;
13
13
  return numeric !== null && Number.isFinite(numeric) ? numeric : null;
14
14
  };
15
+ const readStringField = (record, keys) => {
16
+ for (const key of keys) {
17
+ const value = readString(record[key]);
18
+ if (value) {
19
+ return value;
20
+ }
21
+ }
22
+ return null;
23
+ };
24
+ const readFiniteNumberField = (record, keys) => {
25
+ for (const key of keys) {
26
+ const value = readFiniteNumber(record[key]);
27
+ if (value !== null) {
28
+ return value;
29
+ }
30
+ }
31
+ return null;
32
+ };
15
33
  const readPositiveInteger = (value) => {
16
34
  const numeric = readFiniteNumber(value);
17
35
  return numeric !== null && numeric > 0 ? Math.round(numeric) : null;
@@ -36,9 +54,6 @@ export const findGeneratedOfferSet = (offerSets, offerSetKey) => {
36
54
  const activeOfferSets = offerSets.filter((offerSet) => offerSet.isActive !== false);
37
55
  return ((_b = (_a = activeOfferSets.find((offerSet) => offerSet.key === offerSetKey)) !== null && _a !== void 0 ? _a : activeOfferSets[0]) !== null && _b !== void 0 ? _b : null);
38
56
  };
39
- const readProviderPlanId = (item, mode) => (mode === 'test'
40
- ? readString(item.testProviderPlanId)
41
- : readString(item.liveProviderPlanId));
42
57
  const resolveCatalogKey = (baseCatalog, funnelPlanKey) => {
43
58
  var _a;
44
59
  const key = funnelPlanKey.trim();
@@ -51,11 +66,74 @@ const resolveCatalogKey = (baseCatalog, funnelPlanKey) => {
51
66
  const normalizedKey = normalizeCatalogLookupKey(key);
52
67
  return (_a = Object.keys(baseCatalog).find((catalogKey) => (normalizeCatalogLookupKey(catalogKey) === normalizedKey))) !== null && _a !== void 0 ? _a : null;
53
68
  };
69
+ const readOfferItemMetadata = (item) => (isRecord(item.metadata) ? item.metadata : {});
70
+ const readOfferItemExplicitRuntimePlanKey = (item) => {
71
+ var _a;
72
+ const metadata = readOfferItemMetadata(item);
73
+ return ((_a = readString(item.runtimePlanKey)) !== null && _a !== void 0 ? _a : readStringField(metadata, ['runtimePlanKey', 'planKey', 'billingPlanKey']));
74
+ };
75
+ const readGeneratedModeConfig = (item, mode) => {
76
+ const directMappings = isRecord(item.providerMappingsByMode) ? item.providerMappingsByMode : {};
77
+ const directModeConfig = directMappings[mode];
78
+ if (isRecord(directModeConfig)) {
79
+ return directModeConfig;
80
+ }
81
+ const metadata = readOfferItemMetadata(item);
82
+ const metadataMappings = isRecord(metadata.providerMappingsByMode) ? metadata.providerMappingsByMode : {};
83
+ const metadataModeConfig = metadataMappings[mode];
84
+ return isRecord(metadataModeConfig) ? metadataModeConfig : {};
85
+ };
86
+ const readProviderPlanId = (item, mode) => {
87
+ var _a;
88
+ const modeConfig = readGeneratedModeConfig(item, mode);
89
+ return ((_a = readString(modeConfig.providerPlanId)) !== null && _a !== void 0 ? _a : (mode === 'test'
90
+ ? readString(item.testProviderPlanId)
91
+ : readString(item.liveProviderPlanId)));
92
+ };
54
93
  const resolveOfferItemRuntimeKey = (item, baseCatalogsByMode) => {
94
+ var _a, _b, _c, _d, _e;
95
+ if (!item) {
96
+ return null;
97
+ }
98
+ const explicitKey = readOfferItemExplicitRuntimePlanKey(item);
99
+ return ((_e = (_d = (_c = (_b = (_a = (explicitKey ? resolveCatalogKey(baseCatalogsByMode.test, explicitKey) : null)) !== null && _a !== void 0 ? _a : (explicitKey ? resolveCatalogKey(baseCatalogsByMode.live, explicitKey) : null)) !== null && _b !== void 0 ? _b : resolveCatalogKey(baseCatalogsByMode.test, item.funnelPlanKey)) !== null && _c !== void 0 ? _c : resolveCatalogKey(baseCatalogsByMode.live, item.funnelPlanKey)) !== null && _d !== void 0 ? _d : explicitKey) !== null && _e !== void 0 ? _e : readString(item.funnelPlanKey));
100
+ };
101
+ const resolveOfferItemCatalogKey = (item, baseCatalog) => {
102
+ var _a, _b, _c;
103
+ const explicitKey = readOfferItemExplicitRuntimePlanKey(item);
104
+ return ((_c = (_b = (_a = (explicitKey ? resolveCatalogKey(baseCatalog, explicitKey) : null)) !== null && _a !== void 0 ? _a : resolveCatalogKey(baseCatalog, item.funnelPlanKey)) !== null && _b !== void 0 ? _b : explicitKey) !== null && _c !== void 0 ? _c : readString(item.funnelPlanKey));
105
+ };
106
+ const readGeneratedPlanStringValue = (item, mode, itemKeys, metadataKeys = itemKeys) => {
55
107
  var _a, _b;
56
- return (item
57
- ? (_b = (_a = resolveCatalogKey(baseCatalogsByMode.test, item.funnelPlanKey)) !== null && _a !== void 0 ? _a : resolveCatalogKey(baseCatalogsByMode.live, item.funnelPlanKey)) !== null && _b !== void 0 ? _b : readString(item.funnelPlanKey)
58
- : null);
108
+ const modeConfig = readGeneratedModeConfig(item, mode);
109
+ const metadata = readOfferItemMetadata(item);
110
+ return ((_b = (_a = readStringField(modeConfig, metadataKeys)) !== null && _a !== void 0 ? _a : itemKeys.reduce((result, key) => result !== null && result !== void 0 ? result : readString(item[key]), null)) !== null && _b !== void 0 ? _b : readStringField(metadata, metadataKeys));
111
+ };
112
+ const readGeneratedPlanNumberValue = (item, mode, itemKeys, metadataKeys = itemKeys) => {
113
+ var _a, _b;
114
+ const modeConfig = readGeneratedModeConfig(item, mode);
115
+ const metadata = readOfferItemMetadata(item);
116
+ const itemValue = itemKeys.reduce((result, key) => (result !== null && result !== void 0 ? result : readFiniteNumber(item[key])), null);
117
+ return ((_b = (_a = readFiniteNumberField(modeConfig, metadataKeys)) !== null && _a !== void 0 ? _a : itemValue) !== null && _b !== void 0 ? _b : readFiniteNumberField(metadata, metadataKeys));
118
+ };
119
+ const buildGeneratedPlanOverrides = (item, mode, isDefault) => {
120
+ var _a, _b, _c, _d, _e, _f;
121
+ const metadata = readOfferItemMetadata(item);
122
+ const providerPlanId = readProviderPlanId(item, mode);
123
+ const projectPlanId = (_a = readString(item.projectBillingPlanId)) !== null && _a !== void 0 ? _a : readStringField(metadata, ['projectBillingPlanId', 'projectPlanId', 'project_billing_plan_id']);
124
+ const title = (_c = (_b = readString(item.title)) !== null && _b !== void 0 ? _b : readString(item.displayNameOverride)) !== null && _c !== void 0 ? _c : readStringField(metadata, ['title', 'displayName', 'publicPlanName', 'public_plan_name']);
125
+ const description = readGeneratedPlanStringValue(item, mode, ['description']);
126
+ const priceLabel = readGeneratedPlanStringValue(item, mode, ['priceLabel']);
127
+ const perDayAmount = readGeneratedPlanStringValue(item, mode, ['perDayAmount']);
128
+ const perDayLabel = readGeneratedPlanStringValue(item, mode, ['perDayLabel']);
129
+ const checkoutSummaryLabel = readGeneratedPlanStringValue(item, mode, ['checkoutSummaryLabel']);
130
+ const billingInterval = readGeneratedPlanStringValue(item, mode, ['billingInterval']);
131
+ const billingIntervalCount = readGeneratedPlanNumberValue(item, mode, ['billingIntervalCount']);
132
+ const amountCents = readGeneratedPlanNumberValue(item, mode, ['amountCents']);
133
+ const analyticsPurchaseValue = (_d = readFiniteNumber(item.analyticsPurchaseValue)) !== null && _d !== void 0 ? _d : readFiniteNumberField(metadata, ['analyticsPurchaseValue']);
134
+ const featuredTag = (_e = readString(item.featuredTag)) !== null && _e !== void 0 ? _e : readStringField(metadata, ['featuredTag']);
135
+ const oldPriceLabel = (_f = readString(item.oldPriceLabel)) !== null && _f !== void 0 ? _f : readStringField(metadata, ['oldPriceLabel']);
136
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (projectPlanId ? { projectPlanId } : {})), (providerPlanId ? { providerPlanId } : {})), (analyticsPurchaseValue !== null ? { analyticsPurchaseValue } : {})), (title ? { title } : {})), (description ? { description } : {})), (priceLabel ? { priceLabel } : {})), (perDayAmount ? { perDayAmount } : {})), (perDayLabel ? { perDayLabel } : {})), (amountCents !== null ? { amountCents: Math.max(0, Math.round(amountCents)) } : {})), (checkoutSummaryLabel ? { checkoutSummaryLabel } : {})), (billingInterval ? { billingInterval } : {})), (billingIntervalCount !== null ? { billingIntervalCount: Math.max(1, Math.round(billingIntervalCount)) } : {})), (featuredTag ? { featuredTag } : {})), (oldPriceLabel ? { oldPriceLabel } : {})), (isDefault ? { isDefault: true } : {}));
59
137
  };
60
138
  export const applyGeneratedOfferSetToPlanCatalog = (baseCatalog, mode, offerSet) => {
61
139
  var _a, _b, _c;
@@ -71,24 +149,14 @@ export const applyGeneratedOfferSetToPlanCatalog = (baseCatalog, mode, offerSet)
71
149
  const nextCatalog = Object.assign({}, baseCatalog);
72
150
  const defaultPlanItem = (_a = planItems.find((item) => item.isDefault === true)) !== null && _a !== void 0 ? _a : planItems[0];
73
151
  const defaultPlanKey = defaultPlanItem
74
- ? (_b = resolveCatalogKey(nextCatalog, defaultPlanItem.funnelPlanKey)) !== null && _b !== void 0 ? _b : defaultPlanItem.funnelPlanKey
152
+ ? (_b = resolveOfferItemCatalogKey(defaultPlanItem, nextCatalog)) !== null && _b !== void 0 ? _b : defaultPlanItem.funnelPlanKey
75
153
  : '';
76
154
  for (const item of catalogItems) {
77
- const key = resolveCatalogKey(nextCatalog, item.funnelPlanKey);
155
+ const key = resolveOfferItemCatalogKey(item, nextCatalog);
78
156
  if (!key) {
79
157
  continue;
80
158
  }
81
- const basePlan = nextCatalog[key];
82
- if (!basePlan) {
83
- continue;
84
- }
85
- const providerPlanId = readProviderPlanId(item, mode);
86
- const displayNameOverride = readString(item.displayNameOverride);
87
- const featuredTag = readString(item.featuredTag);
88
- const oldPriceLabel = readString(item.oldPriceLabel);
89
- nextCatalog[key] = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, basePlan), (readString(item.projectBillingPlanId) ? { projectPlanId: (_c = readString(item.projectBillingPlanId)) !== null && _c !== void 0 ? _c : undefined } : {})), (providerPlanId ? { providerPlanId } : {})), (typeof item.analyticsPurchaseValue === 'number'
90
- ? { analyticsPurchaseValue: item.analyticsPurchaseValue }
91
- : {})), (displayNameOverride ? { title: displayNameOverride } : {})), (featuredTag ? { featuredTag } : {})), (oldPriceLabel ? { oldPriceLabel } : {})), { isDefault: getOfferSetItemKind(item) === 'plan' && key === defaultPlanKey || undefined });
159
+ nextCatalog[key] = Object.assign(Object.assign({}, ((_c = nextCatalog[key]) !== null && _c !== void 0 ? _c : {})), buildGeneratedPlanOverrides(item, mode, getOfferSetItemKind(item) === 'plan' && key === defaultPlanKey));
92
160
  }
93
161
  return nextCatalog;
94
162
  };
@@ -156,24 +224,28 @@ export const buildGeneratedOfferSetDiscountList = (offerSet, mode, fallbackDisco
156
224
  ];
157
225
  };
158
226
  export const resolveGeneratedOfferSetRuntime = (input) => {
159
- var _a, _b;
227
+ var _a, _b, _c, _d, _e, _f;
160
228
  const offerSet = findGeneratedOfferSet(input.offerSets, input.offerSetKey);
229
+ const baseCatalogsByMode = {
230
+ test: (_b = (_a = input.baseCatalogsByMode) === null || _a === void 0 ? void 0 : _a.test) !== null && _b !== void 0 ? _b : {},
231
+ live: (_d = (_c = input.baseCatalogsByMode) === null || _c === void 0 ? void 0 : _c.live) !== null && _d !== void 0 ? _d : {},
232
+ };
161
233
  const planItems = getSortedItemsByKind(offerSet, 'plan');
162
234
  const upsellItems = getSortedItemsByKind(offerSet, 'upsell');
163
235
  const downsellItems = getSortedItemsByKind(offerSet, 'downsell');
164
236
  const planKeys = planItems
165
- .map((item) => resolveOfferItemRuntimeKey(item, input.baseCatalogsByMode))
237
+ .map((item) => resolveOfferItemRuntimeKey(item, baseCatalogsByMode))
166
238
  .filter((key) => Boolean(key));
167
239
  const upsellPlanKeys = upsellItems
168
- .map((item) => resolveOfferItemRuntimeKey(item, input.baseCatalogsByMode))
240
+ .map((item) => resolveOfferItemRuntimeKey(item, baseCatalogsByMode))
169
241
  .filter((key) => Boolean(key));
170
242
  const downsellPlanKeys = (downsellItems.length > 0 ? downsellItems : planItems)
171
- .map((item) => resolveOfferItemRuntimeKey(item, input.baseCatalogsByMode))
243
+ .map((item) => resolveOfferItemRuntimeKey(item, baseCatalogsByMode))
172
244
  .filter((key) => Boolean(key));
173
- const defaultPlanKey = (_b = resolveOfferItemRuntimeKey((_a = planItems.find((item) => item.isDefault === true)) !== null && _a !== void 0 ? _a : planItems[0], input.baseCatalogsByMode)) !== null && _b !== void 0 ? _b : '';
245
+ const defaultPlanKey = (_f = resolveOfferItemRuntimeKey((_e = planItems.find((item) => item.isDefault === true)) !== null && _e !== void 0 ? _e : planItems[0], baseCatalogsByMode)) !== null && _f !== void 0 ? _f : '';
174
246
  const plansByMode = {
175
- test: applyGeneratedOfferSetToPlanCatalog(input.baseCatalogsByMode.test, 'test', offerSet),
176
- live: applyGeneratedOfferSetToPlanCatalog(input.baseCatalogsByMode.live, 'live', offerSet),
247
+ test: applyGeneratedOfferSetToPlanCatalog(baseCatalogsByMode.test, 'test', offerSet),
248
+ live: applyGeneratedOfferSetToPlanCatalog(baseCatalogsByMode.live, 'live', offerSet),
177
249
  };
178
250
  const discountListsByMode = {
179
251
  test: buildGeneratedOfferSetDiscountList(offerSet, 'test', input.fallbackDiscounts),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/runtime",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",