@funnelsgrove/payments 0.11.26 → 0.13.0
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 +12 -7
- package/dist/providers/solidgate/services/solidgate.service.js +15 -20
- package/dist/providers/stripe/hooks/checkoutAttempt.d.ts +1 -1
- package/dist/providers/stripe/hooks/checkoutAttempt.js +0 -3
- package/dist/providers/stripe/hooks/checkoutIdentity.d.ts +1 -1
- package/dist/providers/stripe/hooks/checkoutIdentity.js +1 -5
- package/dist/providers/stripe/hooks/useStripeOneTimeCheckoutSession.js +1 -1
- package/dist/providers/stripe/hooks/useStripeSubscriptionCheckoutSession.js +1 -1
- package/dist/providers/stripe/services/hostedCheckout/requests.d.ts +7 -0
- package/dist/providers/stripe/services/hostedCheckout/requests.js +15 -8
- package/dist/providers/stripe/services/hostedCheckout/types.d.ts +6 -0
- package/dist/providers/stripe/services/stripe.service.d.ts +0 -1
- package/dist/providers/stripe/services/stripe.service.js +0 -1
- package/dist/services/checkoutObservability.service.js +1 -1
- package/dist/services/publishedBillingRuntime.service.d.ts +1 -1
- package/dist/services/publishedBillingRuntime.service.js +4 -4
- package/package.json +3 -3
- package/dist/providers/stripe/services/paymentIntent/createPaymentIntent.d.ts +0 -5
- package/dist/providers/stripe/services/paymentIntent/createPaymentIntent.js +0 -8
- package/dist/providers/stripe/services/paymentIntent/requests.d.ts +0 -12
- package/dist/providers/stripe/services/paymentIntent/requests.js +0 -15
- package/dist/providers/stripe/services/paymentIntent/types.d.ts +0 -18
- package/dist/providers/stripe/services/paymentIntent/types.js +0 -1
package/README.md
CHANGED
|
@@ -55,7 +55,6 @@ provider-neutral status endpoint finds canonical shared-ledger payment evidence.
|
|
|
55
55
|
|
|
56
56
|
Keep these exports available for saved drafts, old published artifacts, and controlled migrations. Do not use them for new subscription checkout work:
|
|
57
57
|
|
|
58
|
-
- `createStripePaymentIntent`
|
|
59
58
|
- `SharedStripeCheckoutDialog`
|
|
60
59
|
- `ApplePaySubscribeButton`
|
|
61
60
|
- `GooglePaySubscribeButton`
|
|
@@ -93,7 +92,7 @@ When a live funnel still uses one of these, migrate the funnel deliberately with
|
|
|
93
92
|
- `services/runtimeBillingPlanCatalog.service`: test/live runtime catalog selection.
|
|
94
93
|
- `services/paywallOffer.service`: timed discount and display-plan helpers.
|
|
95
94
|
- `providers/paymentProvider.types`: provider-neutral checkout state shared by every adapter.
|
|
96
|
-
- `providers/stripe/services/*`: Stripe loader, Checkout Session, hosted checkout, one-click, analytics, and
|
|
95
|
+
- `providers/stripe/services/*`: Stripe loader, Checkout Session, hosted checkout, one-click, analytics, and one-click completion.
|
|
97
96
|
- `providers/stripe/hooks/*`: Stripe-backed plan resolution and isolated card/wallet checkout-session state.
|
|
98
97
|
- `providers/stripe/components/*`: plan selector, checkout dialogs, Express Checkout wrappers, wallet slots, placeholders, and trust assets.
|
|
99
98
|
- `providers/stripe/testing/*`: Stripe wallet checkout smoke assertions.
|
|
@@ -112,16 +111,22 @@ service just to resolve or display plans. Shared config/services are checked for
|
|
|
112
111
|
provider dependencies in `paymentBoundaries.test.ts`.
|
|
113
112
|
|
|
114
113
|
Stripe browser operations live in `providers/stripe/services/checkout/`,
|
|
115
|
-
`hostedCheckout
|
|
114
|
+
`hostedCheckout/` and `oneClick/`.
|
|
116
115
|
Keep request mappers (`requests.ts`) beside the short async operation functions;
|
|
117
116
|
common validation and metadata normalization belong in the local `shared/` folder.
|
|
118
117
|
`stripeClient.ts` owns the Stripe.js cache. One-click orchestration calls the
|
|
119
118
|
charge and confirmation functions in its own folder, without a workflow layer.
|
|
120
119
|
|
|
121
|
-
`stripe.service.ts`
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
`stripe.service.ts` is the public export facade. From 0.12.0, all payment
|
|
121
|
+
transport uses V2. `createStripePaymentIntent` is removed: migrate to
|
|
122
|
+
`createStripeOneTimeCheckout` and its Checkout Session UI. Keep legacy published
|
|
123
|
+
bundles on their pinned releases until their own migration passes checkout QA.
|
|
124
|
+
Hosted checkout uses `createStripeCheckoutSession` with published profile,
|
|
125
|
+
provider and plan selection plus `successUrl` and `cancelUrl`. Deploy hosted V2
|
|
126
|
+
support before releasing this SDK. Subscription mutation callers forward the
|
|
127
|
+
listed `subscriptionRef`; no provider ownership is reconstructed in the browser.
|
|
128
|
+
HTTP transport belongs to the runtime SDK. No charge retry, V1 fallback or extra
|
|
129
|
+
conversion event is introduced.
|
|
125
130
|
|
|
126
131
|
## Engineering Rules
|
|
127
132
|
|
|
@@ -110,18 +110,15 @@ const parseStatus = (value) => {
|
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
export const prepareSolidgateCheckout = async (input) => {
|
|
113
|
-
var _a, _b, _c
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const providerPlanId = ((_c = input.providerPlanId) === null || _c === void 0 ? void 0 : _c.trim()) || null;
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
const paymentProfileId = ((_a = input.paymentProfileId) === null || _a === void 0 ? void 0 : _a.trim()) || null;
|
|
115
|
+
const providerPlanId = ((_b = input.providerPlanId) === null || _b === void 0 ? void 0 : _b.trim()) || null;
|
|
117
116
|
const checkoutType = input.checkoutType || null;
|
|
118
117
|
const environment = input.environment || null;
|
|
119
|
-
if (
|
|
118
|
+
if (!paymentProfileId || !providerPlanId || !checkoutType || !environment) {
|
|
120
119
|
throw new Error('Solidgate V2 checkout selection is incomplete');
|
|
121
120
|
}
|
|
122
|
-
return parsePreparation(await postJson(
|
|
123
|
-
? '/sdk/public/v2/payments/checkout-sessions'
|
|
124
|
-
: '/sdk/public/payments/solidgate/checkout', Object.assign(Object.assign(Object.assign(Object.assign({}, (useV2 ? {
|
|
121
|
+
return parsePreparation(await postJson('/sdk/public/v2/payments/checkout-sessions', {
|
|
125
122
|
checkoutType,
|
|
126
123
|
uiMode: 'custom',
|
|
127
124
|
environment,
|
|
@@ -129,23 +126,21 @@ export const prepareSolidgateCheckout = async (input) => {
|
|
|
129
126
|
provider: 'solidgate',
|
|
130
127
|
providerPlanId,
|
|
131
128
|
planKey: requiredString(input.funnelPlanKey, 'funnelPlanKey'),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
:
|
|
129
|
+
funnelId: resolveFunnelId(input.funnelId, input.runtimeConfig),
|
|
130
|
+
funnelEndUserId: requiredString(input.funnelEndUserId, 'funnelEndUserId'),
|
|
131
|
+
offerSetId: requiredString(input.offerSetId, 'offerSetId'),
|
|
132
|
+
idempotencyKey: requiredString(input.idempotencyKey, 'idempotencyKey'),
|
|
133
|
+
couponId: ((_c = input.discountKeyOrProviderId) === null || _c === void 0 ? void 0 : _c.trim()) || null,
|
|
134
|
+
returnUrl: requiredString(input.returnUrl, 'returnUrl'),
|
|
135
|
+
successUrl: requiredString(input.successUrl, 'successUrl'),
|
|
136
|
+
failUrl: requiredString(input.failUrl, 'failUrl'),
|
|
137
|
+
}, input.runtimeConfig, input.signal));
|
|
135
138
|
};
|
|
136
139
|
export const retrieveSolidgateCheckoutStatus = async (input) => {
|
|
137
|
-
var _a;
|
|
138
140
|
const attemptId = requiredString(input.attemptId, 'attemptId');
|
|
139
|
-
const useV2 = ((_a = input.runtimeConfig) === null || _a === void 0 ? void 0 : _a.paymentsApiVersion) === 'v2';
|
|
140
141
|
const funnelId = resolveFunnelId(input.funnelId, input.runtimeConfig);
|
|
141
142
|
const funnelEndUserId = requiredString(input.funnelEndUserId, 'funnelEndUserId');
|
|
142
|
-
const result = parseStatus(await (
|
|
143
|
-
? getJson(`/sdk/public/v2/payments/checkout-sessions/${encodeURIComponent(attemptId)}?provider=solidgate&funnelId=${encodeURIComponent(funnelId)}&funnelEndUserId=${encodeURIComponent(funnelEndUserId)}`, input.runtimeConfig, input.signal)
|
|
144
|
-
: postJson('/sdk/public/payments/solidgate/checkout/status', {
|
|
145
|
-
funnelId: resolveFunnelId(input.funnelId, input.runtimeConfig),
|
|
146
|
-
funnelEndUserId,
|
|
147
|
-
attemptId,
|
|
148
|
-
}, input.runtimeConfig, input.signal)));
|
|
143
|
+
const result = parseStatus(await getJson(`/sdk/public/v2/payments/checkout-sessions/${encodeURIComponent(attemptId)}?provider=solidgate&funnelId=${encodeURIComponent(funnelId)}&funnelEndUserId=${encodeURIComponent(funnelEndUserId)}`, input.runtimeConfig, input.signal));
|
|
149
144
|
if (result.attemptId !== attemptId) {
|
|
150
145
|
throw new Error('Solidgate checkout status returned the wrong attempt');
|
|
151
146
|
}
|
|
@@ -8,7 +8,7 @@ export declare const resolveStripeCheckoutAttempt: (input: {
|
|
|
8
8
|
current: StripeCheckoutAttempt | null;
|
|
9
9
|
forceNew: boolean;
|
|
10
10
|
intentKey: string;
|
|
11
|
-
paymentsApiVersion?: "
|
|
11
|
+
paymentsApiVersion?: "v2" | null;
|
|
12
12
|
createId: () => string;
|
|
13
13
|
nowMs?: number;
|
|
14
14
|
}) => StripeCheckoutAttempt | null;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export const STRIPE_CHECKOUT_ATTEMPT_RETRY_WINDOW_MS = 20 * 60 * 1000;
|
|
2
2
|
export const resolveStripeCheckoutAttempt = (input) => {
|
|
3
3
|
var _a, _b;
|
|
4
|
-
if (input.paymentsApiVersion !== 'v2') {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
4
|
const nowMs = (_a = input.nowMs) !== null && _a !== void 0 ? _a : Date.now();
|
|
8
5
|
if (!input.forceNew
|
|
9
6
|
&& ((_b = input.current) === null || _b === void 0 ? void 0 : _b.key) === input.intentKey
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CheckoutIdentityStatus } from '@funnelsgrove/runtime';
|
|
2
2
|
export declare const isStripeCheckoutIdentityReady: (input: {
|
|
3
3
|
runtimeConfig?: {
|
|
4
|
-
paymentsApiVersion?: "
|
|
4
|
+
paymentsApiVersion?: "v2" | null;
|
|
5
5
|
} | null;
|
|
6
6
|
userId?: string | null;
|
|
7
7
|
}, getIdentityStatus?: (userId: string | null | undefined) => CheckoutIdentityStatus) => boolean;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
import { getCheckoutIdentityStatus, } from '@funnelsgrove/runtime';
|
|
2
|
-
export const isStripeCheckoutIdentityReady = (input, getIdentityStatus = getCheckoutIdentityStatus) =>
|
|
3
|
-
var _a;
|
|
4
|
-
return ((_a = input.runtimeConfig) === null || _a === void 0 ? void 0 : _a.paymentsApiVersion) !== 'v2'
|
|
5
|
-
|| getIdentityStatus(input.userId) !== 'pending';
|
|
6
|
-
};
|
|
2
|
+
export const isStripeCheckoutIdentityReady = (input, getIdentityStatus = getCheckoutIdentityStatus) => getIdentityStatus(input.userId) !== 'pending';
|
|
@@ -42,7 +42,7 @@ export const buildStripeOneTimeCheckoutPreparationAnalyticsMetadata = (analytics
|
|
|
42
42
|
export function buildStripeOneTimeCheckoutIntentKey({ runtimeConfigRevisionId, paymentProfileId, provider, checkoutMode, couponId, customerEmail, plan, returnUrl, runtimeConfig, stripePublishableKey, userId, }) {
|
|
43
43
|
var _a, _b, _c, _d;
|
|
44
44
|
const runtimeConfigSignature = [
|
|
45
|
-
(_a = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.paymentsApiVersion) !== null && _a !== void 0 ? _a : '
|
|
45
|
+
(_a = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.paymentsApiVersion) !== null && _a !== void 0 ? _a : 'v2',
|
|
46
46
|
runtimeConfigRevisionId !== null && runtimeConfigRevisionId !== void 0 ? runtimeConfigRevisionId : '',
|
|
47
47
|
paymentProfileId !== null && paymentProfileId !== void 0 ? paymentProfileId : '',
|
|
48
48
|
provider !== null && provider !== void 0 ? provider : '',
|
|
@@ -46,7 +46,7 @@ export function buildStripeSubscriptionCheckoutIntentKey({ checkoutMode, couponI
|
|
|
46
46
|
normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelId),
|
|
47
47
|
normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelVersionId),
|
|
48
48
|
normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelSdkPublishableKey),
|
|
49
|
-
(_a = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.paymentsApiVersion) !== null && _a !== void 0 ? _a : '
|
|
49
|
+
(_a = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.paymentsApiVersion) !== null && _a !== void 0 ? _a : 'v2',
|
|
50
50
|
normalizeRuntimeConfigValue(runtimeConfigRevisionId),
|
|
51
51
|
normalizeRuntimeConfigValue(paymentProfileId),
|
|
52
52
|
provider !== null && provider !== void 0 ? provider : '',
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { CreateCheckoutSessionInput } from './types.js';
|
|
2
2
|
export declare const toHostedCheckoutRequest: (input: CreateCheckoutSessionInput) => {
|
|
3
|
+
planKey: string;
|
|
4
|
+
paymentProfileId: string | null | undefined;
|
|
5
|
+
provider: "stripe" | null | undefined;
|
|
6
|
+
runtimeConfigRevisionId: string | null | undefined;
|
|
7
|
+
anonymousUserId: string | null | undefined;
|
|
8
|
+
checkoutIdentityToken: string | null | undefined;
|
|
9
|
+
idempotencyKey: string | null | undefined;
|
|
3
10
|
offerSetId: string | undefined;
|
|
4
11
|
offerSetKey: string | undefined;
|
|
5
12
|
planId: string;
|
|
@@ -2,24 +2,31 @@ import { requireCheckoutRecurringConfig } from '../shared/checkout.validator.js'
|
|
|
2
2
|
import { getPaywallPlanRequestId } from '../../../../services/paywallPlans/selection.js';
|
|
3
3
|
import { normalizeCheckoutAnalyticsMetadata } from '../shared/checkoutMetadata.js';
|
|
4
4
|
export const toHostedCheckoutRequest = (input) => {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6
6
|
const recurring = requireCheckoutRecurringConfig(input.plan);
|
|
7
7
|
return {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
planKey: ((_a = input.plan.funnelPlanKey) === null || _a === void 0 ? void 0 : _a.trim()) || input.plan.id,
|
|
9
|
+
paymentProfileId: input.paymentProfileId,
|
|
10
|
+
provider: input.provider,
|
|
11
|
+
runtimeConfigRevisionId: input.runtimeConfigRevisionId,
|
|
12
|
+
anonymousUserId: input.anonymousUserId,
|
|
13
|
+
checkoutIdentityToken: input.checkoutIdentityToken,
|
|
14
|
+
idempotencyKey: input.idempotencyKey,
|
|
15
|
+
offerSetId: ((_b = input.plan.offerSetId) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
|
|
16
|
+
offerSetKey: ((_c = input.plan.offerSetKey) === null || _c === void 0 ? void 0 : _c.trim()) || undefined,
|
|
10
17
|
planId: getPaywallPlanRequestId(input.plan),
|
|
11
|
-
providerPlanId: ((
|
|
18
|
+
providerPlanId: ((_d = input.plan.providerPlanId) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
|
|
12
19
|
title: input.plan.title,
|
|
13
|
-
description: ((
|
|
20
|
+
description: ((_e = input.plan.description) === null || _e === void 0 ? void 0 : _e.trim()) || undefined,
|
|
14
21
|
amountCents: input.plan.amountCents,
|
|
15
22
|
billingInterval: recurring.interval,
|
|
16
23
|
billingIntervalCount: recurring.intervalCount,
|
|
17
|
-
couponId: ((
|
|
24
|
+
couponId: ((_f = input.couponId) === null || _f === void 0 ? void 0 : _f.trim()) || undefined,
|
|
18
25
|
analyticsMetadata: normalizeCheckoutAnalyticsMetadata(input.analyticsMetadata, input.plan),
|
|
19
26
|
successUrl: input.successUrl,
|
|
20
27
|
cancelUrl: input.cancelUrl,
|
|
21
|
-
customerEmail: ((
|
|
22
|
-
userId: ((
|
|
28
|
+
customerEmail: ((_g = input.customerEmail) === null || _g === void 0 ? void 0 : _g.trim()) || undefined,
|
|
29
|
+
userId: ((_h = input.user_id) === null || _h === void 0 ? void 0 : _h.trim()) || undefined,
|
|
23
30
|
environment: input.environment,
|
|
24
31
|
runtimeConfig: input.runtimeConfig,
|
|
25
32
|
};
|
|
@@ -3,6 +3,12 @@ import type { RuntimeMode } from '@funnelsgrove/runtime';
|
|
|
3
3
|
import type { StripeRuntimeConfigOverrides } from '../shared/types.js';
|
|
4
4
|
export type CreateCheckoutSessionInput = {
|
|
5
5
|
plan: CheckoutSessionPlanInput;
|
|
6
|
+
runtimeConfigRevisionId?: string | null;
|
|
7
|
+
paymentProfileId?: string | null;
|
|
8
|
+
provider?: 'stripe' | null;
|
|
9
|
+
anonymousUserId?: string | null;
|
|
10
|
+
checkoutIdentityToken?: string | null;
|
|
11
|
+
idempotencyKey?: string | null;
|
|
6
12
|
successUrl: string;
|
|
7
13
|
cancelUrl: string;
|
|
8
14
|
couponId?: string | null;
|
|
@@ -12,7 +12,6 @@ export { isStripeConfigured } from './stripeClient.js';
|
|
|
12
12
|
export { getStripePromise } from './stripeClient.js';
|
|
13
13
|
export { resolveCheckoutPlanRecurringConfig } from '../../../services/paywallPlans/recurring.js';
|
|
14
14
|
export { createStripeOneTimeCheckout } from './checkout/createOneTimeCheckout.js';
|
|
15
|
-
export { createStripePaymentIntent } from './paymentIntent/createPaymentIntent.js';
|
|
16
15
|
export type { ChargeOneClickPaymentInput } from './oneClick/types.js';
|
|
17
16
|
export type { ChargeOneClickPaymentResponse } from './oneClick/types.js';
|
|
18
17
|
export { chargeStripeOneClickPayment } from './oneClick/chargePayment.js';
|
|
@@ -9,7 +9,6 @@ export { isStripeConfigured } from './stripeClient.js';
|
|
|
9
9
|
export { getStripePromise } from './stripeClient.js';
|
|
10
10
|
export { resolveCheckoutPlanRecurringConfig } from '../../../services/paywallPlans/recurring.js';
|
|
11
11
|
export { createStripeOneTimeCheckout } from './checkout/createOneTimeCheckout.js';
|
|
12
|
-
export { createStripePaymentIntent } from './paymentIntent/createPaymentIntent.js';
|
|
13
12
|
export { chargeStripeOneClickPayment } from './oneClick/chargePayment.js';
|
|
14
13
|
export { requiresStripeOneClickConfirmation } from './oneClick/completePayment.js';
|
|
15
14
|
export { completeStripeOneClickPayment } from './oneClick/completePayment.js';
|
|
@@ -80,7 +80,7 @@ const reportCheckoutObservability = (input) => {
|
|
|
80
80
|
if (!funnelId || !environment) {
|
|
81
81
|
return Promise.resolve();
|
|
82
82
|
}
|
|
83
|
-
const path = '/sdk/public/payments/checkout-observability';
|
|
83
|
+
const path = '/sdk/public/v2/payments/checkout-observability';
|
|
84
84
|
const baseUrl = (_e = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.apiBaseUrl) === null || _e === void 0 ? void 0 : _e.trim().replace(/\/+$/, '');
|
|
85
85
|
const url = baseUrl ? `${baseUrl}${path}` : buildMainApiUrl(path);
|
|
86
86
|
const publishableKey = (_f = runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelSdkPublishableKey) === null || _f === void 0 ? void 0 : _f.trim();
|
|
@@ -4,7 +4,7 @@ import { type PaywallPlan } from './paywallPlans.service.js';
|
|
|
4
4
|
export type PublishedBillingPlan = BillingFallbackPlanConfig & OfferSetRuntimePlanOverrides;
|
|
5
5
|
export type ResolvedPublishedBillingRuntime = {
|
|
6
6
|
revisionId: string | null;
|
|
7
|
-
paymentsApiVersion: '
|
|
7
|
+
paymentsApiVersion: 'v2';
|
|
8
8
|
mode: RuntimeMode;
|
|
9
9
|
offerSetId: string;
|
|
10
10
|
paymentProfileId: string | null;
|
|
@@ -2,7 +2,7 @@ import { resolveGeneratedOfferSetRuntime, resolvePublishedOfferSetSelection, res
|
|
|
2
2
|
import { buildBillingDiscountCatalog } from './paywallOffer.service.js';
|
|
3
3
|
import { buildConfigPaywallPlans, } from './paywallPlans.service.js';
|
|
4
4
|
export const resolvePublishedBillingRuntime = ({ config, featureFlags, mode, search = '', defaultOfferSetId, baseCatalogsByMode, fallbackDiscounts, resolvedExperiments = resolvePublishedRuntimeExperiments(config), }) => {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6
6
|
const offerSets = (_a = config === null || config === void 0 ? void 0 : config.offerSets) !== null && _a !== void 0 ? _a : [];
|
|
7
7
|
const selection = resolvePublishedOfferSetSelection({
|
|
8
8
|
offerSets,
|
|
@@ -26,13 +26,13 @@ export const resolvePublishedBillingRuntime = ({ config, featureFlags, mode, sea
|
|
|
26
26
|
const paymentProviderConfig = (_c = (_b = runtime.offerSet) === null || _b === void 0 ? void 0 : _b.paymentProviderConfigByMode) === null || _c === void 0 ? void 0 : _c[mode];
|
|
27
27
|
return {
|
|
28
28
|
revisionId: (_d = config === null || config === void 0 ? void 0 : config.revisionId) !== null && _d !== void 0 ? _d : null,
|
|
29
|
-
paymentsApiVersion:
|
|
29
|
+
paymentsApiVersion: 'v2',
|
|
30
30
|
mode,
|
|
31
31
|
offerSetId: selection.offerSetId,
|
|
32
|
-
paymentProfileId: ((
|
|
32
|
+
paymentProfileId: ((_f = (_e = runtime.offerSet) === null || _e === void 0 ? void 0 : _e.paymentProfileId) === null || _f === void 0 ? void 0 : _f.trim()) || null,
|
|
33
33
|
provider,
|
|
34
34
|
stripePublishableKey: provider === 'stripe' && (paymentProviderConfig === null || paymentProviderConfig === void 0 ? void 0 : paymentProviderConfig.provider) === 'stripe'
|
|
35
|
-
? ((
|
|
35
|
+
? ((_g = paymentProviderConfig === null || paymentProviderConfig === void 0 ? void 0 : paymentProviderConfig.stripePublishableKey) === null || _g === void 0 ? void 0 : _g.trim()) || null
|
|
36
36
|
: null,
|
|
37
37
|
experimentId: selection.experimentId,
|
|
38
38
|
variantKey: selection.variantKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnelsgrove/payments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test:run": "vitest run --passWithNoTests"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@funnelsgrove/analytics": "^0.1.
|
|
36
|
-
"@funnelsgrove/runtime": "^0.
|
|
35
|
+
"@funnelsgrove/analytics": "^0.1.97",
|
|
36
|
+
"@funnelsgrove/runtime": "^0.13.0",
|
|
37
37
|
"@solidgate/react-sdk": "1.34.0",
|
|
38
38
|
"@stripe/react-stripe-js": "^5.6.0",
|
|
39
39
|
"@stripe/stripe-js": "^8.7.0",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CreatePaymentIntentInput, CreatePaymentIntentResponse } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Use createStripeOneTimeCheckout for one-time paywall checkout.
|
|
4
|
-
*/
|
|
5
|
-
export declare function createStripePaymentIntent(input: CreatePaymentIntentInput): Promise<CreatePaymentIntentResponse>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { funnelSdkService } from '@funnelsgrove/runtime';
|
|
2
|
-
import { toPaymentIntentRequest } from './requests.js';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use createStripeOneTimeCheckout for one-time paywall checkout.
|
|
5
|
-
*/
|
|
6
|
-
export async function createStripePaymentIntent(input) {
|
|
7
|
-
return funnelSdkService.createOneTimePaymentIntent(toPaymentIntentRequest(input));
|
|
8
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CreatePaymentIntentInput } from './types.js';
|
|
2
|
-
export declare const toPaymentIntentRequest: (input: CreatePaymentIntentInput) => {
|
|
3
|
-
offerSetId: string | undefined;
|
|
4
|
-
offerSetKey: string | undefined;
|
|
5
|
-
planId: string;
|
|
6
|
-
amountCents: number;
|
|
7
|
-
couponId: string | undefined;
|
|
8
|
-
analyticsMetadata: Record<string, unknown> | undefined;
|
|
9
|
-
userId: string | undefined;
|
|
10
|
-
environment: import("@funnelsgrove/runtime").RuntimeMode | undefined;
|
|
11
|
-
runtimeConfig: import("@funnelsgrove/runtime").FunnelSdkRuntimeConfigOverrides | undefined;
|
|
12
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { normalizeAnalyticsMetadata } from '../shared/checkoutMetadata.js';
|
|
2
|
-
export const toPaymentIntentRequest = (input) => {
|
|
3
|
-
var _a, _b, _c, _d;
|
|
4
|
-
return {
|
|
5
|
-
offerSetId: ((_a = input.offerSetId) === null || _a === void 0 ? void 0 : _a.trim()) || undefined,
|
|
6
|
-
offerSetKey: ((_b = input.offerSetKey) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
|
|
7
|
-
planId: input.planId,
|
|
8
|
-
amountCents: input.amountCents,
|
|
9
|
-
couponId: ((_c = input.couponId) === null || _c === void 0 ? void 0 : _c.trim()) || undefined,
|
|
10
|
-
analyticsMetadata: normalizeAnalyticsMetadata(input.analyticsMetadata),
|
|
11
|
-
userId: ((_d = input.user_id) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
|
|
12
|
-
environment: input.environment,
|
|
13
|
-
runtimeConfig: input.runtimeConfig,
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { RuntimeMode } from '@funnelsgrove/runtime';
|
|
2
|
-
import type { StripeRuntimeConfigOverrides } from '../shared/types.js';
|
|
3
|
-
export type CreatePaymentIntentInput = {
|
|
4
|
-
planId: string;
|
|
5
|
-
offerSetId?: string | null;
|
|
6
|
-
offerSetKey?: string | null;
|
|
7
|
-
amountCents: number;
|
|
8
|
-
couponId?: string | null;
|
|
9
|
-
analyticsMetadata?: Record<string, unknown> | null;
|
|
10
|
-
user_id?: string | null;
|
|
11
|
-
environment?: RuntimeMode;
|
|
12
|
-
runtimeConfig?: StripeRuntimeConfigOverrides;
|
|
13
|
-
};
|
|
14
|
-
export type CreatePaymentIntentResponse = {
|
|
15
|
-
clientSecret: string;
|
|
16
|
-
stripePublishableKey?: string;
|
|
17
|
-
environment?: 'test' | 'live';
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|