@schematichq/schematic-components 2.28.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.
@@ -3635,6 +3635,7 @@ __export(index_exports, {
3635
3635
  useCustomPlanBilling: () => useCustomPlanBilling,
3636
3636
  useEmbed: () => useEmbed,
3637
3637
  useIsLightBackground: () => useIsLightBackground,
3638
+ useNextBillDate: () => useNextBillDate,
3638
3639
  usePaymentConfirmation: () => usePaymentConfirmation,
3639
3640
  useRequest: () => useRequest,
3640
3641
  useSubscriptionCurrency: () => useSubscriptionCurrency,
@@ -3645,10 +3646,10 @@ __export(index_exports, {
3645
3646
  module.exports = __toCommonJS(index_exports);
3646
3647
 
3647
3648
  // src/components/elements/button/Button.tsx
3648
- var import_react40 = require("react");
3649
+ var import_react41 = require("react");
3649
3650
 
3650
3651
  // src/components/layout/card/Card.tsx
3651
- var import_react19 = require("react");
3652
+ var import_react20 = require("react");
3652
3653
 
3653
3654
  // src/const/components.ts
3654
3655
  var VISIBLE_CREDIT_COUNT = 3;
@@ -4329,6 +4330,10 @@ function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
4329
4330
  }
4330
4331
 
4331
4332
  // src/api/checkoutexternal/models/BillingCollectionMethod.ts
4333
+ var BillingCollectionMethod = {
4334
+ ChargeAutomatically: "charge_automatically",
4335
+ SendInvoice: "send_invoice"
4336
+ };
4332
4337
  function BillingCollectionMethodFromJSON(json) {
4333
4338
  return BillingCollectionMethodFromJSONTyped(json, false);
4334
4339
  }
@@ -6428,6 +6433,48 @@ function CompanyOverrideResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6428
6433
  };
6429
6434
  }
6430
6435
 
6436
+ // src/api/checkoutexternal/models/CompanyPaymentMethodResponseData.ts
6437
+ function CompanyPaymentMethodResponseDataFromJSON(json) {
6438
+ return CompanyPaymentMethodResponseDataFromJSONTyped(json, false);
6439
+ }
6440
+ function CompanyPaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6441
+ if (json == null) {
6442
+ return json;
6443
+ }
6444
+ return {
6445
+ accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
6446
+ accountName: json["account_name"] == null ? void 0 : json["account_name"],
6447
+ bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
6448
+ billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
6449
+ billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
6450
+ canRemove: json["can_remove"],
6451
+ cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
6452
+ cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
6453
+ cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
6454
+ cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
6455
+ externalId: json["external_id"],
6456
+ id: json["id"],
6457
+ isDefault: json["is_default"],
6458
+ type: json["type"]
6459
+ };
6460
+ }
6461
+
6462
+ // src/api/checkoutexternal/models/CompanyPaymentMethodsResponseData.ts
6463
+ function CompanyPaymentMethodsResponseDataFromJSON(json) {
6464
+ return CompanyPaymentMethodsResponseDataFromJSONTyped(json, false);
6465
+ }
6466
+ function CompanyPaymentMethodsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6467
+ if (json == null) {
6468
+ return json;
6469
+ }
6470
+ return {
6471
+ count: json["count"],
6472
+ paymentMethods: json["payment_methods"].map(
6473
+ CompanyPaymentMethodResponseDataFromJSON
6474
+ )
6475
+ };
6476
+ }
6477
+
6431
6478
  // src/api/checkoutexternal/models/CompanyPlanInvalidReason.ts
6432
6479
  var CompanyPlanInvalidReason = {
6433
6480
  DowngradeNotPermitted: "downgrade_not_permitted",
@@ -7831,6 +7878,20 @@ function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
7831
7878
  };
7832
7879
  }
7833
7880
 
7881
+ // src/api/checkoutexternal/models/GetCompanyPaymentMethodsResponse.ts
7882
+ function GetCompanyPaymentMethodsResponseFromJSON(json) {
7883
+ return GetCompanyPaymentMethodsResponseFromJSONTyped(json, false);
7884
+ }
7885
+ function GetCompanyPaymentMethodsResponseFromJSONTyped(json, ignoreDiscriminator) {
7886
+ if (json == null) {
7887
+ return json;
7888
+ }
7889
+ return {
7890
+ data: CompanyPaymentMethodsResponseDataFromJSON(json["data"]),
7891
+ params: json["params"]
7892
+ };
7893
+ }
7894
+
7834
7895
  // src/api/checkoutexternal/models/GetCompanyUpcomingInvoiceResponse.ts
7835
7896
  function GetCompanyUpcomingInvoiceResponseFromJSON(json) {
7836
7897
  return GetCompanyUpcomingInvoiceResponseFromJSONTyped(json, false);
@@ -8725,6 +8786,38 @@ var CheckoutexternalApi = class extends BaseAPI {
8725
8786
  );
8726
8787
  return await response.value();
8727
8788
  }
8789
+ /**
8790
+ * Get company payment methods
8791
+ */
8792
+ async getCompanyPaymentMethodsRaw(initOverrides) {
8793
+ const queryParameters = {};
8794
+ const headerParameters = {};
8795
+ if (this.configuration && this.configuration.apiKey) {
8796
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8797
+ "X-Schematic-Api-Key"
8798
+ );
8799
+ }
8800
+ const response = await this.request(
8801
+ {
8802
+ path: `/company/payment-methods`,
8803
+ method: "GET",
8804
+ headers: headerParameters,
8805
+ query: queryParameters
8806
+ },
8807
+ initOverrides
8808
+ );
8809
+ return new JSONApiResponse(
8810
+ response,
8811
+ (jsonValue) => GetCompanyPaymentMethodsResponseFromJSON(jsonValue)
8812
+ );
8813
+ }
8814
+ /**
8815
+ * Get company payment methods
8816
+ */
8817
+ async getCompanyPaymentMethods(initOverrides) {
8818
+ const response = await this.getCompanyPaymentMethodsRaw(initOverrides);
8819
+ return await response.value();
8820
+ }
8728
8821
  /**
8729
8822
  * Get company upcoming invoice
8730
8823
  */
@@ -13579,6 +13672,7 @@ var en = {
13579
13672
  "An invoice is created when charges reach $X; the rest is billed monthly.": "An invoice is created when charges reach {{amount}}; the rest is billed monthly.",
13580
13673
  "An unknown error occurred.": "An unknown error occurred.",
13581
13674
  "Billed": "Billed {{period}}",
13675
+ "Billing threshold": "Billing threshold",
13582
13676
  "Bundle selected": "Bundle selected",
13583
13677
  "Buy credits": "Buy credits",
13584
13678
  "Cancel": "Cancel",
@@ -13613,8 +13707,11 @@ var en = {
13613
13707
  "Due today": "Due today",
13614
13708
  "Edit payment details": "Edit payment details",
13615
13709
  "Edit": "Edit",
13710
+ "Email": "Email",
13616
13711
  "Ends on": "Ends on {{date}}",
13617
13712
  "Enter discount code": "Enter discount code",
13713
+ "Enter email address": "Enter email address",
13714
+ "Error": "Error",
13618
13715
  "Error initializing payment method change. Please try again.": "Error initializing payment method change. Please try again.",
13619
13716
  "Error processing payment. Please try a different payment method.": "Error processing payment. Please try a different payment method.",
13620
13717
  "Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
@@ -13635,6 +13732,7 @@ var en = {
13635
13732
  "Invoice credit tooltip": "Credit \u2014 this amount was returned to your account, typically due to a plan change or proration",
13636
13733
  "Invoice charge tooltip": "Charge \u2014 you were billed this amount",
13637
13734
  "Invoices": "Invoices",
13735
+ "Limit": "Limit",
13638
13736
  "Limit of": "Limit of {{amount}}",
13639
13737
  "Loading": "Loading",
13640
13738
  "Manage plan": "Manage plan",
@@ -13657,8 +13755,11 @@ var en = {
13657
13755
  "Error saving custom field values. Please try again.": "Error saving custom field values. Please try again.",
13658
13756
  "Pay now": "Pay now",
13659
13757
  "Payment Details": "Payment Details",
13758
+ "Payment due": "Payment due {{date}}",
13660
13759
  "Plan selected": "Plan selected",
13661
13760
  "Please accept the agreement to continue.": "Please accept the agreement to continue.",
13761
+ "Please try again later.": "Please try again later.",
13762
+ "Portal not found": "Portal not found",
13662
13763
  "Plan": "Plan",
13663
13764
  "Plans": "Plans",
13664
13765
  "Please provide an access token.": "Please provide an access token.",
@@ -13710,6 +13811,7 @@ var en = {
13710
13811
  "There was a problem retrieving your upcoming invoice.": "There was a problem retrieving your upcoming invoice.",
13711
13812
  "There was a problem retrieving your invoices.": "There was a problem retrieving your invoices.",
13712
13813
  "Tier-based": "Tier-based",
13814
+ "Tiered pricing": "Tiered pricing",
13713
13815
  "Tiers apply progressively as quantity increases.": "Tiers apply progressively as quantity increases.",
13714
13816
  "Top up balance with:": "Top up balance with:",
13715
13817
  "Top-ups": "Top-ups",
@@ -13783,6 +13885,15 @@ var en = {
13783
13885
  "$X/unit/period": "{{cost}}/{{unit}}/{{period}}",
13784
13886
  "$X/Y units/period": "{{cost}}/{{size}} {{units}}/{{period}}",
13785
13887
  "day": "day",
13888
+ "day_one": "day",
13889
+ "day_other": "days",
13890
+ "hour_one": "hour",
13891
+ "hour_other": "hours",
13892
+ "minute_one": "minute",
13893
+ "minute_other": "minutes",
13894
+ "second_one": "second",
13895
+ "second_other": "seconds",
13896
+ "week": "week",
13786
13897
  "month": "month",
13787
13898
  "quarter": "quarter",
13788
13899
  "year": "year",
@@ -13791,6 +13902,13 @@ var en = {
13791
13902
  "yr": "yr",
13792
13903
  "one time": "one time",
13793
13904
  "billing period": "billing period",
13905
+ "billing period_one": "billing period",
13906
+ "billing period_other": "billing periods",
13907
+ "daily": "daily",
13908
+ "weekly": "weekly",
13909
+ "monthly": "monthly",
13910
+ "quarterly": "quarterly",
13911
+ "yearly": "yearly",
13794
13912
  "expires after purchase": "expires {{amount}} {{unit}} after purchase",
13795
13913
  "expires at the end of the billing period": "expires at the end of the billing period",
13796
13914
  "expires at the end of the next billing period": "expires at the end of the next billing period",
@@ -14480,11 +14598,9 @@ function formatBundleExpiry(bundle, t2) {
14480
14598
  if (typeof bundle.expiryUnitCount !== "number") {
14481
14599
  return void 0;
14482
14600
  }
14483
- const unit = bundle.expiryUnit === BillingCreditExpiryUnit.BillingPeriods ? t2("billing period") : t2("day");
14484
- return t2("expires after purchase", {
14485
- amount: bundle.expiryUnitCount,
14486
- unit: pluralize(unit, bundle.expiryUnitCount)
14487
- });
14601
+ const count = bundle.expiryUnitCount;
14602
+ const unit = bundle.expiryUnit === BillingCreditExpiryUnit.BillingPeriods ? t2("billing period", { count }) : t2("day", { count });
14603
+ return t2("expires after purchase", { amount: count, unit });
14488
14604
  }
14489
14605
  case BillingCreditExpiryType.EndOfBillingPeriod:
14490
14606
  return t2("expires at the end of the billing period");
@@ -14729,16 +14845,33 @@ function entitlementHasHardLimit(entitlement) {
14729
14845
  }
14730
14846
 
14731
14847
  // src/utils/api/feature.ts
14732
- function getFeatureName(feature, count = 0, ignore = false) {
14733
- const shouldBePlural = count === 0 || count > 1;
14848
+ function isEnglish(locale) {
14849
+ try {
14850
+ return new Intl.Locale(locale).language === "en";
14851
+ } catch {
14852
+ return true;
14853
+ }
14854
+ }
14855
+ function isOne(count, locale) {
14856
+ return new Intl.PluralRules(locale).select(count) === "one";
14857
+ }
14858
+ function getFeatureName(feature, locale, count, ignore = false) {
14859
+ if (!isEnglish(locale)) {
14860
+ const named = ignore ? { name: feature.name } : feature;
14861
+ const singularName2 = named.singularName || named.name;
14862
+ const pluralName2 = named.pluralName || singularName2;
14863
+ return count !== void 0 && isOne(count, locale) ? singularName2 : pluralName2;
14864
+ }
14865
+ const resolvedCount = count ?? 0;
14866
+ const shouldBePlural = resolvedCount === 0 || resolvedCount > 1;
14734
14867
  const { name, singularName, pluralName } = feature;
14735
14868
  if (!ignore && pluralName && shouldBePlural) {
14736
14869
  return pluralName;
14737
14870
  }
14738
14871
  if (!ignore && singularName) {
14739
- return shouldBePlural ? pluralize(singularName, count) : singularName;
14872
+ return shouldBePlural ? pluralize(singularName, resolvedCount) : singularName;
14740
14873
  }
14741
- return pluralize(name, count);
14874
+ return pluralize(name, resolvedCount);
14742
14875
  }
14743
14876
 
14744
14877
  // src/utils/color.ts
@@ -14948,8 +15081,21 @@ function formatCurrency(amount, {
14948
15081
  function formatOrdinal(n, t2) {
14949
15082
  return t2("Ordinal", { count: n, ordinal: true });
14950
15083
  }
14951
- function adjectify(str) {
14952
- return `${str}ly`;
15084
+ function adjectify(period, t2) {
15085
+ switch (period) {
15086
+ case "day":
15087
+ return t2("daily");
15088
+ case "week":
15089
+ return t2("weekly");
15090
+ case "month":
15091
+ return t2("monthly");
15092
+ case "quarter":
15093
+ return t2("quarterly");
15094
+ case "year":
15095
+ return t2("yearly");
15096
+ default:
15097
+ return period;
15098
+ }
14953
15099
  }
14954
15100
  var CURRENCY_FLAGS = {
14955
15101
  usd: "\u{1F1FA}\u{1F1F8}",
@@ -15065,11 +15211,12 @@ function getBillingPreviewText({
15065
15211
  );
15066
15212
  }
15067
15213
  const schedule = scheduleParts.length > 0 ? `${scheduleParts.join(" ")} ` : "";
15214
+ const period = t2(planPeriod);
15068
15215
  if (!discount) {
15069
15216
  return t2("You will be billed", {
15070
15217
  price: subscriptionPrice,
15071
15218
  usage,
15072
- period: planPeriod,
15219
+ period,
15073
15220
  schedule
15074
15221
  });
15075
15222
  }
@@ -15078,7 +15225,7 @@ function getBillingPreviewText({
15078
15225
  return t2("You will be billed", {
15079
15226
  price: discountedPrice,
15080
15227
  usage,
15081
- period: planPeriod,
15228
+ period,
15082
15229
  schedule
15083
15230
  });
15084
15231
  }
@@ -15086,7 +15233,7 @@ function getBillingPreviewText({
15086
15233
  return t2("You will be billed with discount window", {
15087
15234
  price: discountedPrice,
15088
15235
  usage,
15089
- period: planPeriod,
15236
+ period,
15090
15237
  schedule,
15091
15238
  window: t2("for the next months", { count: durationInMonths }),
15092
15239
  fullPrice: subscriptionPrice
@@ -15095,7 +15242,7 @@ function getBillingPreviewText({
15095
15242
  return t2("You will be billed next bill discount", {
15096
15243
  price: discountedPrice,
15097
15244
  usage,
15098
- period: planPeriod,
15245
+ period,
15099
15246
  schedule,
15100
15247
  fullPrice: subscriptionPrice
15101
15248
  });
@@ -15871,7 +16018,7 @@ var reducer = (state, action) => {
15871
16018
  // src/context/EmbedProvider.tsx
15872
16019
  var import_jsx_runtime4 = require("react/jsx-runtime");
15873
16020
  var getCustomHeaders = (sessionId) => ({
15874
- "X-Schematic-Components-Version": "2.28.0",
16021
+ "X-Schematic-Components-Version": "2.29.1",
15875
16022
  "X-Schematic-Session-ID": sessionId
15876
16023
  });
15877
16024
  var normalizeCurrencyFilter = (filter) => {
@@ -16657,8 +16804,31 @@ function useIsLightBackground() {
16657
16804
  return isLightBackground;
16658
16805
  }
16659
16806
 
16660
- // src/hooks/usePaymentConfirmation.ts
16807
+ // src/hooks/useNextBillDate.ts
16661
16808
  var import_react10 = require("react");
16809
+ function useNextBillDate(upcomingInvoice) {
16810
+ const { data } = useEmbed();
16811
+ const invoice = upcomingInvoice === void 0 ? data?.upcomingInvoice : upcomingInvoice;
16812
+ const subscription = data?.company?.billingSubscription;
16813
+ const cancelAtPeriodEnd = subscription?.cancelAtPeriodEnd;
16814
+ const periodEnd = subscription?.periodEnd;
16815
+ const collectionMethod = invoice?.collectionMethod;
16816
+ const dueDate = invoice?.dueDate ?? void 0;
16817
+ return (0, import_react10.useMemo)(() => {
16818
+ if (cancelAtPeriodEnd) {
16819
+ return { billDate: void 0, paymentDueDate: void 0 };
16820
+ }
16821
+ const billDate = periodEnd && periodEnd > 0 ? new Date(periodEnd * 1e3) : dueDate;
16822
+ const hasSeparateDeadline = collectionMethod === BillingCollectionMethod.SendInvoice && dueDate && billDate && new Date(dueDate).toDateString() !== new Date(billDate).toDateString();
16823
+ return {
16824
+ billDate,
16825
+ paymentDueDate: hasSeparateDeadline ? dueDate : void 0
16826
+ };
16827
+ }, [cancelAtPeriodEnd, periodEnd, collectionMethod, dueDate]);
16828
+ }
16829
+
16830
+ // src/hooks/usePaymentConfirmation.ts
16831
+ var import_react11 = require("react");
16662
16832
  var usePaymentConfirmation = ({
16663
16833
  stripe,
16664
16834
  clientSecret,
@@ -16666,24 +16836,24 @@ var usePaymentConfirmation = ({
16666
16836
  onError: onError3,
16667
16837
  autoConfirm = false
16668
16838
  }) => {
16669
- const [state, setState] = (0, import_react10.useState)(() => ({
16839
+ const [state, setState] = (0, import_react11.useState)(() => ({
16670
16840
  secret: clientSecret,
16671
16841
  status: "idle",
16672
16842
  error: null
16673
16843
  }));
16674
- const onSuccessRef = (0, import_react10.useRef)(onSuccess);
16675
- const onErrorRef = (0, import_react10.useRef)(onError3);
16676
- (0, import_react10.useEffect)(() => {
16844
+ const onSuccessRef = (0, import_react11.useRef)(onSuccess);
16845
+ const onErrorRef = (0, import_react11.useRef)(onError3);
16846
+ (0, import_react11.useEffect)(() => {
16677
16847
  onSuccessRef.current = onSuccess;
16678
16848
  onErrorRef.current = onError3;
16679
16849
  });
16680
- const confirmedSecrets = (0, import_react10.useRef)(/* @__PURE__ */ new Set());
16681
- const abortControllerRef = (0, import_react10.useRef)(null);
16850
+ const confirmedSecrets = (0, import_react11.useRef)(/* @__PURE__ */ new Set());
16851
+ const abortControllerRef = (0, import_react11.useRef)(null);
16682
16852
  const isCurrentSecret = state.secret === clientSecret;
16683
16853
  const status = isCurrentSecret ? state.status : "idle";
16684
16854
  const error = isCurrentSecret ? state.error : null;
16685
16855
  const isConfirming = status === "confirming";
16686
- const confirmPayment = (0, import_react10.useCallback)(async () => {
16856
+ const confirmPayment = (0, import_react11.useCallback)(async () => {
16687
16857
  if (!stripe || !clientSecret) {
16688
16858
  const err = new Error(
16689
16859
  "Missing required parameters: stripe instance or client secret"
@@ -16731,7 +16901,7 @@ var usePaymentConfirmation = ({
16731
16901
  abortControllerRef.current = null;
16732
16902
  }
16733
16903
  }, [stripe, clientSecret]);
16734
- const reset = (0, import_react10.useCallback)(() => {
16904
+ const reset = (0, import_react11.useCallback)(() => {
16735
16905
  if (clientSecret) {
16736
16906
  confirmedSecrets.current.delete(clientSecret);
16737
16907
  }
@@ -16741,12 +16911,12 @@ var usePaymentConfirmation = ({
16741
16911
  abortControllerRef.current = null;
16742
16912
  }
16743
16913
  }, [clientSecret]);
16744
- (0, import_react10.useEffect)(() => {
16914
+ (0, import_react11.useEffect)(() => {
16745
16915
  if (autoConfirm && status === "idle" && stripe && clientSecret) {
16746
16916
  queueMicrotask(confirmPayment);
16747
16917
  }
16748
16918
  }, [autoConfirm, stripe, clientSecret, status, confirmPayment]);
16749
- (0, import_react10.useEffect)(() => {
16919
+ (0, import_react11.useEffect)(() => {
16750
16920
  return () => {
16751
16921
  if (abortControllerRef.current) {
16752
16922
  abortControllerRef.current.abort();
@@ -16764,12 +16934,12 @@ var usePaymentConfirmation = ({
16764
16934
  };
16765
16935
 
16766
16936
  // src/hooks/useRequest.ts
16767
- var import_react11 = require("react");
16937
+ var import_react12 = require("react");
16768
16938
  function useRequest(fn) {
16769
- const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
16770
- const [error, setError] = (0, import_react11.useState)(null);
16771
- const [data, setData] = (0, import_react11.useState)(void 0);
16772
- const request = (0, import_react11.useCallback)(async () => {
16939
+ const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
16940
+ const [error, setError] = (0, import_react12.useState)(null);
16941
+ const [data, setData] = (0, import_react12.useState)(void 0);
16942
+ const request = (0, import_react12.useCallback)(async () => {
16773
16943
  try {
16774
16944
  setError(null);
16775
16945
  setIsLoading(true);
@@ -16784,7 +16954,7 @@ function useRequest(fn) {
16784
16954
  setIsLoading(false);
16785
16955
  }
16786
16956
  }, [fn]);
16787
- const value = (0, import_react11.useMemo)(() => {
16957
+ const value = (0, import_react12.useMemo)(() => {
16788
16958
  const state = { isLoading, error, data };
16789
16959
  return [state, request];
16790
16960
  }, [isLoading, error, data, request]);
@@ -16792,10 +16962,11 @@ function useRequest(fn) {
16792
16962
  }
16793
16963
 
16794
16964
  // src/hooks/useTrialEnd.ts
16795
- var import_react12 = require("react");
16965
+ var import_react13 = require("react");
16796
16966
  function useTrialEnd() {
16797
16967
  const { data } = useEmbed();
16798
- const { endDate, amount, units } = (0, import_react12.useMemo)(() => {
16968
+ const { t: t2 } = useTranslation();
16969
+ const { endDate, amount, units } = (0, import_react13.useMemo)(() => {
16799
16970
  const billingSubscription = data?.company?.billingSubscription;
16800
16971
  const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
16801
16972
  let amount2;
@@ -16817,27 +16988,27 @@ function useTrialEnd() {
16817
16988
  amount2 = Math.floor(difference / SECONDS_IN_MS);
16818
16989
  unit = "second";
16819
16990
  }
16820
- units2 = pluralize(unit, amount2);
16991
+ units2 = t2(unit, { count: amount2 });
16821
16992
  }
16822
16993
  return { endDate: end, amount: amount2, units: units2 };
16823
- }, [data?.company?.billingSubscription]);
16994
+ }, [data?.company?.billingSubscription, t2]);
16824
16995
  return { endDate, amount, units };
16825
16996
  }
16826
16997
 
16827
16998
  // src/hooks/useTruncatedList.ts
16828
- var import_react13 = require("react");
16999
+ var import_react14 = require("react");
16829
17000
  function useTruncatedList(items, { limit }) {
16830
- const [isExpandedState, setIsExpanded] = (0, import_react13.useState)(false);
17001
+ const [isExpandedState, setIsExpanded] = (0, import_react14.useState)(false);
16831
17002
  const total = items.length;
16832
17003
  const canExpand = total > limit;
16833
17004
  const isExpanded = canExpand && isExpandedState;
16834
- const visibleItems = (0, import_react13.useMemo)(
17005
+ const visibleItems = (0, import_react14.useMemo)(
16835
17006
  () => canExpand && !isExpanded ? items.slice(0, limit) : items,
16836
17007
  [items, limit, canExpand, isExpanded]
16837
17008
  );
16838
- const toggle = (0, import_react13.useCallback)(() => setIsExpanded((prev) => !prev), []);
16839
- const expand = (0, import_react13.useCallback)(() => setIsExpanded(true), []);
16840
- const collapse = (0, import_react13.useCallback)(() => setIsExpanded(false), []);
17009
+ const toggle = (0, import_react14.useCallback)(() => setIsExpanded((prev) => !prev), []);
17010
+ const expand = (0, import_react14.useCallback)(() => setIsExpanded(true), []);
17011
+ const collapse = (0, import_react14.useCallback)(() => setIsExpanded(false), []);
16841
17012
  return {
16842
17013
  items: visibleItems,
16843
17014
  total,
@@ -16851,10 +17022,10 @@ function useTruncatedList(items, { limit }) {
16851
17022
  }
16852
17023
 
16853
17024
  // src/hooks/useWrapChildren.ts
16854
- var import_react14 = require("react");
17025
+ var import_react15 = require("react");
16855
17026
  function useWrapChildren(ref) {
16856
- const [shouldWrap, setShouldWrap] = (0, import_react14.useState)([]);
16857
- (0, import_react14.useLayoutEffect)(() => {
17027
+ const [shouldWrap, setShouldWrap] = (0, import_react15.useState)([]);
17028
+ (0, import_react15.useLayoutEffect)(() => {
16858
17029
  const rowShouldWrap = (parent) => [...parent.children].some(
16859
17030
  (el) => el instanceof HTMLElement && el.previousElementSibling instanceof HTMLElement && el.offsetLeft <= el.previousElementSibling.offsetLeft
16860
17031
  );
@@ -17315,7 +17486,7 @@ var Checkbox = import_styled_components8.styled.input.attrs({ type: "checkbox" }
17315
17486
  `;
17316
17487
 
17317
17488
  // src/components/ui/dialog/Dialog.tsx
17318
- var import_react15 = require("react");
17489
+ var import_react16 = require("react");
17319
17490
 
17320
17491
  // src/components/ui/dialog/styles.ts
17321
17492
  var import_styled_components9 = __toESM(require_styled_components_cjs());
@@ -17383,7 +17554,7 @@ var Dialog = import_styled_components9.styled.dialog(
17383
17554
 
17384
17555
  // src/components/ui/dialog/Dialog.tsx
17385
17556
  var import_jsx_runtime5 = require("react/jsx-runtime");
17386
- var Dialog2 = (0, import_react15.forwardRef)(
17557
+ var Dialog2 = (0, import_react16.forwardRef)(
17387
17558
  ({
17388
17559
  children,
17389
17560
  isModal = true,
@@ -17393,9 +17564,9 @@ var Dialog2 = (0, import_react15.forwardRef)(
17393
17564
  onClose,
17394
17565
  ...rest
17395
17566
  }, outerRef) => {
17396
- const innerRef = (0, import_react15.useRef)(null);
17397
- (0, import_react15.useImperativeHandle)(outerRef, () => innerRef.current, []);
17398
- (0, import_react15.useLayoutEffect)(() => {
17567
+ const innerRef = (0, import_react16.useRef)(null);
17568
+ (0, import_react16.useImperativeHandle)(outerRef, () => innerRef.current, []);
17569
+ (0, import_react16.useLayoutEffect)(() => {
17399
17570
  if (!isModal) {
17400
17571
  return;
17401
17572
  }
@@ -17407,7 +17578,7 @@ var Dialog2 = (0, import_react15.forwardRef)(
17407
17578
  document.body.style.overflow = initialOverflowValue;
17408
17579
  };
17409
17580
  }, [isModal]);
17410
- const dialog = (0, import_react15.useMemo)(
17581
+ const dialog = (0, import_react16.useMemo)(
17411
17582
  () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17412
17583
  Dialog,
17413
17584
  {
@@ -17456,9 +17627,9 @@ var DialogClose = ({ onClose, ...rest }) => {
17456
17627
  };
17457
17628
 
17458
17629
  // src/components/ui/dialog/DialogContent.tsx
17459
- var import_react16 = require("react");
17630
+ var import_react17 = require("react");
17460
17631
  var import_jsx_runtime7 = require("react/jsx-runtime");
17461
- var DialogContent2 = (0, import_react16.forwardRef)(({ children }, ref) => {
17632
+ var DialogContent2 = (0, import_react17.forwardRef)(({ children }, ref) => {
17462
17633
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogContent, { ref, children });
17463
17634
  });
17464
17635
  DialogContent2.displayName = "DialogContent";
@@ -17652,7 +17823,7 @@ var Overlay = (0, import_styled_components12.styled)(Flex)(({ theme }) => {
17652
17823
  });
17653
17824
 
17654
17825
  // src/components/ui/progress-bar/ProgressBar.tsx
17655
- var import_react17 = require("react");
17826
+ var import_react18 = require("react");
17656
17827
  var import_jsx_runtime10 = require("react/jsx-runtime");
17657
17828
  var progressColorMap = [
17658
17829
  "blue",
@@ -17662,7 +17833,7 @@ var progressColorMap = [
17662
17833
  "red",
17663
17834
  "red"
17664
17835
  ];
17665
- var ProgressBar = (0, import_react17.forwardRef)(
17836
+ var ProgressBar = (0, import_react18.forwardRef)(
17666
17837
  ({
17667
17838
  progress,
17668
17839
  value,
@@ -17872,7 +18043,7 @@ var Toggle = import_styled_components14.styled.input.attrs({ type: "checkbox" })
17872
18043
 
17873
18044
  // src/components/ui/tooltip/Tooltip.tsx
17874
18045
  var import_debounce3 = __toESM(require_debounce());
17875
- var import_react18 = require("react");
18046
+ var import_react19 = require("react");
17876
18047
  var import_react_dom = require("react-dom");
17877
18048
 
17878
18049
  // src/components/ui/tooltip/styles.ts
@@ -18043,10 +18214,10 @@ var Tooltip = ({
18043
18214
  position = "top",
18044
18215
  ...rest
18045
18216
  }) => {
18046
- const triggerRef = (0, import_react18.useRef)(null);
18047
- const [show, setShow] = (0, import_react18.useState)(false);
18048
- const [coords2, setCoords] = (0, import_react18.useState)({ x: 0, y: 0 });
18049
- const updateCoords = (0, import_react18.useCallback)(() => {
18217
+ const triggerRef = (0, import_react19.useRef)(null);
18218
+ const [show, setShow] = (0, import_react19.useState)(false);
18219
+ const [coords2, setCoords] = (0, import_react19.useState)({ x: 0, y: 0 });
18220
+ const updateCoords = (0, import_react19.useCallback)(() => {
18050
18221
  const coords3 = getCoords({
18051
18222
  element: triggerRef.current,
18052
18223
  portal,
@@ -18054,7 +18225,7 @@ var Tooltip = ({
18054
18225
  });
18055
18226
  setCoords(coords3);
18056
18227
  }, [portal, position]);
18057
- (0, import_react18.useLayoutEffect)(() => {
18228
+ (0, import_react19.useLayoutEffect)(() => {
18058
18229
  updateCoords();
18059
18230
  const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
18060
18231
  window.addEventListener("resize", handleResize);
@@ -18065,7 +18236,7 @@ var Tooltip = ({
18065
18236
  };
18066
18237
  }, [updateCoords]);
18067
18238
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
18068
- (0, import_react18.cloneElement)(trigger, {
18239
+ (0, import_react19.cloneElement)(trigger, {
18069
18240
  ref: triggerRef,
18070
18241
  onFocus: () => setShow(true),
18071
18242
  onBlur: () => setShow(false),
@@ -18122,7 +18293,7 @@ var StyledCard = import_styled_components16.styled.div(({ theme }) => {
18122
18293
 
18123
18294
  // src/components/layout/card/Card.tsx
18124
18295
  var import_jsx_runtime12 = require("react/jsx-runtime");
18125
- var Card = (0, import_react19.forwardRef)(
18296
+ var Card = (0, import_react20.forwardRef)(
18126
18297
  ({ children, className }, ref) => {
18127
18298
  const { settings, isPending } = useEmbed();
18128
18299
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledCard, { ref, className, children: [
@@ -18150,7 +18321,7 @@ var Card = (0, import_react19.forwardRef)(
18150
18321
  Card.displayName = "Card";
18151
18322
 
18152
18323
  // src/components/layout/column/Column.tsx
18153
- var import_react20 = require("react");
18324
+ var import_react21 = require("react");
18154
18325
 
18155
18326
  // src/components/layout/column/styles.ts
18156
18327
  var import_styled_components17 = __toESM(require_styled_components_cjs());
@@ -18160,15 +18331,15 @@ var StyledColumn = import_styled_components17.styled.div`
18160
18331
 
18161
18332
  // src/components/layout/column/Column.tsx
18162
18333
  var import_jsx_runtime13 = require("react/jsx-runtime");
18163
- var Column = (0, import_react20.forwardRef)(
18334
+ var Column = (0, import_react21.forwardRef)(
18164
18335
  ({ children, basis, ...props }, ref) => {
18165
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StyledColumn, { ref, ...props, children: import_react20.Children.count(children) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Card, { children }) : children });
18336
+ 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 });
18166
18337
  }
18167
18338
  );
18168
18339
  Column.displayName = "Column";
18169
18340
 
18170
18341
  // src/components/layout/root/Root.tsx
18171
- var import_react21 = require("react");
18342
+ var import_react22 = require("react");
18172
18343
 
18173
18344
  // src/components/layout/root/styles.ts
18174
18345
  var import_styled_components18 = __toESM(require_styled_components_cjs());
@@ -18208,7 +18379,7 @@ var Container = import_styled_components18.styled.div`
18208
18379
 
18209
18380
  // src/components/layout/root/Root.tsx
18210
18381
  var import_jsx_runtime14 = require("react/jsx-runtime");
18211
- var Root = (0, import_react21.forwardRef)(
18382
+ var Root = (0, import_react22.forwardRef)(
18212
18383
  ({ data, settings, ...props }, ref) => {
18213
18384
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Container, { ref, ...props });
18214
18385
  }
@@ -18217,7 +18388,7 @@ Root.displayName = "Root";
18217
18388
 
18218
18389
  // src/components/layout/viewport/Viewport.tsx
18219
18390
  var import_debounce5 = __toESM(require_debounce());
18220
- var import_react39 = require("react");
18391
+ var import_react40 = require("react");
18221
18392
  var import_react_dom3 = require("react-dom");
18222
18393
 
18223
18394
  // src/components/shared/auto-topup-notice/AutoTopupNotice.tsx
@@ -18240,7 +18411,7 @@ var AutoTopupNotice = ({
18240
18411
  trigger: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
18241
18412
  Icon3,
18242
18413
  {
18243
- title: "auto top-up",
18414
+ title: t2("Auto Top-up"),
18244
18415
  name: "info-rounded",
18245
18416
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
18246
18417
  style: { lineHeight: 0 }
@@ -18279,7 +18450,7 @@ var BillingThresholdTooltip = ({
18279
18450
  trigger: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
18280
18451
  Icon3,
18281
18452
  {
18282
- title: "billing threshold",
18453
+ title: t2("Billing threshold"),
18283
18454
  name: "info-rounded",
18284
18455
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
18285
18456
  style: { lineHeight: 0 }
@@ -18423,7 +18594,7 @@ var ButtonGroup = ({
18423
18594
  };
18424
18595
 
18425
18596
  // src/components/shared/checkout-dialog/Plan/Entitlement.tsx
18426
- var import_react22 = require("react");
18597
+ var import_react23 = require("react");
18427
18598
  var import_jsx_runtime19 = require("react/jsx-runtime");
18428
18599
  var Entitlement = ({
18429
18600
  portal,
@@ -18453,7 +18624,7 @@ var Entitlement = ({
18453
18624
  tiersMode
18454
18625
  } = entitlementBillingPrice || {};
18455
18626
  const tiered = entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementBillingPrice);
18456
- const text = (0, import_react22.useMemo)(() => {
18627
+ const text = (0, import_react23.useMemo)(() => {
18457
18628
  if (!entitlement.feature) {
18458
18629
  return;
18459
18630
  }
@@ -18475,7 +18646,7 @@ var Entitlement = ({
18475
18646
  packageSize,
18476
18647
  " "
18477
18648
  ] }),
18478
- getFeatureName(entitlement.feature, packageSize),
18649
+ getFeatureName(entitlement.feature, locale, packageSize),
18479
18650
  entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18480
18651
  " ",
18481
18652
  t2("per"),
@@ -18500,12 +18671,13 @@ var Entitlement = ({
18500
18671
  " ",
18501
18672
  getFeatureName(
18502
18673
  entitlement.valueCredit,
18674
+ locale,
18503
18675
  entitlement.consumptionRate || void 0
18504
18676
  ),
18505
18677
  " ",
18506
18678
  t2("per"),
18507
18679
  " ",
18508
- getFeatureName(entitlement.feature, 1)
18680
+ getFeatureName(entitlement.feature, locale, 1)
18509
18681
  ] });
18510
18682
  }
18511
18683
  if (entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit) {
@@ -18513,13 +18685,17 @@ var Entitlement = ({
18513
18685
  amount: creditBasedEntitlementLimit.limit,
18514
18686
  units: getFeatureName(
18515
18687
  entitlement.feature,
18688
+ locale,
18516
18689
  creditBasedEntitlementLimit.limit
18517
18690
  ),
18518
- period: creditBasedEntitlementLimit.period
18691
+ period: t2(
18692
+ creditBasedEntitlementLimit.period
18693
+ )
18519
18694
  }) : t2("Up to X units", {
18520
18695
  amount: creditBasedEntitlementLimit.limit,
18521
18696
  units: getFeatureName(
18522
18697
  entitlement.feature,
18698
+ locale,
18523
18699
  creditBasedEntitlementLimit.limit
18524
18700
  )
18525
18701
  }) });
@@ -18527,11 +18703,11 @@ var Entitlement = ({
18527
18703
  if (hasNumericValue) {
18528
18704
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18529
18705
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t2("Unlimited", {
18530
- item: getFeatureName(entitlement.feature)
18706
+ item: getFeatureName(entitlement.feature, locale)
18531
18707
  }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18532
18708
  formatNumber(limit, { locale }),
18533
18709
  " ",
18534
- getFeatureName(entitlement.feature, limit)
18710
+ getFeatureName(entitlement.feature, locale, limit)
18535
18711
  ] }),
18536
18712
  metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18537
18713
  " ",
@@ -18556,7 +18732,7 @@ var Entitlement = ({
18556
18732
  selectedCurrency,
18557
18733
  showWarningThresholdAsLimit
18558
18734
  ]);
18559
- const usageText = (0, import_react22.useMemo)(() => {
18735
+ const usageText = (0, import_react23.useMemo)(() => {
18560
18736
  if (!entitlement.feature) {
18561
18737
  return;
18562
18738
  }
@@ -18570,7 +18746,7 @@ var Entitlement = ({
18570
18746
  packageSize,
18571
18747
  " "
18572
18748
  ] }),
18573
- getFeatureName(entitlement.feature, packageSize),
18749
+ getFeatureName(entitlement.feature, locale, packageSize),
18574
18750
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18575
18751
  "/",
18576
18752
  shortenPeriod(period, t2)
@@ -18639,7 +18815,7 @@ var Entitlement = ({
18639
18815
  };
18640
18816
 
18641
18817
  // src/components/shared/checkout-dialog/Plan/Plan.tsx
18642
- var import_react23 = require("react");
18818
+ var import_react24 = require("react");
18643
18819
  var import_jsx_runtime20 = require("react/jsx-runtime");
18644
18820
  var Plan = ({
18645
18821
  portal,
@@ -18655,7 +18831,7 @@ var Plan = ({
18655
18831
  const { data, settings } = useEmbed();
18656
18832
  const isLightBackground = useIsLightBackground();
18657
18833
  const trialEnd = useTrialEnd();
18658
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react23.useState)({});
18834
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react24.useState)({});
18659
18835
  const handleToggleShowAll = (id) => {
18660
18836
  setEntitlementVisibility((prev) => {
18661
18837
  const updated = !(prev[id] ?? false);
@@ -18902,7 +19078,7 @@ var Plan = ({
18902
19078
  };
18903
19079
 
18904
19080
  // src/components/shared/checkout-dialog/AutoTopup.tsx
18905
- var import_react24 = require("react");
19081
+ var import_react25 = require("react");
18906
19082
  var import_jsx_runtime21 = require("react/jsx-runtime");
18907
19083
  var AutoTopup = ({
18908
19084
  planCreditGrants,
@@ -18910,9 +19086,9 @@ var AutoTopup = ({
18910
19086
  updateAutoTopupConfig
18911
19087
  }) => {
18912
19088
  const { settings } = useEmbed();
18913
- const { t: t2 } = useTranslation();
19089
+ const { t: t2, locale } = useTranslation();
18914
19090
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
18915
- const configurableCreditGrants = (0, import_react24.useMemo)(() => {
19091
+ const configurableCreditGrants = (0, import_react25.useMemo)(() => {
18916
19092
  return planCreditGrants.reduce(
18917
19093
  (acc, grant) => {
18918
19094
  if (isSelfServiceAutoTopupAvailable(grant)) {
@@ -18957,7 +19133,7 @@ var AutoTopup = ({
18957
19133
  }) }) }),
18958
19134
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { as: "p", $marginBottom: "2rem", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { children: t2(
18959
19135
  "Automatically purchase more credits when your balance is low",
18960
- { units: getFeatureName(grant.credit) }
19136
+ { units: getFeatureName(grant.credit, locale) }
18961
19137
  ) }) })
18962
19138
  ] }),
18963
19139
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", $marginBottom: "1rem", children: [
@@ -19038,7 +19214,7 @@ var AutoTopup = ({
19038
19214
  };
19039
19215
 
19040
19216
  // src/components/shared/checkout-dialog/Quantity.tsx
19041
- var import_react25 = require("react");
19217
+ var import_react26 = require("react");
19042
19218
  var import_jsx_runtime22 = require("react/jsx-runtime");
19043
19219
  var Quantity = ({
19044
19220
  portal,
@@ -19053,12 +19229,12 @@ var Quantity = ({
19053
19229
  const isLightBackground = useIsLightBackground();
19054
19230
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
19055
19231
  const unitPriceFontSize = 0.875 * settings.theme.typography.text.fontSize;
19056
- const planCredits = (0, import_react25.useMemo)(
19232
+ const planCredits = (0, import_react26.useMemo)(
19057
19233
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
19058
19234
  [selectedPlan?.includedCreditGrants]
19059
19235
  );
19060
19236
  const prorationBehavior = data?.checkoutSettings?.prorationBehavior;
19061
- const renewalDate = data?.upcomingInvoice?.dueDate ?? void 0;
19237
+ const { billDate: renewalDate } = useNextBillDate();
19062
19238
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce((acc, entitlement) => {
19063
19239
  if (entitlement.feature) {
19064
19240
  const entitlementBillingPrice = getEntitlementPrice(
@@ -19154,7 +19330,7 @@ var Quantity = ({
19154
19330
  $color: settings.theme.typography.text.color,
19155
19331
  children: t2("Currently using", {
19156
19332
  quantity: entitlement.usage,
19157
- unit: getFeatureName(entitlement.feature)
19333
+ unit: getFeatureName(entitlement.feature, locale)
19158
19334
  })
19159
19335
  }
19160
19336
  ),
@@ -19219,7 +19395,11 @@ var Quantity = ({
19219
19395
  packageSize,
19220
19396
  " "
19221
19397
  ] }),
19222
- getFeatureName(entitlement.feature, packageSize),
19398
+ getFeatureName(
19399
+ entitlement.feature,
19400
+ locale,
19401
+ packageSize
19402
+ ),
19223
19403
  "/",
19224
19404
  shortenPeriod(period, t2)
19225
19405
  ] })
@@ -19256,12 +19436,14 @@ var Quantity = ({
19256
19436
  quantity: entitlement.quantity,
19257
19437
  licenseName: getFeatureName(
19258
19438
  entitlement.feature,
19439
+ locale,
19259
19440
  entitlement.quantity
19260
19441
  ),
19261
19442
  perUnit: perLicenseGrant.amount,
19262
19443
  total: includedCredits,
19263
19444
  creditName: getFeatureName(
19264
19445
  licenseCredit,
19446
+ locale,
19265
19447
  includedCredits
19266
19448
  ),
19267
19449
  period: shortenPeriod(licenseCredit.period, t2)
@@ -19283,11 +19465,13 @@ var Quantity = ({
19283
19465
  added: addedQuantity,
19284
19466
  licenseName: getFeatureName(
19285
19467
  entitlement.feature,
19468
+ locale,
19286
19469
  addedQuantity
19287
19470
  ),
19288
19471
  credits: addedCredits,
19289
19472
  creditName: getFeatureName(
19290
19473
  licenseCredit,
19474
+ locale,
19291
19475
  addedCredits
19292
19476
  )
19293
19477
  }),
@@ -19297,9 +19481,10 @@ var Quantity = ({
19297
19481
  total: includedCredits,
19298
19482
  creditName: getFeatureName(
19299
19483
  licenseCredit,
19484
+ locale,
19300
19485
  includedCredits
19301
19486
  ),
19302
- cadence: adjectify(licenseCredit.period),
19487
+ cadence: adjectify(licenseCredit.period, t2),
19303
19488
  day: formatOrdinal(renewalDate.getDate(), t2)
19304
19489
  })
19305
19490
  ] })
@@ -19338,6 +19523,7 @@ function renderMeteredEntitlementPricing({
19338
19523
  "/",
19339
19524
  feature ? getFeatureName(
19340
19525
  feature,
19526
+ locale,
19341
19527
  packageSize
19342
19528
  ) : featureName || "unit"
19343
19529
  ] });
@@ -19355,6 +19541,7 @@ function renderMeteredEntitlementPricing({
19355
19541
  ] }),
19356
19542
  feature ? getFeatureName(
19357
19543
  feature,
19544
+ locale,
19358
19545
  packageSize
19359
19546
  ) : featureName || "unit"
19360
19547
  ] });
@@ -19672,7 +19859,7 @@ var Credits = ({
19672
19859
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { display: "heading6", children: [
19673
19860
  formatNumber(bundle.quantity ?? 0, { locale }),
19674
19861
  " ",
19675
- getFeatureName(bundle)
19862
+ getFeatureName(bundle, locale)
19676
19863
  ] }) })
19677
19864
  ] }),
19678
19865
  typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { children: formatCurrency(price, {
@@ -19727,7 +19914,7 @@ var Credits = ({
19727
19914
  };
19728
19915
 
19729
19916
  // src/components/shared/checkout-dialog/Checkout.tsx
19730
- var import_react27 = require("react");
19917
+ var import_react28 = require("react");
19731
19918
 
19732
19919
  // src/components/shared/payment-form/styles.ts
19733
19920
  var import_styled_components19 = __toESM(require_styled_components_cjs());
@@ -19821,7 +20008,7 @@ var CustomCheckoutFields = ({
19821
20008
  };
19822
20009
 
19823
20010
  // src/components/shared/checkout-dialog/TaxIdField.tsx
19824
- var import_react26 = require("react");
20011
+ var import_react27 = require("react");
19825
20012
  var import_styled_components20 = __toESM(require_styled_components_cjs());
19826
20013
  var import_jsx_runtime26 = require("react/jsx-runtime");
19827
20014
  var Select = (0, import_styled_components20.styled)(Input2).attrs({ as: "select" })`
@@ -19837,7 +20024,7 @@ var TaxIdField = ({
19837
20024
  }) => {
19838
20025
  const { t: t2, locale } = useTranslation();
19839
20026
  const isLightBackground = useIsLightBackground();
19840
- const countryOptions = (0, import_react26.useMemo)(() => taxIdCountryOptions(locale), [locale]);
20027
+ const countryOptions = (0, import_react27.useMemo)(() => taxIdCountryOptions(locale), [locale]);
19841
20028
  const jurisdictions = taxIdJurisdictionsForCountry(value.country);
19842
20029
  const handleCountryChange = (country) => {
19843
20030
  const next = taxIdJurisdictionsForCountry(country);
@@ -19938,7 +20125,7 @@ var Checkout = ({
19938
20125
  }) => {
19939
20126
  const { t: t2 } = useTranslation();
19940
20127
  const isLightBackground = useIsLightBackground();
19941
- const [discount, setDiscount] = (0, import_react27.useState)(promoCode ?? "");
20128
+ const [discount, setDiscount] = (0, import_react28.useState)(promoCode ?? "");
19942
20129
  const hasCustomFields = !!customCheckoutFields && customCheckoutFields.length > 0;
19943
20130
  const showTaxId = collectTaxId && !!taxIdValues && !!onTaxIdChange;
19944
20131
  if (!isPaymentMethodRequired && !hasCustomFields && !showTaxId && !optInRequired) {
@@ -20062,7 +20249,7 @@ var Checkout = ({
20062
20249
 
20063
20250
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
20064
20251
  var import_debounce4 = __toESM(require_debounce());
20065
- var import_react28 = require("react");
20252
+ var import_react29 = require("react");
20066
20253
 
20067
20254
  // src/components/shared/checkout-dialog/Navigation.tsx
20068
20255
  var import_jsx_runtime28 = require("react/jsx-runtime");
@@ -20200,30 +20387,30 @@ var CheckoutDialog = ({ top }) => {
20200
20387
  getTaxId
20201
20388
  } = useEmbed();
20202
20389
  const isLightBackground = useIsLightBackground();
20203
- const dialogRef = (0, import_react28.useRef)(null);
20204
- const contentRef = (0, import_react28.useRef)(null);
20205
- const stageRef = (0, import_react28.useRef)(null);
20206
- const sidebarRef = (0, import_react28.useRef)(null);
20207
- const [dialogElement, setDialogElement] = (0, import_react28.useState)(
20390
+ const dialogRef = (0, import_react29.useRef)(null);
20391
+ const contentRef = (0, import_react29.useRef)(null);
20392
+ const stageRef = (0, import_react29.useRef)(null);
20393
+ const sidebarRef = (0, import_react29.useRef)(null);
20394
+ const [dialogElement, setDialogElement] = (0, import_react29.useState)(
20208
20395
  null
20209
20396
  );
20210
- const setDialog = (0, import_react28.useCallback)((element) => {
20397
+ const setDialog = (0, import_react29.useCallback)((element) => {
20211
20398
  dialogRef.current = element;
20212
20399
  setDialogElement(element);
20213
20400
  }, []);
20214
- const [confirmPaymentIntentProps, setConfirmPaymentIntentProps] = (0, import_react28.useState)(void 0);
20215
- const [charges, setCharges] = (0, import_react28.useState)();
20216
- const [paymentMethodId, setPaymentMethodId] = (0, import_react28.useState)(
20401
+ const [confirmPaymentIntentProps, setConfirmPaymentIntentProps] = (0, import_react29.useState)(void 0);
20402
+ const [charges, setCharges] = (0, import_react29.useState)();
20403
+ const [paymentMethodId, setPaymentMethodId] = (0, import_react29.useState)(
20217
20404
  () => {
20218
20405
  return data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId;
20219
20406
  }
20220
20407
  );
20221
- const [isLoading, setIsLoading] = (0, import_react28.useState)(false);
20222
- const [error, setError] = (0, import_react28.useState)();
20223
- const [isModal, setIsModal] = (0, import_react28.useState)(true);
20408
+ const [isLoading, setIsLoading] = (0, import_react29.useState)(false);
20409
+ const [error, setError] = (0, import_react29.useState)();
20410
+ const [isModal, setIsModal] = (0, import_react29.useState)(true);
20224
20411
  const showPeriodToggle = data?.displaySettings?.showPeriodToggle ?? true;
20225
20412
  const trialPaymentMethodRequired = data?.trialPaymentMethodRequired === true;
20226
- const featureUsage = (0, import_react28.useMemo)(
20413
+ const featureUsage = (0, import_react29.useMemo)(
20227
20414
  () => data?.featureUsage?.features ?? [],
20228
20415
  [data?.featureUsage?.features]
20229
20416
  );
@@ -20244,13 +20431,13 @@ var CheckoutDialog = ({ top }) => {
20244
20431
  }
20245
20432
  return requestedPeriod;
20246
20433
  };
20247
- const [planPeriod, setPlanPeriod] = (0, import_react28.useState)(getValidatedPeriod);
20434
+ const [planPeriod, setPlanPeriod] = (0, import_react29.useState)(getValidatedPeriod);
20248
20435
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
20249
20436
  const lockedCurrency = useSubscriptionCurrency();
20250
20437
  const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
20251
20438
  const filterBlocksSubscriptionCurrency = hasCurrencyFilter && !!lockedCurrency && !currencyFilter.includes(lockedCurrency);
20252
20439
  const prefilledCurrency = checkoutState?.selectedCurrency?.toUpperCase();
20253
- const [selectedCurrency, setSelectedCurrency] = (0, import_react28.useState)(
20440
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react29.useState)(
20254
20441
  () => prefilledCurrency ?? currencies[0] ?? DEFAULT_CURRENCY
20255
20442
  );
20256
20443
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -20261,7 +20448,7 @@ var CheckoutDialog = ({ top }) => {
20261
20448
  const canSelectCurrency = currencies.length > 1 && !lockedCurrency && currencySelectorEnabled;
20262
20449
  const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
20263
20450
  const hasNoUsableCurrency = !lockedCurrency && currencies.length === 0;
20264
- (0, import_react28.useEffect)(() => {
20451
+ (0, import_react29.useEffect)(() => {
20265
20452
  if (filterBlocksSubscriptionCurrency) {
20266
20453
  console.error(
20267
20454
  `[Schematic] currencyFilter excludes the active subscription currency (${lockedCurrency}); keeping subscription currency.`
@@ -20278,8 +20465,8 @@ var CheckoutDialog = ({ top }) => {
20278
20465
  } = useAvailablePlans(planPeriod, {
20279
20466
  useSelectedPeriod: showPeriodToggle
20280
20467
  });
20281
- const [selectedPlanId, setSelectedPlanId] = (0, import_react28.useState)(void 0);
20282
- const selectedPlan = (0, import_react28.useMemo)(() => {
20468
+ const [selectedPlanId, setSelectedPlanId] = (0, import_react29.useState)(void 0);
20469
+ const selectedPlan = (0, import_react29.useMemo)(() => {
20283
20470
  if (selectedPlanId === null) {
20284
20471
  return void 0;
20285
20472
  }
@@ -20294,8 +20481,8 @@ var CheckoutDialog = ({ top }) => {
20294
20481
  (!plan.isTrialable || !plan.companyCanTrial)
20295
20482
  );
20296
20483
  }, [availablePlans, checkoutState, selectedPlanId]);
20297
- const [shouldTrial, setShouldTrial] = (0, import_react28.useState)(false);
20298
- const planCreditGrants = (0, import_react28.useMemo)(() => {
20484
+ const [shouldTrial, setShouldTrial] = (0, import_react29.useState)(false);
20485
+ const planCreditGrants = (0, import_react29.useMemo)(() => {
20299
20486
  const grants = mergeCompanyGrants(
20300
20487
  selectedPlan?.includedCreditGrants,
20301
20488
  data?.company?.plan?.includedCreditGrants
@@ -20305,7 +20492,7 @@ var CheckoutDialog = ({ top }) => {
20305
20492
  selectedPlan?.includedCreditGrants,
20306
20493
  data?.company?.plan?.includedCreditGrants
20307
20494
  ]);
20308
- const [autoTopupConfigs, setAutoTopupConfigs] = (0, import_react28.useState)(() => {
20495
+ const [autoTopupConfigs, setAutoTopupConfigs] = (0, import_react29.useState)(() => {
20309
20496
  const initialConfigs = data?.company?.plan?.includedCreditGrants.reduce(
20310
20497
  (acc, companyGrant) => {
20311
20498
  const {
@@ -20325,7 +20512,7 @@ var CheckoutDialog = ({ top }) => {
20325
20512
  );
20326
20513
  return new Map(initialConfigs);
20327
20514
  });
20328
- const [selectedAddOnIds, setSelectedAddOnIds] = (0, import_react28.useState)(() => {
20515
+ const [selectedAddOnIds, setSelectedAddOnIds] = (0, import_react29.useState)(() => {
20329
20516
  const ids = /* @__PURE__ */ new Set();
20330
20517
  if (checkoutState?.addOnIds) {
20331
20518
  for (const id of checkoutState.addOnIds) ids.add(id);
@@ -20341,11 +20528,11 @@ var CheckoutDialog = ({ top }) => {
20341
20528
  }
20342
20529
  return ids;
20343
20530
  });
20344
- const addOnCompatibilityLookup = (0, import_react28.useMemo)(
20531
+ const addOnCompatibilityLookup = (0, import_react29.useMemo)(
20345
20532
  () => buildAddOnCompatibilityLookup(data?.addOnCompatibilities),
20346
20533
  [data?.addOnCompatibilities]
20347
20534
  );
20348
- const addOns = (0, import_react28.useMemo)(() => {
20535
+ const addOns = (0, import_react29.useMemo)(() => {
20349
20536
  return availableAddOns.filter((availAddOn) => {
20350
20537
  if (hasCurrency && !planSupportsCurrency(availAddOn, effectiveCurrency)) {
20351
20538
  return false;
@@ -20371,20 +20558,20 @@ var CheckoutDialog = ({ top }) => {
20371
20558
  selectedAddOnIds
20372
20559
  ]);
20373
20560
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
20374
- const [bundleCounts, setBundleCounts] = (0, import_react28.useState)({});
20375
- const bundleCountsRef = (0, import_react28.useRef)(bundleCounts);
20561
+ const [bundleCounts, setBundleCounts] = (0, import_react29.useState)({});
20562
+ const bundleCountsRef = (0, import_react29.useRef)(bundleCounts);
20376
20563
  const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
20377
- const creditBundles = (0, import_react28.useMemo)(() => {
20564
+ const creditBundles = (0, import_react29.useMemo)(() => {
20378
20565
  return deriveCreditBundles(
20379
20566
  data?.creditBundles,
20380
20567
  bundleGatingPlanId,
20381
20568
  bundleCounts
20382
20569
  );
20383
20570
  }, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
20384
- const [hasInitialPaymentMethod] = (0, import_react28.useState)(
20571
+ const [hasInitialPaymentMethod] = (0, import_react29.useState)(
20385
20572
  () => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
20386
20573
  );
20387
- const isCreditOnlyPurchase = (0, import_react28.useMemo)(
20574
+ const isCreditOnlyPurchase = (0, import_react29.useMemo)(
20388
20575
  () => isCreditOnlyCheckout({
20389
20576
  plan: selectedPlan,
20390
20577
  creditBundles,
@@ -20401,7 +20588,7 @@ var CheckoutDialog = ({ top }) => {
20401
20588
  effectiveCurrency
20402
20589
  ]
20403
20590
  );
20404
- const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react28.useState)(
20591
+ const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react29.useState)(
20405
20592
  () => applyPrefilledQuantities(
20406
20593
  (selectedPlan?.entitlements || []).reduce(
20407
20594
  createActiveUsageBasedEntitlementsReducer(featureUsage, planPeriod),
@@ -20410,7 +20597,7 @@ var CheckoutDialog = ({ top }) => {
20410
20597
  checkoutState?.payInAdvanceQuantities
20411
20598
  )
20412
20599
  );
20413
- const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = (0, import_react28.useState)(() => {
20600
+ const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = (0, import_react29.useState)(() => {
20414
20601
  const currentAddOnEntitlements = (data?.company?.addOns || []).flatMap(
20415
20602
  (currentAddOn) => {
20416
20603
  const availableAddOn = availableAddOns.find(
@@ -20451,45 +20638,45 @@ var CheckoutDialog = ({ top }) => {
20451
20638
  checkoutState?.payInAdvanceQuantities
20452
20639
  );
20453
20640
  });
20454
- const payInAdvanceEntitlements = (0, import_react28.useMemo)(
20641
+ const payInAdvanceEntitlements = (0, import_react29.useMemo)(
20455
20642
  () => usageBasedEntitlements.filter(
20456
20643
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20457
20644
  ),
20458
20645
  [usageBasedEntitlements]
20459
20646
  );
20460
- const addOnPayInAdvanceEntitlements = (0, import_react28.useMemo)(
20647
+ const addOnPayInAdvanceEntitlements = (0, import_react29.useMemo)(
20461
20648
  () => addOnUsageBasedEntitlements.filter(
20462
20649
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20463
20650
  ),
20464
20651
  [addOnUsageBasedEntitlements]
20465
20652
  );
20466
- const [promoCode, setPromoCode] = (0, import_react28.useState)(
20653
+ const [promoCode, setPromoCode] = (0, import_react29.useState)(
20467
20654
  () => checkoutState?.promoCode ?? null
20468
20655
  );
20469
- const [customFieldValues, setCustomFieldValues] = (0, import_react28.useState)(() => {
20656
+ const [customFieldValues, setCustomFieldValues] = (0, import_react29.useState)(() => {
20470
20657
  const values = {};
20471
20658
  for (const field of data?.customCheckoutFields ?? []) {
20472
20659
  values[field.id] = field.value ?? "";
20473
20660
  }
20474
20661
  return values;
20475
20662
  });
20476
- const hasIncompleteRequiredCustomFields = (0, import_react28.useMemo)(() => {
20663
+ const hasIncompleteRequiredCustomFields = (0, import_react29.useMemo)(() => {
20477
20664
  return (data?.customCheckoutFields ?? []).some(
20478
20665
  (field) => field.required && !customFieldValues[field.id]?.trim()
20479
20666
  );
20480
20667
  }, [data?.customCheckoutFields, customFieldValues]);
20481
- const handleCustomFieldChange = (0, import_react28.useCallback)(
20668
+ const handleCustomFieldChange = (0, import_react29.useCallback)(
20482
20669
  (fieldId, value) => {
20483
20670
  setCustomFieldValues((prev) => ({ ...prev, [fieldId]: value }));
20484
20671
  },
20485
20672
  []
20486
20673
  );
20487
20674
  const collectTaxId = data?.checkoutSettings.collectTaxId ?? false;
20488
- const [taxIdValues, setTaxIdValues] = (0, import_react28.useState)(emptyTaxIdValues);
20489
- const [taxIdError, setTaxIdError] = (0, import_react28.useState)();
20490
- const lastSavedTaxIdRef = (0, import_react28.useRef)(void 0);
20491
- const pendingTaxIdSaveRef = (0, import_react28.useRef)(null);
20492
- (0, import_react28.useEffect)(() => {
20675
+ const [taxIdValues, setTaxIdValues] = (0, import_react29.useState)(emptyTaxIdValues);
20676
+ const [taxIdError, setTaxIdError] = (0, import_react29.useState)();
20677
+ const lastSavedTaxIdRef = (0, import_react29.useRef)(void 0);
20678
+ const pendingTaxIdSaveRef = (0, import_react29.useRef)(null);
20679
+ (0, import_react29.useEffect)(() => {
20493
20680
  if (!collectTaxId) {
20494
20681
  return;
20495
20682
  }
@@ -20516,19 +20703,19 @@ var CheckoutDialog = ({ top }) => {
20516
20703
  cancelled = true;
20517
20704
  };
20518
20705
  }, [collectTaxId, getTaxId]);
20519
- const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react28.useState)(false);
20520
- const [optInRequired, setOptInRequired] = (0, import_react28.useState)(false);
20521
- const [optInTitle, setOptInTitle] = (0, import_react28.useState)(null);
20522
- const [optInText, setOptInText] = (0, import_react28.useState)(null);
20523
- const [optInAccepted, setOptInAccepted] = (0, import_react28.useState)(false);
20524
- const presentedOptInRef = (0, import_react28.useRef)(null);
20525
- const [willScheduleDowngrade, setWillScheduleDowngrade] = (0, import_react28.useState)(false);
20526
- const willTrialWithoutPaymentMethod = (0, import_react28.useMemo)(
20706
+ const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react29.useState)(false);
20707
+ const [optInRequired, setOptInRequired] = (0, import_react29.useState)(false);
20708
+ const [optInTitle, setOptInTitle] = (0, import_react29.useState)(null);
20709
+ const [optInText, setOptInText] = (0, import_react29.useState)(null);
20710
+ const [optInAccepted, setOptInAccepted] = (0, import_react29.useState)(false);
20711
+ const presentedOptInRef = (0, import_react29.useRef)(null);
20712
+ const [willScheduleDowngrade, setWillScheduleDowngrade] = (0, import_react29.useState)(false);
20713
+ const willTrialWithoutPaymentMethod = (0, import_react29.useMemo)(
20527
20714
  () => shouldTrial && !trialPaymentMethodRequired,
20528
20715
  [shouldTrial, trialPaymentMethodRequired]
20529
20716
  );
20530
20717
  const isSelectedPlanTrialable = selectedPlan && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
20531
- const checkoutStages = (0, import_react28.useMemo)(() => {
20718
+ const checkoutStages = (0, import_react29.useMemo)(() => {
20532
20719
  const stages = [];
20533
20720
  const checkoutStage2 = {
20534
20721
  id: "checkout",
@@ -20616,10 +20803,10 @@ var CheckoutDialog = ({ top }) => {
20616
20803
  isCreditOnlyPurchase,
20617
20804
  hasInitialPaymentMethod
20618
20805
  ]);
20619
- const [isBypassLoading, setIsBypassLoading] = (0, import_react28.useState)(
20806
+ const [isBypassLoading, setIsBypassLoading] = (0, import_react29.useState)(
20620
20807
  () => checkoutState?.bypassPlanSelection || checkoutState?.bypassAddOnSelection || checkoutState?.bypassCreditsSelection || checkoutState?.bypassUsageSelection || checkoutState?.bypassAddOnUsageSelection
20621
20808
  );
20622
- const [checkoutStage, setCheckoutStage] = (0, import_react28.useState)(() => {
20809
+ const [checkoutStage, setCheckoutStage] = (0, import_react29.useState)(() => {
20623
20810
  if (checkoutState?.addOnId) {
20624
20811
  return "addons";
20625
20812
  }
@@ -20634,7 +20821,7 @@ var CheckoutDialog = ({ top }) => {
20634
20821
  }
20635
20822
  return "plan";
20636
20823
  });
20637
- const effectiveCheckoutStage = (0, import_react28.useMemo)(() => {
20824
+ const effectiveCheckoutStage = (0, import_react29.useMemo)(() => {
20638
20825
  if (isBypassLoading) return checkoutStage;
20639
20826
  let id = checkoutStage;
20640
20827
  if (id === "credits" && !checkoutStages.some((stage) => stage.id === id)) {
@@ -20648,9 +20835,9 @@ var CheckoutDialog = ({ top }) => {
20648
20835
  }
20649
20836
  return id;
20650
20837
  }, [checkoutStage, checkoutStages, checkoutState, isBypassLoading]);
20651
- const previewRequestIdRef = (0, import_react28.useRef)(0);
20838
+ const previewRequestIdRef = (0, import_react29.useRef)(0);
20652
20839
  const planStageVisible = checkoutStages.some((stage) => stage.id === "plan") && !checkoutState?.bypassPlanSelection;
20653
- const checkoutStageCurrencies = (0, import_react28.useMemo)(() => {
20840
+ const checkoutStageCurrencies = (0, import_react29.useMemo)(() => {
20654
20841
  if (!selectedPlan) return currencies;
20655
20842
  return currencies.filter(
20656
20843
  (currency) => planOffersCurrencyForPeriod(selectedPlan, planPeriod, currency)
@@ -20659,7 +20846,7 @@ var CheckoutDialog = ({ top }) => {
20659
20846
  const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
20660
20847
  const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
20661
20848
  const currencyPeriodMismatch = hasCurrency && !lockedCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
20662
- (0, import_react28.useEffect)(() => {
20849
+ (0, import_react29.useEffect)(() => {
20663
20850
  if (currencyPeriodMismatch) {
20664
20851
  console.error(
20665
20852
  `[Schematic] No ${effectiveCurrency} price for the "${planPeriod}" billing period on the selected plan; refusing to fall back to the default currency.`
@@ -20677,7 +20864,7 @@ var CheckoutDialog = ({ top }) => {
20677
20864
  selectedPlan?.id,
20678
20865
  debug
20679
20866
  ]);
20680
- const handlePreviewCheckout = (0, import_react28.useCallback)(
20867
+ const handlePreviewCheckout = (0, import_react29.useCallback)(
20681
20868
  async (updates) => {
20682
20869
  const period = updates.period || planPeriod;
20683
20870
  const plan = updates.plan || selectedPlan;
@@ -20857,12 +21044,12 @@ var CheckoutDialog = ({ top }) => {
20857
21044
  isBypassLoading
20858
21045
  ]
20859
21046
  );
20860
- const handlePreviewCheckoutRef = (0, import_react28.useRef)(handlePreviewCheckout);
20861
- (0, import_react28.useEffect)(() => {
21047
+ const handlePreviewCheckoutRef = (0, import_react29.useRef)(handlePreviewCheckout);
21048
+ (0, import_react29.useEffect)(() => {
20862
21049
  handlePreviewCheckoutRef.current = handlePreviewCheckout;
20863
21050
  }, [handlePreviewCheckout]);
20864
- const debouncedPreviewCheckoutRef = (0, import_react28.useRef)(null);
20865
- (0, import_react28.useEffect)(() => {
21051
+ const debouncedPreviewCheckoutRef = (0, import_react29.useRef)(null);
21052
+ (0, import_react29.useEffect)(() => {
20866
21053
  const debounced = (0, import_debounce4.default)(
20867
21054
  (updates) => handlePreviewCheckoutRef.current(updates),
20868
21055
  FETCH_DEBOUNCE_TIMEOUT,
@@ -20874,7 +21061,7 @@ var CheckoutDialog = ({ top }) => {
20874
21061
  debouncedPreviewCheckoutRef.current = null;
20875
21062
  };
20876
21063
  }, []);
20877
- const saveTaxId = (0, import_react28.useCallback)(
21064
+ const saveTaxId = (0, import_react29.useCallback)(
20878
21065
  async ({ refreshPreview = false } = {}) => {
20879
21066
  const input = toTaxIdInput(taxIdValues);
20880
21067
  if (!input) {
@@ -20908,13 +21095,13 @@ var CheckoutDialog = ({ top }) => {
20908
21095
  },
20909
21096
  [t2, taxIdValues, updateTaxId]
20910
21097
  );
20911
- const debouncedPreviewCheckout = (0, import_react28.useCallback)(
21098
+ const debouncedPreviewCheckout = (0, import_react29.useCallback)(
20912
21099
  (updates) => {
20913
21100
  debouncedPreviewCheckoutRef.current?.(updates);
20914
21101
  },
20915
21102
  []
20916
21103
  );
20917
- const selectPlan = (0, import_react28.useCallback)(
21104
+ const selectPlan = (0, import_react29.useCallback)(
20918
21105
  (updates) => {
20919
21106
  const plan = updates.plan;
20920
21107
  const period = showPeriodToggle ? updates.period || planPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
@@ -20986,7 +21173,7 @@ var CheckoutDialog = ({ top }) => {
20986
21173
  checkoutState?.payInAdvanceQuantities
20987
21174
  ]
20988
21175
  );
20989
- const changePlanPeriod = (0, import_react28.useCallback)(
21176
+ const changePlanPeriod = (0, import_react29.useCallback)(
20990
21177
  (period) => {
20991
21178
  if (period === planPeriod) {
20992
21179
  return;
@@ -21043,7 +21230,7 @@ var CheckoutDialog = ({ top }) => {
21043
21230
  handlePreviewCheckout
21044
21231
  ]
21045
21232
  );
21046
- const toggleAddOn = (0, import_react28.useCallback)(
21233
+ const toggleAddOn = (0, import_react29.useCallback)(
21047
21234
  (id) => {
21048
21235
  const updated = addOns.map((addOn) => ({
21049
21236
  ...addOn,
@@ -21076,7 +21263,7 @@ var CheckoutDialog = ({ top }) => {
21076
21263
  },
21077
21264
  [handlePreviewCheckout, addOnUsageBasedEntitlements, addOns]
21078
21265
  );
21079
- const updateAutoTopupConfig = (0, import_react28.useCallback)(
21266
+ const updateAutoTopupConfig = (0, import_react29.useCallback)(
21080
21267
  (id, updates) => {
21081
21268
  setAutoTopupConfigs((prev) => {
21082
21269
  const nextMap = new Map(prev);
@@ -21096,7 +21283,7 @@ var CheckoutDialog = ({ top }) => {
21096
21283
  },
21097
21284
  [debouncedPreviewCheckout, planCreditGrants]
21098
21285
  );
21099
- const updateUsageBasedEntitlementQuantity = (0, import_react28.useCallback)(
21286
+ const updateUsageBasedEntitlementQuantity = (0, import_react29.useCallback)(
21100
21287
  (id, updatedQuantity) => {
21101
21288
  setUsageBasedEntitlements((prev) => {
21102
21289
  const updated = prev.map(
@@ -21115,7 +21302,7 @@ var CheckoutDialog = ({ top }) => {
21115
21302
  },
21116
21303
  [debouncedPreviewCheckout]
21117
21304
  );
21118
- const updateCreditBundleCount = (0, import_react28.useCallback)(
21305
+ const updateCreditBundleCount = (0, import_react29.useCallback)(
21119
21306
  (id, updatedCount) => {
21120
21307
  const nextCounts = { ...bundleCountsRef.current, [id]: updatedCount };
21121
21308
  bundleCountsRef.current = nextCounts;
@@ -21130,7 +21317,7 @@ var CheckoutDialog = ({ top }) => {
21130
21317
  },
21131
21318
  [bundleGatingPlanId, data?.creditBundles, debouncedPreviewCheckout]
21132
21319
  );
21133
- const toggleCreditBundle = (0, import_react28.useCallback)(
21320
+ const toggleCreditBundle = (0, import_react29.useCallback)(
21134
21321
  (id) => {
21135
21322
  const nextCounts = { ...bundleCountsRef.current };
21136
21323
  if (nextCounts[id]) {
@@ -21150,7 +21337,7 @@ var CheckoutDialog = ({ top }) => {
21150
21337
  },
21151
21338
  [bundleGatingPlanId, data?.creditBundles, handlePreviewCheckout]
21152
21339
  );
21153
- const updateAddOnEntitlementQuantity = (0, import_react28.useCallback)(
21340
+ const updateAddOnEntitlementQuantity = (0, import_react29.useCallback)(
21154
21341
  (id, updatedQuantity) => {
21155
21342
  setAddOnUsageBasedEntitlements((prev) => {
21156
21343
  const updated = prev.map(
@@ -21170,25 +21357,25 @@ var CheckoutDialog = ({ top }) => {
21170
21357
  },
21171
21358
  [debouncedPreviewCheckout]
21172
21359
  );
21173
- const updatePromoCode = (0, import_react28.useCallback)(
21360
+ const updatePromoCode = (0, import_react29.useCallback)(
21174
21361
  async (code) => {
21175
21362
  handlePreviewCheckout({ promoCode: code });
21176
21363
  },
21177
21364
  [handlePreviewCheckout]
21178
21365
  );
21179
- const handleClose = (0, import_react28.useCallback)(() => {
21366
+ const handleClose = (0, import_react29.useCallback)(() => {
21180
21367
  clearCheckoutState();
21181
21368
  setLayout("portal");
21182
21369
  }, [setLayout, clearCheckoutState]);
21183
- const hasInitializedPlan = (0, import_react28.useRef)(false);
21184
- (0, import_react28.useEffect)(() => {
21370
+ const hasInitializedPlan = (0, import_react29.useRef)(false);
21371
+ (0, import_react29.useEffect)(() => {
21185
21372
  if (!hasInitializedPlan.current && selectedPlan) {
21186
21373
  hasInitializedPlan.current = true;
21187
21374
  const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
21188
21375
  selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
21189
21376
  }
21190
21377
  }, [selectedPlan, planPeriod, selectPlan]);
21191
- (0, import_react28.useLayoutEffect)(() => {
21378
+ (0, import_react29.useLayoutEffect)(() => {
21192
21379
  const element = dialogRef.current;
21193
21380
  if (layout !== "checkout" || !element) {
21194
21381
  return;
@@ -21204,14 +21391,14 @@ var CheckoutDialog = ({ top }) => {
21204
21391
  element.show();
21205
21392
  }
21206
21393
  }, [layout]);
21207
- (0, import_react28.useLayoutEffect)(() => {
21394
+ (0, import_react29.useLayoutEffect)(() => {
21208
21395
  stageRef.current?.scrollTo({
21209
21396
  top: 0,
21210
21397
  left: 0,
21211
21398
  behavior: "smooth"
21212
21399
  });
21213
21400
  }, [effectiveCheckoutStage]);
21214
- (0, import_react28.useLayoutEffect)(() => {
21401
+ (0, import_react29.useLayoutEffect)(() => {
21215
21402
  if (charges) {
21216
21403
  sidebarRef.current?.scrollTo({
21217
21404
  top: 0,
@@ -21223,7 +21410,7 @@ var CheckoutDialog = ({ top }) => {
21223
21410
  const activeCheckoutStage = checkoutStages.find(
21224
21411
  (stage) => stage.id === effectiveCheckoutStage
21225
21412
  );
21226
- const visibleStages = (0, import_react28.useMemo)(() => {
21413
+ const visibleStages = (0, import_react29.useMemo)(() => {
21227
21414
  if (!checkoutState?.hideSkippedStages) {
21228
21415
  return checkoutStages;
21229
21416
  }
@@ -21246,7 +21433,7 @@ var CheckoutDialog = ({ top }) => {
21246
21433
  return true;
21247
21434
  });
21248
21435
  }, [checkoutStages, checkoutState]);
21249
- const navigableStages = (0, import_react28.useMemo)(() => {
21436
+ const navigableStages = (0, import_react29.useMemo)(() => {
21250
21437
  return checkoutStages.filter((stage) => {
21251
21438
  if (stage.id === "plan" && checkoutState?.bypassPlanSelection) {
21252
21439
  return false;
@@ -21626,7 +21813,7 @@ var CurrencyPeriodMismatchNotice = ({
21626
21813
  style: { opacity: 0.85, textAlign: "center" },
21627
21814
  children: t2("No {{currency}} price for the {{period}} billing period.", {
21628
21815
  currency: currency.toUpperCase(),
21629
- period
21816
+ period: adjectify(period, t2)
21630
21817
  })
21631
21818
  }
21632
21819
  )
@@ -21788,7 +21975,7 @@ var HardLimitTooltip = ({
21788
21975
  feature,
21789
21976
  limit
21790
21977
  }) => {
21791
- const { t: t2 } = useTranslation();
21978
+ const { t: t2, locale } = useTranslation();
21792
21979
  const { data } = useEmbed();
21793
21980
  const isLightBackground = useIsLightBackground();
21794
21981
  const showHardLimit = data?.displaySettings?.showHardLimit ?? false;
@@ -21802,7 +21989,7 @@ var HardLimitTooltip = ({
21802
21989
  trigger: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
21803
21990
  Icon3,
21804
21991
  {
21805
- title: "limit",
21992
+ title: t2("Limit"),
21806
21993
  name: "info-rounded",
21807
21994
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
21808
21995
  style: { lineHeight: 0 }
@@ -21810,7 +21997,7 @@ var HardLimitTooltip = ({
21810
21997
  ),
21811
21998
  content: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { children: t2("Up to a limit of", {
21812
21999
  amount: limit,
21813
- units: getFeatureName(feature, limit)
22000
+ units: getFeatureName(feature, locale, limit)
21814
22001
  }) })
21815
22002
  }
21816
22003
  );
@@ -21856,44 +22043,44 @@ var InvalidCurrencyNotice = ({
21856
22043
  };
21857
22044
 
21858
22045
  // src/components/shared/payment-dialog/PaymentDialog.tsx
21859
- var import_react30 = require("react");
22046
+ var import_react31 = require("react");
21860
22047
 
21861
22048
  // src/components/shared/checkout-dialog/EditableCustomCheckoutFields.tsx
21862
- var import_react29 = require("react");
22049
+ var import_react30 = require("react");
21863
22050
  var import_jsx_runtime35 = require("react/jsx-runtime");
21864
22051
  var EditableCustomCheckoutFields = () => {
21865
22052
  const { t: t2 } = useTranslation();
21866
22053
  const isLightBackground = useIsLightBackground();
21867
22054
  const { data, updateCustomFieldValues } = useEmbed();
21868
- const customCheckoutFields = (0, import_react29.useMemo)(
22055
+ const customCheckoutFields = (0, import_react30.useMemo)(
21869
22056
  () => data?.customCheckoutFields ?? [],
21870
22057
  [data?.customCheckoutFields]
21871
22058
  );
21872
- const serverFieldValues = (0, import_react29.useMemo)(() => {
22059
+ const serverFieldValues = (0, import_react30.useMemo)(() => {
21873
22060
  const values2 = {};
21874
22061
  for (const field of customCheckoutFields) {
21875
22062
  values2[field.id] = field.value ?? "";
21876
22063
  }
21877
22064
  return values2;
21878
22065
  }, [customCheckoutFields]);
21879
- const [editing, setEditing] = (0, import_react29.useState)(false);
21880
- const [values, setValues] = (0, import_react29.useState)(serverFieldValues);
21881
- const [isSaving, setIsSaving] = (0, import_react29.useState)(false);
21882
- const [error, setError] = (0, import_react29.useState)();
21883
- const handleChange = (0, import_react29.useCallback)((fieldId, value) => {
22066
+ const [editing, setEditing] = (0, import_react30.useState)(false);
22067
+ const [values, setValues] = (0, import_react30.useState)(serverFieldValues);
22068
+ const [isSaving, setIsSaving] = (0, import_react30.useState)(false);
22069
+ const [error, setError] = (0, import_react30.useState)();
22070
+ const handleChange = (0, import_react30.useCallback)((fieldId, value) => {
21884
22071
  setValues((prev) => ({ ...prev, [fieldId]: value }));
21885
22072
  }, []);
21886
- const handleEdit = (0, import_react29.useCallback)(() => {
22073
+ const handleEdit = (0, import_react30.useCallback)(() => {
21887
22074
  setError(void 0);
21888
22075
  setValues(serverFieldValues);
21889
22076
  setEditing(true);
21890
22077
  }, [serverFieldValues]);
21891
- const handleCancel = (0, import_react29.useCallback)(() => {
22078
+ const handleCancel = (0, import_react30.useCallback)(() => {
21892
22079
  setError(void 0);
21893
22080
  setEditing(false);
21894
22081
  setValues(serverFieldValues);
21895
22082
  }, [serverFieldValues]);
21896
- const handleSave = (0, import_react29.useCallback)(async () => {
22083
+ const handleSave = (0, import_react30.useCallback)(async () => {
21897
22084
  setError(void 0);
21898
22085
  setIsSaving(true);
21899
22086
  try {
@@ -21981,13 +22168,13 @@ var import_jsx_runtime36 = require("react/jsx-runtime");
21981
22168
  var PaymentDialog = ({ top }) => {
21982
22169
  const { t: t2 } = useTranslation();
21983
22170
  const { layout, setLayout, clearCheckoutState } = useEmbed();
21984
- const dialogRef = (0, import_react30.useRef)(null);
21985
- const [isModal, setIsModal] = (0, import_react30.useState)(true);
21986
- const handleClose = (0, import_react30.useCallback)(() => {
22171
+ const dialogRef = (0, import_react31.useRef)(null);
22172
+ const [isModal, setIsModal] = (0, import_react31.useState)(true);
22173
+ const handleClose = (0, import_react31.useCallback)(() => {
21987
22174
  clearCheckoutState();
21988
22175
  setLayout("portal");
21989
22176
  }, [setLayout, clearCheckoutState]);
21990
- (0, import_react30.useLayoutEffect)(() => {
22177
+ (0, import_react31.useLayoutEffect)(() => {
21991
22178
  const element = dialogRef.current;
21992
22179
  if (layout !== "payment" || !element) {
21993
22180
  return;
@@ -22034,7 +22221,7 @@ var PaymentDialog = ({ top }) => {
22034
22221
 
22035
22222
  // src/components/shared/payment-form/PaymentForm.tsx
22036
22223
  var import_react_stripe_js = require("@stripe/react-stripe-js");
22037
- var import_react31 = require("react");
22224
+ var import_react32 = require("react");
22038
22225
  var import_jsx_runtime37 = require("react/jsx-runtime");
22039
22226
  var PaymentForm = ({ onConfirm, financeData }) => {
22040
22227
  const { t: t2 } = useTranslation();
@@ -22049,32 +22236,32 @@ var PaymentForm = ({ onConfirm, financeData }) => {
22049
22236
  financeData
22050
22237
  );
22051
22238
  const showBillingAddress = shouldCollectAddress || collectPhone;
22052
- const loadTimerRef = (0, import_react31.useRef)(
22239
+ const loadTimerRef = (0, import_react32.useRef)(
22053
22240
  void 0
22054
22241
  );
22055
- const [email, setEmail] = (0, import_react31.useState)(() => billing?.email ?? "");
22056
- const userEditedEmailRef = (0, import_react31.useRef)(false);
22057
- const [message, setMessage] = (0, import_react31.useState)();
22058
- const [isLoading, setIsLoading] = (0, import_react31.useState)(false);
22059
- const [isConfirmed, setIsConfirmed] = (0, import_react31.useState)(false);
22060
- const [isPaymentComplete, setIsPaymentComplete] = (0, import_react31.useState)(false);
22061
- const [isPaymentReady, setIsPaymentReady] = (0, import_react31.useState)(false);
22062
- const [loadError, setLoadError] = (0, import_react31.useState)();
22063
- const [isEmailValid, setIsEmailValid] = (0, import_react31.useState)(() => !collectEmail);
22064
- const emailInputRef = (0, import_react31.useRef)(null);
22065
- const [isAddressComplete, setIsAddressComplete] = (0, import_react31.useState)(
22242
+ const [email, setEmail] = (0, import_react32.useState)(() => billing?.email ?? "");
22243
+ const userEditedEmailRef = (0, import_react32.useRef)(false);
22244
+ const [message, setMessage] = (0, import_react32.useState)();
22245
+ const [isLoading, setIsLoading] = (0, import_react32.useState)(false);
22246
+ const [isConfirmed, setIsConfirmed] = (0, import_react32.useState)(false);
22247
+ const [isPaymentComplete, setIsPaymentComplete] = (0, import_react32.useState)(false);
22248
+ const [isPaymentReady, setIsPaymentReady] = (0, import_react32.useState)(false);
22249
+ const [loadError, setLoadError] = (0, import_react32.useState)();
22250
+ const [isEmailValid, setIsEmailValid] = (0, import_react32.useState)(() => !collectEmail);
22251
+ const emailInputRef = (0, import_react32.useRef)(null);
22252
+ const [isAddressComplete, setIsAddressComplete] = (0, import_react32.useState)(
22066
22253
  () => !shouldCollectAddress
22067
22254
  );
22068
- const addressDefaultsKey = (0, import_react31.useMemo)(
22255
+ const addressDefaultsKey = (0, import_react32.useMemo)(
22069
22256
  () => JSON.stringify(billing ?? {}),
22070
22257
  [billing]
22071
22258
  );
22072
- (0, import_react31.useEffect)(() => {
22259
+ (0, import_react32.useEffect)(() => {
22073
22260
  if (!userEditedEmailRef.current && billing?.email) {
22074
22261
  setEmail(billing.email);
22075
22262
  }
22076
22263
  }, [billing?.email]);
22077
- (0, import_react31.useEffect)(() => {
22264
+ (0, import_react32.useEffect)(() => {
22078
22265
  setIsEmailValid(
22079
22266
  !collectEmail || (emailInputRef.current?.checkValidity() ?? false)
22080
22267
  );
@@ -22119,7 +22306,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
22119
22306
  setIsLoading(false);
22120
22307
  }
22121
22308
  };
22122
- (0, import_react31.useEffect)(() => {
22309
+ (0, import_react32.useEffect)(() => {
22123
22310
  loadTimerRef.current = setTimeout(() => {
22124
22311
  if (!isPaymentReady) {
22125
22312
  setLoadError(t2("Unable to load payment form."));
@@ -22174,7 +22361,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
22174
22361
  )
22175
22362
  ] }),
22176
22363
  stripe && collectEmail && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box, { "data-field": "name", $marginBottom: "1.5rem", $verticalAlign: "top", children: [
22177
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Label, { htmlFor: "email", children: "Email" }),
22364
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Label, { htmlFor: "email", children: t2("Email") }),
22178
22365
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
22179
22366
  Input2,
22180
22367
  {
@@ -22183,7 +22370,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
22183
22370
  type: "email",
22184
22371
  value: email,
22185
22372
  autoComplete: "email",
22186
- placeholder: "Enter email address",
22373
+ placeholder: t2("Enter email address"),
22187
22374
  required: true,
22188
22375
  onChange: (e) => {
22189
22376
  userEditedEmailRef.current = true;
@@ -22230,7 +22417,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
22230
22417
  };
22231
22418
 
22232
22419
  // src/components/shared/period-toggle/PeriodToggle.tsx
22233
- var import_react32 = require("react");
22420
+ var import_react33 = require("react");
22234
22421
  var import_jsx_runtime38 = require("react/jsx-runtime");
22235
22422
  var PERIOD_MONTH_COUNT = {
22236
22423
  year: 12,
@@ -22246,7 +22433,7 @@ var PeriodToggle = ({
22246
22433
  const { t: t2 } = useTranslation();
22247
22434
  const { settings } = useEmbed();
22248
22435
  const isLightBackground = useIsLightBackground();
22249
- const savingsByPeriod = (0, import_react32.useMemo)(() => {
22436
+ const savingsByPeriod = (0, import_react33.useMemo)(() => {
22250
22437
  const result = {};
22251
22438
  if (!selectedPlan) {
22252
22439
  return result;
@@ -22310,7 +22497,7 @@ var PeriodToggle = ({
22310
22497
  },
22311
22498
  $size: 15,
22312
22499
  $weight: option === selectedOption ? 600 : 400,
22313
- children: t2("Billed", { period: adjectify(option) })
22500
+ children: t2("Billed", { period: adjectify(option, t2) })
22314
22501
  }
22315
22502
  )
22316
22503
  },
@@ -22350,7 +22537,7 @@ var PlanCreditText = ({
22350
22537
  entitlements,
22351
22538
  children
22352
22539
  }) => {
22353
- const { t: t2 } = useTranslation();
22540
+ const { t: t2, locale } = useTranslation();
22354
22541
  const { settings } = useEmbed();
22355
22542
  const sources = entitlements ?? [];
22356
22543
  const { perLicenseGrants } = credit;
@@ -22358,7 +22545,7 @@ var PlanCreditText = ({
22358
22545
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { children: [
22359
22546
  credit.quantity,
22360
22547
  " ",
22361
- getFeatureName(credit, credit.quantity),
22548
+ getFeatureName(credit, locale, credit.quantity),
22362
22549
  credit.period && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
22363
22550
  " ",
22364
22551
  t2("per"),
@@ -22370,18 +22557,18 @@ var PlanCreditText = ({
22370
22557
  }
22371
22558
  const resolveLicenseName = (grant) => {
22372
22559
  const licenseFeature = (findLicenseSource(sources, grant.licenseId) ?? (grant.licenseId ? void 0 : findSoleLicenseSource(sources)))?.feature;
22373
- return licenseFeature ? getFeatureName(licenseFeature, 1) : t2("license");
22560
+ return licenseFeature ? getFeatureName(licenseFeature, locale, 1) : t2("license");
22374
22561
  };
22375
22562
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
22376
22563
  perLicenseGrants.map((grant, grantIndex) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { children: [
22377
22564
  credit.period ? t2("X credits per license per period", {
22378
22565
  amount: grant.amount,
22379
- creditName: getFeatureName(credit, grant.amount),
22566
+ creditName: getFeatureName(credit, locale, grant.amount),
22380
22567
  licenseName: resolveLicenseName(grant),
22381
22568
  period: t2(credit.period)
22382
22569
  }) : t2("X credits per license", {
22383
22570
  amount: grant.amount,
22384
- creditName: getFeatureName(credit, grant.amount),
22571
+ creditName: getFeatureName(credit, locale, grant.amount),
22385
22572
  licenseName: resolveLicenseName(grant)
22386
22573
  }),
22387
22574
  grantIndex === 0 && children
@@ -22394,7 +22581,7 @@ var PlanCreditText = ({
22394
22581
  $color: settings.theme.typography.text.color,
22395
22582
  children: t2("Plus X credits per period for your company", {
22396
22583
  amount: credit.fixedQuantity,
22397
- creditName: getFeatureName(credit, credit.fixedQuantity),
22584
+ creditName: getFeatureName(credit, locale, credit.fixedQuantity),
22398
22585
  period: t2(credit.period)
22399
22586
  })
22400
22587
  }
@@ -22403,10 +22590,10 @@ var PlanCreditText = ({
22403
22590
  };
22404
22591
 
22405
22592
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
22406
- var import_react34 = require("react");
22593
+ var import_react35 = require("react");
22407
22594
 
22408
22595
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
22409
- var import_react33 = require("react");
22596
+ var import_react34 = require("react");
22410
22597
  var import_jsx_runtime40 = require("react/jsx-runtime");
22411
22598
  var PriceText = ({
22412
22599
  feature,
@@ -22417,13 +22604,13 @@ var PriceText = ({
22417
22604
  }) => {
22418
22605
  const { settings } = useEmbed();
22419
22606
  const { t: t2, locale } = useTranslation();
22420
- const text = (0, import_react33.useMemo)(() => {
22607
+ const text = (0, import_react34.useMemo)(() => {
22421
22608
  if (!flatAmount && perUnitPrice) {
22422
22609
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
22423
22610
  formatCurrency(perUnitPrice, { locale, currency }),
22424
22611
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("sub", { children: [
22425
22612
  "/",
22426
- getFeatureName(feature, 1)
22613
+ getFeatureName(feature, locale, 1)
22427
22614
  ] })
22428
22615
  ] });
22429
22616
  }
@@ -22440,7 +22627,7 @@ var PriceText = ({
22440
22627
  formatCurrency(perUnitPrice, { locale, currency }),
22441
22628
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("sub", { children: [
22442
22629
  "/",
22443
- getFeatureName(feature, 1)
22630
+ getFeatureName(feature, locale, 1)
22444
22631
  ] }),
22445
22632
  " + ",
22446
22633
  formatCurrency(flatAmount, { locale, currency }),
@@ -22474,7 +22661,7 @@ var PricingTiersTooltip = ({
22474
22661
  const { t: t2 } = useTranslation();
22475
22662
  const { settings } = useEmbed();
22476
22663
  const isLightBackground = useIsLightBackground();
22477
- const { tiers } = (0, import_react34.useMemo)(() => {
22664
+ const { tiers } = (0, import_react35.useMemo)(() => {
22478
22665
  return priceTiers.reduce(
22479
22666
  (acc, tier) => {
22480
22667
  const end = tier.upTo ?? Infinity;
@@ -22501,7 +22688,7 @@ var PricingTiersTooltip = ({
22501
22688
  trigger: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
22502
22689
  Icon3,
22503
22690
  {
22504
- title: "tiered pricing",
22691
+ title: t2("Tiered pricing"),
22505
22692
  name: "info-rounded",
22506
22693
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
22507
22694
  style: { lineHeight: 0 }
@@ -22568,7 +22755,7 @@ var PricingTiersTooltip = ({
22568
22755
  };
22569
22756
 
22570
22757
  // src/components/shared/subscription-sidebar/SubscriptionSidebar.tsx
22571
- var import_react36 = require("react");
22758
+ var import_react37 = require("react");
22572
22759
  var import_react_dom2 = require("react-dom");
22573
22760
 
22574
22761
  // src/components/shared/subscription-sidebar/CheckoutStageButton.tsx
@@ -23003,11 +23190,11 @@ var EntitlementRow = (props) => {
23003
23190
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
23004
23191
  quantity,
23005
23192
  " ",
23006
- getFeatureName(feature, quantity)
23193
+ getFeatureName(feature, locale, quantity)
23007
23194
  ] }) : priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
23008
23195
  softLimit,
23009
23196
  " ",
23010
- getFeatureName(feature, softLimit)
23197
+ getFeatureName(feature, locale, softLimit)
23011
23198
  ] }) : feature.name }) }),
23012
23199
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
23013
23200
  // A tiered scheme still resolves to a fixed amount at the chosen
@@ -23038,7 +23225,7 @@ var EntitlementRow = (props) => {
23038
23225
  packageSize,
23039
23226
  " "
23040
23227
  ] }),
23041
- getFeatureName(feature, packageSize),
23228
+ getFeatureName(feature, locale, packageSize),
23042
23229
  feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
23043
23230
  "/",
23044
23231
  shortenPeriod(planPeriod, t2)
@@ -23050,12 +23237,12 @@ var EntitlementRow = (props) => {
23050
23237
  };
23051
23238
 
23052
23239
  // src/components/shared/subscription-sidebar/Proration.tsx
23053
- var import_react35 = require("react");
23240
+ var import_react36 = require("react");
23054
23241
  var import_jsx_runtime44 = require("react/jsx-runtime");
23055
23242
  var Proration = ({ currency, charges }) => {
23056
23243
  const { t: t2, locale } = useTranslation();
23057
23244
  const { settings } = useEmbed();
23058
- const [open, setOpen] = (0, import_react35.useState)(false);
23245
+ const [open, setOpen] = (0, import_react36.useState)(false);
23059
23246
  const toggle = (e) => {
23060
23247
  e.preventDefault();
23061
23248
  e.stopPropagation();
@@ -23106,7 +23293,7 @@ var Proration = ({ currency, charges }) => {
23106
23293
 
23107
23294
  // src/components/shared/subscription-sidebar/SubscriptionSidebar.tsx
23108
23295
  var import_jsx_runtime45 = require("react/jsx-runtime");
23109
- var SubscriptionSidebar = (0, import_react36.forwardRef)(
23296
+ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23110
23297
  ({
23111
23298
  portal,
23112
23299
  planPeriod,
@@ -23157,8 +23344,8 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23157
23344
  } = useEmbed();
23158
23345
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
23159
23346
  const isLightBackground = useIsLightBackground();
23160
- const buttonRef = (0, import_react36.useRef)(null);
23161
- const [isButtonInView, setIsButtonInView] = (0, import_react36.useState)(false);
23347
+ const buttonRef = (0, import_react37.useRef)(null);
23348
+ const [isButtonInView, setIsButtonInView] = (0, import_react37.useState)(false);
23162
23349
  const {
23163
23350
  currentPlan,
23164
23351
  currentAddOns,
@@ -23167,7 +23354,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23167
23354
  billingSubscription,
23168
23355
  paymentMethod,
23169
23356
  trialPaymentMethodRequired
23170
- } = (0, import_react36.useMemo)(() => {
23357
+ } = (0, import_react37.useMemo)(() => {
23171
23358
  const currentEntitlements2 = data?.featureUsage?.features || [];
23172
23359
  return {
23173
23360
  currentPlan: data?.company?.plan,
@@ -23190,7 +23377,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23190
23377
  data?.subscription?.paymentMethod,
23191
23378
  data?.trialPaymentMethodRequired
23192
23379
  ]);
23193
- const planCreditGrants = (0, import_react36.useMemo)(() => {
23380
+ const planCreditGrants = (0, import_react37.useMemo)(() => {
23194
23381
  const grants = mergeCompanyGrants(
23195
23382
  selectedPlan?.includedCreditGrants,
23196
23383
  data?.company?.plan?.includedCreditGrants
@@ -23200,11 +23387,11 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23200
23387
  selectedPlan?.includedCreditGrants,
23201
23388
  data?.company?.plan?.includedCreditGrants
23202
23389
  ]);
23203
- const planCredits = (0, import_react36.useMemo)(
23390
+ const planCredits = (0, import_react37.useMemo)(
23204
23391
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
23205
23392
  [selectedPlan?.includedCreditGrants]
23206
23393
  );
23207
- const { payInAdvanceEntitlements } = (0, import_react36.useMemo)(() => {
23394
+ const { payInAdvanceEntitlements } = (0, import_react37.useMemo)(() => {
23208
23395
  const payAsYouGoEntitlements = [];
23209
23396
  const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
23210
23397
  (entitlement) => {
@@ -23216,7 +23403,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23216
23403
  );
23217
23404
  return { payAsYouGoEntitlements, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
23218
23405
  }, [usageBasedEntitlements]);
23219
- const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = (0, import_react36.useMemo)(() => {
23406
+ const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = (0, import_react37.useMemo)(() => {
23220
23407
  let planPrice;
23221
23408
  let resolvedCurrency;
23222
23409
  if (selectedPlan) {
@@ -23287,7 +23474,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23287
23474
  proration,
23288
23475
  taxAmount,
23289
23476
  taxDescription
23290
- } = (0, import_react36.useMemo)(() => {
23477
+ } = (0, import_react37.useMemo)(() => {
23291
23478
  return {
23292
23479
  amountOff: charges?.amountOff ?? 0,
23293
23480
  discountAmount: charges?.discountAmount ?? 0,
@@ -23335,7 +23522,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23335
23522
  $color: settings.theme.typography.text.color,
23336
23523
  children: t2("Includes X credits per period", {
23337
23524
  total: includedCredits,
23338
- creditName: getFeatureName(credit, includedCredits),
23525
+ creditName: getFeatureName(credit, locale, includedCredits),
23339
23526
  period: shortenPeriod(credit.period, t2)
23340
23527
  })
23341
23528
  }
@@ -23357,7 +23544,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23357
23544
  }
23358
23545
  );
23359
23546
  };
23360
- const updatedUsageBasedEntitlements = (0, import_react36.useMemo)(() => {
23547
+ const updatedUsageBasedEntitlements = (0, import_react37.useMemo)(() => {
23361
23548
  const changedUsageBasedEntitlements = [];
23362
23549
  const allSelectedUsageBasedEntitlements = [
23363
23550
  ...usageBasedEntitlements,
@@ -23420,19 +23607,19 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23420
23607
  usageBasedEntitlements,
23421
23608
  addOnUsageBasedEntitlements
23422
23609
  ]);
23423
- const selectedAddOnsWithPrice = (0, import_react36.useMemo)(
23610
+ const selectedAddOnsWithPrice = (0, import_react37.useMemo)(
23424
23611
  () => addOns.filter(
23425
23612
  (addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
23426
23613
  ),
23427
23614
  [addOns, currency]
23428
23615
  );
23429
- const selectedOneTimeAddOns = (0, import_react36.useMemo)(
23616
+ const selectedOneTimeAddOns = (0, import_react37.useMemo)(
23430
23617
  () => addOns.filter(
23431
23618
  (addOn) => addOn.isSelected && addOn.chargeType === ChargeType.oneTime && getAddOnPrice(addOn, planPeriod, currency)?.price
23432
23619
  ),
23433
23620
  [addOns, planPeriod, currency]
23434
23621
  );
23435
- const { removedAddOns, willAddOnsChange } = (0, import_react36.useMemo)(() => {
23622
+ const { removedAddOns, willAddOnsChange } = (0, import_react37.useMemo)(() => {
23436
23623
  const addedAddOns = selectedAddOnsWithPrice.filter(
23437
23624
  (selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
23438
23625
  );
@@ -23448,15 +23635,15 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23448
23635
  willAddOnsChange: willAddOnsChange2
23449
23636
  };
23450
23637
  }, [currentAddOns, selectedAddOnsWithPrice, currency]);
23451
- const addedCreditBundles = (0, import_react36.useMemo)(
23638
+ const addedCreditBundles = (0, import_react37.useMemo)(
23452
23639
  () => creditBundles.filter((bundle) => bundle.count > 0),
23453
23640
  [creditBundles]
23454
23641
  );
23455
- const discountApplied = (0, import_react36.useMemo)(
23642
+ const discountApplied = (0, import_react37.useMemo)(
23456
23643
  () => promoCode && (amountOff > 0 || percentOff > 0),
23457
23644
  [promoCode, amountOff, percentOff]
23458
23645
  );
23459
- const subscriptionDiscount = (0, import_react36.useMemo)(
23646
+ const subscriptionDiscount = (0, import_react37.useMemo)(
23460
23647
  () => getSubscriptionDiscount(
23461
23648
  charges?.discounts,
23462
23649
  subscriptionTotal,
@@ -23465,7 +23652,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23465
23652
  ),
23466
23653
  [charges?.discounts, subscriptionTotal, subscriptionCurrency, locale]
23467
23654
  );
23468
- const handleCheckout = (0, import_react36.useCallback)(async () => {
23655
+ const handleCheckout = (0, import_react37.useCallback)(async () => {
23469
23656
  const planId = selectedPlan?.id;
23470
23657
  const currencyPrice = selectedPlan ? getPlanPrice(
23471
23658
  selectedPlan,
@@ -23602,7 +23789,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23602
23789
  customFieldValues,
23603
23790
  ensureTaxIdSaved
23604
23791
  ]);
23605
- const handleUnsubscribe = (0, import_react36.useCallback)(async () => {
23792
+ const handleUnsubscribe = (0, import_react37.useCallback)(async () => {
23606
23793
  try {
23607
23794
  setError(void 0);
23608
23795
  setIsLoading(true);
@@ -23616,7 +23803,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23616
23803
  }
23617
23804
  }, [t2, unsubscribe, setError, setIsLoading, setLayout]);
23618
23805
  const isSelectedPlanTrialable = selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
23619
- const button = (0, import_react36.useMemo)(() => {
23806
+ const button = (0, import_react37.useMemo)(() => {
23620
23807
  const hasEntitlementDowngrade = payInAdvanceEntitlements.some((e) => e.quantity < e.usage) || addOnPayInAdvanceEntitlements.some((e) => e.quantity < e.usage);
23621
23808
  const canCheckout = error !== t2("Downgrade not permitted.") && !hasEntitlementDowngrade;
23622
23809
  const isSticky = !isButtonInView;
@@ -23690,7 +23877,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
23690
23877
  isCreditOnlyPurchase,
23691
23878
  hasIncompleteRequiredCustomFields
23692
23879
  ]);
23693
- (0, import_react36.useLayoutEffect)(() => {
23880
+ (0, import_react37.useLayoutEffect)(() => {
23694
23881
  const element = buttonRef.current;
23695
23882
  if (!element) {
23696
23883
  return;
@@ -24073,7 +24260,7 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
24073
24260
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { children: [
24074
24261
  formatNumber(amount, { locale }),
24075
24262
  " ",
24076
- getFeatureName(bundle, amount),
24263
+ getFeatureName(bundle, locale, amount),
24077
24264
  expiry && ` \xB7 ${expiry}`
24078
24265
  ] }) })
24079
24266
  ] }),
@@ -24344,14 +24531,14 @@ var SubscriptionSidebar = (0, import_react36.forwardRef)(
24344
24531
  SubscriptionSidebar.displayName = "SubscriptionSidebar";
24345
24532
 
24346
24533
  // src/components/shared/tiered-pricing-details/TieredPricingDetails.tsx
24347
- var import_react37 = require("react");
24534
+ var import_react38 = require("react");
24348
24535
  var TieredPricingDetails = ({
24349
24536
  entitlement,
24350
24537
  period,
24351
24538
  currency: selectedCurrency
24352
24539
  }) => {
24353
24540
  const { t: t2, locale } = useTranslation();
24354
- const { currency, flatAmount, perUnitPrice, upTo } = (0, import_react37.useMemo)(() => {
24541
+ const { currency, flatAmount, perUnitPrice, upTo } = (0, import_react38.useMemo)(() => {
24355
24542
  const { currency: currency2, priceTier } = getEntitlementPrice(entitlement, period, selectedCurrency) || {};
24356
24543
  const { flatAmount: flatAmount2, perUnitPrice: perUnitPrice2, perUnitPriceDecimal, upTo: upTo2 } = priceTier?.[0] || {};
24357
24544
  return {
@@ -24367,21 +24554,21 @@ var TieredPricingDetails = ({
24367
24554
  if (flatAmount === 0 && perUnitPrice === 0) {
24368
24555
  return t2("Up to X units for free", {
24369
24556
  X: upTo,
24370
- units: getFeatureName(entitlement.feature, upTo)
24557
+ units: getFeatureName(entitlement.feature, locale, upTo)
24371
24558
  });
24372
24559
  }
24373
24560
  if (flatAmount === 0 && perUnitPrice > 0) {
24374
24561
  return t2("Up to X units at $Y/unit", {
24375
24562
  X: upTo,
24376
- units: getFeatureName(entitlement.feature, upTo),
24563
+ units: getFeatureName(entitlement.feature, locale, upTo),
24377
24564
  Y: formatCurrency(perUnitPrice, { locale, currency }),
24378
- unit: getFeatureName(entitlement.feature, 1)
24565
+ unit: getFeatureName(entitlement.feature, locale, 1)
24379
24566
  });
24380
24567
  }
24381
24568
  if (flatAmount > 0 && perUnitPrice === 0) {
24382
24569
  return t2("Up to X units for $Y/period", {
24383
24570
  X: upTo,
24384
- units: getFeatureName(entitlement.feature, upTo),
24571
+ units: getFeatureName(entitlement.feature, locale, upTo),
24385
24572
  Y: formatCurrency(flatAmount, { locale, currency }),
24386
24573
  period
24387
24574
  });
@@ -24389,9 +24576,9 @@ var TieredPricingDetails = ({
24389
24576
  if (flatAmount > 0 && perUnitPrice > 0) {
24390
24577
  return t2("Up to X units at $Y/unit + $Z/period", {
24391
24578
  X: upTo,
24392
- units: getFeatureName(entitlement.feature, upTo),
24579
+ units: getFeatureName(entitlement.feature, locale, upTo),
24393
24580
  Y: formatCurrency(perUnitPrice, { locale, currency }),
24394
- unit: getFeatureName(entitlement.feature, 1),
24581
+ unit: getFeatureName(entitlement.feature, locale, 1),
24395
24582
  Z: formatCurrency(flatAmount, { locale, currency }),
24396
24583
  period
24397
24584
  });
@@ -24399,25 +24586,26 @@ var TieredPricingDetails = ({
24399
24586
  };
24400
24587
 
24401
24588
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
24402
- var import_react38 = require("react");
24589
+ var import_react39 = require("react");
24403
24590
  var import_jsx_runtime46 = require("react/jsx-runtime");
24404
24591
  var UnsubscribeDialog = ({ top }) => {
24405
24592
  const { t: t2, locale } = useTranslation();
24406
24593
  const { data, layout, setLayout, setCheckoutState, clearCheckoutState } = useEmbed();
24407
- const dialogRef = (0, import_react38.useRef)(null);
24408
- const sidebarRef = (0, import_react38.useRef)(null);
24409
- const [dialogElement, setDialogElement] = (0, import_react38.useState)(
24594
+ const dialogRef = (0, import_react39.useRef)(null);
24595
+ const sidebarRef = (0, import_react39.useRef)(null);
24596
+ const [dialogElement, setDialogElement] = (0, import_react39.useState)(
24410
24597
  null
24411
24598
  );
24412
- const setDialog = (0, import_react38.useCallback)((element) => {
24599
+ const setDialog = (0, import_react39.useCallback)((element) => {
24413
24600
  dialogRef.current = element;
24414
24601
  setDialogElement(element);
24415
24602
  }, []);
24416
- const [error, setError] = (0, import_react38.useState)();
24417
- const [isLoading, setIsLoading] = (0, import_react38.useState)(false);
24418
- const [isModal, setIsModal] = (0, import_react38.useState)(true);
24419
- const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = (0, import_react38.useMemo)(() => {
24420
- const cancelDate2 = data?.subscription?.cancelAt || data?.upcomingInvoice?.dueDate;
24603
+ const [error, setError] = (0, import_react39.useState)();
24604
+ const [isLoading, setIsLoading] = (0, import_react39.useState)(false);
24605
+ const [isModal, setIsModal] = (0, import_react39.useState)(true);
24606
+ const { billDate } = useNextBillDate();
24607
+ const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = (0, import_react39.useMemo)(() => {
24608
+ const cancelDate2 = data?.subscription?.cancelAt || billDate;
24421
24609
  return {
24422
24610
  planPeriod: getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month",
24423
24611
  currentPlan: data?.company?.plan,
@@ -24431,10 +24619,10 @@ var UnsubscribeDialog = ({ top }) => {
24431
24619
  data?.company?.plan,
24432
24620
  data?.featureUsage,
24433
24621
  data?.subscription?.cancelAt,
24434
- data?.upcomingInvoice?.dueDate
24622
+ billDate
24435
24623
  ]);
24436
24624
  const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
24437
- const selectedPlan = (0, import_react38.useMemo)(
24625
+ const selectedPlan = (0, import_react39.useMemo)(
24438
24626
  () => availablePlans.find((plan) => plan.id === currentPlan?.id),
24439
24627
  [currentPlan?.id, availablePlans]
24440
24628
  );
@@ -24443,18 +24631,18 @@ var UnsubscribeDialog = ({ top }) => {
24443
24631
  createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
24444
24632
  []
24445
24633
  );
24446
- const addOns = (0, import_react38.useMemo)(
24634
+ const addOns = (0, import_react39.useMemo)(
24447
24635
  () => availableAddOns.map((available) => ({
24448
24636
  ...available,
24449
24637
  isSelected: currentAddOns.some((current) => available.id === current.id) ?? false
24450
24638
  })),
24451
24639
  [currentAddOns, availableAddOns]
24452
24640
  );
24453
- const handleClose = (0, import_react38.useCallback)(() => {
24641
+ const handleClose = (0, import_react39.useCallback)(() => {
24454
24642
  clearCheckoutState();
24455
24643
  setLayout("portal");
24456
24644
  }, [setLayout, clearCheckoutState]);
24457
- (0, import_react38.useLayoutEffect)(() => {
24645
+ (0, import_react39.useLayoutEffect)(() => {
24458
24646
  const element = dialogRef.current;
24459
24647
  if (layout !== "unsubscribe" || !element) {
24460
24648
  return;
@@ -24694,6 +24882,7 @@ var Badge = () => {
24694
24882
  // src/components/layout/RenderLayout.tsx
24695
24883
  var import_jsx_runtime49 = require("react/jsx-runtime");
24696
24884
  var Disabled = () => {
24885
+ const { t: t2 } = useTranslation();
24697
24886
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Box, { $width: "max-content", $height: "max-content", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
24698
24887
  Element,
24699
24888
  {
@@ -24703,8 +24892,8 @@ var Disabled = () => {
24703
24892
  $alignItems: "center",
24704
24893
  $whiteSpace: "nowrap",
24705
24894
  children: [
24706
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
24707
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "p", children: "Please try again later." })
24895
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "h1", display: "heading1", children: t2("Portal not found") }) }),
24896
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "p", children: t2("Please try again later.") })
24708
24897
  ]
24709
24898
  }
24710
24899
  ) }) });
@@ -24740,13 +24929,13 @@ var StyledViewport = import_styled_components21.styled.div.withConfig({
24740
24929
 
24741
24930
  // src/components/layout/viewport/Viewport.tsx
24742
24931
  var import_jsx_runtime50 = require("react/jsx-runtime");
24743
- var Viewport = (0, import_react39.forwardRef)(
24932
+ var Viewport = (0, import_react40.forwardRef)(
24744
24933
  ({ children, portal, ...props }, ref) => {
24745
24934
  portal = portal || document.body;
24746
- const portalRef = (0, import_react39.useRef)(portal);
24935
+ const portalRef = (0, import_react40.useRef)(portal);
24747
24936
  const { data, layout, settings } = useEmbed();
24748
- const [top, setTop] = (0, import_react39.useState)(0);
24749
- (0, import_react39.useLayoutEffect)(() => {
24937
+ const [top, setTop] = (0, import_react40.useState)(0);
24938
+ (0, import_react40.useLayoutEffect)(() => {
24750
24939
  const element = portalRef.current;
24751
24940
  const setModalY = (0, import_debounce5.default)(() => {
24752
24941
  const value = Math.abs(
@@ -24789,7 +24978,7 @@ var resolveDesignProps = (props) => {
24789
24978
  }
24790
24979
  };
24791
24980
  };
24792
- var ButtonElement = (0, import_react40.forwardRef)(({ children, className, ...rest }, ref) => {
24981
+ var ButtonElement = (0, import_react41.forwardRef)(({ children, className, ...rest }, ref) => {
24793
24982
  const props = resolveDesignProps(rest);
24794
24983
  const buttonStyles2 = {
24795
24984
  primary: {
@@ -24834,10 +25023,10 @@ var ButtonElement = (0, import_react40.forwardRef)(({ children, className, ...re
24834
25023
  ButtonElement.displayName = "Button";
24835
25024
 
24836
25025
  // src/components/elements/included-features/IncludedFeatures.tsx
24837
- var import_react42 = require("react");
25026
+ var import_react43 = require("react");
24838
25027
 
24839
25028
  // src/components/elements/included-features/UsageDetails.tsx
24840
- var import_react41 = require("react");
25029
+ var import_react42 = require("react");
24841
25030
  var import_jsx_runtime52 = require("react/jsx-runtime");
24842
25031
  var UsageDetails = ({ entitlement, layout }) => {
24843
25032
  const {
@@ -24865,7 +25054,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24865
25054
  currentTier,
24866
25055
  tiersMode,
24867
25056
  tiered
24868
- } = (0, import_react41.useMemo)(() => {
25057
+ } = (0, import_react42.useMemo)(() => {
24869
25058
  const { billingPrice, amount, limit: limit2, cost: cost2, currentTier: currentTier2 } = getUsageDetails(
24870
25059
  entitlement,
24871
25060
  period,
@@ -24892,19 +25081,19 @@ var UsageDetails = ({ entitlement, layout }) => {
24892
25081
  tiered: priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(billingPrice)
24893
25082
  };
24894
25083
  }, [entitlement, period, priceBehavior, showWarningThresholdAsLimit]);
24895
- const text = (0, import_react41.useMemo)(() => {
25084
+ const text = (0, import_react42.useMemo)(() => {
24896
25085
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24897
25086
  return;
24898
25087
  }
24899
25088
  if (priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof allocation === "number") {
24900
25089
  return t2("X units", {
24901
25090
  amount: formatNumber(allocation, { locale }),
24902
- units: getFeatureName(feature, allocation)
25091
+ units: getFeatureName(feature, locale, allocation)
24903
25092
  });
24904
25093
  }
24905
25094
  if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo && typeof price === "number") {
24906
25095
  const formattedCost = formatCurrency(price, { locale, currency });
24907
- const featureName = getFeatureName(feature, packageSize);
25096
+ const featureName = getFeatureName(feature, locale, packageSize);
24908
25097
  return packageSize > 1 ? t2("$X per Y units", {
24909
25098
  cost: formattedCost,
24910
25099
  size: packageSize,
@@ -24914,15 +25103,15 @@ var UsageDetails = ({ entitlement, layout }) => {
24914
25103
  if (priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number") {
24915
25104
  return t2("X units", {
24916
25105
  amount: formatNumber(softLimit, { locale }),
24917
- units: getFeatureName(feature, softLimit)
25106
+ units: getFeatureName(feature, locale, softLimit)
24918
25107
  });
24919
25108
  }
24920
25109
  if (priceBehavior === EntitlementPriceBehavior.Tier) {
24921
25110
  return typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
24922
- feature: getFeatureName(feature)
25111
+ feature: getFeatureName(feature, locale)
24923
25112
  }) : t2("Up to X units in this tier", {
24924
25113
  amount: formatNumber(currentTier.to, { locale }),
24925
- feature: getFeatureName(feature, currentTier.to)
25114
+ feature: getFeatureName(feature, locale, currentTier.to)
24926
25115
  }));
24927
25116
  }
24928
25117
  if (showCredits && priceBehavior === EntitlementPriceBehavior.CreditBurndown && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
@@ -24930,6 +25119,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24930
25119
  amount: formatConsumptionRate(planEntitlement.consumptionRate, locale),
24931
25120
  units: getFeatureName(
24932
25121
  planEntitlement.valueCredit,
25122
+ locale,
24933
25123
  planEntitlement.consumptionRate
24934
25124
  )
24935
25125
  });
@@ -24937,18 +25127,18 @@ var UsageDetails = ({ entitlement, layout }) => {
24937
25127
  if (priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof limit === "number") {
24938
25128
  return t2("X units remaining", {
24939
25129
  amount: formatNumber(limit, { locale }),
24940
- units: getFeatureName(feature, limit)
25130
+ units: getFeatureName(feature, locale, limit)
24941
25131
  });
24942
25132
  }
24943
25133
  if (!priceBehavior && typeof allocation === "number") {
24944
25134
  const numericLimit = limit ?? allocation;
24945
25135
  return t2("X units", {
24946
25136
  amount: formatNumber(numericLimit, { locale }),
24947
- units: getFeatureName(feature, numericLimit)
25137
+ units: getFeatureName(feature, locale, numericLimit)
24948
25138
  });
24949
25139
  }
24950
25140
  if (!priceBehavior && allocationType === "unlimited") {
24951
- return t2("Unlimited", { item: getFeatureName(feature) });
25141
+ return t2("Unlimited", { item: getFeatureName(feature, locale) });
24952
25142
  }
24953
25143
  }, [
24954
25144
  t2,
@@ -24966,7 +25156,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24966
25156
  currentTier,
24967
25157
  showCredits
24968
25158
  ]);
24969
- const usageText = (0, import_react41.useMemo)(() => {
25159
+ const usageText = (0, import_react42.useMemo)(() => {
24970
25160
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24971
25161
  return;
24972
25162
  }
@@ -24974,37 +25164,37 @@ var UsageDetails = ({ entitlement, layout }) => {
24974
25164
  let index = 0;
24975
25165
  if (priceBehavior === EntitlementPriceBehavior.PayInAdvance && !tiered && typeof period === "string" && typeof price === "number") {
24976
25166
  acc.push(
24977
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react41.Fragment, { children: packageSize > 1 ? t2("$X/Y units/period", {
25167
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react42.Fragment, { children: packageSize > 1 ? t2("$X/Y units/period", {
24978
25168
  cost: formatCurrency(price, { locale, currency }),
24979
25169
  size: packageSize,
24980
- units: getFeatureName(feature, packageSize),
25170
+ units: getFeatureName(feature, locale, packageSize),
24981
25171
  period: shortenPeriod(period, t2)
24982
25172
  }) : t2("$X/unit/period", {
24983
25173
  cost: formatCurrency(price, { locale, currency }),
24984
- unit: getFeatureName(feature, packageSize),
25174
+ unit: getFeatureName(feature, locale, packageSize),
24985
25175
  period: shortenPeriod(period, t2)
24986
25176
  }) }, index)
24987
25177
  );
24988
25178
  index += 1;
24989
25179
  } else if ((priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier || priceBehavior === EntitlementPriceBehavior.CreditBurndown || tiered) && typeof usage === "number") {
24990
25180
  acc.push(
24991
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react41.Fragment, { children: t2("X units used", {
25181
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react42.Fragment, { children: t2("X units used", {
24992
25182
  amount: usage,
24993
- units: getFeatureName(feature, usage)
25183
+ units: getFeatureName(feature, locale, usage)
24994
25184
  }) }, index)
24995
25185
  );
24996
25186
  index += 1;
24997
25187
  }
24998
25188
  if (typeof cost === "number" && cost > 0) {
24999
25189
  acc.push(
25000
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react41.Fragment, { children: [
25190
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
25001
25191
  acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: " \u2022 " }),
25002
25192
  formatCurrency(cost, { locale, currency })
25003
25193
  ] }, index)
25004
25194
  );
25005
25195
  index += 1;
25006
25196
  if (feature.featureType === FeatureType.Trait && typeof period === "string") {
25007
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react41.Fragment, { children: [
25197
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
25008
25198
  "/",
25009
25199
  shortenPeriod(period, t2)
25010
25200
  ] }, index));
@@ -25013,7 +25203,7 @@ var UsageDetails = ({ entitlement, layout }) => {
25013
25203
  }
25014
25204
  if (metricResetAt) {
25015
25205
  acc.push(
25016
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react41.Fragment, { children: [
25206
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
25017
25207
  acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: " \u2022 " }),
25018
25208
  t2("Resets", {
25019
25209
  date: toPrettyDate(metricResetAt, {
@@ -25138,12 +25328,12 @@ function resolveDesignProps2(props) {
25138
25328
  }
25139
25329
  };
25140
25330
  }
25141
- var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, ref) => {
25331
+ var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
25142
25332
  const props = resolveDesignProps2(rest);
25143
25333
  const { t: t2, locale } = useTranslation();
25144
25334
  const { data, settings } = useEmbed();
25145
25335
  const isLightBackground = useIsLightBackground();
25146
- const { plan, addOns, featureUsage } = (0, import_react42.useMemo)(() => {
25336
+ const { plan, addOns, featureUsage } = (0, import_react43.useMemo)(() => {
25147
25337
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
25148
25338
  (acc, id) => {
25149
25339
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -25189,7 +25379,7 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
25189
25379
  }
25190
25380
  },
25191
25381
  children: visibleFeatureUsage.items.map((entitlement, index) => {
25192
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react42.Fragment, { children: [
25382
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react43.Fragment, { children: [
25193
25383
  props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
25194
25384
  Icon3,
25195
25385
  {
@@ -25220,9 +25410,10 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
25220
25410
  singularName: grant.singularName,
25221
25411
  pluralName: grant.pluralName
25222
25412
  },
25413
+ locale,
25223
25414
  grant.creditAmount
25224
25415
  ),
25225
- licenseName: entitlement.feature ? getFeatureName(entitlement.feature, 1) : ""
25416
+ licenseName: entitlement.feature ? getFeatureName(entitlement.feature, locale, 1) : ""
25226
25417
  }) }, grantIndex)),
25227
25418
  props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
25228
25419
  Text,
@@ -25280,7 +25471,7 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
25280
25471
  IncludedFeatures.displayName = "IncludedFeatures";
25281
25472
 
25282
25473
  // src/components/elements/invoices/Invoices.tsx
25283
- var import_react43 = require("react");
25474
+ var import_react44 = require("react");
25284
25475
  var import_jsx_runtime54 = require("react/jsx-runtime");
25285
25476
  function resolveDesignProps3(props) {
25286
25477
  return {
@@ -25339,27 +25530,27 @@ function formatInvoices(invoices, locale, options) {
25339
25530
  };
25340
25531
  });
25341
25532
  }
25342
- var Invoices = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
25533
+ var Invoices = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
25343
25534
  const props = resolveDesignProps3(rest);
25344
25535
  const { t: t2, locale } = useTranslation();
25345
25536
  const { data, listInvoices, settings } = useEmbed();
25346
- const [isLoading, setIsLoading] = (0, import_react43.useState)(false);
25347
- const [error, setError] = (0, import_react43.useState)();
25348
- const [rawInvoices, setInvoices] = (0, import_react43.useState)(
25537
+ const [isLoading, setIsLoading] = (0, import_react44.useState)(false);
25538
+ const [error, setError] = (0, import_react44.useState)();
25539
+ const [rawInvoices, setInvoices] = (0, import_react44.useState)(
25349
25540
  () => data && "invoices" in data ? data.invoices : rest.data
25350
25541
  );
25351
- const invoices = (0, import_react43.useMemo)(
25542
+ const invoices = (0, import_react44.useMemo)(
25352
25543
  () => formatInvoices(rawInvoices, locale),
25353
25544
  [rawInvoices, locale]
25354
25545
  );
25355
- const reachableInvoices = (0, import_react43.useMemo)(
25546
+ const reachableInvoices = (0, import_react44.useMemo)(
25356
25547
  () => invoices.slice(0, MAX_VISIBLE_INVOICE_COUNT),
25357
25548
  [invoices]
25358
25549
  );
25359
25550
  const visibleInvoices = useTruncatedList(reachableInvoices, {
25360
25551
  limit: props.limit.number
25361
25552
  });
25362
- const getInvoices = (0, import_react43.useCallback)(async () => {
25553
+ const getInvoices = (0, import_react44.useCallback)(async () => {
25363
25554
  try {
25364
25555
  setError(void 0);
25365
25556
  setIsLoading(true);
@@ -25373,15 +25564,15 @@ var Invoices = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
25373
25564
  setIsLoading(false);
25374
25565
  }
25375
25566
  }, [listInvoices]);
25376
- (0, import_react43.useEffect)(() => {
25567
+ (0, import_react44.useEffect)(() => {
25377
25568
  getInvoices();
25378
25569
  }, [getInvoices]);
25379
- (0, import_react43.useEffect)(() => {
25570
+ (0, import_react44.useEffect)(() => {
25380
25571
  if (rest.data) {
25381
25572
  setInvoices(rest.data);
25382
25573
  }
25383
25574
  }, [rest.data]);
25384
- (0, import_react43.useEffect)(() => {
25575
+ (0, import_react44.useEffect)(() => {
25385
25576
  if (data && "invoices" in data) {
25386
25577
  const invoicesPreviewData = data.invoices;
25387
25578
  setInvoices(invoicesPreviewData);
@@ -25471,7 +25662,7 @@ var Invoices = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
25471
25662
  Invoices.displayName = "Invoices";
25472
25663
 
25473
25664
  // src/components/elements/metered-features/MeteredFeatures.tsx
25474
- var import_react45 = require("react");
25665
+ var import_react46 = require("react");
25475
25666
 
25476
25667
  // src/components/elements/metered-features/Meter.tsx
25477
25668
  var import_jsx_runtime55 = require("react/jsx-runtime");
@@ -25556,7 +25747,7 @@ var PriceDetails = ({
25556
25747
  packageSize,
25557
25748
  " "
25558
25749
  ] }),
25559
- getFeatureName(feature, packageSize),
25750
+ getFeatureName(feature, locale, packageSize),
25560
25751
  feature.featureType === FeatureType.Trait && period && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25561
25752
  "/",
25562
25753
  shortenPeriod(period, t2)
@@ -25581,7 +25772,7 @@ var PriceDetails = ({
25581
25772
  typeof amount === "number" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Text, { children: [
25582
25773
  formatNumber(amount, { locale }),
25583
25774
  " ",
25584
- getFeatureName(feature, amount),
25775
+ getFeatureName(feature, locale, amount),
25585
25776
  " \xB7 ",
25586
25777
  formatCurrency(currentTierPerUnitPrice * amount, {
25587
25778
  locale,
@@ -25604,7 +25795,7 @@ var PriceDetails = ({
25604
25795
  };
25605
25796
 
25606
25797
  // src/components/elements/metered-features/UsageByUser.tsx
25607
- var import_react44 = require("react");
25798
+ var import_react45 = require("react");
25608
25799
  var import_jsx_runtime57 = require("react/jsx-runtime");
25609
25800
  var COLLAPSED_COUNT = 3;
25610
25801
  var EXPANDED_COUNT = 20;
@@ -25661,13 +25852,13 @@ var UsageByUser = ({ source, unit }) => {
25661
25852
  const { t: t2, locale } = useTranslation();
25662
25853
  const isLightBackground = useIsLightBackground();
25663
25854
  const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
25664
- const [expanded, setExpanded] = (0, import_react44.useState)(false);
25665
- const [result, setResult] = (0, import_react44.useState)();
25666
- const [attempt, setAttempt] = (0, import_react44.useState)(0);
25855
+ const [expanded, setExpanded] = (0, import_react45.useState)(false);
25856
+ const [result, setResult] = (0, import_react45.useState)();
25857
+ const [attempt, setAttempt] = (0, import_react45.useState)(0);
25667
25858
  const { kind, id } = source;
25668
25859
  const sourceKey = `${kind}:${id}`;
25669
25860
  const current = result?.sourceKey === sourceKey ? result : void 0;
25670
- (0, import_react44.useEffect)(() => {
25861
+ (0, import_react45.useEffect)(() => {
25671
25862
  let active = true;
25672
25863
  const apply = (next) => {
25673
25864
  if (active) {
@@ -25701,7 +25892,7 @@ var UsageByUser = ({ source, unit }) => {
25701
25892
  sourceKey
25702
25893
  ]);
25703
25894
  const entries = current?.section?.entries;
25704
- const attributed = (0, import_react44.useMemo)(
25895
+ const attributed = (0, import_react45.useMemo)(
25705
25896
  () => [...entries ?? []].sort((a, b) => b.amount - a.amount),
25706
25897
  [entries]
25707
25898
  );
@@ -25709,7 +25900,7 @@ var UsageByUser = ({ source, unit }) => {
25709
25900
  const total = current?.section?.total ?? 0;
25710
25901
  const totalUsers = current?.section?.totalUsers ?? 0;
25711
25902
  const unattributed = current?.section?.unattributed;
25712
- const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, amount)}`;
25903
+ const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, locale, amount)}`;
25713
25904
  if (error) {
25714
25905
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
25715
25906
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: "heading4", children: t2("Usage by user") }),
@@ -25815,10 +26006,10 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25815
26006
  const acc = [];
25816
26007
  acc.push(
25817
26008
  priceBehavior === EntitlementPriceBehavior.Tier && typeof currentTier?.to === "number" && typeof feature !== "undefined" ? currentTier?.to === Infinity ? t2("Unlimited in this tier", {
25818
- feature: getFeatureName(feature)
26009
+ feature: getFeatureName(feature, locale)
25819
26010
  }) : t2("Up to X units in this tier", {
25820
26011
  amount: currentTier.to,
25821
- feature: getFeatureName(feature)
26012
+ feature: getFeatureName(feature, locale)
25822
26013
  }) : priceBehavior === EntitlementPriceBehavior.Overage && typeof limit === "number" ? t2("X included", {
25823
26014
  amount: formatNumber(limit, { locale })
25824
26015
  }) : priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof usage === "number" ? `${formatNumber(usage, { locale })} ${t2("used")}` : priceBehavior === EntitlementPriceBehavior.PayAsYouGo && typeof cost === "number" ? formatCurrency(cost, { locale, currency: billingPrice?.currency }) : data?.displaySettings?.showCredits && priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof planEntitlement?.valueCredit !== "undefined" && typeof planEntitlement?.consumptionRate === "number" ? t2("X units per use", {
@@ -25828,11 +26019,12 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25828
26019
  ),
25829
26020
  units: getFeatureName(
25830
26021
  planEntitlement.valueCredit,
26022
+ locale,
25831
26023
  planEntitlement.consumptionRate
25832
26024
  )
25833
26025
  }) : priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof feature !== "undefined" && typeof limit === "number" ? t2("X units remaining", {
25834
26026
  amount: formatNumber(limit, { locale }),
25835
- units: getFeatureName(feature, limit)
26027
+ units: getFeatureName(feature, locale, limit)
25836
26028
  }) : typeof limit === "number" ? t2("Limit of", {
25837
26029
  amount: formatNumber(limit, { locale })
25838
26030
  }) : t2("No limit")
@@ -25887,15 +26079,16 @@ function resolveDesignProps4(props) {
25887
26079
  visibleFeatures: props.visibleFeatures
25888
26080
  };
25889
26081
  }
25890
- var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, ref) => {
26082
+ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, ref) => {
25891
26083
  const props = resolveDesignProps4(rest);
25892
- const elementsRef = (0, import_react45.useRef)([]);
26084
+ const elementsRef = (0, import_react46.useRef)([]);
25893
26085
  const shouldWrapChildren = useWrapChildren(elementsRef);
25894
26086
  const { t: t2, locale } = useTranslation();
25895
26087
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
25896
26088
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
25897
26089
  const isLightBackground = useIsLightBackground();
25898
- const meteredFeatures = (0, import_react45.useMemo)(() => {
26090
+ const { billDate: renewalDate } = useNextBillDate();
26091
+ const meteredFeatures = (0, import_react46.useMemo)(() => {
25899
26092
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
25900
26093
  (acc, id) => {
25901
26094
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -25912,7 +26105,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
25912
26105
  ({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
25913
26106
  );
25914
26107
  }, [props.visibleFeatures, data?.featureUsage?.features]);
25915
- const creditGroups = (0, import_react45.useMemo)(
26108
+ const creditGroups = (0, import_react46.useMemo)(
25916
26109
  () => withEmptyPlanCreditBalances(
25917
26110
  aggregateActiveGrantsByCredit(data?.creditGrants || []),
25918
26111
  listPlanCredits(
@@ -25923,11 +26116,11 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
25923
26116
  ),
25924
26117
  [data?.creditGrants, data?.featureUsage?.features, data?.company]
25925
26118
  );
25926
- const planCreditCompositions = (0, import_react45.useMemo)(
26119
+ const planCreditCompositions = (0, import_react46.useMemo)(
25927
26120
  () => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
25928
26121
  [data?.company?.plan?.includedCreditGrants]
25929
26122
  );
25930
- const resolveLicenseQuantity = (0, import_react45.useCallback)(
26123
+ const resolveLicenseQuantity = (0, import_react46.useCallback)(
25931
26124
  (licenseId) => {
25932
26125
  const allocation = findLicenseSource(
25933
26126
  data?.featureUsage?.features ?? [],
@@ -25937,17 +26130,17 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
25937
26130
  },
25938
26131
  [data?.featureUsage?.features]
25939
26132
  );
25940
- const purchasableCreditIds = (0, import_react45.useMemo)(
26133
+ const purchasableCreditIds = (0, import_react46.useMemo)(
25941
26134
  () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
25942
26135
  [data?.creditBundles, data?.company?.plan?.id]
25943
26136
  );
25944
- const [expandedCreditIds, setExpandedCreditIds] = (0, import_react45.useState)(
26137
+ const [expandedCreditIds, setExpandedCreditIds] = (0, import_react46.useState)(
25945
26138
  () => /* @__PURE__ */ new Set()
25946
26139
  );
25947
- const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react45.useState)(
26140
+ const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react46.useState)(
25948
26141
  () => /* @__PURE__ */ new Set()
25949
26142
  );
25950
- const toggleFullLedger = (0, import_react45.useCallback)((id) => {
26143
+ const toggleFullLedger = (0, import_react46.useCallback)((id) => {
25951
26144
  setFullLedgerCreditIds((prev) => {
25952
26145
  const next = new Set(prev);
25953
26146
  if (next.has(id)) {
@@ -25958,7 +26151,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
25958
26151
  return next;
25959
26152
  });
25960
26153
  }, []);
25961
- const toggleBalanceDetails = (0, import_react45.useCallback)((id) => {
26154
+ const toggleBalanceDetails = (0, import_react46.useCallback)((id) => {
25962
26155
  setExpandedCreditIds((prev) => {
25963
26156
  const next = new Set(prev);
25964
26157
  if (next.has(id)) {
@@ -26034,11 +26227,11 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26034
26227
  formatNumber(limit, { locale }),
26035
26228
  " "
26036
26229
  ] }),
26037
- getFeatureName(feature, limit)
26230
+ getFeatureName(feature, locale, limit)
26038
26231
  ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
26039
26232
  formatNumber(usage, { locale }),
26040
26233
  " ",
26041
- getFeatureName(feature, usage),
26234
+ getFeatureName(feature, locale, usage),
26042
26235
  " ",
26043
26236
  t2("used")
26044
26237
  ] }) }) }),
@@ -26127,6 +26320,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26127
26320
  }),
26128
26321
  units: getFeatureName(
26129
26322
  credit,
26323
+ locale,
26130
26324
  credit.total.remaining
26131
26325
  )
26132
26326
  }) }) }),
@@ -26168,6 +26362,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26168
26362
  quantity: licenseQuantity,
26169
26363
  licenseName: getFeatureName(
26170
26364
  licenseFeature,
26365
+ locale,
26171
26366
  licenseQuantity
26172
26367
  ),
26173
26368
  perUnit: perLicenseGrant.amount
@@ -26180,7 +26375,6 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26180
26375
  })
26181
26376
  );
26182
26377
  }
26183
- const renewalDate = data?.upcomingInvoice?.dueDate;
26184
26378
  return (
26185
26379
  // Pulled up against the balance line despite the column's 2rem gap
26186
26380
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
@@ -26192,7 +26386,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26192
26386
  children: [
26193
26387
  t2("Your plan includes credits", {
26194
26388
  total,
26195
- creditName: getFeatureName(credit, total),
26389
+ creditName: getFeatureName(credit, locale, total),
26196
26390
  period: shortenPeriod(composition.period, t2),
26197
26391
  composition: ` \u2014 ${parts.join(" + ")}`
26198
26392
  }),
@@ -26227,6 +26421,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26227
26421
  amount: grant.quantity,
26228
26422
  item: getFeatureName(
26229
26423
  credit,
26424
+ locale,
26230
26425
  grant.quantity
26231
26426
  )
26232
26427
  }) }) }),
@@ -26248,7 +26443,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26248
26443
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
26249
26444
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: t2("X item bundle", {
26250
26445
  amount: grant.quantity,
26251
- item: getFeatureName(credit, 1),
26446
+ item: getFeatureName(credit, locale, 1),
26252
26447
  createdAt: toPrettyDate(
26253
26448
  grant.createdAt,
26254
26449
  { locale, month: "short" }
@@ -26257,6 +26452,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26257
26452
  amount: grant.quantity,
26258
26453
  item: getFeatureName(
26259
26454
  credit,
26455
+ locale,
26260
26456
  grant.quantity
26261
26457
  ),
26262
26458
  createdAt: toPrettyDate(
@@ -26267,6 +26463,7 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26267
26463
  amount: grant.quantity,
26268
26464
  item: getFeatureName(
26269
26465
  credit,
26466
+ locale,
26270
26467
  grant.quantity
26271
26468
  ),
26272
26469
  createdAt: toPrettyDate(
@@ -26338,10 +26535,10 @@ var MeteredFeatures = (0, import_react45.forwardRef)(({ className, ...rest }, re
26338
26535
  MeteredFeatures.displayName = "MeteredFeatures";
26339
26536
 
26340
26537
  // src/components/elements/payment-method/PaymentMethod.tsx
26341
- var import_react47 = require("react");
26538
+ var import_react48 = require("react");
26342
26539
 
26343
26540
  // src/components/elements/payment-method/PaymentMethodElement.tsx
26344
- var import_react46 = require("react");
26541
+ var import_react47 = require("react");
26345
26542
  var import_jsx_runtime59 = require("react/jsx-runtime");
26346
26543
  var PaymentElement2 = ({
26347
26544
  iconName,
@@ -26517,7 +26714,7 @@ var PaymentListElement = ({
26517
26714
  const { settings } = useEmbed();
26518
26715
  const isLightBackground = useIsLightBackground();
26519
26716
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
26520
- const expirationDate = (0, import_react46.useMemo)(() => {
26717
+ const expirationDate = (0, import_react47.useMemo)(() => {
26521
26718
  const { cardExpMonth, cardExpYear } = paymentMethod;
26522
26719
  if (!cardExpMonth || !cardExpYear) {
26523
26720
  return;
@@ -26609,10 +26806,10 @@ var resolveDesignProps5 = (props) => {
26609
26806
  }
26610
26807
  };
26611
26808
  };
26612
- var PaymentMethod = (0, import_react47.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26809
+ var PaymentMethod = (0, import_react48.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26613
26810
  const props = resolveDesignProps5(rest);
26614
26811
  const { data, setLayout } = useEmbed();
26615
- const { paymentMethod, monthsToExpiration } = (0, import_react47.useMemo)(() => {
26812
+ const { paymentMethod, monthsToExpiration } = (0, import_react48.useMemo)(() => {
26616
26813
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
26617
26814
  let monthsToExpiration2;
26618
26815
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -26816,7 +27013,7 @@ var loadStripe = function loadStripe2() {
26816
27013
  };
26817
27014
 
26818
27015
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
26819
- var import_react48 = require("react");
27016
+ var import_react49 = require("react");
26820
27017
  var import_jsx_runtime61 = require("react/jsx-runtime");
26821
27018
  var resolveDesignProps6 = () => {
26822
27019
  return {
@@ -26845,7 +27042,7 @@ var PaymentMethodDetails = ({
26845
27042
  updatePaymentMethod,
26846
27043
  deletePaymentMethod
26847
27044
  } = useEmbed();
26848
- const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react48.useMemo)(() => {
27045
+ const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react49.useMemo)(() => {
26849
27046
  return {
26850
27047
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
26851
27048
  paymentMethods: data?.company?.paymentMethods || [],
@@ -26858,13 +27055,13 @@ var PaymentMethodDetails = ({
26858
27055
  ]);
26859
27056
  const isLightBackground = useIsLightBackground();
26860
27057
  const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
26861
- const [isLoading, setIsLoading] = (0, import_react48.useState)(!initialPaymentMethod);
26862
- const [error, setError] = (0, import_react48.useState)();
26863
- const [showPaymentForm, setShowPaymentForm] = (0, import_react48.useState)(false);
26864
- const [stripe, setStripe] = (0, import_react48.useState)(null);
26865
- const [setupIntent, setSetupIntent] = (0, import_react48.useState)();
26866
- const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react48.useState)(false);
26867
- const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react48.useState)(initialPaymentMethod);
27058
+ const [isLoading, setIsLoading] = (0, import_react49.useState)(!initialPaymentMethod);
27059
+ const [error, setError] = (0, import_react49.useState)();
27060
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react49.useState)(false);
27061
+ const [stripe, setStripe] = (0, import_react49.useState)(null);
27062
+ const [setupIntent, setSetupIntent] = (0, import_react49.useState)();
27063
+ const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react49.useState)(false);
27064
+ const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react49.useState)(initialPaymentMethod);
26868
27065
  const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
26869
27066
  stripe,
26870
27067
  clientSecret: confirmPaymentIntentProps?.clientSecret,
@@ -26877,7 +27074,7 @@ var PaymentMethodDetails = ({
26877
27074
  },
26878
27075
  autoConfirm: true
26879
27076
  });
26880
- const monthsToExpiration = (0, import_react48.useMemo)(() => {
27077
+ const monthsToExpiration = (0, import_react49.useMemo)(() => {
26881
27078
  let expiration;
26882
27079
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
26883
27080
  const now = /* @__PURE__ */ new Date();
@@ -26900,8 +27097,8 @@ var PaymentMethodDetails = ({
26900
27097
  const toggleShowPaymentMethods = () => {
26901
27098
  setShowDifferentPaymentMethods((prev) => !prev);
26902
27099
  };
26903
- const locale = (0, import_react48.useMemo)(() => stripeLocale(language), [language]);
26904
- const initializeStripe = (0, import_react48.useCallback)(() => {
27100
+ const locale = (0, import_react49.useMemo)(() => stripeLocale(language), [language]);
27101
+ const initializeStripe = (0, import_react49.useCallback)(() => {
26905
27102
  if (stripe || !setupIntent) {
26906
27103
  return;
26907
27104
  }
@@ -26924,7 +27121,7 @@ var PaymentMethodDetails = ({
26924
27121
  setShowPaymentForm(false);
26925
27122
  });
26926
27123
  }, [t2, stripe, setupIntent, locale]);
26927
- const initializePaymentMethod = (0, import_react48.useCallback)(() => {
27124
+ const initializePaymentMethod = (0, import_react49.useCallback)(() => {
26928
27125
  const pending = createSetupIntent() ?? Promise.resolve(void 0);
26929
27126
  return pending.then((response) => {
26930
27127
  if (response) {
@@ -26939,7 +27136,7 @@ var PaymentMethodDetails = ({
26939
27136
  setIsLoading(false);
26940
27137
  });
26941
27138
  }, [t2, createSetupIntent]);
26942
- const handleUpdatePaymentMethod = (0, import_react48.useCallback)(
27139
+ const handleUpdatePaymentMethod = (0, import_react49.useCallback)(
26943
27140
  async (paymentMethodId) => {
26944
27141
  try {
26945
27142
  setIsLoading(true);
@@ -26961,7 +27158,7 @@ var PaymentMethodDetails = ({
26961
27158
  },
26962
27159
  [t2, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
26963
27160
  );
26964
- const handleDeletePaymentMethod = (0, import_react48.useCallback)(
27161
+ const handleDeletePaymentMethod = (0, import_react49.useCallback)(
26965
27162
  async (paymentMethodId) => {
26966
27163
  try {
26967
27164
  setIsLoading(true);
@@ -26977,10 +27174,10 @@ var PaymentMethodDetails = ({
26977
27174
  },
26978
27175
  [t2, deletePaymentMethod]
26979
27176
  );
26980
- (0, import_react48.useEffect)(() => {
27177
+ (0, import_react49.useEffect)(() => {
26981
27178
  initializeStripe();
26982
27179
  }, [initializeStripe]);
26983
- (0, import_react48.useEffect)(() => {
27180
+ (0, import_react49.useEffect)(() => {
26984
27181
  if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
26985
27182
  initializePaymentMethod();
26986
27183
  }
@@ -27160,7 +27357,7 @@ var PaymentMethodDetails = ({
27160
27357
  };
27161
27358
 
27162
27359
  // src/components/elements/plan-manager/PlanManager.tsx
27163
- var import_react50 = require("react");
27360
+ var import_react51 = require("react");
27164
27361
 
27165
27362
  // src/components/elements/plan-manager/AddOn.tsx
27166
27363
  var import_jsx_runtime62 = require("react/jsx-runtime");
@@ -27186,7 +27383,7 @@ var AddOn = ({ addOn, currency, period, layout }) => {
27186
27383
  };
27187
27384
 
27188
27385
  // src/components/elements/plan-manager/UsageDetails.tsx
27189
- var import_react49 = require("react");
27386
+ var import_react50 = require("react");
27190
27387
  var import_jsx_runtime63 = require("react/jsx-runtime");
27191
27388
  var UsageDetails2 = ({
27192
27389
  entitlement,
@@ -27202,31 +27399,31 @@ var UsageDetails2 = ({
27202
27399
  billingPrice,
27203
27400
  limit,
27204
27401
  cost = 0
27205
- } = (0, import_react49.useMemo)(
27402
+ } = (0, import_react50.useMemo)(
27206
27403
  () => getUsageDetails(entitlement, period, currency, {
27207
27404
  showWarningThresholdAsLimit
27208
27405
  }),
27209
27406
  [entitlement, period, currency, showWarningThresholdAsLimit]
27210
27407
  );
27211
- const description = (0, import_react49.useMemo)(() => {
27408
+ const description = (0, import_react50.useMemo)(() => {
27212
27409
  const acc = [];
27213
27410
  let index = 0;
27214
27411
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
27215
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react49.Fragment, { children: [
27412
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27216
27413
  t2("Additional"),
27217
27414
  ": "
27218
27415
  ] }, index));
27219
27416
  index += 1;
27220
27417
  }
27221
27418
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
27222
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react49.Fragment, { children: t2("Tier-based") }, index));
27419
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react50.Fragment, { children: t2("Tier-based") }, index));
27223
27420
  index += 1;
27224
27421
  }
27225
27422
  const { price } = getEntitlementPrice(entitlement, period, currency) || {};
27226
27423
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
27227
27424
  const packageSize = billingPrice?.packageSize ?? 1;
27228
27425
  acc.push(
27229
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react49.Fragment, { children: [
27426
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27230
27427
  formatCurrency(price, { locale, currency: billingPrice?.currency }),
27231
27428
  /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
27232
27429
  "/",
@@ -27234,7 +27431,7 @@ var UsageDetails2 = ({
27234
27431
  packageSize,
27235
27432
  " "
27236
27433
  ] }),
27237
- getFeatureName(entitlement.feature, packageSize),
27434
+ getFeatureName(entitlement.feature, locale, packageSize),
27238
27435
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27239
27436
  "/",
27240
27437
  shortenPeriod(period, t2)
@@ -27246,7 +27443,7 @@ var UsageDetails2 = ({
27246
27443
  }
27247
27444
  if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
27248
27445
  acc.push(
27249
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react49.Fragment, { children: [
27446
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27250
27447
  formatConsumptionRate(
27251
27448
  entitlement.planEntitlement.consumptionRate,
27252
27449
  locale
@@ -27254,6 +27451,7 @@ var UsageDetails2 = ({
27254
27451
  " ",
27255
27452
  getFeatureName(
27256
27453
  entitlement.planEntitlement.valueCredit,
27454
+ locale,
27257
27455
  entitlement.planEntitlement.consumptionRate
27258
27456
  ),
27259
27457
  " ",
@@ -27289,7 +27487,7 @@ var UsageDetails2 = ({
27289
27487
  /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27290
27488
  quantity,
27291
27489
  " ",
27292
- getFeatureName(entitlement.feature, quantity, true)
27490
+ getFeatureName(entitlement.feature, locale, quantity, true)
27293
27491
  ] }) : entitlement.feature.name }),
27294
27492
  /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { children: [
27295
27493
  description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
@@ -27367,7 +27565,7 @@ var resolveDesignProps7 = (props) => {
27367
27565
  }
27368
27566
  };
27369
27567
  };
27370
- var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal, ...rest }, ref) => {
27568
+ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal, ...rest }, ref) => {
27371
27569
  const props = resolveDesignProps7(rest);
27372
27570
  const { t: t2, locale } = useTranslation();
27373
27571
  const { data, settings, setCheckoutState, setLayout } = useEmbed();
@@ -27386,7 +27584,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27386
27584
  showCredits,
27387
27585
  showZeroPriceAsFree,
27388
27586
  trialPaymentMethodRequired
27389
- } = (0, import_react50.useMemo)(() => {
27587
+ } = (0, import_react51.useMemo)(() => {
27390
27588
  const planCreditOrder = /* @__PURE__ */ new Map();
27391
27589
  (data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
27392
27590
  if (!planCreditOrder.has(grant.creditId)) {
@@ -27446,15 +27644,15 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27446
27644
  data?.displaySettings?.showZeroPriceAsFree,
27447
27645
  data?.trialPaymentMethodRequired
27448
27646
  ]);
27449
- const usageBasedEntitlements = (0, import_react50.useMemo)(
27647
+ const usageBasedEntitlements = (0, import_react51.useMemo)(
27450
27648
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
27451
27649
  [featureUsage]
27452
27650
  );
27453
- const planCreditCompositions = (0, import_react50.useMemo)(
27651
+ const planCreditCompositions = (0, import_react51.useMemo)(
27454
27652
  () => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
27455
27653
  [currentPlan?.includedCreditGrants]
27456
27654
  );
27457
- const resolveLicenseQuantity = (0, import_react50.useMemo)(() => {
27655
+ const resolveLicenseQuantity = (0, import_react51.useMemo)(() => {
27458
27656
  return (licenseId) => {
27459
27657
  const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
27460
27658
  return typeof allocation === "number" ? allocation : void 0;
@@ -27477,7 +27675,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27477
27675
  subscriptionCurrency,
27478
27676
  willSubscriptionCancel,
27479
27677
  isTrialSubscription
27480
- } = (0, import_react50.useMemo)(() => {
27678
+ } = (0, import_react51.useMemo)(() => {
27481
27679
  const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
27482
27680
  const subscriptionCurrency2 = billingSubscription?.currency;
27483
27681
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -27490,7 +27688,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27490
27688
  };
27491
27689
  }, [billingSubscription]);
27492
27690
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
27493
- const { isFreePlan, isUsageBasedPlan } = (0, import_react50.useMemo)(() => {
27691
+ const { isFreePlan, isUsageBasedPlan } = (0, import_react51.useMemo)(() => {
27494
27692
  const isFreePlan2 = currentPlan?.planPrice === 0;
27495
27693
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
27496
27694
  return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
@@ -27750,9 +27948,14 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27750
27948
  amount: perLicenseGrant.amount,
27751
27949
  creditName: getFeatureName(
27752
27950
  group,
27951
+ locale,
27753
27952
  perLicenseGrant.amount
27754
27953
  ),
27755
- licenseName: getFeatureName(licenseFeature, 1)
27954
+ licenseName: getFeatureName(
27955
+ licenseFeature,
27956
+ locale,
27957
+ 1
27958
+ )
27756
27959
  }),
27757
27960
  composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27758
27961
  " ",
@@ -27760,6 +27963,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27760
27963
  amount: composition.fixedQuantity,
27761
27964
  creditName: getFeatureName(
27762
27965
  group,
27966
+ locale,
27763
27967
  composition.fixedQuantity
27764
27968
  ),
27765
27969
  period: t2(
@@ -27770,7 +27974,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27770
27974
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27771
27975
  group.total.value,
27772
27976
  " ",
27773
- getFeatureName(group, group.total.value),
27977
+ getFeatureName(group, locale, group.total.value),
27774
27978
  " ",
27775
27979
  subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27776
27980
  t2("per"),
@@ -27813,6 +28017,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27813
28017
  quantity: licenseQuantity,
27814
28018
  licenseName: getFeatureName(
27815
28019
  licenseFeature,
28020
+ locale,
27816
28021
  licenseQuantity
27817
28022
  ),
27818
28023
  perUnit: perLicenseGrant.amount,
@@ -27820,6 +28025,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27820
28025
  total: resolvedTotal,
27821
28026
  creditName: getFeatureName(
27822
28027
  group,
28028
+ locale,
27823
28029
  resolvedTotal
27824
28030
  ),
27825
28031
  period: shortenPeriod(creditPeriod, t2)
@@ -27827,12 +28033,14 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27827
28033
  quantity: licenseQuantity,
27828
28034
  licenseName: getFeatureName(
27829
28035
  licenseFeature,
28036
+ locale,
27830
28037
  licenseQuantity
27831
28038
  ),
27832
28039
  perUnit: perLicenseGrant.amount,
27833
28040
  total: resolvedTotal,
27834
28041
  creditName: getFeatureName(
27835
28042
  group,
28043
+ locale,
27836
28044
  resolvedTotal
27837
28045
  ),
27838
28046
  period: shortenPeriod(creditPeriod, t2)
@@ -27874,7 +28082,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27874
28082
  if (!autoTopupEnabled) {
27875
28083
  acc.push(
27876
28084
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { $leading: "tight", children: t2("Auto top-up disabled for token", {
27877
- unit: getFeatureName(grant.credit, 1)
28085
+ unit: getFeatureName(grant.credit, locale, 1)
27878
28086
  }) }, grant.id)
27879
28087
  );
27880
28088
  return acc;
@@ -27886,6 +28094,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27886
28094
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { $leading: "tight", children: t2("Adds X tokens when Y remaining in balance", {
27887
28095
  unit: getFeatureName(
27888
28096
  grant.credit,
28097
+ locale,
27889
28098
  autoTopupAmount
27890
28099
  ),
27891
28100
  amount: autoTopupAmount,
@@ -27945,7 +28154,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27945
28154
  " (",
27946
28155
  group.quantity,
27947
28156
  " ",
27948
- getFeatureName(group, group.quantity),
28157
+ getFeatureName(group, locale, group.quantity),
27949
28158
  ")"
27950
28159
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27951
28160
  group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { style: { opacity: 0.5 }, children: [
@@ -27956,7 +28165,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
27956
28165
  ] }),
27957
28166
  group.quantity,
27958
28167
  " ",
27959
- getFeatureName(group, group.quantity)
28168
+ getFeatureName(group, locale, group.quantity)
27960
28169
  ] }),
27961
28170
  group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27962
28171
  Text,
@@ -28016,12 +28225,12 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
28016
28225
  " (",
28017
28226
  group.quantity,
28018
28227
  " ",
28019
- getFeatureName(group, group.quantity),
28228
+ getFeatureName(group, locale, group.quantity),
28020
28229
  ")"
28021
28230
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { display: props.addOns.fontStyle, children: [
28022
28231
  group.quantity,
28023
28232
  " ",
28024
- getFeatureName(group, group.quantity)
28233
+ getFeatureName(group, locale, group.quantity)
28025
28234
  ] }),
28026
28235
  group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
28027
28236
  Text,
@@ -28072,7 +28281,7 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
28072
28281
  /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { display: props.addOns.fontStyle, children: [
28073
28282
  group.quantity,
28074
28283
  " ",
28075
- getFeatureName(group, group.quantity)
28284
+ getFeatureName(group, locale, group.quantity)
28076
28285
  ] }),
28077
28286
  group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
28078
28287
  Text,
@@ -28123,10 +28332,10 @@ var PlanManager = (0, import_react50.forwardRef)(({ children, className, portal,
28123
28332
  PlanManager.displayName = "PlanManager";
28124
28333
 
28125
28334
  // src/components/elements/pricing-table/PricingTable.tsx
28126
- var import_react53 = require("react");
28335
+ var import_react54 = require("react");
28127
28336
 
28128
28337
  // src/components/elements/pricing-table/AddOn.tsx
28129
- var import_react51 = require("react");
28338
+ var import_react52 = require("react");
28130
28339
  var import_jsx_runtime65 = require("react/jsx-runtime");
28131
28340
  function renderMeteredEntitlementPricing2({
28132
28341
  priceBehavior,
@@ -28145,6 +28354,7 @@ function renderMeteredEntitlementPricing2({
28145
28354
  "/",
28146
28355
  feature ? getFeatureName(
28147
28356
  feature,
28357
+ locale,
28148
28358
  packageSize
28149
28359
  ) : featureName || "unit"
28150
28360
  ] });
@@ -28162,6 +28372,7 @@ function renderMeteredEntitlementPricing2({
28162
28372
  ] }),
28163
28373
  feature ? getFeatureName(
28164
28374
  feature,
28375
+ locale,
28165
28376
  packageSize
28166
28377
  ) : featureName || "unit"
28167
28378
  ] });
@@ -28182,7 +28393,7 @@ var AddOn2 = ({
28182
28393
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
28183
28394
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
28184
28395
  const isLightBackground = useIsLightBackground();
28185
- const { currentAddOns, canCheckout, isStandalone } = (0, import_react51.useMemo)(() => {
28396
+ const { currentAddOns, canCheckout, isStandalone } = (0, import_react52.useMemo)(() => {
28186
28397
  const isStandalone2 = typeof data?.component === "undefined";
28187
28398
  return {
28188
28399
  currentAddOns: data?.company?.addOns || [],
@@ -28351,7 +28562,7 @@ var AddOn2 = ({
28351
28562
  {
28352
28563
  $flexDirection: "column",
28353
28564
  $justifyContent: "center",
28354
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: getFeatureName(entitlement.feature) })
28565
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: getFeatureName(entitlement.feature, locale) })
28355
28566
  }
28356
28567
  )
28357
28568
  ] }),
@@ -28451,7 +28662,7 @@ var AddOn2 = ({
28451
28662
  };
28452
28663
 
28453
28664
  // src/components/elements/pricing-table/Plan.tsx
28454
- var import_react52 = require("react");
28665
+ var import_react53 = require("react");
28455
28666
 
28456
28667
  // src/components/elements/pricing-table/Entitlement.tsx
28457
28668
  var import_jsx_runtime66 = require("react/jsx-runtime");
@@ -28513,7 +28724,11 @@ var Entitlement2 = ({
28513
28724
  formatNumber(entitlementPackageSize, { locale }),
28514
28725
  " "
28515
28726
  ] }),
28516
- getFeatureName(entitlement.feature, entitlementPackageSize),
28727
+ getFeatureName(
28728
+ entitlement.feature,
28729
+ locale,
28730
+ entitlementPackageSize
28731
+ ),
28517
28732
  entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28518
28733
  " ",
28519
28734
  t2("per"),
@@ -28531,12 +28746,13 @@ var Entitlement2 = ({
28531
28746
  " ",
28532
28747
  getFeatureName(
28533
28748
  entitlement.valueCredit,
28749
+ locale,
28534
28750
  entitlement.consumptionRate
28535
28751
  ),
28536
28752
  " ",
28537
28753
  t2("per"),
28538
28754
  " ",
28539
- getFeatureName(entitlement.feature, 1)
28755
+ getFeatureName(entitlement.feature, locale, 1)
28540
28756
  ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, { children: creditBasedEntitlementLimit?.period ? t2("Up to X units per period", {
28541
28757
  amount: formatNumber(
28542
28758
  creditBasedEntitlementLimit.limit,
@@ -28544,9 +28760,12 @@ var Entitlement2 = ({
28544
28760
  ),
28545
28761
  units: getFeatureName(
28546
28762
  entitlement.feature,
28763
+ locale,
28547
28764
  creditBasedEntitlementLimit.limit
28548
28765
  ),
28549
- period: creditBasedEntitlementLimit.period
28766
+ period: t2(
28767
+ creditBasedEntitlementLimit.period
28768
+ )
28550
28769
  }) : t2("Up to X units", {
28551
28770
  amount: formatNumber(
28552
28771
  creditBasedEntitlementLimit.limit,
@@ -28554,17 +28773,18 @@ var Entitlement2 = ({
28554
28773
  ),
28555
28774
  units: getFeatureName(
28556
28775
  entitlement.feature,
28776
+ locale,
28557
28777
  creditBasedEntitlementLimit.limit
28558
28778
  )
28559
28779
  }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28560
28780
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t2("Unlimited", {
28561
- item: getFeatureName(entitlement.feature)
28781
+ item: getFeatureName(entitlement.feature, locale)
28562
28782
  }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28563
28783
  typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28564
28784
  formatNumber(limit, { locale }),
28565
28785
  " "
28566
28786
  ] }),
28567
- getFeatureName(entitlement.feature, limit)
28787
+ getFeatureName(entitlement.feature, locale, limit)
28568
28788
  ] }),
28569
28789
  metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28570
28790
  " ",
@@ -28593,6 +28813,7 @@ var Entitlement2 = ({
28593
28813
  ] }),
28594
28814
  getFeatureName(
28595
28815
  entitlement.feature,
28816
+ locale,
28596
28817
  entitlementPackageSize
28597
28818
  ),
28598
28819
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
@@ -28664,7 +28885,7 @@ var Plan2 = ({
28664
28885
  const { data, settings, setCheckoutState } = useEmbed();
28665
28886
  const isLightBackground = useIsLightBackground();
28666
28887
  const trialEnd = useTrialEnd();
28667
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react52.useState)({});
28888
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react53.useState)({});
28668
28889
  const handleToggleShowAll = (id) => {
28669
28890
  setEntitlementVisibility((prev) => {
28670
28891
  const updated = !(prev[id] ?? false);
@@ -29002,11 +29223,11 @@ var resolveDesignProps8 = (props) => {
29002
29223
  }
29003
29224
  };
29004
29225
  };
29005
- var PricingTable = (0, import_react53.forwardRef)(({ className, ...rest }, ref) => {
29226
+ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref) => {
29006
29227
  const props = resolveDesignProps8(rest);
29007
29228
  const { t: t2 } = useTranslation();
29008
29229
  const { data, settings, isPending, hydratePublic, currencyFilter } = useEmbed();
29009
- const getCallToActionTarget = (0, import_react53.useCallback)(
29230
+ const getCallToActionTarget = (0, import_react54.useCallback)(
29010
29231
  (url, target) => {
29011
29232
  if (target) {
29012
29233
  return target;
@@ -29024,11 +29245,11 @@ var PricingTable = (0, import_react53.forwardRef)(({ className, ...rest }, ref)
29024
29245
  },
29025
29246
  []
29026
29247
  );
29027
- const [selectedPeriod, setSelectedPeriod] = (0, import_react53.useState)(
29248
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react54.useState)(
29028
29249
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
29029
29250
  );
29030
29251
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
29031
- const [selectedCurrency, setSelectedCurrency] = (0, import_react53.useState)(
29252
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react54.useState)(
29032
29253
  () => currencies[0] ?? DEFAULT_CURRENCY
29033
29254
  );
29034
29255
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -29046,19 +29267,19 @@ var PricingTable = (0, import_react53.forwardRef)(({ className, ...rest }, ref)
29046
29267
  } = useAvailablePlans(selectedPeriod, {
29047
29268
  useSelectedPeriod: showPeriodToggle
29048
29269
  });
29049
- const plans = (0, import_react53.useMemo)(
29270
+ const plans = (0, import_react54.useMemo)(
29050
29271
  () => hasCurrency ? allPlans.filter(
29051
29272
  (plan) => planSupportsCurrency(plan, selectedCurrency)
29052
29273
  ) : allPlans,
29053
29274
  [allPlans, hasCurrency, selectedCurrency]
29054
29275
  );
29055
- const addOns = (0, import_react53.useMemo)(
29276
+ const addOns = (0, import_react54.useMemo)(
29056
29277
  () => hasCurrency ? allAddOns.filter(
29057
29278
  (addOn) => planSupportsCurrency(addOn, selectedCurrency)
29058
29279
  ) : allAddOns,
29059
29280
  [allAddOns, hasCurrency, selectedCurrency]
29060
29281
  );
29061
- (0, import_react53.useEffect)(() => {
29282
+ (0, import_react54.useEffect)(() => {
29062
29283
  if (typeof data?.component === "undefined") {
29063
29284
  hydratePublic();
29064
29285
  }
@@ -29072,7 +29293,7 @@ var PricingTable = (0, import_react53.forwardRef)(({ className, ...rest }, ref)
29072
29293
  $alignItems: "center",
29073
29294
  $justifyContent: "center",
29074
29295
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
29075
- children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
29296
+ children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Loader, { "aria-label": t2("Loading"), $size: "2xl" })
29076
29297
  }
29077
29298
  );
29078
29299
  }
@@ -29085,7 +29306,7 @@ var PricingTable = (0, import_react53.forwardRef)(({ className, ...rest }, ref)
29085
29306
  rest.callToActionUrl,
29086
29307
  rest.callToActionTarget
29087
29308
  );
29088
- const Wrapper = typeof data?.component === "undefined" ? Container : import_react53.Fragment;
29309
+ const Wrapper = typeof data?.component === "undefined" ? Container : import_react54.Fragment;
29089
29310
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
29090
29311
  FussyChild,
29091
29312
  {
@@ -29239,7 +29460,7 @@ var PricingTable = (0, import_react53.forwardRef)(({ className, ...rest }, ref)
29239
29460
  PricingTable.displayName = "PricingTable";
29240
29461
 
29241
29462
  // src/components/elements/text/Text.tsx
29242
- var import_react54 = require("react");
29463
+ var import_react55 = require("react");
29243
29464
  var import_jsx_runtime69 = require("react/jsx-runtime");
29244
29465
  var resolveDesignProps9 = (props) => {
29245
29466
  return {
@@ -29250,7 +29471,7 @@ var resolveDesignProps9 = (props) => {
29250
29471
  }
29251
29472
  };
29252
29473
  };
29253
- var TextElement = (0, import_react54.forwardRef)(({ children, className, ...rest }, ref) => {
29474
+ var TextElement = (0, import_react55.forwardRef)(({ children, className, ...rest }, ref) => {
29254
29475
  const props = resolveDesignProps9(rest);
29255
29476
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
29256
29477
  Text,
@@ -29265,7 +29486,7 @@ var TextElement = (0, import_react54.forwardRef)(({ children, className, ...rest
29265
29486
  TextElement.displayName = "Text";
29266
29487
 
29267
29488
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
29268
- var import_react55 = require("react");
29489
+ var import_react56 = require("react");
29269
29490
  var import_jsx_runtime70 = require("react/jsx-runtime");
29270
29491
  var buttonStyles = {
29271
29492
  primary: {
@@ -29292,11 +29513,11 @@ var resolveDesignProps10 = (props) => {
29292
29513
  }
29293
29514
  };
29294
29515
  };
29295
- var UnsubscribeButton = (0, import_react55.forwardRef)(({ children, className, ...rest }, ref) => {
29516
+ var UnsubscribeButton = (0, import_react56.forwardRef)(({ children, className, ...rest }, ref) => {
29296
29517
  const props = resolveDesignProps10(rest);
29297
29518
  const { t: t2 } = useTranslation();
29298
29519
  const { data, setLayout } = useEmbed();
29299
- const hasActiveSubscription = (0, import_react55.useMemo)(() => {
29520
+ const hasActiveSubscription = (0, import_react56.useMemo)(() => {
29300
29521
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
29301
29522
  }, [data?.subscription]);
29302
29523
  if (!hasActiveSubscription) {
@@ -29331,7 +29552,7 @@ var UnsubscribeButton = (0, import_react55.forwardRef)(({ children, className, .
29331
29552
  UnsubscribeButton.displayName = "UnsubscribeButton";
29332
29553
 
29333
29554
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
29334
- var import_react56 = require("react");
29555
+ var import_react57 = require("react");
29335
29556
  var import_jsx_runtime71 = require("react/jsx-runtime");
29336
29557
  function resolveDesignProps11(props) {
29337
29558
  return {
@@ -29351,15 +29572,15 @@ function resolveDesignProps11(props) {
29351
29572
  }
29352
29573
  };
29353
29574
  }
29354
- var UpcomingBill = (0, import_react56.forwardRef)(({ className, ...rest }, ref) => {
29575
+ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref) => {
29355
29576
  const props = resolveDesignProps11(rest);
29356
29577
  const { t: t2, locale } = useTranslation();
29357
29578
  const { data, settings, getUpcomingInvoice } = useEmbed();
29358
29579
  const isLightBackground = useIsLightBackground();
29359
- const [isLoading, setIsLoading] = (0, import_react56.useState)(false);
29360
- const [error, setError] = (0, import_react56.useState)();
29361
- const [upcomingInvoice, setUpcomingInvoice] = (0, import_react56.useState)(data?.upcomingInvoice);
29362
- const discounts = (0, import_react56.useMemo)(() => {
29580
+ const [isLoading, setIsLoading] = (0, import_react57.useState)(false);
29581
+ const [error, setError] = (0, import_react57.useState)();
29582
+ const [upcomingInvoice, setUpcomingInvoice] = (0, import_react57.useState)(data?.upcomingInvoice);
29583
+ const discounts = (0, import_react57.useMemo)(() => {
29363
29584
  return (data?.subscription?.discounts || []).filter(
29364
29585
  (discount) => (
29365
29586
  // Only surface discounts that are currently active and actually
@@ -29377,7 +29598,7 @@ var UpcomingBill = (0, import_react56.forwardRef)(({ className, ...rest }, ref)
29377
29598
  durationInMonths: discount.durationInMonths ?? void 0
29378
29599
  }));
29379
29600
  }, [data?.subscription?.discounts]);
29380
- const getInvoice = (0, import_react56.useCallback)(async () => {
29601
+ const getInvoice = (0, import_react57.useCallback)(async () => {
29381
29602
  if (data?.component?.id && data?.subscription && !data.subscription.cancelAt) {
29382
29603
  try {
29383
29604
  setError(void 0);
@@ -29393,15 +29614,15 @@ var UpcomingBill = (0, import_react56.forwardRef)(({ className, ...rest }, ref)
29393
29614
  }
29394
29615
  }
29395
29616
  }, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
29396
- (0, import_react56.useEffect)(() => {
29617
+ (0, import_react57.useEffect)(() => {
29397
29618
  getInvoice();
29398
29619
  }, [getInvoice]);
29399
- (0, import_react56.useEffect)(() => {
29620
+ (0, import_react57.useEffect)(() => {
29400
29621
  if (data?.upcomingInvoice) {
29401
29622
  setUpcomingInvoice(data.upcomingInvoice);
29402
29623
  }
29403
29624
  }, [data?.upcomingInvoice]);
29404
- const { currency, applied, remaining } = (0, import_react56.useMemo)(() => {
29625
+ const { currency, applied, remaining } = (0, import_react57.useMemo)(() => {
29405
29626
  const currency2 = upcomingInvoice?.currency;
29406
29627
  const startingBalance = upcomingInvoice?.startingBalance ?? 0;
29407
29628
  const endingBalance = upcomingInvoice?.endingBalance ?? 0;
@@ -29415,6 +29636,7 @@ var UpcomingBill = (0, import_react56.forwardRef)(({ className, ...rest }, ref)
29415
29636
  upcomingInvoice?.endingBalance,
29416
29637
  upcomingInvoice?.subtotal
29417
29638
  ]);
29639
+ const { billDate, paymentDueDate } = useNextBillDate(upcomingInvoice ?? null);
29418
29640
  const hasApplied = applied > 0;
29419
29641
  const hasBalance = remaining > 0 || applied > 0;
29420
29642
  if (!data?.subscription || data.subscription.cancelAt) {
@@ -29446,10 +29668,21 @@ var UpcomingBill = (0, import_react56.forwardRef)(({ className, ...rest }, ref)
29446
29668
  ]
29447
29669
  }
29448
29670
  ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
29449
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { display: props.header.fontStyle, children: [
29450
- t2(props.header.prefix),
29451
- " ",
29452
- toPrettyDate(upcomingInvoice.dueDate, { locale })
29671
+ props.header.isVisible && upcomingInvoice.dueDate && billDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
29672
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { display: props.header.fontStyle, children: [
29673
+ t2(props.header.prefix),
29674
+ " ",
29675
+ toPrettyDate(billDate, { locale })
29676
+ ] }),
29677
+ paymentDueDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
29678
+ Text,
29679
+ {
29680
+ $size: 0.8125 * settings.theme.typography.text.fontSize,
29681
+ children: t2("Payment due", {
29682
+ date: toPrettyDate(paymentDueDate, { locale })
29683
+ })
29684
+ }
29685
+ )
29453
29686
  ] }),
29454
29687
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
29455
29688
  Flex,
@@ -32191,11 +32424,11 @@ function inflate(input, options = {}) {
32191
32424
  }
32192
32425
 
32193
32426
  // src/components/embed/Embed.tsx
32194
- var import_react58 = require("react");
32427
+ var import_react59 = require("react");
32195
32428
  var import_styled_components23 = __toESM(require_styled_components_cjs());
32196
32429
 
32197
32430
  // src/components/embed/renderer.ts
32198
- var import_react57 = require("react");
32431
+ var import_react58 = require("react");
32199
32432
  var components = {
32200
32433
  Root,
32201
32434
  Viewport,
@@ -32259,7 +32492,7 @@ function createRenderer(options) {
32259
32492
  const { className, ...rest } = props;
32260
32493
  const resolvedProps = component === "div" ? rest : props;
32261
32494
  const resolvedChildren = children.map(renderNode);
32262
- return (0, import_react57.createElement)(
32495
+ return (0, import_react58.createElement)(
32263
32496
  component,
32264
32497
  {
32265
32498
  key: index,
@@ -32290,6 +32523,7 @@ var Loading = () => {
32290
32523
  };
32291
32524
  var Error2 = ({ message }) => {
32292
32525
  const { settings } = useEmbed();
32526
+ const { t: t2 } = useTranslation();
32293
32527
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
32294
32528
  Flex,
32295
32529
  {
@@ -32301,14 +32535,15 @@ var Error2 = ({ message }) => {
32301
32535
  $alignItems: "center",
32302
32536
  $justifyContent: "center",
32303
32537
  children: [
32304
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { display: "heading1", children: "Error" }) }),
32538
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { display: "heading1", children: t2("Error") }) }),
32305
32539
  /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { children: message }) })
32306
32540
  ]
32307
32541
  }
32308
32542
  );
32309
32543
  };
32310
32544
  var SchematicEmbed = ({ id, accessToken }) => {
32311
- const theme = (0, import_react58.useContext)(import_styled_components23.ThemeContext);
32545
+ const theme = (0, import_react59.useContext)(import_styled_components23.ThemeContext);
32546
+ const { t: t2 } = useTranslation();
32312
32547
  const {
32313
32548
  data,
32314
32549
  error,
@@ -32320,7 +32555,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
32320
32555
  setBuilderSettings
32321
32556
  } = useEmbed();
32322
32557
  const compressedAst = data?.component?.ast;
32323
- const { children, parsedSettings, parseError } = (0, import_react58.useMemo)(() => {
32558
+ const { children, parsedSettings, parseError } = (0, import_react59.useMemo)(() => {
32324
32559
  let children2 = null;
32325
32560
  let parsedSettings2 = null;
32326
32561
  let parseError2 = null;
@@ -32352,22 +32587,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
32352
32587
  parseError: parseError2
32353
32588
  };
32354
32589
  }, [compressedAst]);
32355
- (0, import_react58.useEffect)(() => {
32590
+ (0, import_react59.useEffect)(() => {
32356
32591
  if (accessToken) {
32357
32592
  setAccessToken(accessToken);
32358
32593
  }
32359
32594
  }, [accessToken, setAccessToken]);
32360
- (0, import_react58.useEffect)(() => {
32595
+ (0, import_react59.useEffect)(() => {
32361
32596
  if (id && stale) {
32362
32597
  hydrateComponent(id);
32363
32598
  }
32364
32599
  }, [id, hydrateComponent, stale]);
32365
- (0, import_react58.useEffect)(() => {
32600
+ (0, import_react59.useEffect)(() => {
32366
32601
  if (parsedSettings) {
32367
32602
  setBuilderSettings(parsedSettings);
32368
32603
  }
32369
32604
  }, [parsedSettings, setBuilderSettings]);
32370
- (0, import_react58.useEffect)(() => {
32605
+ (0, import_react59.useEffect)(() => {
32371
32606
  if (parseError) {
32372
32607
  setError(parseError);
32373
32608
  }
@@ -32379,13 +32614,15 @@ var SchematicEmbed = ({ id, accessToken }) => {
32379
32614
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Error2, { message: error.message });
32380
32615
  }
32381
32616
  if (accessToken?.length === 0) {
32382
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Error2, { message: "Please provide an access token." });
32617
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Error2, { message: t2("Please provide an access token.") });
32383
32618
  }
32384
32619
  if (!accessToken?.startsWith("token_")) {
32385
32620
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
32386
32621
  Error2,
32387
32622
  {
32388
- message: 'Invalid access token; your temporary access token will start with "token_".'
32623
+ message: t2(
32624
+ "Invalid access token; your temporary access token will start with `token_`."
32625
+ )
32389
32626
  }
32390
32627
  );
32391
32628
  }