@schematichq/schematic-components 2.8.3 → 2.8.4

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.
@@ -5256,14 +5256,12 @@ function buildPayInAdvanceRequestBody(entitlements, period) {
5256
5256
  []
5257
5257
  );
5258
5258
  }
5259
- function buildAddOnRequestBody(addOns, period, shouldTrial, addOnPayInAdvanceEntitlements) {
5259
+ function buildAddOnRequestBody(addOns, period, shouldTrial) {
5260
5260
  return addOns.reduce((acc, addOn) => {
5261
5261
  if (addOn.isSelected && !shouldTrial) {
5262
5262
  const addOnPrice = getAddOnPrice(addOn, period);
5263
5263
  const addOnPriceId = addOnPrice?.id;
5264
- if (addOnPriceId && (addOnPrice?.price || addOnPayInAdvanceEntitlements.some(
5265
- (e2) => e2.priceBehavior === EntitlementPriceBehavior.PayInAdvance
5266
- ))) {
5264
+ if (addOnPriceId) {
5267
5265
  acc.push({
5268
5266
  addOnId: addOn.id,
5269
5267
  priceId: addOnPriceId
@@ -7709,7 +7707,7 @@ var defer = () => {
7709
7707
  };
7710
7708
  var makeString = (object) => {
7711
7709
  if (object == null) return "";
7712
- return "" + object;
7710
+ return String(object);
7713
7711
  };
7714
7712
  var copy2 = (a2, s, t2) => {
7715
7713
  a2.forEach((m2) => {
@@ -7717,7 +7715,7 @@ var copy2 = (a2, s, t2) => {
7717
7715
  });
7718
7716
  };
7719
7717
  var lastOfPathSeparatorRegExp = /###/g;
7720
- var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
7718
+ var cleanKey = (key) => key && key.includes("###") ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
7721
7719
  var canNotTraverseDeeper = (object) => !object || isString(object);
7722
7720
  var getLastOfPath = (object, path, Empty) => {
7723
7721
  const stack = !isString(path) ? path : path.split(".");
@@ -7841,7 +7839,7 @@ var looksLikeObjectPathRegExpCache = new RegExpCache(20);
7841
7839
  var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
7842
7840
  nsSeparator = nsSeparator || "";
7843
7841
  keySeparator = keySeparator || "";
7844
- const possibleChars = chars.filter((c2) => nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0);
7842
+ const possibleChars = chars.filter((c2) => !nsSeparator.includes(c2) && !keySeparator.includes(c2));
7845
7843
  if (possibleChars.length === 0) return true;
7846
7844
  const r2 = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c2) => c2 === "?" ? "\\?" : c2).join("|")})`);
7847
7845
  let matched = !r2.test(key);
@@ -7874,7 +7872,7 @@ var deepFind = (obj, path, keySeparator = ".") => {
7874
7872
  nextPath += tokens[j2];
7875
7873
  next2 = current[nextPath];
7876
7874
  if (next2 !== void 0) {
7877
- if (["string", "number", "boolean"].indexOf(typeof next2) > -1 && j2 < tokens.length - 1) {
7875
+ if (["string", "number", "boolean"].includes(typeof next2) && j2 < tokens.length - 1) {
7878
7876
  continue;
7879
7877
  }
7880
7878
  i += j2 - i + 1;
@@ -7963,6 +7961,14 @@ var EventEmitter = class {
7963
7961
  }
7964
7962
  this.observers[event].delete(listener);
7965
7963
  }
7964
+ once(event, listener) {
7965
+ const wrapper = (...args) => {
7966
+ listener(...args);
7967
+ this.off(event, wrapper);
7968
+ };
7969
+ this.on(event, wrapper);
7970
+ return this;
7971
+ }
7966
7972
  emit(event, ...args) {
7967
7973
  if (this.observers[event]) {
7968
7974
  const cloned = Array.from(this.observers[event].entries());
@@ -7976,7 +7982,7 @@ var EventEmitter = class {
7976
7982
  const cloned = Array.from(this.observers["*"].entries());
7977
7983
  cloned.forEach(([observer, numTimesAdded]) => {
7978
7984
  for (let i = 0; i < numTimesAdded; i++) {
7979
- observer.apply(observer, [event, ...args]);
7985
+ observer(event, ...args);
7980
7986
  }
7981
7987
  });
7982
7988
  }
@@ -7998,7 +8004,7 @@ var ResourceStore = class extends EventEmitter {
7998
8004
  }
7999
8005
  }
8000
8006
  addNamespaces(ns) {
8001
- if (this.options.ns.indexOf(ns) < 0) {
8007
+ if (!this.options.ns.includes(ns)) {
8002
8008
  this.options.ns.push(ns);
8003
8009
  }
8004
8010
  }
@@ -8012,7 +8018,7 @@ var ResourceStore = class extends EventEmitter {
8012
8018
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
8013
8019
  const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
8014
8020
  let path;
8015
- if (lng.indexOf(".") > -1) {
8021
+ if (lng.includes(".")) {
8016
8022
  path = lng.split(".");
8017
8023
  } else {
8018
8024
  path = [lng, ns];
@@ -8027,7 +8033,7 @@ var ResourceStore = class extends EventEmitter {
8027
8033
  }
8028
8034
  }
8029
8035
  const result = getPath(this.data, path);
8030
- if (!result && !ns && !key && lng.indexOf(".") > -1) {
8036
+ if (!result && !ns && !key && lng.includes(".")) {
8031
8037
  lng = path[0];
8032
8038
  ns = path[1];
8033
8039
  key = path.slice(2).join(".");
@@ -8041,7 +8047,7 @@ var ResourceStore = class extends EventEmitter {
8041
8047
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
8042
8048
  let path = [lng, ns];
8043
8049
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
8044
- if (lng.indexOf(".") > -1) {
8050
+ if (lng.includes(".")) {
8045
8051
  path = lng.split(".");
8046
8052
  value = ns;
8047
8053
  ns = path[1];
@@ -8065,7 +8071,7 @@ var ResourceStore = class extends EventEmitter {
8065
8071
  skipCopy: false
8066
8072
  }) {
8067
8073
  let path = [lng, ns];
8068
- if (lng.indexOf(".") > -1) {
8074
+ if (lng.includes(".")) {
8069
8075
  path = lng.split(".");
8070
8076
  deep = resources;
8071
8077
  resources = ns;
@@ -8152,7 +8158,6 @@ function keysFromSelector(selector, opts) {
8152
8158
  }
8153
8159
  return path.join(keySeparator);
8154
8160
  }
8155
- var checkedLoadedFor = {};
8156
8161
  var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
8157
8162
  var Translator = class _Translator extends EventEmitter {
8158
8163
  constructor(services, options = {}) {
@@ -8163,6 +8168,7 @@ var Translator = class _Translator extends EventEmitter {
8163
8168
  this.options.keySeparator = ".";
8164
8169
  }
8165
8170
  this.logger = baseLogger.create("translator");
8171
+ this.checkedLoadedFor = {};
8166
8172
  }
8167
8173
  changeLanguage(lng) {
8168
8174
  if (lng) this.language = lng;
@@ -8187,7 +8193,7 @@ var Translator = class _Translator extends EventEmitter {
8187
8193
  if (nsSeparator === void 0) nsSeparator = ":";
8188
8194
  const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
8189
8195
  let namespaces = opt.ns || this.options.defaultNS || [];
8190
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
8196
+ const wouldCheckForNsInKey = nsSeparator && key.includes(nsSeparator);
8191
8197
  const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
8192
8198
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
8193
8199
  const m2 = key.match(this.interpolator.nestingRegexp);
@@ -8198,7 +8204,7 @@ var Translator = class _Translator extends EventEmitter {
8198
8204
  };
8199
8205
  }
8200
8206
  const parts = key.split(nsSeparator);
8201
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
8207
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.includes(parts[0])) namespaces = parts.shift();
8202
8208
  key = parts.join(keySeparator);
8203
8209
  }
8204
8210
  return {
@@ -8285,7 +8291,7 @@ var Translator = class _Translator extends EventEmitter {
8285
8291
  }
8286
8292
  const handleAsObject = shouldHandleAsObject(resForObjHndl);
8287
8293
  const resType = Object.prototype.toString.apply(resForObjHndl);
8288
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
8294
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
8289
8295
  if (!opt.returnObjects && !this.options.returnObjects) {
8290
8296
  if (!this.options.returnedObjectHandler) {
8291
8297
  this.logger.warn("accessing an object - but returnObjects options is not enabled!");
@@ -8381,7 +8387,7 @@ var Translator = class _Translator extends EventEmitter {
8381
8387
  if (this.options.saveMissingPlurals && needsPluralHandling) {
8382
8388
  lngs.forEach((language) => {
8383
8389
  const suffixes = this.pluralResolver.getSuffixes(language, opt);
8384
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
8390
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && !suffixes.includes(`${this.options.pluralSeparator}zero`)) {
8385
8391
  suffixes.push(`${this.options.pluralSeparator}zero`);
8386
8392
  }
8387
8393
  suffixes.forEach((suffix) => {
@@ -8491,8 +8497,8 @@ var Translator = class _Translator extends EventEmitter {
8491
8497
  namespaces.forEach((ns) => {
8492
8498
  if (this.isValidLookup(found)) return;
8493
8499
  usedNS = ns;
8494
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
8495
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
8500
+ if (!this.checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
8501
+ this.checkedLoadedFor[`${codes[0]}-${ns}`] = true;
8496
8502
  this.logger.warn(`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" 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!!!");
8497
8503
  }
8498
8504
  codes.forEach((code) => {
@@ -8507,7 +8513,7 @@ var Translator = class _Translator extends EventEmitter {
8507
8513
  const zeroSuffix = `${this.options.pluralSeparator}zero`;
8508
8514
  const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
8509
8515
  if (needsPluralHandling) {
8510
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
8516
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
8511
8517
  finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
8512
8518
  }
8513
8519
  finalKeys.push(key + pluralSuffix);
@@ -8519,7 +8525,7 @@ var Translator = class _Translator extends EventEmitter {
8519
8525
  const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
8520
8526
  finalKeys.push(contextKey);
8521
8527
  if (needsPluralHandling) {
8522
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
8528
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
8523
8529
  finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
8524
8530
  }
8525
8531
  finalKeys.push(contextKey + pluralSuffix);
@@ -8580,7 +8586,7 @@ var Translator = class _Translator extends EventEmitter {
8580
8586
  static hasDefaultValue(options) {
8581
8587
  const prefix2 = "defaultValue";
8582
8588
  for (const option in options) {
8583
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options[option]) {
8589
+ if (Object.prototype.hasOwnProperty.call(options, option) && option.startsWith(prefix2) && void 0 !== options[option]) {
8584
8590
  return true;
8585
8591
  }
8586
8592
  }
@@ -8595,7 +8601,7 @@ var LanguageUtil = class {
8595
8601
  }
8596
8602
  getScriptPartFromCode(code) {
8597
8603
  code = getCleanedCode(code);
8598
- if (!code || code.indexOf("-") < 0) return null;
8604
+ if (!code || !code.includes("-")) return null;
8599
8605
  const p2 = code.split("-");
8600
8606
  if (p2.length === 2) return null;
8601
8607
  p2.pop();
@@ -8604,12 +8610,12 @@ var LanguageUtil = class {
8604
8610
  }
8605
8611
  getLanguagePartFromCode(code) {
8606
8612
  code = getCleanedCode(code);
8607
- if (!code || code.indexOf("-") < 0) return code;
8613
+ if (!code || !code.includes("-")) return code;
8608
8614
  const p2 = code.split("-");
8609
8615
  return this.formatLanguageCode(p2[0]);
8610
8616
  }
8611
8617
  formatLanguageCode(code) {
8612
- if (isString(code) && code.indexOf("-") > -1) {
8618
+ if (isString(code) && code.includes("-")) {
8613
8619
  let formattedCode;
8614
8620
  try {
8615
8621
  formattedCode = Intl.getCanonicalLocales(code)[0];
@@ -8630,7 +8636,7 @@ var LanguageUtil = class {
8630
8636
  if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
8631
8637
  code = this.getLanguagePartFromCode(code);
8632
8638
  }
8633
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
8639
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(code);
8634
8640
  }
8635
8641
  getBestMatchFromCodes(codes) {
8636
8642
  if (!codes) return null;
@@ -8648,10 +8654,11 @@ var LanguageUtil = class {
8648
8654
  const lngOnly = this.getLanguagePartFromCode(code);
8649
8655
  if (this.isSupportedCode(lngOnly)) return found = lngOnly;
8650
8656
  found = this.options.supportedLngs.find((supportedLng) => {
8651
- if (supportedLng === lngOnly) return supportedLng;
8652
- if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0) return;
8653
- if (supportedLng.indexOf("-") > 0 && lngOnly.indexOf("-") < 0 && supportedLng.substring(0, supportedLng.indexOf("-")) === lngOnly) return supportedLng;
8654
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
8657
+ if (supportedLng === lngOnly) return true;
8658
+ if (!supportedLng.includes("-") && !lngOnly.includes("-")) return false;
8659
+ if (supportedLng.includes("-") && !lngOnly.includes("-") && supportedLng.slice(0, supportedLng.indexOf("-")) === lngOnly) return true;
8660
+ if (supportedLng.startsWith(lngOnly) && lngOnly.length > 1) return true;
8661
+ return false;
8655
8662
  });
8656
8663
  });
8657
8664
  }
@@ -8682,7 +8689,7 @@ var LanguageUtil = class {
8682
8689
  this.logger.warn(`rejecting language code not found in supportedLngs: ${c2}`);
8683
8690
  }
8684
8691
  };
8685
- if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
8692
+ if (isString(code) && (code.includes("-") || code.includes("_"))) {
8686
8693
  if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
8687
8694
  if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
8688
8695
  if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
@@ -8690,7 +8697,7 @@ var LanguageUtil = class {
8690
8697
  addCode(this.formatLanguageCode(code));
8691
8698
  }
8692
8699
  fallbackCodes.forEach((fc) => {
8693
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
8700
+ if (!codes.includes(fc)) addCode(this.formatLanguageCode(fc));
8694
8701
  });
8695
8702
  return codes;
8696
8703
  }
@@ -8844,7 +8851,7 @@ var Interpolator = class {
8844
8851
  let replaces;
8845
8852
  const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
8846
8853
  const handleFormat = (key) => {
8847
- if (key.indexOf(this.formatSeparator) < 0) {
8854
+ if (!key.includes(this.formatSeparator)) {
8848
8855
  const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
8849
8856
  return this.alwaysFormat ? this.format(path, void 0, lng, {
8850
8857
  ...options,
@@ -8914,7 +8921,7 @@ var Interpolator = class {
8914
8921
  let clonedOptions;
8915
8922
  const handleHasOptions = (key, inheritedOptions) => {
8916
8923
  const sep = this.nestingOptionsSeparator;
8917
- if (key.indexOf(sep) < 0) return key;
8924
+ if (!key.includes(sep)) return key;
8918
8925
  const c2 = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
8919
8926
  let optionsString = `{${c2[1]}`;
8920
8927
  key = c2[0];
@@ -8934,7 +8941,7 @@ var Interpolator = class {
8934
8941
  this.logger.warn(`failed parsing options string in nesting for key ${key}`, e2);
8935
8942
  return `${key}${sep}${optionsString}`;
8936
8943
  }
8937
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
8944
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
8938
8945
  return key;
8939
8946
  };
8940
8947
  while (match2 = this.nestingRegexp.exec(str)) {
@@ -8972,13 +8979,13 @@ var Interpolator = class {
8972
8979
  var parseFormatStr = (formatStr) => {
8973
8980
  let formatName = formatStr.toLowerCase().trim();
8974
8981
  const formatOptions = {};
8975
- if (formatStr.indexOf("(") > -1) {
8982
+ if (formatStr.includes("(")) {
8976
8983
  const p2 = formatStr.split("(");
8977
8984
  formatName = p2[0].toLowerCase().trim();
8978
- const optStr = p2[1].substring(0, p2[1].length - 1);
8979
- if (formatName === "currency" && optStr.indexOf(":") < 0) {
8985
+ const optStr = p2[1].slice(0, -1);
8986
+ if (formatName === "currency" && !optStr.includes(":")) {
8980
8987
  if (!formatOptions.currency) formatOptions.currency = optStr.trim();
8981
- } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
8988
+ } else if (formatName === "relativetime" && !optStr.includes(":")) {
8982
8989
  if (!formatOptions.range) formatOptions.range = optStr.trim();
8983
8990
  } else {
8984
8991
  const opts = optStr.split(";");
@@ -9072,9 +9079,11 @@ var Formatter = class {
9072
9079
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
9073
9080
  }
9074
9081
  format(value, format, lng, options = {}) {
9082
+ if (!format) return value;
9083
+ if (value == null) return value;
9075
9084
  const formats = format.split(this.formatSeparator);
9076
- if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
9077
- const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
9085
+ if (formats.length > 1 && formats[0].indexOf("(") > 1 && !formats[0].includes(")") && formats.find((f2) => f2.includes(")"))) {
9086
+ const lastIndex = formats.findIndex((f2) => f2.includes(")"));
9078
9087
  formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
9079
9088
  }
9080
9089
  const result = formats.reduce((mem, f2) => {
@@ -9228,7 +9237,7 @@ var Connector = class extends EventEmitter {
9228
9237
  }
9229
9238
  if (err2 && data && tried < this.maxRetries) {
9230
9239
  setTimeout(() => {
9231
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
9240
+ this.read(lng, ns, fcName, tried + 1, wait * 2, callback);
9232
9241
  }, wait);
9233
9242
  return;
9234
9243
  }
@@ -9332,7 +9341,6 @@ var get = () => ({
9332
9341
  nonExplicitSupportedLngs: false,
9333
9342
  load: "all",
9334
9343
  preload: false,
9335
- simplifyPluralSuffix: true,
9336
9344
  keySeparator: ".",
9337
9345
  nsSeparator: ":",
9338
9346
  pluralSeparator: "_",
@@ -9369,7 +9377,6 @@ var get = () => ({
9369
9377
  },
9370
9378
  interpolation: {
9371
9379
  escapeValue: true,
9372
- format: (value) => value,
9373
9380
  prefix: "{{",
9374
9381
  suffix: "}}",
9375
9382
  formatSeparator: ",",
@@ -9386,10 +9393,9 @@ var transformOptions = (options) => {
9386
9393
  if (isString(options.ns)) options.ns = [options.ns];
9387
9394
  if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
9388
9395
  if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
9389
- if (options.supportedLngs?.indexOf?.("cimode") < 0) {
9396
+ if (options.supportedLngs && !options.supportedLngs.includes("cimode")) {
9390
9397
  options.supportedLngs = options.supportedLngs.concat(["cimode"]);
9391
9398
  }
9392
- if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
9393
9399
  return options;
9394
9400
  };
9395
9401
  var noop = () => {
@@ -9402,28 +9408,6 @@ var bindMemberFunctions = (inst) => {
9402
9408
  }
9403
9409
  });
9404
9410
  };
9405
- var SUPPORT_NOTICE_KEY = "__i18next_supportNoticeShown";
9406
- var getSupportNoticeShown = () => {
9407
- if (typeof globalThis !== "undefined" && !!globalThis[SUPPORT_NOTICE_KEY]) return true;
9408
- if (typeof process !== "undefined" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE) return true;
9409
- if (typeof process !== "undefined" && process.env && false) return true;
9410
- return false;
9411
- };
9412
- var setSupportNoticeShown = () => {
9413
- if (typeof globalThis !== "undefined") globalThis[SUPPORT_NOTICE_KEY] = true;
9414
- };
9415
- var usesLocize = (inst) => {
9416
- if (inst?.modules?.backend?.name?.indexOf("Locize") > 0) return true;
9417
- if (inst?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0) return true;
9418
- if (inst?.options?.backend?.backends) {
9419
- if (inst.options.backend.backends.some((b2) => b2?.name?.indexOf("Locize") > 0 || b2?.constructor?.name?.indexOf("Locize") > 0)) return true;
9420
- }
9421
- if (inst?.options?.backend?.projectId) return true;
9422
- if (inst?.options?.backend?.backendOptions) {
9423
- if (inst.options.backend.backendOptions.some((b2) => b2?.projectId)) return true;
9424
- }
9425
- return false;
9426
- };
9427
9411
  var I18n = class _I18n extends EventEmitter {
9428
9412
  constructor(options = {}, callback) {
9429
9413
  super();
@@ -9453,7 +9437,7 @@ var I18n = class _I18n extends EventEmitter {
9453
9437
  if (options.defaultNS == null && options.ns) {
9454
9438
  if (isString(options.ns)) {
9455
9439
  options.defaultNS = options.ns;
9456
- } else if (options.ns.indexOf("translation") < 0) {
9440
+ } else if (!options.ns.includes("translation")) {
9457
9441
  options.defaultNS = options.ns[0];
9458
9442
  }
9459
9443
  }
@@ -9476,10 +9460,6 @@ var I18n = class _I18n extends EventEmitter {
9476
9460
  if (typeof this.options.overloadTranslationOptionHandler !== "function") {
9477
9461
  this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
9478
9462
  }
9479
- if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
9480
- if (typeof console !== "undefined" && typeof console.info !== "undefined") console.info("\u{1F310} i18next is made possible by our own product, Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}");
9481
- setSupportNoticeShown();
9482
- }
9483
9463
  const createClassOnDemand = (ClassOrObject) => {
9484
9464
  if (!ClassOrObject) return null;
9485
9465
  if (typeof ClassOrObject === "function") return new ClassOrObject();
@@ -9504,14 +9484,9 @@ var I18n = class _I18n extends EventEmitter {
9504
9484
  s.resourceStore = this.store;
9505
9485
  s.languageUtils = lu;
9506
9486
  s.pluralResolver = new PluralResolver(lu, {
9507
- prepend: this.options.pluralSeparator,
9508
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
9487
+ prepend: this.options.pluralSeparator
9509
9488
  });
9510
- const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
9511
- if (usingLegacyFormatFunction) {
9512
- this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
9513
- }
9514
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
9489
+ if (formatter) {
9515
9490
  s.formatter = createClassOnDemand(formatter);
9516
9491
  if (s.formatter.init) s.formatter.init(s, this.options);
9517
9492
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
@@ -9594,7 +9569,7 @@ var I18n = class _I18n extends EventEmitter {
9594
9569
  const lngs = this.services.languageUtils.toResolveHierarchy(lng);
9595
9570
  lngs.forEach((l2) => {
9596
9571
  if (l2 === "cimode") return;
9597
- if (toLoad.indexOf(l2) < 0) toLoad.push(l2);
9572
+ if (!toLoad.includes(l2)) toLoad.push(l2);
9598
9573
  });
9599
9574
  };
9600
9575
  if (!usedLng) {
@@ -9659,16 +9634,16 @@ var I18n = class _I18n extends EventEmitter {
9659
9634
  }
9660
9635
  setResolvedLanguage(l2) {
9661
9636
  if (!l2 || !this.languages) return;
9662
- if (["cimode", "dev"].indexOf(l2) > -1) return;
9637
+ if (["cimode", "dev"].includes(l2)) return;
9663
9638
  for (let li = 0; li < this.languages.length; li++) {
9664
9639
  const lngInLngs = this.languages[li];
9665
- if (["cimode", "dev"].indexOf(lngInLngs) > -1) continue;
9640
+ if (["cimode", "dev"].includes(lngInLngs)) continue;
9666
9641
  if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
9667
9642
  this.resolvedLanguage = lngInLngs;
9668
9643
  break;
9669
9644
  }
9670
9645
  }
9671
- if (!this.resolvedLanguage && this.languages.indexOf(l2) < 0 && this.store.hasLanguageSomeTranslations(l2)) {
9646
+ if (!this.resolvedLanguage && !this.languages.includes(l2) && this.store.hasLanguageSomeTranslations(l2)) {
9672
9647
  this.resolvedLanguage = l2;
9673
9648
  this.languages.unshift(l2);
9674
9649
  }
@@ -9810,7 +9785,7 @@ var I18n = class _I18n extends EventEmitter {
9810
9785
  }
9811
9786
  if (isString(ns)) ns = [ns];
9812
9787
  ns.forEach((n) => {
9813
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
9788
+ if (!this.options.ns.includes(n)) this.options.ns.push(n);
9814
9789
  });
9815
9790
  this.loadResources((err2) => {
9816
9791
  deferred.resolve();
@@ -9822,7 +9797,7 @@ var I18n = class _I18n extends EventEmitter {
9822
9797
  const deferred = defer();
9823
9798
  if (isString(lngs)) lngs = [lngs];
9824
9799
  const preloaded = this.options.preload || [];
9825
- const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
9800
+ const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
9826
9801
  if (!newLngs.length) {
9827
9802
  if (callback) callback();
9828
9803
  return Promise.resolve();
@@ -9848,7 +9823,7 @@ var I18n = class _I18n extends EventEmitter {
9848
9823
  const rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"];
9849
9824
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
9850
9825
  if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
9851
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9826
+ return rtlLngs.includes(languageUtils.getLanguagePartFromCode(lng)) || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9852
9827
  }
9853
9828
  static createInstance(options = {}, callback) {
9854
9829
  const instance2 = new _I18n(options, callback);
@@ -12546,7 +12521,7 @@ var reducer = (state, action) => {
12546
12521
  // src/context/EmbedProvider.tsx
12547
12522
  var import_jsx_runtime2 = require("react/jsx-runtime");
12548
12523
  var getCustomHeaders = (sessionId) => ({
12549
- "X-Schematic-Components-Version": "2.8.3",
12524
+ "X-Schematic-Components-Version": "2.8.4",
12550
12525
  "X-Schematic-Session-ID": sessionId
12551
12526
  });
12552
12527
  var EmbedProvider = ({
@@ -16066,8 +16041,7 @@ var CheckoutDialog = ({ top }) => {
16066
16041
  const addOnRequestBody = buildAddOnRequestBody(
16067
16042
  resolvedAddOns,
16068
16043
  period,
16069
- shouldTrial,
16070
- resolvedAddOnPayInAdvanceEntitlements
16044
+ shouldTrial
16071
16045
  );
16072
16046
  const creditBundlesRequestBody = buildCreditBundlesRequestBody(
16073
16047
  resolvedCreditBundles
@@ -17878,8 +17852,7 @@ var SubscriptionSidebar = (0, import_react39.forwardRef)(
17878
17852
  const addOnRequestBody = buildAddOnRequestBody(
17879
17853
  addOns,
17880
17854
  planPeriod,
17881
- shouldTrial,
17882
- addOnPayInAdvanceEntitlements
17855
+ shouldTrial
17883
17856
  );
17884
17857
  const creditBundlesRequestBody = buildCreditBundlesRequestBody(creditBundles);
17885
17858
  const checkoutResponseFromBackend = await checkout({
@@ -5174,14 +5174,12 @@ function buildPayInAdvanceRequestBody(entitlements, period) {
5174
5174
  []
5175
5175
  );
5176
5176
  }
5177
- function buildAddOnRequestBody(addOns, period, shouldTrial, addOnPayInAdvanceEntitlements) {
5177
+ function buildAddOnRequestBody(addOns, period, shouldTrial) {
5178
5178
  return addOns.reduce((acc, addOn) => {
5179
5179
  if (addOn.isSelected && !shouldTrial) {
5180
5180
  const addOnPrice = getAddOnPrice(addOn, period);
5181
5181
  const addOnPriceId = addOnPrice?.id;
5182
- if (addOnPriceId && (addOnPrice?.price || addOnPayInAdvanceEntitlements.some(
5183
- (e2) => e2.priceBehavior === EntitlementPriceBehavior.PayInAdvance
5184
- ))) {
5182
+ if (addOnPriceId) {
5185
5183
  acc.push({
5186
5184
  addOnId: addOn.id,
5187
5185
  priceId: addOnPriceId
@@ -7627,7 +7625,7 @@ var defer = () => {
7627
7625
  };
7628
7626
  var makeString = (object) => {
7629
7627
  if (object == null) return "";
7630
- return "" + object;
7628
+ return String(object);
7631
7629
  };
7632
7630
  var copy2 = (a2, s, t2) => {
7633
7631
  a2.forEach((m2) => {
@@ -7635,7 +7633,7 @@ var copy2 = (a2, s, t2) => {
7635
7633
  });
7636
7634
  };
7637
7635
  var lastOfPathSeparatorRegExp = /###/g;
7638
- var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
7636
+ var cleanKey = (key) => key && key.includes("###") ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
7639
7637
  var canNotTraverseDeeper = (object) => !object || isString(object);
7640
7638
  var getLastOfPath = (object, path, Empty) => {
7641
7639
  const stack = !isString(path) ? path : path.split(".");
@@ -7759,7 +7757,7 @@ var looksLikeObjectPathRegExpCache = new RegExpCache(20);
7759
7757
  var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
7760
7758
  nsSeparator = nsSeparator || "";
7761
7759
  keySeparator = keySeparator || "";
7762
- const possibleChars = chars.filter((c2) => nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0);
7760
+ const possibleChars = chars.filter((c2) => !nsSeparator.includes(c2) && !keySeparator.includes(c2));
7763
7761
  if (possibleChars.length === 0) return true;
7764
7762
  const r2 = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c2) => c2 === "?" ? "\\?" : c2).join("|")})`);
7765
7763
  let matched = !r2.test(key);
@@ -7792,7 +7790,7 @@ var deepFind = (obj, path, keySeparator = ".") => {
7792
7790
  nextPath += tokens[j2];
7793
7791
  next2 = current[nextPath];
7794
7792
  if (next2 !== void 0) {
7795
- if (["string", "number", "boolean"].indexOf(typeof next2) > -1 && j2 < tokens.length - 1) {
7793
+ if (["string", "number", "boolean"].includes(typeof next2) && j2 < tokens.length - 1) {
7796
7794
  continue;
7797
7795
  }
7798
7796
  i += j2 - i + 1;
@@ -7881,6 +7879,14 @@ var EventEmitter = class {
7881
7879
  }
7882
7880
  this.observers[event].delete(listener);
7883
7881
  }
7882
+ once(event, listener) {
7883
+ const wrapper = (...args) => {
7884
+ listener(...args);
7885
+ this.off(event, wrapper);
7886
+ };
7887
+ this.on(event, wrapper);
7888
+ return this;
7889
+ }
7884
7890
  emit(event, ...args) {
7885
7891
  if (this.observers[event]) {
7886
7892
  const cloned = Array.from(this.observers[event].entries());
@@ -7894,7 +7900,7 @@ var EventEmitter = class {
7894
7900
  const cloned = Array.from(this.observers["*"].entries());
7895
7901
  cloned.forEach(([observer, numTimesAdded]) => {
7896
7902
  for (let i = 0; i < numTimesAdded; i++) {
7897
- observer.apply(observer, [event, ...args]);
7903
+ observer(event, ...args);
7898
7904
  }
7899
7905
  });
7900
7906
  }
@@ -7916,7 +7922,7 @@ var ResourceStore = class extends EventEmitter {
7916
7922
  }
7917
7923
  }
7918
7924
  addNamespaces(ns) {
7919
- if (this.options.ns.indexOf(ns) < 0) {
7925
+ if (!this.options.ns.includes(ns)) {
7920
7926
  this.options.ns.push(ns);
7921
7927
  }
7922
7928
  }
@@ -7930,7 +7936,7 @@ var ResourceStore = class extends EventEmitter {
7930
7936
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
7931
7937
  const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
7932
7938
  let path;
7933
- if (lng.indexOf(".") > -1) {
7939
+ if (lng.includes(".")) {
7934
7940
  path = lng.split(".");
7935
7941
  } else {
7936
7942
  path = [lng, ns];
@@ -7945,7 +7951,7 @@ var ResourceStore = class extends EventEmitter {
7945
7951
  }
7946
7952
  }
7947
7953
  const result = getPath(this.data, path);
7948
- if (!result && !ns && !key && lng.indexOf(".") > -1) {
7954
+ if (!result && !ns && !key && lng.includes(".")) {
7949
7955
  lng = path[0];
7950
7956
  ns = path[1];
7951
7957
  key = path.slice(2).join(".");
@@ -7959,7 +7965,7 @@ var ResourceStore = class extends EventEmitter {
7959
7965
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
7960
7966
  let path = [lng, ns];
7961
7967
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
7962
- if (lng.indexOf(".") > -1) {
7968
+ if (lng.includes(".")) {
7963
7969
  path = lng.split(".");
7964
7970
  value = ns;
7965
7971
  ns = path[1];
@@ -7983,7 +7989,7 @@ var ResourceStore = class extends EventEmitter {
7983
7989
  skipCopy: false
7984
7990
  }) {
7985
7991
  let path = [lng, ns];
7986
- if (lng.indexOf(".") > -1) {
7992
+ if (lng.includes(".")) {
7987
7993
  path = lng.split(".");
7988
7994
  deep = resources;
7989
7995
  resources = ns;
@@ -8070,7 +8076,6 @@ function keysFromSelector(selector, opts) {
8070
8076
  }
8071
8077
  return path.join(keySeparator);
8072
8078
  }
8073
- var checkedLoadedFor = {};
8074
8079
  var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
8075
8080
  var Translator = class _Translator extends EventEmitter {
8076
8081
  constructor(services, options = {}) {
@@ -8081,6 +8086,7 @@ var Translator = class _Translator extends EventEmitter {
8081
8086
  this.options.keySeparator = ".";
8082
8087
  }
8083
8088
  this.logger = baseLogger.create("translator");
8089
+ this.checkedLoadedFor = {};
8084
8090
  }
8085
8091
  changeLanguage(lng) {
8086
8092
  if (lng) this.language = lng;
@@ -8105,7 +8111,7 @@ var Translator = class _Translator extends EventEmitter {
8105
8111
  if (nsSeparator === void 0) nsSeparator = ":";
8106
8112
  const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
8107
8113
  let namespaces = opt.ns || this.options.defaultNS || [];
8108
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
8114
+ const wouldCheckForNsInKey = nsSeparator && key.includes(nsSeparator);
8109
8115
  const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
8110
8116
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
8111
8117
  const m2 = key.match(this.interpolator.nestingRegexp);
@@ -8116,7 +8122,7 @@ var Translator = class _Translator extends EventEmitter {
8116
8122
  };
8117
8123
  }
8118
8124
  const parts = key.split(nsSeparator);
8119
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
8125
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.includes(parts[0])) namespaces = parts.shift();
8120
8126
  key = parts.join(keySeparator);
8121
8127
  }
8122
8128
  return {
@@ -8203,7 +8209,7 @@ var Translator = class _Translator extends EventEmitter {
8203
8209
  }
8204
8210
  const handleAsObject = shouldHandleAsObject(resForObjHndl);
8205
8211
  const resType = Object.prototype.toString.apply(resForObjHndl);
8206
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
8212
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
8207
8213
  if (!opt.returnObjects && !this.options.returnObjects) {
8208
8214
  if (!this.options.returnedObjectHandler) {
8209
8215
  this.logger.warn("accessing an object - but returnObjects options is not enabled!");
@@ -8299,7 +8305,7 @@ var Translator = class _Translator extends EventEmitter {
8299
8305
  if (this.options.saveMissingPlurals && needsPluralHandling) {
8300
8306
  lngs.forEach((language) => {
8301
8307
  const suffixes = this.pluralResolver.getSuffixes(language, opt);
8302
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
8308
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && !suffixes.includes(`${this.options.pluralSeparator}zero`)) {
8303
8309
  suffixes.push(`${this.options.pluralSeparator}zero`);
8304
8310
  }
8305
8311
  suffixes.forEach((suffix) => {
@@ -8409,8 +8415,8 @@ var Translator = class _Translator extends EventEmitter {
8409
8415
  namespaces.forEach((ns) => {
8410
8416
  if (this.isValidLookup(found)) return;
8411
8417
  usedNS = ns;
8412
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
8413
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
8418
+ if (!this.checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
8419
+ this.checkedLoadedFor[`${codes[0]}-${ns}`] = true;
8414
8420
  this.logger.warn(`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" 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!!!");
8415
8421
  }
8416
8422
  codes.forEach((code) => {
@@ -8425,7 +8431,7 @@ var Translator = class _Translator extends EventEmitter {
8425
8431
  const zeroSuffix = `${this.options.pluralSeparator}zero`;
8426
8432
  const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
8427
8433
  if (needsPluralHandling) {
8428
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
8434
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
8429
8435
  finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
8430
8436
  }
8431
8437
  finalKeys.push(key + pluralSuffix);
@@ -8437,7 +8443,7 @@ var Translator = class _Translator extends EventEmitter {
8437
8443
  const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
8438
8444
  finalKeys.push(contextKey);
8439
8445
  if (needsPluralHandling) {
8440
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
8446
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
8441
8447
  finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
8442
8448
  }
8443
8449
  finalKeys.push(contextKey + pluralSuffix);
@@ -8498,7 +8504,7 @@ var Translator = class _Translator extends EventEmitter {
8498
8504
  static hasDefaultValue(options) {
8499
8505
  const prefix2 = "defaultValue";
8500
8506
  for (const option in options) {
8501
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options[option]) {
8507
+ if (Object.prototype.hasOwnProperty.call(options, option) && option.startsWith(prefix2) && void 0 !== options[option]) {
8502
8508
  return true;
8503
8509
  }
8504
8510
  }
@@ -8513,7 +8519,7 @@ var LanguageUtil = class {
8513
8519
  }
8514
8520
  getScriptPartFromCode(code) {
8515
8521
  code = getCleanedCode(code);
8516
- if (!code || code.indexOf("-") < 0) return null;
8522
+ if (!code || !code.includes("-")) return null;
8517
8523
  const p2 = code.split("-");
8518
8524
  if (p2.length === 2) return null;
8519
8525
  p2.pop();
@@ -8522,12 +8528,12 @@ var LanguageUtil = class {
8522
8528
  }
8523
8529
  getLanguagePartFromCode(code) {
8524
8530
  code = getCleanedCode(code);
8525
- if (!code || code.indexOf("-") < 0) return code;
8531
+ if (!code || !code.includes("-")) return code;
8526
8532
  const p2 = code.split("-");
8527
8533
  return this.formatLanguageCode(p2[0]);
8528
8534
  }
8529
8535
  formatLanguageCode(code) {
8530
- if (isString(code) && code.indexOf("-") > -1) {
8536
+ if (isString(code) && code.includes("-")) {
8531
8537
  let formattedCode;
8532
8538
  try {
8533
8539
  formattedCode = Intl.getCanonicalLocales(code)[0];
@@ -8548,7 +8554,7 @@ var LanguageUtil = class {
8548
8554
  if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
8549
8555
  code = this.getLanguagePartFromCode(code);
8550
8556
  }
8551
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
8557
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(code);
8552
8558
  }
8553
8559
  getBestMatchFromCodes(codes) {
8554
8560
  if (!codes) return null;
@@ -8566,10 +8572,11 @@ var LanguageUtil = class {
8566
8572
  const lngOnly = this.getLanguagePartFromCode(code);
8567
8573
  if (this.isSupportedCode(lngOnly)) return found = lngOnly;
8568
8574
  found = this.options.supportedLngs.find((supportedLng) => {
8569
- if (supportedLng === lngOnly) return supportedLng;
8570
- if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0) return;
8571
- if (supportedLng.indexOf("-") > 0 && lngOnly.indexOf("-") < 0 && supportedLng.substring(0, supportedLng.indexOf("-")) === lngOnly) return supportedLng;
8572
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
8575
+ if (supportedLng === lngOnly) return true;
8576
+ if (!supportedLng.includes("-") && !lngOnly.includes("-")) return false;
8577
+ if (supportedLng.includes("-") && !lngOnly.includes("-") && supportedLng.slice(0, supportedLng.indexOf("-")) === lngOnly) return true;
8578
+ if (supportedLng.startsWith(lngOnly) && lngOnly.length > 1) return true;
8579
+ return false;
8573
8580
  });
8574
8581
  });
8575
8582
  }
@@ -8600,7 +8607,7 @@ var LanguageUtil = class {
8600
8607
  this.logger.warn(`rejecting language code not found in supportedLngs: ${c2}`);
8601
8608
  }
8602
8609
  };
8603
- if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
8610
+ if (isString(code) && (code.includes("-") || code.includes("_"))) {
8604
8611
  if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
8605
8612
  if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
8606
8613
  if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
@@ -8608,7 +8615,7 @@ var LanguageUtil = class {
8608
8615
  addCode(this.formatLanguageCode(code));
8609
8616
  }
8610
8617
  fallbackCodes.forEach((fc) => {
8611
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
8618
+ if (!codes.includes(fc)) addCode(this.formatLanguageCode(fc));
8612
8619
  });
8613
8620
  return codes;
8614
8621
  }
@@ -8762,7 +8769,7 @@ var Interpolator = class {
8762
8769
  let replaces;
8763
8770
  const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
8764
8771
  const handleFormat = (key) => {
8765
- if (key.indexOf(this.formatSeparator) < 0) {
8772
+ if (!key.includes(this.formatSeparator)) {
8766
8773
  const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
8767
8774
  return this.alwaysFormat ? this.format(path, void 0, lng, {
8768
8775
  ...options,
@@ -8832,7 +8839,7 @@ var Interpolator = class {
8832
8839
  let clonedOptions;
8833
8840
  const handleHasOptions = (key, inheritedOptions) => {
8834
8841
  const sep = this.nestingOptionsSeparator;
8835
- if (key.indexOf(sep) < 0) return key;
8842
+ if (!key.includes(sep)) return key;
8836
8843
  const c2 = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
8837
8844
  let optionsString = `{${c2[1]}`;
8838
8845
  key = c2[0];
@@ -8852,7 +8859,7 @@ var Interpolator = class {
8852
8859
  this.logger.warn(`failed parsing options string in nesting for key ${key}`, e2);
8853
8860
  return `${key}${sep}${optionsString}`;
8854
8861
  }
8855
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
8862
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
8856
8863
  return key;
8857
8864
  };
8858
8865
  while (match2 = this.nestingRegexp.exec(str)) {
@@ -8890,13 +8897,13 @@ var Interpolator = class {
8890
8897
  var parseFormatStr = (formatStr) => {
8891
8898
  let formatName = formatStr.toLowerCase().trim();
8892
8899
  const formatOptions = {};
8893
- if (formatStr.indexOf("(") > -1) {
8900
+ if (formatStr.includes("(")) {
8894
8901
  const p2 = formatStr.split("(");
8895
8902
  formatName = p2[0].toLowerCase().trim();
8896
- const optStr = p2[1].substring(0, p2[1].length - 1);
8897
- if (formatName === "currency" && optStr.indexOf(":") < 0) {
8903
+ const optStr = p2[1].slice(0, -1);
8904
+ if (formatName === "currency" && !optStr.includes(":")) {
8898
8905
  if (!formatOptions.currency) formatOptions.currency = optStr.trim();
8899
- } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
8906
+ } else if (formatName === "relativetime" && !optStr.includes(":")) {
8900
8907
  if (!formatOptions.range) formatOptions.range = optStr.trim();
8901
8908
  } else {
8902
8909
  const opts = optStr.split(";");
@@ -8990,9 +8997,11 @@ var Formatter = class {
8990
8997
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
8991
8998
  }
8992
8999
  format(value, format, lng, options = {}) {
9000
+ if (!format) return value;
9001
+ if (value == null) return value;
8993
9002
  const formats = format.split(this.formatSeparator);
8994
- if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
8995
- const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
9003
+ if (formats.length > 1 && formats[0].indexOf("(") > 1 && !formats[0].includes(")") && formats.find((f2) => f2.includes(")"))) {
9004
+ const lastIndex = formats.findIndex((f2) => f2.includes(")"));
8996
9005
  formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
8997
9006
  }
8998
9007
  const result = formats.reduce((mem, f2) => {
@@ -9146,7 +9155,7 @@ var Connector = class extends EventEmitter {
9146
9155
  }
9147
9156
  if (err2 && data && tried < this.maxRetries) {
9148
9157
  setTimeout(() => {
9149
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
9158
+ this.read(lng, ns, fcName, tried + 1, wait * 2, callback);
9150
9159
  }, wait);
9151
9160
  return;
9152
9161
  }
@@ -9250,7 +9259,6 @@ var get = () => ({
9250
9259
  nonExplicitSupportedLngs: false,
9251
9260
  load: "all",
9252
9261
  preload: false,
9253
- simplifyPluralSuffix: true,
9254
9262
  keySeparator: ".",
9255
9263
  nsSeparator: ":",
9256
9264
  pluralSeparator: "_",
@@ -9287,7 +9295,6 @@ var get = () => ({
9287
9295
  },
9288
9296
  interpolation: {
9289
9297
  escapeValue: true,
9290
- format: (value) => value,
9291
9298
  prefix: "{{",
9292
9299
  suffix: "}}",
9293
9300
  formatSeparator: ",",
@@ -9304,10 +9311,9 @@ var transformOptions = (options) => {
9304
9311
  if (isString(options.ns)) options.ns = [options.ns];
9305
9312
  if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
9306
9313
  if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
9307
- if (options.supportedLngs?.indexOf?.("cimode") < 0) {
9314
+ if (options.supportedLngs && !options.supportedLngs.includes("cimode")) {
9308
9315
  options.supportedLngs = options.supportedLngs.concat(["cimode"]);
9309
9316
  }
9310
- if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
9311
9317
  return options;
9312
9318
  };
9313
9319
  var noop = () => {
@@ -9320,28 +9326,6 @@ var bindMemberFunctions = (inst) => {
9320
9326
  }
9321
9327
  });
9322
9328
  };
9323
- var SUPPORT_NOTICE_KEY = "__i18next_supportNoticeShown";
9324
- var getSupportNoticeShown = () => {
9325
- if (typeof globalThis !== "undefined" && !!globalThis[SUPPORT_NOTICE_KEY]) return true;
9326
- if (typeof process !== "undefined" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE) return true;
9327
- if (typeof process !== "undefined" && process.env && false) return true;
9328
- return false;
9329
- };
9330
- var setSupportNoticeShown = () => {
9331
- if (typeof globalThis !== "undefined") globalThis[SUPPORT_NOTICE_KEY] = true;
9332
- };
9333
- var usesLocize = (inst) => {
9334
- if (inst?.modules?.backend?.name?.indexOf("Locize") > 0) return true;
9335
- if (inst?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0) return true;
9336
- if (inst?.options?.backend?.backends) {
9337
- if (inst.options.backend.backends.some((b2) => b2?.name?.indexOf("Locize") > 0 || b2?.constructor?.name?.indexOf("Locize") > 0)) return true;
9338
- }
9339
- if (inst?.options?.backend?.projectId) return true;
9340
- if (inst?.options?.backend?.backendOptions) {
9341
- if (inst.options.backend.backendOptions.some((b2) => b2?.projectId)) return true;
9342
- }
9343
- return false;
9344
- };
9345
9329
  var I18n = class _I18n extends EventEmitter {
9346
9330
  constructor(options = {}, callback) {
9347
9331
  super();
@@ -9371,7 +9355,7 @@ var I18n = class _I18n extends EventEmitter {
9371
9355
  if (options.defaultNS == null && options.ns) {
9372
9356
  if (isString(options.ns)) {
9373
9357
  options.defaultNS = options.ns;
9374
- } else if (options.ns.indexOf("translation") < 0) {
9358
+ } else if (!options.ns.includes("translation")) {
9375
9359
  options.defaultNS = options.ns[0];
9376
9360
  }
9377
9361
  }
@@ -9394,10 +9378,6 @@ var I18n = class _I18n extends EventEmitter {
9394
9378
  if (typeof this.options.overloadTranslationOptionHandler !== "function") {
9395
9379
  this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
9396
9380
  }
9397
- if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
9398
- if (typeof console !== "undefined" && typeof console.info !== "undefined") console.info("\u{1F310} i18next is made possible by our own product, Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}");
9399
- setSupportNoticeShown();
9400
- }
9401
9381
  const createClassOnDemand = (ClassOrObject) => {
9402
9382
  if (!ClassOrObject) return null;
9403
9383
  if (typeof ClassOrObject === "function") return new ClassOrObject();
@@ -9422,14 +9402,9 @@ var I18n = class _I18n extends EventEmitter {
9422
9402
  s.resourceStore = this.store;
9423
9403
  s.languageUtils = lu;
9424
9404
  s.pluralResolver = new PluralResolver(lu, {
9425
- prepend: this.options.pluralSeparator,
9426
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
9405
+ prepend: this.options.pluralSeparator
9427
9406
  });
9428
- const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
9429
- if (usingLegacyFormatFunction) {
9430
- this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
9431
- }
9432
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
9407
+ if (formatter) {
9433
9408
  s.formatter = createClassOnDemand(formatter);
9434
9409
  if (s.formatter.init) s.formatter.init(s, this.options);
9435
9410
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
@@ -9512,7 +9487,7 @@ var I18n = class _I18n extends EventEmitter {
9512
9487
  const lngs = this.services.languageUtils.toResolveHierarchy(lng);
9513
9488
  lngs.forEach((l2) => {
9514
9489
  if (l2 === "cimode") return;
9515
- if (toLoad.indexOf(l2) < 0) toLoad.push(l2);
9490
+ if (!toLoad.includes(l2)) toLoad.push(l2);
9516
9491
  });
9517
9492
  };
9518
9493
  if (!usedLng) {
@@ -9577,16 +9552,16 @@ var I18n = class _I18n extends EventEmitter {
9577
9552
  }
9578
9553
  setResolvedLanguage(l2) {
9579
9554
  if (!l2 || !this.languages) return;
9580
- if (["cimode", "dev"].indexOf(l2) > -1) return;
9555
+ if (["cimode", "dev"].includes(l2)) return;
9581
9556
  for (let li = 0; li < this.languages.length; li++) {
9582
9557
  const lngInLngs = this.languages[li];
9583
- if (["cimode", "dev"].indexOf(lngInLngs) > -1) continue;
9558
+ if (["cimode", "dev"].includes(lngInLngs)) continue;
9584
9559
  if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
9585
9560
  this.resolvedLanguage = lngInLngs;
9586
9561
  break;
9587
9562
  }
9588
9563
  }
9589
- if (!this.resolvedLanguage && this.languages.indexOf(l2) < 0 && this.store.hasLanguageSomeTranslations(l2)) {
9564
+ if (!this.resolvedLanguage && !this.languages.includes(l2) && this.store.hasLanguageSomeTranslations(l2)) {
9590
9565
  this.resolvedLanguage = l2;
9591
9566
  this.languages.unshift(l2);
9592
9567
  }
@@ -9728,7 +9703,7 @@ var I18n = class _I18n extends EventEmitter {
9728
9703
  }
9729
9704
  if (isString(ns)) ns = [ns];
9730
9705
  ns.forEach((n) => {
9731
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
9706
+ if (!this.options.ns.includes(n)) this.options.ns.push(n);
9732
9707
  });
9733
9708
  this.loadResources((err2) => {
9734
9709
  deferred.resolve();
@@ -9740,7 +9715,7 @@ var I18n = class _I18n extends EventEmitter {
9740
9715
  const deferred = defer();
9741
9716
  if (isString(lngs)) lngs = [lngs];
9742
9717
  const preloaded = this.options.preload || [];
9743
- const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
9718
+ const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
9744
9719
  if (!newLngs.length) {
9745
9720
  if (callback) callback();
9746
9721
  return Promise.resolve();
@@ -9766,7 +9741,7 @@ var I18n = class _I18n extends EventEmitter {
9766
9741
  const rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"];
9767
9742
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
9768
9743
  if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
9769
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9744
+ return rtlLngs.includes(languageUtils.getLanguagePartFromCode(lng)) || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9770
9745
  }
9771
9746
  static createInstance(options = {}, callback) {
9772
9747
  const instance2 = new _I18n(options, callback);
@@ -12464,7 +12439,7 @@ var reducer = (state, action) => {
12464
12439
  // src/context/EmbedProvider.tsx
12465
12440
  import { jsx, jsxs } from "react/jsx-runtime";
12466
12441
  var getCustomHeaders = (sessionId) => ({
12467
- "X-Schematic-Components-Version": "2.8.3",
12442
+ "X-Schematic-Components-Version": "2.8.4",
12468
12443
  "X-Schematic-Session-ID": sessionId
12469
12444
  });
12470
12445
  var EmbedProvider = ({
@@ -16003,8 +15978,7 @@ var CheckoutDialog = ({ top }) => {
16003
15978
  const addOnRequestBody = buildAddOnRequestBody(
16004
15979
  resolvedAddOns,
16005
15980
  period,
16006
- shouldTrial,
16007
- resolvedAddOnPayInAdvanceEntitlements
15981
+ shouldTrial
16008
15982
  );
16009
15983
  const creditBundlesRequestBody = buildCreditBundlesRequestBody(
16010
15984
  resolvedCreditBundles
@@ -17827,8 +17801,7 @@ var SubscriptionSidebar = forwardRef7(
17827
17801
  const addOnRequestBody = buildAddOnRequestBody(
17828
17802
  addOns,
17829
17803
  planPeriod,
17830
- shouldTrial,
17831
- addOnPayInAdvanceEntitlements
17804
+ shouldTrial
17832
17805
  );
17833
17806
  const creditBundlesRequestBody = buildCreditBundlesRequestBody(creditBundles);
17834
17807
  const checkoutResponseFromBackend = await checkout({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematichq/schematic-components",
3
- "version": "2.8.3",
3
+ "version": "2.8.4",
4
4
  "main": "dist/schematic-components.cjs.js",
5
5
  "module": "dist/schematic-components.esm.js",
6
6
  "types": "dist/schematic-components.d.ts",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@schematichq/schematic-icons": "^0.5.2",
37
37
  "@stripe/stripe-js": "^8.11.0",
38
- "i18next": "^25.10.10",
38
+ "i18next": "^26.0.2",
39
39
  "lodash": "^4.17.23",
40
40
  "pako": "^2.1.0",
41
41
  "react-i18next": "16.1.6",