@schematichq/schematic-components 2.0.1 → 2.0.2

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.
@@ -4,13 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
8
- get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
9
- }) : x2)(function(x2) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x2 + '" is not supported');
12
- });
13
- var __commonJS = (cb, mod) => function __require2() {
7
+ var __commonJS = (cb, mod) => function __require() {
14
8
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
9
  };
16
10
  var __copyProps = (to, from2, except, desc) => {
@@ -89,82 +83,6 @@ var require_void_elements = __commonJS({
89
83
  }
90
84
  });
91
85
 
92
- // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
93
- var require_use_sync_external_store_shim_development = __commonJS({
94
- "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
95
- "use strict";
96
- (function() {
97
- function is(x2, y2) {
98
- return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
99
- }
100
- function useSyncExternalStore$2(subscribe, getSnapshot) {
101
- didWarnOld18Alpha || void 0 === React3.startTransition || (didWarnOld18Alpha = true, console.error(
102
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
103
- ));
104
- var value = getSnapshot();
105
- if (!didWarnUncachedGetSnapshot) {
106
- var cachedValue = getSnapshot();
107
- objectIs(value, cachedValue) || (console.error(
108
- "The result of getSnapshot should be cached to avoid an infinite loop"
109
- ), didWarnUncachedGetSnapshot = true);
110
- }
111
- cachedValue = useState21({
112
- inst: { value, getSnapshot }
113
- });
114
- var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
115
- useLayoutEffect6(
116
- function() {
117
- inst.value = value;
118
- inst.getSnapshot = getSnapshot;
119
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
120
- },
121
- [subscribe, value, getSnapshot]
122
- );
123
- useEffect11(
124
- function() {
125
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
126
- return subscribe(function() {
127
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
128
- });
129
- },
130
- [subscribe]
131
- );
132
- useDebugValue(value);
133
- return value;
134
- }
135
- function checkIfSnapshotChanged(inst) {
136
- var latestGetSnapshot = inst.getSnapshot;
137
- inst = inst.value;
138
- try {
139
- var nextValue = latestGetSnapshot();
140
- return !objectIs(inst, nextValue);
141
- } catch (error) {
142
- return true;
143
- }
144
- }
145
- function useSyncExternalStore$1(subscribe, getSnapshot) {
146
- return getSnapshot();
147
- }
148
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
149
- var React3 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState21 = React3.useState, useEffect11 = React3.useEffect, useLayoutEffect6 = React3.useLayoutEffect, useDebugValue = React3.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
150
- exports.useSyncExternalStore = void 0 !== React3.useSyncExternalStore ? React3.useSyncExternalStore : shim;
151
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
152
- })();
153
- }
154
- });
155
-
156
- // node_modules/use-sync-external-store/shim/index.js
157
- var require_shim = __commonJS({
158
- "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
159
- "use strict";
160
- if (false) {
161
- module.exports = null;
162
- } else {
163
- module.exports = require_use_sync_external_store_shim_development();
164
- }
165
- }
166
- });
167
-
168
86
  // node_modules/lodash/isObject.js
169
87
  var require_isObject = __commonJS({
170
88
  "node_modules/lodash/isObject.js"(exports, module) {
@@ -7157,19 +7075,16 @@ function IcuTrans({
7157
7075
  IcuTrans.displayName = "IcuTrans";
7158
7076
 
7159
7077
  // node_modules/react-i18next/dist/es/useTranslation.js
7160
- var import_shim = __toESM(require_shim(), 1);
7161
- import { useContext as useContext3, useCallback as useCallback2, useMemo as useMemo2, useEffect, useRef, useState } from "react";
7162
- var notReadyT = (k2, optsOrDefaultValue) => {
7163
- if (isString2(optsOrDefaultValue)) return optsOrDefaultValue;
7164
- if (isObject(optsOrDefaultValue) && isString2(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
7165
- return Array.isArray(k2) ? k2[k2.length - 1] : k2;
7166
- };
7167
- var notReadySnapshot = {
7168
- t: notReadyT,
7169
- ready: false
7170
- };
7171
- var dummySubscribe = () => () => {
7078
+ import { useState, useEffect, useContext as useContext3, useRef, useCallback as useCallback2 } from "react";
7079
+ var usePrevious = (value, ignore) => {
7080
+ const ref = useRef();
7081
+ useEffect(() => {
7082
+ ref.current = ignore ? ref.current : value;
7083
+ }, [value, ignore]);
7084
+ return ref.current;
7172
7085
  };
7086
+ var alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
7087
+ var useMemoizedT = (i18n, language, namespace, keyPrefix) => useCallback2(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
7173
7088
  var useTranslation = (ns, props = {}) => {
7174
7089
  const {
7175
7090
  i18n: i18nFromProps
@@ -7182,103 +7097,95 @@ var useTranslation = (ns, props = {}) => {
7182
7097
  if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
7183
7098
  if (!i18n) {
7184
7099
  warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
7185
- }
7186
- const i18nOptions = useMemo2(() => ({
7100
+ const notReadyT = (k2, optsOrDefaultValue) => {
7101
+ if (isString2(optsOrDefaultValue)) return optsOrDefaultValue;
7102
+ if (isObject(optsOrDefaultValue) && isString2(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
7103
+ return Array.isArray(k2) ? k2[k2.length - 1] : k2;
7104
+ };
7105
+ const retNotReady = [notReadyT, {}, false];
7106
+ retNotReady.t = notReadyT;
7107
+ retNotReady.i18n = {};
7108
+ retNotReady.ready = false;
7109
+ return retNotReady;
7110
+ }
7111
+ if (i18n.options.react?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
7112
+ const i18nOptions = {
7187
7113
  ...getDefaults(),
7188
- ...i18n?.options?.react,
7114
+ ...i18n.options.react,
7189
7115
  ...props
7190
- }), [i18n, props]);
7116
+ };
7191
7117
  const {
7192
7118
  useSuspense,
7193
7119
  keyPrefix
7194
7120
  } = i18nOptions;
7195
- const namespaces = useMemo2(() => {
7196
- const nsOrContext = ns || defaultNSFromContext || i18n?.options?.defaultNS;
7197
- return isString2(nsOrContext) ? [nsOrContext] : nsOrContext || ["translation"];
7198
- }, [ns, defaultNSFromContext, i18n]);
7199
- i18n?.reportNamespaces?.addUsedNamespaces?.(namespaces);
7200
- const revisionRef = useRef(0);
7201
- const subscribe = useCallback2((callback) => {
7202
- if (!i18n) return dummySubscribe;
7121
+ let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
7122
+ namespaces = isString2(namespaces) ? [namespaces] : namespaces || ["translation"];
7123
+ i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
7124
+ const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace2(n, i18n, i18nOptions));
7125
+ const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
7126
+ const getT = () => memoGetT;
7127
+ const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
7128
+ const [t2, setT] = useState(getT);
7129
+ let joinedNS = namespaces.join();
7130
+ if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
7131
+ const previousJoinedNS = usePrevious(joinedNS);
7132
+ const isMounted = useRef(true);
7133
+ useEffect(() => {
7203
7134
  const {
7204
7135
  bindI18n,
7205
7136
  bindI18nStore
7206
7137
  } = i18nOptions;
7207
- const wrappedCallback = () => {
7208
- revisionRef.current += 1;
7209
- callback();
7138
+ isMounted.current = true;
7139
+ if (!ready && !useSuspense) {
7140
+ if (props.lng) {
7141
+ loadLanguages2(i18n, props.lng, namespaces, () => {
7142
+ if (isMounted.current) setT(getNewT);
7143
+ });
7144
+ } else {
7145
+ loadNamespaces2(i18n, namespaces, () => {
7146
+ if (isMounted.current) setT(getNewT);
7147
+ });
7148
+ }
7149
+ }
7150
+ if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
7151
+ setT(getNewT);
7152
+ }
7153
+ const boundReset = () => {
7154
+ if (isMounted.current) setT(getNewT);
7210
7155
  };
7211
- if (bindI18n) i18n.on(bindI18n, wrappedCallback);
7212
- if (bindI18nStore) i18n.store.on(bindI18nStore, wrappedCallback);
7156
+ if (bindI18n) i18n?.on(bindI18n, boundReset);
7157
+ if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
7213
7158
  return () => {
7214
- if (bindI18n) bindI18n.split(" ").forEach((e2) => i18n.off(e2, wrappedCallback));
7215
- if (bindI18nStore) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, wrappedCallback));
7216
- };
7217
- }, [i18n, i18nOptions]);
7218
- const snapshotRef = useRef();
7219
- const getSnapshot = useCallback2(() => {
7220
- if (!i18n) {
7221
- return notReadySnapshot;
7222
- }
7223
- const calculatedReady = !!(i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace2(n, i18n, i18nOptions));
7224
- const currentLng = props.lng || i18n.language;
7225
- const currentRevision = revisionRef.current;
7226
- const lastSnapshot = snapshotRef.current;
7227
- if (lastSnapshot && lastSnapshot.ready === calculatedReady && lastSnapshot.lng === currentLng && lastSnapshot.keyPrefix === keyPrefix && lastSnapshot.revision === currentRevision) {
7228
- return lastSnapshot;
7229
- }
7230
- const calculatedT = i18n.getFixedT(currentLng, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
7231
- const newSnapshot = {
7232
- t: calculatedT,
7233
- ready: calculatedReady,
7234
- lng: currentLng,
7235
- keyPrefix,
7236
- revision: currentRevision
7159
+ isMounted.current = false;
7160
+ if (i18n && bindI18n) bindI18n?.split(" ").forEach((e2) => i18n.off(e2, boundReset));
7161
+ if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
7237
7162
  };
7238
- snapshotRef.current = newSnapshot;
7239
- return newSnapshot;
7240
- }, [i18n, namespaces, keyPrefix, i18nOptions, props.lng]);
7241
- const [loadCount, setLoadCount] = useState(0);
7242
- const {
7243
- t: t2,
7244
- ready
7245
- } = (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
7163
+ }, [i18n, joinedNS]);
7246
7164
  useEffect(() => {
7247
- if (i18n && !ready && !useSuspense) {
7248
- const onLoaded = () => setLoadCount((c2) => c2 + 1);
7249
- if (props.lng) {
7250
- loadLanguages2(i18n, props.lng, namespaces, onLoaded);
7251
- } else {
7252
- loadNamespaces2(i18n, namespaces, onLoaded);
7253
- }
7254
- }
7255
- }, [i18n, props.lng, namespaces, ready, useSuspense, loadCount]);
7256
- const finalI18n = i18n || {};
7257
- const ret = useMemo2(() => {
7258
- const arr = [t2, finalI18n, ready];
7259
- arr.t = t2;
7260
- arr.i18n = finalI18n;
7261
- arr.ready = ready;
7262
- return arr;
7263
- }, [t2, finalI18n, ready]);
7264
- if (i18n && useSuspense && !ready) {
7265
- throw new Promise((resolve) => {
7266
- const onLoaded = () => resolve();
7267
- if (props.lng) {
7268
- loadLanguages2(i18n, props.lng, namespaces, onLoaded);
7269
- } else {
7270
- loadNamespaces2(i18n, namespaces, onLoaded);
7271
- }
7272
- });
7273
- }
7274
- return ret;
7165
+ if (isMounted.current && ready) {
7166
+ setT(getT);
7167
+ }
7168
+ }, [i18n, keyPrefix, ready]);
7169
+ const ret = [t2, i18n, ready];
7170
+ ret.t = t2;
7171
+ ret.i18n = i18n;
7172
+ ret.ready = ready;
7173
+ if (ready) return ret;
7174
+ if (!ready && !useSuspense) return ret;
7175
+ throw new Promise((resolve) => {
7176
+ if (props.lng) {
7177
+ loadLanguages2(i18n, props.lng, namespaces, () => resolve());
7178
+ } else {
7179
+ loadNamespaces2(i18n, namespaces, () => resolve());
7180
+ }
7181
+ });
7275
7182
  };
7276
7183
 
7277
7184
  // node_modules/react-i18next/dist/es/withTranslation.js
7278
7185
  import { createElement as createElement2, forwardRef as forwardRefReact } from "react";
7279
7186
 
7280
7187
  // node_modules/react-i18next/dist/es/I18nextProvider.js
7281
- import { createElement as createElement3, useMemo as useMemo3 } from "react";
7188
+ import { createElement as createElement3, useMemo as useMemo2 } from "react";
7282
7189
 
7283
7190
  // node_modules/react-i18next/dist/es/withSSR.js
7284
7191
  import { createElement as createElement4 } from "react";
@@ -7635,7 +7542,7 @@ var import_merge2 = __toESM(require_merge());
7635
7542
  import {
7636
7543
  useCallback as useCallback3,
7637
7544
  useEffect as useEffect2,
7638
- useMemo as useMemo4,
7545
+ useMemo as useMemo3,
7639
7546
  useReducer,
7640
7547
  useRef as useRef2,
7641
7548
  useState as useState2
@@ -11272,7 +11179,7 @@ var reducer = (state, action) => {
11272
11179
  // src/context/EmbedProvider.tsx
11273
11180
  import { jsx, jsxs } from "react/jsx-runtime";
11274
11181
  var getCustomHeaders = (sessionId) => ({
11275
- "X-Schematic-Components-Version": "2.0.1",
11182
+ "X-Schematic-Components-Version": "2.0.2",
11276
11183
  "X-Schematic-Session-ID": sessionId
11277
11184
  });
11278
11185
  var EmbedProvider = ({
@@ -11324,7 +11231,7 @@ var EmbedProvider = ({
11324
11231
  });
11325
11232
  }
11326
11233
  }, [api.public]);
11327
- const debouncedHydratePublic = useMemo4(
11234
+ const debouncedHydratePublic = useMemo3(
11328
11235
  () => (0, import_debounce.default)(
11329
11236
  hydratePublic,
11330
11237
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11350,7 +11257,7 @@ var EmbedProvider = ({
11350
11257
  });
11351
11258
  }
11352
11259
  }, [api.checkout]);
11353
- const debouncedHydrate = useMemo4(
11260
+ const debouncedHydrate = useMemo3(
11354
11261
  () => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11355
11262
  [hydrate]
11356
11263
  );
@@ -11377,7 +11284,7 @@ var EmbedProvider = ({
11377
11284
  },
11378
11285
  [api.checkout]
11379
11286
  );
11380
- const debouncedHydrateComponent = useMemo4(
11287
+ const debouncedHydrateComponent = useMemo3(
11381
11288
  () => (0, import_debounce.default)(
11382
11289
  hydrateComponent,
11383
11290
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11401,7 +11308,7 @@ var EmbedProvider = ({
11401
11308
  });
11402
11309
  }
11403
11310
  }, []);
11404
- const debouncedHydrateExternal = useMemo4(
11311
+ const debouncedHydrateExternal = useMemo3(
11405
11312
  () => (0, import_debounce.default)(
11406
11313
  hydrateExternal,
11407
11314
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11412,7 +11319,7 @@ var EmbedProvider = ({
11412
11319
  const createSetupIntent = useCallback3(async () => {
11413
11320
  return api.checkout?.createSetupIntent();
11414
11321
  }, [api.checkout]);
11415
- const debouncedCreateSetupIntent = useMemo4(
11322
+ const debouncedCreateSetupIntent = useMemo3(
11416
11323
  () => (0, import_debounce.default)(
11417
11324
  createSetupIntent,
11418
11325
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11435,7 +11342,7 @@ var EmbedProvider = ({
11435
11342
  },
11436
11343
  [api.checkout]
11437
11344
  );
11438
- const debouncedUpdatePaymentMethod = useMemo4(
11345
+ const debouncedUpdatePaymentMethod = useMemo3(
11439
11346
  () => (0, import_debounce.default)(
11440
11347
  updatePaymentMethod,
11441
11348
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11458,7 +11365,7 @@ var EmbedProvider = ({
11458
11365
  },
11459
11366
  [api.checkout]
11460
11367
  );
11461
- const debouncedDeletePaymentMethod = useMemo4(
11368
+ const debouncedDeletePaymentMethod = useMemo3(
11462
11369
  () => (0, import_debounce.default)(
11463
11370
  deletePaymentMethod,
11464
11371
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11481,7 +11388,7 @@ var EmbedProvider = ({
11481
11388
  },
11482
11389
  [api.checkout]
11483
11390
  );
11484
- const debouncedCheckout = useMemo4(
11391
+ const debouncedCheckout = useMemo3(
11485
11392
  () => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11486
11393
  [checkout]
11487
11394
  );
@@ -11501,7 +11408,7 @@ var EmbedProvider = ({
11501
11408
  }
11502
11409
  return response;
11503
11410
  }, [api.checkout]);
11504
- const debouncedUnsubscribe = useMemo4(
11411
+ const debouncedUnsubscribe = useMemo3(
11505
11412
  () => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11506
11413
  [unsubscribe]
11507
11414
  );
@@ -11513,7 +11420,7 @@ var EmbedProvider = ({
11513
11420
  },
11514
11421
  [api.checkout]
11515
11422
  );
11516
- const debouncedGetUpcomingInvoice = useMemo4(
11423
+ const debouncedGetUpcomingInvoice = useMemo3(
11517
11424
  () => (0, import_debounce.default)(
11518
11425
  getUpcomingInvoice,
11519
11426
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11524,7 +11431,7 @@ var EmbedProvider = ({
11524
11431
  const getCustomerBalance = useCallback3(async () => {
11525
11432
  return api.checkout?.fetchCustomerBalance();
11526
11433
  }, [api.checkout]);
11527
- const debouncedGetCustomerBalance = useMemo4(
11434
+ const debouncedGetCustomerBalance = useMemo3(
11528
11435
  () => (0, import_debounce.default)(
11529
11436
  getCustomerBalance,
11530
11437
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11535,7 +11442,7 @@ var EmbedProvider = ({
11535
11442
  const listInvoices = useCallback3(async () => {
11536
11443
  return api.checkout?.listInvoices();
11537
11444
  }, [api.checkout]);
11538
- const debouncedListInvoices = useMemo4(
11445
+ const debouncedListInvoices = useMemo3(
11539
11446
  () => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11540
11447
  [listInvoices]
11541
11448
  );
@@ -11702,10 +11609,10 @@ var EmbedProvider = ({
11702
11609
  var useEmbed = () => useContext5(EmbedContext);
11703
11610
 
11704
11611
  // src/hooks/useIsLightBackground.ts
11705
- import { useMemo as useMemo5 } from "react";
11612
+ import { useMemo as useMemo4 } from "react";
11706
11613
  function useIsLightBackground() {
11707
11614
  const { settings } = useEmbed();
11708
- const isLightBackground = useMemo5(() => {
11615
+ const isLightBackground = useMemo4(() => {
11709
11616
  return hexToHSL(settings.theme.card.background).l > 50;
11710
11617
  }, [settings.theme.card.background]);
11711
11618
  return isLightBackground;
@@ -11820,7 +11727,7 @@ var usePaymentConfirmation = ({
11820
11727
  };
11821
11728
 
11822
11729
  // src/hooks/useRequest.ts
11823
- import { useCallback as useCallback5, useMemo as useMemo6, useState as useState4 } from "react";
11730
+ import { useCallback as useCallback5, useMemo as useMemo5, useState as useState4 } from "react";
11824
11731
  function useRequest(fn) {
11825
11732
  const [isLoading, setIsLoading] = useState4(false);
11826
11733
  const [error, setError] = useState4(null);
@@ -11840,7 +11747,7 @@ function useRequest(fn) {
11840
11747
  setIsLoading(false);
11841
11748
  }
11842
11749
  }, [fn]);
11843
- const value = useMemo6(() => {
11750
+ const value = useMemo5(() => {
11844
11751
  const state = { isLoading, error, data };
11845
11752
  return [state, request];
11846
11753
  }, [isLoading, error, data, request]);
@@ -11848,11 +11755,11 @@ function useRequest(fn) {
11848
11755
  }
11849
11756
 
11850
11757
  // src/hooks/useTrialEnd.ts
11851
- import { useMemo as useMemo7 } from "react";
11758
+ import { useMemo as useMemo6 } from "react";
11852
11759
  function useTrialEnd() {
11853
11760
  const { t: t2 } = useTranslation();
11854
11761
  const { data } = useEmbed();
11855
- const { endDate, formatted } = useMemo7(() => {
11762
+ const { endDate, formatted } = useMemo6(() => {
11856
11763
  const billingSubscription = data?.company?.billingSubscription;
11857
11764
  const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
11858
11765
  let formatted2;
@@ -13049,7 +12956,7 @@ Root.displayName = "Root";
13049
12956
 
13050
12957
  // src/components/layout/viewport/Viewport.tsx
13051
12958
  var import_debounce3 = __toESM(require_debounce());
13052
- import { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect5, useMemo as useMemo16, useRef as useRef9, useState as useState13 } from "react";
12959
+ import { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect5, useMemo as useMemo15, useRef as useRef9, useState as useState13 } from "react";
13053
12960
  import { createPortal as createPortal2 } from "react-dom";
13054
12961
 
13055
12962
  // src/components/shared/billing-threshold-tooltip/BillingThresholdTooltip.tsx
@@ -13086,7 +12993,7 @@ import {
13086
12993
  useCallback as useCallback10,
13087
12994
  useEffect as useEffect5,
13088
12995
  useLayoutEffect as useLayoutEffect4,
13089
- useMemo as useMemo10,
12996
+ useMemo as useMemo9,
13090
12997
  useRef as useRef6,
13091
12998
  useState as useState10
13092
12999
  } from "react";
@@ -13094,7 +13001,7 @@ import {
13094
13001
  // src/components/shared/sidebar/Sidebar.tsx
13095
13002
  import {
13096
13003
  useCallback as useCallback9,
13097
- useMemo as useMemo8
13004
+ useMemo as useMemo7
13098
13005
  } from "react";
13099
13006
 
13100
13007
  // src/components/shared/sidebar/EntitlementRow.tsx
@@ -13558,7 +13465,7 @@ var Sidebar = ({
13558
13465
  billingSubscription,
13559
13466
  paymentMethod,
13560
13467
  trialPaymentMethodRequired
13561
- } = useMemo8(() => {
13468
+ } = useMemo7(() => {
13562
13469
  const currentEntitlements2 = data?.featureUsage?.features || [];
13563
13470
  return {
13564
13471
  currentPlan: data?.company?.plan,
@@ -13581,7 +13488,7 @@ var Sidebar = ({
13581
13488
  data?.subscription?.paymentMethod,
13582
13489
  data?.trialPaymentMethodRequired
13583
13490
  ]);
13584
- const { payInAdvanceEntitlements } = useMemo8(() => {
13491
+ const { payInAdvanceEntitlements } = useMemo7(() => {
13585
13492
  const payAsYouGoEntitlements = [];
13586
13493
  const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
13587
13494
  (entitlement) => {
@@ -13593,7 +13500,7 @@ var Sidebar = ({
13593
13500
  );
13594
13501
  return { payAsYouGoEntitlements, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
13595
13502
  }, [usageBasedEntitlements]);
13596
- const subscriptionPrice = useMemo8(() => {
13503
+ const subscriptionPrice = useMemo7(() => {
13597
13504
  let planPrice;
13598
13505
  let currency;
13599
13506
  if (selectedPlan) {
@@ -13630,7 +13537,7 @@ var Sidebar = ({
13630
13537
  proration,
13631
13538
  taxAmount,
13632
13539
  taxDescription
13633
- } = useMemo8(() => {
13540
+ } = useMemo7(() => {
13634
13541
  return {
13635
13542
  amountOff: charges?.amountOff ?? 0,
13636
13543
  dueNow: charges?.dueNow ?? 0,
@@ -13642,7 +13549,7 @@ var Sidebar = ({
13642
13549
  taxDescription: charges?.taxDisplayName
13643
13550
  };
13644
13551
  }, [charges]);
13645
- const updatedUsageBasedEntitlements = useMemo8(() => {
13552
+ const updatedUsageBasedEntitlements = useMemo7(() => {
13646
13553
  const changedUsageBasedEntitlements = [];
13647
13554
  const addedUsageBasedEntitlements = selectedPlan ? usageBasedEntitlements.reduce(
13648
13555
  (acc, selected) => {
@@ -13693,15 +13600,15 @@ var Sidebar = ({
13693
13600
  currentUsageBasedEntitlements,
13694
13601
  usageBasedEntitlements
13695
13602
  ]);
13696
- const selectedAddOns = useMemo8(
13603
+ const selectedAddOns = useMemo7(
13697
13604
  () => addOns.filter((addOn) => addOn.isSelected),
13698
13605
  [addOns]
13699
13606
  );
13700
- const addedCreditBundles = useMemo8(
13607
+ const addedCreditBundles = useMemo7(
13701
13608
  () => creditBundles.filter((bundle) => bundle.count > 0),
13702
13609
  [creditBundles]
13703
13610
  );
13704
- const discountApplied = useMemo8(
13611
+ const discountApplied = useMemo7(
13705
13612
  () => promoCode && (amountOff > 0 || percentOff > 0),
13706
13613
  [promoCode, amountOff, percentOff]
13707
13614
  );
@@ -13839,7 +13746,7 @@ var Sidebar = ({
13839
13746
  setError(t2("Unsubscribe failed"));
13840
13747
  }
13841
13748
  }, [t2, unsubscribe, setError, setIsLoading, setLayout]);
13842
- const { removedAddOns, willAddOnsChange } = useMemo8(() => {
13749
+ const { removedAddOns, willAddOnsChange } = useMemo7(() => {
13843
13750
  const addedAddOns = selectedAddOns.filter(
13844
13751
  (selected) => !currentAddOns.some((current) => selected.id === current.id)
13845
13752
  );
@@ -14888,7 +14795,7 @@ var Navigation = ({
14888
14795
  };
14889
14796
 
14890
14797
  // src/components/shared/checkout-dialog/Plan.tsx
14891
- import { Fragment as Fragment8, useEffect as useEffect4, useMemo as useMemo9, useState as useState9 } from "react";
14798
+ import { Fragment as Fragment8, useEffect as useEffect4, useMemo as useMemo8, useState as useState9 } from "react";
14892
14799
 
14893
14800
  // src/components/shared/checkout-dialog/styles.ts
14894
14801
  var FlexWithAlignEnd = dt(Flex)`
@@ -14900,7 +14807,7 @@ import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-r
14900
14807
  var Selected = ({ isCurrent = false, isTrial = false }) => {
14901
14808
  const { t: t2 } = useTranslation();
14902
14809
  const { settings } = useEmbed();
14903
- const text = useMemo9(() => {
14810
+ const text = useMemo8(() => {
14904
14811
  if (isCurrent) {
14905
14812
  return isTrial ? t2("Trial in progress") : t2("Current plan");
14906
14813
  }
@@ -14936,10 +14843,10 @@ var PlanButtonGroup = ({
14936
14843
  }) => {
14937
14844
  const { t: t2 } = useTranslation();
14938
14845
  const { data } = useEmbed();
14939
- const isTrialing = useMemo9(() => {
14846
+ const isTrialing = useMemo8(() => {
14940
14847
  return data?.subscription?.status === "trialing" || false;
14941
14848
  }, [data]);
14942
- const { isCurrentPlan, isValidPlan } = useMemo9(() => {
14849
+ const { isCurrentPlan, isValidPlan } = useMemo8(() => {
14943
14850
  return {
14944
14851
  isCurrentPlan: data?.company?.plan?.id === plan.id,
14945
14852
  isValidPlan: plan.valid
@@ -15035,7 +14942,7 @@ var Plan = ({
15035
14942
  const [entitlementCounts, setEntitlementCounts] = useState9(
15036
14943
  () => plans.reduce(entitlementCountsReducer, {})
15037
14944
  );
15038
- const { isTrialing, showCredits, showPeriodToggle, showZeroPriceAsFree } = useMemo9(() => {
14945
+ const { isTrialing, showCredits, showPeriodToggle, showZeroPriceAsFree } = useMemo8(() => {
15039
14946
  return {
15040
14947
  isTrialing: data?.subscription?.status === "trialing",
15041
14948
  showCredits: data?.showCredits ?? true,
@@ -15625,7 +15532,7 @@ var CheckoutDialog = ({ top = 0 }) => {
15625
15532
  currentEntitlements,
15626
15533
  showPeriodToggle,
15627
15534
  trialPaymentMethodRequired
15628
- } = useMemo10(() => {
15535
+ } = useMemo9(() => {
15629
15536
  return {
15630
15537
  currentPlanId: data?.company?.plan?.id,
15631
15538
  currentEntitlements: data?.featureUsage ? data.featureUsage.features : [],
@@ -15638,7 +15545,7 @@ var CheckoutDialog = ({ top = 0 }) => {
15638
15545
  data?.showPeriodToggle,
15639
15546
  data?.trialPaymentMethodRequired
15640
15547
  ]);
15641
- const currentPeriod = useMemo10(
15548
+ const currentPeriod = useMemo9(
15642
15549
  () => checkoutState?.period || data?.company?.plan?.planPeriod || "month",
15643
15550
  [data?.company?.plan?.planPeriod, checkoutState?.period]
15644
15551
  );
@@ -15696,13 +15603,13 @@ var CheckoutDialog = ({ top = 0 }) => {
15696
15603
  );
15697
15604
  });
15698
15605
  });
15699
- const payInAdvanceEntitlements = useMemo10(
15606
+ const payInAdvanceEntitlements = useMemo9(
15700
15607
  () => usageBasedEntitlements.filter(
15701
15608
  (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
15702
15609
  ),
15703
15610
  [usageBasedEntitlements]
15704
15611
  );
15705
- const addOnPayInAdvanceEntitlements = useMemo10(
15612
+ const addOnPayInAdvanceEntitlements = useMemo9(
15706
15613
  () => addOnUsageBasedEntitlements.filter(
15707
15614
  (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
15708
15615
  ),
@@ -15710,12 +15617,12 @@ var CheckoutDialog = ({ top = 0 }) => {
15710
15617
  );
15711
15618
  const [promoCode, setPromoCode] = useState10(null);
15712
15619
  const [isPaymentMethodRequired, setIsPaymentMethodRequired] = useState10(false);
15713
- const willTrialWithoutPaymentMethod = useMemo10(
15620
+ const willTrialWithoutPaymentMethod = useMemo9(
15714
15621
  () => shouldTrial && !trialPaymentMethodRequired,
15715
15622
  [shouldTrial, trialPaymentMethodRequired]
15716
15623
  );
15717
15624
  const isSelectedPlanTrialable = selectedPlan && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
15718
- const checkoutStages = useMemo10(() => {
15625
+ const checkoutStages = useMemo9(() => {
15719
15626
  const stages = [];
15720
15627
  if (availablePlans.length > 0) {
15721
15628
  stages.push({
@@ -16505,7 +16412,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
16505
16412
  };
16506
16413
 
16507
16414
  // src/components/shared/period-toggle/PeriodToggle.tsx
16508
- import { useMemo as useMemo11 } from "react";
16415
+ import { useMemo as useMemo10 } from "react";
16509
16416
  import { jsx as jsx24 } from "react/jsx-runtime";
16510
16417
  var PeriodToggle = ({
16511
16418
  options,
@@ -16516,7 +16423,7 @@ var PeriodToggle = ({
16516
16423
  const { t: t2 } = useTranslation();
16517
16424
  const { settings } = useEmbed();
16518
16425
  const isLightBackground = useIsLightBackground();
16519
- const savingsPercentage = useMemo11(() => {
16426
+ const savingsPercentage = useMemo10(() => {
16520
16427
  if (selectedPlan) {
16521
16428
  const monthlyBillingPrice = getPlanPrice(selectedPlan, "month");
16522
16429
  const yearlyBillingPrice = getPlanPrice(selectedPlan, "year");
@@ -16602,10 +16509,10 @@ var PeriodToggle = ({
16602
16509
  };
16603
16510
 
16604
16511
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
16605
- import { useMemo as useMemo13 } from "react";
16512
+ import { useMemo as useMemo12 } from "react";
16606
16513
 
16607
16514
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
16608
- import { useMemo as useMemo12 } from "react";
16515
+ import { useMemo as useMemo11 } from "react";
16609
16516
  import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
16610
16517
  var PriceText = ({
16611
16518
  feature,
@@ -16615,7 +16522,7 @@ var PriceText = ({
16615
16522
  perUnitPrice = 0
16616
16523
  }) => {
16617
16524
  const { settings } = useEmbed();
16618
- const text = useMemo12(() => {
16525
+ const text = useMemo11(() => {
16619
16526
  if (!flatAmount && perUnitPrice) {
16620
16527
  return /* @__PURE__ */ jsxs19(Fragment11, { children: [
16621
16528
  formatCurrency(perUnitPrice, currency),
@@ -16663,7 +16570,7 @@ var PricingTiersTooltip = ({
16663
16570
  const { t: t2 } = useTranslation();
16664
16571
  const { settings } = useEmbed();
16665
16572
  const isLightBackground = useIsLightBackground();
16666
- const { tiers } = useMemo13(() => {
16573
+ const { tiers } = useMemo12(() => {
16667
16574
  return priceTiers.reduce(
16668
16575
  (acc, tier) => {
16669
16576
  const end = tier.upTo ?? Infinity;
@@ -16754,13 +16661,13 @@ var PricingTiersTooltip = ({
16754
16661
  };
16755
16662
 
16756
16663
  // src/components/shared/tiered-pricing-details/TieredPricingDetails.tsx
16757
- import { useMemo as useMemo14 } from "react";
16664
+ import { useMemo as useMemo13 } from "react";
16758
16665
  var TieredPricingDetails = ({
16759
16666
  entitlement,
16760
16667
  period
16761
16668
  }) => {
16762
16669
  const { t: t2 } = useTranslation();
16763
- const { currency, flatAmount, perUnitPrice, upTo } = useMemo14(() => {
16670
+ const { currency, flatAmount, perUnitPrice, upTo } = useMemo13(() => {
16764
16671
  const { currency: currency2, priceTier } = getEntitlementPrice(entitlement, period) || {};
16765
16672
  const { flatAmount: flatAmount2, perUnitPrice: perUnitPrice2, perUnitPriceDecimal, upTo: upTo2 } = priceTier?.[0] || {};
16766
16673
  return {
@@ -16808,7 +16715,7 @@ var TieredPricingDetails = ({
16808
16715
  };
16809
16716
 
16810
16717
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
16811
- import { useMemo as useMemo15, useRef as useRef8, useState as useState12 } from "react";
16718
+ import { useMemo as useMemo14, useRef as useRef8, useState as useState12 } from "react";
16812
16719
  import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
16813
16720
  var UnsubscribeDialog = ({ top = 0 }) => {
16814
16721
  const { t: t2 } = useTranslation();
@@ -16816,7 +16723,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
16816
16723
  const contentRef = useRef8(null);
16817
16724
  const [error, setError] = useState12();
16818
16725
  const [isLoading, setIsLoading] = useState12(false);
16819
- const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo15(() => {
16726
+ const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo14(() => {
16820
16727
  const cancelDate2 = data?.subscription?.cancelAt || data?.upcomingInvoice?.dueDate;
16821
16728
  return {
16822
16729
  planPeriod: data?.company?.plan?.planPeriod || "month",
@@ -16833,7 +16740,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
16833
16740
  data?.upcomingInvoice?.dueDate
16834
16741
  ]);
16835
16742
  const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
16836
- const selectedPlan = useMemo15(
16743
+ const selectedPlan = useMemo14(
16837
16744
  () => availablePlans.find((plan) => plan.id === currentPlan?.id),
16838
16745
  [currentPlan?.id, availablePlans]
16839
16746
  );
@@ -16842,7 +16749,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
16842
16749
  createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
16843
16750
  []
16844
16751
  );
16845
- const addOns = useMemo15(
16752
+ const addOns = useMemo14(
16846
16753
  () => availableAddOns.map((available) => ({
16847
16754
  ...available,
16848
16755
  isSelected: currentAddOns.some((current) => available.id === current.id) ?? false
@@ -17111,7 +17018,7 @@ var Viewport = forwardRef5(
17111
17018
  const portalRef = useRef9(portal || document.body);
17112
17019
  const { data, layout, settings } = useEmbed();
17113
17020
  const [top, setTop] = useState13(0);
17114
- const { canCheckout, isBadgeVisible } = useMemo16(() => {
17021
+ const { canCheckout, isBadgeVisible } = useMemo15(() => {
17115
17022
  return {
17116
17023
  canCheckout: data?.capabilities?.checkout ?? true,
17117
17024
  isBadgeVisible: !data?.capabilities?.badgeVisibility || settings.badge?.visibility !== "hidden"
@@ -17213,10 +17120,10 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
17213
17120
  ButtonElement.displayName = "Button";
17214
17121
 
17215
17122
  // src/components/elements/included-features/IncludedFeatures.tsx
17216
- import { forwardRef as forwardRef7, useMemo as useMemo18, useRef as useRef10, useState as useState14 } from "react";
17123
+ import { forwardRef as forwardRef7, useMemo as useMemo17, useRef as useRef10, useState as useState14 } from "react";
17217
17124
 
17218
17125
  // src/components/elements/included-features/UsageDetails.tsx
17219
- import { Fragment as Fragment14, useMemo as useMemo17 } from "react";
17126
+ import { Fragment as Fragment14, useMemo as useMemo16 } from "react";
17220
17127
  import { Fragment as Fragment15, jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
17221
17128
  var UsageDetails = ({
17222
17129
  entitlement,
@@ -17235,17 +17142,17 @@ var UsageDetails = ({
17235
17142
  } = entitlement;
17236
17143
  const { t: t2 } = useTranslation();
17237
17144
  const { data } = useEmbed();
17238
- const { period, showCredits } = useMemo17(() => {
17145
+ const { period, showCredits } = useMemo16(() => {
17239
17146
  return {
17240
17147
  period: data?.company?.plan?.planPeriod || void 0,
17241
17148
  showCredits: data?.showCredits ?? true
17242
17149
  };
17243
17150
  }, [data?.company?.plan?.planPeriod, data?.showCredits]);
17244
- const { billingPrice, cost, currentTier } = useMemo17(
17151
+ const { billingPrice, cost, currentTier } = useMemo16(
17245
17152
  () => getUsageDetails(entitlement, period),
17246
17153
  [entitlement, period]
17247
17154
  );
17248
- const text = useMemo17(() => {
17155
+ const text = useMemo16(() => {
17249
17156
  if (!feature) {
17250
17157
  return;
17251
17158
  }
@@ -17321,7 +17228,7 @@ var UsageDetails = ({
17321
17228
  currentTier,
17322
17229
  showCredits
17323
17230
  ]);
17324
- const usageText = useMemo17(() => {
17231
+ const usageText = useMemo16(() => {
17325
17232
  if (!feature) {
17326
17233
  return;
17327
17234
  }
@@ -17474,7 +17381,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17474
17381
  const shouldWrapChildren = useWrapChildren(elementsRef);
17475
17382
  const isLightBackground = useIsLightBackground();
17476
17383
  const [showCount, setShowCount] = useState14(VISIBLE_ENTITLEMENT_COUNT);
17477
- const { plan, addOns, featureUsage } = useMemo18(() => {
17384
+ const { plan, addOns, featureUsage } = useMemo17(() => {
17478
17385
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
17479
17386
  (acc, id) => {
17480
17387
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -17753,7 +17660,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
17753
17660
  Invoices.displayName = "Invoices";
17754
17661
 
17755
17662
  // src/components/elements/metered-features/MeteredFeatures.tsx
17756
- import { forwardRef as forwardRef9, useCallback as useCallback12, useMemo as useMemo19, useRef as useRef11, useState as useState16 } from "react";
17663
+ import { forwardRef as forwardRef9, useCallback as useCallback12, useMemo as useMemo18, useRef as useRef11, useState as useState16 } from "react";
17757
17664
 
17758
17665
  // src/components/elements/metered-features/Meter.tsx
17759
17666
  import { jsx as jsx36 } from "react/jsx-runtime";
@@ -17960,7 +17867,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
17960
17867
  const { t: t2 } = useTranslation();
17961
17868
  const { data, settings, setCheckoutState } = useEmbed();
17962
17869
  const isLightBackground = useIsLightBackground();
17963
- const meteredFeatures = useMemo19(() => {
17870
+ const meteredFeatures = useMemo18(() => {
17964
17871
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
17965
17872
  (acc, id) => {
17966
17873
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -18255,10 +18162,10 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18255
18162
  MeteredFeatures.displayName = "MeteredFeatures";
18256
18163
 
18257
18164
  // src/components/elements/payment-method/PaymentMethod.tsx
18258
- import { forwardRef as forwardRef10, useMemo as useMemo21 } from "react";
18165
+ import { forwardRef as forwardRef10, useMemo as useMemo20 } from "react";
18259
18166
 
18260
18167
  // src/components/elements/payment-method/PaymentMethodElement.tsx
18261
- import { useMemo as useMemo20 } from "react";
18168
+ import { useMemo as useMemo19 } from "react";
18262
18169
  import { jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
18263
18170
  var PaymentElement2 = ({
18264
18171
  iconName,
@@ -18378,7 +18285,7 @@ var PaymentListElement = ({
18378
18285
  }) => {
18379
18286
  const isLightBackground = useIsLightBackground();
18380
18287
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
18381
- const expirationDate = useMemo20(() => {
18288
+ const expirationDate = useMemo19(() => {
18382
18289
  const { cardExpMonth, cardExpYear } = paymentMethod;
18383
18290
  if (!cardExpMonth || !cardExpYear) {
18384
18291
  return;
@@ -18466,7 +18373,7 @@ var resolveDesignProps5 = (props) => {
18466
18373
  var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
18467
18374
  const props = resolveDesignProps5(rest);
18468
18375
  const { data, setLayout } = useEmbed();
18469
- const { paymentMethod, monthsToExpiration } = useMemo21(() => {
18376
+ const { paymentMethod, monthsToExpiration } = useMemo20(() => {
18470
18377
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
18471
18378
  let monthsToExpiration2;
18472
18379
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -18653,7 +18560,7 @@ var loadStripe = function loadStripe2() {
18653
18560
  };
18654
18561
 
18655
18562
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
18656
- import { useCallback as useCallback13, useEffect as useEffect7, useMemo as useMemo22, useState as useState17 } from "react";
18563
+ import { useCallback as useCallback13, useEffect as useEffect7, useMemo as useMemo21, useState as useState17 } from "react";
18657
18564
  import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
18658
18565
  var resolveDesignProps6 = () => {
18659
18566
  return {
@@ -18682,7 +18589,7 @@ var PaymentMethodDetails = ({
18682
18589
  updatePaymentMethod,
18683
18590
  deletePaymentMethod
18684
18591
  } = useEmbed();
18685
- const { defaultPaymentMethod, paymentMethods, subscription } = useMemo22(() => {
18592
+ const { defaultPaymentMethod, paymentMethods, subscription } = useMemo21(() => {
18686
18593
  return {
18687
18594
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
18688
18595
  paymentMethods: data?.company?.paymentMethods || [],
@@ -18713,7 +18620,7 @@ var PaymentMethodDetails = ({
18713
18620
  },
18714
18621
  autoConfirm: true
18715
18622
  });
18716
- const monthsToExpiration = useMemo22(() => {
18623
+ const monthsToExpiration = useMemo21(() => {
18717
18624
  let expiration;
18718
18625
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
18719
18626
  const now = /* @__PURE__ */ new Date();
@@ -18956,7 +18863,7 @@ var PaymentMethodDetails = ({
18956
18863
  };
18957
18864
 
18958
18865
  // src/components/elements/plan-manager/PlanManager.tsx
18959
- import { forwardRef as forwardRef11, useMemo as useMemo24 } from "react";
18866
+ import { forwardRef as forwardRef11, useMemo as useMemo23 } from "react";
18960
18867
 
18961
18868
  // src/components/elements/plan-manager/AddOn.tsx
18962
18869
  import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -18980,7 +18887,7 @@ var AddOn = ({ addOn, currency, layout }) => {
18980
18887
  };
18981
18888
 
18982
18889
  // src/components/elements/plan-manager/UsageDetails.tsx
18983
- import { Fragment as Fragment19, useMemo as useMemo23 } from "react";
18890
+ import { Fragment as Fragment19, useMemo as useMemo22 } from "react";
18984
18891
  import { Fragment as Fragment20, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
18985
18892
  var UsageDetails2 = ({
18986
18893
  entitlement,
@@ -18995,11 +18902,11 @@ var UsageDetails2 = ({
18995
18902
  limit,
18996
18903
  amount = 0,
18997
18904
  cost = 0
18998
- } = useMemo23(
18905
+ } = useMemo22(
18999
18906
  () => getUsageDetails(entitlement, period),
19000
18907
  [entitlement, period]
19001
18908
  );
19002
- const description = useMemo23(() => {
18909
+ const description = useMemo22(() => {
19003
18910
  const acc = [];
19004
18911
  let index = 0;
19005
18912
  if (entitlement.priceBehavior === "overage" /* Overage */) {
@@ -19163,7 +19070,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19163
19070
  showCredits,
19164
19071
  showZeroPriceAsFree,
19165
19072
  trialPaymentMethodRequired
19166
- } = useMemo24(() => {
19073
+ } = useMemo23(() => {
19167
19074
  return {
19168
19075
  currentPlan: data?.company?.plan,
19169
19076
  currentAddOns: data?.company?.addOns || [],
@@ -19207,7 +19114,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19207
19114
  data?.showZeroPriceAsFree,
19208
19115
  data?.trialPaymentMethodRequired
19209
19116
  ]);
19210
- const usageBasedEntitlements = useMemo24(
19117
+ const usageBasedEntitlements = useMemo23(
19211
19118
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
19212
19119
  [featureUsage]
19213
19120
  );
@@ -19216,7 +19123,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19216
19123
  subscriptionCurrency,
19217
19124
  willSubscriptionCancel,
19218
19125
  isTrialSubscription
19219
- } = useMemo24(() => {
19126
+ } = useMemo23(() => {
19220
19127
  const subscriptionInterval2 = billingSubscription?.interval;
19221
19128
  const subscriptionCurrency2 = billingSubscription?.currency;
19222
19129
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -19534,12 +19441,12 @@ import {
19534
19441
  forwardRef as forwardRef12,
19535
19442
  useCallback as useCallback14,
19536
19443
  useEffect as useEffect8,
19537
- useMemo as useMemo27,
19444
+ useMemo as useMemo26,
19538
19445
  useState as useState18
19539
19446
  } from "react";
19540
19447
 
19541
19448
  // src/components/elements/pricing-table/AddOn.tsx
19542
- import { useMemo as useMemo25 } from "react";
19449
+ import { useMemo as useMemo24 } from "react";
19543
19450
  import { Fragment as Fragment22, jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
19544
19451
  function renderMeteredEntitlementPricing2({
19545
19452
  priceBehavior,
@@ -19589,7 +19496,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
19589
19496
  const { t: t2 } = useTranslation();
19590
19497
  const { data, settings, setCheckoutState } = useEmbed();
19591
19498
  const isLightBackground = useIsLightBackground();
19592
- const { currentAddOns, canCheckout, isStandalone } = useMemo25(() => {
19499
+ const { currentAddOns, canCheckout, isStandalone } = useMemo24(() => {
19593
19500
  const isStandalone2 = typeof data?.component === "undefined";
19594
19501
  return {
19595
19502
  currentAddOns: data?.company?.addOns || [],
@@ -19823,7 +19730,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
19823
19730
  };
19824
19731
 
19825
19732
  // src/components/elements/pricing-table/Plan.tsx
19826
- import { useMemo as useMemo26 } from "react";
19733
+ import { useMemo as useMemo25 } from "react";
19827
19734
 
19828
19735
  // src/components/elements/pricing-table/Entitlement.tsx
19829
19736
  import { Fragment as Fragment23, jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
@@ -20012,7 +19919,7 @@ var Plan2 = ({
20012
19919
  isStandalone,
20013
19920
  showCredits,
20014
19921
  showZeroPriceAsFree
20015
- } = useMemo26(() => {
19922
+ } = useMemo25(() => {
20016
19923
  const isStandalone2 = typeof data?.component === "undefined";
20017
19924
  return {
20018
19925
  currentPeriod: data?.company?.plan?.planPeriod || "month",
@@ -20353,7 +20260,7 @@ var PricingTable = forwardRef12(({ className, ...rest }, ref) => {
20353
20260
  },
20354
20261
  []
20355
20262
  );
20356
- const { currentPeriod, isStandalone } = useMemo27(() => {
20263
+ const { currentPeriod, isStandalone } = useMemo26(() => {
20357
20264
  const isStandalone2 = typeof data?.component === "undefined";
20358
20265
  return {
20359
20266
  currentPeriod: data?.company?.plan?.planPeriod || "month",
@@ -20565,7 +20472,7 @@ var TextElement = forwardRef13(({ children, className, ...rest }, ref) => {
20565
20472
  TextElement.displayName = "Text";
20566
20473
 
20567
20474
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
20568
- import { forwardRef as forwardRef14, useMemo as useMemo28 } from "react";
20475
+ import { forwardRef as forwardRef14, useMemo as useMemo27 } from "react";
20569
20476
  import { jsx as jsx50 } from "react/jsx-runtime";
20570
20477
  var buttonStyles = {
20571
20478
  primary: {
@@ -20596,7 +20503,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
20596
20503
  const props = resolveDesignProps10(rest);
20597
20504
  const { t: t2 } = useTranslation();
20598
20505
  const { data, setLayout } = useEmbed();
20599
- const hasActiveSubscription = useMemo28(() => {
20506
+ const hasActiveSubscription = useMemo27(() => {
20600
20507
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
20601
20508
  }, [data?.subscription]);
20602
20509
  if (!hasActiveSubscription) {
@@ -20631,7 +20538,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
20631
20538
  UnsubscribeButton.displayName = "UnsubscribeButton";
20632
20539
 
20633
20540
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
20634
- import { forwardRef as forwardRef15, useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo29, useState as useState19 } from "react";
20541
+ import { forwardRef as forwardRef15, useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo28, useState as useState19 } from "react";
20635
20542
  import { jsx as jsx51, jsxs as jsxs39 } from "react/jsx-runtime";
20636
20543
  function resolveDesignProps11(props) {
20637
20544
  return {
@@ -20660,7 +20567,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
20660
20567
  const [error, setError] = useState19();
20661
20568
  const [upcomingInvoice, setUpcomingInvoice] = useState19();
20662
20569
  const [balances, setBalances] = useState19([]);
20663
- const discounts = useMemo29(() => {
20570
+ const discounts = useMemo28(() => {
20664
20571
  return (data?.subscription?.discounts || []).map((discount) => ({
20665
20572
  couponId: discount.couponId,
20666
20573
  customerFacingCode: discount.customerFacingCode || void 0,
@@ -25252,17 +25159,6 @@ export {
25252
25159
  };
25253
25160
  /*! Bundled license information:
25254
25161
 
25255
- use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
25256
- (**
25257
- * @license React
25258
- * use-sync-external-store-shim.development.js
25259
- *
25260
- * Copyright (c) Meta Platforms, Inc. and affiliates.
25261
- *
25262
- * This source code is licensed under the MIT license found in the
25263
- * LICENSE file in the root directory of this source tree.
25264
- *)
25265
-
25266
25162
  pako/dist/pako.esm.mjs:
25267
25163
  (*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
25268
25164
  */