@schematichq/schematic-components 2.0.0 → 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,95 +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 subscribe = useCallback2((callback) => {
7201
- 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(() => {
7202
7134
  const {
7203
7135
  bindI18n,
7204
7136
  bindI18nStore
7205
7137
  } = i18nOptions;
7206
- if (bindI18n) i18n.on(bindI18n, callback);
7207
- if (bindI18nStore) i18n.store.on(bindI18nStore, callback);
7208
- return () => {
7209
- if (bindI18n) bindI18n.split(" ").forEach((e2) => i18n.off(e2, callback));
7210
- if (bindI18nStore) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, callback));
7211
- };
7212
- }, [i18n, i18nOptions]);
7213
- const snapshotRef = useRef();
7214
- const getSnapshot = useCallback2(() => {
7215
- if (!i18n) {
7216
- return notReadySnapshot;
7217
- }
7218
- const calculatedReady = !!(i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace2(n, i18n, i18nOptions));
7219
- const calculatedT = i18n.getFixedT(props.lng || i18n.language, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
7220
- const lastSnapshot = snapshotRef.current;
7221
- if (lastSnapshot && lastSnapshot.ready === calculatedReady && lastSnapshot.lng === (props.lng || i18n.language) && lastSnapshot.keyPrefix === keyPrefix) {
7222
- return lastSnapshot;
7223
- }
7224
- const newSnapshot = {
7225
- t: calculatedT,
7226
- ready: calculatedReady,
7227
- lng: props.lng || i18n.language,
7228
- keyPrefix
7229
- };
7230
- snapshotRef.current = newSnapshot;
7231
- return newSnapshot;
7232
- }, [i18n, namespaces, keyPrefix, i18nOptions, props.lng]);
7233
- const [loadCount, setLoadCount] = useState(0);
7234
- const {
7235
- t: t2,
7236
- ready
7237
- } = (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
7238
- useEffect(() => {
7239
- if (i18n && !ready && !useSuspense) {
7240
- const onLoaded = () => setLoadCount((c2) => c2 + 1);
7241
- if (props.lng) {
7242
- loadLanguages2(i18n, props.lng, namespaces, onLoaded);
7243
- } else {
7244
- loadNamespaces2(i18n, namespaces, onLoaded);
7245
- }
7246
- }
7247
- }, [i18n, props.lng, namespaces, ready, useSuspense, loadCount]);
7248
- const finalI18n = i18n || {};
7249
- const ret = useMemo2(() => {
7250
- const arr = [t2, finalI18n, ready];
7251
- arr.t = t2;
7252
- arr.i18n = finalI18n;
7253
- arr.ready = ready;
7254
- return arr;
7255
- }, [t2, finalI18n, ready]);
7256
- if (i18n && useSuspense && !ready) {
7257
- throw new Promise((resolve) => {
7258
- const onLoaded = () => resolve();
7138
+ isMounted.current = true;
7139
+ if (!ready && !useSuspense) {
7259
7140
  if (props.lng) {
7260
- loadLanguages2(i18n, props.lng, namespaces, onLoaded);
7141
+ loadLanguages2(i18n, props.lng, namespaces, () => {
7142
+ if (isMounted.current) setT(getNewT);
7143
+ });
7261
7144
  } else {
7262
- loadNamespaces2(i18n, namespaces, onLoaded);
7145
+ loadNamespaces2(i18n, namespaces, () => {
7146
+ if (isMounted.current) setT(getNewT);
7147
+ });
7263
7148
  }
7264
- });
7265
- }
7266
- return ret;
7149
+ }
7150
+ if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
7151
+ setT(getNewT);
7152
+ }
7153
+ const boundReset = () => {
7154
+ if (isMounted.current) setT(getNewT);
7155
+ };
7156
+ if (bindI18n) i18n?.on(bindI18n, boundReset);
7157
+ if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
7158
+ return () => {
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));
7162
+ };
7163
+ }, [i18n, joinedNS]);
7164
+ useEffect(() => {
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
+ });
7267
7182
  };
7268
7183
 
7269
7184
  // node_modules/react-i18next/dist/es/withTranslation.js
7270
7185
  import { createElement as createElement2, forwardRef as forwardRefReact } from "react";
7271
7186
 
7272
7187
  // node_modules/react-i18next/dist/es/I18nextProvider.js
7273
- import { createElement as createElement3, useMemo as useMemo3 } from "react";
7188
+ import { createElement as createElement3, useMemo as useMemo2 } from "react";
7274
7189
 
7275
7190
  // node_modules/react-i18next/dist/es/withSSR.js
7276
7191
  import { createElement as createElement4 } from "react";
@@ -7622,12 +7537,12 @@ var Icon = ({ name, className = "", ...rest }) => {
7622
7537
  };
7623
7538
 
7624
7539
  // src/context/EmbedProvider.tsx
7625
- var import_debounce = __toESM(require_debounce(), 1);
7626
- var import_merge2 = __toESM(require_merge(), 1);
7540
+ var import_debounce = __toESM(require_debounce());
7541
+ var import_merge2 = __toESM(require_merge());
7627
7542
  import {
7628
7543
  useCallback as useCallback3,
7629
7544
  useEffect as useEffect2,
7630
- useMemo as useMemo4,
7545
+ useMemo as useMemo3,
7631
7546
  useReducer,
7632
7547
  useRef as useRef2,
7633
7548
  useState as useState2
@@ -8902,7 +8817,6 @@ function RuleConditionDetailResponseDataFromJSONTyped(json, ignoreDiscriminator)
8902
8817
  metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : json["metric_period_month_reset"],
8903
8818
  metricValue: json["metric_value"] == null ? void 0 : json["metric_value"],
8904
8819
  operator: json["operator"],
8905
- planId: json["plan_id"] == null ? void 0 : json["plan_id"],
8906
8820
  resourceIds: json["resource_ids"],
8907
8821
  resources: json["resources"].map(
8908
8822
  PreviewObjectResponseDataFromJSON
@@ -8932,7 +8846,6 @@ function RuleConditionGroupDetailResponseDataFromJSONTyped(json, ignoreDiscrimin
8932
8846
  environmentId: json["environment_id"],
8933
8847
  flagId: json["flag_id"] == null ? void 0 : json["flag_id"],
8934
8848
  id: json["id"],
8935
- planId: json["plan_id"] == null ? void 0 : json["plan_id"],
8936
8849
  ruleId: json["rule_id"],
8937
8850
  updatedAt: new Date(json["updated_at"])
8938
8851
  };
@@ -8958,7 +8871,6 @@ function RuleDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8958
8871
  flagId: json["flag_id"] == null ? void 0 : json["flag_id"],
8959
8872
  id: json["id"],
8960
8873
  name: json["name"],
8961
- planId: json["plan_id"] == null ? void 0 : json["plan_id"],
8962
8874
  priority: json["priority"],
8963
8875
  ruleType: json["rule_type"],
8964
8876
  updatedAt: new Date(json["updated_at"]),
@@ -10762,7 +10674,6 @@ function RuleConditionDetailResponseDataFromJSONTyped4(json, ignoreDiscriminator
10762
10674
  metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : json["metric_period_month_reset"],
10763
10675
  metricValue: json["metric_value"] == null ? void 0 : json["metric_value"],
10764
10676
  operator: json["operator"],
10765
- planId: json["plan_id"] == null ? void 0 : json["plan_id"],
10766
10677
  resourceIds: json["resource_ids"],
10767
10678
  resources: json["resources"].map(
10768
10679
  PreviewObjectResponseDataFromJSON2
@@ -10792,7 +10703,6 @@ function RuleConditionGroupDetailResponseDataFromJSONTyped3(json, ignoreDiscrimi
10792
10703
  environmentId: json["environment_id"],
10793
10704
  flagId: json["flag_id"] == null ? void 0 : json["flag_id"],
10794
10705
  id: json["id"],
10795
- planId: json["plan_id"] == null ? void 0 : json["plan_id"],
10796
10706
  ruleId: json["rule_id"],
10797
10707
  updatedAt: new Date(json["updated_at"])
10798
10708
  };
@@ -10818,7 +10728,6 @@ function RuleDetailResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
10818
10728
  flagId: json["flag_id"] == null ? void 0 : json["flag_id"],
10819
10729
  id: json["id"],
10820
10730
  name: json["name"],
10821
- planId: json["plan_id"] == null ? void 0 : json["plan_id"],
10822
10731
  priority: json["priority"],
10823
10732
  ruleType: json["rule_type"],
10824
10733
  updatedAt: new Date(json["updated_at"]),
@@ -11112,7 +11021,7 @@ var ComponentspublicApi = class extends BaseAPI2 {
11112
11021
  };
11113
11022
 
11114
11023
  // src/context/embedReducer.ts
11115
- var import_merge = __toESM(require_merge(), 1);
11024
+ var import_merge = __toESM(require_merge());
11116
11025
  var dispatchPlanChangedEvent = (detail) => {
11117
11026
  const event = new CustomEvent("plan-changed", {
11118
11027
  bubbles: true,
@@ -11270,7 +11179,7 @@ var reducer = (state, action) => {
11270
11179
  // src/context/EmbedProvider.tsx
11271
11180
  import { jsx, jsxs } from "react/jsx-runtime";
11272
11181
  var getCustomHeaders = (sessionId) => ({
11273
- "X-Schematic-Components-Version": "2.0.0",
11182
+ "X-Schematic-Components-Version": "2.0.2",
11274
11183
  "X-Schematic-Session-ID": sessionId
11275
11184
  });
11276
11185
  var EmbedProvider = ({
@@ -11322,7 +11231,7 @@ var EmbedProvider = ({
11322
11231
  });
11323
11232
  }
11324
11233
  }, [api.public]);
11325
- const debouncedHydratePublic = useMemo4(
11234
+ const debouncedHydratePublic = useMemo3(
11326
11235
  () => (0, import_debounce.default)(
11327
11236
  hydratePublic,
11328
11237
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11348,7 +11257,7 @@ var EmbedProvider = ({
11348
11257
  });
11349
11258
  }
11350
11259
  }, [api.checkout]);
11351
- const debouncedHydrate = useMemo4(
11260
+ const debouncedHydrate = useMemo3(
11352
11261
  () => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11353
11262
  [hydrate]
11354
11263
  );
@@ -11375,7 +11284,7 @@ var EmbedProvider = ({
11375
11284
  },
11376
11285
  [api.checkout]
11377
11286
  );
11378
- const debouncedHydrateComponent = useMemo4(
11287
+ const debouncedHydrateComponent = useMemo3(
11379
11288
  () => (0, import_debounce.default)(
11380
11289
  hydrateComponent,
11381
11290
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11399,7 +11308,7 @@ var EmbedProvider = ({
11399
11308
  });
11400
11309
  }
11401
11310
  }, []);
11402
- const debouncedHydrateExternal = useMemo4(
11311
+ const debouncedHydrateExternal = useMemo3(
11403
11312
  () => (0, import_debounce.default)(
11404
11313
  hydrateExternal,
11405
11314
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11410,7 +11319,7 @@ var EmbedProvider = ({
11410
11319
  const createSetupIntent = useCallback3(async () => {
11411
11320
  return api.checkout?.createSetupIntent();
11412
11321
  }, [api.checkout]);
11413
- const debouncedCreateSetupIntent = useMemo4(
11322
+ const debouncedCreateSetupIntent = useMemo3(
11414
11323
  () => (0, import_debounce.default)(
11415
11324
  createSetupIntent,
11416
11325
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11433,7 +11342,7 @@ var EmbedProvider = ({
11433
11342
  },
11434
11343
  [api.checkout]
11435
11344
  );
11436
- const debouncedUpdatePaymentMethod = useMemo4(
11345
+ const debouncedUpdatePaymentMethod = useMemo3(
11437
11346
  () => (0, import_debounce.default)(
11438
11347
  updatePaymentMethod,
11439
11348
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11456,7 +11365,7 @@ var EmbedProvider = ({
11456
11365
  },
11457
11366
  [api.checkout]
11458
11367
  );
11459
- const debouncedDeletePaymentMethod = useMemo4(
11368
+ const debouncedDeletePaymentMethod = useMemo3(
11460
11369
  () => (0, import_debounce.default)(
11461
11370
  deletePaymentMethod,
11462
11371
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11479,7 +11388,7 @@ var EmbedProvider = ({
11479
11388
  },
11480
11389
  [api.checkout]
11481
11390
  );
11482
- const debouncedCheckout = useMemo4(
11391
+ const debouncedCheckout = useMemo3(
11483
11392
  () => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11484
11393
  [checkout]
11485
11394
  );
@@ -11499,7 +11408,7 @@ var EmbedProvider = ({
11499
11408
  }
11500
11409
  return response;
11501
11410
  }, [api.checkout]);
11502
- const debouncedUnsubscribe = useMemo4(
11411
+ const debouncedUnsubscribe = useMemo3(
11503
11412
  () => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11504
11413
  [unsubscribe]
11505
11414
  );
@@ -11511,7 +11420,7 @@ var EmbedProvider = ({
11511
11420
  },
11512
11421
  [api.checkout]
11513
11422
  );
11514
- const debouncedGetUpcomingInvoice = useMemo4(
11423
+ const debouncedGetUpcomingInvoice = useMemo3(
11515
11424
  () => (0, import_debounce.default)(
11516
11425
  getUpcomingInvoice,
11517
11426
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11522,7 +11431,7 @@ var EmbedProvider = ({
11522
11431
  const getCustomerBalance = useCallback3(async () => {
11523
11432
  return api.checkout?.fetchCustomerBalance();
11524
11433
  }, [api.checkout]);
11525
- const debouncedGetCustomerBalance = useMemo4(
11434
+ const debouncedGetCustomerBalance = useMemo3(
11526
11435
  () => (0, import_debounce.default)(
11527
11436
  getCustomerBalance,
11528
11437
  FETCH_DEBOUNCE_TIMEOUT,
@@ -11533,7 +11442,7 @@ var EmbedProvider = ({
11533
11442
  const listInvoices = useCallback3(async () => {
11534
11443
  return api.checkout?.listInvoices();
11535
11444
  }, [api.checkout]);
11536
- const debouncedListInvoices = useMemo4(
11445
+ const debouncedListInvoices = useMemo3(
11537
11446
  () => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
11538
11447
  [listInvoices]
11539
11448
  );
@@ -11700,10 +11609,10 @@ var EmbedProvider = ({
11700
11609
  var useEmbed = () => useContext5(EmbedContext);
11701
11610
 
11702
11611
  // src/hooks/useIsLightBackground.ts
11703
- import { useMemo as useMemo5 } from "react";
11612
+ import { useMemo as useMemo4 } from "react";
11704
11613
  function useIsLightBackground() {
11705
11614
  const { settings } = useEmbed();
11706
- const isLightBackground = useMemo5(() => {
11615
+ const isLightBackground = useMemo4(() => {
11707
11616
  return hexToHSL(settings.theme.card.background).l > 50;
11708
11617
  }, [settings.theme.card.background]);
11709
11618
  return isLightBackground;
@@ -11818,7 +11727,7 @@ var usePaymentConfirmation = ({
11818
11727
  };
11819
11728
 
11820
11729
  // src/hooks/useRequest.ts
11821
- 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";
11822
11731
  function useRequest(fn) {
11823
11732
  const [isLoading, setIsLoading] = useState4(false);
11824
11733
  const [error, setError] = useState4(null);
@@ -11838,7 +11747,7 @@ function useRequest(fn) {
11838
11747
  setIsLoading(false);
11839
11748
  }
11840
11749
  }, [fn]);
11841
- const value = useMemo6(() => {
11750
+ const value = useMemo5(() => {
11842
11751
  const state = { isLoading, error, data };
11843
11752
  return [state, request];
11844
11753
  }, [isLoading, error, data, request]);
@@ -11846,11 +11755,11 @@ function useRequest(fn) {
11846
11755
  }
11847
11756
 
11848
11757
  // src/hooks/useTrialEnd.ts
11849
- import { useMemo as useMemo7 } from "react";
11758
+ import { useMemo as useMemo6 } from "react";
11850
11759
  function useTrialEnd() {
11851
11760
  const { t: t2 } = useTranslation();
11852
11761
  const { data } = useEmbed();
11853
- const { endDate, formatted } = useMemo7(() => {
11762
+ const { endDate, formatted } = useMemo6(() => {
11854
11763
  const billingSubscription = data?.company?.billingSubscription;
11855
11764
  const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
11856
11765
  let formatted2;
@@ -12704,7 +12613,7 @@ var Text = dt.span.withConfig({
12704
12613
  );
12705
12614
 
12706
12615
  // src/components/ui/tooltip/Tooltip.tsx
12707
- var import_debounce2 = __toESM(require_debounce(), 1);
12616
+ var import_debounce2 = __toESM(require_debounce());
12708
12617
  import { useCallback as useCallback8, useLayoutEffect as useLayoutEffect3, useRef as useRef5, useState as useState6 } from "react";
12709
12618
  import { createPortal } from "react-dom";
12710
12619
 
@@ -13046,8 +12955,8 @@ var Root = forwardRef4(
13046
12955
  Root.displayName = "Root";
13047
12956
 
13048
12957
  // src/components/layout/viewport/Viewport.tsx
13049
- var import_debounce3 = __toESM(require_debounce(), 1);
13050
- import { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect5, useMemo as useMemo16, useRef as useRef9, useState as useState13 } from "react";
12958
+ var import_debounce3 = __toESM(require_debounce());
12959
+ import { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect5, useMemo as useMemo15, useRef as useRef9, useState as useState13 } from "react";
13051
12960
  import { createPortal as createPortal2 } from "react-dom";
13052
12961
 
13053
12962
  // src/components/shared/billing-threshold-tooltip/BillingThresholdTooltip.tsx
@@ -13084,7 +12993,7 @@ import {
13084
12993
  useCallback as useCallback10,
13085
12994
  useEffect as useEffect5,
13086
12995
  useLayoutEffect as useLayoutEffect4,
13087
- useMemo as useMemo10,
12996
+ useMemo as useMemo9,
13088
12997
  useRef as useRef6,
13089
12998
  useState as useState10
13090
12999
  } from "react";
@@ -13092,7 +13001,7 @@ import {
13092
13001
  // src/components/shared/sidebar/Sidebar.tsx
13093
13002
  import {
13094
13003
  useCallback as useCallback9,
13095
- useMemo as useMemo8
13004
+ useMemo as useMemo7
13096
13005
  } from "react";
13097
13006
 
13098
13007
  // src/components/shared/sidebar/EntitlementRow.tsx
@@ -13556,7 +13465,7 @@ var Sidebar = ({
13556
13465
  billingSubscription,
13557
13466
  paymentMethod,
13558
13467
  trialPaymentMethodRequired
13559
- } = useMemo8(() => {
13468
+ } = useMemo7(() => {
13560
13469
  const currentEntitlements2 = data?.featureUsage?.features || [];
13561
13470
  return {
13562
13471
  currentPlan: data?.company?.plan,
@@ -13579,7 +13488,7 @@ var Sidebar = ({
13579
13488
  data?.subscription?.paymentMethod,
13580
13489
  data?.trialPaymentMethodRequired
13581
13490
  ]);
13582
- const { payInAdvanceEntitlements } = useMemo8(() => {
13491
+ const { payInAdvanceEntitlements } = useMemo7(() => {
13583
13492
  const payAsYouGoEntitlements = [];
13584
13493
  const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
13585
13494
  (entitlement) => {
@@ -13591,7 +13500,7 @@ var Sidebar = ({
13591
13500
  );
13592
13501
  return { payAsYouGoEntitlements, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
13593
13502
  }, [usageBasedEntitlements]);
13594
- const subscriptionPrice = useMemo8(() => {
13503
+ const subscriptionPrice = useMemo7(() => {
13595
13504
  let planPrice;
13596
13505
  let currency;
13597
13506
  if (selectedPlan) {
@@ -13628,7 +13537,7 @@ var Sidebar = ({
13628
13537
  proration,
13629
13538
  taxAmount,
13630
13539
  taxDescription
13631
- } = useMemo8(() => {
13540
+ } = useMemo7(() => {
13632
13541
  return {
13633
13542
  amountOff: charges?.amountOff ?? 0,
13634
13543
  dueNow: charges?.dueNow ?? 0,
@@ -13640,7 +13549,7 @@ var Sidebar = ({
13640
13549
  taxDescription: charges?.taxDisplayName
13641
13550
  };
13642
13551
  }, [charges]);
13643
- const updatedUsageBasedEntitlements = useMemo8(() => {
13552
+ const updatedUsageBasedEntitlements = useMemo7(() => {
13644
13553
  const changedUsageBasedEntitlements = [];
13645
13554
  const addedUsageBasedEntitlements = selectedPlan ? usageBasedEntitlements.reduce(
13646
13555
  (acc, selected) => {
@@ -13691,15 +13600,15 @@ var Sidebar = ({
13691
13600
  currentUsageBasedEntitlements,
13692
13601
  usageBasedEntitlements
13693
13602
  ]);
13694
- const selectedAddOns = useMemo8(
13603
+ const selectedAddOns = useMemo7(
13695
13604
  () => addOns.filter((addOn) => addOn.isSelected),
13696
13605
  [addOns]
13697
13606
  );
13698
- const addedCreditBundles = useMemo8(
13607
+ const addedCreditBundles = useMemo7(
13699
13608
  () => creditBundles.filter((bundle) => bundle.count > 0),
13700
13609
  [creditBundles]
13701
13610
  );
13702
- const discountApplied = useMemo8(
13611
+ const discountApplied = useMemo7(
13703
13612
  () => promoCode && (amountOff > 0 || percentOff > 0),
13704
13613
  [promoCode, amountOff, percentOff]
13705
13614
  );
@@ -13837,7 +13746,7 @@ var Sidebar = ({
13837
13746
  setError(t2("Unsubscribe failed"));
13838
13747
  }
13839
13748
  }, [t2, unsubscribe, setError, setIsLoading, setLayout]);
13840
- const { removedAddOns, willAddOnsChange } = useMemo8(() => {
13749
+ const { removedAddOns, willAddOnsChange } = useMemo7(() => {
13841
13750
  const addedAddOns = selectedAddOns.filter(
13842
13751
  (selected) => !currentAddOns.some((current) => selected.id === current.id)
13843
13752
  );
@@ -14886,7 +14795,7 @@ var Navigation = ({
14886
14795
  };
14887
14796
 
14888
14797
  // src/components/shared/checkout-dialog/Plan.tsx
14889
- 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";
14890
14799
 
14891
14800
  // src/components/shared/checkout-dialog/styles.ts
14892
14801
  var FlexWithAlignEnd = dt(Flex)`
@@ -14898,7 +14807,7 @@ import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-r
14898
14807
  var Selected = ({ isCurrent = false, isTrial = false }) => {
14899
14808
  const { t: t2 } = useTranslation();
14900
14809
  const { settings } = useEmbed();
14901
- const text = useMemo9(() => {
14810
+ const text = useMemo8(() => {
14902
14811
  if (isCurrent) {
14903
14812
  return isTrial ? t2("Trial in progress") : t2("Current plan");
14904
14813
  }
@@ -14934,10 +14843,10 @@ var PlanButtonGroup = ({
14934
14843
  }) => {
14935
14844
  const { t: t2 } = useTranslation();
14936
14845
  const { data } = useEmbed();
14937
- const isTrialing = useMemo9(() => {
14846
+ const isTrialing = useMemo8(() => {
14938
14847
  return data?.subscription?.status === "trialing" || false;
14939
14848
  }, [data]);
14940
- const { isCurrentPlan, isValidPlan } = useMemo9(() => {
14849
+ const { isCurrentPlan, isValidPlan } = useMemo8(() => {
14941
14850
  return {
14942
14851
  isCurrentPlan: data?.company?.plan?.id === plan.id,
14943
14852
  isValidPlan: plan.valid
@@ -15033,7 +14942,7 @@ var Plan = ({
15033
14942
  const [entitlementCounts, setEntitlementCounts] = useState9(
15034
14943
  () => plans.reduce(entitlementCountsReducer, {})
15035
14944
  );
15036
- const { isTrialing, showCredits, showPeriodToggle, showZeroPriceAsFree } = useMemo9(() => {
14945
+ const { isTrialing, showCredits, showPeriodToggle, showZeroPriceAsFree } = useMemo8(() => {
15037
14946
  return {
15038
14947
  isTrialing: data?.subscription?.status === "trialing",
15039
14948
  showCredits: data?.showCredits ?? true,
@@ -15623,7 +15532,7 @@ var CheckoutDialog = ({ top = 0 }) => {
15623
15532
  currentEntitlements,
15624
15533
  showPeriodToggle,
15625
15534
  trialPaymentMethodRequired
15626
- } = useMemo10(() => {
15535
+ } = useMemo9(() => {
15627
15536
  return {
15628
15537
  currentPlanId: data?.company?.plan?.id,
15629
15538
  currentEntitlements: data?.featureUsage ? data.featureUsage.features : [],
@@ -15636,7 +15545,7 @@ var CheckoutDialog = ({ top = 0 }) => {
15636
15545
  data?.showPeriodToggle,
15637
15546
  data?.trialPaymentMethodRequired
15638
15547
  ]);
15639
- const currentPeriod = useMemo10(
15548
+ const currentPeriod = useMemo9(
15640
15549
  () => checkoutState?.period || data?.company?.plan?.planPeriod || "month",
15641
15550
  [data?.company?.plan?.planPeriod, checkoutState?.period]
15642
15551
  );
@@ -15694,13 +15603,13 @@ var CheckoutDialog = ({ top = 0 }) => {
15694
15603
  );
15695
15604
  });
15696
15605
  });
15697
- const payInAdvanceEntitlements = useMemo10(
15606
+ const payInAdvanceEntitlements = useMemo9(
15698
15607
  () => usageBasedEntitlements.filter(
15699
15608
  (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
15700
15609
  ),
15701
15610
  [usageBasedEntitlements]
15702
15611
  );
15703
- const addOnPayInAdvanceEntitlements = useMemo10(
15612
+ const addOnPayInAdvanceEntitlements = useMemo9(
15704
15613
  () => addOnUsageBasedEntitlements.filter(
15705
15614
  (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
15706
15615
  ),
@@ -15708,12 +15617,12 @@ var CheckoutDialog = ({ top = 0 }) => {
15708
15617
  );
15709
15618
  const [promoCode, setPromoCode] = useState10(null);
15710
15619
  const [isPaymentMethodRequired, setIsPaymentMethodRequired] = useState10(false);
15711
- const willTrialWithoutPaymentMethod = useMemo10(
15620
+ const willTrialWithoutPaymentMethod = useMemo9(
15712
15621
  () => shouldTrial && !trialPaymentMethodRequired,
15713
15622
  [shouldTrial, trialPaymentMethodRequired]
15714
15623
  );
15715
15624
  const isSelectedPlanTrialable = selectedPlan && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
15716
- const checkoutStages = useMemo10(() => {
15625
+ const checkoutStages = useMemo9(() => {
15717
15626
  const stages = [];
15718
15627
  if (availablePlans.length > 0) {
15719
15628
  stages.push({
@@ -16503,7 +16412,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
16503
16412
  };
16504
16413
 
16505
16414
  // src/components/shared/period-toggle/PeriodToggle.tsx
16506
- import { useMemo as useMemo11 } from "react";
16415
+ import { useMemo as useMemo10 } from "react";
16507
16416
  import { jsx as jsx24 } from "react/jsx-runtime";
16508
16417
  var PeriodToggle = ({
16509
16418
  options,
@@ -16514,7 +16423,7 @@ var PeriodToggle = ({
16514
16423
  const { t: t2 } = useTranslation();
16515
16424
  const { settings } = useEmbed();
16516
16425
  const isLightBackground = useIsLightBackground();
16517
- const savingsPercentage = useMemo11(() => {
16426
+ const savingsPercentage = useMemo10(() => {
16518
16427
  if (selectedPlan) {
16519
16428
  const monthlyBillingPrice = getPlanPrice(selectedPlan, "month");
16520
16429
  const yearlyBillingPrice = getPlanPrice(selectedPlan, "year");
@@ -16600,10 +16509,10 @@ var PeriodToggle = ({
16600
16509
  };
16601
16510
 
16602
16511
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
16603
- import { useMemo as useMemo13 } from "react";
16512
+ import { useMemo as useMemo12 } from "react";
16604
16513
 
16605
16514
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
16606
- import { useMemo as useMemo12 } from "react";
16515
+ import { useMemo as useMemo11 } from "react";
16607
16516
  import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
16608
16517
  var PriceText = ({
16609
16518
  feature,
@@ -16613,7 +16522,7 @@ var PriceText = ({
16613
16522
  perUnitPrice = 0
16614
16523
  }) => {
16615
16524
  const { settings } = useEmbed();
16616
- const text = useMemo12(() => {
16525
+ const text = useMemo11(() => {
16617
16526
  if (!flatAmount && perUnitPrice) {
16618
16527
  return /* @__PURE__ */ jsxs19(Fragment11, { children: [
16619
16528
  formatCurrency(perUnitPrice, currency),
@@ -16661,7 +16570,7 @@ var PricingTiersTooltip = ({
16661
16570
  const { t: t2 } = useTranslation();
16662
16571
  const { settings } = useEmbed();
16663
16572
  const isLightBackground = useIsLightBackground();
16664
- const { tiers } = useMemo13(() => {
16573
+ const { tiers } = useMemo12(() => {
16665
16574
  return priceTiers.reduce(
16666
16575
  (acc, tier) => {
16667
16576
  const end = tier.upTo ?? Infinity;
@@ -16752,13 +16661,13 @@ var PricingTiersTooltip = ({
16752
16661
  };
16753
16662
 
16754
16663
  // src/components/shared/tiered-pricing-details/TieredPricingDetails.tsx
16755
- import { useMemo as useMemo14 } from "react";
16664
+ import { useMemo as useMemo13 } from "react";
16756
16665
  var TieredPricingDetails = ({
16757
16666
  entitlement,
16758
16667
  period
16759
16668
  }) => {
16760
16669
  const { t: t2 } = useTranslation();
16761
- const { currency, flatAmount, perUnitPrice, upTo } = useMemo14(() => {
16670
+ const { currency, flatAmount, perUnitPrice, upTo } = useMemo13(() => {
16762
16671
  const { currency: currency2, priceTier } = getEntitlementPrice(entitlement, period) || {};
16763
16672
  const { flatAmount: flatAmount2, perUnitPrice: perUnitPrice2, perUnitPriceDecimal, upTo: upTo2 } = priceTier?.[0] || {};
16764
16673
  return {
@@ -16806,7 +16715,7 @@ var TieredPricingDetails = ({
16806
16715
  };
16807
16716
 
16808
16717
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
16809
- 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";
16810
16719
  import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
16811
16720
  var UnsubscribeDialog = ({ top = 0 }) => {
16812
16721
  const { t: t2 } = useTranslation();
@@ -16814,7 +16723,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
16814
16723
  const contentRef = useRef8(null);
16815
16724
  const [error, setError] = useState12();
16816
16725
  const [isLoading, setIsLoading] = useState12(false);
16817
- const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo15(() => {
16726
+ const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo14(() => {
16818
16727
  const cancelDate2 = data?.subscription?.cancelAt || data?.upcomingInvoice?.dueDate;
16819
16728
  return {
16820
16729
  planPeriod: data?.company?.plan?.planPeriod || "month",
@@ -16831,7 +16740,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
16831
16740
  data?.upcomingInvoice?.dueDate
16832
16741
  ]);
16833
16742
  const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
16834
- const selectedPlan = useMemo15(
16743
+ const selectedPlan = useMemo14(
16835
16744
  () => availablePlans.find((plan) => plan.id === currentPlan?.id),
16836
16745
  [currentPlan?.id, availablePlans]
16837
16746
  );
@@ -16840,7 +16749,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
16840
16749
  createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
16841
16750
  []
16842
16751
  );
16843
- const addOns = useMemo15(
16752
+ const addOns = useMemo14(
16844
16753
  () => availableAddOns.map((available) => ({
16845
16754
  ...available,
16846
16755
  isSelected: currentAddOns.some((current) => available.id === current.id) ?? false
@@ -17109,7 +17018,7 @@ var Viewport = forwardRef5(
17109
17018
  const portalRef = useRef9(portal || document.body);
17110
17019
  const { data, layout, settings } = useEmbed();
17111
17020
  const [top, setTop] = useState13(0);
17112
- const { canCheckout, isBadgeVisible } = useMemo16(() => {
17021
+ const { canCheckout, isBadgeVisible } = useMemo15(() => {
17113
17022
  return {
17114
17023
  canCheckout: data?.capabilities?.checkout ?? true,
17115
17024
  isBadgeVisible: !data?.capabilities?.badgeVisibility || settings.badge?.visibility !== "hidden"
@@ -17211,10 +17120,10 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
17211
17120
  ButtonElement.displayName = "Button";
17212
17121
 
17213
17122
  // src/components/elements/included-features/IncludedFeatures.tsx
17214
- 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";
17215
17124
 
17216
17125
  // src/components/elements/included-features/UsageDetails.tsx
17217
- import { Fragment as Fragment14, useMemo as useMemo17 } from "react";
17126
+ import { Fragment as Fragment14, useMemo as useMemo16 } from "react";
17218
17127
  import { Fragment as Fragment15, jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
17219
17128
  var UsageDetails = ({
17220
17129
  entitlement,
@@ -17233,17 +17142,17 @@ var UsageDetails = ({
17233
17142
  } = entitlement;
17234
17143
  const { t: t2 } = useTranslation();
17235
17144
  const { data } = useEmbed();
17236
- const { period, showCredits } = useMemo17(() => {
17145
+ const { period, showCredits } = useMemo16(() => {
17237
17146
  return {
17238
17147
  period: data?.company?.plan?.planPeriod || void 0,
17239
17148
  showCredits: data?.showCredits ?? true
17240
17149
  };
17241
17150
  }, [data?.company?.plan?.planPeriod, data?.showCredits]);
17242
- const { billingPrice, cost, currentTier } = useMemo17(
17151
+ const { billingPrice, cost, currentTier } = useMemo16(
17243
17152
  () => getUsageDetails(entitlement, period),
17244
17153
  [entitlement, period]
17245
17154
  );
17246
- const text = useMemo17(() => {
17155
+ const text = useMemo16(() => {
17247
17156
  if (!feature) {
17248
17157
  return;
17249
17158
  }
@@ -17319,7 +17228,7 @@ var UsageDetails = ({
17319
17228
  currentTier,
17320
17229
  showCredits
17321
17230
  ]);
17322
- const usageText = useMemo17(() => {
17231
+ const usageText = useMemo16(() => {
17323
17232
  if (!feature) {
17324
17233
  return;
17325
17234
  }
@@ -17472,7 +17381,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17472
17381
  const shouldWrapChildren = useWrapChildren(elementsRef);
17473
17382
  const isLightBackground = useIsLightBackground();
17474
17383
  const [showCount, setShowCount] = useState14(VISIBLE_ENTITLEMENT_COUNT);
17475
- const { plan, addOns, featureUsage } = useMemo18(() => {
17384
+ const { plan, addOns, featureUsage } = useMemo17(() => {
17476
17385
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
17477
17386
  (acc, id) => {
17478
17387
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -17751,7 +17660,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
17751
17660
  Invoices.displayName = "Invoices";
17752
17661
 
17753
17662
  // src/components/elements/metered-features/MeteredFeatures.tsx
17754
- 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";
17755
17664
 
17756
17665
  // src/components/elements/metered-features/Meter.tsx
17757
17666
  import { jsx as jsx36 } from "react/jsx-runtime";
@@ -17958,7 +17867,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
17958
17867
  const { t: t2 } = useTranslation();
17959
17868
  const { data, settings, setCheckoutState } = useEmbed();
17960
17869
  const isLightBackground = useIsLightBackground();
17961
- const meteredFeatures = useMemo19(() => {
17870
+ const meteredFeatures = useMemo18(() => {
17962
17871
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
17963
17872
  (acc, id) => {
17964
17873
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -18253,10 +18162,10 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18253
18162
  MeteredFeatures.displayName = "MeteredFeatures";
18254
18163
 
18255
18164
  // src/components/elements/payment-method/PaymentMethod.tsx
18256
- import { forwardRef as forwardRef10, useMemo as useMemo21 } from "react";
18165
+ import { forwardRef as forwardRef10, useMemo as useMemo20 } from "react";
18257
18166
 
18258
18167
  // src/components/elements/payment-method/PaymentMethodElement.tsx
18259
- import { useMemo as useMemo20 } from "react";
18168
+ import { useMemo as useMemo19 } from "react";
18260
18169
  import { jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
18261
18170
  var PaymentElement2 = ({
18262
18171
  iconName,
@@ -18376,7 +18285,7 @@ var PaymentListElement = ({
18376
18285
  }) => {
18377
18286
  const isLightBackground = useIsLightBackground();
18378
18287
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
18379
- const expirationDate = useMemo20(() => {
18288
+ const expirationDate = useMemo19(() => {
18380
18289
  const { cardExpMonth, cardExpYear } = paymentMethod;
18381
18290
  if (!cardExpMonth || !cardExpYear) {
18382
18291
  return;
@@ -18464,7 +18373,7 @@ var resolveDesignProps5 = (props) => {
18464
18373
  var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
18465
18374
  const props = resolveDesignProps5(rest);
18466
18375
  const { data, setLayout } = useEmbed();
18467
- const { paymentMethod, monthsToExpiration } = useMemo21(() => {
18376
+ const { paymentMethod, monthsToExpiration } = useMemo20(() => {
18468
18377
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
18469
18378
  let monthsToExpiration2;
18470
18379
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -18539,7 +18448,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
18539
18448
  }
18540
18449
  stripe._registerWrapper({
18541
18450
  name: "stripe-js",
18542
- version: "8.1.0",
18451
+ version: "8.2.0",
18543
18452
  startTime
18544
18453
  });
18545
18454
  };
@@ -18614,7 +18523,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
18614
18523
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
18615
18524
  var expectedVersion = RELEASE_TRAIN;
18616
18525
  if (isTestKey && version !== expectedVersion) {
18617
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
18526
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.2.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
18618
18527
  }
18619
18528
  var stripe = maybeStripe.apply(void 0, args);
18620
18529
  registerWrapper(stripe, startTime);
@@ -18651,7 +18560,7 @@ var loadStripe = function loadStripe2() {
18651
18560
  };
18652
18561
 
18653
18562
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
18654
- 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";
18655
18564
  import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
18656
18565
  var resolveDesignProps6 = () => {
18657
18566
  return {
@@ -18680,7 +18589,7 @@ var PaymentMethodDetails = ({
18680
18589
  updatePaymentMethod,
18681
18590
  deletePaymentMethod
18682
18591
  } = useEmbed();
18683
- const { defaultPaymentMethod, paymentMethods, subscription } = useMemo22(() => {
18592
+ const { defaultPaymentMethod, paymentMethods, subscription } = useMemo21(() => {
18684
18593
  return {
18685
18594
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
18686
18595
  paymentMethods: data?.company?.paymentMethods || [],
@@ -18711,7 +18620,7 @@ var PaymentMethodDetails = ({
18711
18620
  },
18712
18621
  autoConfirm: true
18713
18622
  });
18714
- const monthsToExpiration = useMemo22(() => {
18623
+ const monthsToExpiration = useMemo21(() => {
18715
18624
  let expiration;
18716
18625
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
18717
18626
  const now = /* @__PURE__ */ new Date();
@@ -18954,7 +18863,7 @@ var PaymentMethodDetails = ({
18954
18863
  };
18955
18864
 
18956
18865
  // src/components/elements/plan-manager/PlanManager.tsx
18957
- import { forwardRef as forwardRef11, useMemo as useMemo24 } from "react";
18866
+ import { forwardRef as forwardRef11, useMemo as useMemo23 } from "react";
18958
18867
 
18959
18868
  // src/components/elements/plan-manager/AddOn.tsx
18960
18869
  import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -18978,7 +18887,7 @@ var AddOn = ({ addOn, currency, layout }) => {
18978
18887
  };
18979
18888
 
18980
18889
  // src/components/elements/plan-manager/UsageDetails.tsx
18981
- import { Fragment as Fragment19, useMemo as useMemo23 } from "react";
18890
+ import { Fragment as Fragment19, useMemo as useMemo22 } from "react";
18982
18891
  import { Fragment as Fragment20, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
18983
18892
  var UsageDetails2 = ({
18984
18893
  entitlement,
@@ -18993,11 +18902,11 @@ var UsageDetails2 = ({
18993
18902
  limit,
18994
18903
  amount = 0,
18995
18904
  cost = 0
18996
- } = useMemo23(
18905
+ } = useMemo22(
18997
18906
  () => getUsageDetails(entitlement, period),
18998
18907
  [entitlement, period]
18999
18908
  );
19000
- const description = useMemo23(() => {
18909
+ const description = useMemo22(() => {
19001
18910
  const acc = [];
19002
18911
  let index = 0;
19003
18912
  if (entitlement.priceBehavior === "overage" /* Overage */) {
@@ -19161,7 +19070,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19161
19070
  showCredits,
19162
19071
  showZeroPriceAsFree,
19163
19072
  trialPaymentMethodRequired
19164
- } = useMemo24(() => {
19073
+ } = useMemo23(() => {
19165
19074
  return {
19166
19075
  currentPlan: data?.company?.plan,
19167
19076
  currentAddOns: data?.company?.addOns || [],
@@ -19205,7 +19114,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19205
19114
  data?.showZeroPriceAsFree,
19206
19115
  data?.trialPaymentMethodRequired
19207
19116
  ]);
19208
- const usageBasedEntitlements = useMemo24(
19117
+ const usageBasedEntitlements = useMemo23(
19209
19118
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
19210
19119
  [featureUsage]
19211
19120
  );
@@ -19214,7 +19123,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19214
19123
  subscriptionCurrency,
19215
19124
  willSubscriptionCancel,
19216
19125
  isTrialSubscription
19217
- } = useMemo24(() => {
19126
+ } = useMemo23(() => {
19218
19127
  const subscriptionInterval2 = billingSubscription?.interval;
19219
19128
  const subscriptionCurrency2 = billingSubscription?.currency;
19220
19129
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -19532,12 +19441,12 @@ import {
19532
19441
  forwardRef as forwardRef12,
19533
19442
  useCallback as useCallback14,
19534
19443
  useEffect as useEffect8,
19535
- useMemo as useMemo27,
19444
+ useMemo as useMemo26,
19536
19445
  useState as useState18
19537
19446
  } from "react";
19538
19447
 
19539
19448
  // src/components/elements/pricing-table/AddOn.tsx
19540
- import { useMemo as useMemo25 } from "react";
19449
+ import { useMemo as useMemo24 } from "react";
19541
19450
  import { Fragment as Fragment22, jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
19542
19451
  function renderMeteredEntitlementPricing2({
19543
19452
  priceBehavior,
@@ -19587,7 +19496,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
19587
19496
  const { t: t2 } = useTranslation();
19588
19497
  const { data, settings, setCheckoutState } = useEmbed();
19589
19498
  const isLightBackground = useIsLightBackground();
19590
- const { currentAddOns, canCheckout, isStandalone } = useMemo25(() => {
19499
+ const { currentAddOns, canCheckout, isStandalone } = useMemo24(() => {
19591
19500
  const isStandalone2 = typeof data?.component === "undefined";
19592
19501
  return {
19593
19502
  currentAddOns: data?.company?.addOns || [],
@@ -19821,7 +19730,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
19821
19730
  };
19822
19731
 
19823
19732
  // src/components/elements/pricing-table/Plan.tsx
19824
- import { useMemo as useMemo26 } from "react";
19733
+ import { useMemo as useMemo25 } from "react";
19825
19734
 
19826
19735
  // src/components/elements/pricing-table/Entitlement.tsx
19827
19736
  import { Fragment as Fragment23, jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
@@ -20010,7 +19919,7 @@ var Plan2 = ({
20010
19919
  isStandalone,
20011
19920
  showCredits,
20012
19921
  showZeroPriceAsFree
20013
- } = useMemo26(() => {
19922
+ } = useMemo25(() => {
20014
19923
  const isStandalone2 = typeof data?.component === "undefined";
20015
19924
  return {
20016
19925
  currentPeriod: data?.company?.plan?.planPeriod || "month",
@@ -20351,7 +20260,7 @@ var PricingTable = forwardRef12(({ className, ...rest }, ref) => {
20351
20260
  },
20352
20261
  []
20353
20262
  );
20354
- const { currentPeriod, isStandalone } = useMemo27(() => {
20263
+ const { currentPeriod, isStandalone } = useMemo26(() => {
20355
20264
  const isStandalone2 = typeof data?.component === "undefined";
20356
20265
  return {
20357
20266
  currentPeriod: data?.company?.plan?.planPeriod || "month",
@@ -20563,7 +20472,7 @@ var TextElement = forwardRef13(({ children, className, ...rest }, ref) => {
20563
20472
  TextElement.displayName = "Text";
20564
20473
 
20565
20474
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
20566
- import { forwardRef as forwardRef14, useMemo as useMemo28 } from "react";
20475
+ import { forwardRef as forwardRef14, useMemo as useMemo27 } from "react";
20567
20476
  import { jsx as jsx50 } from "react/jsx-runtime";
20568
20477
  var buttonStyles = {
20569
20478
  primary: {
@@ -20594,7 +20503,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
20594
20503
  const props = resolveDesignProps10(rest);
20595
20504
  const { t: t2 } = useTranslation();
20596
20505
  const { data, setLayout } = useEmbed();
20597
- const hasActiveSubscription = useMemo28(() => {
20506
+ const hasActiveSubscription = useMemo27(() => {
20598
20507
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
20599
20508
  }, [data?.subscription]);
20600
20509
  if (!hasActiveSubscription) {
@@ -20629,7 +20538,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
20629
20538
  UnsubscribeButton.displayName = "UnsubscribeButton";
20630
20539
 
20631
20540
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
20632
- 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";
20633
20542
  import { jsx as jsx51, jsxs as jsxs39 } from "react/jsx-runtime";
20634
20543
  function resolveDesignProps11(props) {
20635
20544
  return {
@@ -20658,7 +20567,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
20658
20567
  const [error, setError] = useState19();
20659
20568
  const [upcomingInvoice, setUpcomingInvoice] = useState19();
20660
20569
  const [balances, setBalances] = useState19([]);
20661
- const discounts = useMemo29(() => {
20570
+ const discounts = useMemo28(() => {
20662
20571
  return (data?.subscription?.discounts || []).map((discount) => ({
20663
20572
  couponId: discount.couponId,
20664
20573
  customerFacingCode: discount.customerFacingCode || void 0,
@@ -25250,17 +25159,6 @@ export {
25250
25159
  };
25251
25160
  /*! Bundled license information:
25252
25161
 
25253
- use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
25254
- (**
25255
- * @license React
25256
- * use-sync-external-store-shim.development.js
25257
- *
25258
- * Copyright (c) Meta Platforms, Inc. and affiliates.
25259
- *
25260
- * This source code is licensed under the MIT license found in the
25261
- * LICENSE file in the root directory of this source tree.
25262
- *)
25263
-
25264
25162
  pako/dist/pako.esm.mjs:
25265
25163
  (*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
25266
25164
  */