@funnelsgrove/payments 0.11.14 → 0.11.15
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.
|
@@ -50,8 +50,9 @@ export type StripeSubscriptionCheckoutSession = {
|
|
|
50
50
|
export declare const buildStripeSubscriptionCheckoutPreparationAnalyticsMetadata: (analyticsMetadata: Record<string, unknown> | null | undefined, options?: StripeSubscriptionCheckoutPreparationOptions) => Record<string, unknown> | null | undefined;
|
|
51
51
|
export type StripeSubscriptionCheckoutIntentKeyInput = Pick<StripeSubscriptionCheckoutSessionInput, 'checkoutMode' | 'couponId' | 'customerEmail' | 'paymentProfileId' | 'provider' | 'returnUrl' | 'runtimeConfig' | 'runtimeConfigRevisionId' | 'stripePublishableKey' | 'userId'> & {
|
|
52
52
|
analyticsMetadata?: Record<string, unknown> | null;
|
|
53
|
+
planKey?: string | null;
|
|
53
54
|
};
|
|
54
|
-
export declare function buildStripeSubscriptionCheckoutIntentKey({ checkoutMode, couponId, customerEmail, returnUrl, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, provider, stripePublishableKey, userId, }: StripeSubscriptionCheckoutIntentKeyInput): string;
|
|
55
|
+
export declare function buildStripeSubscriptionCheckoutIntentKey({ checkoutMode, couponId, customerEmail, returnUrl, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, planKey, provider, stripePublishableKey, userId, }: StripeSubscriptionCheckoutIntentKeyInput): string;
|
|
55
56
|
export declare function shouldResetStripeSubscriptionCheckoutSessionForIntentKey(previousIntentKey: string | null, nextIntentKey: string): boolean;
|
|
56
57
|
export declare function isInactiveCheckoutSessionError(message?: string | null): boolean;
|
|
57
58
|
export declare const shouldReportStripeCheckoutFailureShown: (message: string) => boolean;
|
|
@@ -37,7 +37,7 @@ export const buildStripeSubscriptionCheckoutPreparationAnalyticsMetadata = (anal
|
|
|
37
37
|
const _b = analyticsMetadata !== null && analyticsMetadata !== void 0 ? analyticsMetadata : {}, { payment_method: _paymentMethod, paymentMethod: _camelCasePaymentMethod } = _b, metadata = __rest(_b, ["payment_method", "paymentMethod"]);
|
|
38
38
|
return Object.assign(Object.assign(Object.assign({}, metadata), (checkoutStartSource ? { checkoutStartSource } : {})), (paymentMethod ? { payment_method: paymentMethod } : {}));
|
|
39
39
|
};
|
|
40
|
-
export function buildStripeSubscriptionCheckoutIntentKey({ checkoutMode, couponId, customerEmail, returnUrl, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, provider, stripePublishableKey, userId, }) {
|
|
40
|
+
export function buildStripeSubscriptionCheckoutIntentKey({ checkoutMode, couponId, customerEmail, returnUrl, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, planKey, provider, stripePublishableKey, userId, }) {
|
|
41
41
|
var _a;
|
|
42
42
|
const runtimeConfigSignature = [
|
|
43
43
|
normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.apiBaseUrl),
|
|
@@ -59,6 +59,7 @@ export function buildStripeSubscriptionCheckoutIntentKey({ checkoutMode, couponI
|
|
|
59
59
|
customerEmailSignature,
|
|
60
60
|
userIdSignature,
|
|
61
61
|
(couponId === null || couponId === void 0 ? void 0 : couponId.trim()) || '',
|
|
62
|
+
(planKey === null || planKey === void 0 ? void 0 : planKey.trim()) || '',
|
|
62
63
|
returnUrl.trim(),
|
|
63
64
|
].join('|');
|
|
64
65
|
}
|
|
@@ -87,10 +88,18 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
|
|
|
87
88
|
(isStripeConfigured(checkoutMode) ||
|
|
88
89
|
Boolean(normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelSdkPublishableKey)) ||
|
|
89
90
|
Boolean(normalizeRuntimeConfigValue(stripePublishableKey)));
|
|
91
|
+
const planKey = [
|
|
92
|
+
(_a = plan === null || plan === void 0 ? void 0 : plan.id) !== null && _a !== void 0 ? _a : '',
|
|
93
|
+
(_b = plan === null || plan === void 0 ? void 0 : plan.providerPlanId) !== null && _b !== void 0 ? _b : '',
|
|
94
|
+
(_c = plan === null || plan === void 0 ? void 0 : plan.amountCents) !== null && _c !== void 0 ? _c : '',
|
|
95
|
+
(_d = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.id) !== null && _d !== void 0 ? _d : '',
|
|
96
|
+
(_e = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.amountCents) !== null && _e !== void 0 ? _e : '',
|
|
97
|
+
].join('|');
|
|
90
98
|
const intentKey = buildStripeSubscriptionCheckoutIntentKey({
|
|
91
99
|
checkoutMode,
|
|
92
100
|
couponId,
|
|
93
101
|
customerEmail,
|
|
102
|
+
planKey,
|
|
94
103
|
returnUrl,
|
|
95
104
|
runtimeConfig,
|
|
96
105
|
runtimeConfigRevisionId,
|
|
@@ -99,13 +108,6 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
|
|
|
99
108
|
stripePublishableKey,
|
|
100
109
|
userId,
|
|
101
110
|
});
|
|
102
|
-
const planKey = [
|
|
103
|
-
(_a = plan === null || plan === void 0 ? void 0 : plan.id) !== null && _a !== void 0 ? _a : '',
|
|
104
|
-
(_b = plan === null || plan === void 0 ? void 0 : plan.providerPlanId) !== null && _b !== void 0 ? _b : '',
|
|
105
|
-
(_c = plan === null || plan === void 0 ? void 0 : plan.amountCents) !== null && _c !== void 0 ? _c : '',
|
|
106
|
-
(_d = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.id) !== null && _d !== void 0 ? _d : '',
|
|
107
|
-
(_e = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.amountCents) !== null && _e !== void 0 ? _e : '',
|
|
108
|
-
].join('|');
|
|
109
111
|
const activeClientSecret = clientSecretIntentKey === intentKey ? clientSecret : null;
|
|
110
112
|
const activeCheckoutSessionId = clientSecretIntentKey === intentKey ? checkoutSessionId : null;
|
|
111
113
|
const activePlanKey = clientSecretIntentKey === intentKey ? clientSecretPlanKey : null;
|