@funnelsgrove/payments 0.47.0 → 0.49.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.
@@ -1 +1 @@
1
- export declare const PAYMENTS_PACKAGE_VERSION = "0.47.0";
1
+ export declare const PAYMENTS_PACKAGE_VERSION = "0.49.0";
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/generate-package-version.mjs.
2
- export const PAYMENTS_PACKAGE_VERSION = "0.47.0";
2
+ export const PAYMENTS_PACKAGE_VERSION = "0.49.0";
@@ -1,4 +1,4 @@
1
- import { FUNNEL_ID, FUNNEL_SDK_PUBLISHABLE_KEY, buildMainApiUrl, resolvePreviewPaymentPublishableKey } from '@funnelsgrove/runtime';
1
+ import { FUNNEL_ID, FUNNEL_SDK_PUBLISHABLE_KEY, FUNNEL_VERSION_ID, buildMainApiUrl, resolvePreviewPaymentPublishableKey } from '@funnelsgrove/runtime';
2
2
  const record = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
3
3
  const checkoutErrorMessages = {
4
4
  checkout_unavailable: 'This PayPal checkout is no longer available. Please contact support before starting another purchase.',
@@ -31,8 +31,10 @@ async function request(input, path, signal, body) {
31
31
  return result;
32
32
  }
33
33
  export async function preparePayPalCheckout(input, idempotencyKey, signal) {
34
- var _a;
35
- const result = await request(input, '/sdk/public/v2/payments/checkout-sessions', signal, Object.assign(Object.assign({ provider: 'paypal', checkoutType: 'subscription', uiMode: 'custom', environment: input.environment, paymentProfileId: input.option.paymentProfileId, providerPlanId: input.option.providerPlanId }, (input.option.discountKey ? { couponId: input.option.discountKey } : {})), { funnelId: ((_a = input.runtimeConfig) === null || _a === void 0 ? void 0 : _a.funnelId) || FUNNEL_ID, funnelEndUserId: input.funnelEndUserId, offerSetId: input.offerSetId, planKey: input.funnelPlanKey, idempotencyKey, returnUrl: window.location.href, successUrl: window.location.href, failUrl: window.location.href }));
34
+ var _a, _b, _c;
35
+ // The server selects the plan from this loaded version, so a preview publish checks out its own bindings.
36
+ const funnelVersionId = ((_b = (_a = input.runtimeConfig) === null || _a === void 0 ? void 0 : _a.funnelVersionId) === null || _b === void 0 ? void 0 : _b.trim()) || FUNNEL_VERSION_ID.trim();
37
+ const result = await request(input, '/sdk/public/v2/payments/checkout-sessions', signal, Object.assign(Object.assign(Object.assign(Object.assign({ provider: 'paypal', checkoutType: 'subscription', uiMode: 'custom', environment: input.environment, paymentProfileId: input.option.paymentProfileId, providerPlanId: input.option.providerPlanId }, (input.option.discountKey ? { couponId: input.option.discountKey } : {})), { funnelId: ((_c = input.runtimeConfig) === null || _c === void 0 ? void 0 : _c.funnelId) || FUNNEL_ID }), (funnelVersionId ? { funnelVersionId } : {})), { funnelEndUserId: input.funnelEndUserId, offerSetId: input.offerSetId, planKey: input.funnelPlanKey, idempotencyKey, returnUrl: window.location.href, successUrl: window.location.href, failUrl: window.location.href }));
36
38
  const initialization = result.initialization;
37
39
  if (typeof result.attemptId !== 'string' || !result.attemptId || !record(initialization)
38
40
  || initialization.kind !== 'paypal' || initialization.clientId !== input.option.clientId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.47.0",
3
+ "version": "0.49.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",
@@ -46,11 +46,11 @@
46
46
  "jsdom": "20.0.3",
47
47
  "typescript": "^5",
48
48
  "vitest": "^3.2.4",
49
- "@funnelsgrove/runtime": "0.35.0",
50
- "@funnelsgrove/analytics": "0.17.0"
49
+ "@funnelsgrove/runtime": "0.36.0",
50
+ "@funnelsgrove/analytics": "0.18.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "@funnelsgrove/runtime": "^0.35.0",
54
- "@funnelsgrove/analytics": "^0.17.0"
53
+ "@funnelsgrove/runtime": "^0.36.0",
54
+ "@funnelsgrove/analytics": "^0.18.0"
55
55
  }
56
56
  }