@funnelsgrove/runtime 0.1.59 → 0.1.60
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.
|
@@ -10,6 +10,10 @@ export type GeneratedOfferSetPlanModeConfig = {
|
|
|
10
10
|
readonly checkoutSummaryLabel?: string | null;
|
|
11
11
|
readonly billingInterval?: string | null;
|
|
12
12
|
readonly billingIntervalCount?: number | null;
|
|
13
|
+
readonly followUpProviderPlanId?: string | null;
|
|
14
|
+
readonly followUpBillingInterval?: string | null;
|
|
15
|
+
readonly followUpBillingIntervalCount?: number | null;
|
|
16
|
+
readonly introIterations?: number | null;
|
|
13
17
|
};
|
|
14
18
|
export type GeneratedOfferSetPlanItem = {
|
|
15
19
|
readonly funnelPlanKey: string;
|
|
@@ -17,6 +21,14 @@ export type GeneratedOfferSetPlanItem = {
|
|
|
17
21
|
readonly projectBillingPlanId?: string | null;
|
|
18
22
|
readonly testProviderPlanId?: string | null;
|
|
19
23
|
readonly liveProviderPlanId?: string | null;
|
|
24
|
+
readonly followUpTestProviderPlanId?: string | null;
|
|
25
|
+
readonly followUpLiveProviderPlanId?: string | null;
|
|
26
|
+
readonly followUpProviderPlanId?: string | null;
|
|
27
|
+
readonly followUpTitle?: string | null;
|
|
28
|
+
readonly followUpPlanTitle?: string | null;
|
|
29
|
+
readonly followUpBillingInterval?: string | null;
|
|
30
|
+
readonly followUpBillingIntervalCount?: number | null;
|
|
31
|
+
readonly introIterations?: number | null;
|
|
20
32
|
readonly title?: string | null;
|
|
21
33
|
readonly description?: string | null;
|
|
22
34
|
readonly priceLabel?: string | null;
|
|
@@ -75,6 +87,11 @@ export type OfferSetRuntimePlanOverrides = {
|
|
|
75
87
|
checkoutSummaryLabel?: string;
|
|
76
88
|
billingInterval?: string;
|
|
77
89
|
billingIntervalCount?: number;
|
|
90
|
+
followUpProviderPlanId?: string;
|
|
91
|
+
followUpPlanTitle?: string;
|
|
92
|
+
followUpBillingInterval?: string;
|
|
93
|
+
followUpBillingIntervalCount?: number;
|
|
94
|
+
introIterations?: number;
|
|
78
95
|
featuredTag?: string;
|
|
79
96
|
oldPriceLabel?: string;
|
|
80
97
|
isDefault?: boolean;
|
|
@@ -99,6 +99,13 @@ const readProviderPlanId = (item, mode) => {
|
|
|
99
99
|
? readString(item.testProviderPlanId)
|
|
100
100
|
: readString(item.liveProviderPlanId)));
|
|
101
101
|
};
|
|
102
|
+
const readFollowUpProviderPlanId = (item, mode) => {
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
const modeConfig = readGeneratedModeConfig(item, mode);
|
|
105
|
+
return ((_c = (_b = (_a = readString(modeConfig.followUpProviderPlanId)) !== null && _a !== void 0 ? _a : readString(modeConfig.follow_up_provider_plan_id)) !== null && _b !== void 0 ? _b : readString(item.followUpProviderPlanId)) !== null && _c !== void 0 ? _c : (mode === 'test'
|
|
106
|
+
? readString(item.followUpTestProviderPlanId)
|
|
107
|
+
: readString(item.followUpLiveProviderPlanId)));
|
|
108
|
+
};
|
|
102
109
|
const resolveOfferItemRuntimeKey = (item, baseCatalogsByMode) => {
|
|
103
110
|
var _a, _b, _c, _d, _e;
|
|
104
111
|
if (!item) {
|
|
@@ -126,9 +133,10 @@ const readGeneratedPlanNumberValue = (item, mode, itemKeys, metadataKeys = itemK
|
|
|
126
133
|
return ((_b = (_a = readFiniteNumberField(modeConfig, metadataKeys)) !== null && _a !== void 0 ? _a : itemValue) !== null && _b !== void 0 ? _b : readFiniteNumberField(metadata, metadataKeys));
|
|
127
134
|
};
|
|
128
135
|
const buildGeneratedPlanOverrides = (item, mode, isDefault) => {
|
|
129
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
130
137
|
const metadata = readOfferItemMetadata(item);
|
|
131
138
|
const providerPlanId = readProviderPlanId(item, mode);
|
|
139
|
+
const followUpProviderPlanId = readFollowUpProviderPlanId(item, mode);
|
|
132
140
|
const projectPlanId = (_a = readString(item.projectBillingPlanId)) !== null && _a !== void 0 ? _a : readStringField(metadata, ['projectBillingPlanId', 'projectPlanId', 'project_billing_plan_id']);
|
|
133
141
|
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']);
|
|
134
142
|
const description = readGeneratedPlanStringValue(item, mode, ['description']);
|
|
@@ -138,13 +146,17 @@ const buildGeneratedPlanOverrides = (item, mode, isDefault) => {
|
|
|
138
146
|
const checkoutSummaryLabel = readGeneratedPlanStringValue(item, mode, ['checkoutSummaryLabel']);
|
|
139
147
|
const billingInterval = readGeneratedPlanStringValue(item, mode, ['billingInterval']);
|
|
140
148
|
const billingIntervalCount = readGeneratedPlanNumberValue(item, mode, ['billingIntervalCount']);
|
|
149
|
+
const followUpPlanTitle = (_e = (_d = readString(item.followUpPlanTitle)) !== null && _d !== void 0 ? _d : readString(item.followUpTitle)) !== null && _e !== void 0 ? _e : readStringField(metadata, ['followUpPlanTitle', 'followUpTitle', 'follow_up_plan_title']);
|
|
150
|
+
const followUpBillingInterval = readGeneratedPlanStringValue(item, mode, ['followUpBillingInterval'], ['followUpBillingInterval', 'follow_up_billing_interval']);
|
|
151
|
+
const followUpBillingIntervalCount = readGeneratedPlanNumberValue(item, mode, ['followUpBillingIntervalCount'], ['followUpBillingIntervalCount', 'follow_up_billing_interval_count']);
|
|
152
|
+
const introIterations = readGeneratedPlanNumberValue(item, mode, ['introIterations'], ['introIterations', 'intro_iterations']);
|
|
141
153
|
const amountCents = readGeneratedPlanNumberValue(item, mode, ['amountCents']);
|
|
142
154
|
const modeConfig = readGeneratedModeConfig(item, mode);
|
|
143
|
-
const paymentMode = (
|
|
144
|
-
const analyticsPurchaseValue = (
|
|
145
|
-
const featuredTag = (
|
|
146
|
-
const oldPriceLabel = (
|
|
147
|
-
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(Object.assign({}, (projectPlanId ? { projectPlanId } : {})), (providerPlanId ? { providerPlanId } : {})), (paymentMode ? { paymentMode } : {})), (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 } : {}));
|
|
155
|
+
const paymentMode = (_m = (_l = (_k = (_j = (_h = (_g = (_f = readOneTimePaymentMode(modeConfig.paymentMode)) !== null && _f !== void 0 ? _f : readOneTimePaymentMode(modeConfig.payment_mode)) !== null && _g !== void 0 ? _g : readOneTimePaymentMode(modeConfig.checkoutMode)) !== null && _h !== void 0 ? _h : readOneTimePaymentMode(modeConfig.checkout_mode)) !== null && _j !== void 0 ? _j : readOneTimePaymentMode(metadata.paymentMode)) !== null && _k !== void 0 ? _k : readOneTimePaymentMode(metadata.payment_mode)) !== null && _l !== void 0 ? _l : readOneTimePaymentMode(metadata.checkoutMode)) !== null && _m !== void 0 ? _m : readOneTimePaymentMode(metadata.checkout_mode);
|
|
156
|
+
const analyticsPurchaseValue = (_o = readFiniteNumber(item.analyticsPurchaseValue)) !== null && _o !== void 0 ? _o : readFiniteNumberField(metadata, ['analyticsPurchaseValue']);
|
|
157
|
+
const featuredTag = (_p = readString(item.featuredTag)) !== null && _p !== void 0 ? _p : readStringField(metadata, ['featuredTag']);
|
|
158
|
+
const oldPriceLabel = (_q = readString(item.oldPriceLabel)) !== null && _q !== void 0 ? _q : readStringField(metadata, ['oldPriceLabel']);
|
|
159
|
+
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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (projectPlanId ? { projectPlanId } : {})), (providerPlanId ? { providerPlanId } : {})), (paymentMode ? { paymentMode } : {})), (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)) } : {})), (followUpProviderPlanId ? { followUpProviderPlanId } : {})), (followUpPlanTitle ? { followUpPlanTitle } : {})), (followUpBillingInterval ? { followUpBillingInterval } : {})), (followUpBillingIntervalCount !== null ? { followUpBillingIntervalCount: Math.max(1, Math.round(followUpBillingIntervalCount)) } : {})), (introIterations !== null ? { introIterations: Math.max(1, Math.round(introIterations)) } : {})), (featuredTag ? { featuredTag } : {})), (oldPriceLabel ? { oldPriceLabel } : {})), (isDefault ? { isDefault: true } : {}));
|
|
148
160
|
};
|
|
149
161
|
export const applyGeneratedOfferSetToPlanCatalog = (baseCatalog, mode, offerSet) => {
|
|
150
162
|
var _a, _b, _c;
|
|
@@ -98,6 +98,11 @@ export type FunnelSdkCreateSubscriptionCheckoutInput = {
|
|
|
98
98
|
analyticsMetadata?: Record<string, unknown> | null;
|
|
99
99
|
billingInterval?: string | null;
|
|
100
100
|
billingIntervalCount?: number | null;
|
|
101
|
+
followUpProviderPlanId?: string | null;
|
|
102
|
+
followUpPlanTitle?: string | null;
|
|
103
|
+
followUpBillingInterval?: string | null;
|
|
104
|
+
followUpBillingIntervalCount?: number | null;
|
|
105
|
+
introIterations?: number | null;
|
|
101
106
|
couponId?: string | null;
|
|
102
107
|
customerEmail?: string | null;
|
|
103
108
|
description?: string | null;
|
|
@@ -141,6 +146,11 @@ export type FunnelSdkUpdateSubscriptionCheckoutPlanInput = {
|
|
|
141
146
|
analyticsMetadata?: Record<string, unknown> | null;
|
|
142
147
|
billingInterval?: string | null;
|
|
143
148
|
billingIntervalCount?: number | null;
|
|
149
|
+
followUpProviderPlanId?: string | null;
|
|
150
|
+
followUpPlanTitle?: string | null;
|
|
151
|
+
followUpBillingInterval?: string | null;
|
|
152
|
+
followUpBillingIntervalCount?: number | null;
|
|
153
|
+
introIterations?: number | null;
|
|
144
154
|
couponId?: string | null;
|
|
145
155
|
customerEmail?: string | null;
|
|
146
156
|
description?: string | null;
|
|
@@ -229,6 +229,11 @@ class FunnelSdkService {
|
|
|
229
229
|
amountCents: input.amountCents,
|
|
230
230
|
billingInterval: input.billingInterval,
|
|
231
231
|
billingIntervalCount: input.billingIntervalCount,
|
|
232
|
+
followUpProviderPlanId: input.followUpProviderPlanId,
|
|
233
|
+
followUpPlanTitle: input.followUpPlanTitle,
|
|
234
|
+
followUpBillingInterval: input.followUpBillingInterval,
|
|
235
|
+
followUpBillingIntervalCount: input.followUpBillingIntervalCount,
|
|
236
|
+
introIterations: input.introIterations,
|
|
232
237
|
couponId: input.couponId,
|
|
233
238
|
analyticsMetadata: input.analyticsMetadata,
|
|
234
239
|
customerEmail: input.customerEmail,
|