@funnelsgrove/payments 0.11.24 → 0.12.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.
Files changed (29) hide show
  1. package/README.md +14 -8
  2. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.d.ts +2 -66
  3. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.js +5 -524
  4. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.styles.d.ts +1 -0
  5. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.styles.js +400 -0
  6. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.types.d.ts +66 -0
  7. package/dist/providers/solidgate/components/SolidgateCheckoutSummary.d.ts +4 -0
  8. package/dist/providers/solidgate/components/SolidgateCheckoutSummary.js +15 -0
  9. package/dist/providers/solidgate/components/SolidgatePaymentForm.d.ts +12 -0
  10. package/dist/providers/solidgate/components/SolidgatePaymentForm.js +114 -0
  11. package/dist/providers/solidgate/services/solidgate.service.js +15 -18
  12. package/dist/providers/stripe/hooks/checkoutAttempt.js +0 -3
  13. package/dist/providers/stripe/hooks/checkoutIdentity.js +1 -5
  14. package/dist/providers/stripe/hooks/useStripeOneTimeCheckoutSession.js +1 -1
  15. package/dist/providers/stripe/hooks/useStripeSubscriptionCheckoutSession.js +1 -1
  16. package/dist/providers/stripe/services/hostedCheckout/requests.d.ts +7 -0
  17. package/dist/providers/stripe/services/hostedCheckout/requests.js +15 -8
  18. package/dist/providers/stripe/services/hostedCheckout/types.d.ts +6 -0
  19. package/dist/providers/stripe/services/stripe.service.d.ts +0 -1
  20. package/dist/providers/stripe/services/stripe.service.js +0 -1
  21. package/dist/services/checkoutObservability.service.js +1 -1
  22. package/dist/services/publishedBillingRuntime.service.js +4 -4
  23. package/package.json +3 -3
  24. package/dist/providers/stripe/services/paymentIntent/createPaymentIntent.d.ts +0 -5
  25. package/dist/providers/stripe/services/paymentIntent/createPaymentIntent.js +0 -8
  26. package/dist/providers/stripe/services/paymentIntent/requests.d.ts +0 -12
  27. package/dist/providers/stripe/services/paymentIntent/requests.js +0 -15
  28. package/dist/providers/stripe/services/paymentIntent/types.d.ts +0 -18
  29. /package/dist/providers/{stripe/services/paymentIntent/types.js → solidgate/components/SolidgateCheckoutDialog.types.js} +0 -0
@@ -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 : 'v1',
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 : 'v1',
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
- offerSetId: ((_a = input.plan.offerSetId) === null || _a === void 0 ? void 0 : _a.trim()) || undefined,
9
- offerSetKey: ((_b = input.plan.offerSetKey) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
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: ((_c = input.plan.providerPlanId) === null || _c === void 0 ? void 0 : _c.trim()) || undefined,
18
+ providerPlanId: ((_d = input.plan.providerPlanId) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
12
19
  title: input.plan.title,
13
- description: ((_d = input.plan.description) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
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: ((_e = input.couponId) === null || _e === void 0 ? void 0 : _e.trim()) || undefined,
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: ((_f = input.customerEmail) === null || _f === void 0 ? void 0 : _f.trim()) || undefined,
22
- userId: ((_g = input.user_id) === null || _g === void 0 ? void 0 : _g.trim()) || undefined,
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();
@@ -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, _h;
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: (_e = config === null || config === void 0 ? void 0 : config.paymentsApiVersion) !== null && _e !== void 0 ? _e : 'v1',
29
+ paymentsApiVersion: 'v2',
30
30
  mode,
31
31
  offerSetId: selection.offerSetId,
32
- paymentProfileId: ((_g = (_f = runtime.offerSet) === null || _f === void 0 ? void 0 : _f.paymentProfileId) === null || _g === void 0 ? void 0 : _g.trim()) || null,
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
- ? ((_h = paymentProviderConfig === null || paymentProviderConfig === void 0 ? void 0 : paymentProviderConfig.stripePublishableKey) === null || _h === void 0 ? void 0 : _h.trim()) || null
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.11.24",
3
+ "version": "0.12.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.86",
36
- "@funnelsgrove/runtime": "^0.11.5",
35
+ "@funnelsgrove/analytics": "^0.1.97",
36
+ "@funnelsgrove/runtime": "^0.12.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
- };