@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.
@@ -1867,6 +1867,7 @@ __export(index_exports, {
1867
1867
  useCustomPlanBilling: () => useCustomPlanBilling,
1868
1868
  useEmbed: () => useEmbed,
1869
1869
  useIsLightBackground: () => useIsLightBackground,
1870
+ useNextBillDate: () => useNextBillDate,
1870
1871
  usePaymentConfirmation: () => usePaymentConfirmation,
1871
1872
  useRequest: () => useRequest,
1872
1873
  useSubscriptionCurrency: () => useSubscriptionCurrency,
@@ -1877,10 +1878,10 @@ __export(index_exports, {
1877
1878
  module.exports = __toCommonJS(index_exports);
1878
1879
 
1879
1880
  // src/components/elements/button/Button.tsx
1880
- var import_react41 = require("react");
1881
+ var import_react42 = require("react");
1881
1882
 
1882
1883
  // src/components/layout/card/Card.tsx
1883
- var import_react20 = require("react");
1884
+ var import_react21 = require("react");
1884
1885
 
1885
1886
  // src/const/components.ts
1886
1887
  var VISIBLE_CREDIT_COUNT = 3;
@@ -3973,6 +3974,10 @@ function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
3973
3974
  }
3974
3975
 
3975
3976
  // src/api/checkoutexternal/models/BillingCollectionMethod.ts
3977
+ var BillingCollectionMethod = {
3978
+ ChargeAutomatically: "charge_automatically",
3979
+ SendInvoice: "send_invoice"
3980
+ };
3976
3981
  function BillingCollectionMethodFromJSON(json) {
3977
3982
  return BillingCollectionMethodFromJSONTyped(json, false);
3978
3983
  }
@@ -6072,6 +6077,48 @@ function CompanyOverrideResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6072
6077
  };
6073
6078
  }
6074
6079
 
6080
+ // src/api/checkoutexternal/models/CompanyPaymentMethodResponseData.ts
6081
+ function CompanyPaymentMethodResponseDataFromJSON(json) {
6082
+ return CompanyPaymentMethodResponseDataFromJSONTyped(json, false);
6083
+ }
6084
+ function CompanyPaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6085
+ if (json == null) {
6086
+ return json;
6087
+ }
6088
+ return {
6089
+ accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
6090
+ accountName: json["account_name"] == null ? void 0 : json["account_name"],
6091
+ bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
6092
+ billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
6093
+ billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
6094
+ canRemove: json["can_remove"],
6095
+ cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
6096
+ cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
6097
+ cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
6098
+ cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
6099
+ externalId: json["external_id"],
6100
+ id: json["id"],
6101
+ isDefault: json["is_default"],
6102
+ type: json["type"]
6103
+ };
6104
+ }
6105
+
6106
+ // src/api/checkoutexternal/models/CompanyPaymentMethodsResponseData.ts
6107
+ function CompanyPaymentMethodsResponseDataFromJSON(json) {
6108
+ return CompanyPaymentMethodsResponseDataFromJSONTyped(json, false);
6109
+ }
6110
+ function CompanyPaymentMethodsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6111
+ if (json == null) {
6112
+ return json;
6113
+ }
6114
+ return {
6115
+ count: json["count"],
6116
+ paymentMethods: json["payment_methods"].map(
6117
+ CompanyPaymentMethodResponseDataFromJSON
6118
+ )
6119
+ };
6120
+ }
6121
+
6075
6122
  // src/api/checkoutexternal/models/CompanyPlanInvalidReason.ts
6076
6123
  var CompanyPlanInvalidReason = {
6077
6124
  DowngradeNotPermitted: "downgrade_not_permitted",
@@ -7475,6 +7522,20 @@ function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
7475
7522
  };
7476
7523
  }
7477
7524
 
7525
+ // src/api/checkoutexternal/models/GetCompanyPaymentMethodsResponse.ts
7526
+ function GetCompanyPaymentMethodsResponseFromJSON(json) {
7527
+ return GetCompanyPaymentMethodsResponseFromJSONTyped(json, false);
7528
+ }
7529
+ function GetCompanyPaymentMethodsResponseFromJSONTyped(json, ignoreDiscriminator) {
7530
+ if (json == null) {
7531
+ return json;
7532
+ }
7533
+ return {
7534
+ data: CompanyPaymentMethodsResponseDataFromJSON(json["data"]),
7535
+ params: json["params"]
7536
+ };
7537
+ }
7538
+
7478
7539
  // src/api/checkoutexternal/models/GetCompanyUpcomingInvoiceResponse.ts
7479
7540
  function GetCompanyUpcomingInvoiceResponseFromJSON(json) {
7480
7541
  return GetCompanyUpcomingInvoiceResponseFromJSONTyped(json, false);
@@ -8369,6 +8430,38 @@ var CheckoutexternalApi = class extends BaseAPI {
8369
8430
  );
8370
8431
  return await response.value();
8371
8432
  }
8433
+ /**
8434
+ * Get company payment methods
8435
+ */
8436
+ async getCompanyPaymentMethodsRaw(initOverrides) {
8437
+ const queryParameters = {};
8438
+ const headerParameters = {};
8439
+ if (this.configuration && this.configuration.apiKey) {
8440
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8441
+ "X-Schematic-Api-Key"
8442
+ );
8443
+ }
8444
+ const response = await this.request(
8445
+ {
8446
+ path: `/company/payment-methods`,
8447
+ method: "GET",
8448
+ headers: headerParameters,
8449
+ query: queryParameters
8450
+ },
8451
+ initOverrides
8452
+ );
8453
+ return new JSONApiResponse(
8454
+ response,
8455
+ (jsonValue) => GetCompanyPaymentMethodsResponseFromJSON(jsonValue)
8456
+ );
8457
+ }
8458
+ /**
8459
+ * Get company payment methods
8460
+ */
8461
+ async getCompanyPaymentMethods(initOverrides) {
8462
+ const response = await this.getCompanyPaymentMethodsRaw(initOverrides);
8463
+ return await response.value();
8464
+ }
8372
8465
  /**
8373
8466
  * Get company upcoming invoice
8374
8467
  */
@@ -13223,6 +13316,7 @@ var en = {
13223
13316
  "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.",
13224
13317
  "An unknown error occurred.": "An unknown error occurred.",
13225
13318
  "Billed": "Billed {{period}}",
13319
+ "Billing threshold": "Billing threshold",
13226
13320
  "Bundle selected": "Bundle selected",
13227
13321
  "Buy credits": "Buy credits",
13228
13322
  "Cancel": "Cancel",
@@ -13257,8 +13351,11 @@ var en = {
13257
13351
  "Due today": "Due today",
13258
13352
  "Edit payment details": "Edit payment details",
13259
13353
  "Edit": "Edit",
13354
+ "Email": "Email",
13260
13355
  "Ends on": "Ends on {{date}}",
13261
13356
  "Enter discount code": "Enter discount code",
13357
+ "Enter email address": "Enter email address",
13358
+ "Error": "Error",
13262
13359
  "Error initializing payment method change. Please try again.": "Error initializing payment method change. Please try again.",
13263
13360
  "Error processing payment. Please try a different payment method.": "Error processing payment. Please try a different payment method.",
13264
13361
  "Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
@@ -13279,6 +13376,7 @@ var en = {
13279
13376
  "Invoice credit tooltip": "Credit \u2014 this amount was returned to your account, typically due to a plan change or proration",
13280
13377
  "Invoice charge tooltip": "Charge \u2014 you were billed this amount",
13281
13378
  "Invoices": "Invoices",
13379
+ "Limit": "Limit",
13282
13380
  "Limit of": "Limit of {{amount}}",
13283
13381
  "Loading": "Loading",
13284
13382
  "Manage plan": "Manage plan",
@@ -13301,8 +13399,11 @@ var en = {
13301
13399
  "Error saving custom field values. Please try again.": "Error saving custom field values. Please try again.",
13302
13400
  "Pay now": "Pay now",
13303
13401
  "Payment Details": "Payment Details",
13402
+ "Payment due": "Payment due {{date}}",
13304
13403
  "Plan selected": "Plan selected",
13305
13404
  "Please accept the agreement to continue.": "Please accept the agreement to continue.",
13405
+ "Please try again later.": "Please try again later.",
13406
+ "Portal not found": "Portal not found",
13306
13407
  "Plan": "Plan",
13307
13408
  "Plans": "Plans",
13308
13409
  "Please provide an access token.": "Please provide an access token.",
@@ -13354,6 +13455,7 @@ var en = {
13354
13455
  "There was a problem retrieving your upcoming invoice.": "There was a problem retrieving your upcoming invoice.",
13355
13456
  "There was a problem retrieving your invoices.": "There was a problem retrieving your invoices.",
13356
13457
  "Tier-based": "Tier-based",
13458
+ "Tiered pricing": "Tiered pricing",
13357
13459
  "Tiers apply progressively as quantity increases.": "Tiers apply progressively as quantity increases.",
13358
13460
  "Top up balance with:": "Top up balance with:",
13359
13461
  "Top-ups": "Top-ups",
@@ -13427,6 +13529,15 @@ var en = {
13427
13529
  "$X/unit/period": "{{cost}}/{{unit}}/{{period}}",
13428
13530
  "$X/Y units/period": "{{cost}}/{{size}} {{units}}/{{period}}",
13429
13531
  "day": "day",
13532
+ "day_one": "day",
13533
+ "day_other": "days",
13534
+ "hour_one": "hour",
13535
+ "hour_other": "hours",
13536
+ "minute_one": "minute",
13537
+ "minute_other": "minutes",
13538
+ "second_one": "second",
13539
+ "second_other": "seconds",
13540
+ "week": "week",
13430
13541
  "month": "month",
13431
13542
  "quarter": "quarter",
13432
13543
  "year": "year",
@@ -13435,6 +13546,13 @@ var en = {
13435
13546
  "yr": "yr",
13436
13547
  "one time": "one time",
13437
13548
  "billing period": "billing period",
13549
+ "billing period_one": "billing period",
13550
+ "billing period_other": "billing periods",
13551
+ "daily": "daily",
13552
+ "weekly": "weekly",
13553
+ "monthly": "monthly",
13554
+ "quarterly": "quarterly",
13555
+ "yearly": "yearly",
13438
13556
  "expires after purchase": "expires {{amount}} {{unit}} after purchase",
13439
13557
  "expires at the end of the billing period": "expires at the end of the billing period",
13440
13558
  "expires at the end of the next billing period": "expires at the end of the next billing period",
@@ -14124,11 +14242,9 @@ function formatBundleExpiry(bundle, t3) {
14124
14242
  if (typeof bundle.expiryUnitCount !== "number") {
14125
14243
  return void 0;
14126
14244
  }
14127
- const unit = bundle.expiryUnit === BillingCreditExpiryUnit.BillingPeriods ? t3("billing period") : t3("day");
14128
- return t3("expires after purchase", {
14129
- amount: bundle.expiryUnitCount,
14130
- unit: pluralize(unit, bundle.expiryUnitCount)
14131
- });
14245
+ const count = bundle.expiryUnitCount;
14246
+ const unit = bundle.expiryUnit === BillingCreditExpiryUnit.BillingPeriods ? t3("billing period", { count }) : t3("day", { count });
14247
+ return t3("expires after purchase", { amount: count, unit });
14132
14248
  }
14133
14249
  case BillingCreditExpiryType.EndOfBillingPeriod:
14134
14250
  return t3("expires at the end of the billing period");
@@ -14373,16 +14489,33 @@ function entitlementHasHardLimit(entitlement) {
14373
14489
  }
14374
14490
 
14375
14491
  // src/utils/api/feature.ts
14376
- function getFeatureName(feature, count = 0, ignore = false) {
14377
- const shouldBePlural = count === 0 || count > 1;
14492
+ function isEnglish(locale) {
14493
+ try {
14494
+ return new Intl.Locale(locale).language === "en";
14495
+ } catch {
14496
+ return true;
14497
+ }
14498
+ }
14499
+ function isOne(count, locale) {
14500
+ return new Intl.PluralRules(locale).select(count) === "one";
14501
+ }
14502
+ function getFeatureName(feature, locale, count, ignore = false) {
14503
+ if (!isEnglish(locale)) {
14504
+ const named = ignore ? { name: feature.name } : feature;
14505
+ const singularName2 = named.singularName || named.name;
14506
+ const pluralName2 = named.pluralName || singularName2;
14507
+ return count !== void 0 && isOne(count, locale) ? singularName2 : pluralName2;
14508
+ }
14509
+ const resolvedCount = count ?? 0;
14510
+ const shouldBePlural = resolvedCount === 0 || resolvedCount > 1;
14378
14511
  const { name, singularName, pluralName } = feature;
14379
14512
  if (!ignore && pluralName && shouldBePlural) {
14380
14513
  return pluralName;
14381
14514
  }
14382
14515
  if (!ignore && singularName) {
14383
- return shouldBePlural ? pluralize(singularName, count) : singularName;
14516
+ return shouldBePlural ? pluralize(singularName, resolvedCount) : singularName;
14384
14517
  }
14385
- return pluralize(name, count);
14518
+ return pluralize(name, resolvedCount);
14386
14519
  }
14387
14520
 
14388
14521
  // src/utils/color.ts
@@ -14592,8 +14725,21 @@ function formatCurrency(amount, {
14592
14725
  function formatOrdinal(n2, t3) {
14593
14726
  return t3("Ordinal", { count: n2, ordinal: true });
14594
14727
  }
14595
- function adjectify(str) {
14596
- return `${str}ly`;
14728
+ function adjectify(period, t3) {
14729
+ switch (period) {
14730
+ case "day":
14731
+ return t3("daily");
14732
+ case "week":
14733
+ return t3("weekly");
14734
+ case "month":
14735
+ return t3("monthly");
14736
+ case "quarter":
14737
+ return t3("quarterly");
14738
+ case "year":
14739
+ return t3("yearly");
14740
+ default:
14741
+ return period;
14742
+ }
14597
14743
  }
14598
14744
  var CURRENCY_FLAGS = {
14599
14745
  usd: "\u{1F1FA}\u{1F1F8}",
@@ -14709,11 +14855,12 @@ function getBillingPreviewText({
14709
14855
  );
14710
14856
  }
14711
14857
  const schedule = scheduleParts.length > 0 ? `${scheduleParts.join(" ")} ` : "";
14858
+ const period = t3(planPeriod);
14712
14859
  if (!discount) {
14713
14860
  return t3("You will be billed", {
14714
14861
  price: subscriptionPrice,
14715
14862
  usage,
14716
- period: planPeriod,
14863
+ period,
14717
14864
  schedule
14718
14865
  });
14719
14866
  }
@@ -14722,7 +14869,7 @@ function getBillingPreviewText({
14722
14869
  return t3("You will be billed", {
14723
14870
  price: discountedPrice,
14724
14871
  usage,
14725
- period: planPeriod,
14872
+ period,
14726
14873
  schedule
14727
14874
  });
14728
14875
  }
@@ -14730,7 +14877,7 @@ function getBillingPreviewText({
14730
14877
  return t3("You will be billed with discount window", {
14731
14878
  price: discountedPrice,
14732
14879
  usage,
14733
- period: planPeriod,
14880
+ period,
14734
14881
  schedule,
14735
14882
  window: t3("for the next months", { count: durationInMonths }),
14736
14883
  fullPrice: subscriptionPrice
@@ -14739,7 +14886,7 @@ function getBillingPreviewText({
14739
14886
  return t3("You will be billed next bill discount", {
14740
14887
  price: discountedPrice,
14741
14888
  usage,
14742
- period: planPeriod,
14889
+ period,
14743
14890
  schedule,
14744
14891
  fullPrice: subscriptionPrice
14745
14892
  });
@@ -15514,7 +15661,7 @@ var reducer = (state, action) => {
15514
15661
  // src/context/EmbedProvider.tsx
15515
15662
  var import_jsx_runtime4 = require("react/jsx-runtime");
15516
15663
  var getCustomHeaders = (sessionId) => ({
15517
- "X-Schematic-Components-Version": "2.28.0",
15664
+ "X-Schematic-Components-Version": "2.29.1",
15518
15665
  "X-Schematic-Session-ID": sessionId
15519
15666
  });
15520
15667
  var normalizeCurrencyFilter = (filter2) => {
@@ -16300,8 +16447,31 @@ function useIsLightBackground() {
16300
16447
  return isLightBackground;
16301
16448
  }
16302
16449
 
16303
- // src/hooks/usePaymentConfirmation.ts
16450
+ // src/hooks/useNextBillDate.ts
16304
16451
  var import_react11 = require("react");
16452
+ function useNextBillDate(upcomingInvoice) {
16453
+ const { data } = useEmbed();
16454
+ const invoice = upcomingInvoice === void 0 ? data?.upcomingInvoice : upcomingInvoice;
16455
+ const subscription = data?.company?.billingSubscription;
16456
+ const cancelAtPeriodEnd = subscription?.cancelAtPeriodEnd;
16457
+ const periodEnd = subscription?.periodEnd;
16458
+ const collectionMethod = invoice?.collectionMethod;
16459
+ const dueDate = invoice?.dueDate ?? void 0;
16460
+ return (0, import_react11.useMemo)(() => {
16461
+ if (cancelAtPeriodEnd) {
16462
+ return { billDate: void 0, paymentDueDate: void 0 };
16463
+ }
16464
+ const billDate = periodEnd && periodEnd > 0 ? new Date(periodEnd * 1e3) : dueDate;
16465
+ const hasSeparateDeadline = collectionMethod === BillingCollectionMethod.SendInvoice && dueDate && billDate && new Date(dueDate).toDateString() !== new Date(billDate).toDateString();
16466
+ return {
16467
+ billDate,
16468
+ paymentDueDate: hasSeparateDeadline ? dueDate : void 0
16469
+ };
16470
+ }, [cancelAtPeriodEnd, periodEnd, collectionMethod, dueDate]);
16471
+ }
16472
+
16473
+ // src/hooks/usePaymentConfirmation.ts
16474
+ var import_react12 = require("react");
16305
16475
  var usePaymentConfirmation = ({
16306
16476
  stripe,
16307
16477
  clientSecret,
@@ -16309,24 +16479,24 @@ var usePaymentConfirmation = ({
16309
16479
  onError: onError3,
16310
16480
  autoConfirm = false
16311
16481
  }) => {
16312
- const [state, setState] = (0, import_react11.useState)(() => ({
16482
+ const [state, setState] = (0, import_react12.useState)(() => ({
16313
16483
  secret: clientSecret,
16314
16484
  status: "idle",
16315
16485
  error: null
16316
16486
  }));
16317
- const onSuccessRef = (0, import_react11.useRef)(onSuccess);
16318
- const onErrorRef = (0, import_react11.useRef)(onError3);
16319
- (0, import_react11.useEffect)(() => {
16487
+ const onSuccessRef = (0, import_react12.useRef)(onSuccess);
16488
+ const onErrorRef = (0, import_react12.useRef)(onError3);
16489
+ (0, import_react12.useEffect)(() => {
16320
16490
  onSuccessRef.current = onSuccess;
16321
16491
  onErrorRef.current = onError3;
16322
16492
  });
16323
- const confirmedSecrets = (0, import_react11.useRef)(/* @__PURE__ */ new Set());
16324
- const abortControllerRef = (0, import_react11.useRef)(null);
16493
+ const confirmedSecrets = (0, import_react12.useRef)(/* @__PURE__ */ new Set());
16494
+ const abortControllerRef = (0, import_react12.useRef)(null);
16325
16495
  const isCurrentSecret = state.secret === clientSecret;
16326
16496
  const status = isCurrentSecret ? state.status : "idle";
16327
16497
  const error = isCurrentSecret ? state.error : null;
16328
16498
  const isConfirming = status === "confirming";
16329
- const confirmPayment = (0, import_react11.useCallback)(async () => {
16499
+ const confirmPayment = (0, import_react12.useCallback)(async () => {
16330
16500
  if (!stripe || !clientSecret) {
16331
16501
  const err = new Error(
16332
16502
  "Missing required parameters: stripe instance or client secret"
@@ -16374,7 +16544,7 @@ var usePaymentConfirmation = ({
16374
16544
  abortControllerRef.current = null;
16375
16545
  }
16376
16546
  }, [stripe, clientSecret]);
16377
- const reset = (0, import_react11.useCallback)(() => {
16547
+ const reset = (0, import_react12.useCallback)(() => {
16378
16548
  if (clientSecret) {
16379
16549
  confirmedSecrets.current.delete(clientSecret);
16380
16550
  }
@@ -16384,12 +16554,12 @@ var usePaymentConfirmation = ({
16384
16554
  abortControllerRef.current = null;
16385
16555
  }
16386
16556
  }, [clientSecret]);
16387
- (0, import_react11.useEffect)(() => {
16557
+ (0, import_react12.useEffect)(() => {
16388
16558
  if (autoConfirm && status === "idle" && stripe && clientSecret) {
16389
16559
  queueMicrotask(confirmPayment);
16390
16560
  }
16391
16561
  }, [autoConfirm, stripe, clientSecret, status, confirmPayment]);
16392
- (0, import_react11.useEffect)(() => {
16562
+ (0, import_react12.useEffect)(() => {
16393
16563
  return () => {
16394
16564
  if (abortControllerRef.current) {
16395
16565
  abortControllerRef.current.abort();
@@ -16407,12 +16577,12 @@ var usePaymentConfirmation = ({
16407
16577
  };
16408
16578
 
16409
16579
  // src/hooks/useRequest.ts
16410
- var import_react12 = require("react");
16580
+ var import_react13 = require("react");
16411
16581
  function useRequest(fn) {
16412
- const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
16413
- const [error, setError] = (0, import_react12.useState)(null);
16414
- const [data, setData] = (0, import_react12.useState)(void 0);
16415
- const request = (0, import_react12.useCallback)(async () => {
16582
+ const [isLoading, setIsLoading] = (0, import_react13.useState)(false);
16583
+ const [error, setError] = (0, import_react13.useState)(null);
16584
+ const [data, setData] = (0, import_react13.useState)(void 0);
16585
+ const request = (0, import_react13.useCallback)(async () => {
16416
16586
  try {
16417
16587
  setError(null);
16418
16588
  setIsLoading(true);
@@ -16427,7 +16597,7 @@ function useRequest(fn) {
16427
16597
  setIsLoading(false);
16428
16598
  }
16429
16599
  }, [fn]);
16430
- const value = (0, import_react12.useMemo)(() => {
16600
+ const value = (0, import_react13.useMemo)(() => {
16431
16601
  const state = { isLoading, error, data };
16432
16602
  return [state, request];
16433
16603
  }, [isLoading, error, data, request]);
@@ -16435,10 +16605,11 @@ function useRequest(fn) {
16435
16605
  }
16436
16606
 
16437
16607
  // src/hooks/useTrialEnd.ts
16438
- var import_react13 = require("react");
16608
+ var import_react14 = require("react");
16439
16609
  function useTrialEnd() {
16440
16610
  const { data } = useEmbed();
16441
- const { endDate, amount, units } = (0, import_react13.useMemo)(() => {
16611
+ const { t: t3 } = useTranslation();
16612
+ const { endDate, amount, units } = (0, import_react14.useMemo)(() => {
16442
16613
  const billingSubscription = data?.company?.billingSubscription;
16443
16614
  const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
16444
16615
  let amount2;
@@ -16460,27 +16631,27 @@ function useTrialEnd() {
16460
16631
  amount2 = Math.floor(difference / SECONDS_IN_MS);
16461
16632
  unit = "second";
16462
16633
  }
16463
- units2 = pluralize(unit, amount2);
16634
+ units2 = t3(unit, { count: amount2 });
16464
16635
  }
16465
16636
  return { endDate: end, amount: amount2, units: units2 };
16466
- }, [data?.company?.billingSubscription]);
16637
+ }, [data?.company?.billingSubscription, t3]);
16467
16638
  return { endDate, amount, units };
16468
16639
  }
16469
16640
 
16470
16641
  // src/hooks/useTruncatedList.ts
16471
- var import_react14 = require("react");
16642
+ var import_react15 = require("react");
16472
16643
  function useTruncatedList(items, { limit }) {
16473
- const [isExpandedState, setIsExpanded] = (0, import_react14.useState)(false);
16644
+ const [isExpandedState, setIsExpanded] = (0, import_react15.useState)(false);
16474
16645
  const total = items.length;
16475
16646
  const canExpand = total > limit;
16476
16647
  const isExpanded = canExpand && isExpandedState;
16477
- const visibleItems = (0, import_react14.useMemo)(
16648
+ const visibleItems = (0, import_react15.useMemo)(
16478
16649
  () => canExpand && !isExpanded ? items.slice(0, limit) : items,
16479
16650
  [items, limit, canExpand, isExpanded]
16480
16651
  );
16481
- const toggle = (0, import_react14.useCallback)(() => setIsExpanded((prev2) => !prev2), []);
16482
- const expand = (0, import_react14.useCallback)(() => setIsExpanded(true), []);
16483
- const collapse = (0, import_react14.useCallback)(() => setIsExpanded(false), []);
16652
+ const toggle = (0, import_react15.useCallback)(() => setIsExpanded((prev2) => !prev2), []);
16653
+ const expand = (0, import_react15.useCallback)(() => setIsExpanded(true), []);
16654
+ const collapse = (0, import_react15.useCallback)(() => setIsExpanded(false), []);
16484
16655
  return {
16485
16656
  items: visibleItems,
16486
16657
  total,
@@ -16494,10 +16665,10 @@ function useTruncatedList(items, { limit }) {
16494
16665
  }
16495
16666
 
16496
16667
  // src/hooks/useWrapChildren.ts
16497
- var import_react15 = require("react");
16668
+ var import_react16 = require("react");
16498
16669
  function useWrapChildren(ref) {
16499
- const [shouldWrap, setShouldWrap] = (0, import_react15.useState)([]);
16500
- (0, import_react15.useLayoutEffect)(() => {
16670
+ const [shouldWrap, setShouldWrap] = (0, import_react16.useState)([]);
16671
+ (0, import_react16.useLayoutEffect)(() => {
16501
16672
  const rowShouldWrap = (parent) => [...parent.children].some(
16502
16673
  (el) => el instanceof HTMLElement && el.previousElementSibling instanceof HTMLElement && el.offsetLeft <= el.previousElementSibling.offsetLeft
16503
16674
  );
@@ -16951,7 +17122,7 @@ var Checkbox = gt.input.attrs({ type: "checkbox" })`
16951
17122
  `;
16952
17123
 
16953
17124
  // src/components/ui/dialog/Dialog.tsx
16954
- var import_react16 = require("react");
17125
+ var import_react17 = require("react");
16955
17126
 
16956
17127
  // src/components/ui/dialog/styles.ts
16957
17128
  var DialogContent = gt.div`
@@ -17018,7 +17189,7 @@ var Dialog = gt.dialog(
17018
17189
 
17019
17190
  // src/components/ui/dialog/Dialog.tsx
17020
17191
  var import_jsx_runtime5 = require("react/jsx-runtime");
17021
- var Dialog2 = (0, import_react16.forwardRef)(
17192
+ var Dialog2 = (0, import_react17.forwardRef)(
17022
17193
  ({
17023
17194
  children,
17024
17195
  isModal = true,
@@ -17028,9 +17199,9 @@ var Dialog2 = (0, import_react16.forwardRef)(
17028
17199
  onClose,
17029
17200
  ...rest
17030
17201
  }, outerRef) => {
17031
- const innerRef = (0, import_react16.useRef)(null);
17032
- (0, import_react16.useImperativeHandle)(outerRef, () => innerRef.current, []);
17033
- (0, import_react16.useLayoutEffect)(() => {
17202
+ const innerRef = (0, import_react17.useRef)(null);
17203
+ (0, import_react17.useImperativeHandle)(outerRef, () => innerRef.current, []);
17204
+ (0, import_react17.useLayoutEffect)(() => {
17034
17205
  if (!isModal) {
17035
17206
  return;
17036
17207
  }
@@ -17042,7 +17213,7 @@ var Dialog2 = (0, import_react16.forwardRef)(
17042
17213
  document.body.style.overflow = initialOverflowValue;
17043
17214
  };
17044
17215
  }, [isModal]);
17045
- const dialog = (0, import_react16.useMemo)(
17216
+ const dialog = (0, import_react17.useMemo)(
17046
17217
  () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17047
17218
  Dialog,
17048
17219
  {
@@ -17091,9 +17262,9 @@ var DialogClose = ({ onClose, ...rest }) => {
17091
17262
  };
17092
17263
 
17093
17264
  // src/components/ui/dialog/DialogContent.tsx
17094
- var import_react17 = require("react");
17265
+ var import_react18 = require("react");
17095
17266
  var import_jsx_runtime7 = require("react/jsx-runtime");
17096
- var DialogContent2 = (0, import_react17.forwardRef)(({ children }, ref) => {
17267
+ var DialogContent2 = (0, import_react18.forwardRef)(({ children }, ref) => {
17097
17268
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogContent, { ref, children });
17098
17269
  });
17099
17270
  DialogContent2.displayName = "DialogContent";
@@ -17284,7 +17455,7 @@ var Overlay = gt(Flex)(({ theme }) => {
17284
17455
  });
17285
17456
 
17286
17457
  // src/components/ui/progress-bar/ProgressBar.tsx
17287
- var import_react18 = require("react");
17458
+ var import_react19 = require("react");
17288
17459
  var import_jsx_runtime10 = require("react/jsx-runtime");
17289
17460
  var progressColorMap = [
17290
17461
  "blue",
@@ -17294,7 +17465,7 @@ var progressColorMap = [
17294
17465
  "red",
17295
17466
  "red"
17296
17467
  ];
17297
- var ProgressBar = (0, import_react18.forwardRef)(
17468
+ var ProgressBar = (0, import_react19.forwardRef)(
17298
17469
  ({
17299
17470
  progress,
17300
17471
  value,
@@ -17502,7 +17673,7 @@ var Toggle = gt.input.attrs({ type: "checkbox" })`
17502
17673
 
17503
17674
  // src/components/ui/tooltip/Tooltip.tsx
17504
17675
  var import_debounce3 = __toESM(require_debounce());
17505
- var import_react19 = require("react");
17676
+ var import_react20 = require("react");
17506
17677
  var import_react_dom = require("react-dom");
17507
17678
 
17508
17679
  // src/components/ui/tooltip/styles.ts
@@ -17672,10 +17843,10 @@ var Tooltip = ({
17672
17843
  position: position2 = "top",
17673
17844
  ...rest
17674
17845
  }) => {
17675
- const triggerRef = (0, import_react19.useRef)(null);
17676
- const [show, setShow] = (0, import_react19.useState)(false);
17677
- const [coords2, setCoords] = (0, import_react19.useState)({ x: 0, y: 0 });
17678
- const updateCoords = (0, import_react19.useCallback)(() => {
17846
+ const triggerRef = (0, import_react20.useRef)(null);
17847
+ const [show, setShow] = (0, import_react20.useState)(false);
17848
+ const [coords2, setCoords] = (0, import_react20.useState)({ x: 0, y: 0 });
17849
+ const updateCoords = (0, import_react20.useCallback)(() => {
17679
17850
  const coords3 = getCoords({
17680
17851
  element: triggerRef.current,
17681
17852
  portal,
@@ -17683,7 +17854,7 @@ var Tooltip = ({
17683
17854
  });
17684
17855
  setCoords(coords3);
17685
17856
  }, [portal, position2]);
17686
- (0, import_react19.useLayoutEffect)(() => {
17857
+ (0, import_react20.useLayoutEffect)(() => {
17687
17858
  updateCoords();
17688
17859
  const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17689
17860
  window.addEventListener("resize", handleResize);
@@ -17694,7 +17865,7 @@ var Tooltip = ({
17694
17865
  };
17695
17866
  }, [updateCoords]);
17696
17867
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
17697
- (0, import_react19.cloneElement)(trigger, {
17868
+ (0, import_react20.cloneElement)(trigger, {
17698
17869
  ref: triggerRef,
17699
17870
  onFocus: () => setShow(true),
17700
17871
  onBlur: () => setShow(false),
@@ -17750,7 +17921,7 @@ var StyledCard = gt.div(({ theme }) => {
17750
17921
 
17751
17922
  // src/components/layout/card/Card.tsx
17752
17923
  var import_jsx_runtime12 = require("react/jsx-runtime");
17753
- var Card = (0, import_react20.forwardRef)(
17924
+ var Card = (0, import_react21.forwardRef)(
17754
17925
  ({ children, className }, ref) => {
17755
17926
  const { settings, isPending } = useEmbed();
17756
17927
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledCard, { ref, className, children: [
@@ -17778,7 +17949,7 @@ var Card = (0, import_react20.forwardRef)(
17778
17949
  Card.displayName = "Card";
17779
17950
 
17780
17951
  // src/components/layout/column/Column.tsx
17781
- var import_react21 = require("react");
17952
+ var import_react22 = require("react");
17782
17953
 
17783
17954
  // src/components/layout/column/styles.ts
17784
17955
  var StyledColumn = gt.div`
@@ -17787,15 +17958,15 @@ var StyledColumn = gt.div`
17787
17958
 
17788
17959
  // src/components/layout/column/Column.tsx
17789
17960
  var import_jsx_runtime13 = require("react/jsx-runtime");
17790
- var Column = (0, import_react21.forwardRef)(
17961
+ var Column = (0, import_react22.forwardRef)(
17791
17962
  ({ children, basis, ...props }, ref) => {
17792
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StyledColumn, { ref, ...props, children: import_react21.Children.count(children) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Card, { children }) : children });
17963
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StyledColumn, { ref, ...props, children: import_react22.Children.count(children) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Card, { children }) : children });
17793
17964
  }
17794
17965
  );
17795
17966
  Column.displayName = "Column";
17796
17967
 
17797
17968
  // src/components/layout/root/Root.tsx
17798
- var import_react22 = require("react");
17969
+ var import_react23 = require("react");
17799
17970
 
17800
17971
  // src/components/layout/root/styles.ts
17801
17972
  var ResetStyle = ft`
@@ -17834,7 +18005,7 @@ var Container = gt.div`
17834
18005
 
17835
18006
  // src/components/layout/root/Root.tsx
17836
18007
  var import_jsx_runtime14 = require("react/jsx-runtime");
17837
- var Root = (0, import_react22.forwardRef)(
18008
+ var Root = (0, import_react23.forwardRef)(
17838
18009
  ({ data, settings, ...props }, ref) => {
17839
18010
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Container, { ref, ...props });
17840
18011
  }
@@ -17843,7 +18014,7 @@ Root.displayName = "Root";
17843
18014
 
17844
18015
  // src/components/layout/viewport/Viewport.tsx
17845
18016
  var import_debounce5 = __toESM(require_debounce());
17846
- var import_react40 = require("react");
18017
+ var import_react41 = require("react");
17847
18018
  var import_react_dom3 = require("react-dom");
17848
18019
 
17849
18020
  // src/components/shared/auto-topup-notice/AutoTopupNotice.tsx
@@ -17866,7 +18037,7 @@ var AutoTopupNotice = ({
17866
18037
  trigger: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
17867
18038
  Icon3,
17868
18039
  {
17869
- title: "auto top-up",
18040
+ title: t3("Auto Top-up"),
17870
18041
  name: "info-rounded",
17871
18042
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
17872
18043
  style: { lineHeight: 0 }
@@ -17905,7 +18076,7 @@ var BillingThresholdTooltip = ({
17905
18076
  trigger: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
17906
18077
  Icon3,
17907
18078
  {
17908
- title: "billing threshold",
18079
+ title: t3("Billing threshold"),
17909
18080
  name: "info-rounded",
17910
18081
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
17911
18082
  style: { lineHeight: 0 }
@@ -18049,7 +18220,7 @@ var ButtonGroup = ({
18049
18220
  };
18050
18221
 
18051
18222
  // src/components/shared/checkout-dialog/Plan/Entitlement.tsx
18052
- var import_react23 = require("react");
18223
+ var import_react24 = require("react");
18053
18224
  var import_jsx_runtime19 = require("react/jsx-runtime");
18054
18225
  var Entitlement = ({
18055
18226
  portal,
@@ -18079,7 +18250,7 @@ var Entitlement = ({
18079
18250
  tiersMode
18080
18251
  } = entitlementBillingPrice || {};
18081
18252
  const tiered = entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementBillingPrice);
18082
- const text = (0, import_react23.useMemo)(() => {
18253
+ const text = (0, import_react24.useMemo)(() => {
18083
18254
  if (!entitlement.feature) {
18084
18255
  return;
18085
18256
  }
@@ -18101,7 +18272,7 @@ var Entitlement = ({
18101
18272
  packageSize,
18102
18273
  " "
18103
18274
  ] }),
18104
- getFeatureName(entitlement.feature, packageSize),
18275
+ getFeatureName(entitlement.feature, locale, packageSize),
18105
18276
  entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18106
18277
  " ",
18107
18278
  t3("per"),
@@ -18126,12 +18297,13 @@ var Entitlement = ({
18126
18297
  " ",
18127
18298
  getFeatureName(
18128
18299
  entitlement.valueCredit,
18300
+ locale,
18129
18301
  entitlement.consumptionRate || void 0
18130
18302
  ),
18131
18303
  " ",
18132
18304
  t3("per"),
18133
18305
  " ",
18134
- getFeatureName(entitlement.feature, 1)
18306
+ getFeatureName(entitlement.feature, locale, 1)
18135
18307
  ] });
18136
18308
  }
18137
18309
  if (entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit) {
@@ -18139,13 +18311,17 @@ var Entitlement = ({
18139
18311
  amount: creditBasedEntitlementLimit.limit,
18140
18312
  units: getFeatureName(
18141
18313
  entitlement.feature,
18314
+ locale,
18142
18315
  creditBasedEntitlementLimit.limit
18143
18316
  ),
18144
- period: creditBasedEntitlementLimit.period
18317
+ period: t3(
18318
+ creditBasedEntitlementLimit.period
18319
+ )
18145
18320
  }) : t3("Up to X units", {
18146
18321
  amount: creditBasedEntitlementLimit.limit,
18147
18322
  units: getFeatureName(
18148
18323
  entitlement.feature,
18324
+ locale,
18149
18325
  creditBasedEntitlementLimit.limit
18150
18326
  )
18151
18327
  }) });
@@ -18153,11 +18329,11 @@ var Entitlement = ({
18153
18329
  if (hasNumericValue) {
18154
18330
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18155
18331
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
18156
- item: getFeatureName(entitlement.feature)
18332
+ item: getFeatureName(entitlement.feature, locale)
18157
18333
  }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18158
18334
  formatNumber(limit, { locale }),
18159
18335
  " ",
18160
- getFeatureName(entitlement.feature, limit)
18336
+ getFeatureName(entitlement.feature, locale, limit)
18161
18337
  ] }),
18162
18338
  metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18163
18339
  " ",
@@ -18182,7 +18358,7 @@ var Entitlement = ({
18182
18358
  selectedCurrency,
18183
18359
  showWarningThresholdAsLimit
18184
18360
  ]);
18185
- const usageText = (0, import_react23.useMemo)(() => {
18361
+ const usageText = (0, import_react24.useMemo)(() => {
18186
18362
  if (!entitlement.feature) {
18187
18363
  return;
18188
18364
  }
@@ -18196,7 +18372,7 @@ var Entitlement = ({
18196
18372
  packageSize,
18197
18373
  " "
18198
18374
  ] }),
18199
- getFeatureName(entitlement.feature, packageSize),
18375
+ getFeatureName(entitlement.feature, locale, packageSize),
18200
18376
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
18201
18377
  "/",
18202
18378
  shortenPeriod(period, t3)
@@ -18265,7 +18441,7 @@ var Entitlement = ({
18265
18441
  };
18266
18442
 
18267
18443
  // src/components/shared/checkout-dialog/Plan/Plan.tsx
18268
- var import_react24 = require("react");
18444
+ var import_react25 = require("react");
18269
18445
  var import_jsx_runtime20 = require("react/jsx-runtime");
18270
18446
  var Plan = ({
18271
18447
  portal,
@@ -18281,7 +18457,7 @@ var Plan = ({
18281
18457
  const { data, settings } = useEmbed();
18282
18458
  const isLightBackground = useIsLightBackground();
18283
18459
  const trialEnd = useTrialEnd();
18284
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react24.useState)({});
18460
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react25.useState)({});
18285
18461
  const handleToggleShowAll = (id) => {
18286
18462
  setEntitlementVisibility((prev2) => {
18287
18463
  const updated = !(prev2[id] ?? false);
@@ -18528,7 +18704,7 @@ var Plan = ({
18528
18704
  };
18529
18705
 
18530
18706
  // src/components/shared/checkout-dialog/AutoTopup.tsx
18531
- var import_react25 = require("react");
18707
+ var import_react26 = require("react");
18532
18708
  var import_jsx_runtime21 = require("react/jsx-runtime");
18533
18709
  var AutoTopup = ({
18534
18710
  planCreditGrants,
@@ -18536,9 +18712,9 @@ var AutoTopup = ({
18536
18712
  updateAutoTopupConfig
18537
18713
  }) => {
18538
18714
  const { settings } = useEmbed();
18539
- const { t: t3 } = useTranslation();
18715
+ const { t: t3, locale } = useTranslation();
18540
18716
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
18541
- const configurableCreditGrants = (0, import_react25.useMemo)(() => {
18717
+ const configurableCreditGrants = (0, import_react26.useMemo)(() => {
18542
18718
  return planCreditGrants.reduce(
18543
18719
  (acc, grant) => {
18544
18720
  if (isSelfServiceAutoTopupAvailable(grant)) {
@@ -18583,7 +18759,7 @@ var AutoTopup = ({
18583
18759
  }) }) }),
18584
18760
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { as: "p", $marginBottom: "2rem", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { children: t3(
18585
18761
  "Automatically purchase more credits when your balance is low",
18586
- { units: getFeatureName(grant.credit) }
18762
+ { units: getFeatureName(grant.credit, locale) }
18587
18763
  ) }) })
18588
18764
  ] }),
18589
18765
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", $marginBottom: "1rem", children: [
@@ -18664,7 +18840,7 @@ var AutoTopup = ({
18664
18840
  };
18665
18841
 
18666
18842
  // src/components/shared/checkout-dialog/Quantity.tsx
18667
- var import_react26 = require("react");
18843
+ var import_react27 = require("react");
18668
18844
  var import_jsx_runtime22 = require("react/jsx-runtime");
18669
18845
  var Quantity = ({
18670
18846
  portal,
@@ -18679,12 +18855,12 @@ var Quantity = ({
18679
18855
  const isLightBackground = useIsLightBackground();
18680
18856
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
18681
18857
  const unitPriceFontSize = 0.875 * settings.theme.typography.text.fontSize;
18682
- const planCredits = (0, import_react26.useMemo)(
18858
+ const planCredits = (0, import_react27.useMemo)(
18683
18859
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
18684
18860
  [selectedPlan?.includedCreditGrants]
18685
18861
  );
18686
18862
  const prorationBehavior = data?.checkoutSettings?.prorationBehavior;
18687
- const renewalDate = data?.upcomingInvoice?.dueDate ?? void 0;
18863
+ const { billDate: renewalDate } = useNextBillDate();
18688
18864
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce((acc, entitlement) => {
18689
18865
  if (entitlement.feature) {
18690
18866
  const entitlementBillingPrice = getEntitlementPrice(
@@ -18780,7 +18956,7 @@ var Quantity = ({
18780
18956
  $color: settings.theme.typography.text.color,
18781
18957
  children: t3("Currently using", {
18782
18958
  quantity: entitlement.usage,
18783
- unit: getFeatureName(entitlement.feature)
18959
+ unit: getFeatureName(entitlement.feature, locale)
18784
18960
  })
18785
18961
  }
18786
18962
  ),
@@ -18845,7 +19021,11 @@ var Quantity = ({
18845
19021
  packageSize,
18846
19022
  " "
18847
19023
  ] }),
18848
- getFeatureName(entitlement.feature, packageSize),
19024
+ getFeatureName(
19025
+ entitlement.feature,
19026
+ locale,
19027
+ packageSize
19028
+ ),
18849
19029
  "/",
18850
19030
  shortenPeriod(period, t3)
18851
19031
  ] })
@@ -18882,12 +19062,14 @@ var Quantity = ({
18882
19062
  quantity: entitlement.quantity,
18883
19063
  licenseName: getFeatureName(
18884
19064
  entitlement.feature,
19065
+ locale,
18885
19066
  entitlement.quantity
18886
19067
  ),
18887
19068
  perUnit: perLicenseGrant.amount,
18888
19069
  total: includedCredits,
18889
19070
  creditName: getFeatureName(
18890
19071
  licenseCredit,
19072
+ locale,
18891
19073
  includedCredits
18892
19074
  ),
18893
19075
  period: shortenPeriod(licenseCredit.period, t3)
@@ -18909,11 +19091,13 @@ var Quantity = ({
18909
19091
  added: addedQuantity,
18910
19092
  licenseName: getFeatureName(
18911
19093
  entitlement.feature,
19094
+ locale,
18912
19095
  addedQuantity
18913
19096
  ),
18914
19097
  credits: addedCredits,
18915
19098
  creditName: getFeatureName(
18916
19099
  licenseCredit,
19100
+ locale,
18917
19101
  addedCredits
18918
19102
  )
18919
19103
  }),
@@ -18923,9 +19107,10 @@ var Quantity = ({
18923
19107
  total: includedCredits,
18924
19108
  creditName: getFeatureName(
18925
19109
  licenseCredit,
19110
+ locale,
18926
19111
  includedCredits
18927
19112
  ),
18928
- cadence: adjectify(licenseCredit.period),
19113
+ cadence: adjectify(licenseCredit.period, t3),
18929
19114
  day: formatOrdinal(renewalDate.getDate(), t3)
18930
19115
  })
18931
19116
  ] })
@@ -18964,6 +19149,7 @@ function renderMeteredEntitlementPricing({
18964
19149
  "/",
18965
19150
  feature ? getFeatureName(
18966
19151
  feature,
19152
+ locale,
18967
19153
  packageSize
18968
19154
  ) : featureName || "unit"
18969
19155
  ] });
@@ -18981,6 +19167,7 @@ function renderMeteredEntitlementPricing({
18981
19167
  ] }),
18982
19168
  feature ? getFeatureName(
18983
19169
  feature,
19170
+ locale,
18984
19171
  packageSize
18985
19172
  ) : featureName || "unit"
18986
19173
  ] });
@@ -19298,7 +19485,7 @@ var Credits = ({
19298
19485
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { display: "heading6", children: [
19299
19486
  formatNumber(bundle.quantity ?? 0, { locale }),
19300
19487
  " ",
19301
- getFeatureName(bundle)
19488
+ getFeatureName(bundle, locale)
19302
19489
  ] }) })
19303
19490
  ] }),
19304
19491
  typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { children: formatCurrency(price, {
@@ -19353,7 +19540,7 @@ var Credits = ({
19353
19540
  };
19354
19541
 
19355
19542
  // src/components/shared/checkout-dialog/Checkout.tsx
19356
- var import_react28 = require("react");
19543
+ var import_react29 = require("react");
19357
19544
 
19358
19545
  // src/components/shared/payment-form/styles.ts
19359
19546
  var Label = gt.label`
@@ -19446,7 +19633,7 @@ var CustomCheckoutFields = ({
19446
19633
  };
19447
19634
 
19448
19635
  // src/components/shared/checkout-dialog/TaxIdField.tsx
19449
- var import_react27 = require("react");
19636
+ var import_react28 = require("react");
19450
19637
  var import_jsx_runtime26 = require("react/jsx-runtime");
19451
19638
  var Select = gt(Input2).attrs({ as: "select" })`
19452
19639
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23666' stroke-width='1.5' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
@@ -19461,7 +19648,7 @@ var TaxIdField = ({
19461
19648
  }) => {
19462
19649
  const { t: t3, locale } = useTranslation();
19463
19650
  const isLightBackground = useIsLightBackground();
19464
- const countryOptions = (0, import_react27.useMemo)(() => taxIdCountryOptions(locale), [locale]);
19651
+ const countryOptions = (0, import_react28.useMemo)(() => taxIdCountryOptions(locale), [locale]);
19465
19652
  const jurisdictions = taxIdJurisdictionsForCountry(value.country);
19466
19653
  const handleCountryChange = (country) => {
19467
19654
  const next2 = taxIdJurisdictionsForCountry(country);
@@ -19562,7 +19749,7 @@ var Checkout = ({
19562
19749
  }) => {
19563
19750
  const { t: t3 } = useTranslation();
19564
19751
  const isLightBackground = useIsLightBackground();
19565
- const [discount, setDiscount] = (0, import_react28.useState)(promoCode ?? "");
19752
+ const [discount, setDiscount] = (0, import_react29.useState)(promoCode ?? "");
19566
19753
  const hasCustomFields = !!customCheckoutFields && customCheckoutFields.length > 0;
19567
19754
  const showTaxId = collectTaxId && !!taxIdValues && !!onTaxIdChange;
19568
19755
  if (!isPaymentMethodRequired && !hasCustomFields && !showTaxId && !optInRequired) {
@@ -19686,7 +19873,7 @@ var Checkout = ({
19686
19873
 
19687
19874
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
19688
19875
  var import_debounce4 = __toESM(require_debounce());
19689
- var import_react29 = require("react");
19876
+ var import_react30 = require("react");
19690
19877
 
19691
19878
  // src/components/shared/checkout-dialog/Navigation.tsx
19692
19879
  var import_jsx_runtime28 = require("react/jsx-runtime");
@@ -19824,30 +20011,30 @@ var CheckoutDialog = ({ top }) => {
19824
20011
  getTaxId
19825
20012
  } = useEmbed();
19826
20013
  const isLightBackground = useIsLightBackground();
19827
- const dialogRef = (0, import_react29.useRef)(null);
19828
- const contentRef = (0, import_react29.useRef)(null);
19829
- const stageRef = (0, import_react29.useRef)(null);
19830
- const sidebarRef = (0, import_react29.useRef)(null);
19831
- const [dialogElement, setDialogElement] = (0, import_react29.useState)(
20014
+ const dialogRef = (0, import_react30.useRef)(null);
20015
+ const contentRef = (0, import_react30.useRef)(null);
20016
+ const stageRef = (0, import_react30.useRef)(null);
20017
+ const sidebarRef = (0, import_react30.useRef)(null);
20018
+ const [dialogElement, setDialogElement] = (0, import_react30.useState)(
19832
20019
  null
19833
20020
  );
19834
- const setDialog = (0, import_react29.useCallback)((element) => {
20021
+ const setDialog = (0, import_react30.useCallback)((element) => {
19835
20022
  dialogRef.current = element;
19836
20023
  setDialogElement(element);
19837
20024
  }, []);
19838
- const [confirmPaymentIntentProps, setConfirmPaymentIntentProps] = (0, import_react29.useState)(void 0);
19839
- const [charges, setCharges] = (0, import_react29.useState)();
19840
- const [paymentMethodId, setPaymentMethodId] = (0, import_react29.useState)(
20025
+ const [confirmPaymentIntentProps, setConfirmPaymentIntentProps] = (0, import_react30.useState)(void 0);
20026
+ const [charges, setCharges] = (0, import_react30.useState)();
20027
+ const [paymentMethodId, setPaymentMethodId] = (0, import_react30.useState)(
19841
20028
  () => {
19842
20029
  return data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId;
19843
20030
  }
19844
20031
  );
19845
- const [isLoading, setIsLoading] = (0, import_react29.useState)(false);
19846
- const [error, setError] = (0, import_react29.useState)();
19847
- const [isModal, setIsModal] = (0, import_react29.useState)(true);
20032
+ const [isLoading, setIsLoading] = (0, import_react30.useState)(false);
20033
+ const [error, setError] = (0, import_react30.useState)();
20034
+ const [isModal, setIsModal] = (0, import_react30.useState)(true);
19848
20035
  const showPeriodToggle = data?.displaySettings?.showPeriodToggle ?? true;
19849
20036
  const trialPaymentMethodRequired = data?.trialPaymentMethodRequired === true;
19850
- const featureUsage = (0, import_react29.useMemo)(
20037
+ const featureUsage = (0, import_react30.useMemo)(
19851
20038
  () => data?.featureUsage?.features ?? [],
19852
20039
  [data?.featureUsage?.features]
19853
20040
  );
@@ -19868,13 +20055,13 @@ var CheckoutDialog = ({ top }) => {
19868
20055
  }
19869
20056
  return requestedPeriod;
19870
20057
  };
19871
- const [planPeriod, setPlanPeriod] = (0, import_react29.useState)(getValidatedPeriod);
20058
+ const [planPeriod, setPlanPeriod] = (0, import_react30.useState)(getValidatedPeriod);
19872
20059
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
19873
20060
  const lockedCurrency = useSubscriptionCurrency();
19874
20061
  const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
19875
20062
  const filterBlocksSubscriptionCurrency = hasCurrencyFilter && !!lockedCurrency && !currencyFilter.includes(lockedCurrency);
19876
20063
  const prefilledCurrency = checkoutState?.selectedCurrency?.toUpperCase();
19877
- const [selectedCurrency, setSelectedCurrency] = (0, import_react29.useState)(
20064
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react30.useState)(
19878
20065
  () => prefilledCurrency ?? currencies[0] ?? DEFAULT_CURRENCY
19879
20066
  );
19880
20067
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -19885,7 +20072,7 @@ var CheckoutDialog = ({ top }) => {
19885
20072
  const canSelectCurrency = currencies.length > 1 && !lockedCurrency && currencySelectorEnabled;
19886
20073
  const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
19887
20074
  const hasNoUsableCurrency = !lockedCurrency && currencies.length === 0;
19888
- (0, import_react29.useEffect)(() => {
20075
+ (0, import_react30.useEffect)(() => {
19889
20076
  if (filterBlocksSubscriptionCurrency) {
19890
20077
  console.error(
19891
20078
  `[Schematic] currencyFilter excludes the active subscription currency (${lockedCurrency}); keeping subscription currency.`
@@ -19902,8 +20089,8 @@ var CheckoutDialog = ({ top }) => {
19902
20089
  } = useAvailablePlans(planPeriod, {
19903
20090
  useSelectedPeriod: showPeriodToggle
19904
20091
  });
19905
- const [selectedPlanId, setSelectedPlanId] = (0, import_react29.useState)(void 0);
19906
- const selectedPlan = (0, import_react29.useMemo)(() => {
20092
+ const [selectedPlanId, setSelectedPlanId] = (0, import_react30.useState)(void 0);
20093
+ const selectedPlan = (0, import_react30.useMemo)(() => {
19907
20094
  if (selectedPlanId === null) {
19908
20095
  return void 0;
19909
20096
  }
@@ -19918,8 +20105,8 @@ var CheckoutDialog = ({ top }) => {
19918
20105
  (!plan.isTrialable || !plan.companyCanTrial)
19919
20106
  );
19920
20107
  }, [availablePlans, checkoutState, selectedPlanId]);
19921
- const [shouldTrial, setShouldTrial] = (0, import_react29.useState)(false);
19922
- const planCreditGrants = (0, import_react29.useMemo)(() => {
20108
+ const [shouldTrial, setShouldTrial] = (0, import_react30.useState)(false);
20109
+ const planCreditGrants = (0, import_react30.useMemo)(() => {
19923
20110
  const grants = mergeCompanyGrants(
19924
20111
  selectedPlan?.includedCreditGrants,
19925
20112
  data?.company?.plan?.includedCreditGrants
@@ -19929,7 +20116,7 @@ var CheckoutDialog = ({ top }) => {
19929
20116
  selectedPlan?.includedCreditGrants,
19930
20117
  data?.company?.plan?.includedCreditGrants
19931
20118
  ]);
19932
- const [autoTopupConfigs, setAutoTopupConfigs] = (0, import_react29.useState)(() => {
20119
+ const [autoTopupConfigs, setAutoTopupConfigs] = (0, import_react30.useState)(() => {
19933
20120
  const initialConfigs = data?.company?.plan?.includedCreditGrants.reduce(
19934
20121
  (acc, companyGrant) => {
19935
20122
  const {
@@ -19949,7 +20136,7 @@ var CheckoutDialog = ({ top }) => {
19949
20136
  );
19950
20137
  return new Map(initialConfigs);
19951
20138
  });
19952
- const [selectedAddOnIds, setSelectedAddOnIds] = (0, import_react29.useState)(() => {
20139
+ const [selectedAddOnIds, setSelectedAddOnIds] = (0, import_react30.useState)(() => {
19953
20140
  const ids = /* @__PURE__ */ new Set();
19954
20141
  if (checkoutState?.addOnIds) {
19955
20142
  for (const id of checkoutState.addOnIds) ids.add(id);
@@ -19965,11 +20152,11 @@ var CheckoutDialog = ({ top }) => {
19965
20152
  }
19966
20153
  return ids;
19967
20154
  });
19968
- const addOnCompatibilityLookup = (0, import_react29.useMemo)(
20155
+ const addOnCompatibilityLookup = (0, import_react30.useMemo)(
19969
20156
  () => buildAddOnCompatibilityLookup(data?.addOnCompatibilities),
19970
20157
  [data?.addOnCompatibilities]
19971
20158
  );
19972
- const addOns = (0, import_react29.useMemo)(() => {
20159
+ const addOns = (0, import_react30.useMemo)(() => {
19973
20160
  return availableAddOns.filter((availAddOn) => {
19974
20161
  if (hasCurrency && !planSupportsCurrency(availAddOn, effectiveCurrency)) {
19975
20162
  return false;
@@ -19995,20 +20182,20 @@ var CheckoutDialog = ({ top }) => {
19995
20182
  selectedAddOnIds
19996
20183
  ]);
19997
20184
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
19998
- const [bundleCounts, setBundleCounts] = (0, import_react29.useState)({});
19999
- const bundleCountsRef = (0, import_react29.useRef)(bundleCounts);
20185
+ const [bundleCounts, setBundleCounts] = (0, import_react30.useState)({});
20186
+ const bundleCountsRef = (0, import_react30.useRef)(bundleCounts);
20000
20187
  const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
20001
- const creditBundles = (0, import_react29.useMemo)(() => {
20188
+ const creditBundles = (0, import_react30.useMemo)(() => {
20002
20189
  return deriveCreditBundles(
20003
20190
  data?.creditBundles,
20004
20191
  bundleGatingPlanId,
20005
20192
  bundleCounts
20006
20193
  );
20007
20194
  }, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
20008
- const [hasInitialPaymentMethod] = (0, import_react29.useState)(
20195
+ const [hasInitialPaymentMethod] = (0, import_react30.useState)(
20009
20196
  () => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
20010
20197
  );
20011
- const isCreditOnlyPurchase = (0, import_react29.useMemo)(
20198
+ const isCreditOnlyPurchase = (0, import_react30.useMemo)(
20012
20199
  () => isCreditOnlyCheckout({
20013
20200
  plan: selectedPlan,
20014
20201
  creditBundles,
@@ -20025,7 +20212,7 @@ var CheckoutDialog = ({ top }) => {
20025
20212
  effectiveCurrency
20026
20213
  ]
20027
20214
  );
20028
- const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react29.useState)(
20215
+ const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react30.useState)(
20029
20216
  () => applyPrefilledQuantities(
20030
20217
  (selectedPlan?.entitlements || []).reduce(
20031
20218
  createActiveUsageBasedEntitlementsReducer(featureUsage, planPeriod),
@@ -20034,7 +20221,7 @@ var CheckoutDialog = ({ top }) => {
20034
20221
  checkoutState?.payInAdvanceQuantities
20035
20222
  )
20036
20223
  );
20037
- const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = (0, import_react29.useState)(() => {
20224
+ const [addOnUsageBasedEntitlements, setAddOnUsageBasedEntitlements] = (0, import_react30.useState)(() => {
20038
20225
  const currentAddOnEntitlements = (data?.company?.addOns || []).flatMap(
20039
20226
  (currentAddOn) => {
20040
20227
  const availableAddOn = availableAddOns.find(
@@ -20075,45 +20262,45 @@ var CheckoutDialog = ({ top }) => {
20075
20262
  checkoutState?.payInAdvanceQuantities
20076
20263
  );
20077
20264
  });
20078
- const payInAdvanceEntitlements = (0, import_react29.useMemo)(
20265
+ const payInAdvanceEntitlements = (0, import_react30.useMemo)(
20079
20266
  () => usageBasedEntitlements.filter(
20080
20267
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20081
20268
  ),
20082
20269
  [usageBasedEntitlements]
20083
20270
  );
20084
- const addOnPayInAdvanceEntitlements = (0, import_react29.useMemo)(
20271
+ const addOnPayInAdvanceEntitlements = (0, import_react30.useMemo)(
20085
20272
  () => addOnUsageBasedEntitlements.filter(
20086
20273
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20087
20274
  ),
20088
20275
  [addOnUsageBasedEntitlements]
20089
20276
  );
20090
- const [promoCode, setPromoCode] = (0, import_react29.useState)(
20277
+ const [promoCode, setPromoCode] = (0, import_react30.useState)(
20091
20278
  () => checkoutState?.promoCode ?? null
20092
20279
  );
20093
- const [customFieldValues, setCustomFieldValues] = (0, import_react29.useState)(() => {
20280
+ const [customFieldValues, setCustomFieldValues] = (0, import_react30.useState)(() => {
20094
20281
  const values = {};
20095
20282
  for (const field of data?.customCheckoutFields ?? []) {
20096
20283
  values[field.id] = field.value ?? "";
20097
20284
  }
20098
20285
  return values;
20099
20286
  });
20100
- const hasIncompleteRequiredCustomFields = (0, import_react29.useMemo)(() => {
20287
+ const hasIncompleteRequiredCustomFields = (0, import_react30.useMemo)(() => {
20101
20288
  return (data?.customCheckoutFields ?? []).some(
20102
20289
  (field) => field.required && !customFieldValues[field.id]?.trim()
20103
20290
  );
20104
20291
  }, [data?.customCheckoutFields, customFieldValues]);
20105
- const handleCustomFieldChange = (0, import_react29.useCallback)(
20292
+ const handleCustomFieldChange = (0, import_react30.useCallback)(
20106
20293
  (fieldId, value) => {
20107
20294
  setCustomFieldValues((prev2) => ({ ...prev2, [fieldId]: value }));
20108
20295
  },
20109
20296
  []
20110
20297
  );
20111
20298
  const collectTaxId = data?.checkoutSettings.collectTaxId ?? false;
20112
- const [taxIdValues, setTaxIdValues] = (0, import_react29.useState)(emptyTaxIdValues);
20113
- const [taxIdError, setTaxIdError] = (0, import_react29.useState)();
20114
- const lastSavedTaxIdRef = (0, import_react29.useRef)(void 0);
20115
- const pendingTaxIdSaveRef = (0, import_react29.useRef)(null);
20116
- (0, import_react29.useEffect)(() => {
20299
+ const [taxIdValues, setTaxIdValues] = (0, import_react30.useState)(emptyTaxIdValues);
20300
+ const [taxIdError, setTaxIdError] = (0, import_react30.useState)();
20301
+ const lastSavedTaxIdRef = (0, import_react30.useRef)(void 0);
20302
+ const pendingTaxIdSaveRef = (0, import_react30.useRef)(null);
20303
+ (0, import_react30.useEffect)(() => {
20117
20304
  if (!collectTaxId) {
20118
20305
  return;
20119
20306
  }
@@ -20140,19 +20327,19 @@ var CheckoutDialog = ({ top }) => {
20140
20327
  cancelled = true;
20141
20328
  };
20142
20329
  }, [collectTaxId, getTaxId]);
20143
- const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react29.useState)(false);
20144
- const [optInRequired, setOptInRequired] = (0, import_react29.useState)(false);
20145
- const [optInTitle, setOptInTitle] = (0, import_react29.useState)(null);
20146
- const [optInText, setOptInText] = (0, import_react29.useState)(null);
20147
- const [optInAccepted, setOptInAccepted] = (0, import_react29.useState)(false);
20148
- const presentedOptInRef = (0, import_react29.useRef)(null);
20149
- const [willScheduleDowngrade, setWillScheduleDowngrade] = (0, import_react29.useState)(false);
20150
- const willTrialWithoutPaymentMethod = (0, import_react29.useMemo)(
20330
+ const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react30.useState)(false);
20331
+ const [optInRequired, setOptInRequired] = (0, import_react30.useState)(false);
20332
+ const [optInTitle, setOptInTitle] = (0, import_react30.useState)(null);
20333
+ const [optInText, setOptInText] = (0, import_react30.useState)(null);
20334
+ const [optInAccepted, setOptInAccepted] = (0, import_react30.useState)(false);
20335
+ const presentedOptInRef = (0, import_react30.useRef)(null);
20336
+ const [willScheduleDowngrade, setWillScheduleDowngrade] = (0, import_react30.useState)(false);
20337
+ const willTrialWithoutPaymentMethod = (0, import_react30.useMemo)(
20151
20338
  () => shouldTrial && !trialPaymentMethodRequired,
20152
20339
  [shouldTrial, trialPaymentMethodRequired]
20153
20340
  );
20154
20341
  const isSelectedPlanTrialable = selectedPlan && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
20155
- const checkoutStages = (0, import_react29.useMemo)(() => {
20342
+ const checkoutStages = (0, import_react30.useMemo)(() => {
20156
20343
  const stages = [];
20157
20344
  const checkoutStage2 = {
20158
20345
  id: "checkout",
@@ -20240,10 +20427,10 @@ var CheckoutDialog = ({ top }) => {
20240
20427
  isCreditOnlyPurchase,
20241
20428
  hasInitialPaymentMethod
20242
20429
  ]);
20243
- const [isBypassLoading, setIsBypassLoading] = (0, import_react29.useState)(
20430
+ const [isBypassLoading, setIsBypassLoading] = (0, import_react30.useState)(
20244
20431
  () => checkoutState?.bypassPlanSelection || checkoutState?.bypassAddOnSelection || checkoutState?.bypassCreditsSelection || checkoutState?.bypassUsageSelection || checkoutState?.bypassAddOnUsageSelection
20245
20432
  );
20246
- const [checkoutStage, setCheckoutStage] = (0, import_react29.useState)(() => {
20433
+ const [checkoutStage, setCheckoutStage] = (0, import_react30.useState)(() => {
20247
20434
  if (checkoutState?.addOnId) {
20248
20435
  return "addons";
20249
20436
  }
@@ -20258,7 +20445,7 @@ var CheckoutDialog = ({ top }) => {
20258
20445
  }
20259
20446
  return "plan";
20260
20447
  });
20261
- const effectiveCheckoutStage = (0, import_react29.useMemo)(() => {
20448
+ const effectiveCheckoutStage = (0, import_react30.useMemo)(() => {
20262
20449
  if (isBypassLoading) return checkoutStage;
20263
20450
  let id = checkoutStage;
20264
20451
  if (id === "credits" && !checkoutStages.some((stage) => stage.id === id)) {
@@ -20272,9 +20459,9 @@ var CheckoutDialog = ({ top }) => {
20272
20459
  }
20273
20460
  return id;
20274
20461
  }, [checkoutStage, checkoutStages, checkoutState, isBypassLoading]);
20275
- const previewRequestIdRef = (0, import_react29.useRef)(0);
20462
+ const previewRequestIdRef = (0, import_react30.useRef)(0);
20276
20463
  const planStageVisible = checkoutStages.some((stage) => stage.id === "plan") && !checkoutState?.bypassPlanSelection;
20277
- const checkoutStageCurrencies = (0, import_react29.useMemo)(() => {
20464
+ const checkoutStageCurrencies = (0, import_react30.useMemo)(() => {
20278
20465
  if (!selectedPlan) return currencies;
20279
20466
  return currencies.filter(
20280
20467
  (currency) => planOffersCurrencyForPeriod(selectedPlan, planPeriod, currency)
@@ -20283,7 +20470,7 @@ var CheckoutDialog = ({ top }) => {
20283
20470
  const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
20284
20471
  const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
20285
20472
  const currencyPeriodMismatch = hasCurrency && !lockedCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
20286
- (0, import_react29.useEffect)(() => {
20473
+ (0, import_react30.useEffect)(() => {
20287
20474
  if (currencyPeriodMismatch) {
20288
20475
  console.error(
20289
20476
  `[Schematic] No ${effectiveCurrency} price for the "${planPeriod}" billing period on the selected plan; refusing to fall back to the default currency.`
@@ -20301,7 +20488,7 @@ var CheckoutDialog = ({ top }) => {
20301
20488
  selectedPlan?.id,
20302
20489
  debug
20303
20490
  ]);
20304
- const handlePreviewCheckout = (0, import_react29.useCallback)(
20491
+ const handlePreviewCheckout = (0, import_react30.useCallback)(
20305
20492
  async (updates) => {
20306
20493
  const period = updates.period || planPeriod;
20307
20494
  const plan = updates.plan || selectedPlan;
@@ -20481,12 +20668,12 @@ var CheckoutDialog = ({ top }) => {
20481
20668
  isBypassLoading
20482
20669
  ]
20483
20670
  );
20484
- const handlePreviewCheckoutRef = (0, import_react29.useRef)(handlePreviewCheckout);
20485
- (0, import_react29.useEffect)(() => {
20671
+ const handlePreviewCheckoutRef = (0, import_react30.useRef)(handlePreviewCheckout);
20672
+ (0, import_react30.useEffect)(() => {
20486
20673
  handlePreviewCheckoutRef.current = handlePreviewCheckout;
20487
20674
  }, [handlePreviewCheckout]);
20488
- const debouncedPreviewCheckoutRef = (0, import_react29.useRef)(null);
20489
- (0, import_react29.useEffect)(() => {
20675
+ const debouncedPreviewCheckoutRef = (0, import_react30.useRef)(null);
20676
+ (0, import_react30.useEffect)(() => {
20490
20677
  const debounced = (0, import_debounce4.default)(
20491
20678
  (updates) => handlePreviewCheckoutRef.current(updates),
20492
20679
  FETCH_DEBOUNCE_TIMEOUT,
@@ -20498,7 +20685,7 @@ var CheckoutDialog = ({ top }) => {
20498
20685
  debouncedPreviewCheckoutRef.current = null;
20499
20686
  };
20500
20687
  }, []);
20501
- const saveTaxId = (0, import_react29.useCallback)(
20688
+ const saveTaxId = (0, import_react30.useCallback)(
20502
20689
  async ({ refreshPreview = false } = {}) => {
20503
20690
  const input = toTaxIdInput(taxIdValues);
20504
20691
  if (!input) {
@@ -20532,13 +20719,13 @@ var CheckoutDialog = ({ top }) => {
20532
20719
  },
20533
20720
  [t3, taxIdValues, updateTaxId]
20534
20721
  );
20535
- const debouncedPreviewCheckout = (0, import_react29.useCallback)(
20722
+ const debouncedPreviewCheckout = (0, import_react30.useCallback)(
20536
20723
  (updates) => {
20537
20724
  debouncedPreviewCheckoutRef.current?.(updates);
20538
20725
  },
20539
20726
  []
20540
20727
  );
20541
- const selectPlan = (0, import_react29.useCallback)(
20728
+ const selectPlan = (0, import_react30.useCallback)(
20542
20729
  (updates) => {
20543
20730
  const plan = updates.plan;
20544
20731
  const period = showPeriodToggle ? updates.period || planPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
@@ -20610,7 +20797,7 @@ var CheckoutDialog = ({ top }) => {
20610
20797
  checkoutState?.payInAdvanceQuantities
20611
20798
  ]
20612
20799
  );
20613
- const changePlanPeriod = (0, import_react29.useCallback)(
20800
+ const changePlanPeriod = (0, import_react30.useCallback)(
20614
20801
  (period) => {
20615
20802
  if (period === planPeriod) {
20616
20803
  return;
@@ -20667,7 +20854,7 @@ var CheckoutDialog = ({ top }) => {
20667
20854
  handlePreviewCheckout
20668
20855
  ]
20669
20856
  );
20670
- const toggleAddOn = (0, import_react29.useCallback)(
20857
+ const toggleAddOn = (0, import_react30.useCallback)(
20671
20858
  (id) => {
20672
20859
  const updated = addOns.map((addOn) => ({
20673
20860
  ...addOn,
@@ -20700,7 +20887,7 @@ var CheckoutDialog = ({ top }) => {
20700
20887
  },
20701
20888
  [handlePreviewCheckout, addOnUsageBasedEntitlements, addOns]
20702
20889
  );
20703
- const updateAutoTopupConfig = (0, import_react29.useCallback)(
20890
+ const updateAutoTopupConfig = (0, import_react30.useCallback)(
20704
20891
  (id, updates) => {
20705
20892
  setAutoTopupConfigs((prev2) => {
20706
20893
  const nextMap = new Map(prev2);
@@ -20720,7 +20907,7 @@ var CheckoutDialog = ({ top }) => {
20720
20907
  },
20721
20908
  [debouncedPreviewCheckout, planCreditGrants]
20722
20909
  );
20723
- const updateUsageBasedEntitlementQuantity = (0, import_react29.useCallback)(
20910
+ const updateUsageBasedEntitlementQuantity = (0, import_react30.useCallback)(
20724
20911
  (id, updatedQuantity) => {
20725
20912
  setUsageBasedEntitlements((prev2) => {
20726
20913
  const updated = prev2.map(
@@ -20739,7 +20926,7 @@ var CheckoutDialog = ({ top }) => {
20739
20926
  },
20740
20927
  [debouncedPreviewCheckout]
20741
20928
  );
20742
- const updateCreditBundleCount = (0, import_react29.useCallback)(
20929
+ const updateCreditBundleCount = (0, import_react30.useCallback)(
20743
20930
  (id, updatedCount) => {
20744
20931
  const nextCounts = { ...bundleCountsRef.current, [id]: updatedCount };
20745
20932
  bundleCountsRef.current = nextCounts;
@@ -20754,7 +20941,7 @@ var CheckoutDialog = ({ top }) => {
20754
20941
  },
20755
20942
  [bundleGatingPlanId, data?.creditBundles, debouncedPreviewCheckout]
20756
20943
  );
20757
- const toggleCreditBundle = (0, import_react29.useCallback)(
20944
+ const toggleCreditBundle = (0, import_react30.useCallback)(
20758
20945
  (id) => {
20759
20946
  const nextCounts = { ...bundleCountsRef.current };
20760
20947
  if (nextCounts[id]) {
@@ -20774,7 +20961,7 @@ var CheckoutDialog = ({ top }) => {
20774
20961
  },
20775
20962
  [bundleGatingPlanId, data?.creditBundles, handlePreviewCheckout]
20776
20963
  );
20777
- const updateAddOnEntitlementQuantity = (0, import_react29.useCallback)(
20964
+ const updateAddOnEntitlementQuantity = (0, import_react30.useCallback)(
20778
20965
  (id, updatedQuantity) => {
20779
20966
  setAddOnUsageBasedEntitlements((prev2) => {
20780
20967
  const updated = prev2.map(
@@ -20794,25 +20981,25 @@ var CheckoutDialog = ({ top }) => {
20794
20981
  },
20795
20982
  [debouncedPreviewCheckout]
20796
20983
  );
20797
- const updatePromoCode = (0, import_react29.useCallback)(
20984
+ const updatePromoCode = (0, import_react30.useCallback)(
20798
20985
  async (code) => {
20799
20986
  handlePreviewCheckout({ promoCode: code });
20800
20987
  },
20801
20988
  [handlePreviewCheckout]
20802
20989
  );
20803
- const handleClose = (0, import_react29.useCallback)(() => {
20990
+ const handleClose = (0, import_react30.useCallback)(() => {
20804
20991
  clearCheckoutState();
20805
20992
  setLayout("portal");
20806
20993
  }, [setLayout, clearCheckoutState]);
20807
- const hasInitializedPlan = (0, import_react29.useRef)(false);
20808
- (0, import_react29.useEffect)(() => {
20994
+ const hasInitializedPlan = (0, import_react30.useRef)(false);
20995
+ (0, import_react30.useEffect)(() => {
20809
20996
  if (!hasInitializedPlan.current && selectedPlan) {
20810
20997
  hasInitializedPlan.current = true;
20811
20998
  const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
20812
20999
  selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
20813
21000
  }
20814
21001
  }, [selectedPlan, planPeriod, selectPlan]);
20815
- (0, import_react29.useLayoutEffect)(() => {
21002
+ (0, import_react30.useLayoutEffect)(() => {
20816
21003
  const element = dialogRef.current;
20817
21004
  if (layout !== "checkout" || !element) {
20818
21005
  return;
@@ -20828,14 +21015,14 @@ var CheckoutDialog = ({ top }) => {
20828
21015
  element.show();
20829
21016
  }
20830
21017
  }, [layout]);
20831
- (0, import_react29.useLayoutEffect)(() => {
21018
+ (0, import_react30.useLayoutEffect)(() => {
20832
21019
  stageRef.current?.scrollTo({
20833
21020
  top: 0,
20834
21021
  left: 0,
20835
21022
  behavior: "smooth"
20836
21023
  });
20837
21024
  }, [effectiveCheckoutStage]);
20838
- (0, import_react29.useLayoutEffect)(() => {
21025
+ (0, import_react30.useLayoutEffect)(() => {
20839
21026
  if (charges) {
20840
21027
  sidebarRef.current?.scrollTo({
20841
21028
  top: 0,
@@ -20847,7 +21034,7 @@ var CheckoutDialog = ({ top }) => {
20847
21034
  const activeCheckoutStage = checkoutStages.find(
20848
21035
  (stage) => stage.id === effectiveCheckoutStage
20849
21036
  );
20850
- const visibleStages = (0, import_react29.useMemo)(() => {
21037
+ const visibleStages = (0, import_react30.useMemo)(() => {
20851
21038
  if (!checkoutState?.hideSkippedStages) {
20852
21039
  return checkoutStages;
20853
21040
  }
@@ -20870,7 +21057,7 @@ var CheckoutDialog = ({ top }) => {
20870
21057
  return true;
20871
21058
  });
20872
21059
  }, [checkoutStages, checkoutState]);
20873
- const navigableStages = (0, import_react29.useMemo)(() => {
21060
+ const navigableStages = (0, import_react30.useMemo)(() => {
20874
21061
  return checkoutStages.filter((stage) => {
20875
21062
  if (stage.id === "plan" && checkoutState?.bypassPlanSelection) {
20876
21063
  return false;
@@ -21250,7 +21437,7 @@ var CurrencyPeriodMismatchNotice = ({
21250
21437
  style: { opacity: 0.85, textAlign: "center" },
21251
21438
  children: t3("No {{currency}} price for the {{period}} billing period.", {
21252
21439
  currency: currency.toUpperCase(),
21253
- period
21440
+ period: adjectify(period, t3)
21254
21441
  })
21255
21442
  }
21256
21443
  )
@@ -21412,7 +21599,7 @@ var HardLimitTooltip = ({
21412
21599
  feature,
21413
21600
  limit
21414
21601
  }) => {
21415
- const { t: t3 } = useTranslation();
21602
+ const { t: t3, locale } = useTranslation();
21416
21603
  const { data } = useEmbed();
21417
21604
  const isLightBackground = useIsLightBackground();
21418
21605
  const showHardLimit = data?.displaySettings?.showHardLimit ?? false;
@@ -21426,7 +21613,7 @@ var HardLimitTooltip = ({
21426
21613
  trigger: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
21427
21614
  Icon3,
21428
21615
  {
21429
- title: "limit",
21616
+ title: t3("Limit"),
21430
21617
  name: "info-rounded",
21431
21618
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
21432
21619
  style: { lineHeight: 0 }
@@ -21434,7 +21621,7 @@ var HardLimitTooltip = ({
21434
21621
  ),
21435
21622
  content: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { children: t3("Up to a limit of", {
21436
21623
  amount: limit,
21437
- units: getFeatureName(feature, limit)
21624
+ units: getFeatureName(feature, locale, limit)
21438
21625
  }) })
21439
21626
  }
21440
21627
  );
@@ -21480,44 +21667,44 @@ var InvalidCurrencyNotice = ({
21480
21667
  };
21481
21668
 
21482
21669
  // src/components/shared/payment-dialog/PaymentDialog.tsx
21483
- var import_react31 = require("react");
21670
+ var import_react32 = require("react");
21484
21671
 
21485
21672
  // src/components/shared/checkout-dialog/EditableCustomCheckoutFields.tsx
21486
- var import_react30 = require("react");
21673
+ var import_react31 = require("react");
21487
21674
  var import_jsx_runtime35 = require("react/jsx-runtime");
21488
21675
  var EditableCustomCheckoutFields = () => {
21489
21676
  const { t: t3 } = useTranslation();
21490
21677
  const isLightBackground = useIsLightBackground();
21491
21678
  const { data, updateCustomFieldValues } = useEmbed();
21492
- const customCheckoutFields = (0, import_react30.useMemo)(
21679
+ const customCheckoutFields = (0, import_react31.useMemo)(
21493
21680
  () => data?.customCheckoutFields ?? [],
21494
21681
  [data?.customCheckoutFields]
21495
21682
  );
21496
- const serverFieldValues = (0, import_react30.useMemo)(() => {
21683
+ const serverFieldValues = (0, import_react31.useMemo)(() => {
21497
21684
  const values2 = {};
21498
21685
  for (const field of customCheckoutFields) {
21499
21686
  values2[field.id] = field.value ?? "";
21500
21687
  }
21501
21688
  return values2;
21502
21689
  }, [customCheckoutFields]);
21503
- const [editing, setEditing] = (0, import_react30.useState)(false);
21504
- const [values, setValues] = (0, import_react30.useState)(serverFieldValues);
21505
- const [isSaving, setIsSaving] = (0, import_react30.useState)(false);
21506
- const [error, setError] = (0, import_react30.useState)();
21507
- const handleChange = (0, import_react30.useCallback)((fieldId, value) => {
21690
+ const [editing, setEditing] = (0, import_react31.useState)(false);
21691
+ const [values, setValues] = (0, import_react31.useState)(serverFieldValues);
21692
+ const [isSaving, setIsSaving] = (0, import_react31.useState)(false);
21693
+ const [error, setError] = (0, import_react31.useState)();
21694
+ const handleChange = (0, import_react31.useCallback)((fieldId, value) => {
21508
21695
  setValues((prev2) => ({ ...prev2, [fieldId]: value }));
21509
21696
  }, []);
21510
- const handleEdit = (0, import_react30.useCallback)(() => {
21697
+ const handleEdit = (0, import_react31.useCallback)(() => {
21511
21698
  setError(void 0);
21512
21699
  setValues(serverFieldValues);
21513
21700
  setEditing(true);
21514
21701
  }, [serverFieldValues]);
21515
- const handleCancel = (0, import_react30.useCallback)(() => {
21702
+ const handleCancel = (0, import_react31.useCallback)(() => {
21516
21703
  setError(void 0);
21517
21704
  setEditing(false);
21518
21705
  setValues(serverFieldValues);
21519
21706
  }, [serverFieldValues]);
21520
- const handleSave = (0, import_react30.useCallback)(async () => {
21707
+ const handleSave = (0, import_react31.useCallback)(async () => {
21521
21708
  setError(void 0);
21522
21709
  setIsSaving(true);
21523
21710
  try {
@@ -21605,13 +21792,13 @@ var import_jsx_runtime36 = require("react/jsx-runtime");
21605
21792
  var PaymentDialog = ({ top }) => {
21606
21793
  const { t: t3 } = useTranslation();
21607
21794
  const { layout, setLayout, clearCheckoutState } = useEmbed();
21608
- const dialogRef = (0, import_react31.useRef)(null);
21609
- const [isModal, setIsModal] = (0, import_react31.useState)(true);
21610
- const handleClose = (0, import_react31.useCallback)(() => {
21795
+ const dialogRef = (0, import_react32.useRef)(null);
21796
+ const [isModal, setIsModal] = (0, import_react32.useState)(true);
21797
+ const handleClose = (0, import_react32.useCallback)(() => {
21611
21798
  clearCheckoutState();
21612
21799
  setLayout("portal");
21613
21800
  }, [setLayout, clearCheckoutState]);
21614
- (0, import_react31.useLayoutEffect)(() => {
21801
+ (0, import_react32.useLayoutEffect)(() => {
21615
21802
  const element = dialogRef.current;
21616
21803
  if (layout !== "payment" || !element) {
21617
21804
  return;
@@ -21658,7 +21845,7 @@ var PaymentDialog = ({ top }) => {
21658
21845
 
21659
21846
  // src/components/shared/payment-form/PaymentForm.tsx
21660
21847
  var import_react_stripe_js = require("@stripe/react-stripe-js");
21661
- var import_react32 = require("react");
21848
+ var import_react33 = require("react");
21662
21849
  var import_jsx_runtime37 = require("react/jsx-runtime");
21663
21850
  var PaymentForm = ({ onConfirm, financeData }) => {
21664
21851
  const { t: t3 } = useTranslation();
@@ -21673,32 +21860,32 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21673
21860
  financeData
21674
21861
  );
21675
21862
  const showBillingAddress = shouldCollectAddress || collectPhone;
21676
- const loadTimerRef = (0, import_react32.useRef)(
21863
+ const loadTimerRef = (0, import_react33.useRef)(
21677
21864
  void 0
21678
21865
  );
21679
- const [email, setEmail] = (0, import_react32.useState)(() => billing?.email ?? "");
21680
- const userEditedEmailRef = (0, import_react32.useRef)(false);
21681
- const [message, setMessage] = (0, import_react32.useState)();
21682
- const [isLoading, setIsLoading] = (0, import_react32.useState)(false);
21683
- const [isConfirmed, setIsConfirmed] = (0, import_react32.useState)(false);
21684
- const [isPaymentComplete, setIsPaymentComplete] = (0, import_react32.useState)(false);
21685
- const [isPaymentReady, setIsPaymentReady] = (0, import_react32.useState)(false);
21686
- const [loadError, setLoadError] = (0, import_react32.useState)();
21687
- const [isEmailValid, setIsEmailValid] = (0, import_react32.useState)(() => !collectEmail);
21688
- const emailInputRef = (0, import_react32.useRef)(null);
21689
- const [isAddressComplete, setIsAddressComplete] = (0, import_react32.useState)(
21866
+ const [email, setEmail] = (0, import_react33.useState)(() => billing?.email ?? "");
21867
+ const userEditedEmailRef = (0, import_react33.useRef)(false);
21868
+ const [message, setMessage] = (0, import_react33.useState)();
21869
+ const [isLoading, setIsLoading] = (0, import_react33.useState)(false);
21870
+ const [isConfirmed, setIsConfirmed] = (0, import_react33.useState)(false);
21871
+ const [isPaymentComplete, setIsPaymentComplete] = (0, import_react33.useState)(false);
21872
+ const [isPaymentReady, setIsPaymentReady] = (0, import_react33.useState)(false);
21873
+ const [loadError, setLoadError] = (0, import_react33.useState)();
21874
+ const [isEmailValid, setIsEmailValid] = (0, import_react33.useState)(() => !collectEmail);
21875
+ const emailInputRef = (0, import_react33.useRef)(null);
21876
+ const [isAddressComplete, setIsAddressComplete] = (0, import_react33.useState)(
21690
21877
  () => !shouldCollectAddress
21691
21878
  );
21692
- const addressDefaultsKey = (0, import_react32.useMemo)(
21879
+ const addressDefaultsKey = (0, import_react33.useMemo)(
21693
21880
  () => JSON.stringify(billing ?? {}),
21694
21881
  [billing]
21695
21882
  );
21696
- (0, import_react32.useEffect)(() => {
21883
+ (0, import_react33.useEffect)(() => {
21697
21884
  if (!userEditedEmailRef.current && billing?.email) {
21698
21885
  setEmail(billing.email);
21699
21886
  }
21700
21887
  }, [billing?.email]);
21701
- (0, import_react32.useEffect)(() => {
21888
+ (0, import_react33.useEffect)(() => {
21702
21889
  setIsEmailValid(
21703
21890
  !collectEmail || (emailInputRef.current?.checkValidity() ?? false)
21704
21891
  );
@@ -21743,7 +21930,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21743
21930
  setIsLoading(false);
21744
21931
  }
21745
21932
  };
21746
- (0, import_react32.useEffect)(() => {
21933
+ (0, import_react33.useEffect)(() => {
21747
21934
  loadTimerRef.current = setTimeout(() => {
21748
21935
  if (!isPaymentReady) {
21749
21936
  setLoadError(t3("Unable to load payment form."));
@@ -21798,7 +21985,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21798
21985
  )
21799
21986
  ] }),
21800
21987
  stripe && collectEmail && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box, { "data-field": "name", $marginBottom: "1.5rem", $verticalAlign: "top", children: [
21801
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Label, { htmlFor: "email", children: "Email" }),
21988
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Label, { htmlFor: "email", children: t3("Email") }),
21802
21989
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
21803
21990
  Input2,
21804
21991
  {
@@ -21807,7 +21994,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21807
21994
  type: "email",
21808
21995
  value: email,
21809
21996
  autoComplete: "email",
21810
- placeholder: "Enter email address",
21997
+ placeholder: t3("Enter email address"),
21811
21998
  required: true,
21812
21999
  onChange: (e) => {
21813
22000
  userEditedEmailRef.current = true;
@@ -21854,7 +22041,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21854
22041
  };
21855
22042
 
21856
22043
  // src/components/shared/period-toggle/PeriodToggle.tsx
21857
- var import_react33 = require("react");
22044
+ var import_react34 = require("react");
21858
22045
  var import_jsx_runtime38 = require("react/jsx-runtime");
21859
22046
  var PERIOD_MONTH_COUNT = {
21860
22047
  year: 12,
@@ -21870,7 +22057,7 @@ var PeriodToggle = ({
21870
22057
  const { t: t3 } = useTranslation();
21871
22058
  const { settings } = useEmbed();
21872
22059
  const isLightBackground = useIsLightBackground();
21873
- const savingsByPeriod = (0, import_react33.useMemo)(() => {
22060
+ const savingsByPeriod = (0, import_react34.useMemo)(() => {
21874
22061
  const result = {};
21875
22062
  if (!selectedPlan) {
21876
22063
  return result;
@@ -21934,7 +22121,7 @@ var PeriodToggle = ({
21934
22121
  },
21935
22122
  $size: 15,
21936
22123
  $weight: option === selectedOption ? 600 : 400,
21937
- children: t3("Billed", { period: adjectify(option) })
22124
+ children: t3("Billed", { period: adjectify(option, t3) })
21938
22125
  }
21939
22126
  )
21940
22127
  },
@@ -21974,7 +22161,7 @@ var PlanCreditText = ({
21974
22161
  entitlements,
21975
22162
  children
21976
22163
  }) => {
21977
- const { t: t3 } = useTranslation();
22164
+ const { t: t3, locale } = useTranslation();
21978
22165
  const { settings } = useEmbed();
21979
22166
  const sources = entitlements ?? [];
21980
22167
  const { perLicenseGrants } = credit;
@@ -21982,7 +22169,7 @@ var PlanCreditText = ({
21982
22169
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { children: [
21983
22170
  credit.quantity,
21984
22171
  " ",
21985
- getFeatureName(credit, credit.quantity),
22172
+ getFeatureName(credit, locale, credit.quantity),
21986
22173
  credit.period && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
21987
22174
  " ",
21988
22175
  t3("per"),
@@ -21994,18 +22181,18 @@ var PlanCreditText = ({
21994
22181
  }
21995
22182
  const resolveLicenseName = (grant) => {
21996
22183
  const licenseFeature = (findLicenseSource(sources, grant.licenseId) ?? (grant.licenseId ? void 0 : findSoleLicenseSource(sources)))?.feature;
21997
- return licenseFeature ? getFeatureName(licenseFeature, 1) : t3("license");
22184
+ return licenseFeature ? getFeatureName(licenseFeature, locale, 1) : t3("license");
21998
22185
  };
21999
22186
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
22000
22187
  perLicenseGrants.map((grant, grantIndex) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { children: [
22001
22188
  credit.period ? t3("X credits per license per period", {
22002
22189
  amount: grant.amount,
22003
- creditName: getFeatureName(credit, grant.amount),
22190
+ creditName: getFeatureName(credit, locale, grant.amount),
22004
22191
  licenseName: resolveLicenseName(grant),
22005
22192
  period: t3(credit.period)
22006
22193
  }) : t3("X credits per license", {
22007
22194
  amount: grant.amount,
22008
- creditName: getFeatureName(credit, grant.amount),
22195
+ creditName: getFeatureName(credit, locale, grant.amount),
22009
22196
  licenseName: resolveLicenseName(grant)
22010
22197
  }),
22011
22198
  grantIndex === 0 && children
@@ -22018,7 +22205,7 @@ var PlanCreditText = ({
22018
22205
  $color: settings.theme.typography.text.color,
22019
22206
  children: t3("Plus X credits per period for your company", {
22020
22207
  amount: credit.fixedQuantity,
22021
- creditName: getFeatureName(credit, credit.fixedQuantity),
22208
+ creditName: getFeatureName(credit, locale, credit.fixedQuantity),
22022
22209
  period: t3(credit.period)
22023
22210
  })
22024
22211
  }
@@ -22027,10 +22214,10 @@ var PlanCreditText = ({
22027
22214
  };
22028
22215
 
22029
22216
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
22030
- var import_react35 = require("react");
22217
+ var import_react36 = require("react");
22031
22218
 
22032
22219
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
22033
- var import_react34 = require("react");
22220
+ var import_react35 = require("react");
22034
22221
  var import_jsx_runtime40 = require("react/jsx-runtime");
22035
22222
  var PriceText = ({
22036
22223
  feature,
@@ -22041,13 +22228,13 @@ var PriceText = ({
22041
22228
  }) => {
22042
22229
  const { settings } = useEmbed();
22043
22230
  const { t: t3, locale } = useTranslation();
22044
- const text = (0, import_react34.useMemo)(() => {
22231
+ const text = (0, import_react35.useMemo)(() => {
22045
22232
  if (!flatAmount && perUnitPrice) {
22046
22233
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
22047
22234
  formatCurrency(perUnitPrice, { locale, currency }),
22048
22235
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("sub", { children: [
22049
22236
  "/",
22050
- getFeatureName(feature, 1)
22237
+ getFeatureName(feature, locale, 1)
22051
22238
  ] })
22052
22239
  ] });
22053
22240
  }
@@ -22064,7 +22251,7 @@ var PriceText = ({
22064
22251
  formatCurrency(perUnitPrice, { locale, currency }),
22065
22252
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("sub", { children: [
22066
22253
  "/",
22067
- getFeatureName(feature, 1)
22254
+ getFeatureName(feature, locale, 1)
22068
22255
  ] }),
22069
22256
  " + ",
22070
22257
  formatCurrency(flatAmount, { locale, currency }),
@@ -22098,7 +22285,7 @@ var PricingTiersTooltip = ({
22098
22285
  const { t: t3 } = useTranslation();
22099
22286
  const { settings } = useEmbed();
22100
22287
  const isLightBackground = useIsLightBackground();
22101
- const { tiers } = (0, import_react35.useMemo)(() => {
22288
+ const { tiers } = (0, import_react36.useMemo)(() => {
22102
22289
  return priceTiers.reduce(
22103
22290
  (acc, tier) => {
22104
22291
  const end = tier.upTo ?? Infinity;
@@ -22125,7 +22312,7 @@ var PricingTiersTooltip = ({
22125
22312
  trigger: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
22126
22313
  Icon3,
22127
22314
  {
22128
- title: "tiered pricing",
22315
+ title: t3("Tiered pricing"),
22129
22316
  name: "info-rounded",
22130
22317
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
22131
22318
  style: { lineHeight: 0 }
@@ -22192,7 +22379,7 @@ var PricingTiersTooltip = ({
22192
22379
  };
22193
22380
 
22194
22381
  // src/components/shared/subscription-sidebar/SubscriptionSidebar.tsx
22195
- var import_react37 = require("react");
22382
+ var import_react38 = require("react");
22196
22383
  var import_react_dom2 = require("react-dom");
22197
22384
 
22198
22385
  // src/components/shared/subscription-sidebar/CheckoutStageButton.tsx
@@ -22627,11 +22814,11 @@ var EntitlementRow = (props) => {
22627
22814
  /* @__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: [
22628
22815
  quantity,
22629
22816
  " ",
22630
- getFeatureName(feature, quantity)
22817
+ getFeatureName(feature, locale, quantity)
22631
22818
  ] }) : priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
22632
22819
  softLimit,
22633
22820
  " ",
22634
- getFeatureName(feature, softLimit)
22821
+ getFeatureName(feature, locale, softLimit)
22635
22822
  ] }) : feature.name }) }),
22636
22823
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
22637
22824
  // A tiered scheme still resolves to a fixed amount at the chosen
@@ -22662,7 +22849,7 @@ var EntitlementRow = (props) => {
22662
22849
  packageSize,
22663
22850
  " "
22664
22851
  ] }),
22665
- getFeatureName(feature, packageSize),
22852
+ getFeatureName(feature, locale, packageSize),
22666
22853
  feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
22667
22854
  "/",
22668
22855
  shortenPeriod(planPeriod, t3)
@@ -22674,12 +22861,12 @@ var EntitlementRow = (props) => {
22674
22861
  };
22675
22862
 
22676
22863
  // src/components/shared/subscription-sidebar/Proration.tsx
22677
- var import_react36 = require("react");
22864
+ var import_react37 = require("react");
22678
22865
  var import_jsx_runtime44 = require("react/jsx-runtime");
22679
22866
  var Proration = ({ currency, charges }) => {
22680
22867
  const { t: t3, locale } = useTranslation();
22681
22868
  const { settings } = useEmbed();
22682
- const [open, setOpen] = (0, import_react36.useState)(false);
22869
+ const [open, setOpen] = (0, import_react37.useState)(false);
22683
22870
  const toggle = (e) => {
22684
22871
  e.preventDefault();
22685
22872
  e.stopPropagation();
@@ -22730,7 +22917,7 @@ var Proration = ({ currency, charges }) => {
22730
22917
 
22731
22918
  // src/components/shared/subscription-sidebar/SubscriptionSidebar.tsx
22732
22919
  var import_jsx_runtime45 = require("react/jsx-runtime");
22733
- var SubscriptionSidebar = (0, import_react37.forwardRef)(
22920
+ var SubscriptionSidebar = (0, import_react38.forwardRef)(
22734
22921
  ({
22735
22922
  portal,
22736
22923
  planPeriod,
@@ -22781,8 +22968,8 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22781
22968
  } = useEmbed();
22782
22969
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
22783
22970
  const isLightBackground = useIsLightBackground();
22784
- const buttonRef = (0, import_react37.useRef)(null);
22785
- const [isButtonInView, setIsButtonInView] = (0, import_react37.useState)(false);
22971
+ const buttonRef = (0, import_react38.useRef)(null);
22972
+ const [isButtonInView, setIsButtonInView] = (0, import_react38.useState)(false);
22786
22973
  const {
22787
22974
  currentPlan,
22788
22975
  currentAddOns,
@@ -22791,7 +22978,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22791
22978
  billingSubscription,
22792
22979
  paymentMethod,
22793
22980
  trialPaymentMethodRequired
22794
- } = (0, import_react37.useMemo)(() => {
22981
+ } = (0, import_react38.useMemo)(() => {
22795
22982
  const currentEntitlements2 = data?.featureUsage?.features || [];
22796
22983
  return {
22797
22984
  currentPlan: data?.company?.plan,
@@ -22814,7 +23001,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22814
23001
  data?.subscription?.paymentMethod,
22815
23002
  data?.trialPaymentMethodRequired
22816
23003
  ]);
22817
- const planCreditGrants = (0, import_react37.useMemo)(() => {
23004
+ const planCreditGrants = (0, import_react38.useMemo)(() => {
22818
23005
  const grants = mergeCompanyGrants(
22819
23006
  selectedPlan?.includedCreditGrants,
22820
23007
  data?.company?.plan?.includedCreditGrants
@@ -22824,11 +23011,11 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22824
23011
  selectedPlan?.includedCreditGrants,
22825
23012
  data?.company?.plan?.includedCreditGrants
22826
23013
  ]);
22827
- const planCredits = (0, import_react37.useMemo)(
23014
+ const planCredits = (0, import_react38.useMemo)(
22828
23015
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
22829
23016
  [selectedPlan?.includedCreditGrants]
22830
23017
  );
22831
- const { payInAdvanceEntitlements } = (0, import_react37.useMemo)(() => {
23018
+ const { payInAdvanceEntitlements } = (0, import_react38.useMemo)(() => {
22832
23019
  const payAsYouGoEntitlements = [];
22833
23020
  const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
22834
23021
  (entitlement) => {
@@ -22840,7 +23027,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22840
23027
  );
22841
23028
  return { payAsYouGoEntitlements, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
22842
23029
  }, [usageBasedEntitlements]);
22843
- const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = (0, import_react37.useMemo)(() => {
23030
+ const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = (0, import_react38.useMemo)(() => {
22844
23031
  let planPrice;
22845
23032
  let resolvedCurrency;
22846
23033
  if (selectedPlan) {
@@ -22911,7 +23098,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22911
23098
  proration,
22912
23099
  taxAmount,
22913
23100
  taxDescription
22914
- } = (0, import_react37.useMemo)(() => {
23101
+ } = (0, import_react38.useMemo)(() => {
22915
23102
  return {
22916
23103
  amountOff: charges?.amountOff ?? 0,
22917
23104
  discountAmount: charges?.discountAmount ?? 0,
@@ -22959,7 +23146,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22959
23146
  $color: settings.theme.typography.text.color,
22960
23147
  children: t3("Includes X credits per period", {
22961
23148
  total: includedCredits,
22962
- creditName: getFeatureName(credit, includedCredits),
23149
+ creditName: getFeatureName(credit, locale, includedCredits),
22963
23150
  period: shortenPeriod(credit.period, t3)
22964
23151
  })
22965
23152
  }
@@ -22981,7 +23168,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
22981
23168
  }
22982
23169
  );
22983
23170
  };
22984
- const updatedUsageBasedEntitlements = (0, import_react37.useMemo)(() => {
23171
+ const updatedUsageBasedEntitlements = (0, import_react38.useMemo)(() => {
22985
23172
  const changedUsageBasedEntitlements = [];
22986
23173
  const allSelectedUsageBasedEntitlements = [
22987
23174
  ...usageBasedEntitlements,
@@ -23044,19 +23231,19 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23044
23231
  usageBasedEntitlements,
23045
23232
  addOnUsageBasedEntitlements
23046
23233
  ]);
23047
- const selectedAddOnsWithPrice = (0, import_react37.useMemo)(
23234
+ const selectedAddOnsWithPrice = (0, import_react38.useMemo)(
23048
23235
  () => addOns.filter(
23049
23236
  (addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
23050
23237
  ),
23051
23238
  [addOns, currency]
23052
23239
  );
23053
- const selectedOneTimeAddOns = (0, import_react37.useMemo)(
23240
+ const selectedOneTimeAddOns = (0, import_react38.useMemo)(
23054
23241
  () => addOns.filter(
23055
23242
  (addOn) => addOn.isSelected && addOn.chargeType === ChargeType.oneTime && getAddOnPrice(addOn, planPeriod, currency)?.price
23056
23243
  ),
23057
23244
  [addOns, planPeriod, currency]
23058
23245
  );
23059
- const { removedAddOns, willAddOnsChange } = (0, import_react37.useMemo)(() => {
23246
+ const { removedAddOns, willAddOnsChange } = (0, import_react38.useMemo)(() => {
23060
23247
  const addedAddOns = selectedAddOnsWithPrice.filter(
23061
23248
  (selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
23062
23249
  );
@@ -23072,15 +23259,15 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23072
23259
  willAddOnsChange: willAddOnsChange2
23073
23260
  };
23074
23261
  }, [currentAddOns, selectedAddOnsWithPrice, currency]);
23075
- const addedCreditBundles = (0, import_react37.useMemo)(
23262
+ const addedCreditBundles = (0, import_react38.useMemo)(
23076
23263
  () => creditBundles.filter((bundle) => bundle.count > 0),
23077
23264
  [creditBundles]
23078
23265
  );
23079
- const discountApplied = (0, import_react37.useMemo)(
23266
+ const discountApplied = (0, import_react38.useMemo)(
23080
23267
  () => promoCode && (amountOff > 0 || percentOff > 0),
23081
23268
  [promoCode, amountOff, percentOff]
23082
23269
  );
23083
- const subscriptionDiscount = (0, import_react37.useMemo)(
23270
+ const subscriptionDiscount = (0, import_react38.useMemo)(
23084
23271
  () => getSubscriptionDiscount(
23085
23272
  charges?.discounts,
23086
23273
  subscriptionTotal,
@@ -23089,7 +23276,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23089
23276
  ),
23090
23277
  [charges?.discounts, subscriptionTotal, subscriptionCurrency, locale]
23091
23278
  );
23092
- const handleCheckout = (0, import_react37.useCallback)(async () => {
23279
+ const handleCheckout = (0, import_react38.useCallback)(async () => {
23093
23280
  const planId = selectedPlan?.id;
23094
23281
  const currencyPrice = selectedPlan ? getPlanPrice(
23095
23282
  selectedPlan,
@@ -23226,7 +23413,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23226
23413
  customFieldValues,
23227
23414
  ensureTaxIdSaved
23228
23415
  ]);
23229
- const handleUnsubscribe = (0, import_react37.useCallback)(async () => {
23416
+ const handleUnsubscribe = (0, import_react38.useCallback)(async () => {
23230
23417
  try {
23231
23418
  setError(void 0);
23232
23419
  setIsLoading(true);
@@ -23240,7 +23427,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23240
23427
  }
23241
23428
  }, [t3, unsubscribe, setError, setIsLoading, setLayout]);
23242
23429
  const isSelectedPlanTrialable = selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
23243
- const button = (0, import_react37.useMemo)(() => {
23430
+ const button = (0, import_react38.useMemo)(() => {
23244
23431
  const hasEntitlementDowngrade = payInAdvanceEntitlements.some((e) => e.quantity < e.usage) || addOnPayInAdvanceEntitlements.some((e) => e.quantity < e.usage);
23245
23432
  const canCheckout = error !== t3("Downgrade not permitted.") && !hasEntitlementDowngrade;
23246
23433
  const isSticky = !isButtonInView;
@@ -23314,7 +23501,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23314
23501
  isCreditOnlyPurchase,
23315
23502
  hasIncompleteRequiredCustomFields
23316
23503
  ]);
23317
- (0, import_react37.useLayoutEffect)(() => {
23504
+ (0, import_react38.useLayoutEffect)(() => {
23318
23505
  const element = buttonRef.current;
23319
23506
  if (!element) {
23320
23507
  return;
@@ -23697,7 +23884,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23697
23884
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { children: [
23698
23885
  formatNumber(amount, { locale }),
23699
23886
  " ",
23700
- getFeatureName(bundle, amount),
23887
+ getFeatureName(bundle, locale, amount),
23701
23888
  expiry && ` \xB7 ${expiry}`
23702
23889
  ] }) })
23703
23890
  ] }),
@@ -23968,14 +24155,14 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
23968
24155
  SubscriptionSidebar.displayName = "SubscriptionSidebar";
23969
24156
 
23970
24157
  // src/components/shared/tiered-pricing-details/TieredPricingDetails.tsx
23971
- var import_react38 = require("react");
24158
+ var import_react39 = require("react");
23972
24159
  var TieredPricingDetails = ({
23973
24160
  entitlement,
23974
24161
  period,
23975
24162
  currency: selectedCurrency
23976
24163
  }) => {
23977
24164
  const { t: t3, locale } = useTranslation();
23978
- const { currency, flatAmount, perUnitPrice, upTo } = (0, import_react38.useMemo)(() => {
24165
+ const { currency, flatAmount, perUnitPrice, upTo } = (0, import_react39.useMemo)(() => {
23979
24166
  const { currency: currency2, priceTier } = getEntitlementPrice(entitlement, period, selectedCurrency) || {};
23980
24167
  const { flatAmount: flatAmount2, perUnitPrice: perUnitPrice2, perUnitPriceDecimal, upTo: upTo2 } = priceTier?.[0] || {};
23981
24168
  return {
@@ -23991,21 +24178,21 @@ var TieredPricingDetails = ({
23991
24178
  if (flatAmount === 0 && perUnitPrice === 0) {
23992
24179
  return t3("Up to X units for free", {
23993
24180
  X: upTo,
23994
- units: getFeatureName(entitlement.feature, upTo)
24181
+ units: getFeatureName(entitlement.feature, locale, upTo)
23995
24182
  });
23996
24183
  }
23997
24184
  if (flatAmount === 0 && perUnitPrice > 0) {
23998
24185
  return t3("Up to X units at $Y/unit", {
23999
24186
  X: upTo,
24000
- units: getFeatureName(entitlement.feature, upTo),
24187
+ units: getFeatureName(entitlement.feature, locale, upTo),
24001
24188
  Y: formatCurrency(perUnitPrice, { locale, currency }),
24002
- unit: getFeatureName(entitlement.feature, 1)
24189
+ unit: getFeatureName(entitlement.feature, locale, 1)
24003
24190
  });
24004
24191
  }
24005
24192
  if (flatAmount > 0 && perUnitPrice === 0) {
24006
24193
  return t3("Up to X units for $Y/period", {
24007
24194
  X: upTo,
24008
- units: getFeatureName(entitlement.feature, upTo),
24195
+ units: getFeatureName(entitlement.feature, locale, upTo),
24009
24196
  Y: formatCurrency(flatAmount, { locale, currency }),
24010
24197
  period
24011
24198
  });
@@ -24013,9 +24200,9 @@ var TieredPricingDetails = ({
24013
24200
  if (flatAmount > 0 && perUnitPrice > 0) {
24014
24201
  return t3("Up to X units at $Y/unit + $Z/period", {
24015
24202
  X: upTo,
24016
- units: getFeatureName(entitlement.feature, upTo),
24203
+ units: getFeatureName(entitlement.feature, locale, upTo),
24017
24204
  Y: formatCurrency(perUnitPrice, { locale, currency }),
24018
- unit: getFeatureName(entitlement.feature, 1),
24205
+ unit: getFeatureName(entitlement.feature, locale, 1),
24019
24206
  Z: formatCurrency(flatAmount, { locale, currency }),
24020
24207
  period
24021
24208
  });
@@ -24023,25 +24210,26 @@ var TieredPricingDetails = ({
24023
24210
  };
24024
24211
 
24025
24212
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
24026
- var import_react39 = require("react");
24213
+ var import_react40 = require("react");
24027
24214
  var import_jsx_runtime46 = require("react/jsx-runtime");
24028
24215
  var UnsubscribeDialog = ({ top }) => {
24029
24216
  const { t: t3, locale } = useTranslation();
24030
24217
  const { data, layout, setLayout, setCheckoutState, clearCheckoutState } = useEmbed();
24031
- const dialogRef = (0, import_react39.useRef)(null);
24032
- const sidebarRef = (0, import_react39.useRef)(null);
24033
- const [dialogElement, setDialogElement] = (0, import_react39.useState)(
24218
+ const dialogRef = (0, import_react40.useRef)(null);
24219
+ const sidebarRef = (0, import_react40.useRef)(null);
24220
+ const [dialogElement, setDialogElement] = (0, import_react40.useState)(
24034
24221
  null
24035
24222
  );
24036
- const setDialog = (0, import_react39.useCallback)((element) => {
24223
+ const setDialog = (0, import_react40.useCallback)((element) => {
24037
24224
  dialogRef.current = element;
24038
24225
  setDialogElement(element);
24039
24226
  }, []);
24040
- const [error, setError] = (0, import_react39.useState)();
24041
- const [isLoading, setIsLoading] = (0, import_react39.useState)(false);
24042
- const [isModal, setIsModal] = (0, import_react39.useState)(true);
24043
- const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = (0, import_react39.useMemo)(() => {
24044
- const cancelDate2 = data?.subscription?.cancelAt || data?.upcomingInvoice?.dueDate;
24227
+ const [error, setError] = (0, import_react40.useState)();
24228
+ const [isLoading, setIsLoading] = (0, import_react40.useState)(false);
24229
+ const [isModal, setIsModal] = (0, import_react40.useState)(true);
24230
+ const { billDate } = useNextBillDate();
24231
+ const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = (0, import_react40.useMemo)(() => {
24232
+ const cancelDate2 = data?.subscription?.cancelAt || billDate;
24045
24233
  return {
24046
24234
  planPeriod: getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month",
24047
24235
  currentPlan: data?.company?.plan,
@@ -24055,10 +24243,10 @@ var UnsubscribeDialog = ({ top }) => {
24055
24243
  data?.company?.plan,
24056
24244
  data?.featureUsage,
24057
24245
  data?.subscription?.cancelAt,
24058
- data?.upcomingInvoice?.dueDate
24246
+ billDate
24059
24247
  ]);
24060
24248
  const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
24061
- const selectedPlan = (0, import_react39.useMemo)(
24249
+ const selectedPlan = (0, import_react40.useMemo)(
24062
24250
  () => availablePlans.find((plan) => plan.id === currentPlan?.id),
24063
24251
  [currentPlan?.id, availablePlans]
24064
24252
  );
@@ -24067,18 +24255,18 @@ var UnsubscribeDialog = ({ top }) => {
24067
24255
  createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
24068
24256
  []
24069
24257
  );
24070
- const addOns = (0, import_react39.useMemo)(
24258
+ const addOns = (0, import_react40.useMemo)(
24071
24259
  () => availableAddOns.map((available) => ({
24072
24260
  ...available,
24073
24261
  isSelected: currentAddOns.some((current) => available.id === current.id) ?? false
24074
24262
  })),
24075
24263
  [currentAddOns, availableAddOns]
24076
24264
  );
24077
- const handleClose = (0, import_react39.useCallback)(() => {
24265
+ const handleClose = (0, import_react40.useCallback)(() => {
24078
24266
  clearCheckoutState();
24079
24267
  setLayout("portal");
24080
24268
  }, [setLayout, clearCheckoutState]);
24081
- (0, import_react39.useLayoutEffect)(() => {
24269
+ (0, import_react40.useLayoutEffect)(() => {
24082
24270
  const element = dialogRef.current;
24083
24271
  if (layout !== "unsubscribe" || !element) {
24084
24272
  return;
@@ -24318,6 +24506,7 @@ var Badge = () => {
24318
24506
  // src/components/layout/RenderLayout.tsx
24319
24507
  var import_jsx_runtime49 = require("react/jsx-runtime");
24320
24508
  var Disabled = () => {
24509
+ const { t: t3 } = useTranslation();
24321
24510
  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)(
24322
24511
  Element,
24323
24512
  {
@@ -24327,8 +24516,8 @@ var Disabled = () => {
24327
24516
  $alignItems: "center",
24328
24517
  $whiteSpace: "nowrap",
24329
24518
  children: [
24330
- /* @__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" }) }),
24331
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "p", children: "Please try again later." })
24519
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "h1", display: "heading1", children: t3("Portal not found") }) }),
24520
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "p", children: t3("Please try again later.") })
24332
24521
  ]
24333
24522
  }
24334
24523
  ) }) });
@@ -24363,13 +24552,13 @@ var StyledViewport = gt.div.withConfig({
24363
24552
 
24364
24553
  // src/components/layout/viewport/Viewport.tsx
24365
24554
  var import_jsx_runtime50 = require("react/jsx-runtime");
24366
- var Viewport = (0, import_react40.forwardRef)(
24555
+ var Viewport = (0, import_react41.forwardRef)(
24367
24556
  ({ children, portal, ...props }, ref) => {
24368
24557
  portal = portal || document.body;
24369
- const portalRef = (0, import_react40.useRef)(portal);
24558
+ const portalRef = (0, import_react41.useRef)(portal);
24370
24559
  const { data, layout, settings } = useEmbed();
24371
- const [top, setTop] = (0, import_react40.useState)(0);
24372
- (0, import_react40.useLayoutEffect)(() => {
24560
+ const [top, setTop] = (0, import_react41.useState)(0);
24561
+ (0, import_react41.useLayoutEffect)(() => {
24373
24562
  const element = portalRef.current;
24374
24563
  const setModalY = (0, import_debounce5.default)(() => {
24375
24564
  const value = Math.abs(
@@ -24412,7 +24601,7 @@ var resolveDesignProps = (props) => {
24412
24601
  }
24413
24602
  };
24414
24603
  };
24415
- var ButtonElement = (0, import_react41.forwardRef)(({ children, className, ...rest }, ref) => {
24604
+ var ButtonElement = (0, import_react42.forwardRef)(({ children, className, ...rest }, ref) => {
24416
24605
  const props = resolveDesignProps(rest);
24417
24606
  const buttonStyles2 = {
24418
24607
  primary: {
@@ -24457,10 +24646,10 @@ var ButtonElement = (0, import_react41.forwardRef)(({ children, className, ...re
24457
24646
  ButtonElement.displayName = "Button";
24458
24647
 
24459
24648
  // src/components/elements/included-features/IncludedFeatures.tsx
24460
- var import_react43 = require("react");
24649
+ var import_react44 = require("react");
24461
24650
 
24462
24651
  // src/components/elements/included-features/UsageDetails.tsx
24463
- var import_react42 = require("react");
24652
+ var import_react43 = require("react");
24464
24653
  var import_jsx_runtime52 = require("react/jsx-runtime");
24465
24654
  var UsageDetails = ({ entitlement, layout }) => {
24466
24655
  const {
@@ -24488,7 +24677,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24488
24677
  currentTier,
24489
24678
  tiersMode,
24490
24679
  tiered
24491
- } = (0, import_react42.useMemo)(() => {
24680
+ } = (0, import_react43.useMemo)(() => {
24492
24681
  const { billingPrice, amount, limit: limit2, cost: cost2, currentTier: currentTier2 } = getUsageDetails(
24493
24682
  entitlement,
24494
24683
  period,
@@ -24515,19 +24704,19 @@ var UsageDetails = ({ entitlement, layout }) => {
24515
24704
  tiered: priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(billingPrice)
24516
24705
  };
24517
24706
  }, [entitlement, period, priceBehavior, showWarningThresholdAsLimit]);
24518
- const text = (0, import_react42.useMemo)(() => {
24707
+ const text = (0, import_react43.useMemo)(() => {
24519
24708
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24520
24709
  return;
24521
24710
  }
24522
24711
  if (priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof allocation === "number") {
24523
24712
  return t3("X units", {
24524
24713
  amount: formatNumber(allocation, { locale }),
24525
- units: getFeatureName(feature, allocation)
24714
+ units: getFeatureName(feature, locale, allocation)
24526
24715
  });
24527
24716
  }
24528
24717
  if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo && typeof price === "number") {
24529
24718
  const formattedCost = formatCurrency(price, { locale, currency });
24530
- const featureName = getFeatureName(feature, packageSize);
24719
+ const featureName = getFeatureName(feature, locale, packageSize);
24531
24720
  return packageSize > 1 ? t3("$X per Y units", {
24532
24721
  cost: formattedCost,
24533
24722
  size: packageSize,
@@ -24537,15 +24726,15 @@ var UsageDetails = ({ entitlement, layout }) => {
24537
24726
  if (priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number") {
24538
24727
  return t3("X units", {
24539
24728
  amount: formatNumber(softLimit, { locale }),
24540
- units: getFeatureName(feature, softLimit)
24729
+ units: getFeatureName(feature, locale, softLimit)
24541
24730
  });
24542
24731
  }
24543
24732
  if (priceBehavior === EntitlementPriceBehavior.Tier) {
24544
24733
  return typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t3("Unlimited in this tier", {
24545
- feature: getFeatureName(feature)
24734
+ feature: getFeatureName(feature, locale)
24546
24735
  }) : t3("Up to X units in this tier", {
24547
24736
  amount: formatNumber(currentTier.to, { locale }),
24548
- feature: getFeatureName(feature, currentTier.to)
24737
+ feature: getFeatureName(feature, locale, currentTier.to)
24549
24738
  }));
24550
24739
  }
24551
24740
  if (showCredits && priceBehavior === EntitlementPriceBehavior.CreditBurndown && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
@@ -24553,6 +24742,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24553
24742
  amount: formatConsumptionRate(planEntitlement.consumptionRate, locale),
24554
24743
  units: getFeatureName(
24555
24744
  planEntitlement.valueCredit,
24745
+ locale,
24556
24746
  planEntitlement.consumptionRate
24557
24747
  )
24558
24748
  });
@@ -24560,18 +24750,18 @@ var UsageDetails = ({ entitlement, layout }) => {
24560
24750
  if (priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof limit === "number") {
24561
24751
  return t3("X units remaining", {
24562
24752
  amount: formatNumber(limit, { locale }),
24563
- units: getFeatureName(feature, limit)
24753
+ units: getFeatureName(feature, locale, limit)
24564
24754
  });
24565
24755
  }
24566
24756
  if (!priceBehavior && typeof allocation === "number") {
24567
24757
  const numericLimit = limit ?? allocation;
24568
24758
  return t3("X units", {
24569
24759
  amount: formatNumber(numericLimit, { locale }),
24570
- units: getFeatureName(feature, numericLimit)
24760
+ units: getFeatureName(feature, locale, numericLimit)
24571
24761
  });
24572
24762
  }
24573
24763
  if (!priceBehavior && allocationType === "unlimited") {
24574
- return t3("Unlimited", { item: getFeatureName(feature) });
24764
+ return t3("Unlimited", { item: getFeatureName(feature, locale) });
24575
24765
  }
24576
24766
  }, [
24577
24767
  t3,
@@ -24589,7 +24779,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24589
24779
  currentTier,
24590
24780
  showCredits
24591
24781
  ]);
24592
- const usageText = (0, import_react42.useMemo)(() => {
24782
+ const usageText = (0, import_react43.useMemo)(() => {
24593
24783
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24594
24784
  return;
24595
24785
  }
@@ -24597,37 +24787,37 @@ var UsageDetails = ({ entitlement, layout }) => {
24597
24787
  let index = 0;
24598
24788
  if (priceBehavior === EntitlementPriceBehavior.PayInAdvance && !tiered && typeof period === "string" && typeof price === "number") {
24599
24789
  acc.push(
24600
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react42.Fragment, { children: packageSize > 1 ? t3("$X/Y units/period", {
24790
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react43.Fragment, { children: packageSize > 1 ? t3("$X/Y units/period", {
24601
24791
  cost: formatCurrency(price, { locale, currency }),
24602
24792
  size: packageSize,
24603
- units: getFeatureName(feature, packageSize),
24793
+ units: getFeatureName(feature, locale, packageSize),
24604
24794
  period: shortenPeriod(period, t3)
24605
24795
  }) : t3("$X/unit/period", {
24606
24796
  cost: formatCurrency(price, { locale, currency }),
24607
- unit: getFeatureName(feature, packageSize),
24797
+ unit: getFeatureName(feature, locale, packageSize),
24608
24798
  period: shortenPeriod(period, t3)
24609
24799
  }) }, index)
24610
24800
  );
24611
24801
  index += 1;
24612
24802
  } else if ((priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier || priceBehavior === EntitlementPriceBehavior.CreditBurndown || tiered) && typeof usage === "number") {
24613
24803
  acc.push(
24614
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react42.Fragment, { children: t3("X units used", {
24804
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react43.Fragment, { children: t3("X units used", {
24615
24805
  amount: usage,
24616
- units: getFeatureName(feature, usage)
24806
+ units: getFeatureName(feature, locale, usage)
24617
24807
  }) }, index)
24618
24808
  );
24619
24809
  index += 1;
24620
24810
  }
24621
24811
  if (typeof cost === "number" && cost > 0) {
24622
24812
  acc.push(
24623
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
24813
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react43.Fragment, { children: [
24624
24814
  acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: " \u2022 " }),
24625
24815
  formatCurrency(cost, { locale, currency })
24626
24816
  ] }, index)
24627
24817
  );
24628
24818
  index += 1;
24629
24819
  if (feature.featureType === FeatureType.Trait && typeof period === "string") {
24630
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
24820
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react43.Fragment, { children: [
24631
24821
  "/",
24632
24822
  shortenPeriod(period, t3)
24633
24823
  ] }, index));
@@ -24636,7 +24826,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24636
24826
  }
24637
24827
  if (metricResetAt) {
24638
24828
  acc.push(
24639
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react42.Fragment, { children: [
24829
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react43.Fragment, { children: [
24640
24830
  acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: " \u2022 " }),
24641
24831
  t3("Resets", {
24642
24832
  date: toPrettyDate(metricResetAt, {
@@ -24761,12 +24951,12 @@ function resolveDesignProps2(props) {
24761
24951
  }
24762
24952
  };
24763
24953
  }
24764
- var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
24954
+ var IncludedFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
24765
24955
  const props = resolveDesignProps2(rest);
24766
24956
  const { t: t3, locale } = useTranslation();
24767
24957
  const { data, settings } = useEmbed();
24768
24958
  const isLightBackground = useIsLightBackground();
24769
- const { plan, addOns, featureUsage } = (0, import_react43.useMemo)(() => {
24959
+ const { plan, addOns, featureUsage } = (0, import_react44.useMemo)(() => {
24770
24960
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
24771
24961
  (acc, id) => {
24772
24962
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -24812,7 +25002,7 @@ var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, r
24812
25002
  }
24813
25003
  },
24814
25004
  children: visibleFeatureUsage.items.map((entitlement, index) => {
24815
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react43.Fragment, { children: [
25005
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react44.Fragment, { children: [
24816
25006
  props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
24817
25007
  Icon3,
24818
25008
  {
@@ -24843,9 +25033,10 @@ var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, r
24843
25033
  singularName: grant.singularName,
24844
25034
  pluralName: grant.pluralName
24845
25035
  },
25036
+ locale,
24846
25037
  grant.creditAmount
24847
25038
  ),
24848
- licenseName: entitlement.feature ? getFeatureName(entitlement.feature, 1) : ""
25039
+ licenseName: entitlement.feature ? getFeatureName(entitlement.feature, locale, 1) : ""
24849
25040
  }) }, grantIndex)),
24850
25041
  props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
24851
25042
  Text,
@@ -24903,7 +25094,7 @@ var IncludedFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, r
24903
25094
  IncludedFeatures.displayName = "IncludedFeatures";
24904
25095
 
24905
25096
  // src/components/elements/invoices/Invoices.tsx
24906
- var import_react44 = require("react");
25097
+ var import_react45 = require("react");
24907
25098
  var import_jsx_runtime54 = require("react/jsx-runtime");
24908
25099
  function resolveDesignProps3(props) {
24909
25100
  return {
@@ -24962,27 +25153,27 @@ function formatInvoices(invoices, locale, options) {
24962
25153
  };
24963
25154
  });
24964
25155
  }
24965
- var Invoices = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
25156
+ var Invoices = (0, import_react45.forwardRef)(({ className, ...rest }, ref) => {
24966
25157
  const props = resolveDesignProps3(rest);
24967
25158
  const { t: t3, locale } = useTranslation();
24968
25159
  const { data, listInvoices, settings } = useEmbed();
24969
- const [isLoading, setIsLoading] = (0, import_react44.useState)(false);
24970
- const [error, setError] = (0, import_react44.useState)();
24971
- const [rawInvoices, setInvoices] = (0, import_react44.useState)(
25160
+ const [isLoading, setIsLoading] = (0, import_react45.useState)(false);
25161
+ const [error, setError] = (0, import_react45.useState)();
25162
+ const [rawInvoices, setInvoices] = (0, import_react45.useState)(
24972
25163
  () => data && "invoices" in data ? data.invoices : rest.data
24973
25164
  );
24974
- const invoices = (0, import_react44.useMemo)(
25165
+ const invoices = (0, import_react45.useMemo)(
24975
25166
  () => formatInvoices(rawInvoices, locale),
24976
25167
  [rawInvoices, locale]
24977
25168
  );
24978
- const reachableInvoices = (0, import_react44.useMemo)(
25169
+ const reachableInvoices = (0, import_react45.useMemo)(
24979
25170
  () => invoices.slice(0, MAX_VISIBLE_INVOICE_COUNT),
24980
25171
  [invoices]
24981
25172
  );
24982
25173
  const visibleInvoices = useTruncatedList(reachableInvoices, {
24983
25174
  limit: props.limit.number
24984
25175
  });
24985
- const getInvoices = (0, import_react44.useCallback)(async () => {
25176
+ const getInvoices = (0, import_react45.useCallback)(async () => {
24986
25177
  try {
24987
25178
  setError(void 0);
24988
25179
  setIsLoading(true);
@@ -24996,15 +25187,15 @@ var Invoices = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
24996
25187
  setIsLoading(false);
24997
25188
  }
24998
25189
  }, [listInvoices]);
24999
- (0, import_react44.useEffect)(() => {
25190
+ (0, import_react45.useEffect)(() => {
25000
25191
  getInvoices();
25001
25192
  }, [getInvoices]);
25002
- (0, import_react44.useEffect)(() => {
25193
+ (0, import_react45.useEffect)(() => {
25003
25194
  if (rest.data) {
25004
25195
  setInvoices(rest.data);
25005
25196
  }
25006
25197
  }, [rest.data]);
25007
- (0, import_react44.useEffect)(() => {
25198
+ (0, import_react45.useEffect)(() => {
25008
25199
  if (data && "invoices" in data) {
25009
25200
  const invoicesPreviewData = data.invoices;
25010
25201
  setInvoices(invoicesPreviewData);
@@ -25094,7 +25285,7 @@ var Invoices = (0, import_react44.forwardRef)(({ className, ...rest }, ref) => {
25094
25285
  Invoices.displayName = "Invoices";
25095
25286
 
25096
25287
  // src/components/elements/metered-features/MeteredFeatures.tsx
25097
- var import_react46 = require("react");
25288
+ var import_react47 = require("react");
25098
25289
 
25099
25290
  // src/components/elements/metered-features/Meter.tsx
25100
25291
  var import_jsx_runtime55 = require("react/jsx-runtime");
@@ -25179,7 +25370,7 @@ var PriceDetails = ({
25179
25370
  packageSize,
25180
25371
  " "
25181
25372
  ] }),
25182
- getFeatureName(feature, packageSize),
25373
+ getFeatureName(feature, locale, packageSize),
25183
25374
  feature.featureType === FeatureType.Trait && period && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25184
25375
  "/",
25185
25376
  shortenPeriod(period, t3)
@@ -25204,7 +25395,7 @@ var PriceDetails = ({
25204
25395
  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: [
25205
25396
  formatNumber(amount, { locale }),
25206
25397
  " ",
25207
- getFeatureName(feature, amount),
25398
+ getFeatureName(feature, locale, amount),
25208
25399
  " \xB7 ",
25209
25400
  formatCurrency(currentTierPerUnitPrice * amount, {
25210
25401
  locale,
@@ -25227,7 +25418,7 @@ var PriceDetails = ({
25227
25418
  };
25228
25419
 
25229
25420
  // src/components/elements/metered-features/UsageByUser.tsx
25230
- var import_react45 = require("react");
25421
+ var import_react46 = require("react");
25231
25422
  var import_jsx_runtime57 = require("react/jsx-runtime");
25232
25423
  var COLLAPSED_COUNT = 3;
25233
25424
  var EXPANDED_COUNT = 20;
@@ -25284,13 +25475,13 @@ var UsageByUser = ({ source, unit }) => {
25284
25475
  const { t: t3, locale } = useTranslation();
25285
25476
  const isLightBackground = useIsLightBackground();
25286
25477
  const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
25287
- const [expanded, setExpanded] = (0, import_react45.useState)(false);
25288
- const [result, setResult] = (0, import_react45.useState)();
25289
- const [attempt, setAttempt] = (0, import_react45.useState)(0);
25478
+ const [expanded, setExpanded] = (0, import_react46.useState)(false);
25479
+ const [result, setResult] = (0, import_react46.useState)();
25480
+ const [attempt, setAttempt] = (0, import_react46.useState)(0);
25290
25481
  const { kind, id } = source;
25291
25482
  const sourceKey = `${kind}:${id}`;
25292
25483
  const current = result?.sourceKey === sourceKey ? result : void 0;
25293
- (0, import_react45.useEffect)(() => {
25484
+ (0, import_react46.useEffect)(() => {
25294
25485
  let active = true;
25295
25486
  const apply = (next2) => {
25296
25487
  if (active) {
@@ -25324,7 +25515,7 @@ var UsageByUser = ({ source, unit }) => {
25324
25515
  sourceKey
25325
25516
  ]);
25326
25517
  const entries = current?.section?.entries;
25327
- const attributed = (0, import_react45.useMemo)(
25518
+ const attributed = (0, import_react46.useMemo)(
25328
25519
  () => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
25329
25520
  [entries]
25330
25521
  );
@@ -25332,7 +25523,7 @@ var UsageByUser = ({ source, unit }) => {
25332
25523
  const total = current?.section?.total ?? 0;
25333
25524
  const totalUsers = current?.section?.totalUsers ?? 0;
25334
25525
  const unattributed = current?.section?.unattributed;
25335
- const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, amount)}`;
25526
+ const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, locale, amount)}`;
25336
25527
  if (error) {
25337
25528
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
25338
25529
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: "heading4", children: t3("Usage by user") }),
@@ -25437,10 +25628,10 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25437
25628
  const acc = [];
25438
25629
  acc.push(
25439
25630
  priceBehavior === EntitlementPriceBehavior.Tier && typeof currentTier?.to === "number" && typeof feature !== "undefined" ? currentTier?.to === Infinity ? t3("Unlimited in this tier", {
25440
- feature: getFeatureName(feature)
25631
+ feature: getFeatureName(feature, locale)
25441
25632
  }) : t3("Up to X units in this tier", {
25442
25633
  amount: currentTier.to,
25443
- feature: getFeatureName(feature)
25634
+ feature: getFeatureName(feature, locale)
25444
25635
  }) : priceBehavior === EntitlementPriceBehavior.Overage && typeof limit === "number" ? t3("X included", {
25445
25636
  amount: formatNumber(limit, { locale })
25446
25637
  }) : priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof usage === "number" ? `${formatNumber(usage, { locale })} ${t3("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" ? t3("X units per use", {
@@ -25450,11 +25641,12 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25450
25641
  ),
25451
25642
  units: getFeatureName(
25452
25643
  planEntitlement.valueCredit,
25644
+ locale,
25453
25645
  planEntitlement.consumptionRate
25454
25646
  )
25455
25647
  }) : priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof feature !== "undefined" && typeof limit === "number" ? t3("X units remaining", {
25456
25648
  amount: formatNumber(limit, { locale }),
25457
- units: getFeatureName(feature, limit)
25649
+ units: getFeatureName(feature, locale, limit)
25458
25650
  }) : typeof limit === "number" ? t3("Limit of", {
25459
25651
  amount: formatNumber(limit, { locale })
25460
25652
  }) : t3("No limit")
@@ -25509,15 +25701,16 @@ function resolveDesignProps4(props) {
25509
25701
  visibleFeatures: props.visibleFeatures
25510
25702
  };
25511
25703
  }
25512
- var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, ref) => {
25704
+ var MeteredFeatures = (0, import_react47.forwardRef)(({ className, ...rest }, ref) => {
25513
25705
  const props = resolveDesignProps4(rest);
25514
- const elementsRef = (0, import_react46.useRef)([]);
25706
+ const elementsRef = (0, import_react47.useRef)([]);
25515
25707
  const shouldWrapChildren = useWrapChildren(elementsRef);
25516
25708
  const { t: t3, locale } = useTranslation();
25517
25709
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
25518
25710
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
25519
25711
  const isLightBackground = useIsLightBackground();
25520
- const meteredFeatures = (0, import_react46.useMemo)(() => {
25712
+ const { billDate: renewalDate } = useNextBillDate();
25713
+ const meteredFeatures = (0, import_react47.useMemo)(() => {
25521
25714
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
25522
25715
  (acc, id) => {
25523
25716
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -25534,7 +25727,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25534
25727
  ({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
25535
25728
  );
25536
25729
  }, [props.visibleFeatures, data?.featureUsage?.features]);
25537
- const creditGroups = (0, import_react46.useMemo)(
25730
+ const creditGroups = (0, import_react47.useMemo)(
25538
25731
  () => withEmptyPlanCreditBalances(
25539
25732
  aggregateActiveGrantsByCredit(data?.creditGrants || []),
25540
25733
  listPlanCredits(
@@ -25545,11 +25738,11 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25545
25738
  ),
25546
25739
  [data?.creditGrants, data?.featureUsage?.features, data?.company]
25547
25740
  );
25548
- const planCreditCompositions = (0, import_react46.useMemo)(
25741
+ const planCreditCompositions = (0, import_react47.useMemo)(
25549
25742
  () => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
25550
25743
  [data?.company?.plan?.includedCreditGrants]
25551
25744
  );
25552
- const resolveLicenseQuantity = (0, import_react46.useCallback)(
25745
+ const resolveLicenseQuantity = (0, import_react47.useCallback)(
25553
25746
  (licenseId) => {
25554
25747
  const allocation = findLicenseSource(
25555
25748
  data?.featureUsage?.features ?? [],
@@ -25559,17 +25752,17 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25559
25752
  },
25560
25753
  [data?.featureUsage?.features]
25561
25754
  );
25562
- const purchasableCreditIds = (0, import_react46.useMemo)(
25755
+ const purchasableCreditIds = (0, import_react47.useMemo)(
25563
25756
  () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
25564
25757
  [data?.creditBundles, data?.company?.plan?.id]
25565
25758
  );
25566
- const [expandedCreditIds, setExpandedCreditIds] = (0, import_react46.useState)(
25759
+ const [expandedCreditIds, setExpandedCreditIds] = (0, import_react47.useState)(
25567
25760
  () => /* @__PURE__ */ new Set()
25568
25761
  );
25569
- const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react46.useState)(
25762
+ const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react47.useState)(
25570
25763
  () => /* @__PURE__ */ new Set()
25571
25764
  );
25572
- const toggleFullLedger = (0, import_react46.useCallback)((id) => {
25765
+ const toggleFullLedger = (0, import_react47.useCallback)((id) => {
25573
25766
  setFullLedgerCreditIds((prev2) => {
25574
25767
  const next2 = new Set(prev2);
25575
25768
  if (next2.has(id)) {
@@ -25580,7 +25773,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25580
25773
  return next2;
25581
25774
  });
25582
25775
  }, []);
25583
- const toggleBalanceDetails = (0, import_react46.useCallback)((id) => {
25776
+ const toggleBalanceDetails = (0, import_react47.useCallback)((id) => {
25584
25777
  setExpandedCreditIds((prev2) => {
25585
25778
  const next2 = new Set(prev2);
25586
25779
  if (next2.has(id)) {
@@ -25656,11 +25849,11 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25656
25849
  formatNumber(limit, { locale }),
25657
25850
  " "
25658
25851
  ] }),
25659
- getFeatureName(feature, limit)
25852
+ getFeatureName(feature, locale, limit)
25660
25853
  ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
25661
25854
  formatNumber(usage, { locale }),
25662
25855
  " ",
25663
- getFeatureName(feature, usage),
25856
+ getFeatureName(feature, locale, usage),
25664
25857
  " ",
25665
25858
  t3("used")
25666
25859
  ] }) }) }),
@@ -25749,6 +25942,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25749
25942
  }),
25750
25943
  units: getFeatureName(
25751
25944
  credit,
25945
+ locale,
25752
25946
  credit.total.remaining
25753
25947
  )
25754
25948
  }) }) }),
@@ -25790,6 +25984,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25790
25984
  quantity: licenseQuantity,
25791
25985
  licenseName: getFeatureName(
25792
25986
  licenseFeature,
25987
+ locale,
25793
25988
  licenseQuantity
25794
25989
  ),
25795
25990
  perUnit: perLicenseGrant.amount
@@ -25802,7 +25997,6 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25802
25997
  })
25803
25998
  );
25804
25999
  }
25805
- const renewalDate = data?.upcomingInvoice?.dueDate;
25806
26000
  return (
25807
26001
  // Pulled up against the balance line despite the column's 2rem gap
25808
26002
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
@@ -25814,7 +26008,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25814
26008
  children: [
25815
26009
  t3("Your plan includes credits", {
25816
26010
  total,
25817
- creditName: getFeatureName(credit, total),
26011
+ creditName: getFeatureName(credit, locale, total),
25818
26012
  period: shortenPeriod(composition.period, t3),
25819
26013
  composition: ` \u2014 ${parts.join(" + ")}`
25820
26014
  }),
@@ -25849,6 +26043,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25849
26043
  amount: grant.quantity,
25850
26044
  item: getFeatureName(
25851
26045
  credit,
26046
+ locale,
25852
26047
  grant.quantity
25853
26048
  )
25854
26049
  }) }) }),
@@ -25870,7 +26065,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25870
26065
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
25871
26066
  /* @__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: t3("X item bundle", {
25872
26067
  amount: grant.quantity,
25873
- item: getFeatureName(credit, 1),
26068
+ item: getFeatureName(credit, locale, 1),
25874
26069
  createdAt: toPrettyDate(
25875
26070
  grant.createdAt,
25876
26071
  { locale, month: "short" }
@@ -25879,6 +26074,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25879
26074
  amount: grant.quantity,
25880
26075
  item: getFeatureName(
25881
26076
  credit,
26077
+ locale,
25882
26078
  grant.quantity
25883
26079
  ),
25884
26080
  createdAt: toPrettyDate(
@@ -25889,6 +26085,7 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25889
26085
  amount: grant.quantity,
25890
26086
  item: getFeatureName(
25891
26087
  credit,
26088
+ locale,
25892
26089
  grant.quantity
25893
26090
  ),
25894
26091
  createdAt: toPrettyDate(
@@ -25960,10 +26157,10 @@ var MeteredFeatures = (0, import_react46.forwardRef)(({ className, ...rest }, re
25960
26157
  MeteredFeatures.displayName = "MeteredFeatures";
25961
26158
 
25962
26159
  // src/components/elements/payment-method/PaymentMethod.tsx
25963
- var import_react48 = require("react");
26160
+ var import_react49 = require("react");
25964
26161
 
25965
26162
  // src/components/elements/payment-method/PaymentMethodElement.tsx
25966
- var import_react47 = require("react");
26163
+ var import_react48 = require("react");
25967
26164
  var import_jsx_runtime59 = require("react/jsx-runtime");
25968
26165
  var PaymentElement2 = ({
25969
26166
  iconName,
@@ -26139,7 +26336,7 @@ var PaymentListElement = ({
26139
26336
  const { settings } = useEmbed();
26140
26337
  const isLightBackground = useIsLightBackground();
26141
26338
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
26142
- const expirationDate = (0, import_react47.useMemo)(() => {
26339
+ const expirationDate = (0, import_react48.useMemo)(() => {
26143
26340
  const { cardExpMonth, cardExpYear } = paymentMethod;
26144
26341
  if (!cardExpMonth || !cardExpYear) {
26145
26342
  return;
@@ -26231,10 +26428,10 @@ var resolveDesignProps5 = (props) => {
26231
26428
  }
26232
26429
  };
26233
26430
  };
26234
- var PaymentMethod = (0, import_react48.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26431
+ var PaymentMethod = (0, import_react49.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26235
26432
  const props = resolveDesignProps5(rest);
26236
26433
  const { data, setLayout } = useEmbed();
26237
- const { paymentMethod, monthsToExpiration } = (0, import_react48.useMemo)(() => {
26434
+ const { paymentMethod, monthsToExpiration } = (0, import_react49.useMemo)(() => {
26238
26435
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
26239
26436
  let monthsToExpiration2;
26240
26437
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -26438,7 +26635,7 @@ var loadStripe = function loadStripe2() {
26438
26635
  };
26439
26636
 
26440
26637
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
26441
- var import_react49 = require("react");
26638
+ var import_react50 = require("react");
26442
26639
  var import_jsx_runtime61 = require("react/jsx-runtime");
26443
26640
  var resolveDesignProps6 = () => {
26444
26641
  return {
@@ -26467,7 +26664,7 @@ var PaymentMethodDetails = ({
26467
26664
  updatePaymentMethod,
26468
26665
  deletePaymentMethod
26469
26666
  } = useEmbed();
26470
- const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react49.useMemo)(() => {
26667
+ const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react50.useMemo)(() => {
26471
26668
  return {
26472
26669
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
26473
26670
  paymentMethods: data?.company?.paymentMethods || [],
@@ -26480,13 +26677,13 @@ var PaymentMethodDetails = ({
26480
26677
  ]);
26481
26678
  const isLightBackground = useIsLightBackground();
26482
26679
  const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
26483
- const [isLoading, setIsLoading] = (0, import_react49.useState)(!initialPaymentMethod);
26484
- const [error, setError] = (0, import_react49.useState)();
26485
- const [showPaymentForm, setShowPaymentForm] = (0, import_react49.useState)(false);
26486
- const [stripe, setStripe] = (0, import_react49.useState)(null);
26487
- const [setupIntent, setSetupIntent] = (0, import_react49.useState)();
26488
- const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react49.useState)(false);
26489
- const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react49.useState)(initialPaymentMethod);
26680
+ const [isLoading, setIsLoading] = (0, import_react50.useState)(!initialPaymentMethod);
26681
+ const [error, setError] = (0, import_react50.useState)();
26682
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react50.useState)(false);
26683
+ const [stripe, setStripe] = (0, import_react50.useState)(null);
26684
+ const [setupIntent, setSetupIntent] = (0, import_react50.useState)();
26685
+ const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react50.useState)(false);
26686
+ const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react50.useState)(initialPaymentMethod);
26490
26687
  const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
26491
26688
  stripe,
26492
26689
  clientSecret: confirmPaymentIntentProps?.clientSecret,
@@ -26499,7 +26696,7 @@ var PaymentMethodDetails = ({
26499
26696
  },
26500
26697
  autoConfirm: true
26501
26698
  });
26502
- const monthsToExpiration = (0, import_react49.useMemo)(() => {
26699
+ const monthsToExpiration = (0, import_react50.useMemo)(() => {
26503
26700
  let expiration;
26504
26701
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
26505
26702
  const now = /* @__PURE__ */ new Date();
@@ -26522,8 +26719,8 @@ var PaymentMethodDetails = ({
26522
26719
  const toggleShowPaymentMethods = () => {
26523
26720
  setShowDifferentPaymentMethods((prev2) => !prev2);
26524
26721
  };
26525
- const locale = (0, import_react49.useMemo)(() => stripeLocale(language), [language]);
26526
- const initializeStripe = (0, import_react49.useCallback)(() => {
26722
+ const locale = (0, import_react50.useMemo)(() => stripeLocale(language), [language]);
26723
+ const initializeStripe = (0, import_react50.useCallback)(() => {
26527
26724
  if (stripe || !setupIntent) {
26528
26725
  return;
26529
26726
  }
@@ -26546,7 +26743,7 @@ var PaymentMethodDetails = ({
26546
26743
  setShowPaymentForm(false);
26547
26744
  });
26548
26745
  }, [t3, stripe, setupIntent, locale]);
26549
- const initializePaymentMethod = (0, import_react49.useCallback)(() => {
26746
+ const initializePaymentMethod = (0, import_react50.useCallback)(() => {
26550
26747
  const pending = createSetupIntent() ?? Promise.resolve(void 0);
26551
26748
  return pending.then((response) => {
26552
26749
  if (response) {
@@ -26561,7 +26758,7 @@ var PaymentMethodDetails = ({
26561
26758
  setIsLoading(false);
26562
26759
  });
26563
26760
  }, [t3, createSetupIntent]);
26564
- const handleUpdatePaymentMethod = (0, import_react49.useCallback)(
26761
+ const handleUpdatePaymentMethod = (0, import_react50.useCallback)(
26565
26762
  async (paymentMethodId) => {
26566
26763
  try {
26567
26764
  setIsLoading(true);
@@ -26583,7 +26780,7 @@ var PaymentMethodDetails = ({
26583
26780
  },
26584
26781
  [t3, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
26585
26782
  );
26586
- const handleDeletePaymentMethod = (0, import_react49.useCallback)(
26783
+ const handleDeletePaymentMethod = (0, import_react50.useCallback)(
26587
26784
  async (paymentMethodId) => {
26588
26785
  try {
26589
26786
  setIsLoading(true);
@@ -26599,10 +26796,10 @@ var PaymentMethodDetails = ({
26599
26796
  },
26600
26797
  [t3, deletePaymentMethod]
26601
26798
  );
26602
- (0, import_react49.useEffect)(() => {
26799
+ (0, import_react50.useEffect)(() => {
26603
26800
  initializeStripe();
26604
26801
  }, [initializeStripe]);
26605
- (0, import_react49.useEffect)(() => {
26802
+ (0, import_react50.useEffect)(() => {
26606
26803
  if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
26607
26804
  initializePaymentMethod();
26608
26805
  }
@@ -26782,7 +26979,7 @@ var PaymentMethodDetails = ({
26782
26979
  };
26783
26980
 
26784
26981
  // src/components/elements/plan-manager/PlanManager.tsx
26785
- var import_react51 = require("react");
26982
+ var import_react52 = require("react");
26786
26983
 
26787
26984
  // src/components/elements/plan-manager/AddOn.tsx
26788
26985
  var import_jsx_runtime62 = require("react/jsx-runtime");
@@ -26808,7 +27005,7 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26808
27005
  };
26809
27006
 
26810
27007
  // src/components/elements/plan-manager/UsageDetails.tsx
26811
- var import_react50 = require("react");
27008
+ var import_react51 = require("react");
26812
27009
  var import_jsx_runtime63 = require("react/jsx-runtime");
26813
27010
  var UsageDetails2 = ({
26814
27011
  entitlement,
@@ -26824,31 +27021,31 @@ var UsageDetails2 = ({
26824
27021
  billingPrice,
26825
27022
  limit,
26826
27023
  cost = 0
26827
- } = (0, import_react50.useMemo)(
27024
+ } = (0, import_react51.useMemo)(
26828
27025
  () => getUsageDetails(entitlement, period, currency, {
26829
27026
  showWarningThresholdAsLimit
26830
27027
  }),
26831
27028
  [entitlement, period, currency, showWarningThresholdAsLimit]
26832
27029
  );
26833
- const description = (0, import_react50.useMemo)(() => {
27030
+ const description = (0, import_react51.useMemo)(() => {
26834
27031
  const acc = [];
26835
27032
  let index = 0;
26836
27033
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
26837
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27034
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react51.Fragment, { children: [
26838
27035
  t3("Additional"),
26839
27036
  ": "
26840
27037
  ] }, index));
26841
27038
  index += 1;
26842
27039
  }
26843
27040
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
26844
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react50.Fragment, { children: t3("Tier-based") }, index));
27041
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react51.Fragment, { children: t3("Tier-based") }, index));
26845
27042
  index += 1;
26846
27043
  }
26847
27044
  const { price } = getEntitlementPrice(entitlement, period, currency) || {};
26848
27045
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
26849
27046
  const packageSize = billingPrice?.packageSize ?? 1;
26850
27047
  acc.push(
26851
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27048
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react51.Fragment, { children: [
26852
27049
  formatCurrency(price, { locale, currency: billingPrice?.currency }),
26853
27050
  /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
26854
27051
  "/",
@@ -26856,7 +27053,7 @@ var UsageDetails2 = ({
26856
27053
  packageSize,
26857
27054
  " "
26858
27055
  ] }),
26859
- getFeatureName(entitlement.feature, packageSize),
27056
+ getFeatureName(entitlement.feature, locale, packageSize),
26860
27057
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26861
27058
  "/",
26862
27059
  shortenPeriod(period, t3)
@@ -26868,7 +27065,7 @@ var UsageDetails2 = ({
26868
27065
  }
26869
27066
  if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
26870
27067
  acc.push(
26871
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react50.Fragment, { children: [
27068
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react51.Fragment, { children: [
26872
27069
  formatConsumptionRate(
26873
27070
  entitlement.planEntitlement.consumptionRate,
26874
27071
  locale
@@ -26876,6 +27073,7 @@ var UsageDetails2 = ({
26876
27073
  " ",
26877
27074
  getFeatureName(
26878
27075
  entitlement.planEntitlement.valueCredit,
27076
+ locale,
26879
27077
  entitlement.planEntitlement.consumptionRate
26880
27078
  ),
26881
27079
  " ",
@@ -26911,7 +27109,7 @@ var UsageDetails2 = ({
26911
27109
  /* @__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: [
26912
27110
  quantity,
26913
27111
  " ",
26914
- getFeatureName(entitlement.feature, quantity, true)
27112
+ getFeatureName(entitlement.feature, locale, quantity, true)
26915
27113
  ] }) : entitlement.feature.name }),
26916
27114
  /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { children: [
26917
27115
  description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
@@ -26989,7 +27187,7 @@ var resolveDesignProps7 = (props) => {
26989
27187
  }
26990
27188
  };
26991
27189
  };
26992
- var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal, ...rest }, ref) => {
27190
+ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal, ...rest }, ref) => {
26993
27191
  const props = resolveDesignProps7(rest);
26994
27192
  const { t: t3, locale } = useTranslation();
26995
27193
  const { data, settings, setCheckoutState, setLayout } = useEmbed();
@@ -27008,7 +27206,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27008
27206
  showCredits,
27009
27207
  showZeroPriceAsFree,
27010
27208
  trialPaymentMethodRequired
27011
- } = (0, import_react51.useMemo)(() => {
27209
+ } = (0, import_react52.useMemo)(() => {
27012
27210
  const planCreditOrder = /* @__PURE__ */ new Map();
27013
27211
  (data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
27014
27212
  if (!planCreditOrder.has(grant.creditId)) {
@@ -27068,15 +27266,15 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27068
27266
  data?.displaySettings?.showZeroPriceAsFree,
27069
27267
  data?.trialPaymentMethodRequired
27070
27268
  ]);
27071
- const usageBasedEntitlements = (0, import_react51.useMemo)(
27269
+ const usageBasedEntitlements = (0, import_react52.useMemo)(
27072
27270
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
27073
27271
  [featureUsage]
27074
27272
  );
27075
- const planCreditCompositions = (0, import_react51.useMemo)(
27273
+ const planCreditCompositions = (0, import_react52.useMemo)(
27076
27274
  () => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
27077
27275
  [currentPlan?.includedCreditGrants]
27078
27276
  );
27079
- const resolveLicenseQuantity = (0, import_react51.useMemo)(() => {
27277
+ const resolveLicenseQuantity = (0, import_react52.useMemo)(() => {
27080
27278
  return (licenseId) => {
27081
27279
  const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
27082
27280
  return typeof allocation === "number" ? allocation : void 0;
@@ -27099,7 +27297,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27099
27297
  subscriptionCurrency,
27100
27298
  willSubscriptionCancel,
27101
27299
  isTrialSubscription
27102
- } = (0, import_react51.useMemo)(() => {
27300
+ } = (0, import_react52.useMemo)(() => {
27103
27301
  const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
27104
27302
  const subscriptionCurrency2 = billingSubscription?.currency;
27105
27303
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -27112,7 +27310,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27112
27310
  };
27113
27311
  }, [billingSubscription]);
27114
27312
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
27115
- const { isFreePlan, isUsageBasedPlan } = (0, import_react51.useMemo)(() => {
27313
+ const { isFreePlan, isUsageBasedPlan } = (0, import_react52.useMemo)(() => {
27116
27314
  const isFreePlan2 = currentPlan?.planPrice === 0;
27117
27315
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
27118
27316
  return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
@@ -27372,9 +27570,14 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27372
27570
  amount: perLicenseGrant.amount,
27373
27571
  creditName: getFeatureName(
27374
27572
  group,
27573
+ locale,
27375
27574
  perLicenseGrant.amount
27376
27575
  ),
27377
- licenseName: getFeatureName(licenseFeature, 1)
27576
+ licenseName: getFeatureName(
27577
+ licenseFeature,
27578
+ locale,
27579
+ 1
27580
+ )
27378
27581
  }),
27379
27582
  composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27380
27583
  " ",
@@ -27382,6 +27585,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27382
27585
  amount: composition.fixedQuantity,
27383
27586
  creditName: getFeatureName(
27384
27587
  group,
27588
+ locale,
27385
27589
  composition.fixedQuantity
27386
27590
  ),
27387
27591
  period: t3(
@@ -27392,7 +27596,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27392
27596
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27393
27597
  group.total.value,
27394
27598
  " ",
27395
- getFeatureName(group, group.total.value),
27599
+ getFeatureName(group, locale, group.total.value),
27396
27600
  " ",
27397
27601
  subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27398
27602
  t3("per"),
@@ -27435,6 +27639,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27435
27639
  quantity: licenseQuantity,
27436
27640
  licenseName: getFeatureName(
27437
27641
  licenseFeature,
27642
+ locale,
27438
27643
  licenseQuantity
27439
27644
  ),
27440
27645
  perUnit: perLicenseGrant.amount,
@@ -27442,6 +27647,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27442
27647
  total: resolvedTotal,
27443
27648
  creditName: getFeatureName(
27444
27649
  group,
27650
+ locale,
27445
27651
  resolvedTotal
27446
27652
  ),
27447
27653
  period: shortenPeriod(creditPeriod, t3)
@@ -27449,12 +27655,14 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27449
27655
  quantity: licenseQuantity,
27450
27656
  licenseName: getFeatureName(
27451
27657
  licenseFeature,
27658
+ locale,
27452
27659
  licenseQuantity
27453
27660
  ),
27454
27661
  perUnit: perLicenseGrant.amount,
27455
27662
  total: resolvedTotal,
27456
27663
  creditName: getFeatureName(
27457
27664
  group,
27665
+ locale,
27458
27666
  resolvedTotal
27459
27667
  ),
27460
27668
  period: shortenPeriod(creditPeriod, t3)
@@ -27496,7 +27704,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27496
27704
  if (!autoTopupEnabled) {
27497
27705
  acc.push(
27498
27706
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { $leading: "tight", children: t3("Auto top-up disabled for token", {
27499
- unit: getFeatureName(grant.credit, 1)
27707
+ unit: getFeatureName(grant.credit, locale, 1)
27500
27708
  }) }, grant.id)
27501
27709
  );
27502
27710
  return acc;
@@ -27508,6 +27716,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27508
27716
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { $leading: "tight", children: t3("Adds X tokens when Y remaining in balance", {
27509
27717
  unit: getFeatureName(
27510
27718
  grant.credit,
27719
+ locale,
27511
27720
  autoTopupAmount
27512
27721
  ),
27513
27722
  amount: autoTopupAmount,
@@ -27567,7 +27776,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27567
27776
  " (",
27568
27777
  group.quantity,
27569
27778
  " ",
27570
- getFeatureName(group, group.quantity),
27779
+ getFeatureName(group, locale, group.quantity),
27571
27780
  ")"
27572
27781
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27573
27782
  group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { style: { opacity: 0.5 }, children: [
@@ -27578,7 +27787,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27578
27787
  ] }),
27579
27788
  group.quantity,
27580
27789
  " ",
27581
- getFeatureName(group, group.quantity)
27790
+ getFeatureName(group, locale, group.quantity)
27582
27791
  ] }),
27583
27792
  group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27584
27793
  Text,
@@ -27638,12 +27847,12 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27638
27847
  " (",
27639
27848
  group.quantity,
27640
27849
  " ",
27641
- getFeatureName(group, group.quantity),
27850
+ getFeatureName(group, locale, group.quantity),
27642
27851
  ")"
27643
27852
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27644
27853
  group.quantity,
27645
27854
  " ",
27646
- getFeatureName(group, group.quantity)
27855
+ getFeatureName(group, locale, group.quantity)
27647
27856
  ] }),
27648
27857
  group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27649
27858
  Text,
@@ -27694,7 +27903,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27694
27903
  /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27695
27904
  group.quantity,
27696
27905
  " ",
27697
- getFeatureName(group, group.quantity)
27906
+ getFeatureName(group, locale, group.quantity)
27698
27907
  ] }),
27699
27908
  group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27700
27909
  Text,
@@ -27745,10 +27954,10 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
27745
27954
  PlanManager.displayName = "PlanManager";
27746
27955
 
27747
27956
  // src/components/elements/pricing-table/PricingTable.tsx
27748
- var import_react54 = require("react");
27957
+ var import_react55 = require("react");
27749
27958
 
27750
27959
  // src/components/elements/pricing-table/AddOn.tsx
27751
- var import_react52 = require("react");
27960
+ var import_react53 = require("react");
27752
27961
  var import_jsx_runtime65 = require("react/jsx-runtime");
27753
27962
  function renderMeteredEntitlementPricing2({
27754
27963
  priceBehavior,
@@ -27767,6 +27976,7 @@ function renderMeteredEntitlementPricing2({
27767
27976
  "/",
27768
27977
  feature ? getFeatureName(
27769
27978
  feature,
27979
+ locale,
27770
27980
  packageSize
27771
27981
  ) : featureName || "unit"
27772
27982
  ] });
@@ -27784,6 +27994,7 @@ function renderMeteredEntitlementPricing2({
27784
27994
  ] }),
27785
27995
  feature ? getFeatureName(
27786
27996
  feature,
27997
+ locale,
27787
27998
  packageSize
27788
27999
  ) : featureName || "unit"
27789
28000
  ] });
@@ -27804,7 +28015,7 @@ var AddOn2 = ({
27804
28015
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
27805
28016
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
27806
28017
  const isLightBackground = useIsLightBackground();
27807
- const { currentAddOns, canCheckout, isStandalone } = (0, import_react52.useMemo)(() => {
28018
+ const { currentAddOns, canCheckout, isStandalone } = (0, import_react53.useMemo)(() => {
27808
28019
  const isStandalone2 = typeof data?.component === "undefined";
27809
28020
  return {
27810
28021
  currentAddOns: data?.company?.addOns || [],
@@ -27973,7 +28184,7 @@ var AddOn2 = ({
27973
28184
  {
27974
28185
  $flexDirection: "column",
27975
28186
  $justifyContent: "center",
27976
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: getFeatureName(entitlement.feature) })
28187
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: getFeatureName(entitlement.feature, locale) })
27977
28188
  }
27978
28189
  )
27979
28190
  ] }),
@@ -28073,7 +28284,7 @@ var AddOn2 = ({
28073
28284
  };
28074
28285
 
28075
28286
  // src/components/elements/pricing-table/Plan.tsx
28076
- var import_react53 = require("react");
28287
+ var import_react54 = require("react");
28077
28288
 
28078
28289
  // src/components/elements/pricing-table/Entitlement.tsx
28079
28290
  var import_jsx_runtime66 = require("react/jsx-runtime");
@@ -28135,7 +28346,11 @@ var Entitlement2 = ({
28135
28346
  formatNumber(entitlementPackageSize, { locale }),
28136
28347
  " "
28137
28348
  ] }),
28138
- getFeatureName(entitlement.feature, entitlementPackageSize),
28349
+ getFeatureName(
28350
+ entitlement.feature,
28351
+ locale,
28352
+ entitlementPackageSize
28353
+ ),
28139
28354
  entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28140
28355
  " ",
28141
28356
  t3("per"),
@@ -28153,12 +28368,13 @@ var Entitlement2 = ({
28153
28368
  " ",
28154
28369
  getFeatureName(
28155
28370
  entitlement.valueCredit,
28371
+ locale,
28156
28372
  entitlement.consumptionRate
28157
28373
  ),
28158
28374
  " ",
28159
28375
  t3("per"),
28160
28376
  " ",
28161
- getFeatureName(entitlement.feature, 1)
28377
+ getFeatureName(entitlement.feature, locale, 1)
28162
28378
  ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, { children: creditBasedEntitlementLimit?.period ? t3("Up to X units per period", {
28163
28379
  amount: formatNumber(
28164
28380
  creditBasedEntitlementLimit.limit,
@@ -28166,9 +28382,12 @@ var Entitlement2 = ({
28166
28382
  ),
28167
28383
  units: getFeatureName(
28168
28384
  entitlement.feature,
28385
+ locale,
28169
28386
  creditBasedEntitlementLimit.limit
28170
28387
  ),
28171
- period: creditBasedEntitlementLimit.period
28388
+ period: t3(
28389
+ creditBasedEntitlementLimit.period
28390
+ )
28172
28391
  }) : t3("Up to X units", {
28173
28392
  amount: formatNumber(
28174
28393
  creditBasedEntitlementLimit.limit,
@@ -28176,17 +28395,18 @@ var Entitlement2 = ({
28176
28395
  ),
28177
28396
  units: getFeatureName(
28178
28397
  entitlement.feature,
28398
+ locale,
28179
28399
  creditBasedEntitlementLimit.limit
28180
28400
  )
28181
28401
  }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28182
28402
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
28183
- item: getFeatureName(entitlement.feature)
28403
+ item: getFeatureName(entitlement.feature, locale)
28184
28404
  }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28185
28405
  typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28186
28406
  formatNumber(limit, { locale }),
28187
28407
  " "
28188
28408
  ] }),
28189
- getFeatureName(entitlement.feature, limit)
28409
+ getFeatureName(entitlement.feature, locale, limit)
28190
28410
  ] }),
28191
28411
  metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28192
28412
  " ",
@@ -28215,6 +28435,7 @@ var Entitlement2 = ({
28215
28435
  ] }),
28216
28436
  getFeatureName(
28217
28437
  entitlement.feature,
28438
+ locale,
28218
28439
  entitlementPackageSize
28219
28440
  ),
28220
28441
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
@@ -28286,7 +28507,7 @@ var Plan2 = ({
28286
28507
  const { data, settings, setCheckoutState } = useEmbed();
28287
28508
  const isLightBackground = useIsLightBackground();
28288
28509
  const trialEnd = useTrialEnd();
28289
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react53.useState)({});
28510
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react54.useState)({});
28290
28511
  const handleToggleShowAll = (id) => {
28291
28512
  setEntitlementVisibility((prev2) => {
28292
28513
  const updated = !(prev2[id] ?? false);
@@ -28624,11 +28845,11 @@ var resolveDesignProps8 = (props) => {
28624
28845
  }
28625
28846
  };
28626
28847
  };
28627
- var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref) => {
28848
+ var PricingTable = (0, import_react55.forwardRef)(({ className, ...rest }, ref) => {
28628
28849
  const props = resolveDesignProps8(rest);
28629
28850
  const { t: t3 } = useTranslation();
28630
28851
  const { data, settings, isPending, hydratePublic, currencyFilter } = useEmbed();
28631
- const getCallToActionTarget = (0, import_react54.useCallback)(
28852
+ const getCallToActionTarget = (0, import_react55.useCallback)(
28632
28853
  (url, target) => {
28633
28854
  if (target) {
28634
28855
  return target;
@@ -28646,11 +28867,11 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28646
28867
  },
28647
28868
  []
28648
28869
  );
28649
- const [selectedPeriod, setSelectedPeriod] = (0, import_react54.useState)(
28870
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react55.useState)(
28650
28871
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
28651
28872
  );
28652
28873
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
28653
- const [selectedCurrency, setSelectedCurrency] = (0, import_react54.useState)(
28874
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react55.useState)(
28654
28875
  () => currencies[0] ?? DEFAULT_CURRENCY
28655
28876
  );
28656
28877
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -28668,19 +28889,19 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28668
28889
  } = useAvailablePlans(selectedPeriod, {
28669
28890
  useSelectedPeriod: showPeriodToggle
28670
28891
  });
28671
- const plans = (0, import_react54.useMemo)(
28892
+ const plans = (0, import_react55.useMemo)(
28672
28893
  () => hasCurrency ? allPlans.filter(
28673
28894
  (plan) => planSupportsCurrency(plan, selectedCurrency)
28674
28895
  ) : allPlans,
28675
28896
  [allPlans, hasCurrency, selectedCurrency]
28676
28897
  );
28677
- const addOns = (0, import_react54.useMemo)(
28898
+ const addOns = (0, import_react55.useMemo)(
28678
28899
  () => hasCurrency ? allAddOns.filter(
28679
28900
  (addOn) => planSupportsCurrency(addOn, selectedCurrency)
28680
28901
  ) : allAddOns,
28681
28902
  [allAddOns, hasCurrency, selectedCurrency]
28682
28903
  );
28683
- (0, import_react54.useEffect)(() => {
28904
+ (0, import_react55.useEffect)(() => {
28684
28905
  if (typeof data?.component === "undefined") {
28685
28906
  hydratePublic();
28686
28907
  }
@@ -28694,7 +28915,7 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28694
28915
  $alignItems: "center",
28695
28916
  $justifyContent: "center",
28696
28917
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
28697
- children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
28918
+ children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Loader, { "aria-label": t3("Loading"), $size: "2xl" })
28698
28919
  }
28699
28920
  );
28700
28921
  }
@@ -28707,7 +28928,7 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28707
28928
  rest.callToActionUrl,
28708
28929
  rest.callToActionTarget
28709
28930
  );
28710
- const Wrapper = typeof data?.component === "undefined" ? Container : import_react54.Fragment;
28931
+ const Wrapper = typeof data?.component === "undefined" ? Container : import_react55.Fragment;
28711
28932
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
28712
28933
  FussyChild,
28713
28934
  {
@@ -28861,7 +29082,7 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
28861
29082
  PricingTable.displayName = "PricingTable";
28862
29083
 
28863
29084
  // src/components/elements/text/Text.tsx
28864
- var import_react55 = require("react");
29085
+ var import_react56 = require("react");
28865
29086
  var import_jsx_runtime69 = require("react/jsx-runtime");
28866
29087
  var resolveDesignProps9 = (props) => {
28867
29088
  return {
@@ -28872,7 +29093,7 @@ var resolveDesignProps9 = (props) => {
28872
29093
  }
28873
29094
  };
28874
29095
  };
28875
- var TextElement = (0, import_react55.forwardRef)(({ children, className, ...rest }, ref) => {
29096
+ var TextElement = (0, import_react56.forwardRef)(({ children, className, ...rest }, ref) => {
28876
29097
  const props = resolveDesignProps9(rest);
28877
29098
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28878
29099
  Text,
@@ -28887,7 +29108,7 @@ var TextElement = (0, import_react55.forwardRef)(({ children, className, ...rest
28887
29108
  TextElement.displayName = "Text";
28888
29109
 
28889
29110
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
28890
- var import_react56 = require("react");
29111
+ var import_react57 = require("react");
28891
29112
  var import_jsx_runtime70 = require("react/jsx-runtime");
28892
29113
  var buttonStyles = {
28893
29114
  primary: {
@@ -28914,11 +29135,11 @@ var resolveDesignProps10 = (props) => {
28914
29135
  }
28915
29136
  };
28916
29137
  };
28917
- var UnsubscribeButton = (0, import_react56.forwardRef)(({ children, className, ...rest }, ref) => {
29138
+ var UnsubscribeButton = (0, import_react57.forwardRef)(({ children, className, ...rest }, ref) => {
28918
29139
  const props = resolveDesignProps10(rest);
28919
29140
  const { t: t3 } = useTranslation();
28920
29141
  const { data, setLayout } = useEmbed();
28921
- const hasActiveSubscription = (0, import_react56.useMemo)(() => {
29142
+ const hasActiveSubscription = (0, import_react57.useMemo)(() => {
28922
29143
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
28923
29144
  }, [data?.subscription]);
28924
29145
  if (!hasActiveSubscription) {
@@ -28953,7 +29174,7 @@ var UnsubscribeButton = (0, import_react56.forwardRef)(({ children, className, .
28953
29174
  UnsubscribeButton.displayName = "UnsubscribeButton";
28954
29175
 
28955
29176
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
28956
- var import_react57 = require("react");
29177
+ var import_react58 = require("react");
28957
29178
  var import_jsx_runtime71 = require("react/jsx-runtime");
28958
29179
  function resolveDesignProps11(props) {
28959
29180
  return {
@@ -28973,15 +29194,15 @@ function resolveDesignProps11(props) {
28973
29194
  }
28974
29195
  };
28975
29196
  }
28976
- var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref) => {
29197
+ var UpcomingBill = (0, import_react58.forwardRef)(({ className, ...rest }, ref) => {
28977
29198
  const props = resolveDesignProps11(rest);
28978
29199
  const { t: t3, locale } = useTranslation();
28979
29200
  const { data, settings, getUpcomingInvoice } = useEmbed();
28980
29201
  const isLightBackground = useIsLightBackground();
28981
- const [isLoading, setIsLoading] = (0, import_react57.useState)(false);
28982
- const [error, setError] = (0, import_react57.useState)();
28983
- const [upcomingInvoice, setUpcomingInvoice] = (0, import_react57.useState)(data?.upcomingInvoice);
28984
- const discounts = (0, import_react57.useMemo)(() => {
29202
+ const [isLoading, setIsLoading] = (0, import_react58.useState)(false);
29203
+ const [error, setError] = (0, import_react58.useState)();
29204
+ const [upcomingInvoice, setUpcomingInvoice] = (0, import_react58.useState)(data?.upcomingInvoice);
29205
+ const discounts = (0, import_react58.useMemo)(() => {
28985
29206
  return (data?.subscription?.discounts || []).filter(
28986
29207
  (discount) => (
28987
29208
  // Only surface discounts that are currently active and actually
@@ -28999,7 +29220,7 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
28999
29220
  durationInMonths: discount.durationInMonths ?? void 0
29000
29221
  }));
29001
29222
  }, [data?.subscription?.discounts]);
29002
- const getInvoice = (0, import_react57.useCallback)(async () => {
29223
+ const getInvoice = (0, import_react58.useCallback)(async () => {
29003
29224
  if (data?.component?.id && data?.subscription && !data.subscription.cancelAt) {
29004
29225
  try {
29005
29226
  setError(void 0);
@@ -29015,15 +29236,15 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
29015
29236
  }
29016
29237
  }
29017
29238
  }, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
29018
- (0, import_react57.useEffect)(() => {
29239
+ (0, import_react58.useEffect)(() => {
29019
29240
  getInvoice();
29020
29241
  }, [getInvoice]);
29021
- (0, import_react57.useEffect)(() => {
29242
+ (0, import_react58.useEffect)(() => {
29022
29243
  if (data?.upcomingInvoice) {
29023
29244
  setUpcomingInvoice(data.upcomingInvoice);
29024
29245
  }
29025
29246
  }, [data?.upcomingInvoice]);
29026
- const { currency, applied, remaining } = (0, import_react57.useMemo)(() => {
29247
+ const { currency, applied, remaining } = (0, import_react58.useMemo)(() => {
29027
29248
  const currency2 = upcomingInvoice?.currency;
29028
29249
  const startingBalance = upcomingInvoice?.startingBalance ?? 0;
29029
29250
  const endingBalance = upcomingInvoice?.endingBalance ?? 0;
@@ -29037,6 +29258,7 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
29037
29258
  upcomingInvoice?.endingBalance,
29038
29259
  upcomingInvoice?.subtotal
29039
29260
  ]);
29261
+ const { billDate, paymentDueDate } = useNextBillDate(upcomingInvoice ?? null);
29040
29262
  const hasApplied = applied > 0;
29041
29263
  const hasBalance = remaining > 0 || applied > 0;
29042
29264
  if (!data?.subscription || data.subscription.cancelAt) {
@@ -29068,10 +29290,21 @@ var UpcomingBill = (0, import_react57.forwardRef)(({ className, ...rest }, ref)
29068
29290
  ]
29069
29291
  }
29070
29292
  ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
29071
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { display: props.header.fontStyle, children: [
29072
- t3(props.header.prefix),
29073
- " ",
29074
- toPrettyDate(upcomingInvoice.dueDate, { locale })
29293
+ props.header.isVisible && upcomingInvoice.dueDate && billDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
29294
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { display: props.header.fontStyle, children: [
29295
+ t3(props.header.prefix),
29296
+ " ",
29297
+ toPrettyDate(billDate, { locale })
29298
+ ] }),
29299
+ paymentDueDate && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
29300
+ Text,
29301
+ {
29302
+ $size: 0.8125 * settings.theme.typography.text.fontSize,
29303
+ children: t3("Payment due", {
29304
+ date: toPrettyDate(paymentDueDate, { locale })
29305
+ })
29306
+ }
29307
+ )
29075
29308
  ] }),
29076
29309
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
29077
29310
  Flex,
@@ -31813,10 +32046,10 @@ function inflate(input, options = {}) {
31813
32046
  }
31814
32047
 
31815
32048
  // src/components/embed/Embed.tsx
31816
- var import_react59 = require("react");
32049
+ var import_react60 = require("react");
31817
32050
 
31818
32051
  // src/components/embed/renderer.ts
31819
- var import_react58 = require("react");
32052
+ var import_react59 = require("react");
31820
32053
  var components = {
31821
32054
  Root,
31822
32055
  Viewport,
@@ -31880,7 +32113,7 @@ function createRenderer(options) {
31880
32113
  const { className, ...rest } = props;
31881
32114
  const resolvedProps = component === "div" ? rest : props;
31882
32115
  const resolvedChildren = children.map(renderNode);
31883
- return (0, import_react58.createElement)(
32116
+ return (0, import_react59.createElement)(
31884
32117
  component,
31885
32118
  {
31886
32119
  key: index,
@@ -31911,6 +32144,7 @@ var Loading = () => {
31911
32144
  };
31912
32145
  var Error2 = ({ message }) => {
31913
32146
  const { settings } = useEmbed();
32147
+ const { t: t3 } = useTranslation();
31914
32148
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
31915
32149
  Flex,
31916
32150
  {
@@ -31922,14 +32156,15 @@ var Error2 = ({ message }) => {
31922
32156
  $alignItems: "center",
31923
32157
  $justifyContent: "center",
31924
32158
  children: [
31925
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { display: "heading1", children: "Error" }) }),
32159
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { display: "heading1", children: t3("Error") }) }),
31926
32160
  /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { children: message }) })
31927
32161
  ]
31928
32162
  }
31929
32163
  );
31930
32164
  };
31931
32165
  var SchematicEmbed = ({ id, accessToken }) => {
31932
- const theme = (0, import_react59.useContext)(nt);
32166
+ const theme = (0, import_react60.useContext)(nt);
32167
+ const { t: t3 } = useTranslation();
31933
32168
  const {
31934
32169
  data,
31935
32170
  error,
@@ -31941,7 +32176,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
31941
32176
  setBuilderSettings
31942
32177
  } = useEmbed();
31943
32178
  const compressedAst = data?.component?.ast;
31944
- const { children, parsedSettings, parseError } = (0, import_react59.useMemo)(() => {
32179
+ const { children, parsedSettings, parseError } = (0, import_react60.useMemo)(() => {
31945
32180
  let children2 = null;
31946
32181
  let parsedSettings2 = null;
31947
32182
  let parseError2 = null;
@@ -31973,22 +32208,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
31973
32208
  parseError: parseError2
31974
32209
  };
31975
32210
  }, [compressedAst]);
31976
- (0, import_react59.useEffect)(() => {
32211
+ (0, import_react60.useEffect)(() => {
31977
32212
  if (accessToken) {
31978
32213
  setAccessToken(accessToken);
31979
32214
  }
31980
32215
  }, [accessToken, setAccessToken]);
31981
- (0, import_react59.useEffect)(() => {
32216
+ (0, import_react60.useEffect)(() => {
31982
32217
  if (id && stale) {
31983
32218
  hydrateComponent(id);
31984
32219
  }
31985
32220
  }, [id, hydrateComponent, stale]);
31986
- (0, import_react59.useEffect)(() => {
32221
+ (0, import_react60.useEffect)(() => {
31987
32222
  if (parsedSettings) {
31988
32223
  setBuilderSettings(parsedSettings);
31989
32224
  }
31990
32225
  }, [parsedSettings, setBuilderSettings]);
31991
- (0, import_react59.useEffect)(() => {
32226
+ (0, import_react60.useEffect)(() => {
31992
32227
  if (parseError) {
31993
32228
  setError(parseError);
31994
32229
  }
@@ -32000,13 +32235,15 @@ var SchematicEmbed = ({ id, accessToken }) => {
32000
32235
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Error2, { message: error.message });
32001
32236
  }
32002
32237
  if (accessToken?.length === 0) {
32003
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Error2, { message: "Please provide an access token." });
32238
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Error2, { message: t3("Please provide an access token.") });
32004
32239
  }
32005
32240
  if (!accessToken?.startsWith("token_")) {
32006
32241
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
32007
32242
  Error2,
32008
32243
  {
32009
- message: 'Invalid access token; your temporary access token will start with "token_".'
32244
+ message: t3(
32245
+ "Invalid access token; your temporary access token will start with `token_`."
32246
+ )
32010
32247
  }
32011
32248
  );
32012
32249
  }