@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.
@@ -289,17 +289,17 @@ var require_debounce = __commonJS({
289
289
  var FUNC_ERROR_TEXT = "Expected a function";
290
290
  var nativeMax = Math.max;
291
291
  var nativeMin = Math.min;
292
- function debounce4(func, wait, options2) {
292
+ function debounce4(func, wait, options) {
293
293
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
294
294
  if (typeof func != "function") {
295
295
  throw new TypeError(FUNC_ERROR_TEXT);
296
296
  }
297
297
  wait = toNumber(wait) || 0;
298
- if (isObject2(options2)) {
299
- leading = !!options2.leading;
300
- maxing = "maxWait" in options2;
301
- maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait;
302
- trailing = "trailing" in options2 ? !!options2.trailing : trailing;
298
+ if (isObject2(options)) {
299
+ leading = !!options.leading;
300
+ maxing = "maxWait" in options;
301
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
302
+ trailing = "trailing" in options ? !!options.trailing : trailing;
303
303
  }
304
304
  function invokeFunc(time) {
305
305
  var args = lastArgs, thisArg = lastThis;
@@ -1945,8 +1945,8 @@ function getPriceValue(billingPrice) {
1945
1945
  const price = typeof billingPrice.priceDecimal === "string" ? Number(billingPrice.priceDecimal) : billingPrice.price;
1946
1946
  return price;
1947
1947
  }
1948
- function getPlanPrice(plan, period = "month", options2 = { useSelectedPeriod: true }) {
1949
- const billingPrice = options2.useSelectedPeriod ? period === "year" ? plan.yearlyPrice : plan.monthlyPrice : plan.yearlyPrice && !plan.monthlyPrice ? plan.yearlyPrice : plan.monthlyPrice;
1948
+ function getPlanPrice(plan, period = "month", options = { useSelectedPeriod: true }) {
1949
+ const billingPrice = options.useSelectedPeriod ? period === "year" ? plan.yearlyPrice : plan.monthlyPrice : plan.yearlyPrice && !plan.monthlyPrice ? plan.yearlyPrice : plan.monthlyPrice;
1950
1950
  if (billingPrice) {
1951
1951
  return { ...billingPrice, price: getPriceValue(billingPrice) };
1952
1952
  }
@@ -2078,14 +2078,14 @@ function groupPlanCreditGrants(creditGrants) {
2078
2078
  );
2079
2079
  return Object.values(map);
2080
2080
  }
2081
- function groupCreditGrants(creditGrants, options2) {
2081
+ function groupCreditGrants(creditGrants, options) {
2082
2082
  const today = /* @__PURE__ */ new Date();
2083
2083
  const map = creditGrants.reduce(
2084
2084
  (acc, grant) => {
2085
2085
  const isExpired = !!grant.expiresAt && grant.expiresAt <= today;
2086
2086
  const isZeroedOut = !!grant.zeroedOutDate;
2087
2087
  if (!isExpired && !isZeroedOut) {
2088
- const key = options2?.groupBy === "bundle" ? grant.billingCreditBundleId || grant.id : options2?.groupBy === "credit" ? grant.billingCreditId : grant.id;
2088
+ const key = options?.groupBy === "bundle" ? grant.billingCreditBundleId || grant.id : options?.groupBy === "credit" ? grant.billingCreditId : grant.id;
2089
2089
  const current = acc[key];
2090
2090
  acc[key] = {
2091
2091
  // credit-specific attributes
@@ -4145,7 +4145,7 @@ attr.rem = function propAsRem(key, value) {
4145
4145
  };
4146
4146
 
4147
4147
  // src/hooks/useAvailablePlans.ts
4148
- function useAvailablePlans(activePeriod, options2 = { useSelectedPeriod: true }) {
4148
+ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true }) {
4149
4149
  const { data, settings } = useEmbed();
4150
4150
  const getAvailablePeriods = (0, import_react2.useCallback)(() => {
4151
4151
  const periods = [];
@@ -4160,14 +4160,14 @@ function useAvailablePlans(activePeriod, options2 = { useSelectedPeriod: true })
4160
4160
  const getActivePlans = (0, import_react2.useCallback)(
4161
4161
  (plans) => {
4162
4162
  const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
4163
- if (options2.useSelectedPeriod) {
4163
+ if (options.useSelectedPeriod) {
4164
4164
  return activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
4165
4165
  }
4166
4166
  return plan.monthlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
4167
4167
  });
4168
4168
  return activePlans.map((plan) => ({ ...plan, isSelected: false }));
4169
4169
  },
4170
- [activePeriod, options2.useSelectedPeriod, settings.mode]
4170
+ [activePeriod, options.useSelectedPeriod, settings.mode]
4171
4171
  );
4172
4172
  return (0, import_react2.useMemo)(() => {
4173
4173
  return {
@@ -4497,14 +4497,14 @@ var consoleLogger = {
4497
4497
  }
4498
4498
  };
4499
4499
  var Logger = class _Logger {
4500
- constructor(concreteLogger, options2 = {}) {
4501
- this.init(concreteLogger, options2);
4500
+ constructor(concreteLogger, options = {}) {
4501
+ this.init(concreteLogger, options);
4502
4502
  }
4503
- init(concreteLogger, options2 = {}) {
4504
- this.prefix = options2.prefix || "i18next:";
4503
+ init(concreteLogger, options = {}) {
4504
+ this.prefix = options.prefix || "i18next:";
4505
4505
  this.logger = concreteLogger || consoleLogger;
4506
- this.options = options2;
4507
- this.debug = options2.debug;
4506
+ this.options = options;
4507
+ this.debug = options.debug;
4508
4508
  }
4509
4509
  log(...args) {
4510
4510
  return this.forward(args, "log", "", true);
@@ -4531,10 +4531,10 @@ var Logger = class _Logger {
4531
4531
  ...this.options
4532
4532
  });
4533
4533
  }
4534
- clone(options2) {
4535
- options2 = options2 || this.options;
4536
- options2.prefix = options2.prefix || this.prefix;
4537
- return new _Logger(this.logger, options2);
4534
+ clone(options) {
4535
+ options = options || this.options;
4536
+ options.prefix = options.prefix || this.prefix;
4537
+ return new _Logger(this.logger, options);
4538
4538
  }
4539
4539
  };
4540
4540
  var baseLogger = new Logger();
@@ -4578,13 +4578,13 @@ var EventEmitter = class {
4578
4578
  }
4579
4579
  };
4580
4580
  var ResourceStore = class extends EventEmitter {
4581
- constructor(data, options2 = {
4581
+ constructor(data, options = {
4582
4582
  ns: ["translation"],
4583
4583
  defaultNS: "translation"
4584
4584
  }) {
4585
4585
  super();
4586
4586
  this.data = data || {};
4587
- this.options = options2;
4587
+ this.options = options;
4588
4588
  if (this.options.keySeparator === void 0) {
4589
4589
  this.options.keySeparator = ".";
4590
4590
  }
@@ -4603,9 +4603,9 @@ var ResourceStore = class extends EventEmitter {
4603
4603
  this.options.ns.splice(index, 1);
4604
4604
  }
4605
4605
  }
4606
- getResource(lng, ns, key, options2 = {}) {
4607
- const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
4608
- const ignoreJSONStructure = options2.ignoreJSONStructure !== void 0 ? options2.ignoreJSONStructure : this.options.ignoreJSONStructure;
4606
+ getResource(lng, ns, key, options = {}) {
4607
+ const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
4608
+ const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
4609
4609
  let path;
4610
4610
  if (lng.indexOf(".") > -1) {
4611
4611
  path = lng.split(".");
@@ -4630,10 +4630,10 @@ var ResourceStore = class extends EventEmitter {
4630
4630
  if (result || !ignoreJSONStructure || !isString(key)) return result;
4631
4631
  return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
4632
4632
  }
4633
- addResource(lng, ns, key, value, options2 = {
4633
+ addResource(lng, ns, key, value, options = {
4634
4634
  silent: false
4635
4635
  }) {
4636
- const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
4636
+ const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
4637
4637
  let path = [lng, ns];
4638
4638
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
4639
4639
  if (lng.indexOf(".") > -1) {
@@ -4643,9 +4643,9 @@ var ResourceStore = class extends EventEmitter {
4643
4643
  }
4644
4644
  this.addNamespaces(ns);
4645
4645
  setPath(this.data, path, value);
4646
- if (!options2.silent) this.emit("added", lng, ns, key, value);
4646
+ if (!options.silent) this.emit("added", lng, ns, key, value);
4647
4647
  }
4648
- addResources(lng, ns, resources, options2 = {
4648
+ addResources(lng, ns, resources, options = {
4649
4649
  silent: false
4650
4650
  }) {
4651
4651
  for (const m2 in resources) {
@@ -4653,9 +4653,9 @@ var ResourceStore = class extends EventEmitter {
4653
4653
  silent: true
4654
4654
  });
4655
4655
  }
4656
- if (!options2.silent) this.emit("added", lng, ns, resources);
4656
+ if (!options.silent) this.emit("added", lng, ns, resources);
4657
4657
  }
4658
- addResourceBundle(lng, ns, resources, deep, overwrite, options2 = {
4658
+ addResourceBundle(lng, ns, resources, deep, overwrite, options = {
4659
4659
  silent: false,
4660
4660
  skipCopy: false
4661
4661
  }) {
@@ -4668,7 +4668,7 @@ var ResourceStore = class extends EventEmitter {
4668
4668
  }
4669
4669
  this.addNamespaces(ns);
4670
4670
  let pack = getPath(this.data, path) || {};
4671
- if (!options2.skipCopy) resources = JSON.parse(JSON.stringify(resources));
4671
+ if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
4672
4672
  if (deep) {
4673
4673
  deepExtend(pack, resources, overwrite);
4674
4674
  } else {
@@ -4678,7 +4678,7 @@ var ResourceStore = class extends EventEmitter {
4678
4678
  };
4679
4679
  }
4680
4680
  setPath(this.data, path, pack);
4681
- if (!options2.silent) this.emit("added", lng, ns, resources);
4681
+ if (!options.silent) this.emit("added", lng, ns, resources);
4682
4682
  }
4683
4683
  removeResourceBundle(lng, ns) {
4684
4684
  if (this.hasResourceBundle(lng, ns)) {
@@ -4711,9 +4711,9 @@ var postProcessor = {
4711
4711
  addPostProcessor(module2) {
4712
4712
  this.processors[module2.name] = module2;
4713
4713
  },
4714
- handle(processors, value, key, options2, translator) {
4714
+ handle(processors, value, key, options, translator) {
4715
4715
  processors.forEach((processor) => {
4716
- value = this.processors[processor]?.process(value, key, options2, translator) ?? value;
4716
+ value = this.processors[processor]?.process(value, key, options, translator) ?? value;
4717
4717
  });
4718
4718
  return value;
4719
4719
  }
@@ -4741,10 +4741,10 @@ function keysFromSelector(selector, opts) {
4741
4741
  var checkedLoadedFor = {};
4742
4742
  var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
4743
4743
  var Translator = class _Translator extends EventEmitter {
4744
- constructor(services, options2 = {}) {
4744
+ constructor(services, options = {}) {
4745
4745
  super();
4746
4746
  copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
4747
- this.options = options2;
4747
+ this.options = options;
4748
4748
  if (this.options.keySeparator === void 0) {
4749
4749
  this.options.keySeparator = ".";
4750
4750
  }
@@ -4794,12 +4794,15 @@ var Translator = class _Translator extends EventEmitter {
4794
4794
  if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
4795
4795
  opt = this.options.overloadTranslationOptionHandler(arguments);
4796
4796
  }
4797
- if (typeof options === "object") opt = {
4797
+ if (typeof opt === "object") opt = {
4798
4798
  ...opt
4799
4799
  };
4800
4800
  if (!opt) opt = {};
4801
4801
  if (keys == null) return "";
4802
- if (typeof keys === "function") keys = keysFromSelector(keys, opt);
4802
+ if (typeof keys === "function") keys = keysFromSelector(keys, {
4803
+ ...this.options,
4804
+ ...opt
4805
+ });
4803
4806
  if (!Array.isArray(keys)) keys = [String(keys)];
4804
4807
  const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
4805
4808
  const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
@@ -5120,16 +5123,16 @@ var Translator = class _Translator extends EventEmitter {
5120
5123
  isValidLookup(res) {
5121
5124
  return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
5122
5125
  }
5123
- getResource(code, ns, key, options2 = {}) {
5124
- if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options2);
5125
- return this.resourceStore.getResource(code, ns, key, options2);
5126
+ getResource(code, ns, key, options = {}) {
5127
+ if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
5128
+ return this.resourceStore.getResource(code, ns, key, options);
5126
5129
  }
5127
- getUsedParamsDetails(options2 = {}) {
5130
+ getUsedParamsDetails(options = {}) {
5128
5131
  const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
5129
- const useOptionsReplaceForData = options2.replace && !isString(options2.replace);
5130
- let data = useOptionsReplaceForData ? options2.replace : options2;
5131
- if (useOptionsReplaceForData && typeof options2.count !== "undefined") {
5132
- data.count = options2.count;
5132
+ const useOptionsReplaceForData = options.replace && !isString(options.replace);
5133
+ let data = useOptionsReplaceForData ? options.replace : options;
5134
+ if (useOptionsReplaceForData && typeof options.count !== "undefined") {
5135
+ data.count = options.count;
5133
5136
  }
5134
5137
  if (this.options.interpolation.defaultVariables) {
5135
5138
  data = {
@@ -5147,10 +5150,10 @@ var Translator = class _Translator extends EventEmitter {
5147
5150
  }
5148
5151
  return data;
5149
5152
  }
5150
- static hasDefaultValue(options2) {
5153
+ static hasDefaultValue(options) {
5151
5154
  const prefix2 = "defaultValue";
5152
- for (const option in options2) {
5153
- if (Object.prototype.hasOwnProperty.call(options2, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options2[option]) {
5155
+ for (const option in options) {
5156
+ if (Object.prototype.hasOwnProperty.call(options, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options[option]) {
5154
5157
  return true;
5155
5158
  }
5156
5159
  }
@@ -5158,8 +5161,8 @@ var Translator = class _Translator extends EventEmitter {
5158
5161
  }
5159
5162
  };
5160
5163
  var LanguageUtil = class {
5161
- constructor(options2) {
5162
- this.options = options2;
5164
+ constructor(options) {
5165
+ this.options = options;
5163
5166
  this.supportedLngs = this.options.supportedLngs || false;
5164
5167
  this.logger = baseLogger.create("languageUtils");
5165
5168
  }
@@ -5280,9 +5283,9 @@ var dummyRule = {
5280
5283
  })
5281
5284
  };
5282
5285
  var PluralResolver = class {
5283
- constructor(languageUtils, options2 = {}) {
5286
+ constructor(languageUtils, options = {}) {
5284
5287
  this.languageUtils = languageUtils;
5285
- this.options = options2;
5288
+ this.options = options;
5286
5289
  this.logger = baseLogger.create("pluralResolver");
5287
5290
  this.pluralRulesCache = {};
5288
5291
  }
@@ -5292,9 +5295,9 @@ var PluralResolver = class {
5292
5295
  clearCache() {
5293
5296
  this.pluralRulesCache = {};
5294
5297
  }
5295
- getRule(code, options2 = {}) {
5298
+ getRule(code, options = {}) {
5296
5299
  const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
5297
- const type = options2.ordinal ? "ordinal" : "cardinal";
5300
+ const type = options.ordinal ? "ordinal" : "cardinal";
5298
5301
  const cacheKey = JSON.stringify({
5299
5302
  cleanedCode,
5300
5303
  type
@@ -5314,32 +5317,32 @@ var PluralResolver = class {
5314
5317
  }
5315
5318
  if (!code.match(/-|_/)) return dummyRule;
5316
5319
  const lngPart = this.languageUtils.getLanguagePartFromCode(code);
5317
- rule = this.getRule(lngPart, options2);
5320
+ rule = this.getRule(lngPart, options);
5318
5321
  }
5319
5322
  this.pluralRulesCache[cacheKey] = rule;
5320
5323
  return rule;
5321
5324
  }
5322
- needsPlural(code, options2 = {}) {
5323
- let rule = this.getRule(code, options2);
5324
- if (!rule) rule = this.getRule("dev", options2);
5325
+ needsPlural(code, options = {}) {
5326
+ let rule = this.getRule(code, options);
5327
+ if (!rule) rule = this.getRule("dev", options);
5325
5328
  return rule?.resolvedOptions().pluralCategories.length > 1;
5326
5329
  }
5327
- getPluralFormsOfKey(code, key, options2 = {}) {
5328
- return this.getSuffixes(code, options2).map((suffix) => `${key}${suffix}`);
5330
+ getPluralFormsOfKey(code, key, options = {}) {
5331
+ return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
5329
5332
  }
5330
- getSuffixes(code, options2 = {}) {
5331
- let rule = this.getRule(code, options2);
5332
- if (!rule) rule = this.getRule("dev", options2);
5333
+ getSuffixes(code, options = {}) {
5334
+ let rule = this.getRule(code, options);
5335
+ if (!rule) rule = this.getRule("dev", options);
5333
5336
  if (!rule) return [];
5334
- return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
5337
+ return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
5335
5338
  }
5336
- getSuffix(code, count, options2 = {}) {
5337
- const rule = this.getRule(code, options2);
5339
+ getSuffix(code, count, options = {}) {
5340
+ const rule = this.getRule(code, options);
5338
5341
  if (rule) {
5339
- return `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
5342
+ return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
5340
5343
  }
5341
5344
  this.logger.warn(`no plural rule found for: ${code}`);
5342
- return this.getSuffix("dev", count, options2);
5345
+ return this.getSuffix("dev", count, options);
5343
5346
  }
5344
5347
  };
5345
5348
  var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
@@ -5352,14 +5355,14 @@ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJS
5352
5355
  };
5353
5356
  var regexSafe = (val) => val.replace(/\$/g, "$$$$");
5354
5357
  var Interpolator = class {
5355
- constructor(options2 = {}) {
5358
+ constructor(options = {}) {
5356
5359
  this.logger = baseLogger.create("interpolator");
5357
- this.options = options2;
5358
- this.format = options2?.interpolation?.format || ((value) => value);
5359
- this.init(options2);
5360
+ this.options = options;
5361
+ this.format = options?.interpolation?.format || ((value) => value);
5362
+ this.init(options);
5360
5363
  }
5361
- init(options2 = {}) {
5362
- if (!options2.interpolation) options2.interpolation = {
5364
+ init(options = {}) {
5365
+ if (!options.interpolation) options.interpolation = {
5363
5366
  escapeValue: true
5364
5367
  };
5365
5368
  const {
@@ -5380,7 +5383,7 @@ var Interpolator = class {
5380
5383
  nestingOptionsSeparator,
5381
5384
  maxReplaces,
5382
5385
  alwaysFormat
5383
- } = options2.interpolation;
5386
+ } = options.interpolation;
5384
5387
  this.escape = escape$1 !== void 0 ? escape$1 : escape;
5385
5388
  this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
5386
5389
  this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
@@ -5411,7 +5414,7 @@ var Interpolator = class {
5411
5414
  this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
5412
5415
  this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
5413
5416
  }
5414
- interpolate(str, data, lng, options2) {
5417
+ interpolate(str, data, lng, options) {
5415
5418
  let match2;
5416
5419
  let value;
5417
5420
  let replaces;
@@ -5420,7 +5423,7 @@ var Interpolator = class {
5420
5423
  if (key.indexOf(this.formatSeparator) < 0) {
5421
5424
  const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
5422
5425
  return this.alwaysFormat ? this.format(path, void 0, lng, {
5423
- ...options2,
5426
+ ...options,
5424
5427
  ...data,
5425
5428
  interpolationkey: key
5426
5429
  }) : path;
@@ -5429,14 +5432,14 @@ var Interpolator = class {
5429
5432
  const k2 = p2.shift().trim();
5430
5433
  const f2 = p2.join(this.formatSeparator).trim();
5431
5434
  return this.format(deepFindWithDefaults(data, defaultData, k2, this.options.keySeparator, this.options.ignoreJSONStructure), f2, lng, {
5432
- ...options2,
5435
+ ...options,
5433
5436
  ...data,
5434
5437
  interpolationkey: k2
5435
5438
  });
5436
5439
  };
5437
5440
  this.resetRegExp();
5438
- const missingInterpolationHandler = options2?.missingInterpolationHandler || this.options.missingInterpolationHandler;
5439
- const skipOnVariables = options2?.interpolation?.skipOnVariables !== void 0 ? options2.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
5441
+ const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
5442
+ const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
5440
5443
  const todos = [{
5441
5444
  regex: this.regexpUnescape,
5442
5445
  safeValue: (val) => regexSafe(val)
@@ -5451,9 +5454,9 @@ var Interpolator = class {
5451
5454
  value = handleFormat(matchedVar);
5452
5455
  if (value === void 0) {
5453
5456
  if (typeof missingInterpolationHandler === "function") {
5454
- const temp = missingInterpolationHandler(str, match2, options2);
5457
+ const temp = missingInterpolationHandler(str, match2, options);
5455
5458
  value = isString(temp) ? temp : "";
5456
- } else if (options2 && Object.prototype.hasOwnProperty.call(options2, matchedVar)) {
5459
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
5457
5460
  value = "";
5458
5461
  } else if (skipOnVariables) {
5459
5462
  value = match2[0];
@@ -5481,7 +5484,7 @@ var Interpolator = class {
5481
5484
  });
5482
5485
  return str;
5483
5486
  }
5484
- nest(str, fc, options2 = {}) {
5487
+ nest(str, fc, options = {}) {
5485
5488
  let match2;
5486
5489
  let value;
5487
5490
  let clonedOptions;
@@ -5513,7 +5516,7 @@ var Interpolator = class {
5513
5516
  while (match2 = this.nestingRegexp.exec(str)) {
5514
5517
  let formatters = [];
5515
5518
  clonedOptions = {
5516
- ...options2
5519
+ ...options
5517
5520
  };
5518
5521
  clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
5519
5522
  clonedOptions.applyPostProcessor = false;
@@ -5531,8 +5534,8 @@ var Interpolator = class {
5531
5534
  value = "";
5532
5535
  }
5533
5536
  if (formatters.length) {
5534
- value = formatters.reduce((v2, f2) => this.format(v2, f2, options2.lng, {
5535
- ...options2,
5537
+ value = formatters.reduce((v2, f2) => this.format(v2, f2, options.lng, {
5538
+ ...options,
5536
5539
  interpolationkey: match2[1].trim()
5537
5540
  }), value.trim());
5538
5541
  }
@@ -5594,16 +5597,16 @@ var createCachedFormatter = (fn) => {
5594
5597
  };
5595
5598
  var createNonCachedFormatter = (fn) => (v2, l2, o2) => fn(getCleanedCode(l2), o2)(v2);
5596
5599
  var Formatter = class {
5597
- constructor(options2 = {}) {
5600
+ constructor(options = {}) {
5598
5601
  this.logger = baseLogger.create("formatter");
5599
- this.options = options2;
5600
- this.init(options2);
5602
+ this.options = options;
5603
+ this.init(options);
5601
5604
  }
5602
- init(services, options2 = {
5605
+ init(services, options = {
5603
5606
  interpolation: {}
5604
5607
  }) {
5605
- this.formatSeparator = options2.interpolation.formatSeparator || ",";
5606
- const cf = options2.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
5608
+ this.formatSeparator = options.interpolation.formatSeparator || ",";
5609
+ const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
5607
5610
  this.formats = {
5608
5611
  number: cf((lng, opt) => {
5609
5612
  const formatter = new Intl.NumberFormat(lng, {
@@ -5644,7 +5647,7 @@ var Formatter = class {
5644
5647
  addCached(name, fc) {
5645
5648
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
5646
5649
  }
5647
- format(value, format, lng, options2 = {}) {
5650
+ format(value, format, lng, options = {}) {
5648
5651
  const formats = format.split(this.formatSeparator);
5649
5652
  if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
5650
5653
  const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
@@ -5658,11 +5661,11 @@ var Formatter = class {
5658
5661
  if (this.formats[formatName]) {
5659
5662
  let formatted = mem;
5660
5663
  try {
5661
- const valOptions = options2?.formatParams?.[options2.interpolationkey] || {};
5662
- const l2 = valOptions.locale || valOptions.lng || options2.locale || options2.lng || lng;
5664
+ const valOptions = options?.formatParams?.[options.interpolationkey] || {};
5665
+ const l2 = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
5663
5666
  formatted = this.formats[formatName](mem, l2, {
5664
5667
  ...formatOptions,
5665
- ...options2,
5668
+ ...options,
5666
5669
  ...valOptions
5667
5670
  });
5668
5671
  } catch (error) {
@@ -5684,24 +5687,24 @@ var removePending = (q2, name) => {
5684
5687
  }
5685
5688
  };
5686
5689
  var Connector = class extends EventEmitter {
5687
- constructor(backend, store, services, options2 = {}) {
5690
+ constructor(backend, store, services, options = {}) {
5688
5691
  super();
5689
5692
  this.backend = backend;
5690
5693
  this.store = store;
5691
5694
  this.services = services;
5692
5695
  this.languageUtils = services.languageUtils;
5693
- this.options = options2;
5696
+ this.options = options;
5694
5697
  this.logger = baseLogger.create("backendConnector");
5695
5698
  this.waitingReads = [];
5696
- this.maxParallelReads = options2.maxParallelReads || 10;
5699
+ this.maxParallelReads = options.maxParallelReads || 10;
5697
5700
  this.readingCalls = 0;
5698
- this.maxRetries = options2.maxRetries >= 0 ? options2.maxRetries : 5;
5699
- this.retryTimeout = options2.retryTimeout >= 1 ? options2.retryTimeout : 350;
5701
+ this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
5702
+ this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
5700
5703
  this.state = {};
5701
5704
  this.queue = [];
5702
- this.backend?.init?.(services, options2.backend, options2);
5705
+ this.backend?.init?.(services, options.backend, options);
5703
5706
  }
5704
- queueLoad(languages, namespaces, options2, callback) {
5707
+ queueLoad(languages, namespaces, options, callback) {
5705
5708
  const toLoad = {};
5706
5709
  const pending = {};
5707
5710
  const toLoadLanguages = {};
@@ -5710,7 +5713,7 @@ var Connector = class extends EventEmitter {
5710
5713
  let hasAllNamespaces = true;
5711
5714
  namespaces.forEach((ns) => {
5712
5715
  const name = `${lng}|${ns}`;
5713
- if (!options2.reload && this.store.hasResourceBundle(lng, ns)) {
5716
+ if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
5714
5717
  this.state[name] = 2;
5715
5718
  } else if (this.state[name] < 0) ;
5716
5719
  else if (this.state[name] === 1) {
@@ -5823,14 +5826,14 @@ var Connector = class extends EventEmitter {
5823
5826
  }
5824
5827
  return fc(lng, ns, resolver);
5825
5828
  }
5826
- prepareLoading(languages, namespaces, options2 = {}, callback) {
5829
+ prepareLoading(languages, namespaces, options = {}, callback) {
5827
5830
  if (!this.backend) {
5828
5831
  this.logger.warn("No backend was added via i18next.use. Will not load resources.");
5829
5832
  return callback && callback();
5830
5833
  }
5831
5834
  if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
5832
5835
  if (isString(namespaces)) namespaces = [namespaces];
5833
- const toLoad = this.queueLoad(languages, namespaces, options2, callback);
5836
+ const toLoad = this.queueLoad(languages, namespaces, options, callback);
5834
5837
  if (!toLoad.toLoad.length) {
5835
5838
  if (!toLoad.pending.length) callback();
5836
5839
  return null;
@@ -5857,7 +5860,7 @@ var Connector = class extends EventEmitter {
5857
5860
  this.loaded(name, err2, data);
5858
5861
  });
5859
5862
  }
5860
- saveMissing(languages, namespace, key, fallbackValue, isUpdate, options2 = {}, clb = () => {
5863
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {
5861
5864
  }) {
5862
5865
  if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
5863
5866
  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!!!");
@@ -5866,7 +5869,7 @@ var Connector = class extends EventEmitter {
5866
5869
  if (key === void 0 || key === null || key === "") return;
5867
5870
  if (this.backend?.create) {
5868
5871
  const opts = {
5869
- ...options2,
5872
+ ...options,
5870
5873
  isUpdate
5871
5874
  };
5872
5875
  const fc = this.backend.create.bind(this.backend);
@@ -5933,9 +5936,9 @@ var get = () => ({
5933
5936
  if (isString(args[1])) ret.defaultValue = args[1];
5934
5937
  if (isString(args[2])) ret.tDescription = args[2];
5935
5938
  if (typeof args[2] === "object" || typeof args[3] === "object") {
5936
- const options2 = args[3] || args[2];
5937
- Object.keys(options2).forEach((key) => {
5938
- ret[key] = options2[key];
5939
+ const options = args[3] || args[2];
5940
+ Object.keys(options).forEach((key) => {
5941
+ ret[key] = options[key];
5939
5942
  });
5940
5943
  }
5941
5944
  return ret;
@@ -5955,15 +5958,15 @@ var get = () => ({
5955
5958
  },
5956
5959
  cacheInBuiltFormats: true
5957
5960
  });
5958
- var transformOptions = (options2) => {
5959
- if (isString(options2.ns)) options2.ns = [options2.ns];
5960
- if (isString(options2.fallbackLng)) options2.fallbackLng = [options2.fallbackLng];
5961
- if (isString(options2.fallbackNS)) options2.fallbackNS = [options2.fallbackNS];
5962
- if (options2.supportedLngs?.indexOf?.("cimode") < 0) {
5963
- options2.supportedLngs = options2.supportedLngs.concat(["cimode"]);
5961
+ var transformOptions = (options) => {
5962
+ if (isString(options.ns)) options.ns = [options.ns];
5963
+ if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
5964
+ if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
5965
+ if (options.supportedLngs?.indexOf?.("cimode") < 0) {
5966
+ options.supportedLngs = options.supportedLngs.concat(["cimode"]);
5964
5967
  }
5965
- if (typeof options2.initImmediate === "boolean") options2.initAsync = options2.initImmediate;
5966
- return options2;
5968
+ if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
5969
+ return options;
5967
5970
  };
5968
5971
  var noop = () => {
5969
5972
  };
@@ -5976,53 +5979,53 @@ var bindMemberFunctions = (inst) => {
5976
5979
  });
5977
5980
  };
5978
5981
  var I18n = class _I18n extends EventEmitter {
5979
- constructor(options2 = {}, callback) {
5982
+ constructor(options = {}, callback) {
5980
5983
  super();
5981
- this.options = transformOptions(options2);
5984
+ this.options = transformOptions(options);
5982
5985
  this.services = {};
5983
5986
  this.logger = baseLogger;
5984
5987
  this.modules = {
5985
5988
  external: []
5986
5989
  };
5987
5990
  bindMemberFunctions(this);
5988
- if (callback && !this.isInitialized && !options2.isClone) {
5991
+ if (callback && !this.isInitialized && !options.isClone) {
5989
5992
  if (!this.options.initAsync) {
5990
- this.init(options2, callback);
5993
+ this.init(options, callback);
5991
5994
  return this;
5992
5995
  }
5993
5996
  setTimeout(() => {
5994
- this.init(options2, callback);
5997
+ this.init(options, callback);
5995
5998
  }, 0);
5996
5999
  }
5997
6000
  }
5998
- init(options2 = {}, callback) {
6001
+ init(options = {}, callback) {
5999
6002
  this.isInitializing = true;
6000
- if (typeof options2 === "function") {
6001
- callback = options2;
6002
- options2 = {};
6003
+ if (typeof options === "function") {
6004
+ callback = options;
6005
+ options = {};
6003
6006
  }
6004
- if (options2.defaultNS == null && options2.ns) {
6005
- if (isString(options2.ns)) {
6006
- options2.defaultNS = options2.ns;
6007
- } else if (options2.ns.indexOf("translation") < 0) {
6008
- options2.defaultNS = options2.ns[0];
6007
+ if (options.defaultNS == null && options.ns) {
6008
+ if (isString(options.ns)) {
6009
+ options.defaultNS = options.ns;
6010
+ } else if (options.ns.indexOf("translation") < 0) {
6011
+ options.defaultNS = options.ns[0];
6009
6012
  }
6010
6013
  }
6011
6014
  const defOpts = get();
6012
6015
  this.options = {
6013
6016
  ...defOpts,
6014
6017
  ...this.options,
6015
- ...transformOptions(options2)
6018
+ ...transformOptions(options)
6016
6019
  };
6017
6020
  this.options.interpolation = {
6018
6021
  ...defOpts.interpolation,
6019
6022
  ...this.options.interpolation
6020
6023
  };
6021
- if (options2.keySeparator !== void 0) {
6022
- this.options.userDefinedKeySeparator = options2.keySeparator;
6024
+ if (options.keySeparator !== void 0) {
6025
+ this.options.userDefinedKeySeparator = options.keySeparator;
6023
6026
  }
6024
- if (options2.nsSeparator !== void 0) {
6025
- this.options.userDefinedNsSeparator = options2.nsSeparator;
6027
+ if (options.nsSeparator !== void 0) {
6028
+ this.options.userDefinedNsSeparator = options.nsSeparator;
6026
6029
  }
6027
6030
  const createClassOnDemand = (ClassOrObject) => {
6028
6031
  if (!ClassOrObject) return null;
@@ -6287,8 +6290,18 @@ var I18n = class _I18n extends EventEmitter {
6287
6290
  const keySeparator = this.options.keySeparator || ".";
6288
6291
  let resultKey;
6289
6292
  if (o2.keyPrefix && Array.isArray(key)) {
6290
- resultKey = key.map((k2) => `${o2.keyPrefix}${keySeparator}${k2}`);
6293
+ resultKey = key.map((k2) => {
6294
+ if (typeof k2 === "function") k2 = keysFromSelector(k2, {
6295
+ ...this.options,
6296
+ ...opts
6297
+ });
6298
+ return `${o2.keyPrefix}${keySeparator}${k2}`;
6299
+ });
6291
6300
  } else {
6301
+ if (typeof key === "function") key = keysFromSelector(key, {
6302
+ ...this.options,
6303
+ ...opts
6304
+ });
6292
6305
  resultKey = o2.keyPrefix ? `${o2.keyPrefix}${keySeparator}${key}` : key;
6293
6306
  }
6294
6307
  return this.t(resultKey, o2);
@@ -6311,7 +6324,7 @@ var I18n = class _I18n extends EventEmitter {
6311
6324
  setDefaultNamespace(ns) {
6312
6325
  this.options.defaultNS = ns;
6313
6326
  }
6314
- hasLoadedNamespace(ns, options2 = {}) {
6327
+ hasLoadedNamespace(ns, options = {}) {
6315
6328
  if (!this.isInitialized) {
6316
6329
  this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
6317
6330
  return false;
@@ -6320,7 +6333,7 @@ var I18n = class _I18n extends EventEmitter {
6320
6333
  this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
6321
6334
  return false;
6322
6335
  }
6323
- const lng = options2.lng || this.resolvedLanguage || this.languages[0];
6336
+ const lng = options.lng || this.resolvedLanguage || this.languages[0];
6324
6337
  const fallbackLng = this.options ? this.options.fallbackLng : false;
6325
6338
  const lastLng = this.languages[this.languages.length - 1];
6326
6339
  if (lng.toLowerCase() === "cimode") return true;
@@ -6328,8 +6341,8 @@ var I18n = class _I18n extends EventEmitter {
6328
6341
  const loadState = this.services.backendConnector.state[`${l2}|${n}`];
6329
6342
  return loadState === -1 || loadState === 0 || loadState === 2;
6330
6343
  };
6331
- if (options2.precheck) {
6332
- const preResult = options2.precheck(this, loadNotPending);
6344
+ if (options.precheck) {
6345
+ const preResult = options.precheck(this, loadNotPending);
6333
6346
  if (preResult !== void 0) return preResult;
6334
6347
  }
6335
6348
  if (this.hasResourceBundle(lng, ns)) return true;
@@ -6385,22 +6398,22 @@ var I18n = class _I18n extends EventEmitter {
6385
6398
  if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
6386
6399
  return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
6387
6400
  }
6388
- static createInstance(options2 = {}, callback) {
6389
- return new _I18n(options2, callback);
6401
+ static createInstance(options = {}, callback) {
6402
+ return new _I18n(options, callback);
6390
6403
  }
6391
- cloneInstance(options2 = {}, callback = noop) {
6392
- const forkResourceStore = options2.forkResourceStore;
6393
- if (forkResourceStore) delete options2.forkResourceStore;
6404
+ cloneInstance(options = {}, callback = noop) {
6405
+ const forkResourceStore = options.forkResourceStore;
6406
+ if (forkResourceStore) delete options.forkResourceStore;
6394
6407
  const mergedOptions = {
6395
6408
  ...this.options,
6396
- ...options2,
6409
+ ...options,
6397
6410
  ...{
6398
6411
  isClone: true
6399
6412
  }
6400
6413
  };
6401
6414
  const clone = new _I18n(mergedOptions);
6402
- if (options2.debug !== void 0 || options2.prefix !== void 0) {
6403
- clone.logger = clone.logger.clone(options2);
6415
+ if (options.debug !== void 0 || options.prefix !== void 0) {
6416
+ clone.logger = clone.logger.clone(options);
6404
6417
  }
6405
6418
  const membersToCopy = ["store", "services", "language"];
6406
6419
  membersToCopy.forEach((m2) => {
@@ -6521,7 +6534,7 @@ var loadLanguages2 = (i18n, lng, ns, cb) => {
6521
6534
  });
6522
6535
  i18n.loadLanguages(lng, loadedClb(i18n, cb));
6523
6536
  };
6524
- var hasLoadedNamespace2 = (ns, i18n, options2 = {}) => {
6537
+ var hasLoadedNamespace2 = (ns, i18n, options = {}) => {
6525
6538
  if (!i18n.languages || !i18n.languages.length) {
6526
6539
  warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
6527
6540
  languages: i18n.languages
@@ -6529,9 +6542,9 @@ var hasLoadedNamespace2 = (ns, i18n, options2 = {}) => {
6529
6542
  return true;
6530
6543
  }
6531
6544
  return i18n.hasLoadedNamespace(ns, {
6532
- lng: options2.lng,
6545
+ lng: options.lng,
6533
6546
  precheck: (i18nInstance2, loadNotPending) => {
6534
- if (options2.bindI18n && options2.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
6547
+ if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
6535
6548
  }
6536
6549
  });
6537
6550
  };
@@ -6576,10 +6589,10 @@ var defaultOptions = {
6576
6589
  useSuspense: true,
6577
6590
  unescape
6578
6591
  };
6579
- var setDefaults = (options2 = {}) => {
6592
+ var setDefaults = (options = {}) => {
6580
6593
  defaultOptions = {
6581
6594
  ...defaultOptions,
6582
- ...options2
6595
+ ...options
6583
6596
  };
6584
6597
  };
6585
6598
  var getDefaults = () => defaultOptions;
@@ -7103,12 +7116,12 @@ var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.ra
7103
7116
  var native_default = { randomUUID };
7104
7117
 
7105
7118
  // node_modules/uuid/dist/esm-browser/v4.js
7106
- function v4(options2, buf, offset) {
7107
- if (native_default.randomUUID && !buf && !options2) {
7119
+ function v4(options, buf, offset) {
7120
+ if (native_default.randomUUID && !buf && !options) {
7108
7121
  return native_default.randomUUID();
7109
7122
  }
7110
- options2 = options2 || {};
7111
- const rnds = options2.random ?? options2.rng?.() ?? rng();
7123
+ options = options || {};
7124
+ const rnds = options.random ?? options.rng?.() ?? rng();
7112
7125
  if (rnds.length < 16) {
7113
7126
  throw new Error("Random bytes length must be >= 16");
7114
7127
  }
@@ -7431,6 +7444,7 @@ function BillingCreditBundleViewFromJSONTyped(json, ignoreDiscriminator) {
7431
7444
  expiryType: json["expiry_type"],
7432
7445
  expiryUnit: json["expiry_unit"],
7433
7446
  expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
7447
+ hasGrants: json["has_grants"],
7434
7448
  id: json["id"],
7435
7449
  name: json["name"],
7436
7450
  pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
@@ -7601,6 +7615,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
7601
7615
  }
7602
7616
  return {
7603
7617
  billingScheme: json["billing_scheme"],
7618
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
7604
7619
  createdAt: new Date(json["created_at"]),
7605
7620
  currency: json["currency"],
7606
7621
  environmentId: json["environment_id"],
@@ -7619,6 +7634,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
7619
7634
  ),
7620
7635
  quantity: json["quantity"],
7621
7636
  subscriptionId: json["subscription_id"],
7637
+ subscriptionItemExternalId: json["subscription_item_external_id"] == null ? void 0 : json["subscription_item_external_id"],
7622
7638
  updatedAt: new Date(json["updated_at"]),
7623
7639
  usageType: json["usage_type"]
7624
7640
  };
@@ -8381,6 +8397,7 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8381
8397
  return json;
8382
8398
  }
8383
8399
  return {
8400
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
8384
8401
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
8385
8402
  createdAt: new Date(json["created_at"]),
8386
8403
  environmentId: json["environment_id"],
@@ -8528,6 +8545,21 @@ function ComponentCapabilitiesFromJSONTyped(json, ignoreDiscriminator) {
8528
8545
  };
8529
8546
  }
8530
8547
 
8548
+ // src/api/checkoutexternal/models/ComponentCheckoutSettings.ts
8549
+ function ComponentCheckoutSettingsFromJSON(json) {
8550
+ return ComponentCheckoutSettingsFromJSONTyped(json, false);
8551
+ }
8552
+ function ComponentCheckoutSettingsFromJSONTyped(json, ignoreDiscriminator) {
8553
+ if (json == null) {
8554
+ return json;
8555
+ }
8556
+ return {
8557
+ collectAddress: json["collect_address"],
8558
+ collectEmail: json["collect_email"],
8559
+ collectPhone: json["collect_phone"]
8560
+ };
8561
+ }
8562
+
8531
8563
  // src/api/checkoutexternal/models/PlanDetailResponseData.ts
8532
8564
  function PlanDetailResponseDataFromJSON(json) {
8533
8565
  return PlanDetailResponseDataFromJSONTyped(json, false);
@@ -8596,6 +8628,9 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
8596
8628
  creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
8597
8629
  creditName: json["credit_name"],
8598
8630
  expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
8631
+ expiryType: json["expiry_type"] == null ? void 0 : json["expiry_type"],
8632
+ expiryUnit: json["expiry_unit"] == null ? void 0 : json["expiry_unit"],
8633
+ expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
8599
8634
  grantReason: json["grant_reason"],
8600
8635
  id: json["id"],
8601
8636
  planId: json["plan_id"] == null ? void 0 : json["plan_id"],
@@ -8623,6 +8658,7 @@ function UsageBasedEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminato
8623
8658
  return json;
8624
8659
  }
8625
8660
  return {
8661
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
8626
8662
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
8627
8663
  featureId: json["feature_id"],
8628
8664
  meteredPrice: json["metered_price"] == null ? void 0 : BillingPriceViewFromJSON(json["metered_price"]),
@@ -8721,6 +8757,9 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8721
8757
  CompatiblePlansFromJSON
8722
8758
  ),
8723
8759
  capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON(json["capabilities"]),
8760
+ checkoutSettings: ComponentCheckoutSettingsFromJSON(
8761
+ json["checkout_settings"]
8762
+ ),
8724
8763
  company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
8725
8764
  component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
8726
8765
  creditBundles: json["credit_bundles"].map(
@@ -10193,6 +10232,7 @@ function PlanEntitlementResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
10193
10232
  return json;
10194
10233
  }
10195
10234
  return {
10235
+ billingThreshold: json["billing_threshold"] == null ? void 0 : json["billing_threshold"],
10196
10236
  consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
10197
10237
  createdAt: new Date(json["created_at"]),
10198
10238
  environmentId: json["environment_id"],
@@ -10282,7 +10322,8 @@ function PublicPlansResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10282
10322
  addOnCompatibilities: json["add_on_compatibilities"].map(
10283
10323
  CompatiblePlansFromJSON2
10284
10324
  ),
10285
- capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON2(json["capabilities"])
10325
+ capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON2(json["capabilities"]),
10326
+ showPeriodToggle: json["show_period_toggle"]
10286
10327
  };
10287
10328
  }
10288
10329
 
@@ -10469,18 +10510,18 @@ var EmbedProvider = ({
10469
10510
  children,
10470
10511
  apiKey,
10471
10512
  apiConfig,
10472
- ...options2
10513
+ ...options
10473
10514
  }) => {
10474
10515
  const sessionIdRef = (0, import_react12.useRef)(v4_default());
10475
10516
  const styleRef = (0, import_react12.useRef)(null);
10476
- const [state, dispatch] = (0, import_react12.useReducer)(reducer, options2, (opts) => {
10517
+ const [state, dispatch] = (0, import_react12.useReducer)(reducer, options, (opts) => {
10477
10518
  const providedState = { settings: opts.settings || {} };
10478
10519
  const resolvedState = (0, import_merge2.default)({}, initialState, providedState);
10479
10520
  return resolvedState;
10480
10521
  });
10481
10522
  const customHeaders = (0, import_react12.useMemo)(
10482
10523
  () => ({
10483
- "X-Schematic-Components-Version": "1.4.0",
10524
+ "X-Schematic-Components-Version": "1.4.2",
10484
10525
  "X-Schematic-Session-ID": sessionIdRef.current
10485
10526
  }),
10486
10527
  []
@@ -10488,11 +10529,11 @@ var EmbedProvider = ({
10488
10529
  const [api, setApi] = (0, import_react12.useState)({});
10489
10530
  const debug = (0, import_react12.useCallback)(
10490
10531
  (message, ...args) => {
10491
- if (options2.debug) {
10532
+ if (options.debug) {
10492
10533
  console.debug(`[Schematic] ${message}`, ...args);
10493
10534
  }
10494
10535
  },
10495
- [options2.debug]
10536
+ [options.debug]
10496
10537
  );
10497
10538
  const hydratePublic = (0, import_react12.useCallback)(async () => {
10498
10539
  dispatch({ type: "HYDRATE_STARTED" });
@@ -10702,8 +10743,8 @@ var EmbedProvider = ({
10702
10743
  dispatch({ type: "SET_DATA", data });
10703
10744
  }, []);
10704
10745
  const updateSettings = (0, import_react12.useCallback)(
10705
- (settings = {}, options3) => {
10706
- dispatch({ type: "UPDATE_SETTINGS", settings, update: options3?.update });
10746
+ (settings = {}, options2) => {
10747
+ dispatch({ type: "UPDATE_SETTINGS", settings, update: options2?.update });
10707
10748
  },
10708
10749
  []
10709
10750
  );
@@ -10794,9 +10835,9 @@ var EmbedProvider = ({
10794
10835
  }
10795
10836
  }, [debug, state.error]);
10796
10837
  (0, import_react12.useEffect)(() => {
10797
- const providedSettings = { ...options2.settings || {} };
10838
+ const providedSettings = { ...options.settings || {} };
10798
10839
  updateSettings(providedSettings, { update: false });
10799
- }, [options2.settings, updateSettings]);
10840
+ }, [options.settings, updateSettings]);
10800
10841
  (0, import_react12.useEffect)(() => {
10801
10842
  const planChanged = (event) => {
10802
10843
  if (event instanceof CustomEvent) {
@@ -11185,7 +11226,6 @@ var Button = dt.button(
11185
11226
  ${() => $selfAlignment && lt`
11186
11227
  align-self: ${$selfAlignment};
11187
11228
  `}
11188
- gap: 0.5rem;
11189
11229
  width: ${$fullWidth ? "100%" : "fit-content"};
11190
11230
  border: 1px solid transparent;
11191
11231
  transition: 0.1s;
@@ -11289,6 +11329,9 @@ var Button = dt.button(
11289
11329
  &::before {
11290
11330
  content: "";
11291
11331
  ${loaderStyles({ $color: theme[$color], $size, $isLoading })}
11332
+ ${$isLoading && lt`
11333
+ margin-right: 0.5rem;
11334
+ `}
11292
11335
  }
11293
11336
 
11294
11337
  &:disabled {
@@ -12477,6 +12520,7 @@ var Sidebar = ({
12477
12520
  addOns,
12478
12521
  creditBundles = [],
12479
12522
  usageBasedEntitlements,
12523
+ addOnUsageBasedEntitlements = [],
12480
12524
  charges,
12481
12525
  checkoutRef,
12482
12526
  checkoutStage,
@@ -12661,6 +12705,35 @@ var Sidebar = ({
12661
12705
  }
12662
12706
  setError(void 0);
12663
12707
  setIsLoading(true);
12708
+ const planPayInAdvance = payInAdvanceEntitlements.reduce(
12709
+ (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
12710
+ const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
12711
+ if (priceId2) {
12712
+ acc.push({
12713
+ priceId: priceId2,
12714
+ quantity
12715
+ });
12716
+ }
12717
+ return acc;
12718
+ },
12719
+ []
12720
+ );
12721
+ const addOnPayInAdvance = addOnUsageBasedEntitlements.filter(
12722
+ (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
12723
+ ).reduce(
12724
+ (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
12725
+ const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
12726
+ if (priceId2) {
12727
+ acc.push({
12728
+ priceId: priceId2,
12729
+ quantity
12730
+ });
12731
+ }
12732
+ return acc;
12733
+ },
12734
+ []
12735
+ );
12736
+ const allPayInAdvance = [...planPayInAdvance, ...addOnPayInAdvance];
12664
12737
  await checkout({
12665
12738
  newPlanId: planId,
12666
12739
  newPriceId: priceId,
@@ -12676,19 +12749,7 @@ var Sidebar = ({
12676
12749
  }
12677
12750
  return acc;
12678
12751
  }, []),
12679
- payInAdvance: payInAdvanceEntitlements.reduce(
12680
- (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
12681
- const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
12682
- if (priceId2) {
12683
- acc.push({
12684
- priceId: priceId2,
12685
- quantity
12686
- });
12687
- }
12688
- return acc;
12689
- },
12690
- []
12691
- ),
12752
+ payInAdvance: allPayInAdvance,
12692
12753
  creditBundles: creditBundles.reduce(
12693
12754
  (acc, { id, count }) => {
12694
12755
  if (count > 0) {
@@ -12726,6 +12787,7 @@ var Sidebar = ({
12726
12787
  setIsLoading,
12727
12788
  setLayout,
12728
12789
  payInAdvanceEntitlements,
12790
+ addOnUsageBasedEntitlements,
12729
12791
  willTrialWithoutPaymentMethod,
12730
12792
  promoCode
12731
12793
  ]);
@@ -14214,7 +14276,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
14214
14276
  $size: "lg",
14215
14277
  type: "number",
14216
14278
  value: entitlement.quantity,
14217
- min: 1,
14279
+ min: 0,
14218
14280
  autoFocus: true,
14219
14281
  onFocus: (event) => {
14220
14282
  event.target.select();
@@ -14222,7 +14284,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
14222
14284
  onChange: (event) => {
14223
14285
  event.preventDefault();
14224
14286
  const value = parseInt(event.target.value);
14225
- if (!isNaN(value) && value > 0) {
14287
+ if (!isNaN(value)) {
14226
14288
  updateQuantity(entitlement.id, value);
14227
14289
  }
14228
14290
  }
@@ -14301,7 +14363,7 @@ var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc,
14301
14363
  const featureUsage = entitlements.find(
14302
14364
  (usage2) => usage2.feature?.id === entitlement.feature?.id
14303
14365
  );
14304
- const allocation = featureUsage?.allocation || 1;
14366
+ const allocation = featureUsage?.allocation || 0;
14305
14367
  const usage = featureUsage?.usage || 0;
14306
14368
  acc.push({
14307
14369
  ...entitlement,
@@ -14314,7 +14376,7 @@ var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc,
14314
14376
  };
14315
14377
  var CheckoutDialog = ({ top = 0 }) => {
14316
14378
  const { t: t2 } = useTranslation();
14317
- const { data, checkoutState, previewCheckout } = useEmbed();
14379
+ const { data, settings, isPending, checkoutState, previewCheckout } = useEmbed();
14318
14380
  const isLightBackground = useIsLightBackground();
14319
14381
  const contentRef = (0, import_react30.useRef)(null);
14320
14382
  const checkoutRef = (0, import_react30.useRef)(null);
@@ -14328,16 +14390,6 @@ var CheckoutDialog = ({ top = 0 }) => {
14328
14390
  );
14329
14391
  const [isLoading, setIsLoading] = (0, import_react30.useState)(false);
14330
14392
  const [error, setError] = (0, import_react30.useState)();
14331
- const currentPeriod = (0, import_react30.useMemo)(
14332
- () => checkoutState?.period || isCheckoutData(data) && data.company?.plan?.planPeriod || "month",
14333
- [data, checkoutState?.period]
14334
- );
14335
- const [planPeriod, setPlanPeriod] = (0, import_react30.useState)(currentPeriod);
14336
- const {
14337
- plans: availablePlans,
14338
- addOns: availableAddOns,
14339
- periods: availablePeriods
14340
- } = useAvailablePlans(planPeriod);
14341
14393
  const {
14342
14394
  currentPlanId,
14343
14395
  currentEntitlements,
@@ -14359,6 +14411,18 @@ var CheckoutDialog = ({ top = 0 }) => {
14359
14411
  trialPaymentMethodRequired: false
14360
14412
  };
14361
14413
  }, [data]);
14414
+ const currentPeriod = (0, import_react30.useMemo)(
14415
+ () => checkoutState?.period || isCheckoutData(data) && data.company?.plan?.planPeriod || "month",
14416
+ [data, checkoutState?.period]
14417
+ );
14418
+ const [planPeriod, setPlanPeriod] = (0, import_react30.useState)(currentPeriod);
14419
+ const {
14420
+ plans: availablePlans,
14421
+ addOns: availableAddOns,
14422
+ periods: availablePeriods
14423
+ } = useAvailablePlans(planPeriod, {
14424
+ useSelectedPeriod: showPeriodToggle
14425
+ });
14362
14426
  const [selectedPlan, setSelectedPlan] = (0, import_react30.useState)(
14363
14427
  () => {
14364
14428
  return availablePlans.find(
@@ -14419,6 +14483,12 @@ var CheckoutDialog = ({ top = 0 }) => {
14419
14483
  ),
14420
14484
  [usageBasedEntitlements]
14421
14485
  );
14486
+ const addOnPayInAdvanceEntitlements = (0, import_react30.useMemo)(
14487
+ () => addOnUsageBasedEntitlements.filter(
14488
+ (entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
14489
+ ),
14490
+ [addOnUsageBasedEntitlements]
14491
+ );
14422
14492
  const [promoCode, setPromoCode] = (0, import_react30.useState)(null);
14423
14493
  const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react30.useState)(false);
14424
14494
  const willTrialWithoutPaymentMethod = (0, import_react30.useMemo)(
@@ -14506,20 +14576,8 @@ var CheckoutDialog = ({ top = 0 }) => {
14506
14576
  if (checkoutState?.credits) {
14507
14577
  return "credits";
14508
14578
  }
14509
- if (checkoutState?.planId !== currentPlanId) {
14510
- const hasUsageStage = checkoutStages.some(
14511
- (stage) => stage.id === "usage"
14512
- );
14513
- const hasAddonsStage = checkoutStages.some(
14514
- (stage) => stage.id === "addons"
14515
- );
14516
- const hasAddonsUsageStage = checkoutStages.some(
14517
- (stage) => stage.id === "addonsUsage"
14518
- );
14519
- if (hasUsageStage) return "usage";
14520
- if (hasAddonsStage) return "addons";
14521
- if (hasAddonsUsageStage) return "addonsUsage";
14522
- return "plan";
14579
+ if (typeof checkoutState?.planId !== "undefined" && checkoutState.planId !== currentPlanId) {
14580
+ 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";
14523
14581
  }
14524
14582
  return "plan";
14525
14583
  });
@@ -14658,7 +14716,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14658
14716
  ...entitlement,
14659
14717
  allocation: entitlement.valueNumeric || 0,
14660
14718
  usage: 0,
14661
- quantity: entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ ? 1 : 0
14719
+ quantity: 0
14662
14720
  });
14663
14721
  }
14664
14722
  return acc;
@@ -14725,7 +14783,10 @@ var CheckoutDialog = ({ top = 0 }) => {
14725
14783
  }))
14726
14784
  );
14727
14785
  setAddOnUsageBasedEntitlements(updatedAddOnEntitlements);
14728
- handlePreviewCheckout({ addOns: updated });
14786
+ handlePreviewCheckout({
14787
+ addOns: updated,
14788
+ addOnPayInAdvanceEntitlements: updatedAddOnEntitlements
14789
+ });
14729
14790
  return updated;
14730
14791
  });
14731
14792
  },
@@ -14927,7 +14988,17 @@ var CheckoutDialog = ({ top = 0 }) => {
14927
14988
  ]
14928
14989
  }
14929
14990
  ),
14930
- checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14991
+ isPending ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14992
+ Flex,
14993
+ {
14994
+ $width: "100%",
14995
+ $height: "100%",
14996
+ $alignItems: "center",
14997
+ $justifyContent: "center",
14998
+ $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
14999
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader, { $size: "2xl" })
15000
+ }
15001
+ ) : checkoutStage === "plan" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14931
15002
  Plan,
14932
15003
  {
14933
15004
  isLoading,
@@ -14938,8 +15009,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14938
15009
  shouldTrial,
14939
15010
  showPeriodToggle
14940
15011
  }
14941
- ),
14942
- checkoutStage === "usage" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
15012
+ ) : checkoutStage === "usage" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14943
15013
  Usage,
14944
15014
  {
14945
15015
  isLoading,
@@ -14948,8 +15018,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14948
15018
  entitlements: payInAdvanceEntitlements,
14949
15019
  updateQuantity: updateUsageBasedEntitlementQuantity
14950
15020
  }
14951
- ),
14952
- checkoutStage === "addons" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
15021
+ ) : checkoutStage === "addons" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14953
15022
  AddOns,
14954
15023
  {
14955
15024
  isLoading,
@@ -14957,26 +15026,23 @@ var CheckoutDialog = ({ top = 0 }) => {
14957
15026
  addOns,
14958
15027
  toggle: (id) => toggleAddOn(id)
14959
15028
  }
14960
- ),
14961
- checkoutStage === "addonsUsage" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
15029
+ ) : checkoutStage === "addonsUsage" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14962
15030
  Usage,
14963
15031
  {
14964
15032
  isLoading,
14965
15033
  period: planPeriod,
14966
15034
  selectedPlan,
14967
- entitlements: addOnUsageBasedEntitlements,
15035
+ entitlements: addOnPayInAdvanceEntitlements,
14968
15036
  updateQuantity: updateAddOnEntitlementQuantity
14969
15037
  }
14970
- ),
14971
- checkoutStage === "credits" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
15038
+ ) : checkoutStage === "credits" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14972
15039
  Credits,
14973
15040
  {
14974
15041
  isLoading,
14975
15042
  bundles: creditBundles,
14976
15043
  updateCount: updateCreditBundleCount
14977
15044
  }
14978
- ),
14979
- checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
15045
+ ) : checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14980
15046
  Checkout,
14981
15047
  {
14982
15048
  isPaymentMethodRequired,
@@ -14994,6 +15060,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14994
15060
  selectedPlan,
14995
15061
  addOns,
14996
15062
  usageBasedEntitlements,
15063
+ addOnUsageBasedEntitlements,
14997
15064
  creditBundles,
14998
15065
  charges,
14999
15066
  checkoutRef,
@@ -15115,7 +15182,7 @@ var PaymentForm = ({ onConfirm }) => {
15115
15182
  var import_react33 = require("react");
15116
15183
  var import_jsx_runtime24 = require("react/jsx-runtime");
15117
15184
  var PeriodToggle = ({
15118
- options: options2,
15185
+ options,
15119
15186
  selectedOption,
15120
15187
  selectedPlan,
15121
15188
  onSelect
@@ -15148,7 +15215,7 @@ var PeriodToggle = ({
15148
15215
  $width: "fit-content"
15149
15216
  }
15150
15217
  },
15151
- children: options2.map((option) => {
15218
+ children: options.map((option) => {
15152
15219
  const element = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
15153
15220
  Flex,
15154
15221
  {
@@ -16200,8 +16267,8 @@ function resolveDesignProps3(props) {
16200
16267
  }
16201
16268
  };
16202
16269
  }
16203
- function formatInvoices(invoices, options2) {
16204
- const { hideUpcoming = true } = options2 || {};
16270
+ function formatInvoices(invoices, options) {
16271
+ const { hideUpcoming = true } = options || {};
16205
16272
  const now = /* @__PURE__ */ new Date();
16206
16273
  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 }) => ({
16207
16274
  amount: formatCurrency(amountDue, currency),
@@ -17122,7 +17189,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
17122
17189
  }
17123
17190
  stripe._registerWrapper({
17124
17191
  name: "stripe-js",
17125
- version: "7.8.0",
17192
+ version: "7.9.0",
17126
17193
  startTime
17127
17194
  });
17128
17195
  };
@@ -17197,7 +17264,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
17197
17264
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
17198
17265
  var expectedVersion = RELEASE_TRAIN;
17199
17266
  if (isTestKey && version !== expectedVersion) {
17200
- 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"));
17267
+ 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"));
17201
17268
  }
17202
17269
  var stripe = maybeStripe.apply(void 0, args);
17203
17270
  registerWrapper(stripe, startTime);
@@ -18678,6 +18745,7 @@ var PricingTable = (0, import_react51.forwardRef)(
18678
18745
  const { t: t2 } = useTranslation();
18679
18746
  const { data, settings, isPending, hydratePublic } = useEmbed();
18680
18747
  const { currentPeriod, showPeriodToggle, isStandalone } = (0, import_react51.useMemo)(() => {
18748
+ const showPeriodToggle2 = data?.showPeriodToggle ?? props.showPeriodToggle;
18681
18749
  if (isCheckoutData(data)) {
18682
18750
  const billingSubscription = data.company?.billingSubscription;
18683
18751
  const isTrialSubscription = billingSubscription?.status === "trialing";
@@ -18686,7 +18754,7 @@ var PricingTable = (0, import_react51.forwardRef)(
18686
18754
  currentPeriod: data.company?.plan?.planPeriod || "month",
18687
18755
  currentAddOns: data.company?.addOns || [],
18688
18756
  canCheckout: data.capabilities?.checkout ?? true,
18689
- showPeriodToggle: data.showPeriodToggle ?? props.showPeriodToggle,
18757
+ showPeriodToggle: showPeriodToggle2,
18690
18758
  isTrialSubscription,
18691
18759
  willSubscriptionCancel,
18692
18760
  isStandalone: false
@@ -18696,7 +18764,7 @@ var PricingTable = (0, import_react51.forwardRef)(
18696
18764
  currentPeriod: "month",
18697
18765
  currentAddOns: [],
18698
18766
  canCheckout: true,
18699
- showPeriodToggle: props.showPeriodToggle,
18767
+ showPeriodToggle: showPeriodToggle2,
18700
18768
  isTrialSubscription: false,
18701
18769
  willSubscriptionCancel: false,
18702
18770
  isStandalone: true
@@ -18732,7 +18800,7 @@ var PricingTable = (0, import_react51.forwardRef)(
18732
18800
  (0, import_react51.useEffect)(() => {
18733
18801
  setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
18734
18802
  }, [plans]);
18735
- if (isStandalone && isPending) {
18803
+ if (isPending) {
18736
18804
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18737
18805
  Flex,
18738
18806
  {
@@ -21216,7 +21284,7 @@ var {
21216
21284
  Z_DEFAULT_STRATEGY,
21217
21285
  Z_DEFLATED: Z_DEFLATED$1
21218
21286
  } = constants$2;
21219
- function Deflate$1(options2) {
21287
+ function Deflate$1(options) {
21220
21288
  this.options = common.assign({
21221
21289
  level: Z_DEFAULT_COMPRESSION,
21222
21290
  method: Z_DEFLATED$1,
@@ -21224,7 +21292,7 @@ function Deflate$1(options2) {
21224
21292
  windowBits: 15,
21225
21293
  memLevel: 8,
21226
21294
  strategy: Z_DEFAULT_STRATEGY
21227
- }, options2 || {});
21295
+ }, options || {});
21228
21296
  let opt = this.options;
21229
21297
  if (opt.raw && opt.windowBits > 0) {
21230
21298
  opt.windowBits = -opt.windowBits;
@@ -21330,23 +21398,23 @@ Deflate$1.prototype.onEnd = function(status) {
21330
21398
  this.err = status;
21331
21399
  this.msg = this.strm.msg;
21332
21400
  };
21333
- function deflate$1(input, options2) {
21334
- const deflator = new Deflate$1(options2);
21401
+ function deflate$1(input, options) {
21402
+ const deflator = new Deflate$1(options);
21335
21403
  deflator.push(input, true);
21336
21404
  if (deflator.err) {
21337
21405
  throw deflator.msg || messages[deflator.err];
21338
21406
  }
21339
21407
  return deflator.result;
21340
21408
  }
21341
- function deflateRaw$1(input, options2) {
21342
- options2 = options2 || {};
21343
- options2.raw = true;
21344
- return deflate$1(input, options2);
21409
+ function deflateRaw$1(input, options) {
21410
+ options = options || {};
21411
+ options.raw = true;
21412
+ return deflate$1(input, options);
21345
21413
  }
21346
- function gzip$1(input, options2) {
21347
- options2 = options2 || {};
21348
- options2.gzip = true;
21349
- return deflate$1(input, options2);
21414
+ function gzip$1(input, options) {
21415
+ options = options || {};
21416
+ options.gzip = true;
21417
+ return deflate$1(input, options);
21350
21418
  }
21351
21419
  var Deflate_1$1 = Deflate$1;
21352
21420
  var deflate_2 = deflate$1;
@@ -23159,12 +23227,12 @@ var {
23159
23227
  Z_DATA_ERROR,
23160
23228
  Z_MEM_ERROR
23161
23229
  } = constants$2;
23162
- function Inflate$1(options2) {
23230
+ function Inflate$1(options) {
23163
23231
  this.options = common.assign({
23164
23232
  chunkSize: 1024 * 64,
23165
23233
  windowBits: 15,
23166
23234
  to: ""
23167
- }, options2 || {});
23235
+ }, options || {});
23168
23236
  const opt = this.options;
23169
23237
  if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
23170
23238
  opt.windowBits = -opt.windowBits;
@@ -23172,7 +23240,7 @@ function Inflate$1(options2) {
23172
23240
  opt.windowBits = -15;
23173
23241
  }
23174
23242
  }
23175
- if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options2 && options2.windowBits)) {
23243
+ if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
23176
23244
  opt.windowBits += 32;
23177
23245
  }
23178
23246
  if (opt.windowBits > 15 && opt.windowBits < 48) {
@@ -23294,16 +23362,16 @@ Inflate$1.prototype.onEnd = function(status) {
23294
23362
  this.err = status;
23295
23363
  this.msg = this.strm.msg;
23296
23364
  };
23297
- function inflate$1(input, options2) {
23298
- const inflator = new Inflate$1(options2);
23365
+ function inflate$1(input, options) {
23366
+ const inflator = new Inflate$1(options);
23299
23367
  inflator.push(input);
23300
23368
  if (inflator.err) throw inflator.msg || messages[inflator.err];
23301
23369
  return inflator.result;
23302
23370
  }
23303
- function inflateRaw$1(input, options2) {
23304
- options2 = options2 || {};
23305
- options2.raw = true;
23306
- return inflate$1(input, options2);
23371
+ function inflateRaw$1(input, options) {
23372
+ options = options || {};
23373
+ options.raw = true;
23374
+ return inflate$1(input, options);
23307
23375
  }
23308
23376
  var Inflate_1$1 = Inflate$1;
23309
23377
  var inflate_2 = inflate$1;
@@ -23371,8 +23439,8 @@ function parseEditorState(data) {
23371
23439
  });
23372
23440
  return arr;
23373
23441
  }
23374
- function createRenderer(options2) {
23375
- const { useFallback = false } = options2 || {};
23442
+ function createRenderer(options) {
23443
+ const { useFallback = false } = options || {};
23376
23444
  return function renderNode(node2, index) {
23377
23445
  const { type, props = {}, children } = node2;
23378
23446
  const name = typeof type !== "string" ? type.resolvedName : type;