@funnelsgrove/payments 0.7.5 → 0.7.8

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.
@@ -105,29 +105,21 @@ export function SolidgateCheckoutDialog({ open, request, checkoutAnalytics, cont
105
105
  onStateChangeRef.current = onStateChange;
106
106
  onSuccessRef.current = onSuccess;
107
107
  }, [checkoutAnalytics, copy, onError, onStateChange, onSuccess]);
108
- const { discountKeyOrProviderId, failUrl, funnelEndUserId, funnelId, idempotencyKey, offerSetId, projectBillingPlanId, returnUrl, runtimeConfig, successUrl, } = request;
108
+ const { discountKeyOrProviderId, failUrl, funnelPlanKey, funnelEndUserId, funnelId, idempotencyKey, offerSetId, projectBillingPlanId, returnUrl, runtimeConfig, successUrl, } = request;
109
109
  const { apiBaseUrl, funnelId: runtimeFunnelId, funnelSdkPublishableKey, funnelVersionId, } = runtimeConfig || {};
110
110
  const hasRuntimeConfig = runtimeConfig !== undefined;
111
- const normalizedRequest = useMemo(() => ({
112
- funnelId: (funnelId === null || funnelId === void 0 ? void 0 : funnelId.trim()) || null,
113
- funnelEndUserId: funnelEndUserId.trim(),
114
- offerSetId: offerSetId.trim(),
115
- projectBillingPlanId: projectBillingPlanId.trim(),
116
- idempotencyKey: idempotencyKey.trim(),
117
- discountKeyOrProviderId: (discountKeyOrProviderId === null || discountKeyOrProviderId === void 0 ? void 0 : discountKeyOrProviderId.trim()) || null,
118
- returnUrl: returnUrl.trim(),
119
- successUrl: successUrl.trim(),
120
- failUrl: failUrl.trim(),
121
- runtimeConfig: hasRuntimeConfig ? {
111
+ const normalizedRequest = useMemo(() => (Object.assign(Object.assign({ funnelId: (funnelId === null || funnelId === void 0 ? void 0 : funnelId.trim()) || null, funnelEndUserId: funnelEndUserId.trim(), offerSetId: offerSetId.trim() }, (funnelPlanKey
112
+ ? { funnelPlanKey: funnelPlanKey.trim() }
113
+ : { projectBillingPlanId: (projectBillingPlanId === null || projectBillingPlanId === void 0 ? void 0 : projectBillingPlanId.trim()) || '' })), { idempotencyKey: idempotencyKey.trim(), discountKeyOrProviderId: (discountKeyOrProviderId === null || discountKeyOrProviderId === void 0 ? void 0 : discountKeyOrProviderId.trim()) || null, returnUrl: returnUrl.trim(), successUrl: successUrl.trim(), failUrl: failUrl.trim(), runtimeConfig: hasRuntimeConfig ? {
122
114
  apiBaseUrl: (apiBaseUrl === null || apiBaseUrl === void 0 ? void 0 : apiBaseUrl.trim()) || null,
123
115
  funnelId: (runtimeFunnelId === null || runtimeFunnelId === void 0 ? void 0 : runtimeFunnelId.trim()) || null,
124
116
  funnelVersionId: (funnelVersionId === null || funnelVersionId === void 0 ? void 0 : funnelVersionId.trim()) || null,
125
117
  funnelSdkPublishableKey: (funnelSdkPublishableKey === null || funnelSdkPublishableKey === void 0 ? void 0 : funnelSdkPublishableKey.trim()) || null,
126
- } : undefined,
127
- }), [
118
+ } : undefined })), [
128
119
  apiBaseUrl,
129
120
  discountKeyOrProviderId,
130
121
  failUrl,
122
+ funnelPlanKey,
131
123
  funnelEndUserId,
132
124
  funnelId,
133
125
  funnelSdkPublishableKey,
@@ -25,7 +25,9 @@ export type PrepareSolidgateCheckoutInput = {
25
25
  funnelId?: string | null;
26
26
  funnelEndUserId: string;
27
27
  offerSetId: string;
28
- projectBillingPlanId: string;
28
+ funnelPlanKey?: string | null;
29
+ /** @deprecated Published funnels may send this during the offer-set migration window. */
30
+ projectBillingPlanId?: string | null;
29
31
  idempotencyKey: string;
30
32
  discountKeyOrProviderId?: string | null;
31
33
  returnUrl: string;
@@ -99,17 +99,9 @@ const parseStatus = (value) => {
99
99
  };
100
100
  export const prepareSolidgateCheckout = async (input) => {
101
101
  var _a;
102
- return parsePreparation(await postJson('/sdk/public/payments/solidgate/checkout', {
103
- funnelId: resolveFunnelId(input.funnelId, input.runtimeConfig),
104
- funnelEndUserId: requiredString(input.funnelEndUserId, 'funnelEndUserId'),
105
- offerSetId: requiredString(input.offerSetId, 'offerSetId'),
106
- projectBillingPlanId: requiredString(input.projectBillingPlanId, 'projectBillingPlanId'),
107
- idempotencyKey: requiredString(input.idempotencyKey, 'idempotencyKey'),
108
- discountKeyOrProviderId: ((_a = input.discountKeyOrProviderId) === null || _a === void 0 ? void 0 : _a.trim()) || null,
109
- returnUrl: requiredString(input.returnUrl, 'returnUrl'),
110
- successUrl: requiredString(input.successUrl, 'successUrl'),
111
- failUrl: requiredString(input.failUrl, 'failUrl'),
112
- }, input.runtimeConfig, input.signal));
102
+ return parsePreparation(await postJson('/sdk/public/payments/solidgate/checkout', Object.assign(Object.assign({ funnelId: resolveFunnelId(input.funnelId, input.runtimeConfig), funnelEndUserId: requiredString(input.funnelEndUserId, 'funnelEndUserId'), offerSetId: requiredString(input.offerSetId, 'offerSetId') }, (input.funnelPlanKey
103
+ ? { funnelPlanKey: requiredString(input.funnelPlanKey, 'funnelPlanKey') }
104
+ : { projectBillingPlanId: requiredString(input.projectBillingPlanId, 'projectBillingPlanId') })), { idempotencyKey: requiredString(input.idempotencyKey, 'idempotencyKey'), discountKeyOrProviderId: ((_a = input.discountKeyOrProviderId) === null || _a === void 0 ? void 0 : _a.trim()) || null, returnUrl: requiredString(input.returnUrl, 'returnUrl'), successUrl: requiredString(input.successUrl, 'successUrl'), failUrl: requiredString(input.failUrl, 'failUrl') }), input.runtimeConfig, input.signal));
113
105
  };
114
106
  export const retrieveSolidgateCheckoutStatus = async (input) => {
115
107
  const attemptId = requiredString(input.attemptId, 'attemptId');
@@ -5,6 +5,7 @@ import type { RuntimeMode } from '@funnelsgrove/runtime';
5
5
  import { type RemoteProjectBillingPlan } from '../../../services/planCatalog.service.js';
6
6
  export type PaywallPlan = {
7
7
  id: string;
8
+ funnelPlanKey?: string;
8
9
  projectPlanId?: string;
9
10
  offerSetId?: string;
10
11
  offerSetKey?: string;
@@ -9,7 +9,7 @@ export const resolvePublishedBillingRuntime = ({ config, featureFlags, mode, sea
9
9
  pricingExperiments: resolvedExperiments.pricingExperiments,
10
10
  featureFlags,
11
11
  search,
12
- defaultOfferSetId,
12
+ defaultOfferSetId: defaultOfferSetId || (config === null || config === void 0 ? void 0 : config.defaultOfferSetId) || undefined,
13
13
  });
14
14
  const runtime = resolveGeneratedOfferSetRuntime({
15
15
  offerSets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.7.5",
3
+ "version": "0.7.8",
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.61",
36
- "@funnelsgrove/runtime": "^0.7.12",
35
+ "@funnelsgrove/analytics": "^0.1.67",
36
+ "@funnelsgrove/runtime": "^0.7.18",
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",