@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.
@@ -3877,6 +3877,10 @@ function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
3877
3877
  }
3878
3878
 
3879
3879
  // src/api/checkoutexternal/models/BillingCollectionMethod.ts
3880
+ var BillingCollectionMethod = {
3881
+ ChargeAutomatically: "charge_automatically",
3882
+ SendInvoice: "send_invoice"
3883
+ };
3880
3884
  function BillingCollectionMethodFromJSON(json) {
3881
3885
  return BillingCollectionMethodFromJSONTyped(json, false);
3882
3886
  }
@@ -5976,6 +5980,48 @@ function CompanyOverrideResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5976
5980
  };
5977
5981
  }
5978
5982
 
5983
+ // src/api/checkoutexternal/models/CompanyPaymentMethodResponseData.ts
5984
+ function CompanyPaymentMethodResponseDataFromJSON(json) {
5985
+ return CompanyPaymentMethodResponseDataFromJSONTyped(json, false);
5986
+ }
5987
+ function CompanyPaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
5988
+ if (json == null) {
5989
+ return json;
5990
+ }
5991
+ return {
5992
+ accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
5993
+ accountName: json["account_name"] == null ? void 0 : json["account_name"],
5994
+ bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
5995
+ billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
5996
+ billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
5997
+ canRemove: json["can_remove"],
5998
+ cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
5999
+ cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
6000
+ cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
6001
+ cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
6002
+ externalId: json["external_id"],
6003
+ id: json["id"],
6004
+ isDefault: json["is_default"],
6005
+ type: json["type"]
6006
+ };
6007
+ }
6008
+
6009
+ // src/api/checkoutexternal/models/CompanyPaymentMethodsResponseData.ts
6010
+ function CompanyPaymentMethodsResponseDataFromJSON(json) {
6011
+ return CompanyPaymentMethodsResponseDataFromJSONTyped(json, false);
6012
+ }
6013
+ function CompanyPaymentMethodsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6014
+ if (json == null) {
6015
+ return json;
6016
+ }
6017
+ return {
6018
+ count: json["count"],
6019
+ paymentMethods: json["payment_methods"].map(
6020
+ CompanyPaymentMethodResponseDataFromJSON
6021
+ )
6022
+ };
6023
+ }
6024
+
5979
6025
  // src/api/checkoutexternal/models/CompanyPlanInvalidReason.ts
5980
6026
  var CompanyPlanInvalidReason = {
5981
6027
  DowngradeNotPermitted: "downgrade_not_permitted",
@@ -7379,6 +7425,20 @@ function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
7379
7425
  };
7380
7426
  }
7381
7427
 
7428
+ // src/api/checkoutexternal/models/GetCompanyPaymentMethodsResponse.ts
7429
+ function GetCompanyPaymentMethodsResponseFromJSON(json) {
7430
+ return GetCompanyPaymentMethodsResponseFromJSONTyped(json, false);
7431
+ }
7432
+ function GetCompanyPaymentMethodsResponseFromJSONTyped(json, ignoreDiscriminator) {
7433
+ if (json == null) {
7434
+ return json;
7435
+ }
7436
+ return {
7437
+ data: CompanyPaymentMethodsResponseDataFromJSON(json["data"]),
7438
+ params: json["params"]
7439
+ };
7440
+ }
7441
+
7382
7442
  // src/api/checkoutexternal/models/GetCompanyUpcomingInvoiceResponse.ts
7383
7443
  function GetCompanyUpcomingInvoiceResponseFromJSON(json) {
7384
7444
  return GetCompanyUpcomingInvoiceResponseFromJSONTyped(json, false);
@@ -8273,6 +8333,38 @@ var CheckoutexternalApi = class extends BaseAPI {
8273
8333
  );
8274
8334
  return await response.value();
8275
8335
  }
8336
+ /**
8337
+ * Get company payment methods
8338
+ */
8339
+ async getCompanyPaymentMethodsRaw(initOverrides) {
8340
+ const queryParameters = {};
8341
+ const headerParameters = {};
8342
+ if (this.configuration && this.configuration.apiKey) {
8343
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
8344
+ "X-Schematic-Api-Key"
8345
+ );
8346
+ }
8347
+ const response = await this.request(
8348
+ {
8349
+ path: `/company/payment-methods`,
8350
+ method: "GET",
8351
+ headers: headerParameters,
8352
+ query: queryParameters
8353
+ },
8354
+ initOverrides
8355
+ );
8356
+ return new JSONApiResponse(
8357
+ response,
8358
+ (jsonValue) => GetCompanyPaymentMethodsResponseFromJSON(jsonValue)
8359
+ );
8360
+ }
8361
+ /**
8362
+ * Get company payment methods
8363
+ */
8364
+ async getCompanyPaymentMethods(initOverrides) {
8365
+ const response = await this.getCompanyPaymentMethodsRaw(initOverrides);
8366
+ return await response.value();
8367
+ }
8276
8368
  /**
8277
8369
  * Get company upcoming invoice
8278
8370
  */
@@ -13134,6 +13226,7 @@ var en = {
13134
13226
  "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.",
13135
13227
  "An unknown error occurred.": "An unknown error occurred.",
13136
13228
  "Billed": "Billed {{period}}",
13229
+ "Billing threshold": "Billing threshold",
13137
13230
  "Bundle selected": "Bundle selected",
13138
13231
  "Buy credits": "Buy credits",
13139
13232
  "Cancel": "Cancel",
@@ -13168,8 +13261,11 @@ var en = {
13168
13261
  "Due today": "Due today",
13169
13262
  "Edit payment details": "Edit payment details",
13170
13263
  "Edit": "Edit",
13264
+ "Email": "Email",
13171
13265
  "Ends on": "Ends on {{date}}",
13172
13266
  "Enter discount code": "Enter discount code",
13267
+ "Enter email address": "Enter email address",
13268
+ "Error": "Error",
13173
13269
  "Error initializing payment method change. Please try again.": "Error initializing payment method change. Please try again.",
13174
13270
  "Error processing payment. Please try a different payment method.": "Error processing payment. Please try a different payment method.",
13175
13271
  "Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
@@ -13190,6 +13286,7 @@ var en = {
13190
13286
  "Invoice credit tooltip": "Credit \u2014 this amount was returned to your account, typically due to a plan change or proration",
13191
13287
  "Invoice charge tooltip": "Charge \u2014 you were billed this amount",
13192
13288
  "Invoices": "Invoices",
13289
+ "Limit": "Limit",
13193
13290
  "Limit of": "Limit of {{amount}}",
13194
13291
  "Loading": "Loading",
13195
13292
  "Manage plan": "Manage plan",
@@ -13212,8 +13309,11 @@ var en = {
13212
13309
  "Error saving custom field values. Please try again.": "Error saving custom field values. Please try again.",
13213
13310
  "Pay now": "Pay now",
13214
13311
  "Payment Details": "Payment Details",
13312
+ "Payment due": "Payment due {{date}}",
13215
13313
  "Plan selected": "Plan selected",
13216
13314
  "Please accept the agreement to continue.": "Please accept the agreement to continue.",
13315
+ "Please try again later.": "Please try again later.",
13316
+ "Portal not found": "Portal not found",
13217
13317
  "Plan": "Plan",
13218
13318
  "Plans": "Plans",
13219
13319
  "Please provide an access token.": "Please provide an access token.",
@@ -13265,6 +13365,7 @@ var en = {
13265
13365
  "There was a problem retrieving your upcoming invoice.": "There was a problem retrieving your upcoming invoice.",
13266
13366
  "There was a problem retrieving your invoices.": "There was a problem retrieving your invoices.",
13267
13367
  "Tier-based": "Tier-based",
13368
+ "Tiered pricing": "Tiered pricing",
13268
13369
  "Tiers apply progressively as quantity increases.": "Tiers apply progressively as quantity increases.",
13269
13370
  "Top up balance with:": "Top up balance with:",
13270
13371
  "Top-ups": "Top-ups",
@@ -13338,6 +13439,15 @@ var en = {
13338
13439
  "$X/unit/period": "{{cost}}/{{unit}}/{{period}}",
13339
13440
  "$X/Y units/period": "{{cost}}/{{size}} {{units}}/{{period}}",
13340
13441
  "day": "day",
13442
+ "day_one": "day",
13443
+ "day_other": "days",
13444
+ "hour_one": "hour",
13445
+ "hour_other": "hours",
13446
+ "minute_one": "minute",
13447
+ "minute_other": "minutes",
13448
+ "second_one": "second",
13449
+ "second_other": "seconds",
13450
+ "week": "week",
13341
13451
  "month": "month",
13342
13452
  "quarter": "quarter",
13343
13453
  "year": "year",
@@ -13346,6 +13456,13 @@ var en = {
13346
13456
  "yr": "yr",
13347
13457
  "one time": "one time",
13348
13458
  "billing period": "billing period",
13459
+ "billing period_one": "billing period",
13460
+ "billing period_other": "billing periods",
13461
+ "daily": "daily",
13462
+ "weekly": "weekly",
13463
+ "monthly": "monthly",
13464
+ "quarterly": "quarterly",
13465
+ "yearly": "yearly",
13349
13466
  "expires after purchase": "expires {{amount}} {{unit}} after purchase",
13350
13467
  "expires at the end of the billing period": "expires at the end of the billing period",
13351
13468
  "expires at the end of the next billing period": "expires at the end of the next billing period",
@@ -14035,11 +14152,9 @@ function formatBundleExpiry(bundle, t3) {
14035
14152
  if (typeof bundle.expiryUnitCount !== "number") {
14036
14153
  return void 0;
14037
14154
  }
14038
- const unit = bundle.expiryUnit === BillingCreditExpiryUnit.BillingPeriods ? t3("billing period") : t3("day");
14039
- return t3("expires after purchase", {
14040
- amount: bundle.expiryUnitCount,
14041
- unit: pluralize(unit, bundle.expiryUnitCount)
14042
- });
14155
+ const count = bundle.expiryUnitCount;
14156
+ const unit = bundle.expiryUnit === BillingCreditExpiryUnit.BillingPeriods ? t3("billing period", { count }) : t3("day", { count });
14157
+ return t3("expires after purchase", { amount: count, unit });
14043
14158
  }
14044
14159
  case BillingCreditExpiryType.EndOfBillingPeriod:
14045
14160
  return t3("expires at the end of the billing period");
@@ -14284,16 +14399,33 @@ function entitlementHasHardLimit(entitlement) {
14284
14399
  }
14285
14400
 
14286
14401
  // src/utils/api/feature.ts
14287
- function getFeatureName(feature, count = 0, ignore = false) {
14288
- const shouldBePlural = count === 0 || count > 1;
14402
+ function isEnglish(locale) {
14403
+ try {
14404
+ return new Intl.Locale(locale).language === "en";
14405
+ } catch {
14406
+ return true;
14407
+ }
14408
+ }
14409
+ function isOne(count, locale) {
14410
+ return new Intl.PluralRules(locale).select(count) === "one";
14411
+ }
14412
+ function getFeatureName(feature, locale, count, ignore = false) {
14413
+ if (!isEnglish(locale)) {
14414
+ const named = ignore ? { name: feature.name } : feature;
14415
+ const singularName2 = named.singularName || named.name;
14416
+ const pluralName2 = named.pluralName || singularName2;
14417
+ return count !== void 0 && isOne(count, locale) ? singularName2 : pluralName2;
14418
+ }
14419
+ const resolvedCount = count ?? 0;
14420
+ const shouldBePlural = resolvedCount === 0 || resolvedCount > 1;
14289
14421
  const { name, singularName, pluralName } = feature;
14290
14422
  if (!ignore && pluralName && shouldBePlural) {
14291
14423
  return pluralName;
14292
14424
  }
14293
14425
  if (!ignore && singularName) {
14294
- return shouldBePlural ? pluralize(singularName, count) : singularName;
14426
+ return shouldBePlural ? pluralize(singularName, resolvedCount) : singularName;
14295
14427
  }
14296
- return pluralize(name, count);
14428
+ return pluralize(name, resolvedCount);
14297
14429
  }
14298
14430
 
14299
14431
  // src/utils/color.ts
@@ -14503,8 +14635,21 @@ function formatCurrency(amount, {
14503
14635
  function formatOrdinal(n2, t3) {
14504
14636
  return t3("Ordinal", { count: n2, ordinal: true });
14505
14637
  }
14506
- function adjectify(str) {
14507
- return `${str}ly`;
14638
+ function adjectify(period, t3) {
14639
+ switch (period) {
14640
+ case "day":
14641
+ return t3("daily");
14642
+ case "week":
14643
+ return t3("weekly");
14644
+ case "month":
14645
+ return t3("monthly");
14646
+ case "quarter":
14647
+ return t3("quarterly");
14648
+ case "year":
14649
+ return t3("yearly");
14650
+ default:
14651
+ return period;
14652
+ }
14508
14653
  }
14509
14654
  var CURRENCY_FLAGS = {
14510
14655
  usd: "\u{1F1FA}\u{1F1F8}",
@@ -14620,11 +14765,12 @@ function getBillingPreviewText({
14620
14765
  );
14621
14766
  }
14622
14767
  const schedule = scheduleParts.length > 0 ? `${scheduleParts.join(" ")} ` : "";
14768
+ const period = t3(planPeriod);
14623
14769
  if (!discount) {
14624
14770
  return t3("You will be billed", {
14625
14771
  price: subscriptionPrice,
14626
14772
  usage,
14627
- period: planPeriod,
14773
+ period,
14628
14774
  schedule
14629
14775
  });
14630
14776
  }
@@ -14633,7 +14779,7 @@ function getBillingPreviewText({
14633
14779
  return t3("You will be billed", {
14634
14780
  price: discountedPrice,
14635
14781
  usage,
14636
- period: planPeriod,
14782
+ period,
14637
14783
  schedule
14638
14784
  });
14639
14785
  }
@@ -14641,7 +14787,7 @@ function getBillingPreviewText({
14641
14787
  return t3("You will be billed with discount window", {
14642
14788
  price: discountedPrice,
14643
14789
  usage,
14644
- period: planPeriod,
14790
+ period,
14645
14791
  schedule,
14646
14792
  window: t3("for the next months", { count: durationInMonths }),
14647
14793
  fullPrice: subscriptionPrice
@@ -14650,7 +14796,7 @@ function getBillingPreviewText({
14650
14796
  return t3("You will be billed next bill discount", {
14651
14797
  price: discountedPrice,
14652
14798
  usage,
14653
- period: planPeriod,
14799
+ period,
14654
14800
  schedule,
14655
14801
  fullPrice: subscriptionPrice
14656
14802
  });
@@ -15425,7 +15571,7 @@ var reducer = (state, action) => {
15425
15571
  // src/context/EmbedProvider.tsx
15426
15572
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
15427
15573
  var getCustomHeaders = (sessionId) => ({
15428
- "X-Schematic-Components-Version": "2.28.0",
15574
+ "X-Schematic-Components-Version": "2.29.1",
15429
15575
  "X-Schematic-Session-ID": sessionId
15430
15576
  });
15431
15577
  var normalizeCurrencyFilter = (filter2) => {
@@ -16211,6 +16357,29 @@ function useIsLightBackground() {
16211
16357
  return isLightBackground;
16212
16358
  }
16213
16359
 
16360
+ // src/hooks/useNextBillDate.ts
16361
+ import { useMemo as useMemo7 } from "react";
16362
+ function useNextBillDate(upcomingInvoice) {
16363
+ const { data } = useEmbed();
16364
+ const invoice = upcomingInvoice === void 0 ? data?.upcomingInvoice : upcomingInvoice;
16365
+ const subscription = data?.company?.billingSubscription;
16366
+ const cancelAtPeriodEnd = subscription?.cancelAtPeriodEnd;
16367
+ const periodEnd = subscription?.periodEnd;
16368
+ const collectionMethod = invoice?.collectionMethod;
16369
+ const dueDate = invoice?.dueDate ?? void 0;
16370
+ return useMemo7(() => {
16371
+ if (cancelAtPeriodEnd) {
16372
+ return { billDate: void 0, paymentDueDate: void 0 };
16373
+ }
16374
+ const billDate = periodEnd && periodEnd > 0 ? new Date(periodEnd * 1e3) : dueDate;
16375
+ const hasSeparateDeadline = collectionMethod === BillingCollectionMethod.SendInvoice && dueDate && billDate && new Date(dueDate).toDateString() !== new Date(billDate).toDateString();
16376
+ return {
16377
+ billDate,
16378
+ paymentDueDate: hasSeparateDeadline ? dueDate : void 0
16379
+ };
16380
+ }, [cancelAtPeriodEnd, periodEnd, collectionMethod, dueDate]);
16381
+ }
16382
+
16214
16383
  // src/hooks/usePaymentConfirmation.ts
16215
16384
  import { useCallback as useCallback4, useEffect as useEffect2, useRef as useRef3, useState } from "react";
16216
16385
  var usePaymentConfirmation = ({
@@ -16318,7 +16487,7 @@ var usePaymentConfirmation = ({
16318
16487
  };
16319
16488
 
16320
16489
  // src/hooks/useRequest.ts
16321
- import { useCallback as useCallback5, useMemo as useMemo7, useState as useState2 } from "react";
16490
+ import { useCallback as useCallback5, useMemo as useMemo8, useState as useState2 } from "react";
16322
16491
  function useRequest(fn) {
16323
16492
  const [isLoading, setIsLoading] = useState2(false);
16324
16493
  const [error, setError] = useState2(null);
@@ -16338,7 +16507,7 @@ function useRequest(fn) {
16338
16507
  setIsLoading(false);
16339
16508
  }
16340
16509
  }, [fn]);
16341
- const value = useMemo7(() => {
16510
+ const value = useMemo8(() => {
16342
16511
  const state = { isLoading, error, data };
16343
16512
  return [state, request];
16344
16513
  }, [isLoading, error, data, request]);
@@ -16346,10 +16515,11 @@ function useRequest(fn) {
16346
16515
  }
16347
16516
 
16348
16517
  // src/hooks/useTrialEnd.ts
16349
- import { useMemo as useMemo8 } from "react";
16518
+ import { useMemo as useMemo9 } from "react";
16350
16519
  function useTrialEnd() {
16351
16520
  const { data } = useEmbed();
16352
- const { endDate, amount, units } = useMemo8(() => {
16521
+ const { t: t3 } = useTranslation();
16522
+ const { endDate, amount, units } = useMemo9(() => {
16353
16523
  const billingSubscription = data?.company?.billingSubscription;
16354
16524
  const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
16355
16525
  let amount2;
@@ -16371,21 +16541,21 @@ function useTrialEnd() {
16371
16541
  amount2 = Math.floor(difference / SECONDS_IN_MS);
16372
16542
  unit = "second";
16373
16543
  }
16374
- units2 = pluralize(unit, amount2);
16544
+ units2 = t3(unit, { count: amount2 });
16375
16545
  }
16376
16546
  return { endDate: end, amount: amount2, units: units2 };
16377
- }, [data?.company?.billingSubscription]);
16547
+ }, [data?.company?.billingSubscription, t3]);
16378
16548
  return { endDate, amount, units };
16379
16549
  }
16380
16550
 
16381
16551
  // src/hooks/useTruncatedList.ts
16382
- import { useCallback as useCallback6, useMemo as useMemo9, useState as useState3 } from "react";
16552
+ import { useCallback as useCallback6, useMemo as useMemo10, useState as useState3 } from "react";
16383
16553
  function useTruncatedList(items, { limit }) {
16384
16554
  const [isExpandedState, setIsExpanded] = useState3(false);
16385
16555
  const total = items.length;
16386
16556
  const canExpand = total > limit;
16387
16557
  const isExpanded = canExpand && isExpandedState;
16388
- const visibleItems = useMemo9(
16558
+ const visibleItems = useMemo10(
16389
16559
  () => canExpand && !isExpanded ? items.slice(0, limit) : items,
16390
16560
  [items, limit, canExpand, isExpanded]
16391
16561
  );
@@ -16866,7 +17036,7 @@ import {
16866
17036
  forwardRef,
16867
17037
  useImperativeHandle,
16868
17038
  useLayoutEffect as useLayoutEffect2,
16869
- useMemo as useMemo10,
17039
+ useMemo as useMemo11,
16870
17040
  useRef as useRef4
16871
17041
  } from "react";
16872
17042
 
@@ -16959,7 +17129,7 @@ var Dialog2 = forwardRef(
16959
17129
  document.body.style.overflow = initialOverflowValue;
16960
17130
  };
16961
17131
  }, [isModal]);
16962
- const dialog = useMemo10(
17132
+ const dialog = useMemo11(
16963
17133
  () => /* @__PURE__ */ jsx4(
16964
17134
  Dialog,
16965
17135
  {
@@ -17789,7 +17959,7 @@ var AutoTopupNotice = ({
17789
17959
  trigger: /* @__PURE__ */ jsx14(
17790
17960
  Icon3,
17791
17961
  {
17792
- title: "auto top-up",
17962
+ title: t3("Auto Top-up"),
17793
17963
  name: "info-rounded",
17794
17964
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
17795
17965
  style: { lineHeight: 0 }
@@ -17828,7 +17998,7 @@ var BillingThresholdTooltip = ({
17828
17998
  trigger: /* @__PURE__ */ jsx15(
17829
17999
  Icon3,
17830
18000
  {
17831
- title: "billing threshold",
18001
+ title: t3("Billing threshold"),
17832
18002
  name: "info-rounded",
17833
18003
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
17834
18004
  style: { lineHeight: 0 }
@@ -17972,7 +18142,7 @@ var ButtonGroup = ({
17972
18142
  };
17973
18143
 
17974
18144
  // src/components/shared/checkout-dialog/Plan/Entitlement.tsx
17975
- import { useMemo as useMemo11 } from "react";
18145
+ import { useMemo as useMemo12 } from "react";
17976
18146
  import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
17977
18147
  var Entitlement = ({
17978
18148
  portal,
@@ -18002,7 +18172,7 @@ var Entitlement = ({
18002
18172
  tiersMode
18003
18173
  } = entitlementBillingPrice || {};
18004
18174
  const tiered = entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementBillingPrice);
18005
- const text = useMemo11(() => {
18175
+ const text = useMemo12(() => {
18006
18176
  if (!entitlement.feature) {
18007
18177
  return;
18008
18178
  }
@@ -18024,7 +18194,7 @@ var Entitlement = ({
18024
18194
  packageSize,
18025
18195
  " "
18026
18196
  ] }),
18027
- getFeatureName(entitlement.feature, packageSize),
18197
+ getFeatureName(entitlement.feature, locale, packageSize),
18028
18198
  entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs8(Fragment4, { children: [
18029
18199
  " ",
18030
18200
  t3("per"),
@@ -18049,12 +18219,13 @@ var Entitlement = ({
18049
18219
  " ",
18050
18220
  getFeatureName(
18051
18221
  entitlement.valueCredit,
18222
+ locale,
18052
18223
  entitlement.consumptionRate || void 0
18053
18224
  ),
18054
18225
  " ",
18055
18226
  t3("per"),
18056
18227
  " ",
18057
- getFeatureName(entitlement.feature, 1)
18228
+ getFeatureName(entitlement.feature, locale, 1)
18058
18229
  ] });
18059
18230
  }
18060
18231
  if (entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit) {
@@ -18062,13 +18233,17 @@ var Entitlement = ({
18062
18233
  amount: creditBasedEntitlementLimit.limit,
18063
18234
  units: getFeatureName(
18064
18235
  entitlement.feature,
18236
+ locale,
18065
18237
  creditBasedEntitlementLimit.limit
18066
18238
  ),
18067
- period: creditBasedEntitlementLimit.period
18239
+ period: t3(
18240
+ creditBasedEntitlementLimit.period
18241
+ )
18068
18242
  }) : t3("Up to X units", {
18069
18243
  amount: creditBasedEntitlementLimit.limit,
18070
18244
  units: getFeatureName(
18071
18245
  entitlement.feature,
18246
+ locale,
18072
18247
  creditBasedEntitlementLimit.limit
18073
18248
  )
18074
18249
  }) });
@@ -18076,11 +18251,11 @@ var Entitlement = ({
18076
18251
  if (hasNumericValue) {
18077
18252
  return /* @__PURE__ */ jsxs8(Fragment4, { children: [
18078
18253
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
18079
- item: getFeatureName(entitlement.feature)
18254
+ item: getFeatureName(entitlement.feature, locale)
18080
18255
  }) : typeof limit === "number" && /* @__PURE__ */ jsxs8(Fragment4, { children: [
18081
18256
  formatNumber(limit, { locale }),
18082
18257
  " ",
18083
- getFeatureName(entitlement.feature, limit)
18258
+ getFeatureName(entitlement.feature, locale, limit)
18084
18259
  ] }),
18085
18260
  metricPeriodName && /* @__PURE__ */ jsxs8(Fragment4, { children: [
18086
18261
  " ",
@@ -18105,7 +18280,7 @@ var Entitlement = ({
18105
18280
  selectedCurrency,
18106
18281
  showWarningThresholdAsLimit
18107
18282
  ]);
18108
- const usageText = useMemo11(() => {
18283
+ const usageText = useMemo12(() => {
18109
18284
  if (!entitlement.feature) {
18110
18285
  return;
18111
18286
  }
@@ -18119,7 +18294,7 @@ var Entitlement = ({
18119
18294
  packageSize,
18120
18295
  " "
18121
18296
  ] }),
18122
- getFeatureName(entitlement.feature, packageSize),
18297
+ getFeatureName(entitlement.feature, locale, packageSize),
18123
18298
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs8(Fragment4, { children: [
18124
18299
  "/",
18125
18300
  shortenPeriod(period, t3)
@@ -18451,7 +18626,7 @@ var Plan = ({
18451
18626
  };
18452
18627
 
18453
18628
  // src/components/shared/checkout-dialog/AutoTopup.tsx
18454
- import { useMemo as useMemo12 } from "react";
18629
+ import { useMemo as useMemo13 } from "react";
18455
18630
  import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
18456
18631
  var AutoTopup = ({
18457
18632
  planCreditGrants,
@@ -18459,9 +18634,9 @@ var AutoTopup = ({
18459
18634
  updateAutoTopupConfig
18460
18635
  }) => {
18461
18636
  const { settings } = useEmbed();
18462
- const { t: t3 } = useTranslation();
18637
+ const { t: t3, locale } = useTranslation();
18463
18638
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
18464
- const configurableCreditGrants = useMemo12(() => {
18639
+ const configurableCreditGrants = useMemo13(() => {
18465
18640
  return planCreditGrants.reduce(
18466
18641
  (acc, grant) => {
18467
18642
  if (isSelfServiceAutoTopupAvailable(grant)) {
@@ -18506,7 +18681,7 @@ var AutoTopup = ({
18506
18681
  }) }) }),
18507
18682
  /* @__PURE__ */ jsx20(Box, { as: "p", $marginBottom: "2rem", children: /* @__PURE__ */ jsx20(Text, { children: t3(
18508
18683
  "Automatically purchase more credits when your balance is low",
18509
- { units: getFeatureName(grant.credit) }
18684
+ { units: getFeatureName(grant.credit, locale) }
18510
18685
  ) }) })
18511
18686
  ] }),
18512
18687
  /* @__PURE__ */ jsxs10(Flex, { $alignItems: "center", $gap: "0.5rem", $marginBottom: "1rem", children: [
@@ -18587,7 +18762,7 @@ var AutoTopup = ({
18587
18762
  };
18588
18763
 
18589
18764
  // src/components/shared/checkout-dialog/Quantity.tsx
18590
- import { useMemo as useMemo13 } from "react";
18765
+ import { useMemo as useMemo14 } from "react";
18591
18766
  import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
18592
18767
  var Quantity = ({
18593
18768
  portal,
@@ -18602,12 +18777,12 @@ var Quantity = ({
18602
18777
  const isLightBackground = useIsLightBackground();
18603
18778
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
18604
18779
  const unitPriceFontSize = 0.875 * settings.theme.typography.text.fontSize;
18605
- const planCredits = useMemo13(
18780
+ const planCredits = useMemo14(
18606
18781
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
18607
18782
  [selectedPlan?.includedCreditGrants]
18608
18783
  );
18609
18784
  const prorationBehavior = data?.checkoutSettings?.prorationBehavior;
18610
- const renewalDate = data?.upcomingInvoice?.dueDate ?? void 0;
18785
+ const { billDate: renewalDate } = useNextBillDate();
18611
18786
  return /* @__PURE__ */ jsx21(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce((acc, entitlement) => {
18612
18787
  if (entitlement.feature) {
18613
18788
  const entitlementBillingPrice = getEntitlementPrice(
@@ -18703,7 +18878,7 @@ var Quantity = ({
18703
18878
  $color: settings.theme.typography.text.color,
18704
18879
  children: t3("Currently using", {
18705
18880
  quantity: entitlement.usage,
18706
- unit: getFeatureName(entitlement.feature)
18881
+ unit: getFeatureName(entitlement.feature, locale)
18707
18882
  })
18708
18883
  }
18709
18884
  ),
@@ -18768,7 +18943,11 @@ var Quantity = ({
18768
18943
  packageSize,
18769
18944
  " "
18770
18945
  ] }),
18771
- getFeatureName(entitlement.feature, packageSize),
18946
+ getFeatureName(
18947
+ entitlement.feature,
18948
+ locale,
18949
+ packageSize
18950
+ ),
18772
18951
  "/",
18773
18952
  shortenPeriod(period, t3)
18774
18953
  ] })
@@ -18805,12 +18984,14 @@ var Quantity = ({
18805
18984
  quantity: entitlement.quantity,
18806
18985
  licenseName: getFeatureName(
18807
18986
  entitlement.feature,
18987
+ locale,
18808
18988
  entitlement.quantity
18809
18989
  ),
18810
18990
  perUnit: perLicenseGrant.amount,
18811
18991
  total: includedCredits,
18812
18992
  creditName: getFeatureName(
18813
18993
  licenseCredit,
18994
+ locale,
18814
18995
  includedCredits
18815
18996
  ),
18816
18997
  period: shortenPeriod(licenseCredit.period, t3)
@@ -18832,11 +19013,13 @@ var Quantity = ({
18832
19013
  added: addedQuantity,
18833
19014
  licenseName: getFeatureName(
18834
19015
  entitlement.feature,
19016
+ locale,
18835
19017
  addedQuantity
18836
19018
  ),
18837
19019
  credits: addedCredits,
18838
19020
  creditName: getFeatureName(
18839
19021
  licenseCredit,
19022
+ locale,
18840
19023
  addedCredits
18841
19024
  )
18842
19025
  }),
@@ -18846,9 +19029,10 @@ var Quantity = ({
18846
19029
  total: includedCredits,
18847
19030
  creditName: getFeatureName(
18848
19031
  licenseCredit,
19032
+ locale,
18849
19033
  includedCredits
18850
19034
  ),
18851
- cadence: adjectify(licenseCredit.period),
19035
+ cadence: adjectify(licenseCredit.period, t3),
18852
19036
  day: formatOrdinal(renewalDate.getDate(), t3)
18853
19037
  })
18854
19038
  ] })
@@ -18887,6 +19071,7 @@ function renderMeteredEntitlementPricing({
18887
19071
  "/",
18888
19072
  feature ? getFeatureName(
18889
19073
  feature,
19074
+ locale,
18890
19075
  packageSize
18891
19076
  ) : featureName || "unit"
18892
19077
  ] });
@@ -18904,6 +19089,7 @@ function renderMeteredEntitlementPricing({
18904
19089
  ] }),
18905
19090
  feature ? getFeatureName(
18906
19091
  feature,
19092
+ locale,
18907
19093
  packageSize
18908
19094
  ) : featureName || "unit"
18909
19095
  ] });
@@ -19221,7 +19407,7 @@ var Credits = ({
19221
19407
  /* @__PURE__ */ jsx23(Box, { children: /* @__PURE__ */ jsxs13(Text, { display: "heading6", children: [
19222
19408
  formatNumber(bundle.quantity ?? 0, { locale }),
19223
19409
  " ",
19224
- getFeatureName(bundle)
19410
+ getFeatureName(bundle, locale)
19225
19411
  ] }) })
19226
19412
  ] }),
19227
19413
  typeof price === "number" && /* @__PURE__ */ jsx23(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx23(Text, { children: formatCurrency(price, {
@@ -19369,7 +19555,7 @@ var CustomCheckoutFields = ({
19369
19555
  };
19370
19556
 
19371
19557
  // src/components/shared/checkout-dialog/TaxIdField.tsx
19372
- import { useMemo as useMemo14 } from "react";
19558
+ import { useMemo as useMemo15 } from "react";
19373
19559
  import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
19374
19560
  var Select = gt(Input2).attrs({ as: "select" })`
19375
19561
  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");
@@ -19384,7 +19570,7 @@ var TaxIdField = ({
19384
19570
  }) => {
19385
19571
  const { t: t3, locale } = useTranslation();
19386
19572
  const isLightBackground = useIsLightBackground();
19387
- const countryOptions = useMemo14(() => taxIdCountryOptions(locale), [locale]);
19573
+ const countryOptions = useMemo15(() => taxIdCountryOptions(locale), [locale]);
19388
19574
  const jurisdictions = taxIdJurisdictionsForCountry(value.country);
19389
19575
  const handleCountryChange = (country) => {
19390
19576
  const next2 = taxIdJurisdictionsForCountry(country);
@@ -19613,7 +19799,7 @@ import {
19613
19799
  useCallback as useCallback8,
19614
19800
  useEffect as useEffect3,
19615
19801
  useLayoutEffect as useLayoutEffect4,
19616
- useMemo as useMemo15,
19802
+ useMemo as useMemo16,
19617
19803
  useRef as useRef6,
19618
19804
  useState as useState8
19619
19805
  } from "react";
@@ -19777,7 +19963,7 @@ var CheckoutDialog = ({ top }) => {
19777
19963
  const [isModal, setIsModal] = useState8(true);
19778
19964
  const showPeriodToggle = data?.displaySettings?.showPeriodToggle ?? true;
19779
19965
  const trialPaymentMethodRequired = data?.trialPaymentMethodRequired === true;
19780
- const featureUsage = useMemo15(
19966
+ const featureUsage = useMemo16(
19781
19967
  () => data?.featureUsage?.features ?? [],
19782
19968
  [data?.featureUsage?.features]
19783
19969
  );
@@ -19833,7 +20019,7 @@ var CheckoutDialog = ({ top }) => {
19833
20019
  useSelectedPeriod: showPeriodToggle
19834
20020
  });
19835
20021
  const [selectedPlanId, setSelectedPlanId] = useState8(void 0);
19836
- const selectedPlan = useMemo15(() => {
20022
+ const selectedPlan = useMemo16(() => {
19837
20023
  if (selectedPlanId === null) {
19838
20024
  return void 0;
19839
20025
  }
@@ -19849,7 +20035,7 @@ var CheckoutDialog = ({ top }) => {
19849
20035
  );
19850
20036
  }, [availablePlans, checkoutState, selectedPlanId]);
19851
20037
  const [shouldTrial, setShouldTrial] = useState8(false);
19852
- const planCreditGrants = useMemo15(() => {
20038
+ const planCreditGrants = useMemo16(() => {
19853
20039
  const grants = mergeCompanyGrants(
19854
20040
  selectedPlan?.includedCreditGrants,
19855
20041
  data?.company?.plan?.includedCreditGrants
@@ -19895,11 +20081,11 @@ var CheckoutDialog = ({ top }) => {
19895
20081
  }
19896
20082
  return ids;
19897
20083
  });
19898
- const addOnCompatibilityLookup = useMemo15(
20084
+ const addOnCompatibilityLookup = useMemo16(
19899
20085
  () => buildAddOnCompatibilityLookup(data?.addOnCompatibilities),
19900
20086
  [data?.addOnCompatibilities]
19901
20087
  );
19902
- const addOns = useMemo15(() => {
20088
+ const addOns = useMemo16(() => {
19903
20089
  return availableAddOns.filter((availAddOn) => {
19904
20090
  if (hasCurrency && !planSupportsCurrency(availAddOn, effectiveCurrency)) {
19905
20091
  return false;
@@ -19928,7 +20114,7 @@ var CheckoutDialog = ({ top }) => {
19928
20114
  const [bundleCounts, setBundleCounts] = useState8({});
19929
20115
  const bundleCountsRef = useRef6(bundleCounts);
19930
20116
  const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
19931
- const creditBundles = useMemo15(() => {
20117
+ const creditBundles = useMemo16(() => {
19932
20118
  return deriveCreditBundles(
19933
20119
  data?.creditBundles,
19934
20120
  bundleGatingPlanId,
@@ -19938,7 +20124,7 @@ var CheckoutDialog = ({ top }) => {
19938
20124
  const [hasInitialPaymentMethod] = useState8(
19939
20125
  () => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
19940
20126
  );
19941
- const isCreditOnlyPurchase = useMemo15(
20127
+ const isCreditOnlyPurchase = useMemo16(
19942
20128
  () => isCreditOnlyCheckout({
19943
20129
  plan: selectedPlan,
19944
20130
  creditBundles,
@@ -20005,13 +20191,13 @@ var CheckoutDialog = ({ top }) => {
20005
20191
  checkoutState?.payInAdvanceQuantities
20006
20192
  );
20007
20193
  });
20008
- const payInAdvanceEntitlements = useMemo15(
20194
+ const payInAdvanceEntitlements = useMemo16(
20009
20195
  () => usageBasedEntitlements.filter(
20010
20196
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20011
20197
  ),
20012
20198
  [usageBasedEntitlements]
20013
20199
  );
20014
- const addOnPayInAdvanceEntitlements = useMemo15(
20200
+ const addOnPayInAdvanceEntitlements = useMemo16(
20015
20201
  () => addOnUsageBasedEntitlements.filter(
20016
20202
  (entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
20017
20203
  ),
@@ -20027,7 +20213,7 @@ var CheckoutDialog = ({ top }) => {
20027
20213
  }
20028
20214
  return values;
20029
20215
  });
20030
- const hasIncompleteRequiredCustomFields = useMemo15(() => {
20216
+ const hasIncompleteRequiredCustomFields = useMemo16(() => {
20031
20217
  return (data?.customCheckoutFields ?? []).some(
20032
20218
  (field) => field.required && !customFieldValues[field.id]?.trim()
20033
20219
  );
@@ -20077,12 +20263,12 @@ var CheckoutDialog = ({ top }) => {
20077
20263
  const [optInAccepted, setOptInAccepted] = useState8(false);
20078
20264
  const presentedOptInRef = useRef6(null);
20079
20265
  const [willScheduleDowngrade, setWillScheduleDowngrade] = useState8(false);
20080
- const willTrialWithoutPaymentMethod = useMemo15(
20266
+ const willTrialWithoutPaymentMethod = useMemo16(
20081
20267
  () => shouldTrial && !trialPaymentMethodRequired,
20082
20268
  [shouldTrial, trialPaymentMethodRequired]
20083
20269
  );
20084
20270
  const isSelectedPlanTrialable = selectedPlan && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
20085
- const checkoutStages = useMemo15(() => {
20271
+ const checkoutStages = useMemo16(() => {
20086
20272
  const stages = [];
20087
20273
  const checkoutStage2 = {
20088
20274
  id: "checkout",
@@ -20188,7 +20374,7 @@ var CheckoutDialog = ({ top }) => {
20188
20374
  }
20189
20375
  return "plan";
20190
20376
  });
20191
- const effectiveCheckoutStage = useMemo15(() => {
20377
+ const effectiveCheckoutStage = useMemo16(() => {
20192
20378
  if (isBypassLoading) return checkoutStage;
20193
20379
  let id = checkoutStage;
20194
20380
  if (id === "credits" && !checkoutStages.some((stage) => stage.id === id)) {
@@ -20204,7 +20390,7 @@ var CheckoutDialog = ({ top }) => {
20204
20390
  }, [checkoutStage, checkoutStages, checkoutState, isBypassLoading]);
20205
20391
  const previewRequestIdRef = useRef6(0);
20206
20392
  const planStageVisible = checkoutStages.some((stage) => stage.id === "plan") && !checkoutState?.bypassPlanSelection;
20207
- const checkoutStageCurrencies = useMemo15(() => {
20393
+ const checkoutStageCurrencies = useMemo16(() => {
20208
20394
  if (!selectedPlan) return currencies;
20209
20395
  return currencies.filter(
20210
20396
  (currency) => planOffersCurrencyForPeriod(selectedPlan, planPeriod, currency)
@@ -20777,7 +20963,7 @@ var CheckoutDialog = ({ top }) => {
20777
20963
  const activeCheckoutStage = checkoutStages.find(
20778
20964
  (stage) => stage.id === effectiveCheckoutStage
20779
20965
  );
20780
- const visibleStages = useMemo15(() => {
20966
+ const visibleStages = useMemo16(() => {
20781
20967
  if (!checkoutState?.hideSkippedStages) {
20782
20968
  return checkoutStages;
20783
20969
  }
@@ -20800,7 +20986,7 @@ var CheckoutDialog = ({ top }) => {
20800
20986
  return true;
20801
20987
  });
20802
20988
  }, [checkoutStages, checkoutState]);
20803
- const navigableStages = useMemo15(() => {
20989
+ const navigableStages = useMemo16(() => {
20804
20990
  return checkoutStages.filter((stage) => {
20805
20991
  if (stage.id === "plan" && checkoutState?.bypassPlanSelection) {
20806
20992
  return false;
@@ -21180,7 +21366,7 @@ var CurrencyPeriodMismatchNotice = ({
21180
21366
  style: { opacity: 0.85, textAlign: "center" },
21181
21367
  children: t3("No {{currency}} price for the {{period}} billing period.", {
21182
21368
  currency: currency.toUpperCase(),
21183
- period
21369
+ period: adjectify(period, t3)
21184
21370
  })
21185
21371
  }
21186
21372
  )
@@ -21342,7 +21528,7 @@ var HardLimitTooltip = ({
21342
21528
  feature,
21343
21529
  limit
21344
21530
  }) => {
21345
- const { t: t3 } = useTranslation();
21531
+ const { t: t3, locale } = useTranslation();
21346
21532
  const { data } = useEmbed();
21347
21533
  const isLightBackground = useIsLightBackground();
21348
21534
  const showHardLimit = data?.displaySettings?.showHardLimit ?? false;
@@ -21356,7 +21542,7 @@ var HardLimitTooltip = ({
21356
21542
  trigger: /* @__PURE__ */ jsx32(
21357
21543
  Icon3,
21358
21544
  {
21359
- title: "limit",
21545
+ title: t3("Limit"),
21360
21546
  name: "info-rounded",
21361
21547
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
21362
21548
  style: { lineHeight: 0 }
@@ -21364,7 +21550,7 @@ var HardLimitTooltip = ({
21364
21550
  ),
21365
21551
  content: /* @__PURE__ */ jsx32(Text, { children: t3("Up to a limit of", {
21366
21552
  amount: limit,
21367
- units: getFeatureName(feature, limit)
21553
+ units: getFeatureName(feature, locale, limit)
21368
21554
  }) })
21369
21555
  }
21370
21556
  );
@@ -21413,17 +21599,17 @@ var InvalidCurrencyNotice = ({
21413
21599
  import { useCallback as useCallback10, useLayoutEffect as useLayoutEffect5, useRef as useRef7, useState as useState10 } from "react";
21414
21600
 
21415
21601
  // src/components/shared/checkout-dialog/EditableCustomCheckoutFields.tsx
21416
- import { useCallback as useCallback9, useMemo as useMemo16, useState as useState9 } from "react";
21602
+ import { useCallback as useCallback9, useMemo as useMemo17, useState as useState9 } from "react";
21417
21603
  import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
21418
21604
  var EditableCustomCheckoutFields = () => {
21419
21605
  const { t: t3 } = useTranslation();
21420
21606
  const isLightBackground = useIsLightBackground();
21421
21607
  const { data, updateCustomFieldValues } = useEmbed();
21422
- const customCheckoutFields = useMemo16(
21608
+ const customCheckoutFields = useMemo17(
21423
21609
  () => data?.customCheckoutFields ?? [],
21424
21610
  [data?.customCheckoutFields]
21425
21611
  );
21426
- const serverFieldValues = useMemo16(() => {
21612
+ const serverFieldValues = useMemo17(() => {
21427
21613
  const values2 = {};
21428
21614
  for (const field of customCheckoutFields) {
21429
21615
  values2[field.id] = field.value ?? "";
@@ -21593,7 +21779,7 @@ import {
21593
21779
  useElements,
21594
21780
  useStripe
21595
21781
  } from "@stripe/react-stripe-js";
21596
- import { useEffect as useEffect4, useMemo as useMemo17, useRef as useRef8, useState as useState11 } from "react";
21782
+ import { useEffect as useEffect4, useMemo as useMemo18, useRef as useRef8, useState as useState11 } from "react";
21597
21783
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
21598
21784
  var PaymentForm = ({ onConfirm, financeData }) => {
21599
21785
  const { t: t3 } = useTranslation();
@@ -21624,7 +21810,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21624
21810
  const [isAddressComplete, setIsAddressComplete] = useState11(
21625
21811
  () => !shouldCollectAddress
21626
21812
  );
21627
- const addressDefaultsKey = useMemo17(
21813
+ const addressDefaultsKey = useMemo18(
21628
21814
  () => JSON.stringify(billing ?? {}),
21629
21815
  [billing]
21630
21816
  );
@@ -21733,7 +21919,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21733
21919
  )
21734
21920
  ] }),
21735
21921
  stripe && collectEmail && /* @__PURE__ */ jsxs25(Box, { "data-field": "name", $marginBottom: "1.5rem", $verticalAlign: "top", children: [
21736
- /* @__PURE__ */ jsx36(Label, { htmlFor: "email", children: "Email" }),
21922
+ /* @__PURE__ */ jsx36(Label, { htmlFor: "email", children: t3("Email") }),
21737
21923
  /* @__PURE__ */ jsx36(
21738
21924
  Input2,
21739
21925
  {
@@ -21742,7 +21928,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21742
21928
  type: "email",
21743
21929
  value: email,
21744
21930
  autoComplete: "email",
21745
- placeholder: "Enter email address",
21931
+ placeholder: t3("Enter email address"),
21746
21932
  required: true,
21747
21933
  onChange: (e) => {
21748
21934
  userEditedEmailRef.current = true;
@@ -21789,7 +21975,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
21789
21975
  };
21790
21976
 
21791
21977
  // src/components/shared/period-toggle/PeriodToggle.tsx
21792
- import { useMemo as useMemo18 } from "react";
21978
+ import { useMemo as useMemo19 } from "react";
21793
21979
  import { jsx as jsx37 } from "react/jsx-runtime";
21794
21980
  var PERIOD_MONTH_COUNT = {
21795
21981
  year: 12,
@@ -21805,7 +21991,7 @@ var PeriodToggle = ({
21805
21991
  const { t: t3 } = useTranslation();
21806
21992
  const { settings } = useEmbed();
21807
21993
  const isLightBackground = useIsLightBackground();
21808
- const savingsByPeriod = useMemo18(() => {
21994
+ const savingsByPeriod = useMemo19(() => {
21809
21995
  const result = {};
21810
21996
  if (!selectedPlan) {
21811
21997
  return result;
@@ -21869,7 +22055,7 @@ var PeriodToggle = ({
21869
22055
  },
21870
22056
  $size: 15,
21871
22057
  $weight: option === selectedOption ? 600 : 400,
21872
- children: t3("Billed", { period: adjectify(option) })
22058
+ children: t3("Billed", { period: adjectify(option, t3) })
21873
22059
  }
21874
22060
  )
21875
22061
  },
@@ -21909,7 +22095,7 @@ var PlanCreditText = ({
21909
22095
  entitlements,
21910
22096
  children
21911
22097
  }) => {
21912
- const { t: t3 } = useTranslation();
22098
+ const { t: t3, locale } = useTranslation();
21913
22099
  const { settings } = useEmbed();
21914
22100
  const sources = entitlements ?? [];
21915
22101
  const { perLicenseGrants } = credit;
@@ -21917,7 +22103,7 @@ var PlanCreditText = ({
21917
22103
  return /* @__PURE__ */ jsxs26(Text, { children: [
21918
22104
  credit.quantity,
21919
22105
  " ",
21920
- getFeatureName(credit, credit.quantity),
22106
+ getFeatureName(credit, locale, credit.quantity),
21921
22107
  credit.period && /* @__PURE__ */ jsxs26(Fragment11, { children: [
21922
22108
  " ",
21923
22109
  t3("per"),
@@ -21929,18 +22115,18 @@ var PlanCreditText = ({
21929
22115
  }
21930
22116
  const resolveLicenseName = (grant) => {
21931
22117
  const licenseFeature = (findLicenseSource(sources, grant.licenseId) ?? (grant.licenseId ? void 0 : findSoleLicenseSource(sources)))?.feature;
21932
- return licenseFeature ? getFeatureName(licenseFeature, 1) : t3("license");
22118
+ return licenseFeature ? getFeatureName(licenseFeature, locale, 1) : t3("license");
21933
22119
  };
21934
22120
  return /* @__PURE__ */ jsxs26(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
21935
22121
  perLicenseGrants.map((grant, grantIndex) => /* @__PURE__ */ jsxs26(Text, { children: [
21936
22122
  credit.period ? t3("X credits per license per period", {
21937
22123
  amount: grant.amount,
21938
- creditName: getFeatureName(credit, grant.amount),
22124
+ creditName: getFeatureName(credit, locale, grant.amount),
21939
22125
  licenseName: resolveLicenseName(grant),
21940
22126
  period: t3(credit.period)
21941
22127
  }) : t3("X credits per license", {
21942
22128
  amount: grant.amount,
21943
- creditName: getFeatureName(credit, grant.amount),
22129
+ creditName: getFeatureName(credit, locale, grant.amount),
21944
22130
  licenseName: resolveLicenseName(grant)
21945
22131
  }),
21946
22132
  grantIndex === 0 && children
@@ -21953,7 +22139,7 @@ var PlanCreditText = ({
21953
22139
  $color: settings.theme.typography.text.color,
21954
22140
  children: t3("Plus X credits per period for your company", {
21955
22141
  amount: credit.fixedQuantity,
21956
- creditName: getFeatureName(credit, credit.fixedQuantity),
22142
+ creditName: getFeatureName(credit, locale, credit.fixedQuantity),
21957
22143
  period: t3(credit.period)
21958
22144
  })
21959
22145
  }
@@ -21962,10 +22148,10 @@ var PlanCreditText = ({
21962
22148
  };
21963
22149
 
21964
22150
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
21965
- import { useMemo as useMemo20 } from "react";
22151
+ import { useMemo as useMemo21 } from "react";
21966
22152
 
21967
22153
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
21968
- import { useMemo as useMemo19 } from "react";
22154
+ import { useMemo as useMemo20 } from "react";
21969
22155
  import { Fragment as Fragment12, jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
21970
22156
  var PriceText = ({
21971
22157
  feature,
@@ -21976,13 +22162,13 @@ var PriceText = ({
21976
22162
  }) => {
21977
22163
  const { settings } = useEmbed();
21978
22164
  const { t: t3, locale } = useTranslation();
21979
- const text = useMemo19(() => {
22165
+ const text = useMemo20(() => {
21980
22166
  if (!flatAmount && perUnitPrice) {
21981
22167
  return /* @__PURE__ */ jsxs27(Fragment12, { children: [
21982
22168
  formatCurrency(perUnitPrice, { locale, currency }),
21983
22169
  /* @__PURE__ */ jsxs27("sub", { children: [
21984
22170
  "/",
21985
- getFeatureName(feature, 1)
22171
+ getFeatureName(feature, locale, 1)
21986
22172
  ] })
21987
22173
  ] });
21988
22174
  }
@@ -21999,7 +22185,7 @@ var PriceText = ({
21999
22185
  formatCurrency(perUnitPrice, { locale, currency }),
22000
22186
  /* @__PURE__ */ jsxs27("sub", { children: [
22001
22187
  "/",
22002
- getFeatureName(feature, 1)
22188
+ getFeatureName(feature, locale, 1)
22003
22189
  ] }),
22004
22190
  " + ",
22005
22191
  formatCurrency(flatAmount, { locale, currency }),
@@ -22033,7 +22219,7 @@ var PricingTiersTooltip = ({
22033
22219
  const { t: t3 } = useTranslation();
22034
22220
  const { settings } = useEmbed();
22035
22221
  const isLightBackground = useIsLightBackground();
22036
- const { tiers } = useMemo20(() => {
22222
+ const { tiers } = useMemo21(() => {
22037
22223
  return priceTiers.reduce(
22038
22224
  (acc, tier) => {
22039
22225
  const end = tier.upTo ?? Infinity;
@@ -22060,7 +22246,7 @@ var PricingTiersTooltip = ({
22060
22246
  trigger: /* @__PURE__ */ jsx40(
22061
22247
  Icon3,
22062
22248
  {
22063
- title: "tiered pricing",
22249
+ title: t3("Tiered pricing"),
22064
22250
  name: "info-rounded",
22065
22251
  color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
22066
22252
  style: { lineHeight: 0 }
@@ -22131,7 +22317,7 @@ import {
22131
22317
  forwardRef as forwardRef7,
22132
22318
  useCallback as useCallback11,
22133
22319
  useLayoutEffect as useLayoutEffect6,
22134
- useMemo as useMemo21,
22320
+ useMemo as useMemo22,
22135
22321
  useRef as useRef9,
22136
22322
  useState as useState13
22137
22323
  } from "react";
@@ -22569,11 +22755,11 @@ var EntitlementRow = (props) => {
22569
22755
  /* @__PURE__ */ jsx42(Box, { children: /* @__PURE__ */ jsx42(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs30(Fragment14, { children: [
22570
22756
  quantity,
22571
22757
  " ",
22572
- getFeatureName(feature, quantity)
22758
+ getFeatureName(feature, locale, quantity)
22573
22759
  ] }) : priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number" ? /* @__PURE__ */ jsxs30(Fragment14, { children: [
22574
22760
  softLimit,
22575
22761
  " ",
22576
- getFeatureName(feature, softLimit)
22762
+ getFeatureName(feature, locale, softLimit)
22577
22763
  ] }) : feature.name }) }),
22578
22764
  /* @__PURE__ */ jsx42(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
22579
22765
  // A tiered scheme still resolves to a fixed amount at the chosen
@@ -22604,7 +22790,7 @@ var EntitlementRow = (props) => {
22604
22790
  packageSize,
22605
22791
  " "
22606
22792
  ] }),
22607
- getFeatureName(feature, packageSize),
22793
+ getFeatureName(feature, locale, packageSize),
22608
22794
  feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs30(Fragment14, { children: [
22609
22795
  "/",
22610
22796
  shortenPeriod(planPeriod, t3)
@@ -22733,7 +22919,7 @@ var SubscriptionSidebar = forwardRef7(
22733
22919
  billingSubscription,
22734
22920
  paymentMethod,
22735
22921
  trialPaymentMethodRequired
22736
- } = useMemo21(() => {
22922
+ } = useMemo22(() => {
22737
22923
  const currentEntitlements2 = data?.featureUsage?.features || [];
22738
22924
  return {
22739
22925
  currentPlan: data?.company?.plan,
@@ -22756,7 +22942,7 @@ var SubscriptionSidebar = forwardRef7(
22756
22942
  data?.subscription?.paymentMethod,
22757
22943
  data?.trialPaymentMethodRequired
22758
22944
  ]);
22759
- const planCreditGrants = useMemo21(() => {
22945
+ const planCreditGrants = useMemo22(() => {
22760
22946
  const grants = mergeCompanyGrants(
22761
22947
  selectedPlan?.includedCreditGrants,
22762
22948
  data?.company?.plan?.includedCreditGrants
@@ -22766,11 +22952,11 @@ var SubscriptionSidebar = forwardRef7(
22766
22952
  selectedPlan?.includedCreditGrants,
22767
22953
  data?.company?.plan?.includedCreditGrants
22768
22954
  ]);
22769
- const planCredits = useMemo21(
22955
+ const planCredits = useMemo22(
22770
22956
  () => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
22771
22957
  [selectedPlan?.includedCreditGrants]
22772
22958
  );
22773
- const { payInAdvanceEntitlements } = useMemo21(() => {
22959
+ const { payInAdvanceEntitlements } = useMemo22(() => {
22774
22960
  const payAsYouGoEntitlements = [];
22775
22961
  const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
22776
22962
  (entitlement) => {
@@ -22782,7 +22968,7 @@ var SubscriptionSidebar = forwardRef7(
22782
22968
  );
22783
22969
  return { payAsYouGoEntitlements, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
22784
22970
  }, [usageBasedEntitlements]);
22785
- const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = useMemo21(() => {
22971
+ const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = useMemo22(() => {
22786
22972
  let planPrice;
22787
22973
  let resolvedCurrency;
22788
22974
  if (selectedPlan) {
@@ -22853,7 +23039,7 @@ var SubscriptionSidebar = forwardRef7(
22853
23039
  proration,
22854
23040
  taxAmount,
22855
23041
  taxDescription
22856
- } = useMemo21(() => {
23042
+ } = useMemo22(() => {
22857
23043
  return {
22858
23044
  amountOff: charges?.amountOff ?? 0,
22859
23045
  discountAmount: charges?.discountAmount ?? 0,
@@ -22901,7 +23087,7 @@ var SubscriptionSidebar = forwardRef7(
22901
23087
  $color: settings.theme.typography.text.color,
22902
23088
  children: t3("Includes X credits per period", {
22903
23089
  total: includedCredits,
22904
- creditName: getFeatureName(credit, includedCredits),
23090
+ creditName: getFeatureName(credit, locale, includedCredits),
22905
23091
  period: shortenPeriod(credit.period, t3)
22906
23092
  })
22907
23093
  }
@@ -22923,7 +23109,7 @@ var SubscriptionSidebar = forwardRef7(
22923
23109
  }
22924
23110
  );
22925
23111
  };
22926
- const updatedUsageBasedEntitlements = useMemo21(() => {
23112
+ const updatedUsageBasedEntitlements = useMemo22(() => {
22927
23113
  const changedUsageBasedEntitlements = [];
22928
23114
  const allSelectedUsageBasedEntitlements = [
22929
23115
  ...usageBasedEntitlements,
@@ -22986,19 +23172,19 @@ var SubscriptionSidebar = forwardRef7(
22986
23172
  usageBasedEntitlements,
22987
23173
  addOnUsageBasedEntitlements
22988
23174
  ]);
22989
- const selectedAddOnsWithPrice = useMemo21(
23175
+ const selectedAddOnsWithPrice = useMemo22(
22990
23176
  () => addOns.filter(
22991
23177
  (addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
22992
23178
  ),
22993
23179
  [addOns, currency]
22994
23180
  );
22995
- const selectedOneTimeAddOns = useMemo21(
23181
+ const selectedOneTimeAddOns = useMemo22(
22996
23182
  () => addOns.filter(
22997
23183
  (addOn) => addOn.isSelected && addOn.chargeType === ChargeType.oneTime && getAddOnPrice(addOn, planPeriod, currency)?.price
22998
23184
  ),
22999
23185
  [addOns, planPeriod, currency]
23000
23186
  );
23001
- const { removedAddOns, willAddOnsChange } = useMemo21(() => {
23187
+ const { removedAddOns, willAddOnsChange } = useMemo22(() => {
23002
23188
  const addedAddOns = selectedAddOnsWithPrice.filter(
23003
23189
  (selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
23004
23190
  );
@@ -23014,15 +23200,15 @@ var SubscriptionSidebar = forwardRef7(
23014
23200
  willAddOnsChange: willAddOnsChange2
23015
23201
  };
23016
23202
  }, [currentAddOns, selectedAddOnsWithPrice, currency]);
23017
- const addedCreditBundles = useMemo21(
23203
+ const addedCreditBundles = useMemo22(
23018
23204
  () => creditBundles.filter((bundle) => bundle.count > 0),
23019
23205
  [creditBundles]
23020
23206
  );
23021
- const discountApplied = useMemo21(
23207
+ const discountApplied = useMemo22(
23022
23208
  () => promoCode && (amountOff > 0 || percentOff > 0),
23023
23209
  [promoCode, amountOff, percentOff]
23024
23210
  );
23025
- const subscriptionDiscount = useMemo21(
23211
+ const subscriptionDiscount = useMemo22(
23026
23212
  () => getSubscriptionDiscount(
23027
23213
  charges?.discounts,
23028
23214
  subscriptionTotal,
@@ -23182,7 +23368,7 @@ var SubscriptionSidebar = forwardRef7(
23182
23368
  }
23183
23369
  }, [t3, unsubscribe, setError, setIsLoading, setLayout]);
23184
23370
  const isSelectedPlanTrialable = selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
23185
- const button = useMemo21(() => {
23371
+ const button = useMemo22(() => {
23186
23372
  const hasEntitlementDowngrade = payInAdvanceEntitlements.some((e) => e.quantity < e.usage) || addOnPayInAdvanceEntitlements.some((e) => e.quantity < e.usage);
23187
23373
  const canCheckout = error !== t3("Downgrade not permitted.") && !hasEntitlementDowngrade;
23188
23374
  const isSticky = !isButtonInView;
@@ -23639,7 +23825,7 @@ var SubscriptionSidebar = forwardRef7(
23639
23825
  /* @__PURE__ */ jsx44(Box, { children: /* @__PURE__ */ jsxs32(Text, { children: [
23640
23826
  formatNumber(amount, { locale }),
23641
23827
  " ",
23642
- getFeatureName(bundle, amount),
23828
+ getFeatureName(bundle, locale, amount),
23643
23829
  expiry && ` \xB7 ${expiry}`
23644
23830
  ] }) })
23645
23831
  ] }),
@@ -23910,14 +24096,14 @@ var SubscriptionSidebar = forwardRef7(
23910
24096
  SubscriptionSidebar.displayName = "SubscriptionSidebar";
23911
24097
 
23912
24098
  // src/components/shared/tiered-pricing-details/TieredPricingDetails.tsx
23913
- import { useMemo as useMemo22 } from "react";
24099
+ import { useMemo as useMemo23 } from "react";
23914
24100
  var TieredPricingDetails = ({
23915
24101
  entitlement,
23916
24102
  period,
23917
24103
  currency: selectedCurrency
23918
24104
  }) => {
23919
24105
  const { t: t3, locale } = useTranslation();
23920
- const { currency, flatAmount, perUnitPrice, upTo } = useMemo22(() => {
24106
+ const { currency, flatAmount, perUnitPrice, upTo } = useMemo23(() => {
23921
24107
  const { currency: currency2, priceTier } = getEntitlementPrice(entitlement, period, selectedCurrency) || {};
23922
24108
  const { flatAmount: flatAmount2, perUnitPrice: perUnitPrice2, perUnitPriceDecimal, upTo: upTo2 } = priceTier?.[0] || {};
23923
24109
  return {
@@ -23933,21 +24119,21 @@ var TieredPricingDetails = ({
23933
24119
  if (flatAmount === 0 && perUnitPrice === 0) {
23934
24120
  return t3("Up to X units for free", {
23935
24121
  X: upTo,
23936
- units: getFeatureName(entitlement.feature, upTo)
24122
+ units: getFeatureName(entitlement.feature, locale, upTo)
23937
24123
  });
23938
24124
  }
23939
24125
  if (flatAmount === 0 && perUnitPrice > 0) {
23940
24126
  return t3("Up to X units at $Y/unit", {
23941
24127
  X: upTo,
23942
- units: getFeatureName(entitlement.feature, upTo),
24128
+ units: getFeatureName(entitlement.feature, locale, upTo),
23943
24129
  Y: formatCurrency(perUnitPrice, { locale, currency }),
23944
- unit: getFeatureName(entitlement.feature, 1)
24130
+ unit: getFeatureName(entitlement.feature, locale, 1)
23945
24131
  });
23946
24132
  }
23947
24133
  if (flatAmount > 0 && perUnitPrice === 0) {
23948
24134
  return t3("Up to X units for $Y/period", {
23949
24135
  X: upTo,
23950
- units: getFeatureName(entitlement.feature, upTo),
24136
+ units: getFeatureName(entitlement.feature, locale, upTo),
23951
24137
  Y: formatCurrency(flatAmount, { locale, currency }),
23952
24138
  period
23953
24139
  });
@@ -23955,9 +24141,9 @@ var TieredPricingDetails = ({
23955
24141
  if (flatAmount > 0 && perUnitPrice > 0) {
23956
24142
  return t3("Up to X units at $Y/unit + $Z/period", {
23957
24143
  X: upTo,
23958
- units: getFeatureName(entitlement.feature, upTo),
24144
+ units: getFeatureName(entitlement.feature, locale, upTo),
23959
24145
  Y: formatCurrency(perUnitPrice, { locale, currency }),
23960
- unit: getFeatureName(entitlement.feature, 1),
24146
+ unit: getFeatureName(entitlement.feature, locale, 1),
23961
24147
  Z: formatCurrency(flatAmount, { locale, currency }),
23962
24148
  period
23963
24149
  });
@@ -23965,7 +24151,7 @@ var TieredPricingDetails = ({
23965
24151
  };
23966
24152
 
23967
24153
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
23968
- import { useCallback as useCallback12, useLayoutEffect as useLayoutEffect7, useMemo as useMemo23, useRef as useRef10, useState as useState14 } from "react";
24154
+ import { useCallback as useCallback12, useLayoutEffect as useLayoutEffect7, useMemo as useMemo24, useRef as useRef10, useState as useState14 } from "react";
23969
24155
  import { jsx as jsx45, jsxs as jsxs33 } from "react/jsx-runtime";
23970
24156
  var UnsubscribeDialog = ({ top }) => {
23971
24157
  const { t: t3, locale } = useTranslation();
@@ -23982,8 +24168,9 @@ var UnsubscribeDialog = ({ top }) => {
23982
24168
  const [error, setError] = useState14();
23983
24169
  const [isLoading, setIsLoading] = useState14(false);
23984
24170
  const [isModal, setIsModal] = useState14(true);
23985
- const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo23(() => {
23986
- const cancelDate2 = data?.subscription?.cancelAt || data?.upcomingInvoice?.dueDate;
24171
+ const { billDate } = useNextBillDate();
24172
+ const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo24(() => {
24173
+ const cancelDate2 = data?.subscription?.cancelAt || billDate;
23987
24174
  return {
23988
24175
  planPeriod: getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month",
23989
24176
  currentPlan: data?.company?.plan,
@@ -23997,10 +24184,10 @@ var UnsubscribeDialog = ({ top }) => {
23997
24184
  data?.company?.plan,
23998
24185
  data?.featureUsage,
23999
24186
  data?.subscription?.cancelAt,
24000
- data?.upcomingInvoice?.dueDate
24187
+ billDate
24001
24188
  ]);
24002
24189
  const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
24003
- const selectedPlan = useMemo23(
24190
+ const selectedPlan = useMemo24(
24004
24191
  () => availablePlans.find((plan) => plan.id === currentPlan?.id),
24005
24192
  [currentPlan?.id, availablePlans]
24006
24193
  );
@@ -24009,7 +24196,7 @@ var UnsubscribeDialog = ({ top }) => {
24009
24196
  createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
24010
24197
  []
24011
24198
  );
24012
- const addOns = useMemo23(
24199
+ const addOns = useMemo24(
24013
24200
  () => availableAddOns.map((available) => ({
24014
24201
  ...available,
24015
24202
  isSelected: currentAddOns.some((current) => available.id === current.id) ?? false
@@ -24260,6 +24447,7 @@ var Badge = () => {
24260
24447
  // src/components/layout/RenderLayout.tsx
24261
24448
  import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
24262
24449
  var Disabled = () => {
24450
+ const { t: t3 } = useTranslation();
24263
24451
  return /* @__PURE__ */ jsx48(Box, { $width: "max-content", $height: "max-content", children: /* @__PURE__ */ jsx48(Card, { children: /* @__PURE__ */ jsxs35(
24264
24452
  Element,
24265
24453
  {
@@ -24269,8 +24457,8 @@ var Disabled = () => {
24269
24457
  $alignItems: "center",
24270
24458
  $whiteSpace: "nowrap",
24271
24459
  children: [
24272
- /* @__PURE__ */ jsx48(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx48(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
24273
- /* @__PURE__ */ jsx48(Text, { as: "p", children: "Please try again later." })
24460
+ /* @__PURE__ */ jsx48(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx48(Text, { as: "h1", display: "heading1", children: t3("Portal not found") }) }),
24461
+ /* @__PURE__ */ jsx48(Text, { as: "p", children: t3("Please try again later.") })
24274
24462
  ]
24275
24463
  }
24276
24464
  ) }) });
@@ -24399,10 +24587,10 @@ var ButtonElement = forwardRef9(({ children, className, ...rest }, ref) => {
24399
24587
  ButtonElement.displayName = "Button";
24400
24588
 
24401
24589
  // src/components/elements/included-features/IncludedFeatures.tsx
24402
- import { Fragment as Fragment19, forwardRef as forwardRef10, useMemo as useMemo25 } from "react";
24590
+ import { Fragment as Fragment19, forwardRef as forwardRef10, useMemo as useMemo26 } from "react";
24403
24591
 
24404
24592
  // src/components/elements/included-features/UsageDetails.tsx
24405
- import { Fragment as Fragment17, useMemo as useMemo24 } from "react";
24593
+ import { Fragment as Fragment17, useMemo as useMemo25 } from "react";
24406
24594
  import { Fragment as Fragment18, jsx as jsx51, jsxs as jsxs37 } from "react/jsx-runtime";
24407
24595
  var UsageDetails = ({ entitlement, layout }) => {
24408
24596
  const {
@@ -24430,7 +24618,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24430
24618
  currentTier,
24431
24619
  tiersMode,
24432
24620
  tiered
24433
- } = useMemo24(() => {
24621
+ } = useMemo25(() => {
24434
24622
  const { billingPrice, amount, limit: limit2, cost: cost2, currentTier: currentTier2 } = getUsageDetails(
24435
24623
  entitlement,
24436
24624
  period,
@@ -24457,19 +24645,19 @@ var UsageDetails = ({ entitlement, layout }) => {
24457
24645
  tiered: priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(billingPrice)
24458
24646
  };
24459
24647
  }, [entitlement, period, priceBehavior, showWarningThresholdAsLimit]);
24460
- const text = useMemo24(() => {
24648
+ const text = useMemo25(() => {
24461
24649
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24462
24650
  return;
24463
24651
  }
24464
24652
  if (priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof allocation === "number") {
24465
24653
  return t3("X units", {
24466
24654
  amount: formatNumber(allocation, { locale }),
24467
- units: getFeatureName(feature, allocation)
24655
+ units: getFeatureName(feature, locale, allocation)
24468
24656
  });
24469
24657
  }
24470
24658
  if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo && typeof price === "number") {
24471
24659
  const formattedCost = formatCurrency(price, { locale, currency });
24472
- const featureName = getFeatureName(feature, packageSize);
24660
+ const featureName = getFeatureName(feature, locale, packageSize);
24473
24661
  return packageSize > 1 ? t3("$X per Y units", {
24474
24662
  cost: formattedCost,
24475
24663
  size: packageSize,
@@ -24479,15 +24667,15 @@ var UsageDetails = ({ entitlement, layout }) => {
24479
24667
  if (priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number") {
24480
24668
  return t3("X units", {
24481
24669
  amount: formatNumber(softLimit, { locale }),
24482
- units: getFeatureName(feature, softLimit)
24670
+ units: getFeatureName(feature, locale, softLimit)
24483
24671
  });
24484
24672
  }
24485
24673
  if (priceBehavior === EntitlementPriceBehavior.Tier) {
24486
24674
  return typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t3("Unlimited in this tier", {
24487
- feature: getFeatureName(feature)
24675
+ feature: getFeatureName(feature, locale)
24488
24676
  }) : t3("Up to X units in this tier", {
24489
24677
  amount: formatNumber(currentTier.to, { locale }),
24490
- feature: getFeatureName(feature, currentTier.to)
24678
+ feature: getFeatureName(feature, locale, currentTier.to)
24491
24679
  }));
24492
24680
  }
24493
24681
  if (showCredits && priceBehavior === EntitlementPriceBehavior.CreditBurndown && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
@@ -24495,6 +24683,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24495
24683
  amount: formatConsumptionRate(planEntitlement.consumptionRate, locale),
24496
24684
  units: getFeatureName(
24497
24685
  planEntitlement.valueCredit,
24686
+ locale,
24498
24687
  planEntitlement.consumptionRate
24499
24688
  )
24500
24689
  });
@@ -24502,18 +24691,18 @@ var UsageDetails = ({ entitlement, layout }) => {
24502
24691
  if (priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof limit === "number") {
24503
24692
  return t3("X units remaining", {
24504
24693
  amount: formatNumber(limit, { locale }),
24505
- units: getFeatureName(feature, limit)
24694
+ units: getFeatureName(feature, locale, limit)
24506
24695
  });
24507
24696
  }
24508
24697
  if (!priceBehavior && typeof allocation === "number") {
24509
24698
  const numericLimit = limit ?? allocation;
24510
24699
  return t3("X units", {
24511
24700
  amount: formatNumber(numericLimit, { locale }),
24512
- units: getFeatureName(feature, numericLimit)
24701
+ units: getFeatureName(feature, locale, numericLimit)
24513
24702
  });
24514
24703
  }
24515
24704
  if (!priceBehavior && allocationType === "unlimited") {
24516
- return t3("Unlimited", { item: getFeatureName(feature) });
24705
+ return t3("Unlimited", { item: getFeatureName(feature, locale) });
24517
24706
  }
24518
24707
  }, [
24519
24708
  t3,
@@ -24531,7 +24720,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24531
24720
  currentTier,
24532
24721
  showCredits
24533
24722
  ]);
24534
- const usageText = useMemo24(() => {
24723
+ const usageText = useMemo25(() => {
24535
24724
  if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
24536
24725
  return;
24537
24726
  }
@@ -24542,11 +24731,11 @@ var UsageDetails = ({ entitlement, layout }) => {
24542
24731
  /* @__PURE__ */ jsx51(Fragment17, { children: packageSize > 1 ? t3("$X/Y units/period", {
24543
24732
  cost: formatCurrency(price, { locale, currency }),
24544
24733
  size: packageSize,
24545
- units: getFeatureName(feature, packageSize),
24734
+ units: getFeatureName(feature, locale, packageSize),
24546
24735
  period: shortenPeriod(period, t3)
24547
24736
  }) : t3("$X/unit/period", {
24548
24737
  cost: formatCurrency(price, { locale, currency }),
24549
- unit: getFeatureName(feature, packageSize),
24738
+ unit: getFeatureName(feature, locale, packageSize),
24550
24739
  period: shortenPeriod(period, t3)
24551
24740
  }) }, index)
24552
24741
  );
@@ -24555,7 +24744,7 @@ var UsageDetails = ({ entitlement, layout }) => {
24555
24744
  acc.push(
24556
24745
  /* @__PURE__ */ jsx51(Fragment17, { children: t3("X units used", {
24557
24746
  amount: usage,
24558
- units: getFeatureName(feature, usage)
24747
+ units: getFeatureName(feature, locale, usage)
24559
24748
  }) }, index)
24560
24749
  );
24561
24750
  index += 1;
@@ -24708,7 +24897,7 @@ var IncludedFeatures = forwardRef10(({ className, ...rest }, ref) => {
24708
24897
  const { t: t3, locale } = useTranslation();
24709
24898
  const { data, settings } = useEmbed();
24710
24899
  const isLightBackground = useIsLightBackground();
24711
- const { plan, addOns, featureUsage } = useMemo25(() => {
24900
+ const { plan, addOns, featureUsage } = useMemo26(() => {
24712
24901
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
24713
24902
  (acc, id) => {
24714
24903
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -24785,9 +24974,10 @@ var IncludedFeatures = forwardRef10(({ className, ...rest }, ref) => {
24785
24974
  singularName: grant.singularName,
24786
24975
  pluralName: grant.pluralName
24787
24976
  },
24977
+ locale,
24788
24978
  grant.creditAmount
24789
24979
  ),
24790
- licenseName: entitlement.feature ? getFeatureName(entitlement.feature, 1) : ""
24980
+ licenseName: entitlement.feature ? getFeatureName(entitlement.feature, locale, 1) : ""
24791
24981
  }) }, grantIndex)),
24792
24982
  props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ jsx52(
24793
24983
  Text,
@@ -24845,7 +25035,7 @@ var IncludedFeatures = forwardRef10(({ className, ...rest }, ref) => {
24845
25035
  IncludedFeatures.displayName = "IncludedFeatures";
24846
25036
 
24847
25037
  // src/components/elements/invoices/Invoices.tsx
24848
- import { forwardRef as forwardRef11, useCallback as useCallback13, useEffect as useEffect5, useMemo as useMemo26, useState as useState16 } from "react";
25038
+ import { forwardRef as forwardRef11, useCallback as useCallback13, useEffect as useEffect5, useMemo as useMemo27, useState as useState16 } from "react";
24849
25039
  import { Fragment as Fragment20, jsx as jsx53, jsxs as jsxs39 } from "react/jsx-runtime";
24850
25040
  function resolveDesignProps3(props) {
24851
25041
  return {
@@ -24913,11 +25103,11 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
24913
25103
  const [rawInvoices, setInvoices] = useState16(
24914
25104
  () => data && "invoices" in data ? data.invoices : rest.data
24915
25105
  );
24916
- const invoices = useMemo26(
25106
+ const invoices = useMemo27(
24917
25107
  () => formatInvoices(rawInvoices, locale),
24918
25108
  [rawInvoices, locale]
24919
25109
  );
24920
- const reachableInvoices = useMemo26(
25110
+ const reachableInvoices = useMemo27(
24921
25111
  () => invoices.slice(0, MAX_VISIBLE_INVOICE_COUNT),
24922
25112
  [invoices]
24923
25113
  );
@@ -25036,7 +25226,7 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
25036
25226
  Invoices.displayName = "Invoices";
25037
25227
 
25038
25228
  // src/components/elements/metered-features/MeteredFeatures.tsx
25039
- import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo28, useRef as useRef12, useState as useState18 } from "react";
25229
+ import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo29, useRef as useRef12, useState as useState18 } from "react";
25040
25230
 
25041
25231
  // src/components/elements/metered-features/Meter.tsx
25042
25232
  import { jsx as jsx54 } from "react/jsx-runtime";
@@ -25121,7 +25311,7 @@ var PriceDetails = ({
25121
25311
  packageSize,
25122
25312
  " "
25123
25313
  ] }),
25124
- getFeatureName(feature, packageSize),
25314
+ getFeatureName(feature, locale, packageSize),
25125
25315
  feature.featureType === FeatureType.Trait && period && /* @__PURE__ */ jsxs40(Fragment21, { children: [
25126
25316
  "/",
25127
25317
  shortenPeriod(period, t3)
@@ -25146,7 +25336,7 @@ var PriceDetails = ({
25146
25336
  typeof amount === "number" && /* @__PURE__ */ jsx55(Fragment21, { children: priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ jsxs40(Text, { children: [
25147
25337
  formatNumber(amount, { locale }),
25148
25338
  " ",
25149
- getFeatureName(feature, amount),
25339
+ getFeatureName(feature, locale, amount),
25150
25340
  " \xB7 ",
25151
25341
  formatCurrency(currentTierPerUnitPrice * amount, {
25152
25342
  locale,
@@ -25169,7 +25359,7 @@ var PriceDetails = ({
25169
25359
  };
25170
25360
 
25171
25361
  // src/components/elements/metered-features/UsageByUser.tsx
25172
- import { useEffect as useEffect6, useMemo as useMemo27, useState as useState17 } from "react";
25362
+ import { useEffect as useEffect6, useMemo as useMemo28, useState as useState17 } from "react";
25173
25363
  import { jsx as jsx56, jsxs as jsxs41 } from "react/jsx-runtime";
25174
25364
  var COLLAPSED_COUNT = 3;
25175
25365
  var EXPANDED_COUNT = 20;
@@ -25266,7 +25456,7 @@ var UsageByUser = ({ source, unit }) => {
25266
25456
  sourceKey
25267
25457
  ]);
25268
25458
  const entries = current?.section?.entries;
25269
- const attributed = useMemo27(
25459
+ const attributed = useMemo28(
25270
25460
  () => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
25271
25461
  [entries]
25272
25462
  );
@@ -25274,7 +25464,7 @@ var UsageByUser = ({ source, unit }) => {
25274
25464
  const total = current?.section?.total ?? 0;
25275
25465
  const totalUsers = current?.section?.totalUsers ?? 0;
25276
25466
  const unattributed = current?.section?.unattributed;
25277
- const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, amount)}`;
25467
+ const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, locale, amount)}`;
25278
25468
  if (error) {
25279
25469
  return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
25280
25470
  /* @__PURE__ */ jsx56(Text, { display: "heading4", children: t3("Usage by user") }),
@@ -25379,10 +25569,10 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25379
25569
  const acc = [];
25380
25570
  acc.push(
25381
25571
  priceBehavior === EntitlementPriceBehavior.Tier && typeof currentTier?.to === "number" && typeof feature !== "undefined" ? currentTier?.to === Infinity ? t3("Unlimited in this tier", {
25382
- feature: getFeatureName(feature)
25572
+ feature: getFeatureName(feature, locale)
25383
25573
  }) : t3("Up to X units in this tier", {
25384
25574
  amount: currentTier.to,
25385
- feature: getFeatureName(feature)
25575
+ feature: getFeatureName(feature, locale)
25386
25576
  }) : priceBehavior === EntitlementPriceBehavior.Overage && typeof limit === "number" ? t3("X included", {
25387
25577
  amount: formatNumber(limit, { locale })
25388
25578
  }) : 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", {
@@ -25392,11 +25582,12 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25392
25582
  ),
25393
25583
  units: getFeatureName(
25394
25584
  planEntitlement.valueCredit,
25585
+ locale,
25395
25586
  planEntitlement.consumptionRate
25396
25587
  )
25397
25588
  }) : priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof feature !== "undefined" && typeof limit === "number" ? t3("X units remaining", {
25398
25589
  amount: formatNumber(limit, { locale }),
25399
- units: getFeatureName(feature, limit)
25590
+ units: getFeatureName(feature, locale, limit)
25400
25591
  }) : typeof limit === "number" ? t3("Limit of", {
25401
25592
  amount: formatNumber(limit, { locale })
25402
25593
  }) : t3("No limit")
@@ -25459,7 +25650,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25459
25650
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
25460
25651
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
25461
25652
  const isLightBackground = useIsLightBackground();
25462
- const meteredFeatures = useMemo28(() => {
25653
+ const { billDate: renewalDate } = useNextBillDate();
25654
+ const meteredFeatures = useMemo29(() => {
25463
25655
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
25464
25656
  (acc, id) => {
25465
25657
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -25476,7 +25668,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25476
25668
  ({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
25477
25669
  );
25478
25670
  }, [props.visibleFeatures, data?.featureUsage?.features]);
25479
- const creditGroups = useMemo28(
25671
+ const creditGroups = useMemo29(
25480
25672
  () => withEmptyPlanCreditBalances(
25481
25673
  aggregateActiveGrantsByCredit(data?.creditGrants || []),
25482
25674
  listPlanCredits(
@@ -25487,7 +25679,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25487
25679
  ),
25488
25680
  [data?.creditGrants, data?.featureUsage?.features, data?.company]
25489
25681
  );
25490
- const planCreditCompositions = useMemo28(
25682
+ const planCreditCompositions = useMemo29(
25491
25683
  () => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
25492
25684
  [data?.company?.plan?.includedCreditGrants]
25493
25685
  );
@@ -25501,7 +25693,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25501
25693
  },
25502
25694
  [data?.featureUsage?.features]
25503
25695
  );
25504
- const purchasableCreditIds = useMemo28(
25696
+ const purchasableCreditIds = useMemo29(
25505
25697
  () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
25506
25698
  [data?.creditBundles, data?.company?.plan?.id]
25507
25699
  );
@@ -25598,11 +25790,11 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25598
25790
  formatNumber(limit, { locale }),
25599
25791
  " "
25600
25792
  ] }),
25601
- getFeatureName(feature, limit)
25793
+ getFeatureName(feature, locale, limit)
25602
25794
  ] }) : typeof usage === "number" && /* @__PURE__ */ jsxs42(Fragment22, { children: [
25603
25795
  formatNumber(usage, { locale }),
25604
25796
  " ",
25605
- getFeatureName(feature, usage),
25797
+ getFeatureName(feature, locale, usage),
25606
25798
  " ",
25607
25799
  t3("used")
25608
25800
  ] }) }) }),
@@ -25691,6 +25883,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25691
25883
  }),
25692
25884
  units: getFeatureName(
25693
25885
  credit,
25886
+ locale,
25694
25887
  credit.total.remaining
25695
25888
  )
25696
25889
  }) }) }),
@@ -25732,6 +25925,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25732
25925
  quantity: licenseQuantity,
25733
25926
  licenseName: getFeatureName(
25734
25927
  licenseFeature,
25928
+ locale,
25735
25929
  licenseQuantity
25736
25930
  ),
25737
25931
  perUnit: perLicenseGrant.amount
@@ -25744,7 +25938,6 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25744
25938
  })
25745
25939
  );
25746
25940
  }
25747
- const renewalDate = data?.upcomingInvoice?.dueDate;
25748
25941
  return (
25749
25942
  // Pulled up against the balance line despite the column's 2rem gap
25750
25943
  /* @__PURE__ */ jsx57(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ jsxs42(
@@ -25756,7 +25949,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25756
25949
  children: [
25757
25950
  t3("Your plan includes credits", {
25758
25951
  total,
25759
- creditName: getFeatureName(credit, total),
25952
+ creditName: getFeatureName(credit, locale, total),
25760
25953
  period: shortenPeriod(composition.period, t3),
25761
25954
  composition: ` \u2014 ${parts.join(" + ")}`
25762
25955
  }),
@@ -25791,6 +25984,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25791
25984
  amount: grant.quantity,
25792
25985
  item: getFeatureName(
25793
25986
  credit,
25987
+ locale,
25794
25988
  grant.quantity
25795
25989
  )
25796
25990
  }) }) }),
@@ -25812,7 +26006,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25812
26006
  ] }) : /* @__PURE__ */ jsxs42(Fragment22, { children: [
25813
26007
  /* @__PURE__ */ jsx57(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx57(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ jsx57(Fragment22, { children: t3("X item bundle", {
25814
26008
  amount: grant.quantity,
25815
- item: getFeatureName(credit, 1),
26009
+ item: getFeatureName(credit, locale, 1),
25816
26010
  createdAt: toPrettyDate(
25817
26011
  grant.createdAt,
25818
26012
  { locale, month: "short" }
@@ -25821,6 +26015,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25821
26015
  amount: grant.quantity,
25822
26016
  item: getFeatureName(
25823
26017
  credit,
26018
+ locale,
25824
26019
  grant.quantity
25825
26020
  ),
25826
26021
  createdAt: toPrettyDate(
@@ -25831,6 +26026,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25831
26026
  amount: grant.quantity,
25832
26027
  item: getFeatureName(
25833
26028
  credit,
26029
+ locale,
25834
26030
  grant.quantity
25835
26031
  ),
25836
26032
  createdAt: toPrettyDate(
@@ -25902,10 +26098,10 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25902
26098
  MeteredFeatures.displayName = "MeteredFeatures";
25903
26099
 
25904
26100
  // src/components/elements/payment-method/PaymentMethod.tsx
25905
- import { forwardRef as forwardRef13, useMemo as useMemo30 } from "react";
26101
+ import { forwardRef as forwardRef13, useMemo as useMemo31 } from "react";
25906
26102
 
25907
26103
  // src/components/elements/payment-method/PaymentMethodElement.tsx
25908
- import { useMemo as useMemo29 } from "react";
26104
+ import { useMemo as useMemo30 } from "react";
25909
26105
  import { jsx as jsx58, jsxs as jsxs43 } from "react/jsx-runtime";
25910
26106
  var PaymentElement2 = ({
25911
26107
  iconName,
@@ -26081,7 +26277,7 @@ var PaymentListElement = ({
26081
26277
  const { settings } = useEmbed();
26082
26278
  const isLightBackground = useIsLightBackground();
26083
26279
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
26084
- const expirationDate = useMemo29(() => {
26280
+ const expirationDate = useMemo30(() => {
26085
26281
  const { cardExpMonth, cardExpYear } = paymentMethod;
26086
26282
  if (!cardExpMonth || !cardExpYear) {
26087
26283
  return;
@@ -26176,7 +26372,7 @@ var resolveDesignProps5 = (props) => {
26176
26372
  var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26177
26373
  const props = resolveDesignProps5(rest);
26178
26374
  const { data, setLayout } = useEmbed();
26179
- const { paymentMethod, monthsToExpiration } = useMemo30(() => {
26375
+ const { paymentMethod, monthsToExpiration } = useMemo31(() => {
26180
26376
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
26181
26377
  let monthsToExpiration2;
26182
26378
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -26380,7 +26576,7 @@ var loadStripe = function loadStripe2() {
26380
26576
  };
26381
26577
 
26382
26578
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
26383
- import { useCallback as useCallback15, useEffect as useEffect7, useMemo as useMemo31, useState as useState19 } from "react";
26579
+ import { useCallback as useCallback15, useEffect as useEffect7, useMemo as useMemo32, useState as useState19 } from "react";
26384
26580
  import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
26385
26581
  var resolveDesignProps6 = () => {
26386
26582
  return {
@@ -26409,7 +26605,7 @@ var PaymentMethodDetails = ({
26409
26605
  updatePaymentMethod,
26410
26606
  deletePaymentMethod
26411
26607
  } = useEmbed();
26412
- const { defaultPaymentMethod, paymentMethods, subscription } = useMemo31(() => {
26608
+ const { defaultPaymentMethod, paymentMethods, subscription } = useMemo32(() => {
26413
26609
  return {
26414
26610
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
26415
26611
  paymentMethods: data?.company?.paymentMethods || [],
@@ -26441,7 +26637,7 @@ var PaymentMethodDetails = ({
26441
26637
  },
26442
26638
  autoConfirm: true
26443
26639
  });
26444
- const monthsToExpiration = useMemo31(() => {
26640
+ const monthsToExpiration = useMemo32(() => {
26445
26641
  let expiration;
26446
26642
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
26447
26643
  const now = /* @__PURE__ */ new Date();
@@ -26464,7 +26660,7 @@ var PaymentMethodDetails = ({
26464
26660
  const toggleShowPaymentMethods = () => {
26465
26661
  setShowDifferentPaymentMethods((prev2) => !prev2);
26466
26662
  };
26467
- const locale = useMemo31(() => stripeLocale(language), [language]);
26663
+ const locale = useMemo32(() => stripeLocale(language), [language]);
26468
26664
  const initializeStripe = useCallback15(() => {
26469
26665
  if (stripe || !setupIntent) {
26470
26666
  return;
@@ -26724,7 +26920,7 @@ var PaymentMethodDetails = ({
26724
26920
  };
26725
26921
 
26726
26922
  // src/components/elements/plan-manager/PlanManager.tsx
26727
- import { forwardRef as forwardRef14, useMemo as useMemo33 } from "react";
26923
+ import { forwardRef as forwardRef14, useMemo as useMemo34 } from "react";
26728
26924
 
26729
26925
  // src/components/elements/plan-manager/AddOn.tsx
26730
26926
  import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -26750,7 +26946,7 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26750
26946
  };
26751
26947
 
26752
26948
  // src/components/elements/plan-manager/UsageDetails.tsx
26753
- import { Fragment as Fragment23, useMemo as useMemo32 } from "react";
26949
+ import { Fragment as Fragment23, useMemo as useMemo33 } from "react";
26754
26950
  import { Fragment as Fragment24, jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
26755
26951
  var UsageDetails2 = ({
26756
26952
  entitlement,
@@ -26766,13 +26962,13 @@ var UsageDetails2 = ({
26766
26962
  billingPrice,
26767
26963
  limit,
26768
26964
  cost = 0
26769
- } = useMemo32(
26965
+ } = useMemo33(
26770
26966
  () => getUsageDetails(entitlement, period, currency, {
26771
26967
  showWarningThresholdAsLimit
26772
26968
  }),
26773
26969
  [entitlement, period, currency, showWarningThresholdAsLimit]
26774
26970
  );
26775
- const description = useMemo32(() => {
26971
+ const description = useMemo33(() => {
26776
26972
  const acc = [];
26777
26973
  let index = 0;
26778
26974
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
@@ -26798,7 +26994,7 @@ var UsageDetails2 = ({
26798
26994
  packageSize,
26799
26995
  " "
26800
26996
  ] }),
26801
- getFeatureName(entitlement.feature, packageSize),
26997
+ getFeatureName(entitlement.feature, locale, packageSize),
26802
26998
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46(Fragment24, { children: [
26803
26999
  "/",
26804
27000
  shortenPeriod(period, t3)
@@ -26818,6 +27014,7 @@ var UsageDetails2 = ({
26818
27014
  " ",
26819
27015
  getFeatureName(
26820
27016
  entitlement.planEntitlement.valueCredit,
27017
+ locale,
26821
27018
  entitlement.planEntitlement.consumptionRate
26822
27019
  ),
26823
27020
  " ",
@@ -26853,7 +27050,7 @@ var UsageDetails2 = ({
26853
27050
  /* @__PURE__ */ jsx62(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ jsxs46(Fragment24, { children: [
26854
27051
  quantity,
26855
27052
  " ",
26856
- getFeatureName(entitlement.feature, quantity, true)
27053
+ getFeatureName(entitlement.feature, locale, quantity, true)
26857
27054
  ] }) : entitlement.feature.name }),
26858
27055
  /* @__PURE__ */ jsxs46(Text, { children: [
26859
27056
  description.length > 0 && /* @__PURE__ */ jsx62(
@@ -26950,7 +27147,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26950
27147
  showCredits,
26951
27148
  showZeroPriceAsFree,
26952
27149
  trialPaymentMethodRequired
26953
- } = useMemo33(() => {
27150
+ } = useMemo34(() => {
26954
27151
  const planCreditOrder = /* @__PURE__ */ new Map();
26955
27152
  (data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
26956
27153
  if (!planCreditOrder.has(grant.creditId)) {
@@ -27010,15 +27207,15 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27010
27207
  data?.displaySettings?.showZeroPriceAsFree,
27011
27208
  data?.trialPaymentMethodRequired
27012
27209
  ]);
27013
- const usageBasedEntitlements = useMemo33(
27210
+ const usageBasedEntitlements = useMemo34(
27014
27211
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
27015
27212
  [featureUsage]
27016
27213
  );
27017
- const planCreditCompositions = useMemo33(
27214
+ const planCreditCompositions = useMemo34(
27018
27215
  () => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
27019
27216
  [currentPlan?.includedCreditGrants]
27020
27217
  );
27021
- const resolveLicenseQuantity = useMemo33(() => {
27218
+ const resolveLicenseQuantity = useMemo34(() => {
27022
27219
  return (licenseId) => {
27023
27220
  const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
27024
27221
  return typeof allocation === "number" ? allocation : void 0;
@@ -27041,7 +27238,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27041
27238
  subscriptionCurrency,
27042
27239
  willSubscriptionCancel,
27043
27240
  isTrialSubscription
27044
- } = useMemo33(() => {
27241
+ } = useMemo34(() => {
27045
27242
  const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
27046
27243
  const subscriptionCurrency2 = billingSubscription?.currency;
27047
27244
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -27054,7 +27251,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27054
27251
  };
27055
27252
  }, [billingSubscription]);
27056
27253
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
27057
- const { isFreePlan, isUsageBasedPlan } = useMemo33(() => {
27254
+ const { isFreePlan, isUsageBasedPlan } = useMemo34(() => {
27058
27255
  const isFreePlan2 = currentPlan?.planPrice === 0;
27059
27256
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
27060
27257
  return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
@@ -27314,9 +27511,14 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27314
27511
  amount: perLicenseGrant.amount,
27315
27512
  creditName: getFeatureName(
27316
27513
  group,
27514
+ locale,
27317
27515
  perLicenseGrant.amount
27318
27516
  ),
27319
- licenseName: getFeatureName(licenseFeature, 1)
27517
+ licenseName: getFeatureName(
27518
+ licenseFeature,
27519
+ locale,
27520
+ 1
27521
+ )
27320
27522
  }),
27321
27523
  composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs47(Fragment25, { children: [
27322
27524
  " ",
@@ -27324,6 +27526,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27324
27526
  amount: composition.fixedQuantity,
27325
27527
  creditName: getFeatureName(
27326
27528
  group,
27529
+ locale,
27327
27530
  composition.fixedQuantity
27328
27531
  ),
27329
27532
  period: t3(
@@ -27334,7 +27537,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27334
27537
  ] }) : /* @__PURE__ */ jsxs47(Fragment25, { children: [
27335
27538
  group.total.value,
27336
27539
  " ",
27337
- getFeatureName(group, group.total.value),
27540
+ getFeatureName(group, locale, group.total.value),
27338
27541
  " ",
27339
27542
  subscriptionInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
27340
27543
  t3("per"),
@@ -27377,6 +27580,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27377
27580
  quantity: licenseQuantity,
27378
27581
  licenseName: getFeatureName(
27379
27582
  licenseFeature,
27583
+ locale,
27380
27584
  licenseQuantity
27381
27585
  ),
27382
27586
  perUnit: perLicenseGrant.amount,
@@ -27384,6 +27588,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27384
27588
  total: resolvedTotal,
27385
27589
  creditName: getFeatureName(
27386
27590
  group,
27591
+ locale,
27387
27592
  resolvedTotal
27388
27593
  ),
27389
27594
  period: shortenPeriod(creditPeriod, t3)
@@ -27391,12 +27596,14 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27391
27596
  quantity: licenseQuantity,
27392
27597
  licenseName: getFeatureName(
27393
27598
  licenseFeature,
27599
+ locale,
27394
27600
  licenseQuantity
27395
27601
  ),
27396
27602
  perUnit: perLicenseGrant.amount,
27397
27603
  total: resolvedTotal,
27398
27604
  creditName: getFeatureName(
27399
27605
  group,
27606
+ locale,
27400
27607
  resolvedTotal
27401
27608
  ),
27402
27609
  period: shortenPeriod(creditPeriod, t3)
@@ -27438,7 +27645,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27438
27645
  if (!autoTopupEnabled) {
27439
27646
  acc.push(
27440
27647
  /* @__PURE__ */ jsx63(Text, { $leading: "tight", children: t3("Auto top-up disabled for token", {
27441
- unit: getFeatureName(grant.credit, 1)
27648
+ unit: getFeatureName(grant.credit, locale, 1)
27442
27649
  }) }, grant.id)
27443
27650
  );
27444
27651
  return acc;
@@ -27450,6 +27657,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27450
27657
  /* @__PURE__ */ jsx63(Text, { $leading: "tight", children: t3("Adds X tokens when Y remaining in balance", {
27451
27658
  unit: getFeatureName(
27452
27659
  grant.credit,
27660
+ locale,
27453
27661
  autoTopupAmount
27454
27662
  ),
27455
27663
  amount: autoTopupAmount,
@@ -27509,7 +27717,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27509
27717
  " (",
27510
27718
  group.quantity,
27511
27719
  " ",
27512
- getFeatureName(group, group.quantity),
27720
+ getFeatureName(group, locale, group.quantity),
27513
27721
  ")"
27514
27722
  ] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
27515
27723
  group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
@@ -27520,7 +27728,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27520
27728
  ] }),
27521
27729
  group.quantity,
27522
27730
  " ",
27523
- getFeatureName(group, group.quantity)
27731
+ getFeatureName(group, locale, group.quantity)
27524
27732
  ] }),
27525
27733
  group.total.used > 0 && /* @__PURE__ */ jsxs47(
27526
27734
  Text,
@@ -27580,12 +27788,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27580
27788
  " (",
27581
27789
  group.quantity,
27582
27790
  " ",
27583
- getFeatureName(group, group.quantity),
27791
+ getFeatureName(group, locale, group.quantity),
27584
27792
  ")"
27585
27793
  ] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
27586
27794
  group.quantity,
27587
27795
  " ",
27588
- getFeatureName(group, group.quantity)
27796
+ getFeatureName(group, locale, group.quantity)
27589
27797
  ] }),
27590
27798
  group.total.used > 0 && /* @__PURE__ */ jsxs47(
27591
27799
  Text,
@@ -27636,7 +27844,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27636
27844
  /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
27637
27845
  group.quantity,
27638
27846
  " ",
27639
- getFeatureName(group, group.quantity)
27847
+ getFeatureName(group, locale, group.quantity)
27640
27848
  ] }),
27641
27849
  group.total.used > 0 && /* @__PURE__ */ jsxs47(
27642
27850
  Text,
@@ -27692,12 +27900,12 @@ import {
27692
27900
  forwardRef as forwardRef15,
27693
27901
  useCallback as useCallback16,
27694
27902
  useEffect as useEffect8,
27695
- useMemo as useMemo35,
27903
+ useMemo as useMemo36,
27696
27904
  useState as useState21
27697
27905
  } from "react";
27698
27906
 
27699
27907
  // src/components/elements/pricing-table/AddOn.tsx
27700
- import { useMemo as useMemo34 } from "react";
27908
+ import { useMemo as useMemo35 } from "react";
27701
27909
  import { Fragment as Fragment26, jsx as jsx64, jsxs as jsxs48 } from "react/jsx-runtime";
27702
27910
  function renderMeteredEntitlementPricing2({
27703
27911
  priceBehavior,
@@ -27716,6 +27924,7 @@ function renderMeteredEntitlementPricing2({
27716
27924
  "/",
27717
27925
  feature ? getFeatureName(
27718
27926
  feature,
27927
+ locale,
27719
27928
  packageSize
27720
27929
  ) : featureName || "unit"
27721
27930
  ] });
@@ -27733,6 +27942,7 @@ function renderMeteredEntitlementPricing2({
27733
27942
  ] }),
27734
27943
  feature ? getFeatureName(
27735
27944
  feature,
27945
+ locale,
27736
27946
  packageSize
27737
27947
  ) : featureName || "unit"
27738
27948
  ] });
@@ -27753,7 +27963,7 @@ var AddOn2 = ({
27753
27963
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
27754
27964
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
27755
27965
  const isLightBackground = useIsLightBackground();
27756
- const { currentAddOns, canCheckout, isStandalone } = useMemo34(() => {
27966
+ const { currentAddOns, canCheckout, isStandalone } = useMemo35(() => {
27757
27967
  const isStandalone2 = typeof data?.component === "undefined";
27758
27968
  return {
27759
27969
  currentAddOns: data?.company?.addOns || [],
@@ -27922,7 +28132,7 @@ var AddOn2 = ({
27922
28132
  {
27923
28133
  $flexDirection: "column",
27924
28134
  $justifyContent: "center",
27925
- children: /* @__PURE__ */ jsx64(Text, { children: getFeatureName(entitlement.feature) })
28135
+ children: /* @__PURE__ */ jsx64(Text, { children: getFeatureName(entitlement.feature, locale) })
27926
28136
  }
27927
28137
  )
27928
28138
  ] }),
@@ -28084,7 +28294,11 @@ var Entitlement2 = ({
28084
28294
  formatNumber(entitlementPackageSize, { locale }),
28085
28295
  " "
28086
28296
  ] }),
28087
- getFeatureName(entitlement.feature, entitlementPackageSize),
28297
+ getFeatureName(
28298
+ entitlement.feature,
28299
+ locale,
28300
+ entitlementPackageSize
28301
+ ),
28088
28302
  entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs49(Fragment27, { children: [
28089
28303
  " ",
28090
28304
  t3("per"),
@@ -28102,12 +28316,13 @@ var Entitlement2 = ({
28102
28316
  " ",
28103
28317
  getFeatureName(
28104
28318
  entitlement.valueCredit,
28319
+ locale,
28105
28320
  entitlement.consumptionRate
28106
28321
  ),
28107
28322
  " ",
28108
28323
  t3("per"),
28109
28324
  " ",
28110
- getFeatureName(entitlement.feature, 1)
28325
+ getFeatureName(entitlement.feature, locale, 1)
28111
28326
  ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx65(Fragment27, { children: creditBasedEntitlementLimit?.period ? t3("Up to X units per period", {
28112
28327
  amount: formatNumber(
28113
28328
  creditBasedEntitlementLimit.limit,
@@ -28115,9 +28330,12 @@ var Entitlement2 = ({
28115
28330
  ),
28116
28331
  units: getFeatureName(
28117
28332
  entitlement.feature,
28333
+ locale,
28118
28334
  creditBasedEntitlementLimit.limit
28119
28335
  ),
28120
- period: creditBasedEntitlementLimit.period
28336
+ period: t3(
28337
+ creditBasedEntitlementLimit.period
28338
+ )
28121
28339
  }) : t3("Up to X units", {
28122
28340
  amount: formatNumber(
28123
28341
  creditBasedEntitlementLimit.limit,
@@ -28125,17 +28343,18 @@ var Entitlement2 = ({
28125
28343
  ),
28126
28344
  units: getFeatureName(
28127
28345
  entitlement.feature,
28346
+ locale,
28128
28347
  creditBasedEntitlementLimit.limit
28129
28348
  )
28130
28349
  }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ jsxs49(Fragment27, { children: [
28131
28350
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
28132
- item: getFeatureName(entitlement.feature)
28351
+ item: getFeatureName(entitlement.feature, locale)
28133
28352
  }) : /* @__PURE__ */ jsxs49(Fragment27, { children: [
28134
28353
  typeof limit === "number" && /* @__PURE__ */ jsxs49(Fragment27, { children: [
28135
28354
  formatNumber(limit, { locale }),
28136
28355
  " "
28137
28356
  ] }),
28138
- getFeatureName(entitlement.feature, limit)
28357
+ getFeatureName(entitlement.feature, locale, limit)
28139
28358
  ] }),
28140
28359
  metricPeriodName && /* @__PURE__ */ jsxs49(Fragment27, { children: [
28141
28360
  " ",
@@ -28164,6 +28383,7 @@ var Entitlement2 = ({
28164
28383
  ] }),
28165
28384
  getFeatureName(
28166
28385
  entitlement.feature,
28386
+ locale,
28167
28387
  entitlementPackageSize
28168
28388
  ),
28169
28389
  entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs49(Fragment27, { children: [
@@ -28617,13 +28837,13 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28617
28837
  } = useAvailablePlans(selectedPeriod, {
28618
28838
  useSelectedPeriod: showPeriodToggle
28619
28839
  });
28620
- const plans = useMemo35(
28840
+ const plans = useMemo36(
28621
28841
  () => hasCurrency ? allPlans.filter(
28622
28842
  (plan) => planSupportsCurrency(plan, selectedCurrency)
28623
28843
  ) : allPlans,
28624
28844
  [allPlans, hasCurrency, selectedCurrency]
28625
28845
  );
28626
- const addOns = useMemo35(
28846
+ const addOns = useMemo36(
28627
28847
  () => hasCurrency ? allAddOns.filter(
28628
28848
  (addOn) => planSupportsCurrency(addOn, selectedCurrency)
28629
28849
  ) : allAddOns,
@@ -28643,7 +28863,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28643
28863
  $alignItems: "center",
28644
28864
  $justifyContent: "center",
28645
28865
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
28646
- children: /* @__PURE__ */ jsx67(Loader, { "aria-label": "loading", $size: "2xl" })
28866
+ children: /* @__PURE__ */ jsx67(Loader, { "aria-label": t3("Loading"), $size: "2xl" })
28647
28867
  }
28648
28868
  );
28649
28869
  }
@@ -28836,7 +29056,7 @@ var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
28836
29056
  TextElement.displayName = "Text";
28837
29057
 
28838
29058
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
28839
- import { forwardRef as forwardRef17, useMemo as useMemo36 } from "react";
29059
+ import { forwardRef as forwardRef17, useMemo as useMemo37 } from "react";
28840
29060
  import { jsx as jsx69 } from "react/jsx-runtime";
28841
29061
  var buttonStyles = {
28842
29062
  primary: {
@@ -28867,7 +29087,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
28867
29087
  const props = resolveDesignProps10(rest);
28868
29088
  const { t: t3 } = useTranslation();
28869
29089
  const { data, setLayout } = useEmbed();
28870
- const hasActiveSubscription = useMemo36(() => {
29090
+ const hasActiveSubscription = useMemo37(() => {
28871
29091
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
28872
29092
  }, [data?.subscription]);
28873
29093
  if (!hasActiveSubscription) {
@@ -28902,7 +29122,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
28902
29122
  UnsubscribeButton.displayName = "UnsubscribeButton";
28903
29123
 
28904
29124
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
28905
- import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect9, useMemo as useMemo37, useState as useState22 } from "react";
29125
+ import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect9, useMemo as useMemo38, useState as useState22 } from "react";
28906
29126
  import { jsx as jsx70, jsxs as jsxs52 } from "react/jsx-runtime";
28907
29127
  function resolveDesignProps11(props) {
28908
29128
  return {
@@ -28930,7 +29150,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28930
29150
  const [isLoading, setIsLoading] = useState22(false);
28931
29151
  const [error, setError] = useState22();
28932
29152
  const [upcomingInvoice, setUpcomingInvoice] = useState22(data?.upcomingInvoice);
28933
- const discounts = useMemo37(() => {
29153
+ const discounts = useMemo38(() => {
28934
29154
  return (data?.subscription?.discounts || []).filter(
28935
29155
  (discount) => (
28936
29156
  // Only surface discounts that are currently active and actually
@@ -28972,7 +29192,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28972
29192
  setUpcomingInvoice(data.upcomingInvoice);
28973
29193
  }
28974
29194
  }, [data?.upcomingInvoice]);
28975
- const { currency, applied, remaining } = useMemo37(() => {
29195
+ const { currency, applied, remaining } = useMemo38(() => {
28976
29196
  const currency2 = upcomingInvoice?.currency;
28977
29197
  const startingBalance = upcomingInvoice?.startingBalance ?? 0;
28978
29198
  const endingBalance = upcomingInvoice?.endingBalance ?? 0;
@@ -28986,6 +29206,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28986
29206
  upcomingInvoice?.endingBalance,
28987
29207
  upcomingInvoice?.subtotal
28988
29208
  ]);
29209
+ const { billDate, paymentDueDate } = useNextBillDate(upcomingInvoice ?? null);
28989
29210
  const hasApplied = applied > 0;
28990
29211
  const hasBalance = remaining > 0 || applied > 0;
28991
29212
  if (!data?.subscription || data.subscription.cancelAt) {
@@ -29017,10 +29238,21 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
29017
29238
  ]
29018
29239
  }
29019
29240
  ) : !isLoading && /* @__PURE__ */ jsx70(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "1rem", children: [
29020
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs52(Text, { display: props.header.fontStyle, children: [
29021
- t3(props.header.prefix),
29022
- " ",
29023
- toPrettyDate(upcomingInvoice.dueDate, { locale })
29241
+ props.header.isVisible && upcomingInvoice.dueDate && billDate && /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
29242
+ /* @__PURE__ */ jsxs52(Text, { display: props.header.fontStyle, children: [
29243
+ t3(props.header.prefix),
29244
+ " ",
29245
+ toPrettyDate(billDate, { locale })
29246
+ ] }),
29247
+ paymentDueDate && /* @__PURE__ */ jsx70(
29248
+ Text,
29249
+ {
29250
+ $size: 0.8125 * settings.theme.typography.text.fontSize,
29251
+ children: t3("Payment due", {
29252
+ date: toPrettyDate(paymentDueDate, { locale })
29253
+ })
29254
+ }
29255
+ )
29024
29256
  ] }),
29025
29257
  /* @__PURE__ */ jsxs52(
29026
29258
  Flex,
@@ -31762,7 +31994,7 @@ function inflate(input, options = {}) {
31762
31994
  }
31763
31995
 
31764
31996
  // src/components/embed/Embed.tsx
31765
- import { useContext as useContext3, useEffect as useEffect10, useMemo as useMemo38 } from "react";
31997
+ import { useContext as useContext3, useEffect as useEffect10, useMemo as useMemo39 } from "react";
31766
31998
 
31767
31999
  // src/components/embed/renderer.ts
31768
32000
  import { createElement } from "react";
@@ -31860,6 +32092,7 @@ var Loading = () => {
31860
32092
  };
31861
32093
  var Error2 = ({ message }) => {
31862
32094
  const { settings } = useEmbed();
32095
+ const { t: t3 } = useTranslation();
31863
32096
  return /* @__PURE__ */ jsxs53(
31864
32097
  Flex,
31865
32098
  {
@@ -31871,7 +32104,7 @@ var Error2 = ({ message }) => {
31871
32104
  $alignItems: "center",
31872
32105
  $justifyContent: "center",
31873
32106
  children: [
31874
- /* @__PURE__ */ jsx71(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx71(Text, { display: "heading1", children: "Error" }) }),
32107
+ /* @__PURE__ */ jsx71(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx71(Text, { display: "heading1", children: t3("Error") }) }),
31875
32108
  /* @__PURE__ */ jsx71(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx71(Text, { children: message }) })
31876
32109
  ]
31877
32110
  }
@@ -31879,6 +32112,7 @@ var Error2 = ({ message }) => {
31879
32112
  };
31880
32113
  var SchematicEmbed = ({ id, accessToken }) => {
31881
32114
  const theme = useContext3(nt);
32115
+ const { t: t3 } = useTranslation();
31882
32116
  const {
31883
32117
  data,
31884
32118
  error,
@@ -31890,7 +32124,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
31890
32124
  setBuilderSettings
31891
32125
  } = useEmbed();
31892
32126
  const compressedAst = data?.component?.ast;
31893
- const { children, parsedSettings, parseError } = useMemo38(() => {
32127
+ const { children, parsedSettings, parseError } = useMemo39(() => {
31894
32128
  let children2 = null;
31895
32129
  let parsedSettings2 = null;
31896
32130
  let parseError2 = null;
@@ -31949,13 +32183,15 @@ var SchematicEmbed = ({ id, accessToken }) => {
31949
32183
  return /* @__PURE__ */ jsx71(Error2, { message: error.message });
31950
32184
  }
31951
32185
  if (accessToken?.length === 0) {
31952
- return /* @__PURE__ */ jsx71(Error2, { message: "Please provide an access token." });
32186
+ return /* @__PURE__ */ jsx71(Error2, { message: t3("Please provide an access token.") });
31953
32187
  }
31954
32188
  if (!accessToken?.startsWith("token_")) {
31955
32189
  return /* @__PURE__ */ jsx71(
31956
32190
  Error2,
31957
32191
  {
31958
- message: 'Invalid access token; your temporary access token will start with "token_".'
32192
+ message: t3(
32193
+ "Invalid access token; your temporary access token will start with `token_`."
32194
+ )
31959
32195
  }
31960
32196
  );
31961
32197
  }
@@ -32043,6 +32279,7 @@ export {
32043
32279
  useCustomPlanBilling,
32044
32280
  useEmbed,
32045
32281
  useIsLightBackground,
32282
+ useNextBillDate,
32046
32283
  usePaymentConfirmation,
32047
32284
  useRequest,
32048
32285
  useSubscriptionCurrency,