@funnelsgrove/payments 0.1.31 → 0.1.32

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,5 +1,5 @@
1
1
  'use client';
2
- import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
2
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
3
3
  import { createEmptyCheckoutPreparationLoading, } from '../paymentProvider.types.js';
4
4
  import { createStripeSubscriptionCheckout, getStripePromise, isStripeConfigured, updateStripeSubscriptionCheckoutPlan, } from '../../services/stripe.service.js';
5
5
  const getFriendlyStripeCheckoutError = (error) => {
@@ -9,6 +9,7 @@ const getFriendlyStripeCheckoutError = (error) => {
9
9
  : message;
10
10
  };
11
11
  const normalizeRuntimeConfigValue = (value) => (value === null || value === void 0 ? void 0 : value.trim()) || '';
12
+ const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
12
13
  export function buildStripeSubscriptionCheckoutIntentKey({ checkoutMode, couponId, customerEmail, returnUrl, runtimeConfig, userId, }) {
13
14
  const runtimeConfigSignature = [
14
15
  normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.apiBaseUrl),
@@ -93,7 +94,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
93
94
  setRuntimeStripePublishableKey(null);
94
95
  setError(null);
95
96
  }, [clearActiveCheckoutSession, setError]);
96
- useEffect(() => {
97
+ useIsomorphicLayoutEffect(() => {
97
98
  const previousIntentKey = previousIntentKeyRef.current;
98
99
  previousIntentKeyRef.current = intentKey;
99
100
  if (shouldResetStripeSubscriptionCheckoutSessionForIntentKey(previousIntentKey, intentKey)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",