@schematichq/schematic-components 2.38.0 → 2.39.0

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.
@@ -4609,6 +4609,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
4609
4609
  quantity: json["quantity"],
4610
4610
  subscriptionId: json["subscription_id"],
4611
4611
  subscriptionItemExternalId: json["subscription_item_external_id"] == null ? void 0 : json["subscription_item_external_id"],
4612
+ tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON(json["tiers_mode"]),
4612
4613
  updatedAt: new Date(json["updated_at"]),
4613
4614
  usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
4614
4615
  };
@@ -6086,6 +6087,119 @@ function CompanyCreditBalancesResponseDataFromJSONTyped(json, ignoreDiscriminato
6086
6087
  };
6087
6088
  }
6088
6089
 
6090
+ // src/api/checkoutexternal/models/CompanyCreditLedgerBundleResponseData.ts
6091
+ function CompanyCreditLedgerBundleResponseDataFromJSON(json) {
6092
+ return CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, false);
6093
+ }
6094
+ function CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6095
+ if (json == null) {
6096
+ return json;
6097
+ }
6098
+ return {
6099
+ id: json["id"],
6100
+ name: json["name"]
6101
+ };
6102
+ }
6103
+
6104
+ // src/api/checkoutexternal/models/CompanyCreditLedgerCreditResponseData.ts
6105
+ function CompanyCreditLedgerCreditResponseDataFromJSON(json) {
6106
+ return CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, false);
6107
+ }
6108
+ function CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6109
+ if (json == null) {
6110
+ return json;
6111
+ }
6112
+ return {
6113
+ id: json["id"],
6114
+ name: json["name"],
6115
+ pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
6116
+ singularName: json["singular_name"] == null ? void 0 : json["singular_name"]
6117
+ };
6118
+ }
6119
+
6120
+ // src/api/checkoutexternal/models/CreditUsageReason.ts
6121
+ function CreditUsageReasonFromJSON(json) {
6122
+ return CreditUsageReasonFromJSONTyped(json, false);
6123
+ }
6124
+ function CreditUsageReasonFromJSONTyped(json, ignoreDiscriminator) {
6125
+ return json;
6126
+ }
6127
+
6128
+ // src/api/checkoutexternal/models/CompanyCreditLedgerUserResponseData.ts
6129
+ function CompanyCreditLedgerUserResponseDataFromJSON(json) {
6130
+ return CompanyCreditLedgerUserResponseDataFromJSONTyped(json, false);
6131
+ }
6132
+ function CompanyCreditLedgerUserResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6133
+ if (json == null) {
6134
+ return json;
6135
+ }
6136
+ return {
6137
+ id: json["id"],
6138
+ name: json["name"]
6139
+ };
6140
+ }
6141
+
6142
+ // src/api/checkoutexternal/models/CompanyCreditLedgerFeatureResponseData.ts
6143
+ function CompanyCreditLedgerFeatureResponseDataFromJSON(json) {
6144
+ return CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, false);
6145
+ }
6146
+ function CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6147
+ if (json == null) {
6148
+ return json;
6149
+ }
6150
+ return {
6151
+ id: json["id"],
6152
+ name: json["name"]
6153
+ };
6154
+ }
6155
+
6156
+ // src/api/checkoutexternal/models/CreditLedgerEntryKind.ts
6157
+ function CreditLedgerEntryKindFromJSON(json) {
6158
+ return CreditLedgerEntryKindFromJSONTyped(json, false);
6159
+ }
6160
+ function CreditLedgerEntryKindFromJSONTyped(json, ignoreDiscriminator) {
6161
+ return json;
6162
+ }
6163
+
6164
+ // src/api/checkoutexternal/models/CompanyCreditLedgerEntryResponseData.ts
6165
+ function CompanyCreditLedgerEntryResponseDataFromJSON(json) {
6166
+ return CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, false);
6167
+ }
6168
+ function CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6169
+ if (json == null) {
6170
+ return json;
6171
+ }
6172
+ return {
6173
+ amount: json["amount"],
6174
+ bundle: json["bundle"] == null ? void 0 : CompanyCreditLedgerBundleResponseDataFromJSON(json["bundle"]),
6175
+ credit: CompanyCreditLedgerCreditResponseDataFromJSON(json["credit"]),
6176
+ eventAt: new Date(json["event_at"]),
6177
+ feature: json["feature"] == null ? void 0 : CompanyCreditLedgerFeatureResponseDataFromJSON(json["feature"]),
6178
+ grantReason: json["grant_reason"] == null ? void 0 : BillingCreditGrantReasonFromJSON(json["grant_reason"]),
6179
+ id: json["id"],
6180
+ kind: CreditLedgerEntryKindFromJSON(json["kind"]),
6181
+ usageReason: json["usage_reason"] == null ? void 0 : CreditUsageReasonFromJSON(json["usage_reason"]),
6182
+ user: json["user"] == null ? void 0 : CompanyCreditLedgerUserResponseDataFromJSON(json["user"]),
6183
+ zeroedOutReason: json["zeroed_out_reason"] == null ? void 0 : BillingCreditGrantZeroedOutReasonFromJSON(json["zeroed_out_reason"])
6184
+ };
6185
+ }
6186
+
6187
+ // src/api/checkoutexternal/models/CompanyCreditLedgerResponseData.ts
6188
+ function CompanyCreditLedgerResponseDataFromJSON(json) {
6189
+ return CompanyCreditLedgerResponseDataFromJSONTyped(json, false);
6190
+ }
6191
+ function CompanyCreditLedgerResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6192
+ if (json == null) {
6193
+ return json;
6194
+ }
6195
+ return {
6196
+ entries: json["entries"].map(
6197
+ CompanyCreditLedgerEntryResponseDataFromJSON
6198
+ ),
6199
+ nextCursor: json["next_cursor"] == null ? void 0 : json["next_cursor"]
6200
+ };
6201
+ }
6202
+
6089
6203
  // src/api/checkoutexternal/models/CompanyCreditUserUsageRowResponseData.ts
6090
6204
  function CompanyCreditUserUsageRowResponseDataFromJSON(json) {
6091
6205
  return CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, false);
@@ -6319,7 +6433,9 @@ function ScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator)
6319
6433
  fromSubscriptionPrice: json["from_subscription_price"],
6320
6434
  id: json["id"],
6321
6435
  interval: json["interval"],
6436
+ intervalCount: json["interval_count"],
6322
6437
  scheduledInterval: json["scheduled_interval"] == null ? void 0 : json["scheduled_interval"],
6438
+ scheduledIntervalCount: json["scheduled_interval_count"] == null ? void 0 : json["scheduled_interval_count"],
6323
6439
  scheduledPrice: json["scheduled_price"] == null ? void 0 : json["scheduled_price"],
6324
6440
  toPlanId: json["to_plan_id"],
6325
6441
  toPlanName: json["to_plan_name"]
@@ -7475,6 +7591,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator)
7475
7591
  };
7476
7592
  }
7477
7593
 
7594
+ // src/api/checkoutexternal/models/RenewalDestinationResponseData.ts
7595
+ function RenewalDestinationResponseDataFromJSON(json) {
7596
+ return RenewalDestinationResponseDataFromJSONTyped(json, false);
7597
+ }
7598
+ function RenewalDestinationResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7599
+ if (json == null) {
7600
+ return json;
7601
+ }
7602
+ return {
7603
+ billingPeriod: PlanPriceCadenceFromJSON(json["billing_period"]),
7604
+ planId: json["plan_id"]
7605
+ };
7606
+ }
7607
+
7478
7608
  // src/api/checkoutexternal/models/RenewalPolicy.ts
7479
7609
  function RenewalPolicyFromJSON(json) {
7480
7610
  return RenewalPolicyFromJSONTyped(json, false);
@@ -7500,6 +7630,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7500
7630
  name: json["name"],
7501
7631
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
7502
7632
  planType: PlanTypeFromJSON(json["plan_type"]),
7633
+ renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON(json["renewal_destination"]),
7503
7634
  renewalPolicy: RenewalPolicyFromJSON(json["renewal_policy"]),
7504
7635
  status: PlanVersionStatusFromJSON(json["status"]),
7505
7636
  updatedAt: new Date(json["updated_at"]),
@@ -7703,6 +7834,7 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
7703
7834
  ),
7704
7835
  expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
7705
7836
  interval: json["interval"],
7837
+ intervalCount: json["interval_count"] == null ? void 0 : json["interval_count"],
7706
7838
  isInitial: json["is_initial"],
7707
7839
  latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
7708
7840
  pauseBehavior: json["pause_behavior"] == null ? void 0 : BillingSubscriptionPauseBehaviorFromJSON(json["pause_behavior"]),
@@ -8536,6 +8668,36 @@ function GetCompanyCreditBalancesResponseFromJSONTyped(json, ignoreDiscriminator
8536
8668
  };
8537
8669
  }
8538
8670
 
8671
+ // src/api/checkoutexternal/models/GetCompanyCreditLedgerParams.ts
8672
+ function GetCompanyCreditLedgerParamsFromJSON(json) {
8673
+ return GetCompanyCreditLedgerParamsFromJSONTyped(json, false);
8674
+ }
8675
+ function GetCompanyCreditLedgerParamsFromJSONTyped(json, ignoreDiscriminator) {
8676
+ if (json == null) {
8677
+ return json;
8678
+ }
8679
+ return {
8680
+ creditIds: json["credit_ids"] == null ? void 0 : json["credit_ids"],
8681
+ cursor: json["cursor"] == null ? void 0 : json["cursor"],
8682
+ includeGrants: json["include_grants"] == null ? void 0 : json["include_grants"],
8683
+ limit: json["limit"] == null ? void 0 : json["limit"]
8684
+ };
8685
+ }
8686
+
8687
+ // src/api/checkoutexternal/models/GetCompanyCreditLedgerResponse.ts
8688
+ function GetCompanyCreditLedgerResponseFromJSON(json) {
8689
+ return GetCompanyCreditLedgerResponseFromJSONTyped(json, false);
8690
+ }
8691
+ function GetCompanyCreditLedgerResponseFromJSONTyped(json, ignoreDiscriminator) {
8692
+ if (json == null) {
8693
+ return json;
8694
+ }
8695
+ return {
8696
+ data: CompanyCreditLedgerResponseDataFromJSON(json["data"]),
8697
+ params: GetCompanyCreditLedgerParamsFromJSON(json["params"])
8698
+ };
8699
+ }
8700
+
8539
8701
  // src/api/checkoutexternal/models/GetCompanyCreditUserUsageParams.ts
8540
8702
  function GetCompanyCreditUserUsageParamsFromJSON(json) {
8541
8703
  return GetCompanyCreditUserUsageParamsFromJSONTyped(json, false);
@@ -9075,6 +9237,7 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
9075
9237
  proration: json["proration"],
9076
9238
  scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
9077
9239
  trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
9240
+ unbilledUsageFeatureIds: json["unbilled_usage_feature_ids"],
9078
9241
  usageViolations: json["usage_violations"].map(
9079
9242
  FeatureUsageResponseDataFromJSON
9080
9243
  )
@@ -9910,6 +10073,55 @@ var CheckoutexternalApi = class extends BaseAPI {
9910
10073
  const response = await this.getCompanyCreditBalancesRaw(initOverrides);
9911
10074
  return await response.value();
9912
10075
  }
10076
+ /**
10077
+ * The company\'s credit activity, newest first: draws by feature and user, grants, and credits removed when they expired or reset. A draw written against several grants is one entry. Pass the response\'s `next_cursor` as `cursor` to read the next page.
10078
+ * List credit activity
10079
+ */
10080
+ async getCompanyCreditLedgerRaw(requestParameters, initOverrides) {
10081
+ const queryParameters = {};
10082
+ if (requestParameters["creditIds"] != null) {
10083
+ queryParameters["credit_ids"] = requestParameters["creditIds"];
10084
+ }
10085
+ if (requestParameters["cursor"] != null) {
10086
+ queryParameters["cursor"] = requestParameters["cursor"];
10087
+ }
10088
+ if (requestParameters["includeGrants"] != null) {
10089
+ queryParameters["include_grants"] = requestParameters["includeGrants"];
10090
+ }
10091
+ if (requestParameters["limit"] != null) {
10092
+ queryParameters["limit"] = requestParameters["limit"];
10093
+ }
10094
+ const headerParameters = {};
10095
+ if (this.configuration && this.configuration.apiKey) {
10096
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
10097
+ "X-Schematic-Api-Key"
10098
+ );
10099
+ }
10100
+ const response = await this.request(
10101
+ {
10102
+ path: `/company/credits/ledger`,
10103
+ method: "GET",
10104
+ headers: headerParameters,
10105
+ query: queryParameters
10106
+ },
10107
+ initOverrides
10108
+ );
10109
+ return new JSONApiResponse(
10110
+ response,
10111
+ (jsonValue) => GetCompanyCreditLedgerResponseFromJSON(jsonValue)
10112
+ );
10113
+ }
10114
+ /**
10115
+ * The company\'s credit activity, newest first: draws by feature and user, grants, and credits removed when they expired or reset. A draw written against several grants is one entry. Pass the response\'s `next_cursor` as `cursor` to read the next page.
10116
+ * List credit activity
10117
+ */
10118
+ async getCompanyCreditLedger(requestParameters = {}, initOverrides) {
10119
+ const response = await this.getCompanyCreditLedgerRaw(
10120
+ requestParameters,
10121
+ initOverrides
10122
+ );
10123
+ return await response.value();
10124
+ }
9913
10125
  /**
9914
10126
  * Who in the company consumed the credit, and how much each.
9915
10127
  * List credit usage by user
@@ -11386,9 +11598,9 @@ function BillingPriceUsageTypeFromJSONTyped5(json, ignoreDiscriminator) {
11386
11598
 
11387
11599
  // src/api/componentspublic/models/BillingTiersMode.ts
11388
11600
  function BillingTiersModeFromJSON2(json) {
11389
- return BillingTiersModeFromJSONTyped6(json, false);
11601
+ return BillingTiersModeFromJSONTyped7(json, false);
11390
11602
  }
11391
- function BillingTiersModeFromJSONTyped6(json, ignoreDiscriminator) {
11603
+ function BillingTiersModeFromJSONTyped7(json, ignoreDiscriminator) {
11392
11604
  return json;
11393
11605
  }
11394
11606
 
@@ -11664,9 +11876,9 @@ function ChargeTypeFromJSONTyped7(json, ignoreDiscriminator) {
11664
11876
 
11665
11877
  // src/api/componentspublic/models/PlanPriceCadence.ts
11666
11878
  function PlanPriceCadenceFromJSON2(json) {
11667
- return PlanPriceCadenceFromJSONTyped7(json, false);
11879
+ return PlanPriceCadenceFromJSONTyped8(json, false);
11668
11880
  }
11669
- function PlanPriceCadenceFromJSONTyped7(json, ignoreDiscriminator) {
11881
+ function PlanPriceCadenceFromJSONTyped8(json, ignoreDiscriminator) {
11670
11882
  return json;
11671
11883
  }
11672
11884
 
@@ -12295,6 +12507,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
12295
12507
  };
12296
12508
  }
12297
12509
 
12510
+ // src/api/componentspublic/models/RenewalDestinationResponseData.ts
12511
+ function RenewalDestinationResponseDataFromJSON2(json) {
12512
+ return RenewalDestinationResponseDataFromJSONTyped3(json, false);
12513
+ }
12514
+ function RenewalDestinationResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
12515
+ if (json == null) {
12516
+ return json;
12517
+ }
12518
+ return {
12519
+ billingPeriod: PlanPriceCadenceFromJSON2(json["billing_period"]),
12520
+ planId: json["plan_id"]
12521
+ };
12522
+ }
12523
+
12298
12524
  // src/api/componentspublic/models/RenewalPolicy.ts
12299
12525
  function RenewalPolicyFromJSON2(json) {
12300
12526
  return RenewalPolicyFromJSONTyped3(json, false);
@@ -12320,6 +12546,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
12320
12546
  name: json["name"],
12321
12547
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
12322
12548
  planType: PlanTypeFromJSON2(json["plan_type"]),
12549
+ renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON2(json["renewal_destination"]),
12323
12550
  renewalPolicy: RenewalPolicyFromJSON2(json["renewal_policy"]),
12324
12551
  status: PlanVersionStatusFromJSON2(json["status"]),
12325
12552
  updatedAt: new Date(json["updated_at"]),
@@ -12895,7 +13122,7 @@ function resolveLocale(locale) {
12895
13122
  return locale !== void 0 && locale !== "" && isUsableLocale(locale) ? locale : DEFAULT_LOCALE;
12896
13123
  }
12897
13124
 
12898
- // node_modules/.pnpm/i18next@27.0.0_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
13125
+ // node_modules/.pnpm/i18next@27.1.2_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
12899
13126
  var isString = (obj) => typeof obj === "string";
12900
13127
  var defer = () => {
12901
13128
  let res;
@@ -13491,7 +13718,8 @@ var Translator = class _Translator extends EventEmitter {
13491
13718
  ordinal: false
13492
13719
  }) : "";
13493
13720
  const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
13494
- const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
13721
+ const sep = this.options.pluralSeparator;
13722
+ const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${sep}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || (opt.defaultValue ?? (needsPluralHandling ? opt[`defaultValue${opt.ordinal ? `${sep}ordinal${sep}` : sep}other`] : void 0));
13495
13723
  let resForObjHndl = res;
13496
13724
  if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
13497
13725
  resForObjHndl = defaultValue;
@@ -13645,7 +13873,7 @@ var Translator = class _Translator extends EventEmitter {
13645
13873
  const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
13646
13874
  let nestBef;
13647
13875
  if (skipOnVariables) {
13648
- const nb = res.match(this.interpolator.nestingRegexp);
13876
+ const nb = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
13649
13877
  nestBef = nb && nb.length;
13650
13878
  }
13651
13879
  let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
@@ -13655,7 +13883,7 @@ var Translator = class _Translator extends EventEmitter {
13655
13883
  };
13656
13884
  res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
13657
13885
  if (skipOnVariables) {
13658
- const na = res.match(this.interpolator.nestingRegexp);
13886
+ const na = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
13659
13887
  const nestAft = na && na.length;
13660
13888
  if (nestBef < nestAft) opt.nest = false;
13661
13889
  }
@@ -13752,6 +13980,15 @@ var Translator = class _Translator extends EventEmitter {
13752
13980
  }
13753
13981
  }
13754
13982
  }
13983
+ if (needsPluralHandling) {
13984
+ const otherSuffix = `${opt.ordinal ? ordinalPrefix : this.options.pluralSeparator}other`;
13985
+ if (pluralSuffix !== otherSuffix) {
13986
+ if (needsContextHandling) {
13987
+ finalKeys.unshift(`${key}${this.options.contextSeparator || "_"}${opt.context}${otherSuffix}`);
13988
+ }
13989
+ finalKeys.unshift(key + otherSuffix);
13990
+ }
13991
+ }
13755
13992
  }
13756
13993
  let possibleKey;
13757
13994
  while (possibleKey = finalKeys.pop()) {
@@ -13954,6 +14191,7 @@ var LanguageUtil = class {
13954
14191
  if (!codes.includes(formattedFc)) addCode(formattedFc);
13955
14192
  });
13956
14193
  if (cacheKey !== null) {
14194
+ if (Object.keys(this.resolveHierarchyCache).length >= 1e3) this.resolveHierarchyCache = {};
13957
14195
  this.resolveHierarchyCache[cacheKey] = codes;
13958
14196
  return codes.slice();
13959
14197
  }
@@ -14008,6 +14246,7 @@ var PluralResolver = class {
14008
14246
  const lngPart = this.languageUtils.getLanguagePartFromCode(code);
14009
14247
  rule = this.getRule(lngPart, options);
14010
14248
  }
14249
+ if (Object.keys(this.pluralRulesCache).length >= 1e3) this.pluralRulesCache = {};
14011
14250
  this.pluralRulesCache[cacheKey] = rule;
14012
14251
  return rule;
14013
14252
  }
@@ -14076,6 +14315,8 @@ var Interpolator = class {
14076
14315
  this.formatSeparator = formatSeparator || ",";
14077
14316
  this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix ? regexEscape(unescapePrefix) : "-";
14078
14317
  this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix ? regexEscape(unescapeSuffix) : "";
14318
+ this.prefixText = prefix2 || "{{";
14319
+ this.nestingPrefixText = nestingPrefix || "$t(";
14079
14320
  this.nestingPrefix = regexEscape(nestingPrefix || "$t(");
14080
14321
  this.nestingSuffix = regexEscape(nestingSuffix || ")");
14081
14322
  this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
@@ -14128,6 +14369,7 @@ var Interpolator = class {
14128
14369
  }
14129
14370
  const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
14130
14371
  const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
14372
+ if (isString(str) && !str.includes(this.prefixText)) return str;
14131
14373
  const todos = [{
14132
14374
  regex: this.regexpUnescape,
14133
14375
  safeValue: (val) => val
@@ -14217,6 +14459,7 @@ var Interpolator = class {
14217
14459
  if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
14218
14460
  return key;
14219
14461
  };
14462
+ if (isString(str) && !str.includes(this.nestingPrefixText)) return str;
14220
14463
  const nestingRegexp = new RegExp(this.nestingRegexp);
14221
14464
  let out = "";
14222
14465
  let lastEnd = 0;
@@ -14284,8 +14527,9 @@ var parseFormatStr = (formatStr) => {
14284
14527
  formatOptions
14285
14528
  };
14286
14529
  };
14530
+ var cachedFormattersLimit = 1e3;
14287
14531
  var createCachedFormatter = (fn) => {
14288
- const cache = {};
14532
+ const cache = /* @__PURE__ */ new Map();
14289
14533
  return (v2, l2, o) => {
14290
14534
  let optForCache = o;
14291
14535
  if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
@@ -14300,10 +14544,11 @@ var createCachedFormatter = (fn) => {
14300
14544
  } catch (e) {
14301
14545
  return fn(getCleanedCode(l2), o)(v2);
14302
14546
  }
14303
- let frm = cache[key];
14547
+ let frm = cache.get(key);
14304
14548
  if (!frm) {
14305
14549
  frm = fn(getCleanedCode(l2), o);
14306
- cache[key] = frm;
14550
+ if (cache.size >= cachedFormattersLimit) cache.delete(cache.keys().next().value);
14551
+ cache.set(key, frm);
14307
14552
  }
14308
14553
  return frm(v2);
14309
14554
  };
@@ -14400,6 +14645,7 @@ var Formatter = class {
14400
14645
  return result;
14401
14646
  }
14402
14647
  };
14648
+ var maxFailedLoads = 1e3;
14403
14649
  var removePending = (q2, name) => {
14404
14650
  if (q2.pending[name] !== void 0) {
14405
14651
  delete q2.pending[name];
@@ -14421,6 +14667,7 @@ var Connector = class extends EventEmitter {
14421
14667
  this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
14422
14668
  this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
14423
14669
  this.state = {};
14670
+ this.failed = /* @__PURE__ */ new Set();
14424
14671
  this.queue = [];
14425
14672
  this.backend?.init?.(services, options.backend, options);
14426
14673
  this.callbackApi = callbackApiOf(this.backend);
@@ -14480,6 +14727,15 @@ var Connector = class extends EventEmitter {
14480
14727
  }
14481
14728
  this.state[name] = err ? -1 : 2;
14482
14729
  if (err && data) this.state[name] = 0;
14730
+ this.failed.delete(name);
14731
+ if (err) {
14732
+ this.failed.add(name);
14733
+ if (this.failed.size > maxFailedLoads) {
14734
+ const oldest = this.failed.values().next().value;
14735
+ this.failed.delete(oldest);
14736
+ if (this.state[oldest] < 1) delete this.state[oldest];
14737
+ }
14738
+ }
14483
14739
  const loaded = {};
14484
14740
  this.queue.forEach((q2) => {
14485
14741
  pushPath(q2.loaded, [lng], ns);
@@ -15570,6 +15826,19 @@ var en = {
15570
15826
  "mo": "mo",
15571
15827
  "qtr": "qtr",
15572
15828
  "yr": "yr",
15829
+ "wk": "wk",
15830
+ "X days short": "{{amount, number}}d",
15831
+ "X weeks short": "{{amount, number}}wk",
15832
+ "X months short": "{{amount, number}}mo",
15833
+ "X years short": "{{amount, number}}yr",
15834
+ "X days_one": "{{count, number}} day",
15835
+ "X days_other": "{{count, number}} days",
15836
+ "X weeks_one": "{{count, number}} week",
15837
+ "X weeks_other": "{{count, number}} weeks",
15838
+ "X months_one": "{{count, number}} month",
15839
+ "X months_other": "{{count, number}} months",
15840
+ "X years_one": "{{count, number}} year",
15841
+ "X years_other": "{{count, number}} years",
15573
15842
  "one time": "one time",
15574
15843
  "billing period": "billing period",
15575
15844
  "billing period_one": "billing period",
@@ -15579,6 +15848,7 @@ var en = {
15579
15848
  "monthly": "monthly",
15580
15849
  "quarterly": "quarterly",
15581
15850
  "yearly": "yearly",
15851
+ "every period": "every {{period}}",
15582
15852
  "expires after purchase": "expires {{amount}} {{unit}} after purchase",
15583
15853
  "expires at the end of the billing period": "expires at the end of the billing period",
15584
15854
  "expires at the end of the next billing period": "expires at the end of the next billing period",
@@ -15881,6 +16151,23 @@ var it2 = {
15881
16151
  "mo": "mese",
15882
16152
  "qtr": "trim.",
15883
16153
  "yr": "anno",
16154
+ "wk": "sett.",
16155
+ "X days short": "{{amount, number}} gg",
16156
+ "X weeks short": "{{amount, number}} sett.",
16157
+ "X months short": "{{amount, number}} mesi",
16158
+ "X years short": "{{amount, number}} anni",
16159
+ "X days_one": "{{count, number}} giorno",
16160
+ "X days_many": "{{count, number}} giorni",
16161
+ "X days_other": "{{count, number}} giorni",
16162
+ "X weeks_one": "{{count, number}} settimana",
16163
+ "X weeks_many": "{{count, number}} settimane",
16164
+ "X weeks_other": "{{count, number}} settimane",
16165
+ "X months_one": "{{count, number}} mese",
16166
+ "X months_many": "{{count, number}} mesi",
16167
+ "X months_other": "{{count, number}} mesi",
16168
+ "X years_one": "{{count, number}} anno",
16169
+ "X years_many": "{{count, number}} anni",
16170
+ "X years_other": "{{count, number}} anni",
15884
16171
  "one time": "una tantum",
15885
16172
  "billing period": "periodo di fatturazione",
15886
16173
  "billing period_one": "periodo di fatturazione",
@@ -15914,6 +16201,7 @@ var it2 = {
15914
16201
  "monthly": "mensile",
15915
16202
  "quarterly": "trimestrale",
15916
16203
  "yearly": "annuale",
16204
+ "every period": "ogni {{period}}",
15917
16205
  "Usage by user": "Utilizzo per utente",
15918
16206
  "X used by your team this period": "{{amount}} utilizzati dal tuo team in questo periodo",
15919
16207
  "Show all X users_one": "Mostra {{count, number}} utente",
@@ -16107,14 +16395,24 @@ function derivePeriod(interval, intervalCount) {
16107
16395
  }
16108
16396
  return interval;
16109
16397
  }
16110
- function getSubscriptionPeriod(billingSubscription) {
16398
+ function getSubscriptionInterval(billingSubscription) {
16111
16399
  if (!billingSubscription) {
16112
16400
  return void 0;
16113
16401
  }
16114
16402
  const product = billingSubscription.products?.find(
16115
16403
  (p2) => p2.interval && p2.interval !== "one-time"
16116
16404
  );
16117
- return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
16405
+ if (product?.interval) {
16406
+ return { interval: product.interval, intervalCount: product.intervalCount };
16407
+ }
16408
+ return billingSubscription.interval ? { interval: billingSubscription.interval } : void 0;
16409
+ }
16410
+ function getSubscriptionPeriod(billingSubscription) {
16411
+ const subscriptionInterval = getSubscriptionInterval(billingSubscription);
16412
+ return derivePeriod(
16413
+ subscriptionInterval?.interval,
16414
+ subscriptionInterval?.intervalCount
16415
+ );
16118
16416
  }
16119
16417
  function getDefaultPlanPeriod(plans = []) {
16120
16418
  if (plans.some((plan) => plan.monthlyPrice)) return "month";
@@ -16387,6 +16685,8 @@ function getResetCadencePeriod(cadence) {
16387
16685
  switch (cadence) {
16388
16686
  case BillingPlanCreditGrantResetCadence.Yearly:
16389
16687
  return "year";
16688
+ case BillingPlanCreditGrantResetCadence.Quarterly:
16689
+ return "quarter";
16390
16690
  case BillingPlanCreditGrantResetCadence.Monthly:
16391
16691
  return "month";
16392
16692
  case BillingPlanCreditGrantResetCadence.Weekly:
@@ -16876,6 +17176,11 @@ function getEntitlementFeatureName(entitlement, defaultValue) {
16876
17176
  function entitlementHasCost(entitlement) {
16877
17177
  return entitlement.priceBehavior && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && entitlement.quantity > 0 || entitlement.priceBehavior !== EntitlementPriceBehavior.PayInAdvance);
16878
17178
  }
17179
+ function hasMeteredCosts(entitlements) {
17180
+ return entitlements.some(
17181
+ ({ priceBehavior }) => !!priceBehavior && priceBehavior !== EntitlementPriceBehavior.PayInAdvance && priceBehavior !== EntitlementPriceBehavior.CreditBurndown
17182
+ );
17183
+ }
16879
17184
  function entitlementHasHardLimit(entitlement) {
16880
17185
  return entitlement.priceBehavior && entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown;
16881
17186
  }
@@ -17025,8 +17330,38 @@ function getMonthName(date, { locale, ...format }) {
17025
17330
  ...format
17026
17331
  }).format(new Date(date));
17027
17332
  }
17028
- function shortenPeriod(period, t3) {
17029
- switch (period) {
17333
+ var QUARTERLY_INTERVAL_COUNT = 3;
17334
+ var YEARLY_INTERVAL_COUNT = 12;
17335
+ function normalizeInterval(interval, intervalCount) {
17336
+ const count = intervalCount && intervalCount > 1 ? intervalCount : 1;
17337
+ if (interval === "month" && count === QUARTERLY_INTERVAL_COUNT) {
17338
+ return { period: "quarter", count: 1 };
17339
+ }
17340
+ if (interval === "month" && count === YEARLY_INTERVAL_COUNT) {
17341
+ return { period: "year", count: 1 };
17342
+ }
17343
+ return { period: interval, count };
17344
+ }
17345
+ function shortenPeriod(period, t3, intervalCount) {
17346
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17347
+ if (count > 1) {
17348
+ switch (unit) {
17349
+ case "day":
17350
+ return t3("X days short", { amount: count });
17351
+ case "week":
17352
+ return t3("X weeks short", { amount: count });
17353
+ case "month":
17354
+ return t3("X months short", { amount: count });
17355
+ case "year":
17356
+ return t3("X years short", { amount: count });
17357
+ }
17358
+ return;
17359
+ }
17360
+ switch (unit) {
17361
+ case "day":
17362
+ return t3("day");
17363
+ case "week":
17364
+ return t3("wk");
17030
17365
  case "month":
17031
17366
  return t3("mo");
17032
17367
  case "quarter":
@@ -17035,6 +17370,31 @@ function shortenPeriod(period, t3) {
17035
17370
  return t3("yr");
17036
17371
  }
17037
17372
  }
17373
+ function nameInterval(period, t3, intervalCount) {
17374
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17375
+ if (count > 1) {
17376
+ switch (unit) {
17377
+ case "day":
17378
+ return t3("X days", { count });
17379
+ case "week":
17380
+ return t3("X weeks", { count });
17381
+ case "month":
17382
+ return t3("X months", { count });
17383
+ case "year":
17384
+ return t3("X years", { count });
17385
+ }
17386
+ return period;
17387
+ }
17388
+ switch (unit) {
17389
+ case "day":
17390
+ case "week":
17391
+ case "month":
17392
+ case "quarter":
17393
+ case "year":
17394
+ return t3(unit);
17395
+ }
17396
+ return period;
17397
+ }
17038
17398
  function modifyDate(date, days) {
17039
17399
  const copy3 = new Date(date);
17040
17400
  copy3.setDate(copy3.getDate() + days);
@@ -17117,8 +17477,14 @@ function formatCurrency(amount, {
17117
17477
  function formatOrdinal(n2, t3) {
17118
17478
  return t3("Ordinal", { count: n2, ordinal: true });
17119
17479
  }
17120
- function adjectify(period, t3) {
17121
- switch (period) {
17480
+ function adjectify(period, t3, intervalCount) {
17481
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17482
+ if (count > 1) {
17483
+ return t3("every period", {
17484
+ period: nameInterval(period, t3, intervalCount)
17485
+ });
17486
+ }
17487
+ switch (unit) {
17122
17488
  case "day":
17123
17489
  return t3("daily");
17124
17490
  case "week":
@@ -18072,7 +18438,7 @@ var reducer = (state, action) => {
18072
18438
  // src/context/EmbedProvider.tsx
18073
18439
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
18074
18440
  var getCustomHeaders = (sessionId) => ({
18075
- "X-Schematic-Components-Version": "2.38.0",
18441
+ "X-Schematic-Components-Version": "2.39.0",
18076
18442
  "X-Schematic-Session-ID": sessionId
18077
18443
  });
18078
18444
  var normalizeCurrencyFilter = (filter2) => {
@@ -18799,10 +19165,10 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
18799
19165
  return periods;
18800
19166
  }, [data?.activePlans, data?.activeAddOns]);
18801
19167
  const getActivePlans = useCallback3(
18802
- (plans) => {
19168
+ (plans, period = activePeriod) => {
18803
19169
  const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
18804
19170
  if (options.useSelectedPeriod) {
18805
- return activePeriod === "month" && plan.monthlyPrice || activePeriod === "quarter" && plan.quarterlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
19171
+ return period === "month" && plan.monthlyPrice || period === "quarter" && plan.quarterlyPrice || period === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
18806
19172
  }
18807
19173
  return plan.monthlyPrice || plan.quarterlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
18808
19174
  });
@@ -18814,7 +19180,8 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
18814
19180
  return {
18815
19181
  plans: getActivePlans(data?.activePlans || []),
18816
19182
  addOns: getActivePlans(data?.activeAddOns || []),
18817
- periods: getAvailablePeriods()
19183
+ periods: getAvailablePeriods(),
19184
+ plansForPeriod: (period) => getActivePlans(data?.activePlans || [], period)
18818
19185
  };
18819
19186
  }, [
18820
19187
  data?.activePlans,
@@ -22532,28 +22899,49 @@ var CheckoutDialog = ({ top }) => {
22532
22899
  }
22533
22900
  }, [filterBlocksSubscriptionCurrency, lockedCurrency, debug]);
22534
22901
  const {
22535
- plans: availablePlans,
22902
+ plans: periodPlans,
22536
22903
  addOns: availableAddOns,
22537
- periods: availablePeriods
22904
+ periods: availablePeriods,
22905
+ plansForPeriod
22538
22906
  } = useAvailablePlans(planPeriod, {
22539
22907
  useSelectedPeriod: showPeriodToggle
22540
22908
  });
22541
- const [selectedPlanId, setSelectedPlanId] = useState8(void 0);
22542
- const selectedPlan = useMemo16(() => {
22543
- if (selectedPlanId === null) {
22544
- return void 0;
22545
- }
22546
- if (selectedPlanId) {
22547
- return availablePlans.find((p2) => p2.id === selectedPlanId);
22548
- }
22549
- if (checkoutState?.planId) {
22550
- return availablePlans.find((plan) => plan.id === checkoutState.planId);
22551
- }
22552
- return availablePlans.find(
22553
- (plan) => plan.current && // do not initially set the current plan for a trial
22554
- (!plan.isTrialable || !plan.companyCanTrial)
22555
- );
22556
- }, [availablePlans, checkoutState, selectedPlanId]);
22909
+ const requestedPlanId = checkoutState?.planId;
22910
+ const bypassPlanSelection = checkoutState?.bypassPlanSelection;
22911
+ const supportsCheckoutCurrency = useCallback8(
22912
+ (plan) => !hasCurrency || planSupportsCurrency(plan, effectiveCurrency) || // A plan the host picks and skips past is kept so the currency/period
22913
+ // mismatch notice can say it is unavailable.
22914
+ !!bypassPlanSelection && plan.id === requestedPlanId,
22915
+ [hasCurrency, effectiveCurrency, bypassPlanSelection, requestedPlanId]
22916
+ );
22917
+ const availablePlans = useMemo16(
22918
+ () => periodPlans.filter(supportsCheckoutCurrency),
22919
+ [periodPlans, supportsCheckoutCurrency]
22920
+ );
22921
+ const [selectedPlanId, setSelectedPlanId] = useState8(
22922
+ void 0
22923
+ );
22924
+ const isTrialing = data?.company?.billingSubscription?.status === "trialing";
22925
+ const findSelectedPlan = useCallback8(
22926
+ (plans) => {
22927
+ if (selectedPlanId) {
22928
+ return plans.find((p2) => p2.id === selectedPlanId);
22929
+ }
22930
+ if (requestedPlanId) {
22931
+ return plans.find((plan) => plan.id === requestedPlanId);
22932
+ }
22933
+ return plans.find(
22934
+ (plan) => plan.current && // A company that could trial its current plan chooses for itself,
22935
+ // unless it is already trialing it.
22936
+ (isTrialing || !plan.isTrialable || !plan.companyCanTrial)
22937
+ );
22938
+ },
22939
+ [requestedPlanId, selectedPlanId, isTrialing]
22940
+ );
22941
+ const selectedPlan = useMemo16(
22942
+ () => findSelectedPlan(availablePlans),
22943
+ [availablePlans, findSelectedPlan]
22944
+ );
22557
22945
  const [shouldTrial, setShouldTrial] = useState8(false);
22558
22946
  const displayedPlanCreditGrants = useMemo16(
22559
22947
  () => getDisplayedPlanCreditGrants(selectedPlan),
@@ -22919,7 +23307,7 @@ var CheckoutDialog = ({ top }) => {
22919
23307
  }, [currencies, selectedPlan, planPeriod]);
22920
23308
  const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
22921
23309
  const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
22922
- const currencyPeriodMismatch = hasCurrency && !lockedCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
23310
+ const currencyPeriodMismatch = hasCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
22923
23311
  useEffect3(() => {
22924
23312
  if (currencyPeriodMismatch) {
22925
23313
  console.error(
@@ -22971,7 +23359,6 @@ var CheckoutDialog = ({ top }) => {
22971
23359
  if (isBypassLoading) {
22972
23360
  setIsBypassLoading(false);
22973
23361
  }
22974
- setSelectedPlanId(null);
22975
23362
  return;
22976
23363
  }
22977
23364
  const requestId = ++previewRequestIdRef.current;
@@ -23210,7 +23597,8 @@ var CheckoutDialog = ({ top }) => {
23210
23597
  }
23211
23598
  const updatedShouldTrial = updates.shouldTrial ?? shouldTrial;
23212
23599
  setShouldTrial(updatedShouldTrial);
23213
- if (willTrialWithoutPaymentMethod) {
23600
+ const updatedWillTrialWithoutPaymentMethod = updatedShouldTrial && !trialPaymentMethodRequired;
23601
+ if (updatedWillTrialWithoutPaymentMethod) {
23214
23602
  setSelectedAddOnIds(/* @__PURE__ */ new Set());
23215
23603
  }
23216
23604
  const resolvedCreditBundles = (data?.creditBundles ?? []).map(
@@ -23223,14 +23611,10 @@ var CheckoutDialog = ({ top }) => {
23223
23611
  period,
23224
23612
  plan,
23225
23613
  shouldTrial: updatedShouldTrial,
23226
- ...willTrialWithoutPaymentMethod ? {
23227
- addOns: [],
23228
- payInAdvanceEntitlements: []
23229
- } : {
23230
- payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
23231
- ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
23232
- )
23233
- },
23614
+ ...updatedWillTrialWithoutPaymentMethod && { addOns: [] },
23615
+ payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
23616
+ ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
23617
+ ),
23234
23618
  creditBundles: resolvedCreditBundles
23235
23619
  });
23236
23620
  },
@@ -23242,7 +23626,7 @@ var CheckoutDialog = ({ top }) => {
23242
23626
  featureUsage,
23243
23627
  bundleCounts,
23244
23628
  shouldTrial,
23245
- willTrialWithoutPaymentMethod,
23629
+ trialPaymentMethodRequired,
23246
23630
  handlePreviewCheckout,
23247
23631
  checkoutState?.payInAdvanceQuantities
23248
23632
  ]
@@ -23253,40 +23637,42 @@ var CheckoutDialog = ({ top }) => {
23253
23637
  return;
23254
23638
  }
23255
23639
  setPlanPeriod(period);
23256
- const updatedUsageBasedEntitlements = (selectedPlan?.entitlements || []).reduce(
23257
- createActiveUsageBasedEntitlementsReducer(featureUsage, period),
23258
- [...[]]
23259
- );
23260
- setUsageBasedEntitlements(
23261
- (prev2) => updatedUsageBasedEntitlements.map((updated) => {
23262
- const current = prev2.find(
23263
- ({ featureId }) => featureId === updated.featureId
23264
- );
23265
- if (typeof current?.quantity === "number") {
23266
- return { ...updated, quantity: current.quantity };
23267
- }
23268
- return updated;
23269
- })
23640
+ const plan = findSelectedPlan(
23641
+ plansForPeriod(period).filter(supportsCheckoutCurrency)
23270
23642
  );
23643
+ const updatedUsageBasedEntitlements = plan ? (plan.entitlements || []).reduce(
23644
+ createActiveUsageBasedEntitlementsReducer(featureUsage, period),
23645
+ []
23646
+ ).map((updated) => {
23647
+ const current = usageBasedEntitlements.find(
23648
+ ({ featureId }) => featureId === updated.featureId
23649
+ );
23650
+ if (typeof current?.quantity === "number") {
23651
+ return { ...updated, quantity: current.quantity };
23652
+ }
23653
+ return updated;
23654
+ }) : usageBasedEntitlements;
23655
+ if (plan) {
23656
+ setUsageBasedEntitlements(updatedUsageBasedEntitlements);
23657
+ }
23271
23658
  const updatedAddOnUsageBasedEntitlements = addOns.filter((addOn) => addOn.isSelected).flatMap(
23272
23659
  (addOn) => (addOn.entitlements ?? []).reduce(
23273
23660
  createActiveUsageBasedEntitlementsReducer(featureUsage, period),
23274
23661
  []
23275
23662
  )
23276
- );
23277
- setAddOnUsageBasedEntitlements(
23278
- (prev2) => updatedAddOnUsageBasedEntitlements.map((updated) => {
23279
- const current = prev2.find(
23280
- ({ featureId }) => featureId === updated.featureId
23281
- );
23282
- if (typeof current?.quantity === "number") {
23283
- return { ...updated, quantity: current.quantity };
23284
- }
23285
- return updated;
23286
- })
23287
- );
23663
+ ).map((updated) => {
23664
+ const current = addOnUsageBasedEntitlements.find(
23665
+ ({ featureId }) => featureId === updated.featureId
23666
+ );
23667
+ if (typeof current?.quantity === "number") {
23668
+ return { ...updated, quantity: current.quantity };
23669
+ }
23670
+ return updated;
23671
+ });
23672
+ setAddOnUsageBasedEntitlements(updatedAddOnUsageBasedEntitlements);
23288
23673
  handlePreviewCheckout({
23289
23674
  period,
23675
+ plan,
23290
23676
  payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
23291
23677
  ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
23292
23678
  ),
@@ -23297,9 +23683,13 @@ var CheckoutDialog = ({ top }) => {
23297
23683
  },
23298
23684
  [
23299
23685
  planPeriod,
23300
- selectedPlan?.entitlements,
23686
+ plansForPeriod,
23687
+ findSelectedPlan,
23688
+ supportsCheckoutCurrency,
23301
23689
  featureUsage,
23690
+ usageBasedEntitlements,
23302
23691
  addOns,
23692
+ addOnUsageBasedEntitlements,
23303
23693
  setPlanPeriod,
23304
23694
  handlePreviewCheckout
23305
23695
  ]
@@ -23443,12 +23833,12 @@ var CheckoutDialog = ({ top }) => {
23443
23833
  }, [setLayout, clearCheckoutState]);
23444
23834
  const hasInitializedPlan = useRef6(false);
23445
23835
  useEffect3(() => {
23446
- if (!hasInitializedPlan.current && selectedPlan) {
23836
+ if (!hasInitializedPlan.current && selectedPlan && selectedPlanId === void 0) {
23447
23837
  hasInitializedPlan.current = true;
23448
- const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
23838
+ const shouldTrial2 = checkoutState?.startTrialIfAvailable && !(isTrialing && selectedPlan.current) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
23449
23839
  selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
23450
23840
  }
23451
- }, [selectedPlan, planPeriod, selectPlan]);
23841
+ }, [selectedPlan, selectedPlanId, planPeriod, selectPlan]);
23452
23842
  useLayoutEffect4(() => {
23453
23843
  const element = dialogRef.current;
23454
23844
  if (layout !== "checkout" || !element) {
@@ -23696,6 +24086,7 @@ var CheckoutDialog = ({ top }) => {
23696
24086
  options: availablePeriods,
23697
24087
  selectedOption: planPeriod,
23698
24088
  selectedPlan,
24089
+ currency: hasCurrency ? effectiveCurrency : void 0,
23699
24090
  onSelect: changePlanPeriod
23700
24091
  }
23701
24092
  )
@@ -24507,6 +24898,7 @@ var PeriodToggle = ({
24507
24898
  options,
24508
24899
  selectedOption,
24509
24900
  selectedPlan,
24901
+ currency,
24510
24902
  onSelect
24511
24903
  }) => {
24512
24904
  const { t: t3 } = useTranslation();
@@ -24517,19 +24909,19 @@ var PeriodToggle = ({
24517
24909
  if (!selectedPlan) {
24518
24910
  return result;
24519
24911
  }
24520
- const monthlyPrice = getPlanPrice(selectedPlan, "month")?.price ?? 0;
24912
+ const monthlyPrice = getPlanPrice(selectedPlan, "month", void 0, currency)?.price ?? 0;
24521
24913
  if (monthlyPrice <= 0) {
24522
24914
  return result;
24523
24915
  }
24524
24916
  for (const [period, months] of Object.entries(PERIOD_MONTH_COUNT)) {
24525
- const periodPrice = getPlanPrice(selectedPlan, period)?.price ?? 0;
24917
+ const periodPrice = getPlanPrice(selectedPlan, period, void 0, currency)?.price ?? 0;
24526
24918
  if (periodPrice > 0) {
24527
24919
  const baseline = monthlyPrice * months;
24528
24920
  result[period] = Math.round((baseline - periodPrice) / baseline * 1e4) / 100;
24529
24921
  }
24530
24922
  }
24531
24923
  return result;
24532
- }, [selectedPlan]);
24924
+ }, [selectedPlan, currency]);
24533
24925
  return /* @__PURE__ */ jsx37(
24534
24926
  Flex,
24535
24927
  {
@@ -24924,10 +25316,12 @@ var CheckoutStageButton = ({
24924
25316
  willScheduleDowngrade,
24925
25317
  hasIncompleteRequiredCustomFields = false,
24926
25318
  isCreditOnlyPurchase = false,
24927
- isOneTimeOnlyPurchase = false
25319
+ isOneTimeOnlyPurchase = false,
25320
+ isUnchangedTrial = false
24928
25321
  }) => {
24929
25322
  const { t: t3 } = useTranslation();
24930
25323
  const isDisabled = isLoading || !hasPlan && !isCreditOnlyPurchase || inEditMode || !canCheckout;
25324
+ const isCheckoutDisabled = isDisabled || isUnchangedTrial;
24931
25325
  const optInUnmet = optInRequired && !optInAccepted;
24932
25326
  const getNextStageId = (currentStageId) => {
24933
25327
  if (!checkoutStages) return void 0;
@@ -24989,7 +25383,7 @@ var CheckoutStageButton = ({
24989
25383
  return /* @__PURE__ */ jsx42(
24990
25384
  NoPaymentRequired,
24991
25385
  {
24992
- isDisabled,
25386
+ isDisabled: isCheckoutDisabled,
24993
25387
  isLoading,
24994
25388
  onClick: checkout,
24995
25389
  isSticky,
@@ -25024,7 +25418,7 @@ var CheckoutStageButton = ({
25024
25418
  return /* @__PURE__ */ jsx42(
25025
25419
  NoPaymentRequired,
25026
25420
  {
25027
- isDisabled,
25421
+ isDisabled: isCheckoutDisabled,
25028
25422
  isLoading,
25029
25423
  onClick: checkout,
25030
25424
  isSticky,
@@ -25068,7 +25462,7 @@ var CheckoutStageButton = ({
25068
25462
  return /* @__PURE__ */ jsx42(
25069
25463
  NoPaymentRequired,
25070
25464
  {
25071
- isDisabled,
25465
+ isDisabled: isCheckoutDisabled,
25072
25466
  isLoading,
25073
25467
  onClick: checkout,
25074
25468
  isSticky,
@@ -25112,7 +25506,7 @@ var CheckoutStageButton = ({
25112
25506
  return /* @__PURE__ */ jsx42(
25113
25507
  NoPaymentRequired,
25114
25508
  {
25115
- isDisabled,
25509
+ isDisabled: isCheckoutDisabled,
25116
25510
  isLoading,
25117
25511
  onClick: checkout,
25118
25512
  isSticky,
@@ -25155,7 +25549,7 @@ var CheckoutStageButton = ({
25155
25549
  return /* @__PURE__ */ jsx42(
25156
25550
  NoPaymentRequired,
25157
25551
  {
25158
- isDisabled,
25552
+ isDisabled: isCheckoutDisabled,
25159
25553
  isLoading,
25160
25554
  onClick: checkout,
25161
25555
  isSticky,
@@ -25199,7 +25593,7 @@ var CheckoutStageButton = ({
25199
25593
  return /* @__PURE__ */ jsx42(
25200
25594
  NoPaymentRequired,
25201
25595
  {
25202
- isDisabled,
25596
+ isDisabled: isCheckoutDisabled,
25203
25597
  isLoading,
25204
25598
  onClick: checkout,
25205
25599
  isSticky,
@@ -25243,7 +25637,7 @@ var CheckoutStageButton = ({
25243
25637
  /* @__PURE__ */ jsx42(
25244
25638
  NoPaymentRequired,
25245
25639
  {
25246
- isDisabled: isDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
25640
+ isDisabled: isCheckoutDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
25247
25641
  isLoading,
25248
25642
  onClick: checkout,
25249
25643
  isSticky,
@@ -25259,7 +25653,7 @@ var CheckoutStageButton = ({
25259
25653
  Button,
25260
25654
  {
25261
25655
  type: "button",
25262
- disabled: isDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
25656
+ disabled: isCheckoutDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
25263
25657
  onClick: checkout,
25264
25658
  $fullWidth: true,
25265
25659
  $isLoading: isLoading,
@@ -25741,9 +26135,9 @@ var SubscriptionSidebar = forwardRef7(
25741
26135
  ]);
25742
26136
  const selectedAddOnsWithPrice = useMemo22(
25743
26137
  () => addOns.filter(
25744
- (addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
26138
+ (addOn) => addOn.isSelected && getPlanPrice(addOn, planPeriod, void 0, currency)?.price
25745
26139
  ),
25746
- [addOns, currency]
26140
+ [addOns, planPeriod, currency]
25747
26141
  );
25748
26142
  const selectedOneTimeAddOns = useMemo22(
25749
26143
  () => addOns.filter(
@@ -25753,7 +26147,7 @@ var SubscriptionSidebar = forwardRef7(
25753
26147
  );
25754
26148
  const { removedAddOns, willAddOnsChange } = useMemo22(() => {
25755
26149
  const addedAddOns = selectedAddOnsWithPrice.filter(
25756
- (selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
26150
+ (selected) => !currentAddOns.some((current) => selected.id === current.id)
25757
26151
  );
25758
26152
  const removedAddOns2 = currentAddOns.filter(
25759
26153
  (current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithPrice.some(
@@ -25766,7 +26160,7 @@ var SubscriptionSidebar = forwardRef7(
25766
26160
  removedAddOns: removedAddOns2,
25767
26161
  willAddOnsChange: willAddOnsChange2
25768
26162
  };
25769
- }, [currentAddOns, selectedAddOnsWithPrice, currency]);
26163
+ }, [currentAddOns, selectedAddOnsWithPrice]);
25770
26164
  const addedCreditBundles = useMemo22(
25771
26165
  () => creditBundles.filter((bundle) => bundle.count > 0),
25772
26166
  [creditBundles]
@@ -25792,6 +26186,24 @@ var SubscriptionSidebar = forwardRef7(
25792
26186
  selectedOneTimeAddOns.length,
25793
26187
  addedCreditBundles.length
25794
26188
  ]);
26189
+ const isUnchangedTrial = useMemo22(() => {
26190
+ if (billingSubscription?.status !== "trialing" || !selectedPlan?.current) {
26191
+ return false;
26192
+ }
26193
+ const currentPeriod = getSubscriptionPeriod(billingSubscription);
26194
+ if (currentPeriod && currentPeriod !== planPeriod) {
26195
+ return false;
26196
+ }
26197
+ return !willAddOnsChange && updatedUsageBasedEntitlements.changed.length === 0 && selectedOneTimeAddOns.length === 0 && addedCreditBundles.length === 0;
26198
+ }, [
26199
+ selectedPlan,
26200
+ billingSubscription,
26201
+ planPeriod,
26202
+ willAddOnsChange,
26203
+ updatedUsageBasedEntitlements.changed.length,
26204
+ selectedOneTimeAddOns.length,
26205
+ addedCreditBundles.length
26206
+ ]);
25795
26207
  const discountApplied = useMemo22(
25796
26208
  () => promoCode && (amountOff > 0 || percentOff > 0),
25797
26209
  [promoCode, amountOff, percentOff]
@@ -25985,6 +26397,7 @@ var SubscriptionSidebar = forwardRef7(
25985
26397
  hasIncompleteRequiredCustomFields,
25986
26398
  isCreditOnlyPurchase,
25987
26399
  isOneTimeOnlyPurchase,
26400
+ isUnchangedTrial,
25988
26401
  checkout: handleCheckout
25989
26402
  }
25990
26403
  );
@@ -26030,6 +26443,7 @@ var SubscriptionSidebar = forwardRef7(
26030
26443
  addOnPayInAdvanceEntitlements,
26031
26444
  isCreditOnlyPurchase,
26032
26445
  isOneTimeOnlyPurchase,
26446
+ isUnchangedTrial,
26033
26447
  hasIncompleteRequiredCustomFields
26034
26448
  ]);
26035
26449
  useLayoutEffect6(() => {
@@ -26064,7 +26478,10 @@ var SubscriptionSidebar = forwardRef7(
26064
26478
  subscriptionPrice,
26065
26479
  planPeriod,
26066
26480
  periodStart: renewDate,
26067
- hasUsageBasedCosts: usageBasedEntitlements.length > 0,
26481
+ hasUsageBasedCosts: hasMeteredCosts([
26482
+ ...usageBasedEntitlements,
26483
+ ...addOnUsageBasedEntitlements
26484
+ ]),
26068
26485
  discount: subscriptionDiscount,
26069
26486
  locale
26070
26487
  },
@@ -26076,6 +26493,14 @@ var SubscriptionSidebar = forwardRef7(
26076
26493
  locale
26077
26494
  })
26078
26495
  }) : billingPreviewText;
26496
+ const currentPriceInterval = getSubscriptionInterval(
26497
+ billingSubscription
26498
+ ) ?? { interval: currentPlan?.planPeriod || planPeriod };
26499
+ const currentPriceSuffix = shortenPeriod(
26500
+ currentPriceInterval.interval,
26501
+ t3,
26502
+ currentPriceInterval.intervalCount
26503
+ );
26079
26504
  return /* @__PURE__ */ jsxs32(
26080
26505
  Flex,
26081
26506
  {
@@ -26144,10 +26569,7 @@ var SubscriptionSidebar = forwardRef7(
26144
26569
  }),
26145
26570
  /* @__PURE__ */ jsxs32("sub", { children: [
26146
26571
  "/",
26147
- shortenPeriod(
26148
- getSubscriptionPeriod(billingSubscription) || currentPlan.planPeriod || planPeriod,
26149
- t3
26150
- )
26572
+ currentPriceSuffix
26151
26573
  ] })
26152
26574
  ] }) })
26153
26575
  ]
@@ -26357,7 +26779,7 @@ var SubscriptionSidebar = forwardRef7(
26357
26779
  }),
26358
26780
  addOn.planPeriod !== "one-time" && /* @__PURE__ */ jsxs32("sub", { children: [
26359
26781
  "/",
26360
- shortenPeriod(planPeriod, t3)
26782
+ currentPriceSuffix
26361
26783
  ] })
26362
26784
  ] }) })
26363
26785
  ]
@@ -29522,9 +29944,14 @@ import { forwardRef as forwardRef14, useMemo as useMemo34 } from "react";
29522
29944
 
29523
29945
  // src/components/elements/plan-manager/AddOn.tsx
29524
29946
  import { jsx as jsx62, jsxs as jsxs45 } from "react/jsx-runtime";
29525
- var AddOn = ({ addOn, currency, period, layout }) => {
29947
+ var AddOn = ({
29948
+ addOn,
29949
+ currency,
29950
+ priceInterval,
29951
+ layout
29952
+ }) => {
29526
29953
  const { t: t3, locale } = useTranslation();
29527
- const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
29954
+ const resolvedInterval = addOn.planPeriod === "one-time" ? { interval: addOn.planPeriod } : priceInterval ?? (addOn.planPeriod ? { interval: addOn.planPeriod } : void 0);
29528
29955
  return /* @__PURE__ */ jsxs45(
29529
29956
  Flex,
29530
29957
  {
@@ -29534,9 +29961,13 @@ var AddOn = ({ addOn, currency, period, layout }) => {
29534
29961
  $gap: "1rem",
29535
29962
  children: [
29536
29963
  /* @__PURE__ */ jsx62(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
29537
- typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ jsxs45(Text, { children: [
29964
+ typeof addOn.planPrice === "number" && resolvedInterval && /* @__PURE__ */ jsxs45(Text, { children: [
29538
29965
  formatCurrency(addOn.planPrice, { locale, currency }),
29539
- /* @__PURE__ */ jsx62("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod, t3) : `/${shortenPeriod(resolvedPeriod, t3)}` })
29966
+ /* @__PURE__ */ jsx62("sub", { children: resolvedInterval.interval === "one-time" ? shortenPeriod(resolvedInterval.interval, t3) : `/${shortenPeriod(
29967
+ resolvedInterval.interval,
29968
+ t3,
29969
+ resolvedInterval.intervalCount
29970
+ )}` })
29540
29971
  ] })
29541
29972
  ]
29542
29973
  }
@@ -29837,7 +30268,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
29837
30268
  willSubscriptionCancel,
29838
30269
  isTrialSubscription
29839
30270
  } = useMemo34(() => {
29840
- const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
30271
+ const subscriptionInterval2 = getSubscriptionInterval(billingSubscription);
29841
30272
  const subscriptionCurrency2 = billingSubscription?.currency;
29842
30273
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
29843
30274
  const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
@@ -29849,6 +30280,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
29849
30280
  };
29850
30281
  }, [billingSubscription]);
29851
30282
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
30283
+ const currentPriceInterval = subscriptionInterval ?? (currentPlanPeriod ? { interval: currentPlanPeriod } : void 0);
29852
30284
  const { isFreePlan, isUsageBasedPlan } = useMemo34(() => {
29853
30285
  const isFreePlan2 = currentPlan?.planPrice === 0;
29854
30286
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
@@ -30007,9 +30439,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30007
30439
  })
30008
30440
  }
30009
30441
  ),
30010
- !isFreePlan && currentPlanPeriod && /* @__PURE__ */ jsx64(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
30442
+ !isFreePlan && currentPriceInterval && /* @__PURE__ */ jsx64(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
30011
30443
  "/",
30012
- shortenPeriod(currentPlanPeriod, t3)
30444
+ shortenPeriod(
30445
+ currentPriceInterval.interval,
30446
+ t3,
30447
+ currentPriceInterval.intervalCount
30448
+ )
30013
30449
  ] }) })
30014
30450
  ] })
30015
30451
  ]
@@ -30029,7 +30465,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30029
30465
  {
30030
30466
  addOn,
30031
30467
  currency: subscriptionCurrency,
30032
- period: currentPlanPeriod,
30468
+ priceInterval: currentPriceInterval,
30033
30469
  layout: props
30034
30470
  },
30035
30471
  addOnIndex
@@ -30088,7 +30524,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30088
30524
  resolveLicenseQuantity
30089
30525
  );
30090
30526
  const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
30091
- const creditPeriod = composition.period ?? subscriptionInterval;
30527
+ const creditInterval = composition.period ? { interval: composition.period } : subscriptionInterval;
30092
30528
  const showPerLicense = !!perLicenseGrant && !!licenseFeature;
30093
30529
  return /* @__PURE__ */ jsxs47(
30094
30530
  Flex,
@@ -30118,7 +30554,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30118
30554
  1
30119
30555
  )
30120
30556
  }),
30121
- composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs47(Fragment25, { children: [
30557
+ composition.fixedQuantity > 0 && creditInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
30122
30558
  " ",
30123
30559
  t3("Plus X credits per period", {
30124
30560
  amount: composition.fixedQuantity,
@@ -30127,8 +30563,10 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30127
30563
  locale,
30128
30564
  composition.fixedQuantity
30129
30565
  ),
30130
- period: t3(
30131
- creditPeriod
30566
+ period: nameInterval(
30567
+ creditInterval.interval,
30568
+ t3,
30569
+ creditInterval.intervalCount
30132
30570
  )
30133
30571
  })
30134
30572
  ] })
@@ -30137,11 +30575,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30137
30575
  " ",
30138
30576
  getFeatureName(group, locale, group.total.value),
30139
30577
  " ",
30140
- subscriptionInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
30578
+ creditInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
30141
30579
  t3("per"),
30142
30580
  " ",
30143
- t3(
30144
- subscriptionInterval
30581
+ nameInterval(
30582
+ creditInterval.interval,
30583
+ t3,
30584
+ creditInterval.intervalCount
30145
30585
  )
30146
30586
  ] })
30147
30587
  ] }) }),
@@ -30168,7 +30608,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30168
30608
  ]
30169
30609
  }
30170
30610
  ),
30171
- showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ jsx64(
30611
+ showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditInterval && /* @__PURE__ */ jsx64(
30172
30612
  Text,
30173
30613
  {
30174
30614
  style: { opacity: 0.54 },
@@ -30189,7 +30629,11 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30189
30629
  locale,
30190
30630
  resolvedTotal
30191
30631
  ),
30192
- period: shortenPeriod(creditPeriod, t3)
30632
+ period: shortenPeriod(
30633
+ creditInterval.interval,
30634
+ t3,
30635
+ creditInterval.intervalCount
30636
+ )
30193
30637
  }) : t3("X licenses times Y credits", {
30194
30638
  quantity: licenseQuantity,
30195
30639
  licenseName: getFeatureName(
@@ -30204,7 +30648,11 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
30204
30648
  locale,
30205
30649
  resolvedTotal
30206
30650
  ),
30207
- period: shortenPeriod(creditPeriod, t3)
30651
+ period: shortenPeriod(
30652
+ creditInterval.interval,
30653
+ t3,
30654
+ creditInterval.intervalCount
30655
+ )
30208
30656
  })
30209
30657
  }
30210
30658
  )
@@ -31427,16 +31875,18 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
31427
31875
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
31428
31876
  );
31429
31877
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
31430
- const [selectedCurrency, setSelectedCurrency] = useState21(
31878
+ const [chosenCurrency, setSelectedCurrency] = useState21(
31431
31879
  () => currencies[0] ?? DEFAULT_CURRENCY
31432
31880
  );
31433
- if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
31881
+ if (currencies.length > 0 && !currencies.includes(chosenCurrency)) {
31434
31882
  setSelectedCurrency(currencies[0]);
31435
31883
  }
31884
+ const lockedCurrency = useSubscriptionCurrency();
31885
+ const selectedCurrency = lockedCurrency ?? chosenCurrency;
31436
31886
  const showPeriodToggle = rest.showPeriodToggle ?? data?.displaySettings?.showPeriodToggle ?? true;
31437
31887
  const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
31438
- const showCurrencySelector = currencies.length > 1;
31439
- const hasCurrency = currencies.length > 1 || hasCurrencyFilter;
31888
+ const showCurrencySelector = currencies.length > 1 && !lockedCurrency;
31889
+ const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
31440
31890
  const hasNoUsableCurrency = currencies.length === 0;
31441
31891
  const {
31442
31892
  plans: allPlans,
@@ -31535,6 +31985,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
31535
31985
  options: periods,
31536
31986
  selectedOption: selectedPeriod,
31537
31987
  selectedPlan: currentPlan,
31988
+ currency: hasCurrency ? selectedCurrency : void 0,
31538
31989
  onSelect: (period) => {
31539
31990
  if (period !== selectedPeriod) {
31540
31991
  setSelectedPeriod(period);