@schematichq/schematic-components 2.29.0 → 2.29.1

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.
@@ -1867,6 +1867,7 @@ __export(index_exports, {
1867
1867
  useCustomPlanBilling: () => useCustomPlanBilling,
1868
1868
  useEmbed: () => useEmbed,
1869
1869
  useIsLightBackground: () => useIsLightBackground,
1870
+ useNextBillDate: () => useNextBillDate,
1870
1871
  usePaymentConfirmation: () => usePaymentConfirmation,
1871
1872
  useRequest: () => useRequest,
1872
1873
  useSubscriptionCurrency: () => useSubscriptionCurrency,
@@ -1877,10 +1878,10 @@ __export(index_exports, {
1877
1878
  module.exports = __toCommonJS(index_exports);
1878
1879
 
1879
1880
  // src/components/elements/button/Button.tsx
1880
- var import_react41 = require("react");
1881
+ var import_react42 = require("react");
1881
1882
 
1882
1883
  // src/components/layout/card/Card.tsx
1883
- var import_react20 = require("react");
1884
+ var import_react21 = require("react");
1884
1885
 
1885
1886
  // src/const/components.ts
1886
1887
  var VISIBLE_CREDIT_COUNT = 3;
@@ -3973,6 +3974,10 @@ function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
3973
3974
  }
3974
3975
 
3975
3976
  // src/api/checkoutexternal/models/BillingCollectionMethod.ts
3977
+ var BillingCollectionMethod = {
3978
+ ChargeAutomatically: "charge_automatically",
3979
+ SendInvoice: "send_invoice"
3980
+ };
3976
3981
  function BillingCollectionMethodFromJSON(json) {
3977
3982
  return BillingCollectionMethodFromJSONTyped(json, false);
3978
3983
  }
@@ -6072,6 +6077,48 @@ function CompanyOverrideResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6072
6077
  };
6073
6078
  }
6074
6079
 
6080
+ // src/api/checkoutexternal/models/CompanyPaymentMethodResponseData.ts
6081
+ function CompanyPaymentMethodResponseDataFromJSON(json) {
6082
+ return CompanyPaymentMethodResponseDataFromJSONTyped(json, false);
6083
+ }
6084
+ function CompanyPaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6085
+ if (json == null) {
6086
+ return json;
6087
+ }
6088
+ return {
6089
+ accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
6090
+ accountName: json["account_name"] == null ? void 0 : json["account_name"],
6091
+ bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
6092
+ billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
6093
+ billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
6094
+ canRemove: json["can_remove"],
6095
+ cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
6096
+ cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
6097
+ cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
6098
+ cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
6099
+ externalId: json["external_id"],
6100
+ id: json["id"],
6101
+ isDefault: json["is_default"],
6102
+ type: json["type"]
6103
+ };
6104
+ }
6105
+
6106
+ // src/api/checkoutexternal/models/CompanyPaymentMethodsResponseData.ts
6107
+ function CompanyPaymentMethodsResponseDataFromJSON(json) {
6108
+ return CompanyPaymentMethodsResponseDataFromJSONTyped(json, false);
6109
+ }
6110
+ function CompanyPaymentMethodsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6111
+ if (json == null) {
6112
+ return json;
6113
+ }
6114
+ return {
6115
+ count: json["count"],
6116
+ paymentMethods: json["payment_methods"].map(
6117
+ CompanyPaymentMethodResponseDataFromJSON
6118
+ )
6119
+ };
6120
+ }
6121
+
6075
6122
  // src/api/checkoutexternal/models/CompanyPlanInvalidReason.ts
6076
6123
  var CompanyPlanInvalidReason = {
6077
6124
  DowngradeNotPermitted: "downgrade_not_permitted",
@@ -7475,6 +7522,20 @@ function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
7475
7522
  };
7476
7523
  }
7477
7524
 
7525
+ // src/api/checkoutexternal/models/GetCompanyPaymentMethodsResponse.ts
7526
+ function GetCompanyPaymentMethodsResponseFromJSON(json) {
7527
+ return GetCompanyPaymentMethodsResponseFromJSONTyped(json, false);
7528
+ }
7529
+ function GetCompanyPaymentMethodsResponseFromJSONTyped(json, ignoreDiscriminator) {
7530
+ if (json == null) {
7531
+ return json;
7532
+ }
7533
+ return {
7534
+ data: CompanyPaymentMethodsResponseDataFromJSON(json["data"]),
7535
+ params: json["params"]
7536
+ };
7537
+ }
7538
+
7478
7539
  // src/api/checkoutexternal/models/GetCompanyUpcomingInvoiceResponse.ts
7479
7540
  function GetCompanyUpcomingInvoiceResponseFromJSON(json) {
7480
7541
  return GetCompanyUpcomingInvoiceResponseFromJSONTyped(json, false);
@@ -8369,6 +8430,38 @@ var CheckoutexternalApi = class extends BaseAPI {
8369
8430
  );
8370
8431
  return await response.value();
8371
8432
  }
8433
+ /**
8434
+ * Get company payment methods
8435
+ */
8436
+ async getCompanyPaymentMethodsRaw(initOverrides) {
8437
+ const queryParameters = {};
8438
+ const headerParameters = {};
8439
+ if (this.configuration && this.configuration.apiKey) {
8440
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8441
+ "X-Schematic-Api-Key"
8442
+ );
8443
+ }
8444
+ const response = await this.request(
8445
+ {
8446
+ path: `/company/payment-methods`,
8447
+ method: "GET",
8448
+ headers: headerParameters,
8449
+ query: queryParameters
8450
+ },
8451
+ initOverrides
8452
+ );
8453
+ return new JSONApiResponse(
8454
+ response,
8455
+ (jsonValue) => GetCompanyPaymentMethodsResponseFromJSON(jsonValue)
8456
+ );
8457
+ }
8458
+ /**
8459
+ * Get company payment methods
8460
+ */
8461
+ async getCompanyPaymentMethods(initOverrides) {
8462
+ const response = await this.getCompanyPaymentMethodsRaw(initOverrides);
8463
+ return await response.value();
8464
+ }
8372
8465
  /**
8373
8466
  * Get company upcoming invoice
8374
8467
  */
@@ -13306,6 +13399,7 @@ var en = {
13306
13399
  "Error saving custom field values. Please try again.": "Error saving custom field values. Please try again.",
13307
13400
  "Pay now": "Pay now",
13308
13401
  "Payment Details": "Payment Details",
13402
+ "Payment due": "Payment due {{date}}",
13309
13403
  "Plan selected": "Plan selected",
13310
13404
  "Please accept the agreement to continue.": "Please accept the agreement to continue.",
13311
13405
  "Please try again later.": "Please try again later.",
@@ -15567,7 +15661,7 @@ var reducer = (state, action) => {
15567
15661
  // src/context/EmbedProvider.tsx
15568
15662
  var import_jsx_runtime4 = require("react/jsx-runtime");
15569
15663
  var getCustomHeaders = (sessionId) => ({
15570
- "X-Schematic-Components-Version": "2.29.0",
15664
+ "X-Schematic-Components-Version": "2.29.1",
15571
15665
  "X-Schematic-Session-ID": sessionId
15572
15666
  });
15573
15667
  var normalizeCurrencyFilter = (filter2) => {
@@ -16353,8 +16447,31 @@ function useIsLightBackground() {
16353
16447
  return isLightBackground;
16354
16448
  }
16355
16449
 
16356
- // src/hooks/usePaymentConfirmation.ts
16450
+ // src/hooks/useNextBillDate.ts
16357
16451
  var import_react11 = require("react");
16452
+ function useNextBillDate(upcomingInvoice) {
16453
+ const { data } = useEmbed();
16454
+ const invoice = upcomingInvoice === void 0 ? data?.upcomingInvoice : upcomingInvoice;
16455
+ const subscription = data?.company?.billingSubscription;
16456
+ const cancelAtPeriodEnd = subscription?.cancelAtPeriodEnd;
16457
+ const periodEnd = subscription?.periodEnd;
16458
+ const collectionMethod = invoice?.collectionMethod;
16459
+ const dueDate = invoice?.dueDate ?? void 0;
16460
+ return (0, import_react11.useMemo)(() => {
16461
+ if (cancelAtPeriodEnd) {
16462
+ return { billDate: void 0, paymentDueDate: void 0 };
16463
+ }
16464
+ const billDate = periodEnd && periodEnd > 0 ? new Date(periodEnd * 1e3) : dueDate;
16465
+ const hasSeparateDeadline = collectionMethod === BillingCollectionMethod.SendInvoice && dueDate && billDate && new Date(dueDate).toDateString() !== new Date(billDate).toDateString();
16466
+ return {
16467
+ billDate,
16468
+ paymentDueDate: hasSeparateDeadline ? dueDate : void 0
16469
+ };
16470
+ }, [cancelAtPeriodEnd, periodEnd, collectionMethod, dueDate]);
16471
+ }
16472
+
16473
+ // src/hooks/usePaymentConfirmation.ts
16474
+ var import_react12 = require("react");
16358
16475
  var usePaymentConfirmation = ({
16359
16476
  stripe,
16360
16477
  clientSecret,
@@ -16362,24 +16479,24 @@ var usePaymentConfirmation = ({
16362
16479
  onError: onError3,
16363
16480
  autoConfirm = false
16364
16481
  }) => {
16365
- const [state, setState] = (0, import_react11.useState)(() => ({
16482
+ const [state, setState] = (0, import_react12.useState)(() => ({
16366
16483
  secret: clientSecret,
16367
16484
  status: "idle",
16368
16485
  error: null
16369
16486
  }));
16370
- const onSuccessRef = (0, import_react11.useRef)(onSuccess);
16371
- const onErrorRef = (0, import_react11.useRef)(onError3);
16372
- (0, import_react11.useEffect)(() => {
16487
+ const onSuccessRef = (0, import_react12.useRef)(onSuccess);
16488
+ const onErrorRef = (0, import_react12.useRef)(onError3);
16489
+ (0, import_react12.useEffect)(() => {
16373
16490
  onSuccessRef.current = onSuccess;
16374
16491
  onErrorRef.current = onError3;
16375
16492
  });
16376
- const confirmedSecrets = (0, import_react11.useRef)(/* @__PURE__ */ new Set());
16377
- const abortControllerRef = (0, import_react11.useRef)(null);
16493
+ const confirmedSecrets = (0, import_react12.useRef)(/* @__PURE__ */ new Set());
16494
+ const abortControllerRef = (0, import_react12.useRef)(null);
16378
16495
  const isCurrentSecret = state.secret === clientSecret;
16379
16496
  const status = isCurrentSecret ? state.status : "idle";
16380
16497
  const error = isCurrentSecret ? state.error : null;
16381
16498
  const isConfirming = status === "confirming";
16382
- const confirmPayment = (0, import_react11.useCallback)(async () => {
16499
+ const confirmPayment = (0, import_react12.useCallback)(async () => {
16383
16500
  if (!stripe || !clientSecret) {
16384
16501
  const err = new Error(
16385
16502
  "Missing required parameters: stripe instance or client secret"
@@ -16427,7 +16544,7 @@ var usePaymentConfirmation = ({
16427
16544
  abortControllerRef.current = null;
16428
16545
  }
16429
16546
  }, [stripe, clientSecret]);
16430
- const reset = (0, import_react11.useCallback)(() => {
16547
+ const reset = (0, import_react12.useCallback)(() => {
16431
16548
  if (clientSecret) {
16432
16549
  confirmedSecrets.current.delete(clientSecret);
16433
16550
  }
@@ -16437,12 +16554,12 @@ var usePaymentConfirmation = ({
16437
16554
  abortControllerRef.current = null;
16438
16555
  }
16439
16556
  }, [clientSecret]);
16440
- (0, import_react11.useEffect)(() => {
16557
+ (0, import_react12.useEffect)(() => {
16441
16558
  if (autoConfirm && status === "idle" && stripe && clientSecret) {
16442
16559
  queueMicrotask(confirmPayment);
16443
16560
  }
16444
16561
  }, [autoConfirm, stripe, clientSecret, status, confirmPayment]);
16445
- (0, import_react11.useEffect)(() => {
16562
+ (0, import_react12.useEffect)(() => {
16446
16563
  return () => {
16447
16564
  if (abortControllerRef.current) {
16448
16565
  abortControllerRef.current.abort();
@@ -16460,12 +16577,12 @@ var usePaymentConfirmation = ({
16460
16577
  };
16461
16578
 
16462
16579
  // src/hooks/useRequest.ts
16463
- var import_react12 = require("react");
16580
+ var import_react13 = require("react");
16464
16581
  function useRequest(fn) {
16465
- const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
16466
- const [error, setError] = (0, import_react12.useState)(null);
16467
- const [data, setData] = (0, import_react12.useState)(void 0);
16468
- const request = (0, import_react12.useCallback)(async () => {
16582
+ const [isLoading, setIsLoading] = (0, import_react13.useState)(false);
16583
+ const [error, setError] = (0, import_react13.useState)(null);
16584
+ const [data, setData] = (0, import_react13.useState)(void 0);
16585
+ const request = (0, import_react13.useCallback)(async () => {
16469
16586
  try {
16470
16587
  setError(null);
16471
16588
  setIsLoading(true);
@@ -16480,7 +16597,7 @@ function useRequest(fn) {
16480
16597
  setIsLoading(false);
16481
16598
  }
16482
16599
  }, [fn]);
16483
- const value = (0, import_react12.useMemo)(() => {
16600
+ const value = (0, import_react13.useMemo)(() => {
16484
16601
  const state = { isLoading, error, data };
16485
16602
  return [state, request];
16486
16603
  }, [isLoading, error, data, request]);
@@ -16488,11 +16605,11 @@ function useRequest(fn) {
16488
16605
  }
16489
16606
 
16490
16607
  // src/hooks/useTrialEnd.ts
16491
- var import_react13 = require("react");
16608
+ var import_react14 = require("react");
16492
16609
  function useTrialEnd() {
16493
16610
  const { data } = useEmbed();
16494
16611
  const { t: t3 } = useTranslation();
16495
- const { endDate, amount, units } = (0, import_react13.useMemo)(() => {
16612
+ const { endDate, amount, units } = (0, import_react14.useMemo)(() => {
16496
16613
  const billingSubscription = data?.company?.billingSubscription;
16497
16614
  const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
16498
16615
  let amount2;
@@ -16522,19 +16639,19 @@ function useTrialEnd() {
16522
16639
  }
16523
16640
 
16524
16641
  // src/hooks/useTruncatedList.ts
16525
- var import_react14 = require("react");
16642
+ var import_react15 = require("react");
16526
16643
  function useTruncatedList(items, { limit }) {
16527
- const [isExpandedState, setIsExpanded] = (0, import_react14.useState)(false);
16644
+ const [isExpandedState, setIsExpanded] = (0, import_react15.useState)(false);
16528
16645
  const total = items.length;
16529
16646
  const canExpand = total > limit;
16530
16647
  const isExpanded = canExpand && isExpandedState;
16531
- const visibleItems = (0, import_react14.useMemo)(
16648
+ const visibleItems = (0, import_react15.useMemo)(
16532
16649
  () => canExpand && !isExpanded ? items.slice(0, limit) : items,
16533
16650
  [items, limit, canExpand, isExpanded]
16534
16651
  );
16535
- const toggle = (0, import_react14.useCallback)(() => setIsExpanded((prev2) => !prev2), []);
16536
- const expand = (0, import_react14.useCallback)(() => setIsExpanded(true), []);
16537
- const collapse = (0, import_react14.useCallback)(() => setIsExpanded(false), []);
16652
+ const toggle = (0, import_react15.useCallback)(() => setIsExpanded((prev2) => !prev2), []);
16653
+ const expand = (0, import_react15.useCallback)(() => setIsExpanded(true), []);
16654
+ const collapse = (0, import_react15.useCallback)(() => setIsExpanded(false), []);
16538
16655
  return {
16539
16656
  items: visibleItems,
16540
16657
  total,
@@ -16548,10 +16665,10 @@ function useTruncatedList(items, { limit }) {
16548
16665
  }
16549
16666
 
16550
16667
  // src/hooks/useWrapChildren.ts
16551
- var import_react15 = require("react");
16668
+ var import_react16 = require("react");
16552
16669
  function useWrapChildren(ref) {
16553
- const [shouldWrap, setShouldWrap] = (0, import_react15.useState)([]);
16554
- (0, import_react15.useLayoutEffect)(() => {
16670
+ const [shouldWrap, setShouldWrap] = (0, import_react16.useState)([]);
16671
+ (0, import_react16.useLayoutEffect)(() => {
16555
16672
  const rowShouldWrap = (parent) => [...parent.children].some(
16556
16673
  (el) => el instanceof HTMLElement && el.previousElementSibling instanceof HTMLElement && el.offsetLeft <= el.previousElementSibling.offsetLeft
16557
16674
  );
@@ -17005,7 +17122,7 @@ var Checkbox = gt.input.attrs({ type: "checkbox" })`
17005
17122
  `;
17006
17123
 
17007
17124
  // src/components/ui/dialog/Dialog.tsx
17008
- var import_react16 = require("react");
17125
+ var import_react17 = require("react");
17009
17126
 
17010
17127
  // src/components/ui/dialog/styles.ts
17011
17128
  var DialogContent = gt.div`
@@ -17072,7 +17189,7 @@ var Dialog = gt.dialog(
17072
17189
 
17073
17190
  // src/components/ui/dialog/Dialog.tsx
17074
17191
  var import_jsx_runtime5 = require("react/jsx-runtime");
17075
- var Dialog2 = (0, import_react16.forwardRef)(
17192
+ var Dialog2 = (0, import_react17.forwardRef)(
17076
17193
  ({
17077
17194
  children,
17078
17195
  isModal = true,
@@ -17082,9 +17199,9 @@ var Dialog2 = (0, import_react16.forwardRef)(
17082
17199
  onClose,
17083
17200
  ...rest
17084
17201
  }, outerRef) => {
17085
- const innerRef = (0, import_react16.useRef)(null);
17086
- (0, import_react16.useImperativeHandle)(outerRef, () => innerRef.current, []);
17087
- (0, import_react16.useLayoutEffect)(() => {
17202
+ const innerRef = (0, import_react17.useRef)(null);
17203
+ (0, import_react17.useImperativeHandle)(outerRef, () => innerRef.current, []);
17204
+ (0, import_react17.useLayoutEffect)(() => {
17088
17205
  if (!isModal) {
17089
17206
  return;
17090
17207
  }
@@ -17096,7 +17213,7 @@ var Dialog2 = (0, import_react16.forwardRef)(
17096
17213
  document.body.style.overflow = initialOverflowValue;
17097
17214
  };
17098
17215
  }, [isModal]);
17099
- const dialog = (0, import_react16.useMemo)(
17216
+ const dialog = (0, import_react17.useMemo)(
17100
17217
  () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17101
17218
  Dialog,
17102
17219
  {
@@ -17145,9 +17262,9 @@ var DialogClose = ({ onClose, ...rest }) => {
17145
17262
  };
17146
17263
 
17147
17264
  // src/components/ui/dialog/DialogContent.tsx
17148
- var import_react17 = require("react");
17265
+ var import_react18 = require("react");
17149
17266
  var import_jsx_runtime7 = require("react/jsx-runtime");
17150
- var DialogContent2 = (0, import_react17.forwardRef)(({ children }, ref) => {
17267
+ var DialogContent2 = (0, import_react18.forwardRef)(({ children }, ref) => {
17151
17268
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogContent, { ref, children });
17152
17269
  });
17153
17270
  DialogContent2.displayName = "DialogContent";
@@ -17338,7 +17455,7 @@ var Overlay = gt(Flex)(({ theme }) => {
17338
17455
  });
17339
17456
 
17340
17457
  // src/components/ui/progress-bar/ProgressBar.tsx
17341
- var import_react18 = require("react");
17458
+ var import_react19 = require("react");
17342
17459
  var import_jsx_runtime10 = require("react/jsx-runtime");
17343
17460
  var progressColorMap = [
17344
17461
  "blue",
@@ -17348,7 +17465,7 @@ var progressColorMap = [
17348
17465
  "red",
17349
17466
  "red"
17350
17467
  ];
17351
- var ProgressBar = (0, import_react18.forwardRef)(
17468
+ var ProgressBar = (0, import_react19.forwardRef)(
17352
17469
  ({
17353
17470
  progress,
17354
17471
  value,
@@ -17556,7 +17673,7 @@ var Toggle = gt.input.attrs({ type: "checkbox" })`
17556
17673
 
17557
17674
  // src/components/ui/tooltip/Tooltip.tsx
17558
17675
  var import_debounce3 = __toESM(require_debounce());
17559
- var import_react19 = require("react");
17676
+ var import_react20 = require("react");
17560
17677
  var import_react_dom = require("react-dom");
17561
17678
 
17562
17679
  // src/components/ui/tooltip/styles.ts
@@ -17726,10 +17843,10 @@ var Tooltip = ({
17726
17843
  position: position2 = "top",
17727
17844
  ...rest
17728
17845
  }) => {
17729
- const triggerRef = (0, import_react19.useRef)(null);
17730
- const [show, setShow] = (0, import_react19.useState)(false);
17731
- const [coords2, setCoords] = (0, import_react19.useState)({ x: 0, y: 0 });
17732
- const updateCoords = (0, import_react19.useCallback)(() => {
17846
+ const triggerRef = (0, import_react20.useRef)(null);
17847
+ const [show, setShow] = (0, import_react20.useState)(false);
17848
+ const [coords2, setCoords] = (0, import_react20.useState)({ x: 0, y: 0 });
17849
+ const updateCoords = (0, import_react20.useCallback)(() => {
17733
17850
  const coords3 = getCoords({
17734
17851
  element: triggerRef.current,
17735
17852
  portal,
@@ -17737,7 +17854,7 @@ var Tooltip = ({
17737
17854
  });
17738
17855
  setCoords(coords3);
17739
17856
  }, [portal, position2]);
17740
- (0, import_react19.useLayoutEffect)(() => {
17857
+ (0, import_react20.useLayoutEffect)(() => {
17741
17858
  updateCoords();
17742
17859
  const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17743
17860
  window.addEventListener("resize", handleResize);
@@ -17748,7 +17865,7 @@ var Tooltip = ({
17748
17865
  };
17749
17866
  }, [updateCoords]);
17750
17867
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
17751
- (0, import_react19.cloneElement)(trigger, {
17868
+ (0, import_react20.cloneElement)(trigger, {
17752
17869
  ref: triggerRef,
17753
17870
  onFocus: () => setShow(true),
17754
17871
  onBlur: () => setShow(false),
@@ -17804,7 +17921,7 @@ var StyledCard = gt.div(({ theme }) => {
17804
17921
 
17805
17922
  // src/components/layout/card/Card.tsx
17806
17923
  var import_jsx_runtime12 = require("react/jsx-runtime");
17807
- var Card = (0, import_react20.forwardRef)(
17924
+ var Card = (0, import_react21.forwardRef)(
17808
17925
  ({ children, className }, ref) => {
17809
17926
  const { settings, isPending } = useEmbed();
17810
17927
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledCard, { ref, className, children: [
@@ -17832,7 +17949,7 @@ var Card = (0, import_react20.forwardRef)(
17832
17949
  Card.displayName = "Card";
17833
17950
 
17834
17951
  // src/components/layout/column/Column.tsx
17835
- var import_react21 = require("react");
17952
+ var import_react22 = require("react");
17836
17953
 
17837
17954
  // src/components/layout/column/styles.ts
17838
17955
  var StyledColumn = gt.div`
@@ -17841,15 +17958,15 @@ var StyledColumn = gt.div`
17841
17958
 
17842
17959
  // src/components/layout/column/Column.tsx
17843
17960
  var import_jsx_runtime13 = require("react/jsx-runtime");
17844
- var Column = (0, import_react21.forwardRef)(
17961
+ var Column = (0, import_react22.forwardRef)(
17845
17962
  ({ children, basis, ...props }, ref) => {
17846
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StyledColumn, { ref, ...props, children: import_react21.Children.count(children) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Card, { children }) : children });
17963
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StyledColumn, { ref, ...props, children: import_react22.Children.count(children) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Card, { children }) : children });
17847
17964
  }
17848
17965
  );
17849
17966
  Column.displayName = "Column";
17850
17967
 
17851
17968
  // src/components/layout/root/Root.tsx
17852
- var import_react22 = require("react");
17969
+ var import_react23 = require("react");
17853
17970
 
17854
17971
  // src/components/layout/root/styles.ts
17855
17972
  var ResetStyle = ft`
@@ -17888,7 +18005,7 @@ var Container = gt.div`
17888
18005
 
17889
18006
  // src/components/layout/root/Root.tsx
17890
18007
  var import_jsx_runtime14 = require("react/jsx-runtime");
17891
- var Root = (0, import_react22.forwardRef)(
18008
+ var Root = (0, import_react23.forwardRef)(
17892
18009
  ({ data, settings, ...props }, ref) => {
17893
18010
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Container, { ref, ...props });
17894
18011
  }
@@ -17897,7 +18014,7 @@ Root.displayName = "Root";
17897
18014
 
17898
18015
  // src/components/layout/viewport/Viewport.tsx
17899
18016
  var import_debounce5 = __toESM(require_debounce());
17900
- var import_react40 = require("react");
18017
+ var import_react41 = require("react");
17901
18018
  var import_react_dom3 = require("react-dom");
17902
18019
 
17903
18020
  // src/components/shared/auto-topup-notice/AutoTopupNotice.tsx
@@ -18103,7 +18220,7 @@ var ButtonGroup = ({
18103
18220
  };
18104
18221
 
18105
18222
  // src/components/shared/checkout-dialog/Plan/Entitlement.tsx
18106
- var import_react23 = require("react");
18223
+ var import_react24 = require("react");
18107
18224
  var import_jsx_runtime19 = require("react/jsx-runtime");
18108
18225
  var Entitlement = ({
18109
18226
  portal,
@@ -18133,7 +18250,7 @@ var Entitlement = ({
18133
18250
  tiersMode
18134
18251
  } = entitlementBillingPrice || {};
18135
18252
  const tiered = entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementBillingPrice);
18136
- const text = (0, import_react23.useMemo)(() => {
18253
+ const text = (0, import_react24.useMemo)(() => {
18137
18254
  if (!entitlement.feature) {
18138
18255
  return;
18139
18256
  }
@@ -18241,7 +18358,7 @@ var Entitlement = ({
18241
18358
  selectedCurrency,
18242
18359
  showWarningThresholdAsLimit
18243
18360
  ]);
18244
- const usageText = (0, import_react23.useMemo)(() => {
18361
+ const usageText = (0, import_react24.useMemo)(() => {
18245
18362
  if (!entitlement.feature) {
18246
18363
  return;
18247
18364
  }
@@ -18324,7 +18441,7 @@ var Entitlement = ({
18324
18441
  };
18325
18442
 
18326
18443
  // src/components/shared/checkout-dialog/Plan/Plan.tsx
18327
- var import_react24 = require("react");
18444
+ var import_react25 = require("react");
18328
18445
  var import_jsx_runtime20 = require("react/jsx-runtime");
18329
18446
  var Plan = ({
18330
18447
  portal,
@@ -18340,7 +18457,7 @@ var Plan = ({
18340
18457
  const { data, settings } = useEmbed();
18341
18458
  const isLightBackground = useIsLightBackground();
18342
18459
  const trialEnd = useTrialEnd();
18343
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react24.useState)({});
18460
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react25.useState)({});
18344
18461
  const handleToggleShowAll = (id) => {
18345
18462
  setEntitlementVisibility((prev2) => {
18346
18463
  const updated = !(prev2[id] ?? false);
@@ -18587,7 +18704,7 @@ var Plan = ({
18587
18704
  };
18588
18705
 
18589
18706
  // src/components/shared/checkout-dialog/AutoTopup.tsx
18590
- var import_react25 = require("react");
18707
+ var import_react26 = require("react");
18591
18708
  var import_jsx_runtime21 = require("react/jsx-runtime");
18592
18709
  var AutoTopup = ({
18593
18710
  planCreditGrants,
@@ -18597,7 +18714,7 @@ var AutoTopup = ({
18597
18714
  const { settings } = useEmbed();
18598
18715
  const { t: t3, locale } = useTranslation();
18599
18716
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
18600
- const configurableCreditGrants = (0, import_react25.useMemo)(() => {
18717
+ const configurableCreditGrants = (0, import_react26.useMemo)(() => {
18601
18718
  return planCreditGrants.reduce(
18602
18719
  (acc, grant) => {
18603
18720
  if (isSelfServiceAutoTopupAvailable(grant)) {
@@ -18723,7 +18840,7 @@ var AutoTopup = ({
18723
18840
  };
18724
18841
 
18725
18842
  // src/components/shared/checkout-dialog/Quantity.tsx
18726
- var import_react26 = require("react");
18843
+ var import_react27 = require("react");
18727
18844
  var import_jsx_runtime22 = require("react/jsx-runtime");
18728
18845
  var Quantity = ({
18729
18846
  portal,
@@ -18738,12 +18855,12 @@ var Quantity = ({
18738
18855
  const isLightBackground = useIsLightBackground();
18739
18856
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
18740
18857
  const unitPriceFontSize = 0.875 * settings.theme.typography.text.fontSize;
18741
- const planCredits = (0, import_react26.useMemo)(
18858
+ const planCredits = (0, import_react27.useMemo)(
18742
18859
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
18743
18860
  [selectedPlan?.includedCreditGrants]
18744
18861
  );
18745
18862
  const prorationBehavior = data?.checkoutSettings?.prorationBehavior;
18746
- const renewalDate = data?.upcomingInvoice?.dueDate ?? void 0;
18863
+ const { billDate: renewalDate } = useNextBillDate();
18747
18864
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce((acc, entitlement) => {
18748
18865
  if (entitlement.feature) {
18749
18866
  const entitlementBillingPrice = getEntitlementPrice(
@@ -19423,7 +19540,7 @@ var Credits = ({
19423
19540
  };
19424
19541
 
19425
19542
  // src/components/shared/checkout-dialog/Checkout.tsx
19426
- var import_react28 = require("react");
19543
+ var import_react29 = require("react");
19427
19544
 
19428
19545
  // src/components/shared/payment-form/styles.ts
19429
19546
  var Label = gt.label`
@@ -19516,7 +19633,7 @@ var CustomCheckoutFields = ({
19516
19633
  };
19517
19634
 
19518
19635
  // src/components/shared/checkout-dialog/TaxIdField.tsx
19519
- var import_react27 = require("react");
19636
+ var import_react28 = require("react");
19520
19637
  var import_jsx_runtime26 = require("react/jsx-runtime");
19521
19638
  var Select = gt(Input2).attrs({ as: "select" })`
19522
19639
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23666' stroke-width='1.5' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
@@ -19531,7 +19648,7 @@ var TaxIdField = ({
19531
19648
  }) => {
19532
19649
  const { t: t3, locale } = useTranslation();
19533
19650
  const isLightBackground = useIsLightBackground();
19534
- const countryOptions = (0, import_react27.useMemo)(() => taxIdCountryOptions(locale), [locale]);
19651
+ const countryOptions = (0, import_react28.useMemo)(() => taxIdCountryOptions(locale), [locale]);
19535
19652
  const jurisdictions = taxIdJurisdictionsForCountry(value.country);
19536
19653
  const handleCountryChange = (country) => {
19537
19654
  const next2 = taxIdJurisdictionsForCountry(country);
@@ -19632,7 +19749,7 @@ var Checkout = ({
19632
19749
  }) => {
19633
19750
  const { t: t3 } = useTranslation();
19634
19751
  const isLightBackground = useIsLightBackground();
19635
- const [discount, setDiscount] = (0, import_react28.useState)(promoCode ?? "");
19752
+ const [discount, setDiscount] = (0, import_react29.useState)(promoCode ?? "");
19636
19753
  const hasCustomFields = !!customCheckoutFields && customCheckoutFields.length > 0;
19637
19754
  const showTaxId = collectTaxId && !!taxIdValues && !!onTaxIdChange;
19638
19755
  if (!isPaymentMethodRequired && !hasCustomFields && !showTaxId && !optInRequired) {
@@ -19756,7 +19873,7 @@ var Checkout = ({
19756
19873
 
19757
19874
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
19758
19875
  var import_debounce4 = __toESM(require_debounce());
19759
- var import_react29 = require("react");
19876
+ var import_react30 = require("react");
19760
19877
 
19761
19878
  // src/components/shared/checkout-dialog/Navigation.tsx
19762
19879
  var import_jsx_runtime28 = require("react/jsx-runtime");
@@ -19894,30 +20011,30 @@ var CheckoutDialog = ({ top }) => {
19894
20011
  getTaxId
19895
20012
  } = useEmbed();
19896
20013
  const isLightBackground = useIsLightBackground();
19897
- const dialogRef = (0, import_react29.useRef)(null);
19898
- const contentRef = (0, import_react29.useRef)(null);
19899
- const stageRef = (0, import_react29.useRef)(null);
19900
- const sidebarRef = (0, import_react29.useRef)(null);
19901
- const [dialogElement, setDialogElement] = (0, import_react29.useState)(
20014
+ const dialogRef = (0, import_react30.useRef)(null);
20015
+ const contentRef = (0, import_react30.useRef)(null);
20016
+ const stageRef = (0, import_react30.useRef)(null);
20017
+ const sidebarRef = (0, import_react30.useRef)(null);
20018
+ const [dialogElement, setDialogElement] = (0, import_react30.useState)(
19902
20019
  null
19903
20020
  );
19904
- const setDialog = (0, import_react29.useCallback)((element) => {
20021
+ const setDialog = (0, import_react30.useCallback)((element) => {
19905
20022
  dialogRef.current = element;
19906
20023
  setDialogElement(element);
19907
20024
  }, []);
19908
- const [confirmPaymentIntentProps, setConfirmPaymentIntentProps] = (0, import_react29.useState)(void 0);
19909
- const [charges, setCharges] = (0, import_react29.useState)();
19910
- const [paymentMethodId, setPaymentMethodId] = (0, import_react29.useState)(
20025
+ const [confirmPaymentIntentProps, setConfirmPaymentIntentProps] = (0, import_react30.useState)(void 0);
20026
+ const [charges, setCharges] = (0, import_react30.useState)();
20027
+ const [paymentMethodId, setPaymentMethodId] = (0, import_react30.useState)(
19911
20028
  () => {
19912
20029
  return data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId;
19913
20030
  }
19914
20031
  );
19915
- const [isLoading, setIsLoading] = (0, import_react29.useState)(false);
19916
- const [error, setError] = (0, import_react29.useState)();
19917
- const [isModal, setIsModal] = (0, import_react29.useState)(true);
20032
+ const [isLoading, setIsLoading] = (0, import_react30.useState)(false);
20033
+ const [error, setError] = (0, import_react30.useState)();
20034
+ const [isModal, setIsModal] = (0, import_react30.useState)(true);
19918
20035
  const showPeriodToggle = data?.displaySettings?.showPeriodToggle ?? true;
19919
20036
  const trialPaymentMethodRequired = data?.trialPaymentMethodRequired === true;
19920
- const featureUsage = (0, import_react29.useMemo)(
20037
+ const featureUsage = (0, import_react30.useMemo)(
19921
20038
  () => data?.featureUsage?.features ?? [],
19922
20039
  [data?.featureUsage?.features]
19923
20040
  );
@@ -19938,13 +20055,13 @@ var CheckoutDialog = ({ top }) => {
19938
20055
  }
19939
20056
  return requestedPeriod;
19940
20057
  };
19941
- const [planPeriod, setPlanPeriod] = (0, import_react29.useState)(getValidatedPeriod);
20058
+ const [planPeriod, setPlanPeriod] = (0, import_react30.useState)(getValidatedPeriod);
19942
20059
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
19943
20060
  const lockedCurrency = useSubscriptionCurrency();
19944
20061
  const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
19945
20062
  const filterBlocksSubscriptionCurrency = hasCurrencyFilter && !!lockedCurrency && !currencyFilter.includes(lockedCurrency);
19946
20063
  const prefilledCurrency = checkoutState?.selectedCurrency?.toUpperCase();
19947
- const [selectedCurrency, setSelectedCurrency] = (0, import_react29.useState)(
20064
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react30.useState)(
19948
20065
  () => prefilledCurrency ?? currencies[0] ?? DEFAULT_CURRENCY
19949
20066
  );
19950
20067
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -19955,7 +20072,7 @@ var CheckoutDialog = ({ top }) => {
19955
20072
  const canSelectCurrency = currencies.length > 1 && !lockedCurrency && currencySelectorEnabled;
19956
20073
  const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
19957
20074
  const hasNoUsableCurrency = !lockedCurrency && currencies.length === 0;
19958
- (0, import_react29.useEffect)(() => {
20075
+ (0, import_react30.useEffect)(() => {
19959
20076
  if (filterBlocksSubscriptionCurrency) {
19960
20077
  console.error(
19961
20078
  `[Schematic] currencyFilter excludes the active subscription currency (${lockedCurrency}); keeping subscription currency.`
@@ -19972,8 +20089,8 @@ var CheckoutDialog = ({ top }) => {
19972
20089
  } = useAvailablePlans(planPeriod, {
19973
20090
  useSelectedPeriod: showPeriodToggle
19974
20091
  });
19975
- const [selectedPlanId, setSelectedPlanId] = (0, import_react29.useState)(void 0);
19976
- const selectedPlan = (0, import_react29.useMemo)(() => {
20092
+ const [selectedPlanId, setSelectedPlanId] = (0, import_react30.useState)(void 0);
20093
+ const selectedPlan = (0, import_react30.useMemo)(() => {
19977
20094
  if (selectedPlanId === null) {
19978
20095
  return void 0;
19979
20096
  }
@@ -19988,8 +20105,8 @@ var CheckoutDialog = ({ top }) => {
19988
20105
  (!plan.isTrialable || !plan.companyCanTrial)
19989
20106
  );
19990
20107
  }, [availablePlans, checkoutState, selectedPlanId]);
19991
- const [shouldTrial, setShouldTrial] = (0, import_react29.useState)(false);
19992
- const planCreditGrants = (0, import_react29.useMemo)(() => {
20108
+ const [shouldTrial, setShouldTrial] = (0, import_react30.useState)(false);
20109
+ const planCreditGrants = (0, import_react30.useMemo)(() => {
19993
20110
  const grants = mergeCompanyGrants(
19994
20111
  selectedPlan?.includedCreditGrants,
19995
20112
  data?.company?.plan?.includedCreditGrants
@@ -19999,7 +20116,7 @@ var CheckoutDialog = ({ top }) => {
19999
20116
  selectedPlan?.includedCreditGrants,
20000
20117
  data?.company?.plan?.includedCreditGrants
20001
20118
  ]);
20002
- const [autoTopupConfigs, setAutoTopupConfigs] = (0, import_react29.useState)(() => {
20119
+ const [autoTopupConfigs, setAutoTopupConfigs] = (0, import_react30.useState)(() => {
20003
20120
  const initialConfigs = data?.company?.plan?.includedCreditGrants.reduce(
20004
20121
  (acc, companyGrant) => {
20005
20122
  const {
@@ -20019,7 +20136,7 @@ var CheckoutDialog = ({ top }) => {
20019
20136
  );
20020
20137
  return new Map(initialConfigs);
20021
20138
  });
20022
- const [selectedAddOnIds, setSelectedAddOnIds] = (0, import_react29.useState)(() => {
20139
+ const [selectedAddOnIds, setSelectedAddOnIds] = (0, import_react30.useState)(() => {
20023
20140
  const ids = /* @__PURE__ */ new Set();
20024
20141
  if (checkoutState?.addOnIds) {
20025
20142
  for (const id of checkoutState.addOnIds) ids.add(id);
@@ -20035,11 +20152,11 @@ var CheckoutDialog = ({ top }) => {
20035
20152
  }
20036
20153
  return ids;
20037
20154
  });
20038
- const addOnCompatibilityLookup = (0, import_react29.useMemo)(
20155
+ const addOnCompatibilityLookup = (0, import_react30.useMemo)(
20039
20156
  () => buildAddOnCompatibilityLookup(data?.addOnCompatibilities),
20040
20157
  [data?.addOnCompatibilities]
20041
20158
  );
20042
- const addOns = (0, import_react29.useMemo)(() => {
20159
+ const addOns = (0, import_react30.useMemo)(() => {
20043
20160
  return availableAddOns.filter((availAddOn) => {
20044
20161
  if (hasCurrency && !planSupportsCurrency(availAddOn, effectiveCurrency)) {
20045
20162
  return false;
@@ -20065,20 +20182,20 @@ var CheckoutDialog = ({ top }) => {
20065
20182
  selectedAddOnIds
20066
20183
  ]);
20067
20184
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
20068
- const [bundleCounts, setBundleCounts] = (0, import_react29.useState)({});
20069
- const bundleCountsRef = (0, import_react29.useRef)(bundleCounts);
20185
+ const [bundleCounts, setBundleCounts] = (0, import_react30.useState)({});
20186
+ const bundleCountsRef = (0, import_react30.useRef)(bundleCounts);
20070
20187
  const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
20071
- const creditBundles = (0, import_react29.useMemo)(() => {
20188
+ const creditBundles = (0, import_react30.useMemo)(() => {
20072
20189
  return deriveCreditBundles(
20073
20190
  data?.creditBundles,
20074
20191
  bundleGatingPlanId,
20075
20192
  bundleCounts
20076
20193
  );
20077
20194
  }, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
20078
- const [hasInitialPaymentMethod] = (0, import_react29.useState)(
20195
+ const [hasInitialPaymentMethod] = (0, import_react30.useState)(
20079
20196
  () => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
20080
20197
  );
20081
- const isCreditOnlyPurchase = (0, import_react29.useMemo)(
20198
+ const isCreditOnlyPurchase = (0, import_react30.useMemo)(
20082
20199
  () => isCreditOnlyCheckout({
20083
20200
  plan: selectedPlan,
20084
20201
  creditBundles,
@@ -20095,7 +20212,7 @@ var CheckoutDialog = ({ top }) => {
20095
20212
  effectiveCurrency
20096
20213
  ]
20097
20214
  );
20098
- const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react29.useState)(
20215
+ const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react30.useState)(
20099
20216
  () => applyPrefilledQuantities(
20100
20217
  (selectedPlan?.entitlements || []).reduce(
20101
20218
  createActiveUsageBasedEntitlementsReducer(featureUsage, planPeriod),
@@ -20104,7 +20221,7 @@ var CheckoutDialog = ({ top }) => {
20104
20221
  checkoutState?.payInAdvanceQuantities
20105
20222
  )
20106
20223
  );
20107
- const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = (0, import_react29.useState)(() => {
20224
+ const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = (0, import_react30.useState)(() => {
20108
20225
  const currentAddOnEntitlements = (data?.company?.addOns || []).flatMap(
20109
20226
  (currentAddOn) => {
20110
20227
  const availableAddOn = availableAddOns.find(
@@ -20145,45 +20262,45 @@ var CheckoutDialog = ({ top }) => {
20145
20262
  checkoutState?.payInAdvanceQuantities
20146
20263
  );
20147
20264
  });
20148
- const payInAdvanceEntitlements = (0, import_react29.useMemo)(
20265
+ const payInAdvanceEntitlements = (0, import_react30.useMemo)(
20149
20266
  () => usageBasedEntitlements.filter(
20150
20267
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20151
20268
  ),
20152
20269
  [usageBasedEntitlements]
20153
20270
  );
20154
- const addOnPayInAdvanceEntitlements = (0, import_react29.useMemo)(
20271
+ const addOnPayInAdvanceEntitlements = (0, import_react30.useMemo)(
20155
20272
  () => addOnUsageBasedEntitlements.filter(
20156
20273
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20157
20274
  ),
20158
20275
  [addOnUsageBasedEntitlements]
20159
20276
  );
20160
- const [promoCode, setPromoCode] = (0, import_react29.useState)(
20277
+ const [promoCode, setPromoCode] = (0, import_react30.useState)(
20161
20278
  () => checkoutState?.promoCode ?? null
20162
20279
  );
20163
- const [customFieldValues, setCustomFieldValues] = (0, import_react29.useState)(() => {
20280
+ const [customFieldValues, setCustomFieldValues] = (0, import_react30.useState)(() => {
20164
20281
  const values = {};
20165
20282
  for (const field of data?.customCheckoutFields ?? []) {
20166
20283
  values[field.id] = field.value ?? "";
20167
20284
  }
20168
20285
  return values;
20169
20286
  });
20170
- const hasIncompleteRequiredCustomFields = (0, import_react29.useMemo)(() => {
20287
+ const hasIncompleteRequiredCustomFields = (0, import_react30.useMemo)(() => {
20171
20288
  return (data?.customCheckoutFields ?? []).some(
20172
20289
  (field) => field.required && !customFieldValues[field.id]?.trim()
20173
20290
  );
20174
20291
  }, [data?.customCheckoutFields, customFieldValues]);
20175
- const handleCustomFieldChange = (0, import_react29.useCallback)(
20292
+ const handleCustomFieldChange = (0, import_react30.useCallback)(
20176
20293
  (fieldId, value) => {
20177
20294
  setCustomFieldValues((prev2) => ({ ...prev2, [fieldId]: value }));
20178
20295
  },
20179
20296
  []
20180
20297
  );
20181
20298
  const collectTaxId = data?.checkoutSettings.collectTaxId ?? false;
20182
- const [taxIdValues, setTaxIdValues] = (0, import_react29.useState)(emptyTaxIdValues);
20183
- const [taxIdError, setTaxIdError] = (0, import_react29.useState)();
20184
- const lastSavedTaxIdRef = (0, import_react29.useRef)(void 0);
20185
- const pendingTaxIdSaveRef = (0, import_react29.useRef)(null);
20186
- (0, import_react29.useEffect)(() => {
20299
+ const [taxIdValues, setTaxIdValues] = (0, import_react30.useState)(emptyTaxIdValues);
20300
+ const [taxIdError, setTaxIdError] = (0, import_react30.useState)();
20301
+ const lastSavedTaxIdRef = (0, import_react30.useRef)(void 0);
20302
+ const pendingTaxIdSaveRef = (0, import_react30.useRef)(null);
20303
+ (0, import_react30.useEffect)(() => {
20187
20304
  if (!collectTaxId) {
20188
20305
  return;
20189
20306
  }
@@ -20210,19 +20327,19 @@ var CheckoutDialog = ({ top }) => {
20210
20327
  cancelled = true;
20211
20328
  };
20212
20329
  }, [collectTaxId, getTaxId]);
20213
- const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react29.useState)(false);
20214
- const [optInRequired, setOptInRequired] = (0, import_react29.useState)(false);
20215
- const [optInTitle, setOptInTitle] = (0, import_react29.useState)(null);
20216
- const [optInText, setOptInText] = (0, import_react29.useState)(null);
20217
- const [optInAccepted, setOptInAccepted] = (0, import_react29.useState)(false);
20218
- const presentedOptInRef = (0, import_react29.useRef)(null);
20219
- const [willScheduleDowngrade, setWillScheduleDowngrade] = (0, import_react29.useState)(false);
20220
- const willTrialWithoutPaymentMethod = (0, import_react29.useMemo)(
20330
+ const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react30.useState)(false);
20331
+ const [optInRequired, setOptInRequired] = (0, import_react30.useState)(false);
20332
+ const [optInTitle, setOptInTitle] = (0, import_react30.useState)(null);
20333
+ const [optInText, setOptInText] = (0, import_react30.useState)(null);
20334
+ const [optInAccepted, setOptInAccepted] = (0, import_react30.useState)(false);
20335
+ const presentedOptInRef = (0, import_react30.useRef)(null);
20336
+ const [willScheduleDowngrade, setWillScheduleDowngrade] = (0, import_react30.useState)(false);
20337
+ const willTrialWithoutPaymentMethod = (0, import_react30.useMemo)(
20221
20338
  () => shouldTrial && !trialPaymentMethodRequired,
20222
20339
  [shouldTrial, trialPaymentMethodRequired]
20223
20340
  );
20224
20341
  const isSelectedPlanTrialable = selectedPlan && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
20225
- const checkoutStages = (0, import_react29.useMemo)(() => {
20342
+ const checkoutStages = (0, import_react30.useMemo)(() => {
20226
20343
  const stages = [];
20227
20344
  const checkoutStage2 = {
20228
20345
  id: "checkout",
@@ -20310,10 +20427,10 @@ var CheckoutDialog = ({ top }) => {
20310
20427
  isCreditOnlyPurchase,
20311
20428
  hasInitialPaymentMethod
20312
20429
  ]);
20313
- const [isBypassLoading, setIsBypassLoading] = (0, import_react29.useState)(
20430
+ const [isBypassLoading, setIsBypassLoading] = (0, import_react30.useState)(
20314
20431
  () => checkoutState?.bypassPlanSelection || checkoutState?.bypassAddOnSelection || checkoutState?.bypassCreditsSelection || checkoutState?.bypassUsageSelection || checkoutState?.bypassAddOnUsageSelection
20315
20432
  );
20316
- const [checkoutStage, setCheckoutStage] = (0, import_react29.useState)(() => {
20433
+ const [checkoutStage, setCheckoutStage] = (0, import_react30.useState)(() => {
20317
20434
  if (checkoutState?.addOnId) {
20318
20435
  return "addons";
20319
20436
  }
@@ -20328,7 +20445,7 @@ var CheckoutDialog = ({ top }) => {
20328
20445
  }
20329
20446
  return "plan";
20330
20447
  });
20331
- const effectiveCheckoutStage = (0, import_react29.useMemo)(() => {
20448
+ const effectiveCheckoutStage = (0, import_react30.useMemo)(() => {
20332
20449
  if (isBypassLoading) return checkoutStage;
20333
20450
  let id = checkoutStage;
20334
20451
  if (id === "credits" && !checkoutStages.some((stage) => stage.id === id)) {
@@ -20342,9 +20459,9 @@ var CheckoutDialog = ({ top }) => {
20342
20459
  }
20343
20460
  return id;
20344
20461
  }, [checkoutStage, checkoutStages, checkoutState, isBypassLoading]);
20345
- const previewRequestIdRef = (0, import_react29.useRef)(0);
20462
+ const previewRequestIdRef = (0, import_react30.useRef)(0);
20346
20463
  const planStageVisible = checkoutStages.some((stage) => stage.id === "plan") && !checkoutState?.bypassPlanSelection;
20347
- const checkoutStageCurrencies = (0, import_react29.useMemo)(() => {
20464
+ const checkoutStageCurrencies = (0, import_react30.useMemo)(() => {
20348
20465
  if (!selectedPlan) return currencies;
20349
20466
  return currencies.filter(
20350
20467
  (currency) => planOffersCurrencyForPeriod(selectedPlan, planPeriod, currency)
@@ -20353,7 +20470,7 @@ var CheckoutDialog = ({ top }) => {
20353
20470
  const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
20354
20471
  const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
20355
20472
  const currencyPeriodMismatch = hasCurrency && !lockedCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
20356
- (0, import_react29.useEffect)(() => {
20473
+ (0, import_react30.useEffect)(() => {
20357
20474
  if (currencyPeriodMismatch) {
20358
20475
  console.error(
20359
20476
  `[Schematic] No ${effectiveCurrency} price for the "${planPeriod}" billing period on the selected plan; refusing to fall back to the default currency.`
@@ -20371,7 +20488,7 @@ var CheckoutDialog = ({ top }) => {
20371
20488
  selectedPlan?.id,
20372
20489
  debug
20373
20490
  ]);
20374
- const handlePreviewCheckout = (0, import_react29.useCallback)(
20491
+ const handlePreviewCheckout = (0, import_react30.useCallback)(
20375
20492
  async (updates) => {
20376
20493
  const period = updates.period || planPeriod;
20377
20494
  const plan = updates.plan || selectedPlan;
@@ -20551,12 +20668,12 @@ var CheckoutDialog = ({ top }) => {
20551
20668
  isBypassLoading
20552
20669
  ]
20553
20670
  );
20554
- const handlePreviewCheckoutRef = (0, import_react29.useRef)(handlePreviewCheckout);
20555
- (0, import_react29.useEffect)(() => {
20671
+ const handlePreviewCheckoutRef = (0, import_react30.useRef)(handlePreviewCheckout);
20672
+ (0, import_react30.useEffect)(() => {
20556
20673
  handlePreviewCheckoutRef.current = handlePreviewCheckout;
20557
20674
  }, [handlePreviewCheckout]);
20558
- const debouncedPreviewCheckoutRef = (0, import_react29.useRef)(null);
20559
- (0, import_react29.useEffect)(() => {
20675
+ const debouncedPreviewCheckoutRef = (0, import_react30.useRef)(null);
20676
+ (0, import_react30.useEffect)(() => {
20560
20677
  const debounced = (0, import_debounce4.default)(
20561
20678
  (updates) => handlePreviewCheckoutRef.current(updates),
20562
20679
  FETCH_DEBOUNCE_TIMEOUT,
@@ -20568,7 +20685,7 @@ var CheckoutDialog = ({ top }) => {
20568
20685
  debouncedPreviewCheckoutRef.current = null;
20569
20686
  };
20570
20687
  }, []);
20571
- const saveTaxId = (0, import_react29.useCallback)(
20688
+ const saveTaxId = (0, import_react30.useCallback)(
20572
20689
  async ({ refreshPreview = false } = {}) => {
20573
20690
  const input = toTaxIdInput(taxIdValues);
20574
20691
  if (!input) {
@@ -20602,13 +20719,13 @@ var CheckoutDialog = ({ top }) => {
20602
20719
  },
20603
20720
  [t3, taxIdValues, updateTaxId]
20604
20721
  );
20605
- const debouncedPreviewCheckout = (0, import_react29.useCallback)(
20722
+ const debouncedPreviewCheckout = (0, import_react30.useCallback)(
20606
20723
  (updates) => {
20607
20724
  debouncedPreviewCheckoutRef.current?.(updates);
20608
20725
  },
20609
20726
  []
20610
20727
  );
20611
- const selectPlan = (0, import_react29.useCallback)(
20728
+ const selectPlan = (0, import_react30.useCallback)(
20612
20729
  (updates) => {
20613
20730
  const plan = updates.plan;
20614
20731
  const period = showPeriodToggle ? updates.period || planPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
@@ -20680,7 +20797,7 @@ var CheckoutDialog = ({ top }) => {
20680
20797
  checkoutState?.payInAdvanceQuantities
20681
20798
  ]
20682
20799
  );
20683
- const changePlanPeriod = (0, import_react29.useCallback)(
20800
+ const changePlanPeriod = (0, import_react30.useCallback)(
20684
20801
  (period) => {
20685
20802
  if (period === planPeriod) {
20686
20803
  return;
@@ -20737,7 +20854,7 @@ var CheckoutDialog = ({ top }) => {
20737
20854
  handlePreviewCheckout
20738
20855
  ]
20739
20856
  );
20740
- const toggleAddOn = (0, import_react29.useCallback)(
20857
+ const toggleAddOn = (0, import_react30.useCallback)(
20741
20858
  (id) => {
20742
20859
  const updated = addOns.map((addOn) => ({
20743
20860
  ...addOn,
@@ -20770,7 +20887,7 @@ var CheckoutDialog = ({ top }) => {
20770
20887
  },
20771
20888
  [handlePreviewCheckout, addOnUsageBasedEntitlements, addOns]
20772
20889
  );
20773
- const updateAutoTopupConfig = (0, import_react29.useCallback)(
20890
+ const updateAutoTopupConfig = (0, import_react30.useCallback)(
20774
20891
  (id, updates) => {
20775
20892
  setAutoTopupConfigs((prev2) => {
20776
20893
  const nextMap = new Map(prev2);
@@ -20790,7 +20907,7 @@ var CheckoutDialog = ({ top }) => {
20790
20907
  },
20791
20908
  [debouncedPreviewCheckout, planCreditGrants]
20792
20909
  );
20793
- const updateUsageBasedEntitlementQuantity = (0, import_react29.useCallback)(
20910
+ const updateUsageBasedEntitlementQuantity = (0, import_react30.useCallback)(
20794
20911
  (id, updatedQuantity) => {
20795
20912
  setUsageBasedEntitlements((prev2) => {
20796
20913
  const updated = prev2.map(
@@ -20809,7 +20926,7 @@ var CheckoutDialog = ({ top }) => {
20809
20926
  },
20810
20927
  [debouncedPreviewCheckout]
20811
20928
  );
20812
- const updateCreditBundleCount = (0, import_react29.useCallback)(
20929
+ const updateCreditBundleCount = (0, import_react30.useCallback)(
20813
20930
  (id, updatedCount) => {
20814
20931
  const nextCounts = { ...bundleCountsRef.current, [id]: updatedCount };
20815
20932
  bundleCountsRef.current = nextCounts;
@@ -20824,7 +20941,7 @@ var CheckoutDialog = ({ top }) => {
20824
20941
  },
20825
20942
  [bundleGatingPlanId, data?.creditBundles, debouncedPreviewCheckout]
20826
20943
  );
20827
- const toggleCreditBundle = (0, import_react29.useCallback)(
20944
+ const toggleCreditBundle = (0, import_react30.useCallback)(
20828
20945
  (id) => {
20829
20946
  const nextCounts = { ...bundleCountsRef.current };
20830
20947
  if (nextCounts[id]) {
@@ -20844,7 +20961,7 @@ var CheckoutDialog = ({ top }) => {
20844
20961
  },
20845
20962
  [bundleGatingPlanId, data?.creditBundles, handlePreviewCheckout]
20846
20963
  );
20847
- const updateAddOnEntitlementQuantity = (0, import_react29.useCallback)(
20964
+ const updateAddOnEntitlementQuantity = (0, import_react30.useCallback)(
20848
20965
  (id, updatedQuantity) => {
20849
20966
  setAddOnUsageBasedEntitlements((prev2) => {
20850
20967
  const updated = prev2.map(
@@ -20864,25 +20981,25 @@ var CheckoutDialog = ({ top }) => {
20864
20981
  },
20865
20982
  [debouncedPreviewCheckout]
20866
20983
  );
20867
- const updatePromoCode = (0, import_react29.useCallback)(
20984
+ const updatePromoCode = (0, import_react30.useCallback)(
20868
20985
  async (code) => {
20869
20986
  handlePreviewCheckout({ promoCode: code });
20870
20987
  },
20871
20988
  [handlePreviewCheckout]
20872
20989
  );
20873
- const handleClose = (0, import_react29.useCallback)(() => {
20990
+ const handleClose = (0, import_react30.useCallback)(() => {
20874
20991
  clearCheckoutState();
20875
20992
  setLayout("portal");
20876
20993
  }, [setLayout, clearCheckoutState]);
20877
- const hasInitializedPlan = (0, import_react29.useRef)(false);
20878
- (0, import_react29.useEffect)(() => {
20994
+ const hasInitializedPlan = (0, import_react30.useRef)(false);
20995
+ (0, import_react30.useEffect)(() => {
20879
20996
  if (!hasInitializedPlan.current && selectedPlan) {
20880
20997
  hasInitializedPlan.current = true;
20881
20998
  const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
20882
20999
  selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
20883
21000
  }
20884
21001
  }, [selectedPlan, planPeriod, selectPlan]);
20885
- (0, import_react29.useLayoutEffect)(() => {
21002
+ (0, import_react30.useLayoutEffect)(() => {
20886
21003
  const element = dialogRef.current;
20887
21004
  if (layout !== "checkout" || !element) {
20888
21005
  return;
@@ -20898,14 +21015,14 @@ var CheckoutDialog = ({ top }) => {
20898
21015
  element.show();
20899
21016
  }
20900
21017
  }, [layout]);
20901
- (0, import_react29.useLayoutEffect)(() => {
21018
+ (0, import_react30.useLayoutEffect)(() => {
20902
21019
  stageRef.current?.scrollTo({
20903
21020
  top: 0,
20904
21021
  left: 0,
20905
21022
  behavior: "smooth"
20906
21023
  });
20907
21024
  }, [effectiveCheckoutStage]);
20908
- (0, import_react29.useLayoutEffect)(() => {
21025
+ (0, import_react30.useLayoutEffect)(() => {
20909
21026
  if (charges) {
20910
21027
  sidebarRef.current?.scrollTo({
20911
21028
  top: 0,
@@ -20917,7 +21034,7 @@ var CheckoutDialog = ({ top }) => {
20917
21034
  const activeCheckoutStage = checkoutStages.find(
20918
21035
  (stage) => stage.id === effectiveCheckoutStage
20919
21036
  );
20920
- const visibleStages = (0, import_react29.useMemo)(() => {
21037
+ const visibleStages = (0, import_react30.useMemo)(() => {
20921
21038
  if (!checkoutState?.hideSkippedStages) {
20922
21039
  return checkoutStages;
20923
21040
  }
@@ -20940,7 +21057,7 @@ var CheckoutDialog = ({ top }) => {
20940
21057
  return true;
20941
21058
  });
20942
21059
  }, [checkoutStages, checkoutState]);
20943
- const navigableStages = (0, import_react29.useMemo)(() => {
21060
+ const navigableStages = (0, import_react30.useMemo)(() => {
20944
21061
  return checkoutStages.filter((stage) => {
20945
21062
  if (stage.id === "plan" && checkoutState?.bypassPlanSelection) {
20946
21063
  return false;
@@ -21550,44 +21667,44 @@ var InvalidCurrencyNotice = ({
21550
21667
  };
21551
21668
 
21552
21669
  // src/components/shared/payment-dialog/PaymentDialog.tsx
21553
- var import_react31 = require("react");
21670
+ var import_react32 = require("react");
21554
21671
 
21555
21672
  // src/components/shared/checkout-dialog/EditableCustomCheckoutFields.tsx
21556
- var import_react30 = require("react");
21673
+ var import_react31 = require("react");
21557
21674
  var import_jsx_runtime35 = require("react/jsx-runtime");
21558
21675
  var EditableCustomCheckoutFields = () => {
21559
21676
  const { t: t3 } = useTranslation();
21560
21677
  const isLightBackground = useIsLightBackground();
21561
21678
  const { data, updateCustomFieldValues } = useEmbed();
21562
- const customCheckoutFields = (0, import_react30.useMemo)(
21679
+ const customCheckoutFields = (0, import_react31.useMemo)(
21563
21680
  () => data?.customCheckoutFields ?? [],
21564
21681
  [data?.customCheckoutFields]
21565
21682
  );
21566
- const serverFieldValues = (0, import_react30.useMemo)(() => {
21683
+ const serverFieldValues = (0, import_react31.useMemo)(() => {
21567
21684
  const values2 = {};
21568
21685
  for (const field of customCheckoutFields) {
21569
21686
  values2[field.id] = field.value ?? "";
21570
21687
  }
21571
21688
  return values2;
21572
21689
  }, [customCheckoutFields]);
21573
- const [editing, setEditing] = (0, import_react30.useState)(false);
21574
- const [values, setValues] = (0, import_react30.useState)(serverFieldValues);
21575
- const [isSaving, setIsSaving] = (0, import_react30.useState)(false);
21576
- const [error, setError] = (0, import_react30.useState)();
21577
- const handleChange = (0, import_react30.useCallback)((fieldId, value) => {
21690
+ const [editing, setEditing] = (0, import_react31.useState)(false);
21691
+ const [values, setValues] = (0, import_react31.useState)(serverFieldValues);
21692
+ const [isSaving, setIsSaving] = (0, import_react31.useState)(false);
21693
+ const [error, setError] = (0, import_react31.useState)();
21694
+ const handleChange = (0, import_react31.useCallback)((fieldId, value) => {
21578
21695
  setValues((prev2) => ({ ...prev2, [fieldId]: value }));
21579
21696
  }, []);
21580
- const handleEdit = (0, import_react30.useCallback)(() => {
21697
+ const handleEdit = (0, import_react31.useCallback)(() => {
21581
21698
  setError(void 0);
21582
21699
  setValues(serverFieldValues);
21583
21700
  setEditing(true);
21584
21701
  }, [serverFieldValues]);
21585
- const handleCancel = (0, import_react30.useCallback)(() => {
21702
+ const handleCancel = (0, import_react31.useCallback)(() => {
21586
21703
  setError(void 0);
21587
21704
  setEditing(false);
21588
21705
  setValues(serverFieldValues);
21589
21706
  }, [serverFieldValues]);
21590
- const handleSave = (0, import_react30.useCallback)(async () => {
21707
+ const handleSave = (0, import_react31.useCallback)(async () => {
21591
21708
  setError(void 0);
21592
21709
  setIsSaving(true);
21593
21710
  try {
@@ -21675,13 +21792,13 @@ var import_jsx_runtime36 = require("react/jsx-runtime");
21675
21792
  var PaymentDialog = ({ top }) => {
21676
21793
  const { t: t3 } = useTranslation();
21677
21794
  const { layout, setLayout, clearCheckoutState } = useEmbed();
21678
- const dialogRef = (0, import_react31.useRef)(null);
21679
- const [isModal, setIsModal] = (0, import_react31.useState)(true);
21680
- const handleClose = (0, import_react31.useCallback)(() => {
21795
+ const dialogRef = (0, import_react32.useRef)(null);
21796
+ const [isModal, setIsModal] = (0, import_react32.useState)(true);
21797
+ const handleClose = (0, import_react32.useCallback)(() => {
21681
21798
  clearCheckoutState();
21682
21799
  setLayout("portal");
21683
21800
  }, [setLayout, clearCheckoutState]);
21684
- (0, import_react31.useLayoutEffect)(() => {
21801
+ (0, import_react32.useLayoutEffect)(() => {
21685
21802
  const element = dialogRef.current;
21686
21803
  if (layout !== "payment" || !element) {
21687
21804
  return;
@@ -21728,7 +21845,7 @@ var PaymentDialog = ({ top }) => {
21728
21845
 
21729
21846
  // src/components/shared/payment-form/PaymentForm.tsx
21730
21847
  var import_react_stripe_js = require("@stripe/react-stripe-js");
21731
- var import_react32 = require("react");
21848
+ var import_react33 = require("react");
21732
21849
  var import_jsx_runtime37 = require("react/jsx-runtime");
21733
21850
  var PaymentForm = ({ onConfirm, financeData }) => {
21734
21851
  const { t: t3 } = useTranslation();
@@ -21743,32 +21860,32 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21743
21860
  financeData
21744
21861
  );
21745
21862
  const showBillingAddress = shouldCollectAddress || collectPhone;
21746
- const loadTimerRef = (0, import_react32.useRef)(
21863
+ const loadTimerRef = (0, import_react33.useRef)(
21747
21864
  void 0
21748
21865
  );
21749
- const [email, setEmail] = (0, import_react32.useState)(() => billing?.email ?? "");
21750
- const userEditedEmailRef = (0, import_react32.useRef)(false);
21751
- const [message, setMessage] = (0, import_react32.useState)();
21752
- const [isLoading, setIsLoading] = (0, import_react32.useState)(false);
21753
- const [isConfirmed, setIsConfirmed] = (0, import_react32.useState)(false);
21754
- const [isPaymentComplete, setIsPaymentComplete] = (0, import_react32.useState)(false);
21755
- const [isPaymentReady, setIsPaymentReady] = (0, import_react32.useState)(false);
21756
- const [loadError, setLoadError] = (0, import_react32.useState)();
21757
- const [isEmailValid, setIsEmailValid] = (0, import_react32.useState)(() => !collectEmail);
21758
- const emailInputRef = (0, import_react32.useRef)(null);
21759
- const [isAddressComplete, setIsAddressComplete] = (0, import_react32.useState)(
21866
+ const [email, setEmail] = (0, import_react33.useState)(() => billing?.email ?? "");
21867
+ const userEditedEmailRef = (0, import_react33.useRef)(false);
21868
+ const [message, setMessage] = (0, import_react33.useState)();
21869
+ const [isLoading, setIsLoading] = (0, import_react33.useState)(false);
21870
+ const [isConfirmed, setIsConfirmed] = (0, import_react33.useState)(false);
21871
+ const [isPaymentComplete, setIsPaymentComplete] = (0, import_react33.useState)(false);
21872
+ const [isPaymentReady, setIsPaymentReady] = (0, import_react33.useState)(false);
21873
+ const [loadError, setLoadError] = (0, import_react33.useState)();
21874
+ const [isEmailValid, setIsEmailValid] = (0, import_react33.useState)(() => !collectEmail);
21875
+ const emailInputRef = (0, import_react33.useRef)(null);
21876
+ const [isAddressComplete, setIsAddressComplete] = (0, import_react33.useState)(
21760
21877
  () => !shouldCollectAddress
21761
21878
  );
21762
- const addressDefaultsKey = (0, import_react32.useMemo)(
21879
+ const addressDefaultsKey = (0, import_react33.useMemo)(
21763
21880
  () => JSON.stringify(billing ?? {}),
21764
21881
  [billing]
21765
21882
  );
21766
- (0, import_react32.useEffect)(() => {
21883
+ (0, import_react33.useEffect)(() => {
21767
21884
  if (!userEditedEmailRef.current && billing?.email) {
21768
21885
  setEmail(billing.email);
21769
21886
  }
21770
21887
  }, [billing?.email]);
21771
- (0, import_react32.useEffect)(() => {
21888
+ (0, import_react33.useEffect)(() => {
21772
21889
  setIsEmailValid(
21773
21890
  !collectEmail || (emailInputRef.current?.checkValidity() ?? false)
21774
21891
  );
@@ -21813,7 +21930,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21813
21930
  setIsLoading(false);
21814
21931
  }
21815
21932
  };
21816
- (0, import_react32.useEffect)(() => {
21933
+ (0, import_react33.useEffect)(() => {
21817
21934
  loadTimerRef.current = setTimeout(() => {
21818
21935
  if (!isPaymentReady) {
21819
21936
  setLoadError(t3("Unable to load payment form."));
@@ -21924,7 +22041,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21924
22041
  };
21925
22042
 
21926
22043
  // src/components/shared/period-toggle/PeriodToggle.tsx
21927
- var import_react33 = require("react");
22044
+ var import_react34 = require("react");
21928
22045
  var import_jsx_runtime38 = require("react/jsx-runtime");
21929
22046
  var PERIOD_MONTH_COUNT = {
21930
22047
  year: 12,
@@ -21940,7 +22057,7 @@ var PeriodToggle = ({
21940
22057
  const { t: t3 } = useTranslation();
21941
22058
  const { settings } = useEmbed();
21942
22059
  const isLightBackground = useIsLightBackground();
21943
- const savingsByPeriod = (0, import_react33.useMemo)(() => {
22060
+ const savingsByPeriod = (0, import_react34.useMemo)(() => {
21944
22061
  const result = {};
21945
22062
  if (!selectedPlan) {
21946
22063
  return result;
@@ -22097,10 +22214,10 @@ var PlanCreditText = ({
22097
22214
  };
22098
22215
 
22099
22216
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
22100
- var import_react35 = require("react");
22217
+ var import_react36 = require("react");
22101
22218
 
22102
22219
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
22103
- var import_react34 = require("react");
22220
+ var import_react35 = require("react");
22104
22221
  var import_jsx_runtime40 = require("react/jsx-runtime");
22105
22222
  var PriceText = ({
22106
22223
  feature,
@@ -22111,7 +22228,7 @@ var PriceText = ({
22111
22228
  }) => {
22112
22229
  const { settings } = useEmbed();
22113
22230
  const { t: t3, locale } = useTranslation();
22114
- const text = (0, import_react34.useMemo)(() => {
22231
+ const text = (0, import_react35.useMemo)(() => {
22115
22232
  if (!flatAmount && perUnitPrice) {
22116
22233
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
22117
22234
  formatCurrency(perUnitPrice, { locale, currency }),
@@ -22168,7 +22285,7 @@ var PricingTiersTooltip = ({
22168
22285
  const { t: t3 } = useTranslation();
22169
22286
  const { settings } = useEmbed();
22170
22287
  const isLightBackground = useIsLightBackground();
22171
- const { tiers } = (0, import_react35.useMemo)(() => {
22288
+ const { tiers } = (0, import_react36.useMemo)(() => {
22172
22289
  return priceTiers.reduce(
22173
22290
  (acc, tier) => {
22174
22291
  const end = tier.upTo ?? Infinity;
@@ -22262,7 +22379,7 @@ var PricingTiersTooltip = ({
22262
22379
  };
22263
22380
 
22264
22381
  // src/components/shared/subscription-sidebar/SubscriptionSidebar.tsx
22265
- var import_react37 = require("react");
22382
+ var import_react38 = require("react");
22266
22383
  var import_react_dom2 = require("react-dom");
22267
22384
 
22268
22385
  // src/components/shared/subscription-sidebar/CheckoutStageButton.tsx
@@ -22744,12 +22861,12 @@ var EntitlementRow = (props) => {
22744
22861
  };
22745
22862
 
22746
22863
  // src/components/shared/subscription-sidebar/Proration.tsx
22747
- var import_react36 = require("react");
22864
+ var import_react37 = require("react");
22748
22865
  var import_jsx_runtime44 = require("react/jsx-runtime");
22749
22866
  var Proration = ({ currency, charges }) => {
22750
22867
  const { t: t3, locale } = useTranslation();
22751
22868
  const { settings } = useEmbed();
22752
- const [open, setOpen] = (0, import_react36.useState)(false);
22869
+ const [open, setOpen] = (0, import_react37.useState)(false);
22753
22870
  const toggle = (e) => {
22754
22871
  e.preventDefault();
22755
22872
  e.stopPropagation();
@@ -22800,7 +22917,7 @@ var Proration = ({ currency, charges }) => {
22800
22917
 
22801
22918
  // src/components/shared/subscription-sidebar/SubscriptionSidebar.tsx
22802
22919
  var import_jsx_runtime45 = require("react/jsx-runtime");
22803
- var SubscriptionSidebar = (0, import_react37.forwardRef)(
22920
+ var SubscriptionSidebar = (0, import_react38.forwardRef)(
22804
22921
  ({
22805
22922
  portal,
22806
22923
  planPeriod,
@@ -22851,8 +22968,8 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22851
22968
  } = useEmbed();
22852
22969
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
22853
22970
  const isLightBackground = useIsLightBackground();
22854
- const buttonRef = (0, import_react37.useRef)(null);
22855
- const [isButtonInView, setIsButtonInView] = (0, import_react37.useState)(false);
22971
+ const buttonRef = (0, import_react38.useRef)(null);
22972
+ const [isButtonInView, setIsButtonInView] = (0, import_react38.useState)(false);
22856
22973
  const {
22857
22974
  currentPlan,
22858
22975
  currentAddOns,
@@ -22861,7 +22978,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22861
22978
  billingSubscription,
22862
22979
  paymentMethod,
22863
22980
  trialPaymentMethodRequired
22864
- } = (0, import_react37.useMemo)(() => {
22981
+ } = (0, import_react38.useMemo)(() => {
22865
22982
  const currentEntitlements2 = data?.featureUsage?.features || [];
22866
22983
  return {
22867
22984
  currentPlan: data?.company?.plan,
@@ -22884,7 +23001,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22884
23001
  data?.subscription?.paymentMethod,
22885
23002
  data?.trialPaymentMethodRequired
22886
23003
  ]);
22887
- const planCreditGrants = (0, import_react37.useMemo)(() => {
23004
+ const planCreditGrants = (0, import_react38.useMemo)(() => {
22888
23005
  const grants = mergeCompanyGrants(
22889
23006
  selectedPlan?.includedCreditGrants,
22890
23007
  data?.company?.plan?.includedCreditGrants
@@ -22894,11 +23011,11 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22894
23011
  selectedPlan?.includedCreditGrants,
22895
23012
  data?.company?.plan?.includedCreditGrants
22896
23013
  ]);
22897
- const planCredits = (0, import_react37.useMemo)(
23014
+ const planCredits = (0, import_react38.useMemo)(
22898
23015
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
22899
23016
  [selectedPlan?.includedCreditGrants]
22900
23017
  );
22901
- const { payInAdvanceEntitlements } = (0, import_react37.useMemo)(() => {
23018
+ const { payInAdvanceEntitlements } = (0, import_react38.useMemo)(() => {
22902
23019
  const payAsYouGoEntitlements = [];
22903
23020
  const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
22904
23021
  (entitlement) => {
@@ -22910,7 +23027,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22910
23027
  );
22911
23028
  return { payAsYouGoEntitlements, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
22912
23029
  }, [usageBasedEntitlements]);
22913
- const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = (0, import_react37.useMemo)(() => {
23030
+ const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = (0, import_react38.useMemo)(() => {
22914
23031
  let planPrice;
22915
23032
  let resolvedCurrency;
22916
23033
  if (selectedPlan) {
@@ -22981,7 +23098,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22981
23098
  proration,
22982
23099
  taxAmount,
22983
23100
  taxDescription
22984
- } = (0, import_react37.useMemo)(() => {
23101
+ } = (0, import_react38.useMemo)(() => {
22985
23102
  return {
22986
23103
  amountOff: charges?.amountOff ?? 0,
22987
23104
  discountAmount: charges?.discountAmount ?? 0,
@@ -23051,7 +23168,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23051
23168
  }
23052
23169
  );
23053
23170
  };
23054
- const updatedUsageBasedEntitlements = (0, import_react37.useMemo)(() => {
23171
+ const updatedUsageBasedEntitlements = (0, import_react38.useMemo)(() => {
23055
23172
  const changedUsageBasedEntitlements = [];
23056
23173
  const allSelectedUsageBasedEntitlements = [
23057
23174
  ...usageBasedEntitlements,
@@ -23114,19 +23231,19 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23114
23231
  usageBasedEntitlements,
23115
23232
  addOnUsageBasedEntitlements
23116
23233
  ]);
23117
- const selectedAddOnsWithPrice = (0, import_react37.useMemo)(
23234
+ const selectedAddOnsWithPrice = (0, import_react38.useMemo)(
23118
23235
  () => addOns.filter(
23119
23236
  (addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
23120
23237
  ),
23121
23238
  [addOns, currency]
23122
23239
  );
23123
- const selectedOneTimeAddOns = (0, import_react37.useMemo)(
23240
+ const selectedOneTimeAddOns = (0, import_react38.useMemo)(
23124
23241
  () => addOns.filter(
23125
23242
  (addOn) => addOn.isSelected && addOn.chargeType === ChargeType.oneTime && getAddOnPrice(addOn, planPeriod, currency)?.price
23126
23243
  ),
23127
23244
  [addOns, planPeriod, currency]
23128
23245
  );
23129
- const { removedAddOns, willAddOnsChange } = (0, import_react37.useMemo)(() => {
23246
+ const { removedAddOns, willAddOnsChange } = (0, import_react38.useMemo)(() => {
23130
23247
  const addedAddOns = selectedAddOnsWithPrice.filter(
23131
23248
  (selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
23132
23249
  );
@@ -23142,15 +23259,15 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23142
23259
  willAddOnsChange: willAddOnsChange2
23143
23260
  };
23144
23261
  }, [currentAddOns, selectedAddOnsWithPrice, currency]);
23145
- const addedCreditBundles = (0, import_react37.useMemo)(
23262
+ const addedCreditBundles = (0, import_react38.useMemo)(
23146
23263
  () => creditBundles.filter((bundle) => bundle.count > 0),
23147
23264
  [creditBundles]
23148
23265
  );
23149
- const discountApplied = (0, import_react37.useMemo)(
23266
+ const discountApplied = (0, import_react38.useMemo)(
23150
23267
  () => promoCode && (amountOff > 0 || percentOff > 0),
23151
23268
  [promoCode, amountOff, percentOff]
23152
23269
  );
23153
- const subscriptionDiscount = (0, import_react37.useMemo)(
23270
+ const subscriptionDiscount = (0, import_react38.useMemo)(
23154
23271
  () => getSubscriptionDiscount(
23155
23272
  charges?.discounts,
23156
23273
  subscriptionTotal,
@@ -23159,7 +23276,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23159
23276
  ),
23160
23277
  [charges?.discounts, subscriptionTotal, subscriptionCurrency, locale]
23161
23278
  );
23162
- const handleCheckout = (0, import_react37.useCallback)(async () => {
23279
+ const handleCheckout = (0, import_react38.useCallback)(async () => {
23163
23280
  const planId = selectedPlan?.id;
23164
23281
  const currencyPrice = selectedPlan ? getPlanPrice(
23165
23282
  selectedPlan,
@@ -23296,7 +23413,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23296
23413
  customFieldValues,
23297
23414
  ensureTaxIdSaved
23298
23415
  ]);
23299
- const handleUnsubscribe = (0, import_react37.useCallback)(async () => {
23416
+ const handleUnsubscribe = (0, import_react38.useCallback)(async () => {
23300
23417
  try {
23301
23418
  setError(void 0);
23302
23419
  setIsLoading(true);
@@ -23310,7 +23427,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23310
23427
  }
23311
23428
  }, [t3, unsubscribe, setError, setIsLoading, setLayout]);
23312
23429
  const isSelectedPlanTrialable = selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
23313
- const button = (0, import_react37.useMemo)(() => {
23430
+ const button = (0, import_react38.useMemo)(() => {
23314
23431
  const hasEntitlementDowngrade = payInAdvanceEntitlements.some((e) => e.quantity < e.usage) || addOnPayInAdvanceEntitlements.some((e) => e.quantity < e.usage);
23315
23432
  const canCheckout = error !== t3("Downgrade not permitted.") && !hasEntitlementDowngrade;
23316
23433
  const isSticky = !isButtonInView;
@@ -23384,7 +23501,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23384
23501
  isCreditOnlyPurchase,
23385
23502
  hasIncompleteRequiredCustomFields
23386
23503
  ]);
23387
- (0, import_react37.useLayoutEffect)(() => {
23504
+ (0, import_react38.useLayoutEffect)(() => {
23388
23505
  const element = buttonRef.current;
23389
23506
  if (!element) {
23390
23507
  return;
@@ -24038,14 +24155,14 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
24038
24155
  SubscriptionSidebar.displayName = "SubscriptionSidebar";
24039
24156
 
24040
24157
  // src/components/shared/tiered-pricing-details/TieredPricingDetails.tsx
24041
- var import_react38 = require("react");
24158
+ var import_react39 = require("react");
24042
24159
  var TieredPricingDetails = ({
24043
24160
  entitlement,
24044
24161
  period,
24045
24162
  currency: selectedCurrency
24046
24163
  }) => {
24047
24164
  const { t: t3, locale } = useTranslation();
24048
- const { currency, flatAmount, perUnitPrice, upTo } = (0, import_react38.useMemo)(() => {
24165
+ const { currency, flatAmount, perUnitPrice, upTo } = (0, import_react39.useMemo)(() => {
24049
24166
  const { currency: currency2, priceTier } = getEntitlementPrice(entitlement, period, selectedCurrency) || {};
24050
24167
  const { flatAmount: flatAmount2, perUnitPrice: perUnitPrice2, perUnitPriceDecimal, upTo: upTo2 } = priceTier?.[0] || {};
24051
24168
  return {
@@ -24093,25 +24210,26 @@ var TieredPricingDetails = ({
24093
24210
  };
24094
24211
 
24095
24212
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
24096
- var import_react39 = require("react");
24213
+ var import_react40 = require("react");
24097
24214
  var import_jsx_runtime46 = require("react/jsx-runtime");
24098
24215
  var UnsubscribeDialog = ({ top }) => {
24099
24216
  const { t: t3, locale } = useTranslation();
24100
24217
  const { data, layout, setLayout, setCheckoutState, clearCheckoutState } = useEmbed();
24101
- const dialogRef = (0, import_react39.useRef)(null);
24102
- const sidebarRef = (0, import_react39.useRef)(null);
24103
- const [dialogElement, setDialogElement] = (0, import_react39.useState)(
24218
+ const dialogRef = (0, import_react40.useRef)(null);
24219
+ const sidebarRef = (0, import_react40.useRef)(null);
24220
+ const [dialogElement, setDialogElement] = (0, import_react40.useState)(
24104
24221
  null
24105
24222
  );
24106
- const setDialog = (0, import_react39.useCallback)((element) => {
24223
+ const setDialog = (0, import_react40.useCallback)((element) => {
24107
24224
  dialogRef.current = element;
24108
24225
  setDialogElement(element);
24109
24226
  }, []);
24110
- const [error, setError] = (0, import_react39.useState)();
24111
- const [isLoading, setIsLoading] = (0, import_react39.useState)(false);
24112
- const [isModal, setIsModal] = (0, import_react39.useState)(true);
24113
- const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = (0, import_react39.useMemo)(() => {
24114
- const cancelDate2 = data?.subscription?.cancelAt || data?.upcomingInvoice?.dueDate;
24227
+ const [error, setError] = (0, import_react40.useState)();
24228
+ const [isLoading, setIsLoading] = (0, import_react40.useState)(false);
24229
+ const [isModal, setIsModal] = (0, import_react40.useState)(true);
24230
+ const { billDate } = useNextBillDate();
24231
+ const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = (0, import_react40.useMemo)(() => {
24232
+ const cancelDate2 = data?.subscription?.cancelAt || billDate;
24115
24233
  return {
24116
24234
  planPeriod: getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month",
24117
24235
  currentPlan: data?.company?.plan,
@@ -24125,10 +24243,10 @@ var UnsubscribeDialog = ({ top }) => {
24125
24243
  data?.company?.plan,
24126
24244
  data?.featureUsage,
24127
24245
  data?.subscription?.cancelAt,
24128
- data?.upcomingInvoice?.dueDate
24246
+ billDate
24129
24247
  ]);
24130
24248
  const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
24131
- const selectedPlan = (0, import_react39.useMemo)(
24249
+ const selectedPlan = (0, import_react40.useMemo)(
24132
24250
  () => availablePlans.find((plan) => plan.id === currentPlan?.id),
24133
24251
  [currentPlan?.id, availablePlans]
24134
24252
  );
@@ -24137,18 +24255,18 @@ var UnsubscribeDialog = ({ top }) => {
24137
24255
  createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
24138
24256
  []
24139
24257
  );
24140
- const addOns = (0, import_react39.useMemo)(
24258
+ const addOns = (0, import_react40.useMemo)(
24141
24259
  () => availableAddOns.map((available) => ({
24142
24260
  ...available,
24143
24261
  isSelected: currentAddOns.some((current) => available.id === current.id) ?? false
24144
24262
  })),
24145
24263
  [currentAddOns, availableAddOns]
24146
24264
  );
24147
- const handleClose = (0, import_react39.useCallback)(() => {
24265
+ const handleClose = (0, import_react40.useCallback)(() => {
24148
24266
  clearCheckoutState();
24149
24267
  setLayout("portal");
24150
24268
  }, [setLayout, clearCheckoutState]);
24151
- (0, import_react39.useLayoutEffect)(() => {
24269
+ (0, import_react40.useLayoutEffect)(() => {
24152
24270
  const element = dialogRef.current;
24153
24271
  if (layout !== "unsubscribe" || !element) {
24154
24272
  return;
@@ -24434,13 +24552,13 @@ var StyledViewport = gt.div.withConfig({
24434
24552
 
24435
24553
  // src/components/layout/viewport/Viewport.tsx
24436
24554
  var import_jsx_runtime50 = require("react/jsx-runtime");
24437
- var Viewport = (0, import_react40.forwardRef)(
24555
+ var Viewport = (0, import_react41.forwardRef)(
24438
24556
  ({ children, portal, ...props }, ref) => {
24439
24557
  portal = portal || document.body;
24440
- const portalRef = (0, import_react40.useRef)(portal);
24558
+ const portalRef = (0, import_react41.useRef)(portal);
24441
24559
  const { data, layout, settings } = useEmbed();
24442
- const [top, setTop] = (0, import_react40.useState)(0);
24443
- (0, import_react40.useLayoutEffect)(() => {
24560
+ const [top, setTop] = (0, import_react41.useState)(0);
24561
+ (0, import_react41.useLayoutEffect)(() => {
24444
24562
  const element = portalRef.current;
24445
24563
  const setModalY = (0, import_debounce5.default)(() => {
24446
24564
  const value = Math.abs(
@@ -24483,7 +24601,7 @@ var resolveDesignProps = (props) => {
24483
24601
  }
24484
24602
  };
24485
24603
  };
24486
- var ButtonElement = (0, import_react41.forwardRef)(({ children, className, ...rest }, ref) => {
24604
+ var ButtonElement = (0, import_react42.forwardRef)(({ children, className, ...rest }, ref) => {
24487
24605
  const props = resolveDesignProps(rest);
24488
24606
  const buttonStyles2 = {
24489
24607
  primary: {
@@ -24528,10 +24646,10 @@ var ButtonElement = (0, import_react41.forwardRef)(({ children, className, ...re
24528
24646
  ButtonElement.displayName = "Button";
24529
24647
 
24530
24648
  // src/components/elements/included-features/IncludedFeatures.tsx
24531
- var import_react43 = require("react");
24649
+ var import_react44 = require("react");
24532
24650
 
24533
24651
  // src/components/elements/included-features/UsageDetails.tsx
24534
- var import_react42 = require("react");
24652
+ var import_react43 = require("react");
24535
24653
  var import_jsx_runtime52 = require("react/jsx-runtime");
24536
24654
  var UsageDetails = ({ entitlement, layout }) => {
24537
24655
  const {
@@ -24559,7 +24677,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24559
24677
  currentTier,
24560
24678
  tiersMode,
24561
24679
  tiered
24562
- } = (0, import_react42.useMemo)(() => {
24680
+ } = (0, import_react43.useMemo)(() => {
24563
24681
  const { billingPrice, amount, limit: limit2, cost: cost2, currentTier: currentTier2 } = getUsageDetails(
24564
24682
  entitlement,
24565
24683
  period,
@@ -24586,7 +24704,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24586
24704
  tiered: priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(billingPrice)
24587
24705
  };
24588
24706
  }, [entitlement, period, priceBehavior, showWarningThresholdAsLimit]);
24589
- const text = (0, import_react42.useMemo)(() => {
24707
+ const text = (0, import_react43.useMemo)(() => {
24590
24708
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24591
24709
  return;
24592
24710
  }
@@ -24661,7 +24779,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24661
24779
  currentTier,
24662
24780
  showCredits
24663
24781
  ]);
24664
- const usageText = (0, import_react42.useMemo)(() => {
24782
+ const usageText = (0, import_react43.useMemo)(() => {
24665
24783
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24666
24784
  return;
24667
24785
  }
@@ -24669,7 +24787,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24669
24787
  let index = 0;
24670
24788
  if (priceBehavior === EntitlementPriceBehavior.PayInAdvance && !tiered && typeof period === "string" && typeof price === "number") {
24671
24789
  acc.push(
24672
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react42.Fragment, { children: packageSize > 1 ? t3("$X/Y units/period", {
24790
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react43.Fragment, { children: packageSize > 1 ? t3("$X/Y units/period", {
24673
24791
  cost: formatCurrency(price, { locale, currency }),
24674
24792
  size: packageSize,
24675
24793
  units: getFeatureName(feature, locale, packageSize),
@@ -24683,7 +24801,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24683
24801
  index += 1;
24684
24802
  } else if ((priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier || priceBehavior === EntitlementPriceBehavior.CreditBurndown || tiered) && typeof usage === "number") {
24685
24803
  acc.push(
24686
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react42.Fragment, { children: t3("X units used", {
24804
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react43.Fragment, { children: t3("X units used", {
24687
24805
  amount: usage,
24688
24806
  units: getFeatureName(feature, locale, usage)
24689
24807
  }) }, index)
@@ -24692,14 +24810,14 @@ var UsageDetails = ({ entitlement, layout }) => {
24692
24810
  }
24693
24811
  if (typeof cost === "number" && cost > 0) {
24694
24812
  acc.push(
24695
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
24813
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react43.Fragment, { children: [
24696
24814
  acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: " \u2022 " }),
24697
24815
  formatCurrency(cost, { locale, currency })
24698
24816
  ] }, index)
24699
24817
  );
24700
24818
  index += 1;
24701
24819
  if (feature.featureType === FeatureType.Trait && typeof period === "string") {
24702
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
24820
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react43.Fragment, { children: [
24703
24821
  "/",
24704
24822
  shortenPeriod(period, t3)
24705
24823
  ] }, index));
@@ -24708,7 +24826,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24708
24826
  }
24709
24827
  if (metricResetAt) {
24710
24828
  acc.push(
24711
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
24829
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react43.Fragment, { children: [
24712
24830
  acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: " \u2022 " }),
24713
24831
  t3("Resets", {
24714
24832
  date: toPrettyDate(metricResetAt, {
@@ -24833,12 +24951,12 @@ function resolveDesignProps2(props) {
24833
24951
  }
24834
24952
  };
24835
24953
  }
24836
- var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
24954
+ var IncludedFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
24837
24955
  const props = resolveDesignProps2(rest);
24838
24956
  const { t: t3, locale } = useTranslation();
24839
24957
  const { data, settings } = useEmbed();
24840
24958
  const isLightBackground = useIsLightBackground();
24841
- const { plan, addOns, featureUsage } = (0, import_react43.useMemo)(() => {
24959
+ const { plan, addOns, featureUsage } = (0, import_react44.useMemo)(() => {
24842
24960
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
24843
24961
  (acc, id) => {
24844
24962
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -24884,7 +25002,7 @@ var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, r
24884
25002
  }
24885
25003
  },
24886
25004
  children: visibleFeatureUsage.items.map((entitlement, index) => {
24887
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react43.Fragment, { children: [
25005
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react44.Fragment, { children: [
24888
25006
  props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
24889
25007
  Icon3,
24890
25008
  {
@@ -24976,7 +25094,7 @@ var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, r
24976
25094
  IncludedFeatures.displayName = "IncludedFeatures";
24977
25095
 
24978
25096
  // src/components/elements/invoices/Invoices.tsx
24979
- var import_react44 = require("react");
25097
+ var import_react45 = require("react");
24980
25098
  var import_jsx_runtime54 = require("react/jsx-runtime");
24981
25099
  function resolveDesignProps3(props) {
24982
25100
  return {
@@ -25035,27 +25153,27 @@ function formatInvoices(invoices, locale, options) {
25035
25153
  };
25036
25154
  });
25037
25155
  }
25038
- var Invoices = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
25156
+ var Invoices = (0, import_react45.forwardRef)(({ className, ...rest }, ref) => {
25039
25157
  const props = resolveDesignProps3(rest);
25040
25158
  const { t: t3, locale } = useTranslation();
25041
25159
  const { data, listInvoices, settings } = useEmbed();
25042
- const [isLoading, setIsLoading] = (0, import_react44.useState)(false);
25043
- const [error, setError] = (0, import_react44.useState)();
25044
- const [rawInvoices, setInvoices] = (0, import_react44.useState)(
25160
+ const [isLoading, setIsLoading] = (0, import_react45.useState)(false);
25161
+ const [error, setError] = (0, import_react45.useState)();
25162
+ const [rawInvoices, setInvoices] = (0, import_react45.useState)(
25045
25163
  () => data && "invoices" in data ? data.invoices : rest.data
25046
25164
  );
25047
- const invoices = (0, import_react44.useMemo)(
25165
+ const invoices = (0, import_react45.useMemo)(
25048
25166
  () => formatInvoices(rawInvoices, locale),
25049
25167
  [rawInvoices, locale]
25050
25168
  );
25051
- const reachableInvoices = (0, import_react44.useMemo)(
25169
+ const reachableInvoices = (0, import_react45.useMemo)(
25052
25170
  () => invoices.slice(0, MAX_VISIBLE_INVOICE_COUNT),
25053
25171
  [invoices]
25054
25172
  );
25055
25173
  const visibleInvoices = useTruncatedList(reachableInvoices, {
25056
25174
  limit: props.limit.number
25057
25175
  });
25058
- const getInvoices = (0, import_react44.useCallback)(async () => {
25176
+ const getInvoices = (0, import_react45.useCallback)(async () => {
25059
25177
  try {
25060
25178
  setError(void 0);
25061
25179
  setIsLoading(true);
@@ -25069,15 +25187,15 @@ var Invoices = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
25069
25187
  setIsLoading(false);
25070
25188
  }
25071
25189
  }, [listInvoices]);
25072
- (0, import_react44.useEffect)(() => {
25190
+ (0, import_react45.useEffect)(() => {
25073
25191
  getInvoices();
25074
25192
  }, [getInvoices]);
25075
- (0, import_react44.useEffect)(() => {
25193
+ (0, import_react45.useEffect)(() => {
25076
25194
  if (rest.data) {
25077
25195
  setInvoices(rest.data);
25078
25196
  }
25079
25197
  }, [rest.data]);
25080
- (0, import_react44.useEffect)(() => {
25198
+ (0, import_react45.useEffect)(() => {
25081
25199
  if (data && "invoices" in data) {
25082
25200
  const invoicesPreviewData = data.invoices;
25083
25201
  setInvoices(invoicesPreviewData);
@@ -25167,7 +25285,7 @@ var Invoices = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
25167
25285
  Invoices.displayName = "Invoices";
25168
25286
 
25169
25287
  // src/components/elements/metered-features/MeteredFeatures.tsx
25170
- var import_react46 = require("react");
25288
+ var import_react47 = require("react");
25171
25289
 
25172
25290
  // src/components/elements/metered-features/Meter.tsx
25173
25291
  var import_jsx_runtime55 = require("react/jsx-runtime");
@@ -25300,7 +25418,7 @@ var PriceDetails = ({
25300
25418
  };
25301
25419
 
25302
25420
  // src/components/elements/metered-features/UsageByUser.tsx
25303
- var import_react45 = require("react");
25421
+ var import_react46 = require("react");
25304
25422
  var import_jsx_runtime57 = require("react/jsx-runtime");
25305
25423
  var COLLAPSED_COUNT = 3;
25306
25424
  var EXPANDED_COUNT = 20;
@@ -25357,13 +25475,13 @@ var UsageByUser = ({ source, unit }) => {
25357
25475
  const { t: t3, locale } = useTranslation();
25358
25476
  const isLightBackground = useIsLightBackground();
25359
25477
  const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
25360
- const [expanded, setExpanded] = (0, import_react45.useState)(false);
25361
- const [result, setResult] = (0, import_react45.useState)();
25362
- const [attempt, setAttempt] = (0, import_react45.useState)(0);
25478
+ const [expanded, setExpanded] = (0, import_react46.useState)(false);
25479
+ const [result, setResult] = (0, import_react46.useState)();
25480
+ const [attempt, setAttempt] = (0, import_react46.useState)(0);
25363
25481
  const { kind, id } = source;
25364
25482
  const sourceKey = `${kind}:${id}`;
25365
25483
  const current = result?.sourceKey === sourceKey ? result : void 0;
25366
- (0, import_react45.useEffect)(() => {
25484
+ (0, import_react46.useEffect)(() => {
25367
25485
  let active = true;
25368
25486
  const apply = (next2) => {
25369
25487
  if (active) {
@@ -25397,7 +25515,7 @@ var UsageByUser = ({ source, unit }) => {
25397
25515
  sourceKey
25398
25516
  ]);
25399
25517
  const entries = current?.section?.entries;
25400
- const attributed = (0, import_react45.useMemo)(
25518
+ const attributed = (0, import_react46.useMemo)(
25401
25519
  () => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
25402
25520
  [entries]
25403
25521
  );
@@ -25583,15 +25701,16 @@ function resolveDesignProps4(props) {
25583
25701
  visibleFeatures: props.visibleFeatures
25584
25702
  };
25585
25703
  }
25586
- var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, ref) => {
25704
+ var MeteredFeatures = (0, import_react47.forwardRef)(({ className, ...rest }, ref) => {
25587
25705
  const props = resolveDesignProps4(rest);
25588
- const elementsRef = (0, import_react46.useRef)([]);
25706
+ const elementsRef = (0, import_react47.useRef)([]);
25589
25707
  const shouldWrapChildren = useWrapChildren(elementsRef);
25590
25708
  const { t: t3, locale } = useTranslation();
25591
25709
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
25592
25710
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
25593
25711
  const isLightBackground = useIsLightBackground();
25594
- const meteredFeatures = (0, import_react46.useMemo)(() => {
25712
+ const { billDate: renewalDate } = useNextBillDate();
25713
+ const meteredFeatures = (0, import_react47.useMemo)(() => {
25595
25714
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
25596
25715
  (acc, id) => {
25597
25716
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -25608,7 +25727,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25608
25727
  ({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
25609
25728
  );
25610
25729
  }, [props.visibleFeatures, data?.featureUsage?.features]);
25611
- const creditGroups = (0, import_react46.useMemo)(
25730
+ const creditGroups = (0, import_react47.useMemo)(
25612
25731
  () => withEmptyPlanCreditBalances(
25613
25732
  aggregateActiveGrantsByCredit(data?.creditGrants || []),
25614
25733
  listPlanCredits(
@@ -25619,11 +25738,11 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25619
25738
  ),
25620
25739
  [data?.creditGrants, data?.featureUsage?.features, data?.company]
25621
25740
  );
25622
- const planCreditCompositions = (0, import_react46.useMemo)(
25741
+ const planCreditCompositions = (0, import_react47.useMemo)(
25623
25742
  () => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
25624
25743
  [data?.company?.plan?.includedCreditGrants]
25625
25744
  );
25626
- const resolveLicenseQuantity = (0, import_react46.useCallback)(
25745
+ const resolveLicenseQuantity = (0, import_react47.useCallback)(
25627
25746
  (licenseId) => {
25628
25747
  const allocation = findLicenseSource(
25629
25748
  data?.featureUsage?.features ?? [],
@@ -25633,17 +25752,17 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25633
25752
  },
25634
25753
  [data?.featureUsage?.features]
25635
25754
  );
25636
- const purchasableCreditIds = (0, import_react46.useMemo)(
25755
+ const purchasableCreditIds = (0, import_react47.useMemo)(
25637
25756
  () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
25638
25757
  [data?.creditBundles, data?.company?.plan?.id]
25639
25758
  );
25640
- const [expandedCreditIds, setExpandedCreditIds] = (0, import_react46.useState)(
25759
+ const [expandedCreditIds, setExpandedCreditIds] = (0, import_react47.useState)(
25641
25760
  () => /* @__PURE__ */ new Set()
25642
25761
  );
25643
- const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react46.useState)(
25762
+ const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react47.useState)(
25644
25763
  () => /* @__PURE__ */ new Set()
25645
25764
  );
25646
- const toggleFullLedger = (0, import_react46.useCallback)((id) => {
25765
+ const toggleFullLedger = (0, import_react47.useCallback)((id) => {
25647
25766
  setFullLedgerCreditIds((prev2) => {
25648
25767
  const next2 = new Set(prev2);
25649
25768
  if (next2.has(id)) {
@@ -25654,7 +25773,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25654
25773
  return next2;
25655
25774
  });
25656
25775
  }, []);
25657
- const toggleBalanceDetails = (0, import_react46.useCallback)((id) => {
25776
+ const toggleBalanceDetails = (0, import_react47.useCallback)((id) => {
25658
25777
  setExpandedCreditIds((prev2) => {
25659
25778
  const next2 = new Set(prev2);
25660
25779
  if (next2.has(id)) {
@@ -25878,7 +25997,6 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25878
25997
  })
25879
25998
  );
25880
25999
  }
25881
- const renewalDate = data?.upcomingInvoice?.dueDate;
25882
26000
  return (
25883
26001
  // Pulled up against the balance line despite the column's 2rem gap
25884
26002
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
@@ -26039,10 +26157,10 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
26039
26157
  MeteredFeatures.displayName = "MeteredFeatures";
26040
26158
 
26041
26159
  // src/components/elements/payment-method/PaymentMethod.tsx
26042
- var import_react48 = require("react");
26160
+ var import_react49 = require("react");
26043
26161
 
26044
26162
  // src/components/elements/payment-method/PaymentMethodElement.tsx
26045
- var import_react47 = require("react");
26163
+ var import_react48 = require("react");
26046
26164
  var import_jsx_runtime59 = require("react/jsx-runtime");
26047
26165
  var PaymentElement2 = ({
26048
26166
  iconName,
@@ -26218,7 +26336,7 @@ var PaymentListElement = ({
26218
26336
  const { settings } = useEmbed();
26219
26337
  const isLightBackground = useIsLightBackground();
26220
26338
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
26221
- const expirationDate = (0, import_react47.useMemo)(() => {
26339
+ const expirationDate = (0, import_react48.useMemo)(() => {
26222
26340
  const { cardExpMonth, cardExpYear } = paymentMethod;
26223
26341
  if (!cardExpMonth || !cardExpYear) {
26224
26342
  return;
@@ -26310,10 +26428,10 @@ var resolveDesignProps5 = (props) => {
26310
26428
  }
26311
26429
  };
26312
26430
  };
26313
- var PaymentMethod = (0, import_react48.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26431
+ var PaymentMethod = (0, import_react49.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26314
26432
  const props = resolveDesignProps5(rest);
26315
26433
  const { data, setLayout } = useEmbed();
26316
- const { paymentMethod, monthsToExpiration } = (0, import_react48.useMemo)(() => {
26434
+ const { paymentMethod, monthsToExpiration } = (0, import_react49.useMemo)(() => {
26317
26435
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
26318
26436
  let monthsToExpiration2;
26319
26437
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -26517,7 +26635,7 @@ var loadStripe = function loadStripe2() {
26517
26635
  };
26518
26636
 
26519
26637
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
26520
- var import_react49 = require("react");
26638
+ var import_react50 = require("react");
26521
26639
  var import_jsx_runtime61 = require("react/jsx-runtime");
26522
26640
  var resolveDesignProps6 = () => {
26523
26641
  return {
@@ -26546,7 +26664,7 @@ var PaymentMethodDetails = ({
26546
26664
  updatePaymentMethod,
26547
26665
  deletePaymentMethod
26548
26666
  } = useEmbed();
26549
- const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react49.useMemo)(() => {
26667
+ const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react50.useMemo)(() => {
26550
26668
  return {
26551
26669
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
26552
26670
  paymentMethods: data?.company?.paymentMethods || [],
@@ -26559,13 +26677,13 @@ var PaymentMethodDetails = ({
26559
26677
  ]);
26560
26678
  const isLightBackground = useIsLightBackground();
26561
26679
  const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
26562
- const [isLoading, setIsLoading] = (0, import_react49.useState)(!initialPaymentMethod);
26563
- const [error, setError] = (0, import_react49.useState)();
26564
- const [showPaymentForm, setShowPaymentForm] = (0, import_react49.useState)(false);
26565
- const [stripe, setStripe] = (0, import_react49.useState)(null);
26566
- const [setupIntent, setSetupIntent] = (0, import_react49.useState)();
26567
- const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react49.useState)(false);
26568
- const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react49.useState)(initialPaymentMethod);
26680
+ const [isLoading, setIsLoading] = (0, import_react50.useState)(!initialPaymentMethod);
26681
+ const [error, setError] = (0, import_react50.useState)();
26682
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react50.useState)(false);
26683
+ const [stripe, setStripe] = (0, import_react50.useState)(null);
26684
+ const [setupIntent, setSetupIntent] = (0, import_react50.useState)();
26685
+ const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react50.useState)(false);
26686
+ const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react50.useState)(initialPaymentMethod);
26569
26687
  const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
26570
26688
  stripe,
26571
26689
  clientSecret: confirmPaymentIntentProps?.clientSecret,
@@ -26578,7 +26696,7 @@ var PaymentMethodDetails = ({
26578
26696
  },
26579
26697
  autoConfirm: true
26580
26698
  });
26581
- const monthsToExpiration = (0, import_react49.useMemo)(() => {
26699
+ const monthsToExpiration = (0, import_react50.useMemo)(() => {
26582
26700
  let expiration;
26583
26701
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
26584
26702
  const now = /* @__PURE__ */ new Date();
@@ -26601,8 +26719,8 @@ var PaymentMethodDetails = ({
26601
26719
  const toggleShowPaymentMethods = () => {
26602
26720
  setShowDifferentPaymentMethods((prev2) => !prev2);
26603
26721
  };
26604
- const locale = (0, import_react49.useMemo)(() => stripeLocale(language), [language]);
26605
- const initializeStripe = (0, import_react49.useCallback)(() => {
26722
+ const locale = (0, import_react50.useMemo)(() => stripeLocale(language), [language]);
26723
+ const initializeStripe = (0, import_react50.useCallback)(() => {
26606
26724
  if (stripe || !setupIntent) {
26607
26725
  return;
26608
26726
  }
@@ -26625,7 +26743,7 @@ var PaymentMethodDetails = ({
26625
26743
  setShowPaymentForm(false);
26626
26744
  });
26627
26745
  }, [t3, stripe, setupIntent, locale]);
26628
- const initializePaymentMethod = (0, import_react49.useCallback)(() => {
26746
+ const initializePaymentMethod = (0, import_react50.useCallback)(() => {
26629
26747
  const pending = createSetupIntent() ?? Promise.resolve(void 0);
26630
26748
  return pending.then((response) => {
26631
26749
  if (response) {
@@ -26640,7 +26758,7 @@ var PaymentMethodDetails = ({
26640
26758
  setIsLoading(false);
26641
26759
  });
26642
26760
  }, [t3, createSetupIntent]);
26643
- const handleUpdatePaymentMethod = (0, import_react49.useCallback)(
26761
+ const handleUpdatePaymentMethod = (0, import_react50.useCallback)(
26644
26762
  async (paymentMethodId) => {
26645
26763
  try {
26646
26764
  setIsLoading(true);
@@ -26662,7 +26780,7 @@ var PaymentMethodDetails = ({
26662
26780
  },
26663
26781
  [t3, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
26664
26782
  );
26665
- const handleDeletePaymentMethod = (0, import_react49.useCallback)(
26783
+ const handleDeletePaymentMethod = (0, import_react50.useCallback)(
26666
26784
  async (paymentMethodId) => {
26667
26785
  try {
26668
26786
  setIsLoading(true);
@@ -26678,10 +26796,10 @@ var PaymentMethodDetails = ({
26678
26796
  },
26679
26797
  [t3, deletePaymentMethod]
26680
26798
  );
26681
- (0, import_react49.useEffect)(() => {
26799
+ (0, import_react50.useEffect)(() => {
26682
26800
  initializeStripe();
26683
26801
  }, [initializeStripe]);
26684
- (0, import_react49.useEffect)(() => {
26802
+ (0, import_react50.useEffect)(() => {
26685
26803
  if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
26686
26804
  initializePaymentMethod();
26687
26805
  }
@@ -26861,7 +26979,7 @@ var PaymentMethodDetails = ({
26861
26979
  };
26862
26980
 
26863
26981
  // src/components/elements/plan-manager/PlanManager.tsx
26864
- var import_react51 = require("react");
26982
+ var import_react52 = require("react");
26865
26983
 
26866
26984
  // src/components/elements/plan-manager/AddOn.tsx
26867
26985
  var import_jsx_runtime62 = require("react/jsx-runtime");
@@ -26887,7 +27005,7 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26887
27005
  };
26888
27006
 
26889
27007
  // src/components/elements/plan-manager/UsageDetails.tsx
26890
- var import_react50 = require("react");
27008
+ var import_react51 = require("react");
26891
27009
  var import_jsx_runtime63 = require("react/jsx-runtime");
26892
27010
  var UsageDetails2 = ({
26893
27011
  entitlement,
@@ -26903,31 +27021,31 @@ var UsageDetails2 = ({
26903
27021
  billingPrice,
26904
27022
  limit,
26905
27023
  cost = 0
26906
- } = (0, import_react50.useMemo)(
27024
+ } = (0, import_react51.useMemo)(
26907
27025
  () => getUsageDetails(entitlement, period, currency, {
26908
27026
  showWarningThresholdAsLimit
26909
27027
  }),
26910
27028
  [entitlement, period, currency, showWarningThresholdAsLimit]
26911
27029
  );
26912
- const description = (0, import_react50.useMemo)(() => {
27030
+ const description = (0, import_react51.useMemo)(() => {
26913
27031
  const acc = [];
26914
27032
  let index = 0;
26915
27033
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
26916
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27034
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react51.Fragment, { children: [
26917
27035
  t3("Additional"),
26918
27036
  ": "
26919
27037
  ] }, index));
26920
27038
  index += 1;
26921
27039
  }
26922
27040
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
26923
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react50.Fragment, { children: t3("Tier-based") }, index));
27041
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react51.Fragment, { children: t3("Tier-based") }, index));
26924
27042
  index += 1;
26925
27043
  }
26926
27044
  const { price } = getEntitlementPrice(entitlement, period, currency) || {};
26927
27045
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
26928
27046
  const packageSize = billingPrice?.packageSize ?? 1;
26929
27047
  acc.push(
26930
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27048
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react51.Fragment, { children: [
26931
27049
  formatCurrency(price, { locale, currency: billingPrice?.currency }),
26932
27050
  /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
26933
27051
  "/",
@@ -26947,7 +27065,7 @@ var UsageDetails2 = ({
26947
27065
  }
26948
27066
  if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
26949
27067
  acc.push(
26950
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27068
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react51.Fragment, { children: [
26951
27069
  formatConsumptionRate(
26952
27070
  entitlement.planEntitlement.consumptionRate,
26953
27071
  locale
@@ -27069,7 +27187,7 @@ var resolveDesignProps7 = (props) => {
27069
27187
  }
27070
27188
  };
27071
27189
  };
27072
- var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal, ...rest }, ref) => {
27190
+ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal, ...rest }, ref) => {
27073
27191
  const props = resolveDesignProps7(rest);
27074
27192
  const { t: t3, locale } = useTranslation();
27075
27193
  const { data, settings, setCheckoutState, setLayout } = useEmbed();
@@ -27088,7 +27206,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27088
27206
  showCredits,
27089
27207
  showZeroPriceAsFree,
27090
27208
  trialPaymentMethodRequired
27091
- } = (0, import_react51.useMemo)(() => {
27209
+ } = (0, import_react52.useMemo)(() => {
27092
27210
  const planCreditOrder = /* @__PURE__ */ new Map();
27093
27211
  (data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
27094
27212
  if (!planCreditOrder.has(grant.creditId)) {
@@ -27148,15 +27266,15 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27148
27266
  data?.displaySettings?.showZeroPriceAsFree,
27149
27267
  data?.trialPaymentMethodRequired
27150
27268
  ]);
27151
- const usageBasedEntitlements = (0, import_react51.useMemo)(
27269
+ const usageBasedEntitlements = (0, import_react52.useMemo)(
27152
27270
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
27153
27271
  [featureUsage]
27154
27272
  );
27155
- const planCreditCompositions = (0, import_react51.useMemo)(
27273
+ const planCreditCompositions = (0, import_react52.useMemo)(
27156
27274
  () => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
27157
27275
  [currentPlan?.includedCreditGrants]
27158
27276
  );
27159
- const resolveLicenseQuantity = (0, import_react51.useMemo)(() => {
27277
+ const resolveLicenseQuantity = (0, import_react52.useMemo)(() => {
27160
27278
  return (licenseId) => {
27161
27279
  const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
27162
27280
  return typeof allocation === "number" ? allocation : void 0;
@@ -27179,7 +27297,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27179
27297
  subscriptionCurrency,
27180
27298
  willSubscriptionCancel,
27181
27299
  isTrialSubscription
27182
- } = (0, import_react51.useMemo)(() => {
27300
+ } = (0, import_react52.useMemo)(() => {
27183
27301
  const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
27184
27302
  const subscriptionCurrency2 = billingSubscription?.currency;
27185
27303
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -27192,7 +27310,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27192
27310
  };
27193
27311
  }, [billingSubscription]);
27194
27312
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
27195
- const { isFreePlan, isUsageBasedPlan } = (0, import_react51.useMemo)(() => {
27313
+ const { isFreePlan, isUsageBasedPlan } = (0, import_react52.useMemo)(() => {
27196
27314
  const isFreePlan2 = currentPlan?.planPrice === 0;
27197
27315
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
27198
27316
  return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
@@ -27836,10 +27954,10 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27836
27954
  PlanManager.displayName = "PlanManager";
27837
27955
 
27838
27956
  // src/components/elements/pricing-table/PricingTable.tsx
27839
- var import_react54 = require("react");
27957
+ var import_react55 = require("react");
27840
27958
 
27841
27959
  // src/components/elements/pricing-table/AddOn.tsx
27842
- var import_react52 = require("react");
27960
+ var import_react53 = require("react");
27843
27961
  var import_jsx_runtime65 = require("react/jsx-runtime");
27844
27962
  function renderMeteredEntitlementPricing2({
27845
27963
  priceBehavior,
@@ -27897,7 +28015,7 @@ var AddOn2 = ({
27897
28015
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
27898
28016
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
27899
28017
  const isLightBackground = useIsLightBackground();
27900
- const { currentAddOns, canCheckout, isStandalone } = (0, import_react52.useMemo)(() => {
28018
+ const { currentAddOns, canCheckout, isStandalone } = (0, import_react53.useMemo)(() => {
27901
28019
  const isStandalone2 = typeof data?.component === "undefined";
27902
28020
  return {
27903
28021
  currentAddOns: data?.company?.addOns || [],
@@ -28166,7 +28284,7 @@ var AddOn2 = ({
28166
28284
  };
28167
28285
 
28168
28286
  // src/components/elements/pricing-table/Plan.tsx
28169
- var import_react53 = require("react");
28287
+ var import_react54 = require("react");
28170
28288
 
28171
28289
  // src/components/elements/pricing-table/Entitlement.tsx
28172
28290
  var import_jsx_runtime66 = require("react/jsx-runtime");
@@ -28389,7 +28507,7 @@ var Plan2 = ({
28389
28507
  const { data, settings, setCheckoutState } = useEmbed();
28390
28508
  const isLightBackground = useIsLightBackground();
28391
28509
  const trialEnd = useTrialEnd();
28392
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react53.useState)({});
28510
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react54.useState)({});
28393
28511
  const handleToggleShowAll = (id) => {
28394
28512
  setEntitlementVisibility((prev2) => {
28395
28513
  const updated = !(prev2[id] ?? false);
@@ -28727,11 +28845,11 @@ var resolveDesignProps8 = (props) => {
28727
28845
  }
28728
28846
  };
28729
28847
  };
28730
- var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref) => {
28848
+ var PricingTable = (0, import_react55.forwardRef)(({ className, ...rest }, ref) => {
28731
28849
  const props = resolveDesignProps8(rest);
28732
28850
  const { t: t3 } = useTranslation();
28733
28851
  const { data, settings, isPending, hydratePublic, currencyFilter } = useEmbed();
28734
- const getCallToActionTarget = (0, import_react54.useCallback)(
28852
+ const getCallToActionTarget = (0, import_react55.useCallback)(
28735
28853
  (url, target) => {
28736
28854
  if (target) {
28737
28855
  return target;
@@ -28749,11 +28867,11 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28749
28867
  },
28750
28868
  []
28751
28869
  );
28752
- const [selectedPeriod, setSelectedPeriod] = (0, import_react54.useState)(
28870
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react55.useState)(
28753
28871
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
28754
28872
  );
28755
28873
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
28756
- const [selectedCurrency, setSelectedCurrency] = (0, import_react54.useState)(
28874
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react55.useState)(
28757
28875
  () => currencies[0] ?? DEFAULT_CURRENCY
28758
28876
  );
28759
28877
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -28771,19 +28889,19 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28771
28889
  } = useAvailablePlans(selectedPeriod, {
28772
28890
  useSelectedPeriod: showPeriodToggle
28773
28891
  });
28774
- const plans = (0, import_react54.useMemo)(
28892
+ const plans = (0, import_react55.useMemo)(
28775
28893
  () => hasCurrency ? allPlans.filter(
28776
28894
  (plan) => planSupportsCurrency(plan, selectedCurrency)
28777
28895
  ) : allPlans,
28778
28896
  [allPlans, hasCurrency, selectedCurrency]
28779
28897
  );
28780
- const addOns = (0, import_react54.useMemo)(
28898
+ const addOns = (0, import_react55.useMemo)(
28781
28899
  () => hasCurrency ? allAddOns.filter(
28782
28900
  (addOn) => planSupportsCurrency(addOn, selectedCurrency)
28783
28901
  ) : allAddOns,
28784
28902
  [allAddOns, hasCurrency, selectedCurrency]
28785
28903
  );
28786
- (0, import_react54.useEffect)(() => {
28904
+ (0, import_react55.useEffect)(() => {
28787
28905
  if (typeof data?.component === "undefined") {
28788
28906
  hydratePublic();
28789
28907
  }
@@ -28810,7 +28928,7 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28810
28928
  rest.callToActionUrl,
28811
28929
  rest.callToActionTarget
28812
28930
  );
28813
- const Wrapper = typeof data?.component === "undefined" ? Container : import_react54.Fragment;
28931
+ const Wrapper = typeof data?.component === "undefined" ? Container : import_react55.Fragment;
28814
28932
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
28815
28933
  FussyChild,
28816
28934
  {
@@ -28964,7 +29082,7 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28964
29082
  PricingTable.displayName = "PricingTable";
28965
29083
 
28966
29084
  // src/components/elements/text/Text.tsx
28967
- var import_react55 = require("react");
29085
+ var import_react56 = require("react");
28968
29086
  var import_jsx_runtime69 = require("react/jsx-runtime");
28969
29087
  var resolveDesignProps9 = (props) => {
28970
29088
  return {
@@ -28975,7 +29093,7 @@ var resolveDesignProps9 = (props) => {
28975
29093
  }
28976
29094
  };
28977
29095
  };
28978
- var TextElement = (0, import_react55.forwardRef)(({ children, className, ...rest }, ref) => {
29096
+ var TextElement = (0, import_react56.forwardRef)(({ children, className, ...rest }, ref) => {
28979
29097
  const props = resolveDesignProps9(rest);
28980
29098
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28981
29099
  Text,
@@ -28990,7 +29108,7 @@ var TextElement = (0, import_react55.forwardRef)(({ children, className, ...rest
28990
29108
  TextElement.displayName = "Text";
28991
29109
 
28992
29110
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
28993
- var import_react56 = require("react");
29111
+ var import_react57 = require("react");
28994
29112
  var import_jsx_runtime70 = require("react/jsx-runtime");
28995
29113
  var buttonStyles = {
28996
29114
  primary: {
@@ -29017,11 +29135,11 @@ var resolveDesignProps10 = (props) => {
29017
29135
  }
29018
29136
  };
29019
29137
  };
29020
- var UnsubscribeButton = (0, import_react56.forwardRef)(({ children, className, ...rest }, ref) => {
29138
+ var UnsubscribeButton = (0, import_react57.forwardRef)(({ children, className, ...rest }, ref) => {
29021
29139
  const props = resolveDesignProps10(rest);
29022
29140
  const { t: t3 } = useTranslation();
29023
29141
  const { data, setLayout } = useEmbed();
29024
- const hasActiveSubscription = (0, import_react56.useMemo)(() => {
29142
+ const hasActiveSubscription = (0, import_react57.useMemo)(() => {
29025
29143
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
29026
29144
  }, [data?.subscription]);
29027
29145
  if (!hasActiveSubscription) {
@@ -29056,7 +29174,7 @@ var UnsubscribeButton = (0, import_react56.forwardRef)(({ children, className, .
29056
29174
  UnsubscribeButton.displayName = "UnsubscribeButton";
29057
29175
 
29058
29176
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
29059
- var import_react57 = require("react");
29177
+ var import_react58 = require("react");
29060
29178
  var import_jsx_runtime71 = require("react/jsx-runtime");
29061
29179
  function resolveDesignProps11(props) {
29062
29180
  return {
@@ -29076,15 +29194,15 @@ function resolveDesignProps11(props) {
29076
29194
  }
29077
29195
  };
29078
29196
  }
29079
- var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref) => {
29197
+ var UpcomingBill = (0, import_react58.forwardRef)(({ className, ...rest }, ref) => {
29080
29198
  const props = resolveDesignProps11(rest);
29081
29199
  const { t: t3, locale } = useTranslation();
29082
29200
  const { data, settings, getUpcomingInvoice } = useEmbed();
29083
29201
  const isLightBackground = useIsLightBackground();
29084
- const [isLoading, setIsLoading] = (0, import_react57.useState)(false);
29085
- const [error, setError] = (0, import_react57.useState)();
29086
- const [upcomingInvoice, setUpcomingInvoice] = (0, import_react57.useState)(data?.upcomingInvoice);
29087
- const discounts = (0, import_react57.useMemo)(() => {
29202
+ const [isLoading, setIsLoading] = (0, import_react58.useState)(false);
29203
+ const [error, setError] = (0, import_react58.useState)();
29204
+ const [upcomingInvoice, setUpcomingInvoice] = (0, import_react58.useState)(data?.upcomingInvoice);
29205
+ const discounts = (0, import_react58.useMemo)(() => {
29088
29206
  return (data?.subscription?.discounts || []).filter(
29089
29207
  (discount) => (
29090
29208
  // Only surface discounts that are currently active and actually
@@ -29102,7 +29220,7 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
29102
29220
  durationInMonths: discount.durationInMonths ?? void 0
29103
29221
  }));
29104
29222
  }, [data?.subscription?.discounts]);
29105
- const getInvoice = (0, import_react57.useCallback)(async () => {
29223
+ const getInvoice = (0, import_react58.useCallback)(async () => {
29106
29224
  if (data?.component?.id && data?.subscription && !data.subscription.cancelAt) {
29107
29225
  try {
29108
29226
  setError(void 0);
@@ -29118,15 +29236,15 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
29118
29236
  }
29119
29237
  }
29120
29238
  }, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
29121
- (0, import_react57.useEffect)(() => {
29239
+ (0, import_react58.useEffect)(() => {
29122
29240
  getInvoice();
29123
29241
  }, [getInvoice]);
29124
- (0, import_react57.useEffect)(() => {
29242
+ (0, import_react58.useEffect)(() => {
29125
29243
  if (data?.upcomingInvoice) {
29126
29244
  setUpcomingInvoice(data.upcomingInvoice);
29127
29245
  }
29128
29246
  }, [data?.upcomingInvoice]);
29129
- const { currency, applied, remaining } = (0, import_react57.useMemo)(() => {
29247
+ const { currency, applied, remaining } = (0, import_react58.useMemo)(() => {
29130
29248
  const currency2 = upcomingInvoice?.currency;
29131
29249
  const startingBalance = upcomingInvoice?.startingBalance ?? 0;
29132
29250
  const endingBalance = upcomingInvoice?.endingBalance ?? 0;
@@ -29140,6 +29258,7 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
29140
29258
  upcomingInvoice?.endingBalance,
29141
29259
  upcomingInvoice?.subtotal
29142
29260
  ]);
29261
+ const { billDate, paymentDueDate } = useNextBillDate(upcomingInvoice ?? null);
29143
29262
  const hasApplied = applied > 0;
29144
29263
  const hasBalance = remaining > 0 || applied > 0;
29145
29264
  if (!data?.subscription || data.subscription.cancelAt) {
@@ -29171,10 +29290,21 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
29171
29290
  ]
29172
29291
  }
29173
29292
  ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
29174
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { display: props.header.fontStyle, children: [
29175
- t3(props.header.prefix),
29176
- " ",
29177
- toPrettyDate(upcomingInvoice.dueDate, { locale })
29293
+ props.header.isVisible && upcomingInvoice.dueDate && billDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
29294
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { display: props.header.fontStyle, children: [
29295
+ t3(props.header.prefix),
29296
+ " ",
29297
+ toPrettyDate(billDate, { locale })
29298
+ ] }),
29299
+ paymentDueDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
29300
+ Text,
29301
+ {
29302
+ $size: 0.8125 * settings.theme.typography.text.fontSize,
29303
+ children: t3("Payment due", {
29304
+ date: toPrettyDate(paymentDueDate, { locale })
29305
+ })
29306
+ }
29307
+ )
29178
29308
  ] }),
29179
29309
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
29180
29310
  Flex,
@@ -31916,10 +32046,10 @@ function inflate(input, options = {}) {
31916
32046
  }
31917
32047
 
31918
32048
  // src/components/embed/Embed.tsx
31919
- var import_react59 = require("react");
32049
+ var import_react60 = require("react");
31920
32050
 
31921
32051
  // src/components/embed/renderer.ts
31922
- var import_react58 = require("react");
32052
+ var import_react59 = require("react");
31923
32053
  var components = {
31924
32054
  Root,
31925
32055
  Viewport,
@@ -31983,7 +32113,7 @@ function createRenderer(options) {
31983
32113
  const { className, ...rest } = props;
31984
32114
  const resolvedProps = component === "div" ? rest : props;
31985
32115
  const resolvedChildren = children.map(renderNode);
31986
- return (0, import_react58.createElement)(
32116
+ return (0, import_react59.createElement)(
31987
32117
  component,
31988
32118
  {
31989
32119
  key: index,
@@ -32033,7 +32163,7 @@ var Error2 = ({ message }) => {
32033
32163
  );
32034
32164
  };
32035
32165
  var SchematicEmbed = ({ id, accessToken }) => {
32036
- const theme = (0, import_react59.useContext)(nt);
32166
+ const theme = (0, import_react60.useContext)(nt);
32037
32167
  const { t: t3 } = useTranslation();
32038
32168
  const {
32039
32169
  data,
@@ -32046,7 +32176,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
32046
32176
  setBuilderSettings
32047
32177
  } = useEmbed();
32048
32178
  const compressedAst = data?.component?.ast;
32049
- const { children, parsedSettings, parseError } = (0, import_react59.useMemo)(() => {
32179
+ const { children, parsedSettings, parseError } = (0, import_react60.useMemo)(() => {
32050
32180
  let children2 = null;
32051
32181
  let parsedSettings2 = null;
32052
32182
  let parseError2 = null;
@@ -32078,22 +32208,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
32078
32208
  parseError: parseError2
32079
32209
  };
32080
32210
  }, [compressedAst]);
32081
- (0, import_react59.useEffect)(() => {
32211
+ (0, import_react60.useEffect)(() => {
32082
32212
  if (accessToken) {
32083
32213
  setAccessToken(accessToken);
32084
32214
  }
32085
32215
  }, [accessToken, setAccessToken]);
32086
- (0, import_react59.useEffect)(() => {
32216
+ (0, import_react60.useEffect)(() => {
32087
32217
  if (id && stale) {
32088
32218
  hydrateComponent(id);
32089
32219
  }
32090
32220
  }, [id, hydrateComponent, stale]);
32091
- (0, import_react59.useEffect)(() => {
32221
+ (0, import_react60.useEffect)(() => {
32092
32222
  if (parsedSettings) {
32093
32223
  setBuilderSettings(parsedSettings);
32094
32224
  }
32095
32225
  }, [parsedSettings, setBuilderSettings]);
32096
- (0, import_react59.useEffect)(() => {
32226
+ (0, import_react60.useEffect)(() => {
32097
32227
  if (parseError) {
32098
32228
  setError(parseError);
32099
32229
  }