@schematichq/schematic-components 1.4.0 → 1.4.2

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.
@@ -283,17 +283,17 @@ var require_debounce = __commonJS({
283
283
  var FUNC_ERROR_TEXT = "Expected a function";
284
284
  var nativeMax = Math.max;
285
285
  var nativeMin = Math.min;
286
- function debounce4(func, wait, options2) {
286
+ function debounce4(func, wait, options) {
287
287
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
288
288
  if (typeof func != "function") {
289
289
  throw new TypeError(FUNC_ERROR_TEXT);
290
290
  }
291
291
  wait = toNumber(wait) || 0;
292
- if (isObject2(options2)) {
293
- leading = !!options2.leading;
294
- maxing = "maxWait" in options2;
295
- maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait;
296
- trailing = "trailing" in options2 ? !!options2.trailing : trailing;
292
+ if (isObject2(options)) {
293
+ leading = !!options.leading;
294
+ maxing = "maxWait" in options;
295
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
296
+ trailing = "trailing" in options ? !!options.trailing : trailing;
297
297
  }
298
298
  function invokeFunc(time) {
299
299
  var args = lastArgs, thisArg = lastThis;
@@ -1879,8 +1879,8 @@ function getPriceValue(billingPrice) {
1879
1879
  const price = typeof billingPrice.priceDecimal === "string" ? Number(billingPrice.priceDecimal) : billingPrice.price;
1880
1880
  return price;
1881
1881
  }
1882
- function getPlanPrice(plan, period = "month", options2 = { useSelectedPeriod: true }) {
1883
- const billingPrice = options2.useSelectedPeriod ? period === "year" ? plan.yearlyPrice : plan.monthlyPrice : plan.yearlyPrice && !plan.monthlyPrice ? plan.yearlyPrice : plan.monthlyPrice;
1882
+ function getPlanPrice(plan, period = "month", options = { useSelectedPeriod: true }) {
1883
+ const billingPrice = options.useSelectedPeriod ? period === "year" ? plan.yearlyPrice : plan.monthlyPrice : plan.yearlyPrice && !plan.monthlyPrice ? plan.yearlyPrice : plan.monthlyPrice;
1884
1884
  if (billingPrice) {
1885
1885
  return { ...billingPrice, price: getPriceValue(billingPrice) };
1886
1886
  }
@@ -2012,14 +2012,14 @@ function groupPlanCreditGrants(creditGrants) {
2012
2012
  );
2013
2013
  return Object.values(map);
2014
2014
  }
2015
- function groupCreditGrants(creditGrants, options2) {
2015
+ function groupCreditGrants(creditGrants, options) {
2016
2016
  const today = /* @__PURE__ */ new Date();
2017
2017
  const map = creditGrants.reduce(
2018
2018
  (acc, grant) => {
2019
2019
  const isExpired = !!grant.expiresAt && grant.expiresAt <= today;
2020
2020
  const isZeroedOut = !!grant.zeroedOutDate;
2021
2021
  if (!isExpired && !isZeroedOut) {
2022
- const key = options2?.groupBy === "bundle" ? grant.billingCreditBundleId || grant.id : options2?.groupBy === "credit" ? grant.billingCreditId : grant.id;
2022
+ const key = options?.groupBy === "bundle" ? grant.billingCreditBundleId || grant.id : options?.groupBy === "credit" ? grant.billingCreditId : grant.id;
2023
2023
  const current = acc[key];
2024
2024
  acc[key] = {
2025
2025
  // credit-specific attributes
@@ -4079,7 +4079,7 @@ attr.rem = function propAsRem(key, value) {
4079
4079
  };
4080
4080
 
4081
4081
  // src/hooks/useAvailablePlans.ts
4082
- function useAvailablePlans(activePeriod, options2 = { useSelectedPeriod: true }) {
4082
+ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true }) {
4083
4083
  const { data, settings } = useEmbed();
4084
4084
  const getAvailablePeriods = useCallback(() => {
4085
4085
  const periods = [];
@@ -4094,14 +4094,14 @@ function useAvailablePlans(activePeriod, options2 = { useSelectedPeriod: true })
4094
4094
  const getActivePlans = useCallback(
4095
4095
  (plans) => {
4096
4096
  const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
4097
- if (options2.useSelectedPeriod) {
4097
+ if (options.useSelectedPeriod) {
4098
4098
  return activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
4099
4099
  }
4100
4100
  return plan.monthlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
4101
4101
  });
4102
4102
  return activePlans.map((plan) => ({ ...plan, isSelected: false }));
4103
4103
  },
4104
- [activePeriod, options2.useSelectedPeriod, settings.mode]
4104
+ [activePeriod, options.useSelectedPeriod, settings.mode]
4105
4105
  );
4106
4106
  return useMemo(() => {
4107
4107
  return {
@@ -4431,14 +4431,14 @@ var consoleLogger = {
4431
4431
  }
4432
4432
  };
4433
4433
  var Logger = class _Logger {
4434
- constructor(concreteLogger, options2 = {}) {
4435
- this.init(concreteLogger, options2);
4434
+ constructor(concreteLogger, options = {}) {
4435
+ this.init(concreteLogger, options);
4436
4436
  }
4437
- init(concreteLogger, options2 = {}) {
4438
- this.prefix = options2.prefix || "i18next:";
4437
+ init(concreteLogger, options = {}) {
4438
+ this.prefix = options.prefix || "i18next:";
4439
4439
  this.logger = concreteLogger || consoleLogger;
4440
- this.options = options2;
4441
- this.debug = options2.debug;
4440
+ this.options = options;
4441
+ this.debug = options.debug;
4442
4442
  }
4443
4443
  log(...args) {
4444
4444
  return this.forward(args, "log", "", true);
@@ -4465,10 +4465,10 @@ var Logger = class _Logger {
4465
4465
  ...this.options
4466
4466
  });
4467
4467
  }
4468
- clone(options2) {
4469
- options2 = options2 || this.options;
4470
- options2.prefix = options2.prefix || this.prefix;
4471
- return new _Logger(this.logger, options2);
4468
+ clone(options) {
4469
+ options = options || this.options;
4470
+ options.prefix = options.prefix || this.prefix;
4471
+ return new _Logger(this.logger, options);
4472
4472
  }
4473
4473
  };
4474
4474
  var baseLogger = new Logger();
@@ -4512,13 +4512,13 @@ var EventEmitter = class {
4512
4512
  }
4513
4513
  };
4514
4514
  var ResourceStore = class extends EventEmitter {
4515
- constructor(data, options2 = {
4515
+ constructor(data, options = {
4516
4516
  ns: ["translation"],
4517
4517
  defaultNS: "translation"
4518
4518
  }) {
4519
4519
  super();
4520
4520
  this.data = data || {};
4521
- this.options = options2;
4521
+ this.options = options;
4522
4522
  if (this.options.keySeparator === void 0) {
4523
4523
  this.options.keySeparator = ".";
4524
4524
  }
@@ -4537,9 +4537,9 @@ var ResourceStore = class extends EventEmitter {
4537
4537
  this.options.ns.splice(index, 1);
4538
4538
  }
4539
4539
  }
4540
- getResource(lng, ns, key, options2 = {}) {
4541
- const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
4542
- const ignoreJSONStructure = options2.ignoreJSONStructure !== void 0 ? options2.ignoreJSONStructure : this.options.ignoreJSONStructure;
4540
+ getResource(lng, ns, key, options = {}) {
4541
+ const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
4542
+ const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
4543
4543
  let path;
4544
4544
  if (lng.indexOf(".") > -1) {
4545
4545
  path = lng.split(".");
@@ -4564,10 +4564,10 @@ var ResourceStore = class extends EventEmitter {
4564
4564
  if (result || !ignoreJSONStructure || !isString(key)) return result;
4565
4565
  return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
4566
4566
  }
4567
- addResource(lng, ns, key, value, options2 = {
4567
+ addResource(lng, ns, key, value, options = {
4568
4568
  silent: false
4569
4569
  }) {
4570
- const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
4570
+ const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
4571
4571
  let path = [lng, ns];
4572
4572
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
4573
4573
  if (lng.indexOf(".") > -1) {
@@ -4577,9 +4577,9 @@ var ResourceStore = class extends EventEmitter {
4577
4577
  }
4578
4578
  this.addNamespaces(ns);
4579
4579
  setPath(this.data, path, value);
4580
- if (!options2.silent) this.emit("added", lng, ns, key, value);
4580
+ if (!options.silent) this.emit("added", lng, ns, key, value);
4581
4581
  }
4582
- addResources(lng, ns, resources, options2 = {
4582
+ addResources(lng, ns, resources, options = {
4583
4583
  silent: false
4584
4584
  }) {
4585
4585
  for (const m2 in resources) {
@@ -4587,9 +4587,9 @@ var ResourceStore = class extends EventEmitter {
4587
4587
  silent: true
4588
4588
  });
4589
4589
  }
4590
- if (!options2.silent) this.emit("added", lng, ns, resources);
4590
+ if (!options.silent) this.emit("added", lng, ns, resources);
4591
4591
  }
4592
- addResourceBundle(lng, ns, resources, deep, overwrite, options2 = {
4592
+ addResourceBundle(lng, ns, resources, deep, overwrite, options = {
4593
4593
  silent: false,
4594
4594
  skipCopy: false
4595
4595
  }) {
@@ -4602,7 +4602,7 @@ var ResourceStore = class extends EventEmitter {
4602
4602
  }
4603
4603
  this.addNamespaces(ns);
4604
4604
  let pack = getPath(this.data, path) || {};
4605
- if (!options2.skipCopy) resources = JSON.parse(JSON.stringify(resources));
4605
+ if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
4606
4606
  if (deep) {
4607
4607
  deepExtend(pack, resources, overwrite);
4608
4608
  } else {
@@ -4612,7 +4612,7 @@ var ResourceStore = class extends EventEmitter {
4612
4612
  };
4613
4613
  }
4614
4614
  setPath(this.data, path, pack);
4615
- if (!options2.silent) this.emit("added", lng, ns, resources);
4615
+ if (!options.silent) this.emit("added", lng, ns, resources);
4616
4616
  }
4617
4617
  removeResourceBundle(lng, ns) {
4618
4618
  if (this.hasResourceBundle(lng, ns)) {
@@ -4645,9 +4645,9 @@ var postProcessor = {
4645
4645
  addPostProcessor(module) {
4646
4646
  this.processors[module.name] = module;
4647
4647
  },
4648
- handle(processors, value, key, options2, translator) {
4648
+ handle(processors, value, key, options, translator) {
4649
4649
  processors.forEach((processor) => {
4650
- value = this.processors[processor]?.process(value, key, options2, translator) ?? value;
4650
+ value = this.processors[processor]?.process(value, key, options, translator) ?? value;
4651
4651
  });
4652
4652
  return value;
4653
4653
  }
@@ -4675,10 +4675,10 @@ function keysFromSelector(selector, opts) {
4675
4675
  var checkedLoadedFor = {};
4676
4676
  var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
4677
4677
  var Translator = class _Translator extends EventEmitter {
4678
- constructor(services, options2 = {}) {
4678
+ constructor(services, options = {}) {
4679
4679
  super();
4680
4680
  copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
4681
- this.options = options2;
4681
+ this.options = options;
4682
4682
  if (this.options.keySeparator === void 0) {
4683
4683
  this.options.keySeparator = ".";
4684
4684
  }
@@ -4728,12 +4728,15 @@ var Translator = class _Translator extends EventEmitter {
4728
4728
  if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
4729
4729
  opt = this.options.overloadTranslationOptionHandler(arguments);
4730
4730
  }
4731
- if (typeof options === "object") opt = {
4731
+ if (typeof opt === "object") opt = {
4732
4732
  ...opt
4733
4733
  };
4734
4734
  if (!opt) opt = {};
4735
4735
  if (keys == null) return "";
4736
- if (typeof keys === "function") keys = keysFromSelector(keys, opt);
4736
+ if (typeof keys === "function") keys = keysFromSelector(keys, {
4737
+ ...this.options,
4738
+ ...opt
4739
+ });
4737
4740
  if (!Array.isArray(keys)) keys = [String(keys)];
4738
4741
  const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
4739
4742
  const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
@@ -5054,16 +5057,16 @@ var Translator = class _Translator extends EventEmitter {
5054
5057
  isValidLookup(res) {
5055
5058
  return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
5056
5059
  }
5057
- getResource(code, ns, key, options2 = {}) {
5058
- if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options2);
5059
- return this.resourceStore.getResource(code, ns, key, options2);
5060
+ getResource(code, ns, key, options = {}) {
5061
+ if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
5062
+ return this.resourceStore.getResource(code, ns, key, options);
5060
5063
  }
5061
- getUsedParamsDetails(options2 = {}) {
5064
+ getUsedParamsDetails(options = {}) {
5062
5065
  const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
5063
- const useOptionsReplaceForData = options2.replace && !isString(options2.replace);
5064
- let data = useOptionsReplaceForData ? options2.replace : options2;
5065
- if (useOptionsReplaceForData && typeof options2.count !== "undefined") {
5066
- data.count = options2.count;
5066
+ const useOptionsReplaceForData = options.replace && !isString(options.replace);
5067
+ let data = useOptionsReplaceForData ? options.replace : options;
5068
+ if (useOptionsReplaceForData && typeof options.count !== "undefined") {
5069
+ data.count = options.count;
5067
5070
  }
5068
5071
  if (this.options.interpolation.defaultVariables) {
5069
5072
  data = {
@@ -5081,10 +5084,10 @@ var Translator = class _Translator extends EventEmitter {
5081
5084
  }
5082
5085
  return data;
5083
5086
  }
5084
- static hasDefaultValue(options2) {
5087
+ static hasDefaultValue(options) {
5085
5088
  const prefix2 = "defaultValue";
5086
- for (const option in options2) {
5087
- if (Object.prototype.hasOwnProperty.call(options2, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options2[option]) {
5089
+ for (const option in options) {
5090
+ if (Object.prototype.hasOwnProperty.call(options, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options[option]) {
5088
5091
  return true;
5089
5092
  }
5090
5093
  }
@@ -5092,8 +5095,8 @@ var Translator = class _Translator extends EventEmitter {
5092
5095
  }
5093
5096
  };
5094
5097
  var LanguageUtil = class {
5095
- constructor(options2) {
5096
- this.options = options2;
5098
+ constructor(options) {
5099
+ this.options = options;
5097
5100
  this.supportedLngs = this.options.supportedLngs || false;
5098
5101
  this.logger = baseLogger.create("languageUtils");
5099
5102
  }
@@ -5214,9 +5217,9 @@ var dummyRule = {
5214
5217
  })
5215
5218
  };
5216
5219
  var PluralResolver = class {
5217
- constructor(languageUtils, options2 = {}) {
5220
+ constructor(languageUtils, options = {}) {
5218
5221
  this.languageUtils = languageUtils;
5219
- this.options = options2;
5222
+ this.options = options;
5220
5223
  this.logger = baseLogger.create("pluralResolver");
5221
5224
  this.pluralRulesCache = {};
5222
5225
  }
@@ -5226,9 +5229,9 @@ var PluralResolver = class {
5226
5229
  clearCache() {
5227
5230
  this.pluralRulesCache = {};
5228
5231
  }
5229
- getRule(code, options2 = {}) {
5232
+ getRule(code, options = {}) {
5230
5233
  const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
5231
- const type = options2.ordinal ? "ordinal" : "cardinal";
5234
+ const type = options.ordinal ? "ordinal" : "cardinal";
5232
5235
  const cacheKey = JSON.stringify({
5233
5236
  cleanedCode,
5234
5237
  type
@@ -5248,32 +5251,32 @@ var PluralResolver = class {
5248
5251
  }
5249
5252
  if (!code.match(/-|_/)) return dummyRule;
5250
5253
  const lngPart = this.languageUtils.getLanguagePartFromCode(code);
5251
- rule = this.getRule(lngPart, options2);
5254
+ rule = this.getRule(lngPart, options);
5252
5255
  }
5253
5256
  this.pluralRulesCache[cacheKey] = rule;
5254
5257
  return rule;
5255
5258
  }
5256
- needsPlural(code, options2 = {}) {
5257
- let rule = this.getRule(code, options2);
5258
- if (!rule) rule = this.getRule("dev", options2);
5259
+ needsPlural(code, options = {}) {
5260
+ let rule = this.getRule(code, options);
5261
+ if (!rule) rule = this.getRule("dev", options);
5259
5262
  return rule?.resolvedOptions().pluralCategories.length > 1;
5260
5263
  }
5261
- getPluralFormsOfKey(code, key, options2 = {}) {
5262
- return this.getSuffixes(code, options2).map((suffix) => `${key}${suffix}`);
5264
+ getPluralFormsOfKey(code, key, options = {}) {
5265
+ return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
5263
5266
  }
5264
- getSuffixes(code, options2 = {}) {
5265
- let rule = this.getRule(code, options2);
5266
- if (!rule) rule = this.getRule("dev", options2);
5267
+ getSuffixes(code, options = {}) {
5268
+ let rule = this.getRule(code, options);
5269
+ if (!rule) rule = this.getRule("dev", options);
5267
5270
  if (!rule) return [];
5268
- return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
5271
+ return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
5269
5272
  }
5270
- getSuffix(code, count, options2 = {}) {
5271
- const rule = this.getRule(code, options2);
5273
+ getSuffix(code, count, options = {}) {
5274
+ const rule = this.getRule(code, options);
5272
5275
  if (rule) {
5273
- return `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
5276
+ return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
5274
5277
  }
5275
5278
  this.logger.warn(`no plural rule found for: ${code}`);
5276
- return this.getSuffix("dev", count, options2);
5279
+ return this.getSuffix("dev", count, options);
5277
5280
  }
5278
5281
  };
5279
5282
  var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
@@ -5286,14 +5289,14 @@ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJS
5286
5289
  };
5287
5290
  var regexSafe = (val) => val.replace(/\$/g, "$$$$");
5288
5291
  var Interpolator = class {
5289
- constructor(options2 = {}) {
5292
+ constructor(options = {}) {
5290
5293
  this.logger = baseLogger.create("interpolator");
5291
- this.options = options2;
5292
- this.format = options2?.interpolation?.format || ((value) => value);
5293
- this.init(options2);
5294
+ this.options = options;
5295
+ this.format = options?.interpolation?.format || ((value) => value);
5296
+ this.init(options);
5294
5297
  }
5295
- init(options2 = {}) {
5296
- if (!options2.interpolation) options2.interpolation = {
5298
+ init(options = {}) {
5299
+ if (!options.interpolation) options.interpolation = {
5297
5300
  escapeValue: true
5298
5301
  };
5299
5302
  const {
@@ -5314,7 +5317,7 @@ var Interpolator = class {
5314
5317
  nestingOptionsSeparator,
5315
5318
  maxReplaces,
5316
5319
  alwaysFormat
5317
- } = options2.interpolation;
5320
+ } = options.interpolation;
5318
5321
  this.escape = escape$1 !== void 0 ? escape$1 : escape;
5319
5322
  this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
5320
5323
  this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
@@ -5345,7 +5348,7 @@ var Interpolator = class {
5345
5348
  this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
5346
5349
  this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
5347
5350
  }
5348
- interpolate(str, data, lng, options2) {
5351
+ interpolate(str, data, lng, options) {
5349
5352
  let match2;
5350
5353
  let value;
5351
5354
  let replaces;
@@ -5354,7 +5357,7 @@ var Interpolator = class {
5354
5357
  if (key.indexOf(this.formatSeparator) < 0) {
5355
5358
  const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
5356
5359
  return this.alwaysFormat ? this.format(path, void 0, lng, {
5357
- ...options2,
5360
+ ...options,
5358
5361
  ...data,
5359
5362
  interpolationkey: key
5360
5363
  }) : path;
@@ -5363,14 +5366,14 @@ var Interpolator = class {
5363
5366
  const k2 = p2.shift().trim();
5364
5367
  const f2 = p2.join(this.formatSeparator).trim();
5365
5368
  return this.format(deepFindWithDefaults(data, defaultData, k2, this.options.keySeparator, this.options.ignoreJSONStructure), f2, lng, {
5366
- ...options2,
5369
+ ...options,
5367
5370
  ...data,
5368
5371
  interpolationkey: k2
5369
5372
  });
5370
5373
  };
5371
5374
  this.resetRegExp();
5372
- const missingInterpolationHandler = options2?.missingInterpolationHandler || this.options.missingInterpolationHandler;
5373
- const skipOnVariables = options2?.interpolation?.skipOnVariables !== void 0 ? options2.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
5375
+ const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
5376
+ const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
5374
5377
  const todos = [{
5375
5378
  regex: this.regexpUnescape,
5376
5379
  safeValue: (val) => regexSafe(val)
@@ -5385,9 +5388,9 @@ var Interpolator = class {
5385
5388
  value = handleFormat(matchedVar);
5386
5389
  if (value === void 0) {
5387
5390
  if (typeof missingInterpolationHandler === "function") {
5388
- const temp = missingInterpolationHandler(str, match2, options2);
5391
+ const temp = missingInterpolationHandler(str, match2, options);
5389
5392
  value = isString(temp) ? temp : "";
5390
- } else if (options2 && Object.prototype.hasOwnProperty.call(options2, matchedVar)) {
5393
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
5391
5394
  value = "";
5392
5395
  } else if (skipOnVariables) {
5393
5396
  value = match2[0];
@@ -5415,7 +5418,7 @@ var Interpolator = class {
5415
5418
  });
5416
5419
  return str;
5417
5420
  }
5418
- nest(str, fc, options2 = {}) {
5421
+ nest(str, fc, options = {}) {
5419
5422
  let match2;
5420
5423
  let value;
5421
5424
  let clonedOptions;
@@ -5447,7 +5450,7 @@ var Interpolator = class {
5447
5450
  while (match2 = this.nestingRegexp.exec(str)) {
5448
5451
  let formatters = [];
5449
5452
  clonedOptions = {
5450
- ...options2
5453
+ ...options
5451
5454
  };
5452
5455
  clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
5453
5456
  clonedOptions.applyPostProcessor = false;
@@ -5465,8 +5468,8 @@ var Interpolator = class {
5465
5468
  value = "";
5466
5469
  }
5467
5470
  if (formatters.length) {
5468
- value = formatters.reduce((v2, f2) => this.format(v2, f2, options2.lng, {
5469
- ...options2,
5471
+ value = formatters.reduce((v2, f2) => this.format(v2, f2, options.lng, {
5472
+ ...options,
5470
5473
  interpolationkey: match2[1].trim()
5471
5474
  }), value.trim());
5472
5475
  }
@@ -5528,16 +5531,16 @@ var createCachedFormatter = (fn) => {
5528
5531
  };
5529
5532
  var createNonCachedFormatter = (fn) => (v2, l2, o2) => fn(getCleanedCode(l2), o2)(v2);
5530
5533
  var Formatter = class {
5531
- constructor(options2 = {}) {
5534
+ constructor(options = {}) {
5532
5535
  this.logger = baseLogger.create("formatter");
5533
- this.options = options2;
5534
- this.init(options2);
5536
+ this.options = options;
5537
+ this.init(options);
5535
5538
  }
5536
- init(services, options2 = {
5539
+ init(services, options = {
5537
5540
  interpolation: {}
5538
5541
  }) {
5539
- this.formatSeparator = options2.interpolation.formatSeparator || ",";
5540
- const cf = options2.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
5542
+ this.formatSeparator = options.interpolation.formatSeparator || ",";
5543
+ const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
5541
5544
  this.formats = {
5542
5545
  number: cf((lng, opt) => {
5543
5546
  const formatter = new Intl.NumberFormat(lng, {
@@ -5578,7 +5581,7 @@ var Formatter = class {
5578
5581
  addCached(name, fc) {
5579
5582
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
5580
5583
  }
5581
- format(value, format, lng, options2 = {}) {
5584
+ format(value, format, lng, options = {}) {
5582
5585
  const formats = format.split(this.formatSeparator);
5583
5586
  if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
5584
5587
  const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
@@ -5592,11 +5595,11 @@ var Formatter = class {
5592
5595
  if (this.formats[formatName]) {
5593
5596
  let formatted = mem;
5594
5597
  try {
5595
- const valOptions = options2?.formatParams?.[options2.interpolationkey] || {};
5596
- const l2 = valOptions.locale || valOptions.lng || options2.locale || options2.lng || lng;
5598
+ const valOptions = options?.formatParams?.[options.interpolationkey] || {};
5599
+ const l2 = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
5597
5600
  formatted = this.formats[formatName](mem, l2, {
5598
5601
  ...formatOptions,
5599
- ...options2,
5602
+ ...options,
5600
5603
  ...valOptions
5601
5604
  });
5602
5605
  } catch (error) {
@@ -5618,24 +5621,24 @@ var removePending = (q2, name) => {
5618
5621
  }
5619
5622
  };
5620
5623
  var Connector = class extends EventEmitter {
5621
- constructor(backend, store, services, options2 = {}) {
5624
+ constructor(backend, store, services, options = {}) {
5622
5625
  super();
5623
5626
  this.backend = backend;
5624
5627
  this.store = store;
5625
5628
  this.services = services;
5626
5629
  this.languageUtils = services.languageUtils;
5627
- this.options = options2;
5630
+ this.options = options;
5628
5631
  this.logger = baseLogger.create("backendConnector");
5629
5632
  this.waitingReads = [];
5630
- this.maxParallelReads = options2.maxParallelReads || 10;
5633
+ this.maxParallelReads = options.maxParallelReads || 10;
5631
5634
  this.readingCalls = 0;
5632
- this.maxRetries = options2.maxRetries >= 0 ? options2.maxRetries : 5;
5633
- this.retryTimeout = options2.retryTimeout >= 1 ? options2.retryTimeout : 350;
5635
+ this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
5636
+ this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
5634
5637
  this.state = {};
5635
5638
  this.queue = [];
5636
- this.backend?.init?.(services, options2.backend, options2);
5639
+ this.backend?.init?.(services, options.backend, options);
5637
5640
  }
5638
- queueLoad(languages, namespaces, options2, callback) {
5641
+ queueLoad(languages, namespaces, options, callback) {
5639
5642
  const toLoad = {};
5640
5643
  const pending = {};
5641
5644
  const toLoadLanguages = {};
@@ -5644,7 +5647,7 @@ var Connector = class extends EventEmitter {
5644
5647
  let hasAllNamespaces = true;
5645
5648
  namespaces.forEach((ns) => {
5646
5649
  const name = `${lng}|${ns}`;
5647
- if (!options2.reload && this.store.hasResourceBundle(lng, ns)) {
5650
+ if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
5648
5651
  this.state[name] = 2;
5649
5652
  } else if (this.state[name] < 0) ;
5650
5653
  else if (this.state[name] === 1) {
@@ -5757,14 +5760,14 @@ var Connector = class extends EventEmitter {
5757
5760
  }
5758
5761
  return fc(lng, ns, resolver);
5759
5762
  }
5760
- prepareLoading(languages, namespaces, options2 = {}, callback) {
5763
+ prepareLoading(languages, namespaces, options = {}, callback) {
5761
5764
  if (!this.backend) {
5762
5765
  this.logger.warn("No backend was added via i18next.use. Will not load resources.");
5763
5766
  return callback && callback();
5764
5767
  }
5765
5768
  if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
5766
5769
  if (isString(namespaces)) namespaces = [namespaces];
5767
- const toLoad = this.queueLoad(languages, namespaces, options2, callback);
5770
+ const toLoad = this.queueLoad(languages, namespaces, options, callback);
5768
5771
  if (!toLoad.toLoad.length) {
5769
5772
  if (!toLoad.pending.length) callback();
5770
5773
  return null;
@@ -5791,7 +5794,7 @@ var Connector = class extends EventEmitter {
5791
5794
  this.loaded(name, err2, data);
5792
5795
  });
5793
5796
  }
5794
- saveMissing(languages, namespace, key, fallbackValue, isUpdate, options2 = {}, clb = () => {
5797
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {
5795
5798
  }) {
5796
5799
  if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
5797
5800
  this.logger.warn(`did not save key "${key}" as the namespace "${namespace}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
@@ -5800,7 +5803,7 @@ var Connector = class extends EventEmitter {
5800
5803
  if (key === void 0 || key === null || key === "") return;
5801
5804
  if (this.backend?.create) {
5802
5805
  const opts = {
5803
- ...options2,
5806
+ ...options,
5804
5807
  isUpdate
5805
5808
  };
5806
5809
  const fc = this.backend.create.bind(this.backend);
@@ -5867,9 +5870,9 @@ var get = () => ({
5867
5870
  if (isString(args[1])) ret.defaultValue = args[1];
5868
5871
  if (isString(args[2])) ret.tDescription = args[2];
5869
5872
  if (typeof args[2] === "object" || typeof args[3] === "object") {
5870
- const options2 = args[3] || args[2];
5871
- Object.keys(options2).forEach((key) => {
5872
- ret[key] = options2[key];
5873
+ const options = args[3] || args[2];
5874
+ Object.keys(options).forEach((key) => {
5875
+ ret[key] = options[key];
5873
5876
  });
5874
5877
  }
5875
5878
  return ret;
@@ -5889,15 +5892,15 @@ var get = () => ({
5889
5892
  },
5890
5893
  cacheInBuiltFormats: true
5891
5894
  });
5892
- var transformOptions = (options2) => {
5893
- if (isString(options2.ns)) options2.ns = [options2.ns];
5894
- if (isString(options2.fallbackLng)) options2.fallbackLng = [options2.fallbackLng];
5895
- if (isString(options2.fallbackNS)) options2.fallbackNS = [options2.fallbackNS];
5896
- if (options2.supportedLngs?.indexOf?.("cimode") < 0) {
5897
- options2.supportedLngs = options2.supportedLngs.concat(["cimode"]);
5895
+ var transformOptions = (options) => {
5896
+ if (isString(options.ns)) options.ns = [options.ns];
5897
+ if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
5898
+ if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
5899
+ if (options.supportedLngs?.indexOf?.("cimode") < 0) {
5900
+ options.supportedLngs = options.supportedLngs.concat(["cimode"]);
5898
5901
  }
5899
- if (typeof options2.initImmediate === "boolean") options2.initAsync = options2.initImmediate;
5900
- return options2;
5902
+ if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
5903
+ return options;
5901
5904
  };
5902
5905
  var noop = () => {
5903
5906
  };
@@ -5910,53 +5913,53 @@ var bindMemberFunctions = (inst) => {
5910
5913
  });
5911
5914
  };
5912
5915
  var I18n = class _I18n extends EventEmitter {
5913
- constructor(options2 = {}, callback) {
5916
+ constructor(options = {}, callback) {
5914
5917
  super();
5915
- this.options = transformOptions(options2);
5918
+ this.options = transformOptions(options);
5916
5919
  this.services = {};
5917
5920
  this.logger = baseLogger;
5918
5921
  this.modules = {
5919
5922
  external: []
5920
5923
  };
5921
5924
  bindMemberFunctions(this);
5922
- if (callback && !this.isInitialized && !options2.isClone) {
5925
+ if (callback && !this.isInitialized && !options.isClone) {
5923
5926
  if (!this.options.initAsync) {
5924
- this.init(options2, callback);
5927
+ this.init(options, callback);
5925
5928
  return this;
5926
5929
  }
5927
5930
  setTimeout(() => {
5928
- this.init(options2, callback);
5931
+ this.init(options, callback);
5929
5932
  }, 0);
5930
5933
  }
5931
5934
  }
5932
- init(options2 = {}, callback) {
5935
+ init(options = {}, callback) {
5933
5936
  this.isInitializing = true;
5934
- if (typeof options2 === "function") {
5935
- callback = options2;
5936
- options2 = {};
5937
+ if (typeof options === "function") {
5938
+ callback = options;
5939
+ options = {};
5937
5940
  }
5938
- if (options2.defaultNS == null && options2.ns) {
5939
- if (isString(options2.ns)) {
5940
- options2.defaultNS = options2.ns;
5941
- } else if (options2.ns.indexOf("translation") < 0) {
5942
- options2.defaultNS = options2.ns[0];
5941
+ if (options.defaultNS == null && options.ns) {
5942
+ if (isString(options.ns)) {
5943
+ options.defaultNS = options.ns;
5944
+ } else if (options.ns.indexOf("translation") < 0) {
5945
+ options.defaultNS = options.ns[0];
5943
5946
  }
5944
5947
  }
5945
5948
  const defOpts = get();
5946
5949
  this.options = {
5947
5950
  ...defOpts,
5948
5951
  ...this.options,
5949
- ...transformOptions(options2)
5952
+ ...transformOptions(options)
5950
5953
  };
5951
5954
  this.options.interpolation = {
5952
5955
  ...defOpts.interpolation,
5953
5956
  ...this.options.interpolation
5954
5957
  };
5955
- if (options2.keySeparator !== void 0) {
5956
- this.options.userDefinedKeySeparator = options2.keySeparator;
5958
+ if (options.keySeparator !== void 0) {
5959
+ this.options.userDefinedKeySeparator = options.keySeparator;
5957
5960
  }
5958
- if (options2.nsSeparator !== void 0) {
5959
- this.options.userDefinedNsSeparator = options2.nsSeparator;
5961
+ if (options.nsSeparator !== void 0) {
5962
+ this.options.userDefinedNsSeparator = options.nsSeparator;
5960
5963
  }
5961
5964
  const createClassOnDemand = (ClassOrObject) => {
5962
5965
  if (!ClassOrObject) return null;
@@ -6221,8 +6224,18 @@ var I18n = class _I18n extends EventEmitter {
6221
6224
  const keySeparator = this.options.keySeparator || ".";
6222
6225
  let resultKey;
6223
6226
  if (o2.keyPrefix && Array.isArray(key)) {
6224
- resultKey = key.map((k2) => `${o2.keyPrefix}${keySeparator}${k2}`);
6227
+ resultKey = key.map((k2) => {
6228
+ if (typeof k2 === "function") k2 = keysFromSelector(k2, {
6229
+ ...this.options,
6230
+ ...opts
6231
+ });
6232
+ return `${o2.keyPrefix}${keySeparator}${k2}`;
6233
+ });
6225
6234
  } else {
6235
+ if (typeof key === "function") key = keysFromSelector(key, {
6236
+ ...this.options,
6237
+ ...opts
6238
+ });
6226
6239
  resultKey = o2.keyPrefix ? `${o2.keyPrefix}${keySeparator}${key}` : key;
6227
6240
  }
6228
6241
  return this.t(resultKey, o2);
@@ -6245,7 +6258,7 @@ var I18n = class _I18n extends EventEmitter {
6245
6258
  setDefaultNamespace(ns) {
6246
6259
  this.options.defaultNS = ns;
6247
6260
  }
6248
- hasLoadedNamespace(ns, options2 = {}) {
6261
+ hasLoadedNamespace(ns, options = {}) {
6249
6262
  if (!this.isInitialized) {
6250
6263
  this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
6251
6264
  return false;
@@ -6254,7 +6267,7 @@ var I18n = class _I18n extends EventEmitter {
6254
6267
  this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
6255
6268
  return false;
6256
6269
  }
6257
- const lng = options2.lng || this.resolvedLanguage || this.languages[0];
6270
+ const lng = options.lng || this.resolvedLanguage || this.languages[0];
6258
6271
  const fallbackLng = this.options ? this.options.fallbackLng : false;
6259
6272
  const lastLng = this.languages[this.languages.length - 1];
6260
6273
  if (lng.toLowerCase() === "cimode") return true;
@@ -6262,8 +6275,8 @@ var I18n = class _I18n extends EventEmitter {
6262
6275
  const loadState = this.services.backendConnector.state[`${l2}|${n}`];
6263
6276
  return loadState === -1 || loadState === 0 || loadState === 2;
6264
6277
  };
6265
- if (options2.precheck) {
6266
- const preResult = options2.precheck(this, loadNotPending);
6278
+ if (options.precheck) {
6279
+ const preResult = options.precheck(this, loadNotPending);
6267
6280
  if (preResult !== void 0) return preResult;
6268
6281
  }
6269
6282
  if (this.hasResourceBundle(lng, ns)) return true;
@@ -6319,22 +6332,22 @@ var I18n = class _I18n extends EventEmitter {
6319
6332
  if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
6320
6333
  return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
6321
6334
  }
6322
- static createInstance(options2 = {}, callback) {
6323
- return new _I18n(options2, callback);
6335
+ static createInstance(options = {}, callback) {
6336
+ return new _I18n(options, callback);
6324
6337
  }
6325
- cloneInstance(options2 = {}, callback = noop) {
6326
- const forkResourceStore = options2.forkResourceStore;
6327
- if (forkResourceStore) delete options2.forkResourceStore;
6338
+ cloneInstance(options = {}, callback = noop) {
6339
+ const forkResourceStore = options.forkResourceStore;
6340
+ if (forkResourceStore) delete options.forkResourceStore;
6328
6341
  const mergedOptions = {
6329
6342
  ...this.options,
6330
- ...options2,
6343
+ ...options,
6331
6344
  ...{
6332
6345
  isClone: true
6333
6346
  }
6334
6347
  };
6335
6348
  const clone = new _I18n(mergedOptions);
6336
- if (options2.debug !== void 0 || options2.prefix !== void 0) {
6337
- clone.logger = clone.logger.clone(options2);
6349
+ if (options.debug !== void 0 || options.prefix !== void 0) {
6350
+ clone.logger = clone.logger.clone(options);
6338
6351
  }
6339
6352
  const membersToCopy = ["store", "services", "language"];
6340
6353
  membersToCopy.forEach((m2) => {
@@ -6455,7 +6468,7 @@ var loadLanguages2 = (i18n, lng, ns, cb) => {
6455
6468
  });
6456
6469
  i18n.loadLanguages(lng, loadedClb(i18n, cb));
6457
6470
  };
6458
- var hasLoadedNamespace2 = (ns, i18n, options2 = {}) => {
6471
+ var hasLoadedNamespace2 = (ns, i18n, options = {}) => {
6459
6472
  if (!i18n.languages || !i18n.languages.length) {
6460
6473
  warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
6461
6474
  languages: i18n.languages
@@ -6463,9 +6476,9 @@ var hasLoadedNamespace2 = (ns, i18n, options2 = {}) => {
6463
6476
  return true;
6464
6477
  }
6465
6478
  return i18n.hasLoadedNamespace(ns, {
6466
- lng: options2.lng,
6479
+ lng: options.lng,
6467
6480
  precheck: (i18nInstance2, loadNotPending) => {
6468
- if (options2.bindI18n && options2.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
6481
+ if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
6469
6482
  }
6470
6483
  });
6471
6484
  };
@@ -6510,10 +6523,10 @@ var defaultOptions = {
6510
6523
  useSuspense: true,
6511
6524
  unescape
6512
6525
  };
6513
- var setDefaults = (options2 = {}) => {
6526
+ var setDefaults = (options = {}) => {
6514
6527
  defaultOptions = {
6515
6528
  ...defaultOptions,
6516
- ...options2
6529
+ ...options
6517
6530
  };
6518
6531
  };
6519
6532
  var getDefaults = () => defaultOptions;
@@ -7044,12 +7057,12 @@ var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.ra
7044
7057
  var native_default = { randomUUID };
7045
7058
 
7046
7059
  // node_modules/uuid/dist/esm-browser/v4.js
7047
- function v4(options2, buf, offset) {
7048
- if (native_default.randomUUID && !buf && !options2) {
7060
+ function v4(options, buf, offset) {
7061
+ if (native_default.randomUUID && !buf && !options) {
7049
7062
  return native_default.randomUUID();
7050
7063
  }
7051
- options2 = options2 || {};
7052
- const rnds = options2.random ?? options2.rng?.() ?? rng();
7064
+ options = options || {};
7065
+ const rnds = options.random ?? options.rng?.() ?? rng();
7053
7066
  if (rnds.length < 16) {
7054
7067
  throw new Error("Random bytes length must be >= 16");
7055
7068
  }
@@ -7372,6 +7385,7 @@ function BillingCreditBundleViewFromJSONTyped(json, ignoreDiscriminator) {
7372
7385
  expiryType: json["expiry_type"],
7373
7386
  expiryUnit: json["expiry_unit"],
7374
7387
  expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
7388
+ hasGrants: json["has_grants"],
7375
7389
  id: json["id"],
7376
7390
  name: json["name"],
7377
7391
  pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
@@ -7542,6 +7556,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
7542
7556
  }
7543
7557
  return {
7544
7558
  billingScheme: json["billing_scheme"],
7559
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
7545
7560
  createdAt: new Date(json["created_at"]),
7546
7561
  currency: json["currency"],
7547
7562
  environmentId: json["environment_id"],
@@ -7560,6 +7575,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
7560
7575
  ),
7561
7576
  quantity: json["quantity"],
7562
7577
  subscriptionId: json["subscription_id"],
7578
+ subscriptionItemExternalId: json["subscription_item_external_id"] == null ? void 0 : json["subscription_item_external_id"],
7563
7579
  updatedAt: new Date(json["updated_at"]),
7564
7580
  usageType: json["usage_type"]
7565
7581
  };
@@ -8322,6 +8338,7 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8322
8338
  return json;
8323
8339
  }
8324
8340
  return {
8341
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
8325
8342
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
8326
8343
  createdAt: new Date(json["created_at"]),
8327
8344
  environmentId: json["environment_id"],
@@ -8469,6 +8486,21 @@ function ComponentCapabilitiesFromJSONTyped(json, ignoreDiscriminator) {
8469
8486
  };
8470
8487
  }
8471
8488
 
8489
+ // src/api/checkoutexternal/models/ComponentCheckoutSettings.ts
8490
+ function ComponentCheckoutSettingsFromJSON(json) {
8491
+ return ComponentCheckoutSettingsFromJSONTyped(json, false);
8492
+ }
8493
+ function ComponentCheckoutSettingsFromJSONTyped(json, ignoreDiscriminator) {
8494
+ if (json == null) {
8495
+ return json;
8496
+ }
8497
+ return {
8498
+ collectAddress: json["collect_address"],
8499
+ collectEmail: json["collect_email"],
8500
+ collectPhone: json["collect_phone"]
8501
+ };
8502
+ }
8503
+
8472
8504
  // src/api/checkoutexternal/models/PlanDetailResponseData.ts
8473
8505
  function PlanDetailResponseDataFromJSON(json) {
8474
8506
  return PlanDetailResponseDataFromJSONTyped(json, false);
@@ -8537,6 +8569,9 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
8537
8569
  creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
8538
8570
  creditName: json["credit_name"],
8539
8571
  expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
8572
+ expiryType: json["expiry_type"] == null ? void 0 : json["expiry_type"],
8573
+ expiryUnit: json["expiry_unit"] == null ? void 0 : json["expiry_unit"],
8574
+ expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
8540
8575
  grantReason: json["grant_reason"],
8541
8576
  id: json["id"],
8542
8577
  planId: json["plan_id"] == null ? void 0 : json["plan_id"],
@@ -8564,6 +8599,7 @@ function UsageBasedEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminato
8564
8599
  return json;
8565
8600
  }
8566
8601
  return {
8602
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
8567
8603
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
8568
8604
  featureId: json["feature_id"],
8569
8605
  meteredPrice: json["metered_price"] == null ? void 0 : BillingPriceViewFromJSON(json["metered_price"]),
@@ -8662,6 +8698,9 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8662
8698
  CompatiblePlansFromJSON
8663
8699
  ),
8664
8700
  capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON(json["capabilities"]),
8701
+ checkoutSettings: ComponentCheckoutSettingsFromJSON(
8702
+ json["checkout_settings"]
8703
+ ),
8665
8704
  company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
8666
8705
  component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
8667
8706
  creditBundles: json["credit_bundles"].map(
@@ -10134,6 +10173,7 @@ function PlanEntitlementResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
10134
10173
  return json;
10135
10174
  }
10136
10175
  return {
10176
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
10137
10177
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
10138
10178
  createdAt: new Date(json["created_at"]),
10139
10179
  environmentId: json["environment_id"],
@@ -10223,7 +10263,8 @@ function PublicPlansResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10223
10263
  addOnCompatibilities: json["add_on_compatibilities"].map(
10224
10264
  CompatiblePlansFromJSON2
10225
10265
  ),
10226
- capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON2(json["capabilities"])
10266
+ capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON2(json["capabilities"]),
10267
+ showPeriodToggle: json["show_period_toggle"]
10227
10268
  };
10228
10269
  }
10229
10270
 
@@ -10410,18 +10451,18 @@ var EmbedProvider = ({
10410
10451
  children,
10411
10452
  apiKey,
10412
10453
  apiConfig,
10413
- ...options2
10454
+ ...options
10414
10455
  }) => {
10415
10456
  const sessionIdRef = useRef2(v4_default());
10416
10457
  const styleRef = useRef2(null);
10417
- const [state, dispatch] = useReducer(reducer, options2, (opts) => {
10458
+ const [state, dispatch] = useReducer(reducer, options, (opts) => {
10418
10459
  const providedState = { settings: opts.settings || {} };
10419
10460
  const resolvedState = (0, import_merge2.default)({}, initialState, providedState);
10420
10461
  return resolvedState;
10421
10462
  });
10422
10463
  const customHeaders = useMemo3(
10423
10464
  () => ({
10424
- "X-Schematic-Components-Version": "1.4.0",
10465
+ "X-Schematic-Components-Version": "1.4.2",
10425
10466
  "X-Schematic-Session-ID": sessionIdRef.current
10426
10467
  }),
10427
10468
  []
@@ -10429,11 +10470,11 @@ var EmbedProvider = ({
10429
10470
  const [api, setApi] = useState2({});
10430
10471
  const debug = useCallback3(
10431
10472
  (message, ...args) => {
10432
- if (options2.debug) {
10473
+ if (options.debug) {
10433
10474
  console.debug(`[Schematic] ${message}`, ...args);
10434
10475
  }
10435
10476
  },
10436
- [options2.debug]
10477
+ [options.debug]
10437
10478
  );
10438
10479
  const hydratePublic = useCallback3(async () => {
10439
10480
  dispatch({ type: "HYDRATE_STARTED" });
@@ -10643,8 +10684,8 @@ var EmbedProvider = ({
10643
10684
  dispatch({ type: "SET_DATA", data });
10644
10685
  }, []);
10645
10686
  const updateSettings = useCallback3(
10646
- (settings = {}, options3) => {
10647
- dispatch({ type: "UPDATE_SETTINGS", settings, update: options3?.update });
10687
+ (settings = {}, options2) => {
10688
+ dispatch({ type: "UPDATE_SETTINGS", settings, update: options2?.update });
10648
10689
  },
10649
10690
  []
10650
10691
  );
@@ -10735,9 +10776,9 @@ var EmbedProvider = ({
10735
10776
  }
10736
10777
  }, [debug, state.error]);
10737
10778
  useEffect2(() => {
10738
- const providedSettings = { ...options2.settings || {} };
10779
+ const providedSettings = { ...options.settings || {} };
10739
10780
  updateSettings(providedSettings, { update: false });
10740
- }, [options2.settings, updateSettings]);
10781
+ }, [options.settings, updateSettings]);
10741
10782
  useEffect2(() => {
10742
10783
  const planChanged = (event) => {
10743
10784
  if (event instanceof CustomEvent) {
@@ -11126,7 +11167,6 @@ var Button = dt.button(
11126
11167
  ${() => $selfAlignment && lt`
11127
11168
  align-self: ${$selfAlignment};
11128
11169
  `}
11129
- gap: 0.5rem;
11130
11170
  width: ${$fullWidth ? "100%" : "fit-content"};
11131
11171
  border: 1px solid transparent;
11132
11172
  transition: 0.1s;
@@ -11230,6 +11270,9 @@ var Button = dt.button(
11230
11270
  &::before {
11231
11271
  content: "";
11232
11272
  ${loaderStyles({ $color: theme[$color], $size, $isLoading })}
11273
+ ${$isLoading && lt`
11274
+ margin-right: 0.5rem;
11275
+ `}
11233
11276
  }
11234
11277
 
11235
11278
  &:disabled {
@@ -12428,6 +12471,7 @@ var Sidebar = ({
12428
12471
  addOns,
12429
12472
  creditBundles = [],
12430
12473
  usageBasedEntitlements,
12474
+ addOnUsageBasedEntitlements = [],
12431
12475
  charges,
12432
12476
  checkoutRef,
12433
12477
  checkoutStage,
@@ -12612,6 +12656,35 @@ var Sidebar = ({
12612
12656
  }
12613
12657
  setError(void 0);
12614
12658
  setIsLoading(true);
12659
+ const planPayInAdvance = payInAdvanceEntitlements.reduce(
12660
+ (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
12661
+ const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
12662
+ if (priceId2) {
12663
+ acc.push({
12664
+ priceId: priceId2,
12665
+ quantity
12666
+ });
12667
+ }
12668
+ return acc;
12669
+ },
12670
+ []
12671
+ );
12672
+ const addOnPayInAdvance = addOnUsageBasedEntitlements.filter(
12673
+ (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
12674
+ ).reduce(
12675
+ (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
12676
+ const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
12677
+ if (priceId2) {
12678
+ acc.push({
12679
+ priceId: priceId2,
12680
+ quantity
12681
+ });
12682
+ }
12683
+ return acc;
12684
+ },
12685
+ []
12686
+ );
12687
+ const allPayInAdvance = [...planPayInAdvance, ...addOnPayInAdvance];
12615
12688
  await checkout({
12616
12689
  newPlanId: planId,
12617
12690
  newPriceId: priceId,
@@ -12627,19 +12700,7 @@ var Sidebar = ({
12627
12700
  }
12628
12701
  return acc;
12629
12702
  }, []),
12630
- payInAdvance: payInAdvanceEntitlements.reduce(
12631
- (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
12632
- const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
12633
- if (priceId2) {
12634
- acc.push({
12635
- priceId: priceId2,
12636
- quantity
12637
- });
12638
- }
12639
- return acc;
12640
- },
12641
- []
12642
- ),
12703
+ payInAdvance: allPayInAdvance,
12643
12704
  creditBundles: creditBundles.reduce(
12644
12705
  (acc, { id, count }) => {
12645
12706
  if (count > 0) {
@@ -12677,6 +12738,7 @@ var Sidebar = ({
12677
12738
  setIsLoading,
12678
12739
  setLayout,
12679
12740
  payInAdvanceEntitlements,
12741
+ addOnUsageBasedEntitlements,
12680
12742
  willTrialWithoutPaymentMethod,
12681
12743
  promoCode
12682
12744
  ]);
@@ -14165,7 +14227,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
14165
14227
  $size: "lg",
14166
14228
  type: "number",
14167
14229
  value: entitlement.quantity,
14168
- min: 1,
14230
+ min: 0,
14169
14231
  autoFocus: true,
14170
14232
  onFocus: (event) => {
14171
14233
  event.target.select();
@@ -14173,7 +14235,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
14173
14235
  onChange: (event) => {
14174
14236
  event.preventDefault();
14175
14237
  const value = parseInt(event.target.value);
14176
- if (!isNaN(value) && value > 0) {
14238
+ if (!isNaN(value)) {
14177
14239
  updateQuantity(entitlement.id, value);
14178
14240
  }
14179
14241
  }
@@ -14252,7 +14314,7 @@ var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc,
14252
14314
  const featureUsage = entitlements.find(
14253
14315
  (usage2) => usage2.feature?.id === entitlement.feature?.id
14254
14316
  );
14255
- const allocation = featureUsage?.allocation || 1;
14317
+ const allocation = featureUsage?.allocation || 0;
14256
14318
  const usage = featureUsage?.usage || 0;
14257
14319
  acc.push({
14258
14320
  ...entitlement,
@@ -14265,7 +14327,7 @@ var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc,
14265
14327
  };
14266
14328
  var CheckoutDialog = ({ top = 0 }) => {
14267
14329
  const { t: t2 } = useTranslation();
14268
- const { data, checkoutState, previewCheckout } = useEmbed();
14330
+ const { data, settings, isPending, checkoutState, previewCheckout } = useEmbed();
14269
14331
  const isLightBackground = useIsLightBackground();
14270
14332
  const contentRef = useRef6(null);
14271
14333
  const checkoutRef = useRef6(null);
@@ -14279,16 +14341,6 @@ var CheckoutDialog = ({ top = 0 }) => {
14279
14341
  );
14280
14342
  const [isLoading, setIsLoading] = useState9(false);
14281
14343
  const [error, setError] = useState9();
14282
- const currentPeriod = useMemo9(
14283
- () => checkoutState?.period || isCheckoutData(data) && data.company?.plan?.planPeriod || "month",
14284
- [data, checkoutState?.period]
14285
- );
14286
- const [planPeriod, setPlanPeriod] = useState9(currentPeriod);
14287
- const {
14288
- plans: availablePlans,
14289
- addOns: availableAddOns,
14290
- periods: availablePeriods
14291
- } = useAvailablePlans(planPeriod);
14292
14344
  const {
14293
14345
  currentPlanId,
14294
14346
  currentEntitlements,
@@ -14310,6 +14362,18 @@ var CheckoutDialog = ({ top = 0 }) => {
14310
14362
  trialPaymentMethodRequired: false
14311
14363
  };
14312
14364
  }, [data]);
14365
+ const currentPeriod = useMemo9(
14366
+ () => checkoutState?.period || isCheckoutData(data) && data.company?.plan?.planPeriod || "month",
14367
+ [data, checkoutState?.period]
14368
+ );
14369
+ const [planPeriod, setPlanPeriod] = useState9(currentPeriod);
14370
+ const {
14371
+ plans: availablePlans,
14372
+ addOns: availableAddOns,
14373
+ periods: availablePeriods
14374
+ } = useAvailablePlans(planPeriod, {
14375
+ useSelectedPeriod: showPeriodToggle
14376
+ });
14313
14377
  const [selectedPlan, setSelectedPlan] = useState9(
14314
14378
  () => {
14315
14379
  return availablePlans.find(
@@ -14370,6 +14434,12 @@ var CheckoutDialog = ({ top = 0 }) => {
14370
14434
  ),
14371
14435
  [usageBasedEntitlements]
14372
14436
  );
14437
+ const addOnPayInAdvanceEntitlements = useMemo9(
14438
+ () => addOnUsageBasedEntitlements.filter(
14439
+ (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
14440
+ ),
14441
+ [addOnUsageBasedEntitlements]
14442
+ );
14373
14443
  const [promoCode, setPromoCode] = useState9(null);
14374
14444
  const [isPaymentMethodRequired, setIsPaymentMethodRequired] = useState9(false);
14375
14445
  const willTrialWithoutPaymentMethod = useMemo9(
@@ -14457,20 +14527,8 @@ var CheckoutDialog = ({ top = 0 }) => {
14457
14527
  if (checkoutState?.credits) {
14458
14528
  return "credits";
14459
14529
  }
14460
- if (checkoutState?.planId !== currentPlanId) {
14461
- const hasUsageStage = checkoutStages.some(
14462
- (stage) => stage.id === "usage"
14463
- );
14464
- const hasAddonsStage = checkoutStages.some(
14465
- (stage) => stage.id === "addons"
14466
- );
14467
- const hasAddonsUsageStage = checkoutStages.some(
14468
- (stage) => stage.id === "addonsUsage"
14469
- );
14470
- if (hasUsageStage) return "usage";
14471
- if (hasAddonsStage) return "addons";
14472
- if (hasAddonsUsageStage) return "addonsUsage";
14473
- return "plan";
14530
+ if (typeof checkoutState?.planId !== "undefined" && checkoutState.planId !== currentPlanId) {
14531
+ return checkoutStages.some((stage) => stage.id === "usage") ? "usage" : checkoutStages.some((stage) => stage.id === "addons") ? "addons" : checkoutStages.some((stage) => stage.id === "addonsUsage") ? "addonsUsage" : checkoutStages.some((stage) => stage.id === "credits") ? "credits" : "plan";
14474
14532
  }
14475
14533
  return "plan";
14476
14534
  });
@@ -14609,7 +14667,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14609
14667
  ...entitlement,
14610
14668
  allocation: entitlement.valueNumeric || 0,
14611
14669
  usage: 0,
14612
- quantity: entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ ? 1 : 0
14670
+ quantity: 0
14613
14671
  });
14614
14672
  }
14615
14673
  return acc;
@@ -14676,7 +14734,10 @@ var CheckoutDialog = ({ top = 0 }) => {
14676
14734
  }))
14677
14735
  );
14678
14736
  setAddOnUsageBasedEntitlements(updatedAddOnEntitlements);
14679
- handlePreviewCheckout({ addOns: updated });
14737
+ handlePreviewCheckout({
14738
+ addOns: updated,
14739
+ addOnPayInAdvanceEntitlements: updatedAddOnEntitlements
14740
+ });
14680
14741
  return updated;
14681
14742
  });
14682
14743
  },
@@ -14878,7 +14939,17 @@ var CheckoutDialog = ({ top = 0 }) => {
14878
14939
  ]
14879
14940
  }
14880
14941
  ),
14881
- checkoutStage === "plan" && /* @__PURE__ */ jsx20(
14942
+ isPending ? /* @__PURE__ */ jsx20(
14943
+ Flex,
14944
+ {
14945
+ $width: "100%",
14946
+ $height: "100%",
14947
+ $alignItems: "center",
14948
+ $justifyContent: "center",
14949
+ $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
14950
+ children: /* @__PURE__ */ jsx20(Loader, { $size: "2xl" })
14951
+ }
14952
+ ) : checkoutStage === "plan" ? /* @__PURE__ */ jsx20(
14882
14953
  Plan,
14883
14954
  {
14884
14955
  isLoading,
@@ -14889,8 +14960,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14889
14960
  shouldTrial,
14890
14961
  showPeriodToggle
14891
14962
  }
14892
- ),
14893
- checkoutStage === "usage" && /* @__PURE__ */ jsx20(
14963
+ ) : checkoutStage === "usage" ? /* @__PURE__ */ jsx20(
14894
14964
  Usage,
14895
14965
  {
14896
14966
  isLoading,
@@ -14899,8 +14969,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14899
14969
  entitlements: payInAdvanceEntitlements,
14900
14970
  updateQuantity: updateUsageBasedEntitlementQuantity
14901
14971
  }
14902
- ),
14903
- checkoutStage === "addons" && /* @__PURE__ */ jsx20(
14972
+ ) : checkoutStage === "addons" ? /* @__PURE__ */ jsx20(
14904
14973
  AddOns,
14905
14974
  {
14906
14975
  isLoading,
@@ -14908,26 +14977,23 @@ var CheckoutDialog = ({ top = 0 }) => {
14908
14977
  addOns,
14909
14978
  toggle: (id) => toggleAddOn(id)
14910
14979
  }
14911
- ),
14912
- checkoutStage === "addonsUsage" && /* @__PURE__ */ jsx20(
14980
+ ) : checkoutStage === "addonsUsage" ? /* @__PURE__ */ jsx20(
14913
14981
  Usage,
14914
14982
  {
14915
14983
  isLoading,
14916
14984
  period: planPeriod,
14917
14985
  selectedPlan,
14918
- entitlements: addOnUsageBasedEntitlements,
14986
+ entitlements: addOnPayInAdvanceEntitlements,
14919
14987
  updateQuantity: updateAddOnEntitlementQuantity
14920
14988
  }
14921
- ),
14922
- checkoutStage === "credits" && /* @__PURE__ */ jsx20(
14989
+ ) : checkoutStage === "credits" ? /* @__PURE__ */ jsx20(
14923
14990
  Credits,
14924
14991
  {
14925
14992
  isLoading,
14926
14993
  bundles: creditBundles,
14927
14994
  updateCount: updateCreditBundleCount
14928
14995
  }
14929
- ),
14930
- checkoutStage === "checkout" && /* @__PURE__ */ jsx20(
14996
+ ) : checkoutStage === "checkout" && /* @__PURE__ */ jsx20(
14931
14997
  Checkout,
14932
14998
  {
14933
14999
  isPaymentMethodRequired,
@@ -14945,6 +15011,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14945
15011
  selectedPlan,
14946
15012
  addOns,
14947
15013
  usageBasedEntitlements,
15014
+ addOnUsageBasedEntitlements,
14948
15015
  creditBundles,
14949
15016
  charges,
14950
15017
  checkoutRef,
@@ -15070,7 +15137,7 @@ var PaymentForm = ({ onConfirm }) => {
15070
15137
  import { useMemo as useMemo10 } from "react";
15071
15138
  import { jsx as jsx23 } from "react/jsx-runtime";
15072
15139
  var PeriodToggle = ({
15073
- options: options2,
15140
+ options,
15074
15141
  selectedOption,
15075
15142
  selectedPlan,
15076
15143
  onSelect
@@ -15103,7 +15170,7 @@ var PeriodToggle = ({
15103
15170
  $width: "fit-content"
15104
15171
  }
15105
15172
  },
15106
- children: options2.map((option) => {
15173
+ children: options.map((option) => {
15107
15174
  const element = /* @__PURE__ */ jsx23(
15108
15175
  Flex,
15109
15176
  {
@@ -16155,8 +16222,8 @@ function resolveDesignProps3(props) {
16155
16222
  }
16156
16223
  };
16157
16224
  }
16158
- function formatInvoices(invoices, options2) {
16159
- const { hideUpcoming = true } = options2 || {};
16225
+ function formatInvoices(invoices, options) {
16226
+ const { hideUpcoming = true } = options || {};
16160
16227
  const now = /* @__PURE__ */ new Date();
16161
16228
  return (invoices || []).filter(({ dueDate }) => !hideUpcoming || dueDate && +dueDate <= +now).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url, currency }) => ({
16162
16229
  amount: formatCurrency(amountDue, currency),
@@ -17077,7 +17144,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
17077
17144
  }
17078
17145
  stripe._registerWrapper({
17079
17146
  name: "stripe-js",
17080
- version: "7.8.0",
17147
+ version: "7.9.0",
17081
17148
  startTime
17082
17149
  });
17083
17150
  };
@@ -17152,7 +17219,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
17152
17219
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
17153
17220
  var expectedVersion = RELEASE_TRAIN;
17154
17221
  if (isTestKey && version !== expectedVersion) {
17155
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
17222
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
17156
17223
  }
17157
17224
  var stripe = maybeStripe.apply(void 0, args);
17158
17225
  registerWrapper(stripe, startTime);
@@ -18639,6 +18706,7 @@ var PricingTable = forwardRef12(
18639
18706
  const { t: t2 } = useTranslation();
18640
18707
  const { data, settings, isPending, hydratePublic } = useEmbed();
18641
18708
  const { currentPeriod, showPeriodToggle, isStandalone } = useMemo26(() => {
18709
+ const showPeriodToggle2 = data?.showPeriodToggle ?? props.showPeriodToggle;
18642
18710
  if (isCheckoutData(data)) {
18643
18711
  const billingSubscription = data.company?.billingSubscription;
18644
18712
  const isTrialSubscription = billingSubscription?.status === "trialing";
@@ -18647,7 +18715,7 @@ var PricingTable = forwardRef12(
18647
18715
  currentPeriod: data.company?.plan?.planPeriod || "month",
18648
18716
  currentAddOns: data.company?.addOns || [],
18649
18717
  canCheckout: data.capabilities?.checkout ?? true,
18650
- showPeriodToggle: data.showPeriodToggle ?? props.showPeriodToggle,
18718
+ showPeriodToggle: showPeriodToggle2,
18651
18719
  isTrialSubscription,
18652
18720
  willSubscriptionCancel,
18653
18721
  isStandalone: false
@@ -18657,7 +18725,7 @@ var PricingTable = forwardRef12(
18657
18725
  currentPeriod: "month",
18658
18726
  currentAddOns: [],
18659
18727
  canCheckout: true,
18660
- showPeriodToggle: props.showPeriodToggle,
18728
+ showPeriodToggle: showPeriodToggle2,
18661
18729
  isTrialSubscription: false,
18662
18730
  willSubscriptionCancel: false,
18663
18731
  isStandalone: true
@@ -18693,7 +18761,7 @@ var PricingTable = forwardRef12(
18693
18761
  useEffect8(() => {
18694
18762
  setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
18695
18763
  }, [plans]);
18696
- if (isStandalone && isPending) {
18764
+ if (isPending) {
18697
18765
  return /* @__PURE__ */ jsx46(
18698
18766
  Flex,
18699
18767
  {
@@ -21177,7 +21245,7 @@ var {
21177
21245
  Z_DEFAULT_STRATEGY,
21178
21246
  Z_DEFLATED: Z_DEFLATED$1
21179
21247
  } = constants$2;
21180
- function Deflate$1(options2) {
21248
+ function Deflate$1(options) {
21181
21249
  this.options = common.assign({
21182
21250
  level: Z_DEFAULT_COMPRESSION,
21183
21251
  method: Z_DEFLATED$1,
@@ -21185,7 +21253,7 @@ function Deflate$1(options2) {
21185
21253
  windowBits: 15,
21186
21254
  memLevel: 8,
21187
21255
  strategy: Z_DEFAULT_STRATEGY
21188
- }, options2 || {});
21256
+ }, options || {});
21189
21257
  let opt = this.options;
21190
21258
  if (opt.raw && opt.windowBits > 0) {
21191
21259
  opt.windowBits = -opt.windowBits;
@@ -21291,23 +21359,23 @@ Deflate$1.prototype.onEnd = function(status) {
21291
21359
  this.err = status;
21292
21360
  this.msg = this.strm.msg;
21293
21361
  };
21294
- function deflate$1(input, options2) {
21295
- const deflator = new Deflate$1(options2);
21362
+ function deflate$1(input, options) {
21363
+ const deflator = new Deflate$1(options);
21296
21364
  deflator.push(input, true);
21297
21365
  if (deflator.err) {
21298
21366
  throw deflator.msg || messages[deflator.err];
21299
21367
  }
21300
21368
  return deflator.result;
21301
21369
  }
21302
- function deflateRaw$1(input, options2) {
21303
- options2 = options2 || {};
21304
- options2.raw = true;
21305
- return deflate$1(input, options2);
21370
+ function deflateRaw$1(input, options) {
21371
+ options = options || {};
21372
+ options.raw = true;
21373
+ return deflate$1(input, options);
21306
21374
  }
21307
- function gzip$1(input, options2) {
21308
- options2 = options2 || {};
21309
- options2.gzip = true;
21310
- return deflate$1(input, options2);
21375
+ function gzip$1(input, options) {
21376
+ options = options || {};
21377
+ options.gzip = true;
21378
+ return deflate$1(input, options);
21311
21379
  }
21312
21380
  var Deflate_1$1 = Deflate$1;
21313
21381
  var deflate_2 = deflate$1;
@@ -23120,12 +23188,12 @@ var {
23120
23188
  Z_DATA_ERROR,
23121
23189
  Z_MEM_ERROR
23122
23190
  } = constants$2;
23123
- function Inflate$1(options2) {
23191
+ function Inflate$1(options) {
23124
23192
  this.options = common.assign({
23125
23193
  chunkSize: 1024 * 64,
23126
23194
  windowBits: 15,
23127
23195
  to: ""
23128
- }, options2 || {});
23196
+ }, options || {});
23129
23197
  const opt = this.options;
23130
23198
  if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
23131
23199
  opt.windowBits = -opt.windowBits;
@@ -23133,7 +23201,7 @@ function Inflate$1(options2) {
23133
23201
  opt.windowBits = -15;
23134
23202
  }
23135
23203
  }
23136
- if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options2 && options2.windowBits)) {
23204
+ if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
23137
23205
  opt.windowBits += 32;
23138
23206
  }
23139
23207
  if (opt.windowBits > 15 && opt.windowBits < 48) {
@@ -23255,16 +23323,16 @@ Inflate$1.prototype.onEnd = function(status) {
23255
23323
  this.err = status;
23256
23324
  this.msg = this.strm.msg;
23257
23325
  };
23258
- function inflate$1(input, options2) {
23259
- const inflator = new Inflate$1(options2);
23326
+ function inflate$1(input, options) {
23327
+ const inflator = new Inflate$1(options);
23260
23328
  inflator.push(input);
23261
23329
  if (inflator.err) throw inflator.msg || messages[inflator.err];
23262
23330
  return inflator.result;
23263
23331
  }
23264
- function inflateRaw$1(input, options2) {
23265
- options2 = options2 || {};
23266
- options2.raw = true;
23267
- return inflate$1(input, options2);
23332
+ function inflateRaw$1(input, options) {
23333
+ options = options || {};
23334
+ options.raw = true;
23335
+ return inflate$1(input, options);
23268
23336
  }
23269
23337
  var Inflate_1$1 = Inflate$1;
23270
23338
  var inflate_2 = inflate$1;
@@ -23332,8 +23400,8 @@ function parseEditorState(data) {
23332
23400
  });
23333
23401
  return arr;
23334
23402
  }
23335
- function createRenderer(options2) {
23336
- const { useFallback = false } = options2 || {};
23403
+ function createRenderer(options) {
23404
+ const { useFallback = false } = options || {};
23337
23405
  return function renderNode(node2, index) {
23338
23406
  const { type, props = {}, children } = node2;
23339
23407
  const name = typeof type !== "string" ? type.resolvedName : type;