@schematichq/schematic-components 0.7.14 → 0.7.15

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.
@@ -7854,8 +7854,7 @@ var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
7854
7854
  }
7855
7855
  return matched;
7856
7856
  };
7857
- var deepFind = function(obj, path) {
7858
- let keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
7857
+ var deepFind = (obj, path, keySeparator = ".") => {
7859
7858
  if (!obj) return void 0;
7860
7859
  if (obj[path]) {
7861
7860
  if (!Object.prototype.hasOwnProperty.call(obj, path)) return void 0;
@@ -7904,39 +7903,25 @@ var consoleLogger = {
7904
7903
  }
7905
7904
  };
7906
7905
  var Logger = class _Logger {
7907
- constructor(concreteLogger) {
7908
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
7906
+ constructor(concreteLogger, options2 = {}) {
7909
7907
  this.init(concreteLogger, options2);
7910
7908
  }
7911
- init(concreteLogger) {
7912
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
7909
+ init(concreteLogger, options2 = {}) {
7913
7910
  this.prefix = options2.prefix || "i18next:";
7914
7911
  this.logger = concreteLogger || consoleLogger;
7915
7912
  this.options = options2;
7916
7913
  this.debug = options2.debug;
7917
7914
  }
7918
- log() {
7919
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
7920
- args[_key] = arguments[_key];
7921
- }
7915
+ log(...args) {
7922
7916
  return this.forward(args, "log", "", true);
7923
7917
  }
7924
- warn() {
7925
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
7926
- args[_key2] = arguments[_key2];
7927
- }
7918
+ warn(...args) {
7928
7919
  return this.forward(args, "warn", "", true);
7929
7920
  }
7930
- error() {
7931
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
7932
- args[_key3] = arguments[_key3];
7933
- }
7921
+ error(...args) {
7934
7922
  return this.forward(args, "error", "");
7935
7923
  }
7936
- deprecate() {
7937
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
7938
- args[_key4] = arguments[_key4];
7939
- }
7924
+ deprecate(...args) {
7940
7925
  return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
7941
7926
  }
7942
7927
  forward(args, lvl, prefix2, debugOnly) {
@@ -7979,14 +7964,10 @@ var EventEmitter = class {
7979
7964
  }
7980
7965
  this.observers[event].delete(listener);
7981
7966
  }
7982
- emit(event) {
7983
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
7984
- args[_key - 1] = arguments[_key];
7985
- }
7967
+ emit(event, ...args) {
7986
7968
  if (this.observers[event]) {
7987
7969
  const cloned = Array.from(this.observers[event].entries());
7988
- cloned.forEach((_ref) => {
7989
- let [observer, numTimesAdded] = _ref;
7970
+ cloned.forEach(([observer, numTimesAdded]) => {
7990
7971
  for (let i2 = 0; i2 < numTimesAdded; i2++) {
7991
7972
  observer(...args);
7992
7973
  }
@@ -7994,8 +7975,7 @@ var EventEmitter = class {
7994
7975
  }
7995
7976
  if (this.observers["*"]) {
7996
7977
  const cloned = Array.from(this.observers["*"].entries());
7997
- cloned.forEach((_ref2) => {
7998
- let [observer, numTimesAdded] = _ref2;
7978
+ cloned.forEach(([observer, numTimesAdded]) => {
7999
7979
  for (let i2 = 0; i2 < numTimesAdded; i2++) {
8000
7980
  observer.apply(observer, [event, ...args]);
8001
7981
  }
@@ -8004,11 +7984,10 @@ var EventEmitter = class {
8004
7984
  }
8005
7985
  };
8006
7986
  var ResourceStore = class extends EventEmitter {
8007
- constructor(data) {
8008
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
8009
- ns: ["translation"],
8010
- defaultNS: "translation"
8011
- };
7987
+ constructor(data, options2 = {
7988
+ ns: ["translation"],
7989
+ defaultNS: "translation"
7990
+ }) {
8012
7991
  super();
8013
7992
  this.data = data || {};
8014
7993
  this.options = options2;
@@ -8030,8 +8009,7 @@ var ResourceStore = class extends EventEmitter {
8030
8009
  this.options.ns.splice(index, 1);
8031
8010
  }
8032
8011
  }
8033
- getResource(lng, ns, key) {
8034
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
8012
+ getResource(lng, ns, key, options2 = {}) {
8035
8013
  const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
8036
8014
  const ignoreJSONStructure = options2.ignoreJSONStructure !== void 0 ? options2.ignoreJSONStructure : this.options.ignoreJSONStructure;
8037
8015
  let path;
@@ -8058,10 +8036,9 @@ var ResourceStore = class extends EventEmitter {
8058
8036
  if (result || !ignoreJSONStructure || !isString(key)) return result;
8059
8037
  return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
8060
8038
  }
8061
- addResource(lng, ns, key, value) {
8062
- let options2 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
8063
- silent: false
8064
- };
8039
+ addResource(lng, ns, key, value, options2 = {
8040
+ silent: false
8041
+ }) {
8065
8042
  const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
8066
8043
  let path = [lng, ns];
8067
8044
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
@@ -8074,10 +8051,9 @@ var ResourceStore = class extends EventEmitter {
8074
8051
  setPath(this.data, path, value);
8075
8052
  if (!options2.silent) this.emit("added", lng, ns, key, value);
8076
8053
  }
8077
- addResources(lng, ns, resources) {
8078
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
8079
- silent: false
8080
- };
8054
+ addResources(lng, ns, resources, options2 = {
8055
+ silent: false
8056
+ }) {
8081
8057
  for (const m2 in resources) {
8082
8058
  if (isString(resources[m2]) || Array.isArray(resources[m2])) this.addResource(lng, ns, m2, resources[m2], {
8083
8059
  silent: true
@@ -8085,11 +8061,10 @@ var ResourceStore = class extends EventEmitter {
8085
8061
  }
8086
8062
  if (!options2.silent) this.emit("added", lng, ns, resources);
8087
8063
  }
8088
- addResourceBundle(lng, ns, resources, deep, overwrite) {
8089
- let options2 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
8090
- silent: false,
8091
- skipCopy: false
8092
- };
8064
+ addResourceBundle(lng, ns, resources, deep, overwrite, options2 = {
8065
+ silent: false,
8066
+ skipCopy: false
8067
+ }) {
8093
8068
  let path = [lng, ns];
8094
8069
  if (lng.indexOf(".") > -1) {
8095
8070
  path = lng.split(".");
@@ -8152,8 +8127,7 @@ var postProcessor = {
8152
8127
  var checkedLoadedFor = {};
8153
8128
  var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
8154
8129
  var Translator = class _Translator extends EventEmitter {
8155
- constructor(services) {
8156
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8130
+ constructor(services, options2 = {}) {
8157
8131
  super();
8158
8132
  copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
8159
8133
  this.options = options2;
@@ -8165,10 +8139,9 @@ var Translator = class _Translator extends EventEmitter {
8165
8139
  changeLanguage(lng) {
8166
8140
  if (lng) this.language = lng;
8167
8141
  }
8168
- exists(key) {
8169
- let o2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
8170
- interpolation: {}
8171
- };
8142
+ exists(key, o2 = {
8143
+ interpolation: {}
8144
+ }) {
8172
8145
  const opt = {
8173
8146
  ...o2
8174
8147
  };
@@ -8220,11 +8193,12 @@ var Translator = class _Translator extends EventEmitter {
8220
8193
  namespaces
8221
8194
  } = this.extractFromKey(keys[keys.length - 1], opt);
8222
8195
  const namespace = namespaces[namespaces.length - 1];
8196
+ let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
8197
+ if (nsSeparator === void 0) nsSeparator = ":";
8223
8198
  const lng = opt.lng || this.language;
8224
8199
  const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
8225
8200
  if (lng?.toLowerCase() === "cimode") {
8226
8201
  if (appendNamespaceToCIMode) {
8227
- const nsSeparator = opt.nsSeparator || this.options.nsSeparator;
8228
8202
  if (returnDetails) {
8229
8203
  return {
8230
8204
  res: `${namespace}${nsSeparator}${key}`,
@@ -8379,9 +8353,11 @@ var Translator = class _Translator extends EventEmitter {
8379
8353
  }
8380
8354
  }
8381
8355
  res = this.extendTranslation(res, keys, opt, resolved, lastKey);
8382
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}:${key}`;
8356
+ if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
8357
+ res = `${namespace}${nsSeparator}${key}`;
8358
+ }
8383
8359
  if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
8384
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : void 0, opt);
8360
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : void 0, opt);
8385
8361
  }
8386
8362
  }
8387
8363
  if (returnDetails) {
@@ -8392,7 +8368,6 @@ var Translator = class _Translator extends EventEmitter {
8392
8368
  return res;
8393
8369
  }
8394
8370
  extendTranslation(res, key, opt, resolved, lastKey) {
8395
- var _this = this;
8396
8371
  if (this.i18nFormat?.parse) {
8397
8372
  res = this.i18nFormat.parse(res, {
8398
8373
  ...this.options.interpolation.defaultVariables,
@@ -8428,15 +8403,12 @@ var Translator = class _Translator extends EventEmitter {
8428
8403
  if (nestBef < nestAft) opt.nest = false;
8429
8404
  }
8430
8405
  if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
8431
- if (opt.nest !== false) res = this.interpolator.nest(res, function() {
8432
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8433
- args[_key] = arguments[_key];
8434
- }
8406
+ if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
8435
8407
  if (lastKey?.[0] === args[0] && !opt.context) {
8436
- _this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
8408
+ this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
8437
8409
  return null;
8438
8410
  }
8439
- return _this.translate(...args, key);
8411
+ return this.translate(...args, key);
8440
8412
  }, opt);
8441
8413
  if (opt.interpolation) this.interpolator.reset();
8442
8414
  }
@@ -8453,8 +8425,7 @@ var Translator = class _Translator extends EventEmitter {
8453
8425
  }
8454
8426
  return res;
8455
8427
  }
8456
- resolve(keys) {
8457
- let opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8428
+ resolve(keys, opt = {}) {
8458
8429
  let found;
8459
8430
  let usedKey;
8460
8431
  let exactUsedKey;
@@ -8534,13 +8505,11 @@ var Translator = class _Translator extends EventEmitter {
8534
8505
  isValidLookup(res) {
8535
8506
  return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
8536
8507
  }
8537
- getResource(code, ns, key) {
8538
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
8508
+ getResource(code, ns, key, options2 = {}) {
8539
8509
  if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options2);
8540
8510
  return this.resourceStore.getResource(code, ns, key, options2);
8541
8511
  }
8542
- getUsedParamsDetails() {
8543
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8512
+ getUsedParamsDetails(options2 = {}) {
8544
8513
  const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
8545
8514
  const useOptionsReplaceForData = options2.replace && !isString(options2.replace);
8546
8515
  let data = useOptionsReplaceForData ? options2.replace : options2;
@@ -8696,8 +8665,7 @@ var dummyRule = {
8696
8665
  })
8697
8666
  };
8698
8667
  var PluralResolver = class {
8699
- constructor(languageUtils) {
8700
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8668
+ constructor(languageUtils, options2 = {}) {
8701
8669
  this.languageUtils = languageUtils;
8702
8670
  this.options = options2;
8703
8671
  this.logger = baseLogger.create("pluralResolver");
@@ -8709,8 +8677,7 @@ var PluralResolver = class {
8709
8677
  clearCache() {
8710
8678
  this.pluralRulesCache = {};
8711
8679
  }
8712
- getRule(code) {
8713
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8680
+ getRule(code, options2 = {}) {
8714
8681
  const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
8715
8682
  const type = options2.ordinal ? "ordinal" : "cardinal";
8716
8683
  const cacheKey = JSON.stringify({
@@ -8737,25 +8704,21 @@ var PluralResolver = class {
8737
8704
  this.pluralRulesCache[cacheKey] = rule;
8738
8705
  return rule;
8739
8706
  }
8740
- needsPlural(code) {
8741
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8707
+ needsPlural(code, options2 = {}) {
8742
8708
  let rule = this.getRule(code, options2);
8743
8709
  if (!rule) rule = this.getRule("dev", options2);
8744
8710
  return rule?.resolvedOptions().pluralCategories.length > 1;
8745
8711
  }
8746
- getPluralFormsOfKey(code, key) {
8747
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
8712
+ getPluralFormsOfKey(code, key, options2 = {}) {
8748
8713
  return this.getSuffixes(code, options2).map((suffix) => `${key}${suffix}`);
8749
8714
  }
8750
- getSuffixes(code) {
8751
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8715
+ getSuffixes(code, options2 = {}) {
8752
8716
  let rule = this.getRule(code, options2);
8753
8717
  if (!rule) rule = this.getRule("dev", options2);
8754
8718
  if (!rule) return [];
8755
8719
  return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
8756
8720
  }
8757
- getSuffix(code, count) {
8758
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
8721
+ getSuffix(code, count, options2 = {}) {
8759
8722
  const rule = this.getRule(code, options2);
8760
8723
  if (rule) {
8761
8724
  return `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
@@ -8764,9 +8727,7 @@ var PluralResolver = class {
8764
8727
  return this.getSuffix("dev", count, options2);
8765
8728
  }
8766
8729
  };
8767
- var deepFindWithDefaults = function(data, defaultData, key) {
8768
- let keySeparator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".";
8769
- let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
8730
+ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
8770
8731
  let path = getPathWithDefaults(data, defaultData, key);
8771
8732
  if (!path && ignoreJSONStructure && isString(key)) {
8772
8733
  path = deepFind(data, key, keySeparator);
@@ -8776,15 +8737,13 @@ var deepFindWithDefaults = function(data, defaultData, key) {
8776
8737
  };
8777
8738
  var regexSafe = (val) => val.replace(/\$/g, "$$$$");
8778
8739
  var Interpolator = class {
8779
- constructor() {
8780
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8740
+ constructor(options2 = {}) {
8781
8741
  this.logger = baseLogger.create("interpolator");
8782
8742
  this.options = options2;
8783
8743
  this.format = options2?.interpolation?.format || ((value) => value);
8784
8744
  this.init(options2);
8785
8745
  }
8786
- init() {
8787
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8746
+ init(options2 = {}) {
8788
8747
  if (!options2.interpolation) options2.interpolation = {
8789
8748
  escapeValue: true
8790
8749
  };
@@ -8907,8 +8866,7 @@ var Interpolator = class {
8907
8866
  });
8908
8867
  return str;
8909
8868
  }
8910
- nest(str, fc) {
8911
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
8869
+ nest(str, fc, options2 = {}) {
8912
8870
  let match2;
8913
8871
  let value;
8914
8872
  let clonedOptions;
@@ -9004,68 +8962,68 @@ var parseFormatStr = (formatStr) => {
9004
8962
  };
9005
8963
  var createCachedFormatter = (fn) => {
9006
8964
  const cache = {};
9007
- return (val, lng, options2) => {
9008
- let optForCache = options2;
9009
- if (options2 && options2.interpolationkey && options2.formatParams && options2.formatParams[options2.interpolationkey] && options2[options2.interpolationkey]) {
8965
+ return (v2, l2, o2) => {
8966
+ let optForCache = o2;
8967
+ if (o2 && o2.interpolationkey && o2.formatParams && o2.formatParams[o2.interpolationkey] && o2[o2.interpolationkey]) {
9010
8968
  optForCache = {
9011
8969
  ...optForCache,
9012
- [options2.interpolationkey]: void 0
8970
+ [o2.interpolationkey]: void 0
9013
8971
  };
9014
8972
  }
9015
- const key = lng + JSON.stringify(optForCache);
9016
- let formatter = cache[key];
9017
- if (!formatter) {
9018
- formatter = fn(getCleanedCode(lng), options2);
9019
- cache[key] = formatter;
8973
+ const key = l2 + JSON.stringify(optForCache);
8974
+ let frm = cache[key];
8975
+ if (!frm) {
8976
+ frm = fn(getCleanedCode(l2), o2);
8977
+ cache[key] = frm;
9020
8978
  }
9021
- return formatter(val);
8979
+ return frm(v2);
9022
8980
  };
9023
8981
  };
8982
+ var createNonCachedFormatter = (fn) => (v2, l2, o2) => fn(getCleanedCode(l2), o2)(v2);
9024
8983
  var Formatter = class {
9025
- constructor() {
9026
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8984
+ constructor(options2 = {}) {
9027
8985
  this.logger = baseLogger.create("formatter");
9028
8986
  this.options = options2;
8987
+ this.init(options2);
8988
+ }
8989
+ init(services, options2 = {
8990
+ interpolation: {}
8991
+ }) {
8992
+ this.formatSeparator = options2.interpolation.formatSeparator || ",";
8993
+ const cf = options2.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
9029
8994
  this.formats = {
9030
- number: createCachedFormatter((lng, opt) => {
8995
+ number: cf((lng, opt) => {
9031
8996
  const formatter = new Intl.NumberFormat(lng, {
9032
8997
  ...opt
9033
8998
  });
9034
8999
  return (val) => formatter.format(val);
9035
9000
  }),
9036
- currency: createCachedFormatter((lng, opt) => {
9001
+ currency: cf((lng, opt) => {
9037
9002
  const formatter = new Intl.NumberFormat(lng, {
9038
9003
  ...opt,
9039
9004
  style: "currency"
9040
9005
  });
9041
9006
  return (val) => formatter.format(val);
9042
9007
  }),
9043
- datetime: createCachedFormatter((lng, opt) => {
9008
+ datetime: cf((lng, opt) => {
9044
9009
  const formatter = new Intl.DateTimeFormat(lng, {
9045
9010
  ...opt
9046
9011
  });
9047
9012
  return (val) => formatter.format(val);
9048
9013
  }),
9049
- relativetime: createCachedFormatter((lng, opt) => {
9014
+ relativetime: cf((lng, opt) => {
9050
9015
  const formatter = new Intl.RelativeTimeFormat(lng, {
9051
9016
  ...opt
9052
9017
  });
9053
9018
  return (val) => formatter.format(val, opt.range || "day");
9054
9019
  }),
9055
- list: createCachedFormatter((lng, opt) => {
9020
+ list: cf((lng, opt) => {
9056
9021
  const formatter = new Intl.ListFormat(lng, {
9057
9022
  ...opt
9058
9023
  });
9059
9024
  return (val) => formatter.format(val);
9060
9025
  })
9061
9026
  };
9062
- this.init(options2);
9063
- }
9064
- init(services) {
9065
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
9066
- interpolation: {}
9067
- };
9068
- this.formatSeparator = options2.interpolation.formatSeparator || ",";
9069
9027
  }
9070
9028
  add(name, fc) {
9071
9029
  this.formats[name.toLowerCase().trim()] = fc;
@@ -9073,8 +9031,7 @@ var Formatter = class {
9073
9031
  addCached(name, fc) {
9074
9032
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
9075
9033
  }
9076
- format(value, format, lng) {
9077
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
9034
+ format(value, format, lng, options2 = {}) {
9078
9035
  const formats = format.split(this.formatSeparator);
9079
9036
  if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
9080
9037
  const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
@@ -9114,8 +9071,7 @@ var removePending = (q2, name) => {
9114
9071
  }
9115
9072
  };
9116
9073
  var Connector = class extends EventEmitter {
9117
- constructor(backend, store, services) {
9118
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
9074
+ constructor(backend, store, services, options2 = {}) {
9119
9075
  super();
9120
9076
  this.backend = backend;
9121
9077
  this.store = store;
@@ -9210,10 +9166,7 @@ var Connector = class extends EventEmitter {
9210
9166
  this.emit("loaded", loaded);
9211
9167
  this.queue = this.queue.filter((q2) => !q2.done);
9212
9168
  }
9213
- read(lng, ns, fcName) {
9214
- let tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
9215
- let wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout;
9216
- let callback = arguments.length > 5 ? arguments[5] : void 0;
9169
+ read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
9217
9170
  if (!lng.length) return callback(null, {});
9218
9171
  if (this.readingCalls >= this.maxParallelReads) {
9219
9172
  this.waitingReads.push({
@@ -9257,9 +9210,7 @@ var Connector = class extends EventEmitter {
9257
9210
  }
9258
9211
  return fc(lng, ns, resolver);
9259
9212
  }
9260
- prepareLoading(languages, namespaces) {
9261
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
9262
- let callback = arguments.length > 3 ? arguments[3] : void 0;
9213
+ prepareLoading(languages, namespaces, options2 = {}, callback) {
9263
9214
  if (!this.backend) {
9264
9215
  this.logger.warn("No backend was added via i18next.use. Will not load resources.");
9265
9216
  return callback && callback();
@@ -9283,8 +9234,7 @@ var Connector = class extends EventEmitter {
9283
9234
  reload: true
9284
9235
  }, callback);
9285
9236
  }
9286
- loadOne(name) {
9287
- let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
9237
+ loadOne(name, prefix2 = "") {
9288
9238
  const s2 = name.split("|");
9289
9239
  const lng = s2[0];
9290
9240
  const ns = s2[1];
@@ -9294,10 +9244,8 @@ var Connector = class extends EventEmitter {
9294
9244
  this.loaded(name, err2, data);
9295
9245
  });
9296
9246
  }
9297
- saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
9298
- let options2 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
9299
- let clb = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
9300
- };
9247
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options2 = {}, clb = () => {
9248
+ }) {
9301
9249
  if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
9302
9250
  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!!!");
9303
9251
  return;
@@ -9391,7 +9339,8 @@ var get = () => ({
9391
9339
  nestingOptionsSeparator: ",",
9392
9340
  maxReplaces: 1e3,
9393
9341
  skipOnVariables: true
9394
- }
9342
+ },
9343
+ cacheInBuiltFormats: true
9395
9344
  });
9396
9345
  var transformOptions = (options2) => {
9397
9346
  if (isString(options2.ns)) options2.ns = [options2.ns];
@@ -9414,9 +9363,7 @@ var bindMemberFunctions = (inst) => {
9414
9363
  });
9415
9364
  };
9416
9365
  var I18n = class _I18n extends EventEmitter {
9417
- constructor() {
9418
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9419
- let callback = arguments.length > 1 ? arguments[1] : void 0;
9366
+ constructor(options2 = {}, callback) {
9420
9367
  super();
9421
9368
  this.options = transformOptions(options2);
9422
9369
  this.services = {};
@@ -9435,10 +9382,7 @@ var I18n = class _I18n extends EventEmitter {
9435
9382
  }, 0);
9436
9383
  }
9437
9384
  }
9438
- init() {
9439
- var _this = this;
9440
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9441
- let callback = arguments.length > 1 ? arguments[1] : void 0;
9385
+ init(options2 = {}, callback) {
9442
9386
  this.isInitializing = true;
9443
9387
  if (typeof options2 === "function") {
9444
9388
  callback = options2;
@@ -9504,11 +9448,8 @@ var I18n = class _I18n extends EventEmitter {
9504
9448
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
9505
9449
  };
9506
9450
  s2.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s2.resourceStore, s2, this.options);
9507
- s2.backendConnector.on("*", function(event) {
9508
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9509
- args[_key - 1] = arguments[_key];
9510
- }
9511
- _this.emit(event, ...args);
9451
+ s2.backendConnector.on("*", (event, ...args) => {
9452
+ this.emit(event, ...args);
9512
9453
  });
9513
9454
  if (this.modules.languageDetector) {
9514
9455
  s2.languageDetector = createClassOnDemand(this.modules.languageDetector);
@@ -9519,11 +9460,8 @@ var I18n = class _I18n extends EventEmitter {
9519
9460
  if (s2.i18nFormat.init) s2.i18nFormat.init(this);
9520
9461
  }
9521
9462
  this.translator = new Translator(this.services, this.options);
9522
- this.translator.on("*", function(event) {
9523
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
9524
- args[_key2 - 1] = arguments[_key2];
9525
- }
9526
- _this.emit(event, ...args);
9463
+ this.translator.on("*", (event, ...args) => {
9464
+ this.emit(event, ...args);
9527
9465
  });
9528
9466
  this.modules.external.forEach((m2) => {
9529
9467
  if (m2.init) m2.init(this);
@@ -9540,15 +9478,13 @@ var I18n = class _I18n extends EventEmitter {
9540
9478
  }
9541
9479
  const storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
9542
9480
  storeApi.forEach((fcName) => {
9543
- this[fcName] = function() {
9544
- return _this.store[fcName](...arguments);
9545
- };
9481
+ this[fcName] = (...args) => this.store[fcName](...args);
9546
9482
  });
9547
9483
  const storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
9548
9484
  storeApiChained.forEach((fcName) => {
9549
- this[fcName] = function() {
9550
- _this.store[fcName](...arguments);
9551
- return _this;
9485
+ this[fcName] = (...args) => {
9486
+ this.store[fcName](...args);
9487
+ return this;
9552
9488
  };
9553
9489
  });
9554
9490
  const deferred = defer();
@@ -9572,8 +9508,7 @@ var I18n = class _I18n extends EventEmitter {
9572
9508
  }
9573
9509
  return deferred;
9574
9510
  }
9575
- loadResources(language) {
9576
- let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
9511
+ loadResources(language, callback = noop) {
9577
9512
  let usedCallback = callback;
9578
9513
  const usedLng = isString(language) ? language : this.language;
9579
9514
  if (typeof language === "function") usedCallback = language;
@@ -9666,7 +9601,6 @@ var I18n = class _I18n extends EventEmitter {
9666
9601
  }
9667
9602
  }
9668
9603
  changeLanguage(lng, callback) {
9669
- var _this2 = this;
9670
9604
  this.isLanguageChangingTo = lng;
9671
9605
  const deferred = defer();
9672
9606
  this.emit("languageChanging", lng);
@@ -9688,12 +9622,8 @@ var I18n = class _I18n extends EventEmitter {
9688
9622
  } else {
9689
9623
  this.isLanguageChangingTo = void 0;
9690
9624
  }
9691
- deferred.resolve(function() {
9692
- return _this2.t(...arguments);
9693
- });
9694
- if (callback) callback(err2, function() {
9695
- return _this2.t(...arguments);
9696
- });
9625
+ deferred.resolve((...args) => this.t(...args));
9626
+ if (callback) callback(err2, (...args) => this.t(...args));
9697
9627
  };
9698
9628
  const setLng = (lngs) => {
9699
9629
  if (!lng && !lngs && this.services.languageDetector) lngs = [];
@@ -9724,14 +9654,10 @@ var I18n = class _I18n extends EventEmitter {
9724
9654
  return deferred;
9725
9655
  }
9726
9656
  getFixedT(lng, ns, keyPrefix) {
9727
- var _this3 = this;
9728
- const fixedT = function(key, opts) {
9657
+ const fixedT = (key, opts, ...rest) => {
9729
9658
  let o2;
9730
9659
  if (typeof opts !== "object") {
9731
- for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
9732
- rest[_key3 - 2] = arguments[_key3];
9733
- }
9734
- o2 = _this3.options.overloadTranslationOptionHandler([key, opts].concat(rest));
9660
+ o2 = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
9735
9661
  } else {
9736
9662
  o2 = {
9737
9663
  ...opts
@@ -9741,14 +9667,14 @@ var I18n = class _I18n extends EventEmitter {
9741
9667
  o2.lngs = o2.lngs || fixedT.lngs;
9742
9668
  o2.ns = o2.ns || fixedT.ns;
9743
9669
  if (o2.keyPrefix !== "") o2.keyPrefix = o2.keyPrefix || keyPrefix || fixedT.keyPrefix;
9744
- const keySeparator = _this3.options.keySeparator || ".";
9670
+ const keySeparator = this.options.keySeparator || ".";
9745
9671
  let resultKey;
9746
9672
  if (o2.keyPrefix && Array.isArray(key)) {
9747
9673
  resultKey = key.map((k2) => `${o2.keyPrefix}${keySeparator}${k2}`);
9748
9674
  } else {
9749
9675
  resultKey = o2.keyPrefix ? `${o2.keyPrefix}${keySeparator}${key}` : key;
9750
9676
  }
9751
- return _this3.t(resultKey, o2);
9677
+ return this.t(resultKey, o2);
9752
9678
  };
9753
9679
  if (isString(lng)) {
9754
9680
  fixedT.lng = lng;
@@ -9759,23 +9685,16 @@ var I18n = class _I18n extends EventEmitter {
9759
9685
  fixedT.keyPrefix = keyPrefix;
9760
9686
  return fixedT;
9761
9687
  }
9762
- t() {
9763
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
9764
- args[_key4] = arguments[_key4];
9765
- }
9688
+ t(...args) {
9766
9689
  return this.translator?.translate(...args);
9767
9690
  }
9768
- exists() {
9769
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
9770
- args[_key5] = arguments[_key5];
9771
- }
9691
+ exists(...args) {
9772
9692
  return this.translator?.exists(...args);
9773
9693
  }
9774
9694
  setDefaultNamespace(ns) {
9775
9695
  this.options.defaultNS = ns;
9776
9696
  }
9777
- hasLoadedNamespace(ns) {
9778
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9697
+ hasLoadedNamespace(ns, options2 = {}) {
9779
9698
  if (!this.isInitialized) {
9780
9699
  this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
9781
9700
  return false;
@@ -9840,14 +9759,10 @@ var I18n = class _I18n extends EventEmitter {
9840
9759
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
9841
9760
  return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9842
9761
  }
9843
- static createInstance() {
9844
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9845
- let callback = arguments.length > 1 ? arguments[1] : void 0;
9762
+ static createInstance(options2 = {}, callback) {
9846
9763
  return new _I18n(options2, callback);
9847
9764
  }
9848
- cloneInstance() {
9849
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9850
- let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
9765
+ cloneInstance(options2 = {}, callback = noop) {
9851
9766
  const forkResourceStore = options2.forkResourceStore;
9852
9767
  if (forkResourceStore) delete options2.forkResourceStore;
9853
9768
  const mergedOptions = {
@@ -9888,10 +9803,7 @@ var I18n = class _I18n extends EventEmitter {
9888
9803
  clone.services.resourceStore = clone.store;
9889
9804
  }
9890
9805
  clone.translator = new Translator(clone.services, mergedOptions);
9891
- clone.translator.on("*", function(event) {
9892
- for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
9893
- args[_key6 - 1] = arguments[_key6];
9894
- }
9806
+ clone.translator.on("*", (event, ...args) => {
9895
9807
  clone.emit(event, ...args);
9896
9808
  });
9897
9809
  clone.init(mergedOptions, callback);
@@ -15554,6 +15466,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15554
15466
  chargeType: json["charge_type"],
15555
15467
  companyCanTrial: json["company_can_trial"],
15556
15468
  companyCount: json["company_count"],
15469
+ controlledBy: json["controlled_by"],
15557
15470
  createdAt: new Date(json["created_at"]),
15558
15471
  current: json["current"],
15559
15472
  custom: json["custom"],
@@ -15639,6 +15552,7 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15639
15552
  billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON(json["billing_product"]),
15640
15553
  chargeType: json["charge_type"],
15641
15554
  companyCount: json["company_count"],
15555
+ controlledBy: json["controlled_by"],
15642
15556
  createdAt: new Date(json["created_at"]),
15643
15557
  description: json["description"],
15644
15558
  features: json["features"].map(
@@ -15785,31 +15699,45 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15785
15699
  };
15786
15700
  }
15787
15701
 
15788
- // src/api/checkoutexternal/models/DeletePaymentMethodResponse.ts
15789
- function DeletePaymentMethodResponseFromJSON(json) {
15790
- return DeletePaymentMethodResponseFromJSONTyped(json, false);
15702
+ // src/api/checkoutexternal/models/SetupIntentResponseData.ts
15703
+ function SetupIntentResponseDataFromJSON(json) {
15704
+ return SetupIntentResponseDataFromJSONTyped(json, false);
15791
15705
  }
15792
- function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
15706
+ function SetupIntentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15793
15707
  if (json == null) {
15794
15708
  return json;
15795
15709
  }
15796
15710
  return {
15797
- data: DeleteResponseFromJSON(json["data"]),
15711
+ publishableKey: json["publishable_key"],
15712
+ setupIntentClientSecret: json["setup_intent_client_secret"] == null ? void 0 : json["setup_intent_client_secret"]
15713
+ };
15714
+ }
15715
+
15716
+ // src/api/checkoutexternal/models/CreateSetupIntentResponse.ts
15717
+ function CreateSetupIntentResponseFromJSON(json) {
15718
+ return CreateSetupIntentResponseFromJSONTyped(json, false);
15719
+ }
15720
+ function CreateSetupIntentResponseFromJSONTyped(json, ignoreDiscriminator) {
15721
+ if (json == null) {
15722
+ return json;
15723
+ }
15724
+ return {
15725
+ data: SetupIntentResponseDataFromJSON(json["data"]),
15798
15726
  params: json["params"]
15799
15727
  };
15800
15728
  }
15801
15729
 
15802
- // src/api/checkoutexternal/models/SetupIntentResponseData.ts
15803
- function SetupIntentResponseDataFromJSON(json) {
15804
- return SetupIntentResponseDataFromJSONTyped(json, false);
15730
+ // src/api/checkoutexternal/models/DeletePaymentMethodResponse.ts
15731
+ function DeletePaymentMethodResponseFromJSON(json) {
15732
+ return DeletePaymentMethodResponseFromJSONTyped(json, false);
15805
15733
  }
15806
- function SetupIntentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15734
+ function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
15807
15735
  if (json == null) {
15808
15736
  return json;
15809
15737
  }
15810
15738
  return {
15811
- publishableKey: json["publishable_key"],
15812
- setupIntentClientSecret: json["setup_intent_client_secret"] == null ? void 0 : json["setup_intent_client_secret"]
15739
+ data: DeleteResponseFromJSON(json["data"]),
15740
+ params: json["params"]
15813
15741
  };
15814
15742
  }
15815
15743
 
@@ -16059,6 +15987,38 @@ var CheckoutexternalApi = class extends BaseAPI {
16059
15987
  const response = await this.checkoutUnsubscribeRaw(initOverrides);
16060
15988
  return await response.value();
16061
15989
  }
15990
+ /**
15991
+ * Create setup intent
15992
+ */
15993
+ async createSetupIntentRaw(initOverrides) {
15994
+ const queryParameters = {};
15995
+ const headerParameters = {};
15996
+ if (this.configuration && this.configuration.apiKey) {
15997
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
15998
+ "X-Schematic-Api-Key"
15999
+ );
16000
+ }
16001
+ const response = await this.request(
16002
+ {
16003
+ path: `/components/setup-intent`,
16004
+ method: "POST",
16005
+ headers: headerParameters,
16006
+ query: queryParameters
16007
+ },
16008
+ initOverrides
16009
+ );
16010
+ return new JSONApiResponse(
16011
+ response,
16012
+ (jsonValue) => CreateSetupIntentResponseFromJSON(jsonValue)
16013
+ );
16014
+ }
16015
+ /**
16016
+ * Create setup intent
16017
+ */
16018
+ async createSetupIntent(initOverrides) {
16019
+ const response = await this.createSetupIntentRaw(initOverrides);
16020
+ return await response.value();
16021
+ }
16062
16022
  /**
16063
16023
  * Delete payment method
16064
16024
  */
@@ -16422,8 +16382,10 @@ var en_default = {
16422
16382
  "Manage plan": "Manage plan",
16423
16383
  Monthly: "Monthly",
16424
16384
  Next: "Next",
16385
+ "No invoices created yet": "No invoices created yet",
16425
16386
  "No limit": "No limit",
16426
16387
  "No payment method added yet": "No payment method added yet",
16388
+ "No upcoming invoice": "No upcoming invoice",
16427
16389
  "Not ready to cancel?": "Not ready to cancel?",
16428
16390
  "On demand": "On demand",
16429
16391
  "One time ": "One time",
@@ -17158,7 +17120,7 @@ var EmbedProvider = ({
17158
17120
  (0, import_react11.useEffect)(() => {
17159
17121
  if (accessToken) {
17160
17122
  const { headers = {} } = apiConfig ?? {};
17161
- headers["X-Schematic-Components-Version"] = "0.7.14";
17123
+ headers["X-Schematic-Components-Version"] = "0.7.15";
17162
17124
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
17163
17125
  const config = new Configuration({
17164
17126
  ...apiConfig,
@@ -17285,7 +17247,7 @@ var Box = dt.div((props) => {
17285
17247
  function reducer(acc, [key, value]) {
17286
17248
  if (key.startsWith("$") && !["$viewport"].includes(key)) {
17287
17249
  acc.push(
17288
- // keys will always be CSS properties
17250
+ // keys should always be CSS properties
17289
17251
  attr(camelToHyphen(key.slice(1)), value)
17290
17252
  );
17291
17253
  }
@@ -17295,11 +17257,11 @@ var Box = dt.div((props) => {
17295
17257
  for (const [key, value] of Object.entries(props.$viewport || {})) {
17296
17258
  styles.push(lt`
17297
17259
  ${{
17298
- sm: "@media (min-width: 640px)",
17299
- md: "@media (min-width: 768px)",
17300
- lg: "@media (min-width: 1024px)",
17301
- xl: "@media (min-width: 1280px)",
17302
- "2xl": "@media (min-width: 1536px)"
17260
+ sm: "@container (min-width: 640px)",
17261
+ md: "@container (min-width: 768px)",
17262
+ lg: "@container (min-width: 1024px)",
17263
+ xl: "@container (min-width: 1280px)",
17264
+ "2xl": "@container (min-width: 1536px)"
17303
17265
  }[key] || key} {
17304
17266
  ${Object.entries(value || {}).reduce(reducer, [])}
17305
17267
  }
@@ -18482,6 +18444,7 @@ var Container2 = dt.div`
18482
18444
  line-height: 1.35;
18483
18445
  width: 100%;
18484
18446
  height: 100%;
18447
+ container-type: inline-size;
18485
18448
 
18486
18449
  *,
18487
18450
  *::before,
@@ -22084,17 +22047,16 @@ var StyledViewport = dt.div.withConfig({
22084
22047
  shouldForwardProp: (prop) => !["$numberOfColumns", "numberOfColumns"].includes(prop)
22085
22048
  })`
22086
22049
  display: grid;
22087
- grid-template-columns: repeat(1, minmax(300px, 1fr));
22088
22050
  margin-left: auto;
22089
22051
  margin-right: auto;
22090
22052
  gap: 1rem;
22091
22053
 
22092
- @media (min-width: 768px) {
22093
- grid-template-columns: ${({ theme }) => lt`repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`};
22054
+ @container (max-width: 767px) {
22055
+ grid-template-columns: repeat(1, minmax(300px, 1fr));
22094
22056
  }
22095
22057
 
22096
- @container (max-width: 768px) {
22097
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
22058
+ @container (min-width: 768px) {
22059
+ grid-template-columns: ${({ theme }) => lt`repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`};
22098
22060
  }
22099
22061
  `;
22100
22062
 
@@ -22705,9 +22667,6 @@ var Invoices = (0, import_react34.forwardRef)(({ className, data, ...rest }, ref
22705
22667
  (0, import_react34.useEffect)(() => {
22706
22668
  setInvoices(formatInvoices(data));
22707
22669
  }, [data]);
22708
- if (invoices.length === 0) {
22709
- return null;
22710
- }
22711
22670
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
22712
22671
  props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22713
22672
  Text,
@@ -22719,48 +22678,50 @@ var Invoices = (0, import_react34.forwardRef)(({ className, data, ...rest }, ref
22719
22678
  children: t2("Invoices")
22720
22679
  }
22721
22680
  ) }),
22722
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
22723
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $justifyContent: "space-between", children: [
22724
- props.date.isVisible && date && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22725
- InvoiceDate,
22681
+ invoices.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
22682
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
22683
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $justifyContent: "space-between", children: [
22684
+ props.date.isVisible && date && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22685
+ InvoiceDate,
22686
+ {
22687
+ date,
22688
+ fontStyle: props.date.fontStyle,
22689
+ url
22690
+ }
22691
+ ),
22692
+ props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22693
+ Text,
22694
+ {
22695
+ $font: theme.typography[props.amount.fontStyle].fontFamily,
22696
+ $size: theme.typography[props.amount.fontStyle].fontSize,
22697
+ $weight: theme.typography[props.amount.fontStyle].fontWeight,
22698
+ $color: theme.typography[props.amount.fontStyle].color,
22699
+ children: amount
22700
+ }
22701
+ )
22702
+ ] }, index);
22703
+ }) }),
22704
+ props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
22705
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22706
+ Icon2,
22726
22707
  {
22727
- date,
22728
- fontStyle: props.date.fontStyle,
22729
- url
22708
+ name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
22709
+ style: { color: "#D0D0D0" }
22730
22710
  }
22731
22711
  ),
22732
- props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22712
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22733
22713
  Text,
22734
22714
  {
22735
- $font: theme.typography[props.amount.fontStyle].fontFamily,
22736
- $size: theme.typography[props.amount.fontStyle].fontSize,
22737
- $weight: theme.typography[props.amount.fontStyle].fontWeight,
22738
- $color: theme.typography[props.amount.fontStyle].color,
22739
- children: amount
22715
+ onClick: toggleListSize,
22716
+ $font: theme.typography[props.collapse.fontStyle].fontFamily,
22717
+ $size: theme.typography[props.collapse.fontStyle].fontSize,
22718
+ $weight: theme.typography[props.collapse.fontStyle].fontWeight,
22719
+ $color: theme.typography[props.collapse.fontStyle].color,
22720
+ children: listSize === props.limit.number ? t2("See more") : t2("See less")
22740
22721
  }
22741
22722
  )
22742
- ] }, index);
22743
- }) }),
22744
- props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
22745
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22746
- Icon2,
22747
- {
22748
- name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
22749
- style: { color: "#D0D0D0" }
22750
- }
22751
- ),
22752
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
22753
- Text,
22754
- {
22755
- onClick: toggleListSize,
22756
- $font: theme.typography[props.collapse.fontStyle].fontFamily,
22757
- $size: theme.typography[props.collapse.fontStyle].fontSize,
22758
- $weight: theme.typography[props.collapse.fontStyle].fontWeight,
22759
- $color: theme.typography[props.collapse.fontStyle].color,
22760
- children: listSize === props.limit.number ? t2("See more") : t2("See less")
22761
- }
22762
- )
22763
- ] })
22723
+ ] })
22724
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { display: "heading2", children: t2("No invoices created yet") })
22764
22725
  ] }) });
22765
22726
  });
22766
22727
  Invoices.displayName = "Invoices";
@@ -22774,11 +22735,10 @@ var Container3 = dt.div`
22774
22735
  flex-direction: column;
22775
22736
 
22776
22737
  &:last-child {
22777
- overflow: hidden;
22778
-
22779
22738
  ${({ theme }) => {
22780
22739
  const borderRadius = `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`;
22781
22740
  return theme.sectionLayout === "merged" && lt`
22741
+ overflow: hidden;
22782
22742
  border-bottom-left-radius: ${borderRadius};
22783
22743
  border-bottom-right-radius: ${borderRadius};
22784
22744
  `;
@@ -25114,7 +25074,7 @@ var UpcomingBill = (0, import_react43.forwardRef)(({ className, ...rest }, ref)
25114
25074
  const theme = nt();
25115
25075
  const { data } = useEmbed();
25116
25076
  const isLightBackground = useIsLightBackground();
25117
- const { upcomingInvoice, discounts } = (0, import_react43.useMemo)(() => {
25077
+ const { discounts, upcomingInvoice } = (0, import_react43.useMemo)(() => {
25118
25078
  const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
25119
25079
  amountOff: discount.amountOff,
25120
25080
  couponId: discount.couponId,
@@ -25124,24 +25084,10 @@ var UpcomingBill = (0, import_react43.forwardRef)(({ className, ...rest }, ref)
25124
25084
  }));
25125
25085
  return {
25126
25086
  discounts: discounts2,
25127
- upcomingInvoice: {
25128
- ...typeof data.upcomingInvoice?.amountDue === "number" && {
25129
- amountDue: data.upcomingInvoice.amountDue
25130
- },
25131
- ...data.subscription?.interval && {
25132
- interval: data.subscription.interval
25133
- },
25134
- ...data.upcomingInvoice?.dueDate && {
25135
- dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
25136
- },
25137
- currency: data.upcomingInvoice?.currency
25138
- }
25087
+ upcomingInvoice: data.upcomingInvoice
25139
25088
  };
25140
25089
  }, [data.subscription, data.upcomingInvoice]);
25141
- if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
25142
- return null;
25143
- }
25144
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
25090
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25145
25091
  Element,
25146
25092
  {
25147
25093
  as: Flex,
@@ -25149,8 +25095,8 @@ var UpcomingBill = (0, import_react43.forwardRef)(({ className, ...rest }, ref)
25149
25095
  className,
25150
25096
  $flexDirection: "column",
25151
25097
  $gap: "1rem",
25152
- children: [
25153
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
25098
+ children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
25099
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
25154
25100
  Text,
25155
25101
  {
25156
25102
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -25160,7 +25106,7 @@ var UpcomingBill = (0, import_react43.forwardRef)(({ className, ...rest }, ref)
25160
25106
  children: [
25161
25107
  props.header.prefix,
25162
25108
  " ",
25163
- upcomingInvoice.dueDate
25109
+ toPrettyDate(upcomingInvoice.dueDate)
25164
25110
  ]
25165
25111
  }
25166
25112
  ) }),
@@ -25202,41 +25148,49 @@ var UpcomingBill = (0, import_react43.forwardRef)(({ className, ...rest }, ref)
25202
25148
  children: t2("Discount")
25203
25149
  }
25204
25150
  ) }),
25205
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: discounts.map((discount) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
25206
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25207
- Flex,
25208
- {
25209
- $alignItems: "center",
25210
- $padding: "0.1875rem 0.375rem",
25211
- $borderWidth: "1px",
25212
- $borderStyle: "solid",
25213
- $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
25214
- $borderRadius: "0.3125rem",
25215
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25151
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: discounts.map((discount) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
25152
+ Flex,
25153
+ {
25154
+ $alignItems: "center",
25155
+ $gap: "0.5rem",
25156
+ children: [
25157
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25158
+ Flex,
25159
+ {
25160
+ $alignItems: "center",
25161
+ $padding: "0.1875rem 0.375rem",
25162
+ $borderWidth: "1px",
25163
+ $borderStyle: "solid",
25164
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
25165
+ $borderRadius: "0.3125rem",
25166
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25167
+ Text,
25168
+ {
25169
+ $font: theme.typography.text.fontFamily,
25170
+ $size: 0.75 * theme.typography.text.fontSize,
25171
+ $weight: theme.typography.text.fontWeight,
25172
+ $color: theme.typography.text.color,
25173
+ children: discount.customerFacingCode
25174
+ }
25175
+ )
25176
+ }
25177
+ ),
25178
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25216
25179
  Text,
25217
25180
  {
25218
25181
  $font: theme.typography.text.fontFamily,
25219
- $size: 0.75 * theme.typography.text.fontSize,
25182
+ $size: theme.typography.text.fontSize,
25220
25183
  $weight: theme.typography.text.fontWeight,
25221
25184
  $color: theme.typography.text.color,
25222
- children: discount.customerFacingCode
25185
+ children: t2("Percent off", { percent: discount.percentOff })
25223
25186
  }
25224
- )
25225
- }
25226
- ),
25227
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
25228
- Text,
25229
- {
25230
- $font: theme.typography.text.fontFamily,
25231
- $size: theme.typography.text.fontSize,
25232
- $weight: theme.typography.text.fontWeight,
25233
- $color: theme.typography.text.color,
25234
- children: t2("Percent off", { percent: discount.percentOff })
25235
- }
25236
- ) })
25237
- ] }, discount.couponId)) })
25187
+ ) })
25188
+ ]
25189
+ },
25190
+ discount.couponId
25191
+ )) })
25238
25192
  ] })
25239
- ]
25193
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: "heading2", children: t2("No upcoming invoice") })
25240
25194
  }
25241
25195
  );
25242
25196
  });