@funnelsgrove/runtime 0.11.0 → 0.11.1
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.
package/README.md
CHANGED
|
@@ -62,6 +62,11 @@ documented in [`docs/product-specs/funnel-template-runtime.md`](../../docs/produ
|
|
|
62
62
|
`useBrowserLocationSearch`; the shared controller also notifies it after
|
|
63
63
|
`history.pushState` and `history.replaceState` navigation.
|
|
64
64
|
- Keep env mapping centralized in `config/env.config.ts`.
|
|
65
|
+
- V2 checkout selection requires the offer set, payment profile, provider, provider
|
|
66
|
+
plan and plan key. `runtimeConfigRevisionId` is optional and must not gate the
|
|
67
|
+
request; a deployment does not invalidate an otherwise unchanged offer. Continue
|
|
68
|
+
forwarding a supplied revision for older API versions. Deploy the compatible
|
|
69
|
+
API before rolling out SDK callers that omit it.
|
|
65
70
|
|
|
66
71
|
## Build, Test, Publish
|
|
67
72
|
|
|
@@ -8,12 +8,12 @@ export type PublishedStripeSelectionInput = {
|
|
|
8
8
|
runtimeConfigRevisionId?: string | null;
|
|
9
9
|
};
|
|
10
10
|
export declare const toV2CheckoutSelection: (input: PublishedStripeSelectionInput) => {
|
|
11
|
-
runtimeConfigRevisionId: string | undefined;
|
|
12
11
|
offerSetId: string | undefined;
|
|
13
12
|
paymentProfileId: string | undefined;
|
|
14
13
|
provider: "stripe" | null | undefined;
|
|
15
14
|
providerPlanId: string | undefined;
|
|
16
15
|
planKey: string | undefined;
|
|
16
|
+
runtimeConfigRevisionId: string | undefined;
|
|
17
17
|
};
|
|
18
18
|
export declare const toV2CheckoutSessionRequest: (input: PublishedStripeSelectionInput & {
|
|
19
19
|
couponId?: string | null;
|
|
@@ -35,10 +35,10 @@ export declare const toV2CheckoutSessionRequest: (input: PublishedStripeSelectio
|
|
|
35
35
|
anonymousUserId: string | null | undefined;
|
|
36
36
|
idempotencyKey: string | null | undefined;
|
|
37
37
|
environment: "test" | "live" | undefined;
|
|
38
|
-
runtimeConfigRevisionId: string | undefined;
|
|
39
38
|
offerSetId: string | undefined;
|
|
40
39
|
paymentProfileId: string | undefined;
|
|
41
40
|
provider: "stripe" | null | undefined;
|
|
42
41
|
providerPlanId: string | undefined;
|
|
43
42
|
planKey: string | undefined;
|
|
43
|
+
runtimeConfigRevisionId: string | undefined;
|
|
44
44
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
export const toV2CheckoutSelection = (input) => {
|
|
2
2
|
var _a, _b, _c, _d, _e, _f;
|
|
3
3
|
const selection = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
paymentProfileId: (_c = input.paymentProfileId) === null || _c === void 0 ? void 0 : _c.trim(),
|
|
4
|
+
offerSetId: (_a = input.offerSetId) === null || _a === void 0 ? void 0 : _a.trim(),
|
|
5
|
+
paymentProfileId: (_b = input.paymentProfileId) === null || _b === void 0 ? void 0 : _b.trim(),
|
|
7
6
|
provider: input.provider,
|
|
8
|
-
providerPlanId: (
|
|
9
|
-
planKey: ((
|
|
7
|
+
providerPlanId: (_c = input.providerPlanId) === null || _c === void 0 ? void 0 : _c.trim(),
|
|
8
|
+
planKey: ((_d = input.planKey) === null || _d === void 0 ? void 0 : _d.trim()) || ((_e = input.planId) === null || _e === void 0 ? void 0 : _e.trim()),
|
|
10
9
|
};
|
|
11
10
|
if (selection.provider !== 'stripe' || Object.values(selection).some((value) => !value)) {
|
|
12
11
|
throw new Error('Published Stripe checkout selection is incomplete');
|
|
13
12
|
}
|
|
14
|
-
return
|
|
13
|
+
return Object.assign({
|
|
14
|
+
// Retained for older API versions, but not required to identify an offer.
|
|
15
|
+
runtimeConfigRevisionId: ((_f = input.runtimeConfigRevisionId) === null || _f === void 0 ? void 0 : _f.trim()) || undefined }, selection);
|
|
15
16
|
};
|
|
16
17
|
export const toV2CheckoutSessionRequest = (input, checkoutType) => (Object.assign(Object.assign({}, toV2CheckoutSelection(input)), { checkoutType, uiMode: 'custom', couponId: input.couponId, analyticsMetadata: input.analyticsMetadata, customerEmail: input.customerEmail, returnUrl: input.returnUrl, userId: input.userId, anonymousUserId: input.anonymousUserId, idempotencyKey: input.idempotencyKey, environment: input.environment }));
|