@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.
@@ -4707,6 +4707,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
4707
4707
  quantity: json["quantity"],
4708
4708
  subscriptionId: json["subscription_id"],
4709
4709
  subscriptionItemExternalId: json["subscription_item_external_id"] == null ? void 0 : json["subscription_item_external_id"],
4710
+ tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON(json["tiers_mode"]),
4710
4711
  updatedAt: new Date(json["updated_at"]),
4711
4712
  usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
4712
4713
  };
@@ -6184,6 +6185,119 @@ function CompanyCreditBalancesResponseDataFromJSONTyped(json, ignoreDiscriminato
6184
6185
  };
6185
6186
  }
6186
6187
 
6188
+ // src/api/checkoutexternal/models/CompanyCreditLedgerBundleResponseData.ts
6189
+ function CompanyCreditLedgerBundleResponseDataFromJSON(json) {
6190
+ return CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, false);
6191
+ }
6192
+ function CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6193
+ if (json == null) {
6194
+ return json;
6195
+ }
6196
+ return {
6197
+ id: json["id"],
6198
+ name: json["name"]
6199
+ };
6200
+ }
6201
+
6202
+ // src/api/checkoutexternal/models/CompanyCreditLedgerCreditResponseData.ts
6203
+ function CompanyCreditLedgerCreditResponseDataFromJSON(json) {
6204
+ return CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, false);
6205
+ }
6206
+ function CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6207
+ if (json == null) {
6208
+ return json;
6209
+ }
6210
+ return {
6211
+ id: json["id"],
6212
+ name: json["name"],
6213
+ pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
6214
+ singularName: json["singular_name"] == null ? void 0 : json["singular_name"]
6215
+ };
6216
+ }
6217
+
6218
+ // src/api/checkoutexternal/models/CreditUsageReason.ts
6219
+ function CreditUsageReasonFromJSON(json) {
6220
+ return CreditUsageReasonFromJSONTyped(json, false);
6221
+ }
6222
+ function CreditUsageReasonFromJSONTyped(json, ignoreDiscriminator) {
6223
+ return json;
6224
+ }
6225
+
6226
+ // src/api/checkoutexternal/models/CompanyCreditLedgerUserResponseData.ts
6227
+ function CompanyCreditLedgerUserResponseDataFromJSON(json) {
6228
+ return CompanyCreditLedgerUserResponseDataFromJSONTyped(json, false);
6229
+ }
6230
+ function CompanyCreditLedgerUserResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6231
+ if (json == null) {
6232
+ return json;
6233
+ }
6234
+ return {
6235
+ id: json["id"],
6236
+ name: json["name"]
6237
+ };
6238
+ }
6239
+
6240
+ // src/api/checkoutexternal/models/CompanyCreditLedgerFeatureResponseData.ts
6241
+ function CompanyCreditLedgerFeatureResponseDataFromJSON(json) {
6242
+ return CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, false);
6243
+ }
6244
+ function CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6245
+ if (json == null) {
6246
+ return json;
6247
+ }
6248
+ return {
6249
+ id: json["id"],
6250
+ name: json["name"]
6251
+ };
6252
+ }
6253
+
6254
+ // src/api/checkoutexternal/models/CreditLedgerEntryKind.ts
6255
+ function CreditLedgerEntryKindFromJSON(json) {
6256
+ return CreditLedgerEntryKindFromJSONTyped(json, false);
6257
+ }
6258
+ function CreditLedgerEntryKindFromJSONTyped(json, ignoreDiscriminator) {
6259
+ return json;
6260
+ }
6261
+
6262
+ // src/api/checkoutexternal/models/CompanyCreditLedgerEntryResponseData.ts
6263
+ function CompanyCreditLedgerEntryResponseDataFromJSON(json) {
6264
+ return CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, false);
6265
+ }
6266
+ function CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6267
+ if (json == null) {
6268
+ return json;
6269
+ }
6270
+ return {
6271
+ amount: json["amount"],
6272
+ bundle: json["bundle"] == null ? void 0 : CompanyCreditLedgerBundleResponseDataFromJSON(json["bundle"]),
6273
+ credit: CompanyCreditLedgerCreditResponseDataFromJSON(json["credit"]),
6274
+ eventAt: new Date(json["event_at"]),
6275
+ feature: json["feature"] == null ? void 0 : CompanyCreditLedgerFeatureResponseDataFromJSON(json["feature"]),
6276
+ grantReason: json["grant_reason"] == null ? void 0 : BillingCreditGrantReasonFromJSON(json["grant_reason"]),
6277
+ id: json["id"],
6278
+ kind: CreditLedgerEntryKindFromJSON(json["kind"]),
6279
+ usageReason: json["usage_reason"] == null ? void 0 : CreditUsageReasonFromJSON(json["usage_reason"]),
6280
+ user: json["user"] == null ? void 0 : CompanyCreditLedgerUserResponseDataFromJSON(json["user"]),
6281
+ zeroedOutReason: json["zeroed_out_reason"] == null ? void 0 : BillingCreditGrantZeroedOutReasonFromJSON(json["zeroed_out_reason"])
6282
+ };
6283
+ }
6284
+
6285
+ // src/api/checkoutexternal/models/CompanyCreditLedgerResponseData.ts
6286
+ function CompanyCreditLedgerResponseDataFromJSON(json) {
6287
+ return CompanyCreditLedgerResponseDataFromJSONTyped(json, false);
6288
+ }
6289
+ function CompanyCreditLedgerResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6290
+ if (json == null) {
6291
+ return json;
6292
+ }
6293
+ return {
6294
+ entries: json["entries"].map(
6295
+ CompanyCreditLedgerEntryResponseDataFromJSON
6296
+ ),
6297
+ nextCursor: json["next_cursor"] == null ? void 0 : json["next_cursor"]
6298
+ };
6299
+ }
6300
+
6187
6301
  // src/api/checkoutexternal/models/CompanyCreditUserUsageRowResponseData.ts
6188
6302
  function CompanyCreditUserUsageRowResponseDataFromJSON(json) {
6189
6303
  return CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, false);
@@ -6417,7 +6531,9 @@ function ScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator)
6417
6531
  fromSubscriptionPrice: json["from_subscription_price"],
6418
6532
  id: json["id"],
6419
6533
  interval: json["interval"],
6534
+ intervalCount: json["interval_count"],
6420
6535
  scheduledInterval: json["scheduled_interval"] == null ? void 0 : json["scheduled_interval"],
6536
+ scheduledIntervalCount: json["scheduled_interval_count"] == null ? void 0 : json["scheduled_interval_count"],
6421
6537
  scheduledPrice: json["scheduled_price"] == null ? void 0 : json["scheduled_price"],
6422
6538
  toPlanId: json["to_plan_id"],
6423
6539
  toPlanName: json["to_plan_name"]
@@ -7573,6 +7689,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator)
7573
7689
  };
7574
7690
  }
7575
7691
 
7692
+ // src/api/checkoutexternal/models/RenewalDestinationResponseData.ts
7693
+ function RenewalDestinationResponseDataFromJSON(json) {
7694
+ return RenewalDestinationResponseDataFromJSONTyped(json, false);
7695
+ }
7696
+ function RenewalDestinationResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7697
+ if (json == null) {
7698
+ return json;
7699
+ }
7700
+ return {
7701
+ billingPeriod: PlanPriceCadenceFromJSON(json["billing_period"]),
7702
+ planId: json["plan_id"]
7703
+ };
7704
+ }
7705
+
7576
7706
  // src/api/checkoutexternal/models/RenewalPolicy.ts
7577
7707
  function RenewalPolicyFromJSON(json) {
7578
7708
  return RenewalPolicyFromJSONTyped(json, false);
@@ -7598,6 +7728,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7598
7728
  name: json["name"],
7599
7729
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
7600
7730
  planType: PlanTypeFromJSON(json["plan_type"]),
7731
+ renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON(json["renewal_destination"]),
7601
7732
  renewalPolicy: RenewalPolicyFromJSON(json["renewal_policy"]),
7602
7733
  status: PlanVersionStatusFromJSON(json["status"]),
7603
7734
  updatedAt: new Date(json["updated_at"]),
@@ -7801,6 +7932,7 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
7801
7932
  ),
7802
7933
  expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
7803
7934
  interval: json["interval"],
7935
+ intervalCount: json["interval_count"] == null ? void 0 : json["interval_count"],
7804
7936
  isInitial: json["is_initial"],
7805
7937
  latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
7806
7938
  pauseBehavior: json["pause_behavior"] == null ? void 0 : BillingSubscriptionPauseBehaviorFromJSON(json["pause_behavior"]),
@@ -8634,6 +8766,36 @@ function GetCompanyCreditBalancesResponseFromJSONTyped(json, ignoreDiscriminator
8634
8766
  };
8635
8767
  }
8636
8768
 
8769
+ // src/api/checkoutexternal/models/GetCompanyCreditLedgerParams.ts
8770
+ function GetCompanyCreditLedgerParamsFromJSON(json) {
8771
+ return GetCompanyCreditLedgerParamsFromJSONTyped(json, false);
8772
+ }
8773
+ function GetCompanyCreditLedgerParamsFromJSONTyped(json, ignoreDiscriminator) {
8774
+ if (json == null) {
8775
+ return json;
8776
+ }
8777
+ return {
8778
+ creditIds: json["credit_ids"] == null ? void 0 : json["credit_ids"],
8779
+ cursor: json["cursor"] == null ? void 0 : json["cursor"],
8780
+ includeGrants: json["include_grants"] == null ? void 0 : json["include_grants"],
8781
+ limit: json["limit"] == null ? void 0 : json["limit"]
8782
+ };
8783
+ }
8784
+
8785
+ // src/api/checkoutexternal/models/GetCompanyCreditLedgerResponse.ts
8786
+ function GetCompanyCreditLedgerResponseFromJSON(json) {
8787
+ return GetCompanyCreditLedgerResponseFromJSONTyped(json, false);
8788
+ }
8789
+ function GetCompanyCreditLedgerResponseFromJSONTyped(json, ignoreDiscriminator) {
8790
+ if (json == null) {
8791
+ return json;
8792
+ }
8793
+ return {
8794
+ data: CompanyCreditLedgerResponseDataFromJSON(json["data"]),
8795
+ params: GetCompanyCreditLedgerParamsFromJSON(json["params"])
8796
+ };
8797
+ }
8798
+
8637
8799
  // src/api/checkoutexternal/models/GetCompanyCreditUserUsageParams.ts
8638
8800
  function GetCompanyCreditUserUsageParamsFromJSON(json) {
8639
8801
  return GetCompanyCreditUserUsageParamsFromJSONTyped(json, false);
@@ -9173,6 +9335,7 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
9173
9335
  proration: json["proration"],
9174
9336
  scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
9175
9337
  trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
9338
+ unbilledUsageFeatureIds: json["unbilled_usage_feature_ids"],
9176
9339
  usageViolations: json["usage_violations"].map(
9177
9340
  FeatureUsageResponseDataFromJSON
9178
9341
  )
@@ -10008,6 +10171,55 @@ var CheckoutexternalApi = class extends BaseAPI {
10008
10171
  const response = await this.getCompanyCreditBalancesRaw(initOverrides);
10009
10172
  return await response.value();
10010
10173
  }
10174
+ /**
10175
+ * 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.
10176
+ * List credit activity
10177
+ */
10178
+ async getCompanyCreditLedgerRaw(requestParameters, initOverrides) {
10179
+ const queryParameters = {};
10180
+ if (requestParameters["creditIds"] != null) {
10181
+ queryParameters["credit_ids"] = requestParameters["creditIds"];
10182
+ }
10183
+ if (requestParameters["cursor"] != null) {
10184
+ queryParameters["cursor"] = requestParameters["cursor"];
10185
+ }
10186
+ if (requestParameters["includeGrants"] != null) {
10187
+ queryParameters["include_grants"] = requestParameters["includeGrants"];
10188
+ }
10189
+ if (requestParameters["limit"] != null) {
10190
+ queryParameters["limit"] = requestParameters["limit"];
10191
+ }
10192
+ const headerParameters = {};
10193
+ if (this.configuration && this.configuration.apiKey) {
10194
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
10195
+ "X-Schematic-Api-Key"
10196
+ );
10197
+ }
10198
+ const response = await this.request(
10199
+ {
10200
+ path: `/company/credits/ledger`,
10201
+ method: "GET",
10202
+ headers: headerParameters,
10203
+ query: queryParameters
10204
+ },
10205
+ initOverrides
10206
+ );
10207
+ return new JSONApiResponse(
10208
+ response,
10209
+ (jsonValue) => GetCompanyCreditLedgerResponseFromJSON(jsonValue)
10210
+ );
10211
+ }
10212
+ /**
10213
+ * 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.
10214
+ * List credit activity
10215
+ */
10216
+ async getCompanyCreditLedger(requestParameters = {}, initOverrides) {
10217
+ const response = await this.getCompanyCreditLedgerRaw(
10218
+ requestParameters,
10219
+ initOverrides
10220
+ );
10221
+ return await response.value();
10222
+ }
10011
10223
  /**
10012
10224
  * Who in the company consumed the credit, and how much each.
10013
10225
  * List credit usage by user
@@ -11484,9 +11696,9 @@ function BillingPriceUsageTypeFromJSONTyped5(json, ignoreDiscriminator) {
11484
11696
 
11485
11697
  // src/api/componentspublic/models/BillingTiersMode.ts
11486
11698
  function BillingTiersModeFromJSON2(json) {
11487
- return BillingTiersModeFromJSONTyped6(json, false);
11699
+ return BillingTiersModeFromJSONTyped7(json, false);
11488
11700
  }
11489
- function BillingTiersModeFromJSONTyped6(json, ignoreDiscriminator) {
11701
+ function BillingTiersModeFromJSONTyped7(json, ignoreDiscriminator) {
11490
11702
  return json;
11491
11703
  }
11492
11704
 
@@ -11762,9 +11974,9 @@ function ChargeTypeFromJSONTyped7(json, ignoreDiscriminator) {
11762
11974
 
11763
11975
  // src/api/componentspublic/models/PlanPriceCadence.ts
11764
11976
  function PlanPriceCadenceFromJSON2(json) {
11765
- return PlanPriceCadenceFromJSONTyped7(json, false);
11977
+ return PlanPriceCadenceFromJSONTyped8(json, false);
11766
11978
  }
11767
- function PlanPriceCadenceFromJSONTyped7(json, ignoreDiscriminator) {
11979
+ function PlanPriceCadenceFromJSONTyped8(json, ignoreDiscriminator) {
11768
11980
  return json;
11769
11981
  }
11770
11982
 
@@ -12393,6 +12605,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
12393
12605
  };
12394
12606
  }
12395
12607
 
12608
+ // src/api/componentspublic/models/RenewalDestinationResponseData.ts
12609
+ function RenewalDestinationResponseDataFromJSON2(json) {
12610
+ return RenewalDestinationResponseDataFromJSONTyped3(json, false);
12611
+ }
12612
+ function RenewalDestinationResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
12613
+ if (json == null) {
12614
+ return json;
12615
+ }
12616
+ return {
12617
+ billingPeriod: PlanPriceCadenceFromJSON2(json["billing_period"]),
12618
+ planId: json["plan_id"]
12619
+ };
12620
+ }
12621
+
12396
12622
  // src/api/componentspublic/models/RenewalPolicy.ts
12397
12623
  function RenewalPolicyFromJSON2(json) {
12398
12624
  return RenewalPolicyFromJSONTyped3(json, false);
@@ -12418,6 +12644,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
12418
12644
  name: json["name"],
12419
12645
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
12420
12646
  planType: PlanTypeFromJSON2(json["plan_type"]),
12647
+ renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON2(json["renewal_destination"]),
12421
12648
  renewalPolicy: RenewalPolicyFromJSON2(json["renewal_policy"]),
12422
12649
  status: PlanVersionStatusFromJSON2(json["status"]),
12423
12650
  updatedAt: new Date(json["updated_at"]),
@@ -12986,7 +13213,7 @@ function resolveLocale(locale) {
12986
13213
  return locale !== void 0 && locale !== "" && isUsableLocale(locale) ? locale : DEFAULT_LOCALE;
12987
13214
  }
12988
13215
 
12989
- // node_modules/.pnpm/i18next@27.0.0_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
13216
+ // node_modules/.pnpm/i18next@27.1.2_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
12990
13217
  var isString = (obj) => typeof obj === "string";
12991
13218
  var defer = () => {
12992
13219
  let res;
@@ -13582,7 +13809,8 @@ var Translator = class _Translator extends EventEmitter {
13582
13809
  ordinal: false
13583
13810
  }) : "";
13584
13811
  const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
13585
- const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
13812
+ const sep = this.options.pluralSeparator;
13813
+ 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));
13586
13814
  let resForObjHndl = res;
13587
13815
  if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
13588
13816
  resForObjHndl = defaultValue;
@@ -13736,7 +13964,7 @@ var Translator = class _Translator extends EventEmitter {
13736
13964
  const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
13737
13965
  let nestBef;
13738
13966
  if (skipOnVariables) {
13739
- const nb = res.match(this.interpolator.nestingRegexp);
13967
+ const nb = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
13740
13968
  nestBef = nb && nb.length;
13741
13969
  }
13742
13970
  let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
@@ -13746,7 +13974,7 @@ var Translator = class _Translator extends EventEmitter {
13746
13974
  };
13747
13975
  res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
13748
13976
  if (skipOnVariables) {
13749
- const na = res.match(this.interpolator.nestingRegexp);
13977
+ const na = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
13750
13978
  const nestAft = na && na.length;
13751
13979
  if (nestBef < nestAft) opt.nest = false;
13752
13980
  }
@@ -13843,6 +14071,15 @@ var Translator = class _Translator extends EventEmitter {
13843
14071
  }
13844
14072
  }
13845
14073
  }
14074
+ if (needsPluralHandling) {
14075
+ const otherSuffix = `${opt.ordinal ? ordinalPrefix : this.options.pluralSeparator}other`;
14076
+ if (pluralSuffix !== otherSuffix) {
14077
+ if (needsContextHandling) {
14078
+ finalKeys.unshift(`${key}${this.options.contextSeparator || "_"}${opt.context}${otherSuffix}`);
14079
+ }
14080
+ finalKeys.unshift(key + otherSuffix);
14081
+ }
14082
+ }
13846
14083
  }
13847
14084
  let possibleKey;
13848
14085
  while (possibleKey = finalKeys.pop()) {
@@ -14045,6 +14282,7 @@ var LanguageUtil = class {
14045
14282
  if (!codes.includes(formattedFc)) addCode(formattedFc);
14046
14283
  });
14047
14284
  if (cacheKey !== null) {
14285
+ if (Object.keys(this.resolveHierarchyCache).length >= 1e3) this.resolveHierarchyCache = {};
14048
14286
  this.resolveHierarchyCache[cacheKey] = codes;
14049
14287
  return codes.slice();
14050
14288
  }
@@ -14099,6 +14337,7 @@ var PluralResolver = class {
14099
14337
  const lngPart = this.languageUtils.getLanguagePartFromCode(code);
14100
14338
  rule = this.getRule(lngPart, options);
14101
14339
  }
14340
+ if (Object.keys(this.pluralRulesCache).length >= 1e3) this.pluralRulesCache = {};
14102
14341
  this.pluralRulesCache[cacheKey] = rule;
14103
14342
  return rule;
14104
14343
  }
@@ -14167,6 +14406,8 @@ var Interpolator = class {
14167
14406
  this.formatSeparator = formatSeparator || ",";
14168
14407
  this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix ? regexEscape(unescapePrefix) : "-";
14169
14408
  this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix ? regexEscape(unescapeSuffix) : "";
14409
+ this.prefixText = prefix2 || "{{";
14410
+ this.nestingPrefixText = nestingPrefix || "$t(";
14170
14411
  this.nestingPrefix = regexEscape(nestingPrefix || "$t(");
14171
14412
  this.nestingSuffix = regexEscape(nestingSuffix || ")");
14172
14413
  this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
@@ -14219,6 +14460,7 @@ var Interpolator = class {
14219
14460
  }
14220
14461
  const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
14221
14462
  const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
14463
+ if (isString(str) && !str.includes(this.prefixText)) return str;
14222
14464
  const todos = [{
14223
14465
  regex: this.regexpUnescape,
14224
14466
  safeValue: (val) => val
@@ -14308,6 +14550,7 @@ var Interpolator = class {
14308
14550
  if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
14309
14551
  return key;
14310
14552
  };
14553
+ if (isString(str) && !str.includes(this.nestingPrefixText)) return str;
14311
14554
  const nestingRegexp = new RegExp(this.nestingRegexp);
14312
14555
  let out = "";
14313
14556
  let lastEnd = 0;
@@ -14375,8 +14618,9 @@ var parseFormatStr = (formatStr) => {
14375
14618
  formatOptions
14376
14619
  };
14377
14620
  };
14621
+ var cachedFormattersLimit = 1e3;
14378
14622
  var createCachedFormatter = (fn) => {
14379
- const cache = {};
14623
+ const cache = /* @__PURE__ */ new Map();
14380
14624
  return (v2, l2, o) => {
14381
14625
  let optForCache = o;
14382
14626
  if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
@@ -14391,10 +14635,11 @@ var createCachedFormatter = (fn) => {
14391
14635
  } catch (e) {
14392
14636
  return fn(getCleanedCode(l2), o)(v2);
14393
14637
  }
14394
- let frm = cache[key];
14638
+ let frm = cache.get(key);
14395
14639
  if (!frm) {
14396
14640
  frm = fn(getCleanedCode(l2), o);
14397
- cache[key] = frm;
14641
+ if (cache.size >= cachedFormattersLimit) cache.delete(cache.keys().next().value);
14642
+ cache.set(key, frm);
14398
14643
  }
14399
14644
  return frm(v2);
14400
14645
  };
@@ -14491,6 +14736,7 @@ var Formatter = class {
14491
14736
  return result;
14492
14737
  }
14493
14738
  };
14739
+ var maxFailedLoads = 1e3;
14494
14740
  var removePending = (q2, name) => {
14495
14741
  if (q2.pending[name] !== void 0) {
14496
14742
  delete q2.pending[name];
@@ -14512,6 +14758,7 @@ var Connector = class extends EventEmitter {
14512
14758
  this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
14513
14759
  this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
14514
14760
  this.state = {};
14761
+ this.failed = /* @__PURE__ */ new Set();
14515
14762
  this.queue = [];
14516
14763
  this.backend?.init?.(services, options.backend, options);
14517
14764
  this.callbackApi = callbackApiOf(this.backend);
@@ -14571,6 +14818,15 @@ var Connector = class extends EventEmitter {
14571
14818
  }
14572
14819
  this.state[name] = err ? -1 : 2;
14573
14820
  if (err && data) this.state[name] = 0;
14821
+ this.failed.delete(name);
14822
+ if (err) {
14823
+ this.failed.add(name);
14824
+ if (this.failed.size > maxFailedLoads) {
14825
+ const oldest = this.failed.values().next().value;
14826
+ this.failed.delete(oldest);
14827
+ if (this.state[oldest] < 1) delete this.state[oldest];
14828
+ }
14829
+ }
14574
14830
  const loaded = {};
14575
14831
  this.queue.forEach((q2) => {
14576
14832
  pushPath(q2.loaded, [lng], ns);
@@ -15661,6 +15917,19 @@ var en = {
15661
15917
  "mo": "mo",
15662
15918
  "qtr": "qtr",
15663
15919
  "yr": "yr",
15920
+ "wk": "wk",
15921
+ "X days short": "{{amount, number}}d",
15922
+ "X weeks short": "{{amount, number}}wk",
15923
+ "X months short": "{{amount, number}}mo",
15924
+ "X years short": "{{amount, number}}yr",
15925
+ "X days_one": "{{count, number}} day",
15926
+ "X days_other": "{{count, number}} days",
15927
+ "X weeks_one": "{{count, number}} week",
15928
+ "X weeks_other": "{{count, number}} weeks",
15929
+ "X months_one": "{{count, number}} month",
15930
+ "X months_other": "{{count, number}} months",
15931
+ "X years_one": "{{count, number}} year",
15932
+ "X years_other": "{{count, number}} years",
15664
15933
  "one time": "one time",
15665
15934
  "billing period": "billing period",
15666
15935
  "billing period_one": "billing period",
@@ -15670,6 +15939,7 @@ var en = {
15670
15939
  "monthly": "monthly",
15671
15940
  "quarterly": "quarterly",
15672
15941
  "yearly": "yearly",
15942
+ "every period": "every {{period}}",
15673
15943
  "expires after purchase": "expires {{amount}} {{unit}} after purchase",
15674
15944
  "expires at the end of the billing period": "expires at the end of the billing period",
15675
15945
  "expires at the end of the next billing period": "expires at the end of the next billing period",
@@ -15972,6 +16242,23 @@ var it2 = {
15972
16242
  "mo": "mese",
15973
16243
  "qtr": "trim.",
15974
16244
  "yr": "anno",
16245
+ "wk": "sett.",
16246
+ "X days short": "{{amount, number}} gg",
16247
+ "X weeks short": "{{amount, number}} sett.",
16248
+ "X months short": "{{amount, number}} mesi",
16249
+ "X years short": "{{amount, number}} anni",
16250
+ "X days_one": "{{count, number}} giorno",
16251
+ "X days_many": "{{count, number}} giorni",
16252
+ "X days_other": "{{count, number}} giorni",
16253
+ "X weeks_one": "{{count, number}} settimana",
16254
+ "X weeks_many": "{{count, number}} settimane",
16255
+ "X weeks_other": "{{count, number}} settimane",
16256
+ "X months_one": "{{count, number}} mese",
16257
+ "X months_many": "{{count, number}} mesi",
16258
+ "X months_other": "{{count, number}} mesi",
16259
+ "X years_one": "{{count, number}} anno",
16260
+ "X years_many": "{{count, number}} anni",
16261
+ "X years_other": "{{count, number}} anni",
15975
16262
  "one time": "una tantum",
15976
16263
  "billing period": "periodo di fatturazione",
15977
16264
  "billing period_one": "periodo di fatturazione",
@@ -16005,6 +16292,7 @@ var it2 = {
16005
16292
  "monthly": "mensile",
16006
16293
  "quarterly": "trimestrale",
16007
16294
  "yearly": "annuale",
16295
+ "every period": "ogni {{period}}",
16008
16296
  "Usage by user": "Utilizzo per utente",
16009
16297
  "X used by your team this period": "{{amount}} utilizzati dal tuo team in questo periodo",
16010
16298
  "Show all X users_one": "Mostra {{count, number}} utente",
@@ -16198,14 +16486,24 @@ function derivePeriod(interval, intervalCount) {
16198
16486
  }
16199
16487
  return interval;
16200
16488
  }
16201
- function getSubscriptionPeriod(billingSubscription) {
16489
+ function getSubscriptionInterval(billingSubscription) {
16202
16490
  if (!billingSubscription) {
16203
16491
  return void 0;
16204
16492
  }
16205
16493
  const product = billingSubscription.products?.find(
16206
16494
  (p2) => p2.interval && p2.interval !== "one-time"
16207
16495
  );
16208
- return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
16496
+ if (product?.interval) {
16497
+ return { interval: product.interval, intervalCount: product.intervalCount };
16498
+ }
16499
+ return billingSubscription.interval ? { interval: billingSubscription.interval } : void 0;
16500
+ }
16501
+ function getSubscriptionPeriod(billingSubscription) {
16502
+ const subscriptionInterval = getSubscriptionInterval(billingSubscription);
16503
+ return derivePeriod(
16504
+ subscriptionInterval?.interval,
16505
+ subscriptionInterval?.intervalCount
16506
+ );
16209
16507
  }
16210
16508
  function getDefaultPlanPeriod(plans = []) {
16211
16509
  if (plans.some((plan) => plan.monthlyPrice)) return "month";
@@ -16478,6 +16776,8 @@ function getResetCadencePeriod(cadence) {
16478
16776
  switch (cadence) {
16479
16777
  case BillingPlanCreditGrantResetCadence.Yearly:
16480
16778
  return "year";
16779
+ case BillingPlanCreditGrantResetCadence.Quarterly:
16780
+ return "quarter";
16481
16781
  case BillingPlanCreditGrantResetCadence.Monthly:
16482
16782
  return "month";
16483
16783
  case BillingPlanCreditGrantResetCadence.Weekly:
@@ -16967,6 +17267,11 @@ function getEntitlementFeatureName(entitlement, defaultValue) {
16967
17267
  function entitlementHasCost(entitlement) {
16968
17268
  return entitlement.priceBehavior && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && entitlement.quantity > 0 || entitlement.priceBehavior !== EntitlementPriceBehavior.PayInAdvance);
16969
17269
  }
17270
+ function hasMeteredCosts(entitlements) {
17271
+ return entitlements.some(
17272
+ ({ priceBehavior }) => !!priceBehavior && priceBehavior !== EntitlementPriceBehavior.PayInAdvance && priceBehavior !== EntitlementPriceBehavior.CreditBurndown
17273
+ );
17274
+ }
16970
17275
  function entitlementHasHardLimit(entitlement) {
16971
17276
  return entitlement.priceBehavior && entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown;
16972
17277
  }
@@ -17116,8 +17421,38 @@ function getMonthName(date, { locale, ...format }) {
17116
17421
  ...format
17117
17422
  }).format(new Date(date));
17118
17423
  }
17119
- function shortenPeriod(period, t3) {
17120
- switch (period) {
17424
+ var QUARTERLY_INTERVAL_COUNT = 3;
17425
+ var YEARLY_INTERVAL_COUNT = 12;
17426
+ function normalizeInterval(interval, intervalCount) {
17427
+ const count = intervalCount && intervalCount > 1 ? intervalCount : 1;
17428
+ if (interval === "month" && count === QUARTERLY_INTERVAL_COUNT) {
17429
+ return { period: "quarter", count: 1 };
17430
+ }
17431
+ if (interval === "month" && count === YEARLY_INTERVAL_COUNT) {
17432
+ return { period: "year", count: 1 };
17433
+ }
17434
+ return { period: interval, count };
17435
+ }
17436
+ function shortenPeriod(period, t3, intervalCount) {
17437
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17438
+ if (count > 1) {
17439
+ switch (unit) {
17440
+ case "day":
17441
+ return t3("X days short", { amount: count });
17442
+ case "week":
17443
+ return t3("X weeks short", { amount: count });
17444
+ case "month":
17445
+ return t3("X months short", { amount: count });
17446
+ case "year":
17447
+ return t3("X years short", { amount: count });
17448
+ }
17449
+ return;
17450
+ }
17451
+ switch (unit) {
17452
+ case "day":
17453
+ return t3("day");
17454
+ case "week":
17455
+ return t3("wk");
17121
17456
  case "month":
17122
17457
  return t3("mo");
17123
17458
  case "quarter":
@@ -17126,6 +17461,31 @@ function shortenPeriod(period, t3) {
17126
17461
  return t3("yr");
17127
17462
  }
17128
17463
  }
17464
+ function nameInterval(period, t3, intervalCount) {
17465
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17466
+ if (count > 1) {
17467
+ switch (unit) {
17468
+ case "day":
17469
+ return t3("X days", { count });
17470
+ case "week":
17471
+ return t3("X weeks", { count });
17472
+ case "month":
17473
+ return t3("X months", { count });
17474
+ case "year":
17475
+ return t3("X years", { count });
17476
+ }
17477
+ return period;
17478
+ }
17479
+ switch (unit) {
17480
+ case "day":
17481
+ case "week":
17482
+ case "month":
17483
+ case "quarter":
17484
+ case "year":
17485
+ return t3(unit);
17486
+ }
17487
+ return period;
17488
+ }
17129
17489
  function modifyDate(date, days) {
17130
17490
  const copy3 = new Date(date);
17131
17491
  copy3.setDate(copy3.getDate() + days);
@@ -17208,8 +17568,14 @@ function formatCurrency(amount, {
17208
17568
  function formatOrdinal(n2, t3) {
17209
17569
  return t3("Ordinal", { count: n2, ordinal: true });
17210
17570
  }
17211
- function adjectify(period, t3) {
17212
- switch (period) {
17571
+ function adjectify(period, t3, intervalCount) {
17572
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17573
+ if (count > 1) {
17574
+ return t3("every period", {
17575
+ period: nameInterval(period, t3, intervalCount)
17576
+ });
17577
+ }
17578
+ switch (unit) {
17213
17579
  case "day":
17214
17580
  return t3("daily");
17215
17581
  case "week":
@@ -18163,7 +18529,7 @@ var reducer = (state, action) => {
18163
18529
  // src/context/EmbedProvider.tsx
18164
18530
  var import_jsx_runtime4 = require("react/jsx-runtime");
18165
18531
  var getCustomHeaders = (sessionId) => ({
18166
- "X-Schematic-Components-Version": "2.38.0",
18532
+ "X-Schematic-Components-Version": "2.39.0",
18167
18533
  "X-Schematic-Session-ID": sessionId
18168
18534
  });
18169
18535
  var normalizeCurrencyFilter = (filter2) => {
@@ -18890,10 +19256,10 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
18890
19256
  return periods;
18891
19257
  }, [data?.activePlans, data?.activeAddOns]);
18892
19258
  const getActivePlans = (0, import_react8.useCallback)(
18893
- (plans) => {
19259
+ (plans, period = activePeriod) => {
18894
19260
  const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
18895
19261
  if (options.useSelectedPeriod) {
18896
- return activePeriod === "month" && plan.monthlyPrice || activePeriod === "quarter" && plan.quarterlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
19262
+ return period === "month" && plan.monthlyPrice || period === "quarter" && plan.quarterlyPrice || period === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
18897
19263
  }
18898
19264
  return plan.monthlyPrice || plan.quarterlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
18899
19265
  });
@@ -18905,7 +19271,8 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
18905
19271
  return {
18906
19272
  plans: getActivePlans(data?.activePlans || []),
18907
19273
  addOns: getActivePlans(data?.activeAddOns || []),
18908
- periods: getAvailablePeriods()
19274
+ periods: getAvailablePeriods(),
19275
+ plansForPeriod: (period) => getActivePlans(data?.activePlans || [], period)
18909
19276
  };
18910
19277
  }, [
18911
19278
  data?.activePlans,
@@ -22604,28 +22971,49 @@ var CheckoutDialog = ({ top }) => {
22604
22971
  }
22605
22972
  }, [filterBlocksSubscriptionCurrency, lockedCurrency, debug]);
22606
22973
  const {
22607
- plans: availablePlans,
22974
+ plans: periodPlans,
22608
22975
  addOns: availableAddOns,
22609
- periods: availablePeriods
22976
+ periods: availablePeriods,
22977
+ plansForPeriod
22610
22978
  } = useAvailablePlans(planPeriod, {
22611
22979
  useSelectedPeriod: showPeriodToggle
22612
22980
  });
22613
- const [selectedPlanId, setSelectedPlanId] = (0, import_react30.useState)(void 0);
22614
- const selectedPlan = (0, import_react30.useMemo)(() => {
22615
- if (selectedPlanId === null) {
22616
- return void 0;
22617
- }
22618
- if (selectedPlanId) {
22619
- return availablePlans.find((p2) => p2.id === selectedPlanId);
22620
- }
22621
- if (checkoutState?.planId) {
22622
- return availablePlans.find((plan) => plan.id === checkoutState.planId);
22623
- }
22624
- return availablePlans.find(
22625
- (plan) => plan.current && // do not initially set the current plan for a trial
22626
- (!plan.isTrialable || !plan.companyCanTrial)
22627
- );
22628
- }, [availablePlans, checkoutState, selectedPlanId]);
22981
+ const requestedPlanId = checkoutState?.planId;
22982
+ const bypassPlanSelection = checkoutState?.bypassPlanSelection;
22983
+ const supportsCheckoutCurrency = (0, import_react30.useCallback)(
22984
+ (plan) => !hasCurrency || planSupportsCurrency(plan, effectiveCurrency) || // A plan the host picks and skips past is kept so the currency/period
22985
+ // mismatch notice can say it is unavailable.
22986
+ !!bypassPlanSelection && plan.id === requestedPlanId,
22987
+ [hasCurrency, effectiveCurrency, bypassPlanSelection, requestedPlanId]
22988
+ );
22989
+ const availablePlans = (0, import_react30.useMemo)(
22990
+ () => periodPlans.filter(supportsCheckoutCurrency),
22991
+ [periodPlans, supportsCheckoutCurrency]
22992
+ );
22993
+ const [selectedPlanId, setSelectedPlanId] = (0, import_react30.useState)(
22994
+ void 0
22995
+ );
22996
+ const isTrialing = data?.company?.billingSubscription?.status === "trialing";
22997
+ const findSelectedPlan = (0, import_react30.useCallback)(
22998
+ (plans) => {
22999
+ if (selectedPlanId) {
23000
+ return plans.find((p2) => p2.id === selectedPlanId);
23001
+ }
23002
+ if (requestedPlanId) {
23003
+ return plans.find((plan) => plan.id === requestedPlanId);
23004
+ }
23005
+ return plans.find(
23006
+ (plan) => plan.current && // A company that could trial its current plan chooses for itself,
23007
+ // unless it is already trialing it.
23008
+ (isTrialing || !plan.isTrialable || !plan.companyCanTrial)
23009
+ );
23010
+ },
23011
+ [requestedPlanId, selectedPlanId, isTrialing]
23012
+ );
23013
+ const selectedPlan = (0, import_react30.useMemo)(
23014
+ () => findSelectedPlan(availablePlans),
23015
+ [availablePlans, findSelectedPlan]
23016
+ );
22629
23017
  const [shouldTrial, setShouldTrial] = (0, import_react30.useState)(false);
22630
23018
  const displayedPlanCreditGrants = (0, import_react30.useMemo)(
22631
23019
  () => getDisplayedPlanCreditGrants(selectedPlan),
@@ -22991,7 +23379,7 @@ var CheckoutDialog = ({ top }) => {
22991
23379
  }, [currencies, selectedPlan, planPeriod]);
22992
23380
  const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
22993
23381
  const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
22994
- const currencyPeriodMismatch = hasCurrency && !lockedCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
23382
+ const currencyPeriodMismatch = hasCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
22995
23383
  (0, import_react30.useEffect)(() => {
22996
23384
  if (currencyPeriodMismatch) {
22997
23385
  console.error(
@@ -23043,7 +23431,6 @@ var CheckoutDialog = ({ top }) => {
23043
23431
  if (isBypassLoading) {
23044
23432
  setIsBypassLoading(false);
23045
23433
  }
23046
- setSelectedPlanId(null);
23047
23434
  return;
23048
23435
  }
23049
23436
  const requestId = ++previewRequestIdRef.current;
@@ -23282,7 +23669,8 @@ var CheckoutDialog = ({ top }) => {
23282
23669
  }
23283
23670
  const updatedShouldTrial = updates.shouldTrial ?? shouldTrial;
23284
23671
  setShouldTrial(updatedShouldTrial);
23285
- if (willTrialWithoutPaymentMethod) {
23672
+ const updatedWillTrialWithoutPaymentMethod = updatedShouldTrial && !trialPaymentMethodRequired;
23673
+ if (updatedWillTrialWithoutPaymentMethod) {
23286
23674
  setSelectedAddOnIds(/* @__PURE__ */ new Set());
23287
23675
  }
23288
23676
  const resolvedCreditBundles = (data?.creditBundles ?? []).map(
@@ -23295,14 +23683,10 @@ var CheckoutDialog = ({ top }) => {
23295
23683
  period,
23296
23684
  plan,
23297
23685
  shouldTrial: updatedShouldTrial,
23298
- ...willTrialWithoutPaymentMethod ? {
23299
- addOns: [],
23300
- payInAdvanceEntitlements: []
23301
- } : {
23302
- payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
23303
- ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
23304
- )
23305
- },
23686
+ ...updatedWillTrialWithoutPaymentMethod && { addOns: [] },
23687
+ payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
23688
+ ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
23689
+ ),
23306
23690
  creditBundles: resolvedCreditBundles
23307
23691
  });
23308
23692
  },
@@ -23314,7 +23698,7 @@ var CheckoutDialog = ({ top }) => {
23314
23698
  featureUsage,
23315
23699
  bundleCounts,
23316
23700
  shouldTrial,
23317
- willTrialWithoutPaymentMethod,
23701
+ trialPaymentMethodRequired,
23318
23702
  handlePreviewCheckout,
23319
23703
  checkoutState?.payInAdvanceQuantities
23320
23704
  ]
@@ -23325,40 +23709,42 @@ var CheckoutDialog = ({ top }) => {
23325
23709
  return;
23326
23710
  }
23327
23711
  setPlanPeriod(period);
23328
- const updatedUsageBasedEntitlements = (selectedPlan?.entitlements || []).reduce(
23329
- createActiveUsageBasedEntitlementsReducer(featureUsage, period),
23330
- [...[]]
23331
- );
23332
- setUsageBasedEntitlements(
23333
- (prev2) => updatedUsageBasedEntitlements.map((updated) => {
23334
- const current = prev2.find(
23335
- ({ featureId }) => featureId === updated.featureId
23336
- );
23337
- if (typeof current?.quantity === "number") {
23338
- return { ...updated, quantity: current.quantity };
23339
- }
23340
- return updated;
23341
- })
23712
+ const plan = findSelectedPlan(
23713
+ plansForPeriod(period).filter(supportsCheckoutCurrency)
23342
23714
  );
23715
+ const updatedUsageBasedEntitlements = plan ? (plan.entitlements || []).reduce(
23716
+ createActiveUsageBasedEntitlementsReducer(featureUsage, period),
23717
+ []
23718
+ ).map((updated) => {
23719
+ const current = usageBasedEntitlements.find(
23720
+ ({ featureId }) => featureId === updated.featureId
23721
+ );
23722
+ if (typeof current?.quantity === "number") {
23723
+ return { ...updated, quantity: current.quantity };
23724
+ }
23725
+ return updated;
23726
+ }) : usageBasedEntitlements;
23727
+ if (plan) {
23728
+ setUsageBasedEntitlements(updatedUsageBasedEntitlements);
23729
+ }
23343
23730
  const updatedAddOnUsageBasedEntitlements = addOns.filter((addOn) => addOn.isSelected).flatMap(
23344
23731
  (addOn) => (addOn.entitlements ?? []).reduce(
23345
23732
  createActiveUsageBasedEntitlementsReducer(featureUsage, period),
23346
23733
  []
23347
23734
  )
23348
- );
23349
- setAddOnUsageBasedEntitlements(
23350
- (prev2) => updatedAddOnUsageBasedEntitlements.map((updated) => {
23351
- const current = prev2.find(
23352
- ({ featureId }) => featureId === updated.featureId
23353
- );
23354
- if (typeof current?.quantity === "number") {
23355
- return { ...updated, quantity: current.quantity };
23356
- }
23357
- return updated;
23358
- })
23359
- );
23735
+ ).map((updated) => {
23736
+ const current = addOnUsageBasedEntitlements.find(
23737
+ ({ featureId }) => featureId === updated.featureId
23738
+ );
23739
+ if (typeof current?.quantity === "number") {
23740
+ return { ...updated, quantity: current.quantity };
23741
+ }
23742
+ return updated;
23743
+ });
23744
+ setAddOnUsageBasedEntitlements(updatedAddOnUsageBasedEntitlements);
23360
23745
  handlePreviewCheckout({
23361
23746
  period,
23747
+ plan,
23362
23748
  payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
23363
23749
  ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
23364
23750
  ),
@@ -23369,9 +23755,13 @@ var CheckoutDialog = ({ top }) => {
23369
23755
  },
23370
23756
  [
23371
23757
  planPeriod,
23372
- selectedPlan?.entitlements,
23758
+ plansForPeriod,
23759
+ findSelectedPlan,
23760
+ supportsCheckoutCurrency,
23373
23761
  featureUsage,
23762
+ usageBasedEntitlements,
23374
23763
  addOns,
23764
+ addOnUsageBasedEntitlements,
23375
23765
  setPlanPeriod,
23376
23766
  handlePreviewCheckout
23377
23767
  ]
@@ -23515,12 +23905,12 @@ var CheckoutDialog = ({ top }) => {
23515
23905
  }, [setLayout, clearCheckoutState]);
23516
23906
  const hasInitializedPlan = (0, import_react30.useRef)(false);
23517
23907
  (0, import_react30.useEffect)(() => {
23518
- if (!hasInitializedPlan.current && selectedPlan) {
23908
+ if (!hasInitializedPlan.current && selectedPlan && selectedPlanId === void 0) {
23519
23909
  hasInitializedPlan.current = true;
23520
- const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
23910
+ const shouldTrial2 = checkoutState?.startTrialIfAvailable && !(isTrialing && selectedPlan.current) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
23521
23911
  selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
23522
23912
  }
23523
- }, [selectedPlan, planPeriod, selectPlan]);
23913
+ }, [selectedPlan, selectedPlanId, planPeriod, selectPlan]);
23524
23914
  (0, import_react30.useLayoutEffect)(() => {
23525
23915
  const element = dialogRef.current;
23526
23916
  if (layout !== "checkout" || !element) {
@@ -23768,6 +24158,7 @@ var CheckoutDialog = ({ top }) => {
23768
24158
  options: availablePeriods,
23769
24159
  selectedOption: planPeriod,
23770
24160
  selectedPlan,
24161
+ currency: hasCurrency ? effectiveCurrency : void 0,
23771
24162
  onSelect: changePlanPeriod
23772
24163
  }
23773
24164
  )
@@ -24574,6 +24965,7 @@ var PeriodToggle = ({
24574
24965
  options,
24575
24966
  selectedOption,
24576
24967
  selectedPlan,
24968
+ currency,
24577
24969
  onSelect
24578
24970
  }) => {
24579
24971
  const { t: t3 } = useTranslation();
@@ -24584,19 +24976,19 @@ var PeriodToggle = ({
24584
24976
  if (!selectedPlan) {
24585
24977
  return result;
24586
24978
  }
24587
- const monthlyPrice = getPlanPrice(selectedPlan, "month")?.price ?? 0;
24979
+ const monthlyPrice = getPlanPrice(selectedPlan, "month", void 0, currency)?.price ?? 0;
24588
24980
  if (monthlyPrice <= 0) {
24589
24981
  return result;
24590
24982
  }
24591
24983
  for (const [period, months] of Object.entries(PERIOD_MONTH_COUNT)) {
24592
- const periodPrice = getPlanPrice(selectedPlan, period)?.price ?? 0;
24984
+ const periodPrice = getPlanPrice(selectedPlan, period, void 0, currency)?.price ?? 0;
24593
24985
  if (periodPrice > 0) {
24594
24986
  const baseline = monthlyPrice * months;
24595
24987
  result[period] = Math.round((baseline - periodPrice) / baseline * 1e4) / 100;
24596
24988
  }
24597
24989
  }
24598
24990
  return result;
24599
- }, [selectedPlan]);
24991
+ }, [selectedPlan, currency]);
24600
24992
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
24601
24993
  Flex,
24602
24994
  {
@@ -24984,10 +25376,12 @@ var CheckoutStageButton = ({
24984
25376
  willScheduleDowngrade,
24985
25377
  hasIncompleteRequiredCustomFields = false,
24986
25378
  isCreditOnlyPurchase = false,
24987
- isOneTimeOnlyPurchase = false
25379
+ isOneTimeOnlyPurchase = false,
25380
+ isUnchangedTrial = false
24988
25381
  }) => {
24989
25382
  const { t: t3 } = useTranslation();
24990
25383
  const isDisabled = isLoading || !hasPlan && !isCreditOnlyPurchase || inEditMode || !canCheckout;
25384
+ const isCheckoutDisabled = isDisabled || isUnchangedTrial;
24991
25385
  const optInUnmet = optInRequired && !optInAccepted;
24992
25386
  const getNextStageId = (currentStageId) => {
24993
25387
  if (!checkoutStages) return void 0;
@@ -25049,7 +25443,7 @@ var CheckoutStageButton = ({
25049
25443
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
25050
25444
  NoPaymentRequired,
25051
25445
  {
25052
- isDisabled,
25446
+ isDisabled: isCheckoutDisabled,
25053
25447
  isLoading,
25054
25448
  onClick: checkout,
25055
25449
  isSticky,
@@ -25084,7 +25478,7 @@ var CheckoutStageButton = ({
25084
25478
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
25085
25479
  NoPaymentRequired,
25086
25480
  {
25087
- isDisabled,
25481
+ isDisabled: isCheckoutDisabled,
25088
25482
  isLoading,
25089
25483
  onClick: checkout,
25090
25484
  isSticky,
@@ -25128,7 +25522,7 @@ var CheckoutStageButton = ({
25128
25522
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
25129
25523
  NoPaymentRequired,
25130
25524
  {
25131
- isDisabled,
25525
+ isDisabled: isCheckoutDisabled,
25132
25526
  isLoading,
25133
25527
  onClick: checkout,
25134
25528
  isSticky,
@@ -25172,7 +25566,7 @@ var CheckoutStageButton = ({
25172
25566
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
25173
25567
  NoPaymentRequired,
25174
25568
  {
25175
- isDisabled,
25569
+ isDisabled: isCheckoutDisabled,
25176
25570
  isLoading,
25177
25571
  onClick: checkout,
25178
25572
  isSticky,
@@ -25215,7 +25609,7 @@ var CheckoutStageButton = ({
25215
25609
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
25216
25610
  NoPaymentRequired,
25217
25611
  {
25218
- isDisabled,
25612
+ isDisabled: isCheckoutDisabled,
25219
25613
  isLoading,
25220
25614
  onClick: checkout,
25221
25615
  isSticky,
@@ -25259,7 +25653,7 @@ var CheckoutStageButton = ({
25259
25653
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
25260
25654
  NoPaymentRequired,
25261
25655
  {
25262
- isDisabled,
25656
+ isDisabled: isCheckoutDisabled,
25263
25657
  isLoading,
25264
25658
  onClick: checkout,
25265
25659
  isSticky,
@@ -25303,7 +25697,7 @@ var CheckoutStageButton = ({
25303
25697
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
25304
25698
  NoPaymentRequired,
25305
25699
  {
25306
- isDisabled: isDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
25700
+ isDisabled: isCheckoutDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
25307
25701
  isLoading,
25308
25702
  onClick: checkout,
25309
25703
  isSticky,
@@ -25319,7 +25713,7 @@ var CheckoutStageButton = ({
25319
25713
  Button,
25320
25714
  {
25321
25715
  type: "button",
25322
- disabled: isDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
25716
+ disabled: isCheckoutDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
25323
25717
  onClick: checkout,
25324
25718
  $fullWidth: true,
25325
25719
  $isLoading: isLoading,
@@ -25801,9 +26195,9 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25801
26195
  ]);
25802
26196
  const selectedAddOnsWithPrice = (0, import_react38.useMemo)(
25803
26197
  () => addOns.filter(
25804
- (addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
26198
+ (addOn) => addOn.isSelected && getPlanPrice(addOn, planPeriod, void 0, currency)?.price
25805
26199
  ),
25806
- [addOns, currency]
26200
+ [addOns, planPeriod, currency]
25807
26201
  );
25808
26202
  const selectedOneTimeAddOns = (0, import_react38.useMemo)(
25809
26203
  () => addOns.filter(
@@ -25813,7 +26207,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25813
26207
  );
25814
26208
  const { removedAddOns, willAddOnsChange } = (0, import_react38.useMemo)(() => {
25815
26209
  const addedAddOns = selectedAddOnsWithPrice.filter(
25816
- (selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
26210
+ (selected) => !currentAddOns.some((current) => selected.id === current.id)
25817
26211
  );
25818
26212
  const removedAddOns2 = currentAddOns.filter(
25819
26213
  (current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithPrice.some(
@@ -25826,7 +26220,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25826
26220
  removedAddOns: removedAddOns2,
25827
26221
  willAddOnsChange: willAddOnsChange2
25828
26222
  };
25829
- }, [currentAddOns, selectedAddOnsWithPrice, currency]);
26223
+ }, [currentAddOns, selectedAddOnsWithPrice]);
25830
26224
  const addedCreditBundles = (0, import_react38.useMemo)(
25831
26225
  () => creditBundles.filter((bundle) => bundle.count > 0),
25832
26226
  [creditBundles]
@@ -25852,6 +26246,24 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25852
26246
  selectedOneTimeAddOns.length,
25853
26247
  addedCreditBundles.length
25854
26248
  ]);
26249
+ const isUnchangedTrial = (0, import_react38.useMemo)(() => {
26250
+ if (billingSubscription?.status !== "trialing" || !selectedPlan?.current) {
26251
+ return false;
26252
+ }
26253
+ const currentPeriod = getSubscriptionPeriod(billingSubscription);
26254
+ if (currentPeriod && currentPeriod !== planPeriod) {
26255
+ return false;
26256
+ }
26257
+ return !willAddOnsChange && updatedUsageBasedEntitlements.changed.length === 0 && selectedOneTimeAddOns.length === 0 && addedCreditBundles.length === 0;
26258
+ }, [
26259
+ selectedPlan,
26260
+ billingSubscription,
26261
+ planPeriod,
26262
+ willAddOnsChange,
26263
+ updatedUsageBasedEntitlements.changed.length,
26264
+ selectedOneTimeAddOns.length,
26265
+ addedCreditBundles.length
26266
+ ]);
25855
26267
  const discountApplied = (0, import_react38.useMemo)(
25856
26268
  () => promoCode && (amountOff > 0 || percentOff > 0),
25857
26269
  [promoCode, amountOff, percentOff]
@@ -26045,6 +26457,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
26045
26457
  hasIncompleteRequiredCustomFields,
26046
26458
  isCreditOnlyPurchase,
26047
26459
  isOneTimeOnlyPurchase,
26460
+ isUnchangedTrial,
26048
26461
  checkout: handleCheckout
26049
26462
  }
26050
26463
  );
@@ -26090,6 +26503,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
26090
26503
  addOnPayInAdvanceEntitlements,
26091
26504
  isCreditOnlyPurchase,
26092
26505
  isOneTimeOnlyPurchase,
26506
+ isUnchangedTrial,
26093
26507
  hasIncompleteRequiredCustomFields
26094
26508
  ]);
26095
26509
  (0, import_react38.useLayoutEffect)(() => {
@@ -26124,7 +26538,10 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
26124
26538
  subscriptionPrice,
26125
26539
  planPeriod,
26126
26540
  periodStart: renewDate,
26127
- hasUsageBasedCosts: usageBasedEntitlements.length > 0,
26541
+ hasUsageBasedCosts: hasMeteredCosts([
26542
+ ...usageBasedEntitlements,
26543
+ ...addOnUsageBasedEntitlements
26544
+ ]),
26128
26545
  discount: subscriptionDiscount,
26129
26546
  locale
26130
26547
  },
@@ -26136,6 +26553,14 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
26136
26553
  locale
26137
26554
  })
26138
26555
  }) : billingPreviewText;
26556
+ const currentPriceInterval = getSubscriptionInterval(
26557
+ billingSubscription
26558
+ ) ?? { interval: currentPlan?.planPeriod || planPeriod };
26559
+ const currentPriceSuffix = shortenPeriod(
26560
+ currentPriceInterval.interval,
26561
+ t3,
26562
+ currentPriceInterval.intervalCount
26563
+ );
26139
26564
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
26140
26565
  Flex,
26141
26566
  {
@@ -26204,10 +26629,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
26204
26629
  }),
26205
26630
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
26206
26631
  "/",
26207
- shortenPeriod(
26208
- getSubscriptionPeriod(billingSubscription) || currentPlan.planPeriod || planPeriod,
26209
- t3
26210
- )
26632
+ currentPriceSuffix
26211
26633
  ] })
26212
26634
  ] }) })
26213
26635
  ]
@@ -26417,7 +26839,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
26417
26839
  }),
26418
26840
  addOn.planPeriod !== "one-time" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
26419
26841
  "/",
26420
- shortenPeriod(planPeriod, t3)
26842
+ currentPriceSuffix
26421
26843
  ] })
26422
26844
  ] }) })
26423
26845
  ]
@@ -29582,9 +30004,14 @@ var import_react52 = require("react");
29582
30004
 
29583
30005
  // src/components/elements/plan-manager/AddOn.tsx
29584
30006
  var import_jsx_runtime63 = require("react/jsx-runtime");
29585
- var AddOn = ({ addOn, currency, period, layout }) => {
30007
+ var AddOn = ({
30008
+ addOn,
30009
+ currency,
30010
+ priceInterval,
30011
+ layout
30012
+ }) => {
29586
30013
  const { t: t3, locale } = useTranslation();
29587
- const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
30014
+ const resolvedInterval = addOn.planPeriod === "one-time" ? { interval: addOn.planPeriod } : priceInterval ?? (addOn.planPeriod ? { interval: addOn.planPeriod } : void 0);
29588
30015
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
29589
30016
  Flex,
29590
30017
  {
@@ -29594,9 +30021,13 @@ var AddOn = ({ addOn, currency, period, layout }) => {
29594
30021
  $gap: "1rem",
29595
30022
  children: [
29596
30023
  /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
29597
- typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { children: [
30024
+ typeof addOn.planPrice === "number" && resolvedInterval && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { children: [
29598
30025
  formatCurrency(addOn.planPrice, { locale, currency }),
29599
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod, t3) : `/${shortenPeriod(resolvedPeriod, t3)}` })
30026
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("sub", { children: resolvedInterval.interval === "one-time" ? shortenPeriod(resolvedInterval.interval, t3) : `/${shortenPeriod(
30027
+ resolvedInterval.interval,
30028
+ t3,
30029
+ resolvedInterval.intervalCount
30030
+ )}` })
29600
30031
  ] })
29601
30032
  ]
29602
30033
  }
@@ -29897,7 +30328,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29897
30328
  willSubscriptionCancel,
29898
30329
  isTrialSubscription
29899
30330
  } = (0, import_react52.useMemo)(() => {
29900
- const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
30331
+ const subscriptionInterval2 = getSubscriptionInterval(billingSubscription);
29901
30332
  const subscriptionCurrency2 = billingSubscription?.currency;
29902
30333
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
29903
30334
  const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
@@ -29909,6 +30340,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29909
30340
  };
29910
30341
  }, [billingSubscription]);
29911
30342
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
30343
+ const currentPriceInterval = subscriptionInterval ?? (currentPlanPeriod ? { interval: currentPlanPeriod } : void 0);
29912
30344
  const { isFreePlan, isUsageBasedPlan } = (0, import_react52.useMemo)(() => {
29913
30345
  const isFreePlan2 = currentPlan?.planPrice === 0;
29914
30346
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
@@ -30067,9 +30499,13 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30067
30499
  })
30068
30500
  }
30069
30501
  ),
30070
- !isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("sub", { children: [
30502
+ !isFreePlan && currentPriceInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("sub", { children: [
30071
30503
  "/",
30072
- shortenPeriod(currentPlanPeriod, t3)
30504
+ shortenPeriod(
30505
+ currentPriceInterval.interval,
30506
+ t3,
30507
+ currentPriceInterval.intervalCount
30508
+ )
30073
30509
  ] }) })
30074
30510
  ] })
30075
30511
  ]
@@ -30089,7 +30525,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30089
30525
  {
30090
30526
  addOn,
30091
30527
  currency: subscriptionCurrency,
30092
- period: currentPlanPeriod,
30528
+ priceInterval: currentPriceInterval,
30093
30529
  layout: props
30094
30530
  },
30095
30531
  addOnIndex
@@ -30148,7 +30584,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30148
30584
  resolveLicenseQuantity
30149
30585
  );
30150
30586
  const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
30151
- const creditPeriod = composition.period ?? subscriptionInterval;
30587
+ const creditInterval = composition.period ? { interval: composition.period } : subscriptionInterval;
30152
30588
  const showPerLicense = !!perLicenseGrant && !!licenseFeature;
30153
30589
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
30154
30590
  Flex,
@@ -30178,7 +30614,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30178
30614
  1
30179
30615
  )
30180
30616
  }),
30181
- composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
30617
+ composition.fixedQuantity > 0 && creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
30182
30618
  " ",
30183
30619
  t3("Plus X credits per period", {
30184
30620
  amount: composition.fixedQuantity,
@@ -30187,8 +30623,10 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30187
30623
  locale,
30188
30624
  composition.fixedQuantity
30189
30625
  ),
30190
- period: t3(
30191
- creditPeriod
30626
+ period: nameInterval(
30627
+ creditInterval.interval,
30628
+ t3,
30629
+ creditInterval.intervalCount
30192
30630
  )
30193
30631
  })
30194
30632
  ] })
@@ -30197,11 +30635,13 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30197
30635
  " ",
30198
30636
  getFeatureName(group, locale, group.total.value),
30199
30637
  " ",
30200
- subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
30638
+ creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
30201
30639
  t3("per"),
30202
30640
  " ",
30203
- t3(
30204
- subscriptionInterval
30641
+ nameInterval(
30642
+ creditInterval.interval,
30643
+ t3,
30644
+ creditInterval.intervalCount
30205
30645
  )
30206
30646
  ] })
30207
30647
  ] }) }),
@@ -30228,7 +30668,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30228
30668
  ]
30229
30669
  }
30230
30670
  ),
30231
- showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
30671
+ showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
30232
30672
  Text,
30233
30673
  {
30234
30674
  style: { opacity: 0.54 },
@@ -30249,7 +30689,11 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30249
30689
  locale,
30250
30690
  resolvedTotal
30251
30691
  ),
30252
- period: shortenPeriod(creditPeriod, t3)
30692
+ period: shortenPeriod(
30693
+ creditInterval.interval,
30694
+ t3,
30695
+ creditInterval.intervalCount
30696
+ )
30253
30697
  }) : t3("X licenses times Y credits", {
30254
30698
  quantity: licenseQuantity,
30255
30699
  licenseName: getFeatureName(
@@ -30264,7 +30708,11 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
30264
30708
  locale,
30265
30709
  resolvedTotal
30266
30710
  ),
30267
- period: shortenPeriod(creditPeriod, t3)
30711
+ period: shortenPeriod(
30712
+ creditInterval.interval,
30713
+ t3,
30714
+ creditInterval.intervalCount
30715
+ )
30268
30716
  })
30269
30717
  }
30270
30718
  )
@@ -31480,16 +31928,18 @@ var PricingTable = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
31480
31928
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
31481
31929
  );
31482
31930
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
31483
- const [selectedCurrency, setSelectedCurrency] = (0, import_react55.useState)(
31931
+ const [chosenCurrency, setSelectedCurrency] = (0, import_react55.useState)(
31484
31932
  () => currencies[0] ?? DEFAULT_CURRENCY
31485
31933
  );
31486
- if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
31934
+ if (currencies.length > 0 && !currencies.includes(chosenCurrency)) {
31487
31935
  setSelectedCurrency(currencies[0]);
31488
31936
  }
31937
+ const lockedCurrency = useSubscriptionCurrency();
31938
+ const selectedCurrency = lockedCurrency ?? chosenCurrency;
31489
31939
  const showPeriodToggle = rest.showPeriodToggle ?? data?.displaySettings?.showPeriodToggle ?? true;
31490
31940
  const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
31491
- const showCurrencySelector = currencies.length > 1;
31492
- const hasCurrency = currencies.length > 1 || hasCurrencyFilter;
31941
+ const showCurrencySelector = currencies.length > 1 && !lockedCurrency;
31942
+ const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
31493
31943
  const hasNoUsableCurrency = currencies.length === 0;
31494
31944
  const {
31495
31945
  plans: allPlans,
@@ -31588,6 +32038,7 @@ var PricingTable = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
31588
32038
  options: periods,
31589
32039
  selectedOption: selectedPeriod,
31590
32040
  selectedPlan: currentPlan,
32041
+ currency: hasCurrency ? selectedCurrency : void 0,
31591
32042
  onSelect: (period) => {
31592
32043
  if (period !== selectedPeriod) {
31593
32044
  setSelectedPeriod(period);