@schematichq/schematic-components 0.7.13 → 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.
@@ -6692,9 +6692,9 @@ var unitlessKeys = {
6692
6692
  var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
6693
6693
  var m = "active";
6694
6694
  var y = "data-styled-version";
6695
- var v = "6.1.17";
6695
+ var v = "6.1.18";
6696
6696
  var g = "/*!sc*/\n";
6697
- var S = "undefined" != typeof window && "HTMLElement" in window;
6697
+ var S = "undefined" != typeof window && "undefined" != typeof document;
6698
6698
  var w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : true);
6699
6699
  var b = {};
6700
6700
  var E = /invalid hook call/i;
@@ -7801,8 +7801,7 @@ var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
7801
7801
  }
7802
7802
  return matched;
7803
7803
  };
7804
- var deepFind = function(obj, path) {
7805
- let keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
7804
+ var deepFind = (obj, path, keySeparator = ".") => {
7806
7805
  if (!obj) return void 0;
7807
7806
  if (obj[path]) {
7808
7807
  if (!Object.prototype.hasOwnProperty.call(obj, path)) return void 0;
@@ -7851,39 +7850,25 @@ var consoleLogger = {
7851
7850
  }
7852
7851
  };
7853
7852
  var Logger = class _Logger {
7854
- constructor(concreteLogger) {
7855
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
7853
+ constructor(concreteLogger, options2 = {}) {
7856
7854
  this.init(concreteLogger, options2);
7857
7855
  }
7858
- init(concreteLogger) {
7859
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
7856
+ init(concreteLogger, options2 = {}) {
7860
7857
  this.prefix = options2.prefix || "i18next:";
7861
7858
  this.logger = concreteLogger || consoleLogger;
7862
7859
  this.options = options2;
7863
7860
  this.debug = options2.debug;
7864
7861
  }
7865
- log() {
7866
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
7867
- args[_key] = arguments[_key];
7868
- }
7862
+ log(...args) {
7869
7863
  return this.forward(args, "log", "", true);
7870
7864
  }
7871
- warn() {
7872
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
7873
- args[_key2] = arguments[_key2];
7874
- }
7865
+ warn(...args) {
7875
7866
  return this.forward(args, "warn", "", true);
7876
7867
  }
7877
- error() {
7878
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
7879
- args[_key3] = arguments[_key3];
7880
- }
7868
+ error(...args) {
7881
7869
  return this.forward(args, "error", "");
7882
7870
  }
7883
- deprecate() {
7884
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
7885
- args[_key4] = arguments[_key4];
7886
- }
7871
+ deprecate(...args) {
7887
7872
  return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
7888
7873
  }
7889
7874
  forward(args, lvl, prefix2, debugOnly) {
@@ -7926,14 +7911,10 @@ var EventEmitter = class {
7926
7911
  }
7927
7912
  this.observers[event].delete(listener);
7928
7913
  }
7929
- emit(event) {
7930
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
7931
- args[_key - 1] = arguments[_key];
7932
- }
7914
+ emit(event, ...args) {
7933
7915
  if (this.observers[event]) {
7934
7916
  const cloned = Array.from(this.observers[event].entries());
7935
- cloned.forEach((_ref) => {
7936
- let [observer, numTimesAdded] = _ref;
7917
+ cloned.forEach(([observer, numTimesAdded]) => {
7937
7918
  for (let i2 = 0; i2 < numTimesAdded; i2++) {
7938
7919
  observer(...args);
7939
7920
  }
@@ -7941,8 +7922,7 @@ var EventEmitter = class {
7941
7922
  }
7942
7923
  if (this.observers["*"]) {
7943
7924
  const cloned = Array.from(this.observers["*"].entries());
7944
- cloned.forEach((_ref2) => {
7945
- let [observer, numTimesAdded] = _ref2;
7925
+ cloned.forEach(([observer, numTimesAdded]) => {
7946
7926
  for (let i2 = 0; i2 < numTimesAdded; i2++) {
7947
7927
  observer.apply(observer, [event, ...args]);
7948
7928
  }
@@ -7951,11 +7931,10 @@ var EventEmitter = class {
7951
7931
  }
7952
7932
  };
7953
7933
  var ResourceStore = class extends EventEmitter {
7954
- constructor(data) {
7955
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
7956
- ns: ["translation"],
7957
- defaultNS: "translation"
7958
- };
7934
+ constructor(data, options2 = {
7935
+ ns: ["translation"],
7936
+ defaultNS: "translation"
7937
+ }) {
7959
7938
  super();
7960
7939
  this.data = data || {};
7961
7940
  this.options = options2;
@@ -7977,8 +7956,7 @@ var ResourceStore = class extends EventEmitter {
7977
7956
  this.options.ns.splice(index, 1);
7978
7957
  }
7979
7958
  }
7980
- getResource(lng, ns, key) {
7981
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
7959
+ getResource(lng, ns, key, options2 = {}) {
7982
7960
  const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
7983
7961
  const ignoreJSONStructure = options2.ignoreJSONStructure !== void 0 ? options2.ignoreJSONStructure : this.options.ignoreJSONStructure;
7984
7962
  let path;
@@ -8005,10 +7983,9 @@ var ResourceStore = class extends EventEmitter {
8005
7983
  if (result || !ignoreJSONStructure || !isString(key)) return result;
8006
7984
  return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
8007
7985
  }
8008
- addResource(lng, ns, key, value) {
8009
- let options2 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
8010
- silent: false
8011
- };
7986
+ addResource(lng, ns, key, value, options2 = {
7987
+ silent: false
7988
+ }) {
8012
7989
  const keySeparator = options2.keySeparator !== void 0 ? options2.keySeparator : this.options.keySeparator;
8013
7990
  let path = [lng, ns];
8014
7991
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
@@ -8021,10 +7998,9 @@ var ResourceStore = class extends EventEmitter {
8021
7998
  setPath(this.data, path, value);
8022
7999
  if (!options2.silent) this.emit("added", lng, ns, key, value);
8023
8000
  }
8024
- addResources(lng, ns, resources) {
8025
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
8026
- silent: false
8027
- };
8001
+ addResources(lng, ns, resources, options2 = {
8002
+ silent: false
8003
+ }) {
8028
8004
  for (const m2 in resources) {
8029
8005
  if (isString(resources[m2]) || Array.isArray(resources[m2])) this.addResource(lng, ns, m2, resources[m2], {
8030
8006
  silent: true
@@ -8032,11 +8008,10 @@ var ResourceStore = class extends EventEmitter {
8032
8008
  }
8033
8009
  if (!options2.silent) this.emit("added", lng, ns, resources);
8034
8010
  }
8035
- addResourceBundle(lng, ns, resources, deep, overwrite) {
8036
- let options2 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
8037
- silent: false,
8038
- skipCopy: false
8039
- };
8011
+ addResourceBundle(lng, ns, resources, deep, overwrite, options2 = {
8012
+ silent: false,
8013
+ skipCopy: false
8014
+ }) {
8040
8015
  let path = [lng, ns];
8041
8016
  if (lng.indexOf(".") > -1) {
8042
8017
  path = lng.split(".");
@@ -8099,8 +8074,7 @@ var postProcessor = {
8099
8074
  var checkedLoadedFor = {};
8100
8075
  var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
8101
8076
  var Translator = class _Translator extends EventEmitter {
8102
- constructor(services) {
8103
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8077
+ constructor(services, options2 = {}) {
8104
8078
  super();
8105
8079
  copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
8106
8080
  this.options = options2;
@@ -8112,14 +8086,14 @@ var Translator = class _Translator extends EventEmitter {
8112
8086
  changeLanguage(lng) {
8113
8087
  if (lng) this.language = lng;
8114
8088
  }
8115
- exists(key) {
8116
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
8117
- interpolation: {}
8089
+ exists(key, o2 = {
8090
+ interpolation: {}
8091
+ }) {
8092
+ const opt = {
8093
+ ...o2
8118
8094
  };
8119
- if (key == null) {
8120
- return false;
8121
- }
8122
- const resolved = this.resolve(key, options2);
8095
+ if (key == null) return false;
8096
+ const resolved = this.resolve(key, opt);
8123
8097
  return resolved?.res !== void 0;
8124
8098
  }
8125
8099
  extractFromKey(key, opt) {
@@ -8146,7 +8120,10 @@ var Translator = class _Translator extends EventEmitter {
8146
8120
  namespaces: isString(namespaces) ? [namespaces] : namespaces
8147
8121
  };
8148
8122
  }
8149
- translate(keys, opt, lastKey) {
8123
+ translate(keys, o2, lastKey) {
8124
+ let opt = typeof o2 === "object" ? {
8125
+ ...o2
8126
+ } : o2;
8150
8127
  if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
8151
8128
  opt = this.options.overloadTranslationOptionHandler(arguments);
8152
8129
  }
@@ -8163,11 +8140,12 @@ var Translator = class _Translator extends EventEmitter {
8163
8140
  namespaces
8164
8141
  } = this.extractFromKey(keys[keys.length - 1], opt);
8165
8142
  const namespace = namespaces[namespaces.length - 1];
8143
+ let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
8144
+ if (nsSeparator === void 0) nsSeparator = ":";
8166
8145
  const lng = opt.lng || this.language;
8167
8146
  const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
8168
8147
  if (lng?.toLowerCase() === "cimode") {
8169
8148
  if (appendNamespaceToCIMode) {
8170
- const nsSeparator = opt.nsSeparator || this.options.nsSeparator;
8171
8149
  if (returnDetails) {
8172
8150
  return {
8173
8151
  res: `${namespace}${nsSeparator}${key}`,
@@ -8322,9 +8300,11 @@ var Translator = class _Translator extends EventEmitter {
8322
8300
  }
8323
8301
  }
8324
8302
  res = this.extendTranslation(res, keys, opt, resolved, lastKey);
8325
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}:${key}`;
8303
+ if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
8304
+ res = `${namespace}${nsSeparator}${key}`;
8305
+ }
8326
8306
  if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
8327
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : void 0);
8307
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : void 0, opt);
8328
8308
  }
8329
8309
  }
8330
8310
  if (returnDetails) {
@@ -8335,7 +8315,6 @@ var Translator = class _Translator extends EventEmitter {
8335
8315
  return res;
8336
8316
  }
8337
8317
  extendTranslation(res, key, opt, resolved, lastKey) {
8338
- var _this = this;
8339
8318
  if (this.i18nFormat?.parse) {
8340
8319
  res = this.i18nFormat.parse(res, {
8341
8320
  ...this.options.interpolation.defaultVariables,
@@ -8371,15 +8350,12 @@ var Translator = class _Translator extends EventEmitter {
8371
8350
  if (nestBef < nestAft) opt.nest = false;
8372
8351
  }
8373
8352
  if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
8374
- if (opt.nest !== false) res = this.interpolator.nest(res, function() {
8375
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8376
- args[_key] = arguments[_key];
8377
- }
8353
+ if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
8378
8354
  if (lastKey?.[0] === args[0] && !opt.context) {
8379
- _this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
8355
+ this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
8380
8356
  return null;
8381
8357
  }
8382
- return _this.translate(...args, key);
8358
+ return this.translate(...args, key);
8383
8359
  }, opt);
8384
8360
  if (opt.interpolation) this.interpolator.reset();
8385
8361
  }
@@ -8396,8 +8372,7 @@ var Translator = class _Translator extends EventEmitter {
8396
8372
  }
8397
8373
  return res;
8398
8374
  }
8399
- resolve(keys) {
8400
- let opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8375
+ resolve(keys, opt = {}) {
8401
8376
  let found;
8402
8377
  let usedKey;
8403
8378
  let exactUsedKey;
@@ -8477,13 +8452,11 @@ var Translator = class _Translator extends EventEmitter {
8477
8452
  isValidLookup(res) {
8478
8453
  return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
8479
8454
  }
8480
- getResource(code, ns, key) {
8481
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
8455
+ getResource(code, ns, key, options2 = {}) {
8482
8456
  if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options2);
8483
8457
  return this.resourceStore.getResource(code, ns, key, options2);
8484
8458
  }
8485
- getUsedParamsDetails() {
8486
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8459
+ getUsedParamsDetails(options2 = {}) {
8487
8460
  const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
8488
8461
  const useOptionsReplaceForData = options2.replace && !isString(options2.replace);
8489
8462
  let data = useOptionsReplaceForData ? options2.replace : options2;
@@ -8639,8 +8612,7 @@ var dummyRule = {
8639
8612
  })
8640
8613
  };
8641
8614
  var PluralResolver = class {
8642
- constructor(languageUtils) {
8643
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8615
+ constructor(languageUtils, options2 = {}) {
8644
8616
  this.languageUtils = languageUtils;
8645
8617
  this.options = options2;
8646
8618
  this.logger = baseLogger.create("pluralResolver");
@@ -8652,8 +8624,7 @@ var PluralResolver = class {
8652
8624
  clearCache() {
8653
8625
  this.pluralRulesCache = {};
8654
8626
  }
8655
- getRule(code) {
8656
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8627
+ getRule(code, options2 = {}) {
8657
8628
  const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
8658
8629
  const type = options2.ordinal ? "ordinal" : "cardinal";
8659
8630
  const cacheKey = JSON.stringify({
@@ -8680,25 +8651,21 @@ var PluralResolver = class {
8680
8651
  this.pluralRulesCache[cacheKey] = rule;
8681
8652
  return rule;
8682
8653
  }
8683
- needsPlural(code) {
8684
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8654
+ needsPlural(code, options2 = {}) {
8685
8655
  let rule = this.getRule(code, options2);
8686
8656
  if (!rule) rule = this.getRule("dev", options2);
8687
8657
  return rule?.resolvedOptions().pluralCategories.length > 1;
8688
8658
  }
8689
- getPluralFormsOfKey(code, key) {
8690
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
8659
+ getPluralFormsOfKey(code, key, options2 = {}) {
8691
8660
  return this.getSuffixes(code, options2).map((suffix) => `${key}${suffix}`);
8692
8661
  }
8693
- getSuffixes(code) {
8694
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8662
+ getSuffixes(code, options2 = {}) {
8695
8663
  let rule = this.getRule(code, options2);
8696
8664
  if (!rule) rule = this.getRule("dev", options2);
8697
8665
  if (!rule) return [];
8698
8666
  return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
8699
8667
  }
8700
- getSuffix(code, count) {
8701
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
8668
+ getSuffix(code, count, options2 = {}) {
8702
8669
  const rule = this.getRule(code, options2);
8703
8670
  if (rule) {
8704
8671
  return `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
@@ -8707,9 +8674,7 @@ var PluralResolver = class {
8707
8674
  return this.getSuffix("dev", count, options2);
8708
8675
  }
8709
8676
  };
8710
- var deepFindWithDefaults = function(data, defaultData, key) {
8711
- let keySeparator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".";
8712
- let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
8677
+ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
8713
8678
  let path = getPathWithDefaults(data, defaultData, key);
8714
8679
  if (!path && ignoreJSONStructure && isString(key)) {
8715
8680
  path = deepFind(data, key, keySeparator);
@@ -8719,15 +8684,13 @@ var deepFindWithDefaults = function(data, defaultData, key) {
8719
8684
  };
8720
8685
  var regexSafe = (val) => val.replace(/\$/g, "$$$$");
8721
8686
  var Interpolator = class {
8722
- constructor() {
8723
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8687
+ constructor(options2 = {}) {
8724
8688
  this.logger = baseLogger.create("interpolator");
8725
8689
  this.options = options2;
8726
8690
  this.format = options2?.interpolation?.format || ((value) => value);
8727
8691
  this.init(options2);
8728
8692
  }
8729
- init() {
8730
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8693
+ init(options2 = {}) {
8731
8694
  if (!options2.interpolation) options2.interpolation = {
8732
8695
  escapeValue: true
8733
8696
  };
@@ -8850,8 +8813,7 @@ var Interpolator = class {
8850
8813
  });
8851
8814
  return str;
8852
8815
  }
8853
- nest(str, fc) {
8854
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
8816
+ nest(str, fc, options2 = {}) {
8855
8817
  let match2;
8856
8818
  let value;
8857
8819
  let clonedOptions;
@@ -8947,68 +8909,68 @@ var parseFormatStr = (formatStr) => {
8947
8909
  };
8948
8910
  var createCachedFormatter = (fn) => {
8949
8911
  const cache = {};
8950
- return (val, lng, options2) => {
8951
- let optForCache = options2;
8952
- if (options2 && options2.interpolationkey && options2.formatParams && options2.formatParams[options2.interpolationkey] && options2[options2.interpolationkey]) {
8912
+ return (v2, l2, o2) => {
8913
+ let optForCache = o2;
8914
+ if (o2 && o2.interpolationkey && o2.formatParams && o2.formatParams[o2.interpolationkey] && o2[o2.interpolationkey]) {
8953
8915
  optForCache = {
8954
8916
  ...optForCache,
8955
- [options2.interpolationkey]: void 0
8917
+ [o2.interpolationkey]: void 0
8956
8918
  };
8957
8919
  }
8958
- const key = lng + JSON.stringify(optForCache);
8959
- let formatter = cache[key];
8960
- if (!formatter) {
8961
- formatter = fn(getCleanedCode(lng), options2);
8962
- cache[key] = formatter;
8920
+ const key = l2 + JSON.stringify(optForCache);
8921
+ let frm = cache[key];
8922
+ if (!frm) {
8923
+ frm = fn(getCleanedCode(l2), o2);
8924
+ cache[key] = frm;
8963
8925
  }
8964
- return formatter(val);
8926
+ return frm(v2);
8965
8927
  };
8966
8928
  };
8929
+ var createNonCachedFormatter = (fn) => (v2, l2, o2) => fn(getCleanedCode(l2), o2)(v2);
8967
8930
  var Formatter = class {
8968
- constructor() {
8969
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8931
+ constructor(options2 = {}) {
8970
8932
  this.logger = baseLogger.create("formatter");
8971
8933
  this.options = options2;
8934
+ this.init(options2);
8935
+ }
8936
+ init(services, options2 = {
8937
+ interpolation: {}
8938
+ }) {
8939
+ this.formatSeparator = options2.interpolation.formatSeparator || ",";
8940
+ const cf = options2.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
8972
8941
  this.formats = {
8973
- number: createCachedFormatter((lng, opt) => {
8942
+ number: cf((lng, opt) => {
8974
8943
  const formatter = new Intl.NumberFormat(lng, {
8975
8944
  ...opt
8976
8945
  });
8977
8946
  return (val) => formatter.format(val);
8978
8947
  }),
8979
- currency: createCachedFormatter((lng, opt) => {
8948
+ currency: cf((lng, opt) => {
8980
8949
  const formatter = new Intl.NumberFormat(lng, {
8981
8950
  ...opt,
8982
8951
  style: "currency"
8983
8952
  });
8984
8953
  return (val) => formatter.format(val);
8985
8954
  }),
8986
- datetime: createCachedFormatter((lng, opt) => {
8955
+ datetime: cf((lng, opt) => {
8987
8956
  const formatter = new Intl.DateTimeFormat(lng, {
8988
8957
  ...opt
8989
8958
  });
8990
8959
  return (val) => formatter.format(val);
8991
8960
  }),
8992
- relativetime: createCachedFormatter((lng, opt) => {
8961
+ relativetime: cf((lng, opt) => {
8993
8962
  const formatter = new Intl.RelativeTimeFormat(lng, {
8994
8963
  ...opt
8995
8964
  });
8996
8965
  return (val) => formatter.format(val, opt.range || "day");
8997
8966
  }),
8998
- list: createCachedFormatter((lng, opt) => {
8967
+ list: cf((lng, opt) => {
8999
8968
  const formatter = new Intl.ListFormat(lng, {
9000
8969
  ...opt
9001
8970
  });
9002
8971
  return (val) => formatter.format(val);
9003
8972
  })
9004
8973
  };
9005
- this.init(options2);
9006
- }
9007
- init(services) {
9008
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
9009
- interpolation: {}
9010
- };
9011
- this.formatSeparator = options2.interpolation.formatSeparator || ",";
9012
8974
  }
9013
8975
  add(name, fc) {
9014
8976
  this.formats[name.toLowerCase().trim()] = fc;
@@ -9016,8 +8978,7 @@ var Formatter = class {
9016
8978
  addCached(name, fc) {
9017
8979
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
9018
8980
  }
9019
- format(value, format, lng) {
9020
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
8981
+ format(value, format, lng, options2 = {}) {
9021
8982
  const formats = format.split(this.formatSeparator);
9022
8983
  if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
9023
8984
  const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
@@ -9057,8 +9018,7 @@ var removePending = (q2, name) => {
9057
9018
  }
9058
9019
  };
9059
9020
  var Connector = class extends EventEmitter {
9060
- constructor(backend, store, services) {
9061
- let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
9021
+ constructor(backend, store, services, options2 = {}) {
9062
9022
  super();
9063
9023
  this.backend = backend;
9064
9024
  this.store = store;
@@ -9153,10 +9113,7 @@ var Connector = class extends EventEmitter {
9153
9113
  this.emit("loaded", loaded);
9154
9114
  this.queue = this.queue.filter((q2) => !q2.done);
9155
9115
  }
9156
- read(lng, ns, fcName) {
9157
- let tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
9158
- let wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout;
9159
- let callback = arguments.length > 5 ? arguments[5] : void 0;
9116
+ read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
9160
9117
  if (!lng.length) return callback(null, {});
9161
9118
  if (this.readingCalls >= this.maxParallelReads) {
9162
9119
  this.waitingReads.push({
@@ -9200,9 +9157,7 @@ var Connector = class extends EventEmitter {
9200
9157
  }
9201
9158
  return fc(lng, ns, resolver);
9202
9159
  }
9203
- prepareLoading(languages, namespaces) {
9204
- let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
9205
- let callback = arguments.length > 3 ? arguments[3] : void 0;
9160
+ prepareLoading(languages, namespaces, options2 = {}, callback) {
9206
9161
  if (!this.backend) {
9207
9162
  this.logger.warn("No backend was added via i18next.use. Will not load resources.");
9208
9163
  return callback && callback();
@@ -9226,8 +9181,7 @@ var Connector = class extends EventEmitter {
9226
9181
  reload: true
9227
9182
  }, callback);
9228
9183
  }
9229
- loadOne(name) {
9230
- let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
9184
+ loadOne(name, prefix2 = "") {
9231
9185
  const s2 = name.split("|");
9232
9186
  const lng = s2[0];
9233
9187
  const ns = s2[1];
@@ -9237,10 +9191,8 @@ var Connector = class extends EventEmitter {
9237
9191
  this.loaded(name, err2, data);
9238
9192
  });
9239
9193
  }
9240
- saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
9241
- let options2 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
9242
- let clb = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
9243
- };
9194
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options2 = {}, clb = () => {
9195
+ }) {
9244
9196
  if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
9245
9197
  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!!!");
9246
9198
  return;
@@ -9334,7 +9286,8 @@ var get = () => ({
9334
9286
  nestingOptionsSeparator: ",",
9335
9287
  maxReplaces: 1e3,
9336
9288
  skipOnVariables: true
9337
- }
9289
+ },
9290
+ cacheInBuiltFormats: true
9338
9291
  });
9339
9292
  var transformOptions = (options2) => {
9340
9293
  if (isString(options2.ns)) options2.ns = [options2.ns];
@@ -9357,9 +9310,7 @@ var bindMemberFunctions = (inst) => {
9357
9310
  });
9358
9311
  };
9359
9312
  var I18n = class _I18n extends EventEmitter {
9360
- constructor() {
9361
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9362
- let callback = arguments.length > 1 ? arguments[1] : void 0;
9313
+ constructor(options2 = {}, callback) {
9363
9314
  super();
9364
9315
  this.options = transformOptions(options2);
9365
9316
  this.services = {};
@@ -9378,10 +9329,7 @@ var I18n = class _I18n extends EventEmitter {
9378
9329
  }, 0);
9379
9330
  }
9380
9331
  }
9381
- init() {
9382
- var _this = this;
9383
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9384
- let callback = arguments.length > 1 ? arguments[1] : void 0;
9332
+ init(options2 = {}, callback) {
9385
9333
  this.isInitializing = true;
9386
9334
  if (typeof options2 === "function") {
9387
9335
  callback = options2;
@@ -9447,11 +9395,8 @@ var I18n = class _I18n extends EventEmitter {
9447
9395
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
9448
9396
  };
9449
9397
  s2.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s2.resourceStore, s2, this.options);
9450
- s2.backendConnector.on("*", function(event) {
9451
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9452
- args[_key - 1] = arguments[_key];
9453
- }
9454
- _this.emit(event, ...args);
9398
+ s2.backendConnector.on("*", (event, ...args) => {
9399
+ this.emit(event, ...args);
9455
9400
  });
9456
9401
  if (this.modules.languageDetector) {
9457
9402
  s2.languageDetector = createClassOnDemand(this.modules.languageDetector);
@@ -9462,11 +9407,8 @@ var I18n = class _I18n extends EventEmitter {
9462
9407
  if (s2.i18nFormat.init) s2.i18nFormat.init(this);
9463
9408
  }
9464
9409
  this.translator = new Translator(this.services, this.options);
9465
- this.translator.on("*", function(event) {
9466
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
9467
- args[_key2 - 1] = arguments[_key2];
9468
- }
9469
- _this.emit(event, ...args);
9410
+ this.translator.on("*", (event, ...args) => {
9411
+ this.emit(event, ...args);
9470
9412
  });
9471
9413
  this.modules.external.forEach((m2) => {
9472
9414
  if (m2.init) m2.init(this);
@@ -9483,15 +9425,13 @@ var I18n = class _I18n extends EventEmitter {
9483
9425
  }
9484
9426
  const storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
9485
9427
  storeApi.forEach((fcName) => {
9486
- this[fcName] = function() {
9487
- return _this.store[fcName](...arguments);
9488
- };
9428
+ this[fcName] = (...args) => this.store[fcName](...args);
9489
9429
  });
9490
9430
  const storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
9491
9431
  storeApiChained.forEach((fcName) => {
9492
- this[fcName] = function() {
9493
- _this.store[fcName](...arguments);
9494
- return _this;
9432
+ this[fcName] = (...args) => {
9433
+ this.store[fcName](...args);
9434
+ return this;
9495
9435
  };
9496
9436
  });
9497
9437
  const deferred = defer();
@@ -9515,8 +9455,7 @@ var I18n = class _I18n extends EventEmitter {
9515
9455
  }
9516
9456
  return deferred;
9517
9457
  }
9518
- loadResources(language) {
9519
- let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
9458
+ loadResources(language, callback = noop) {
9520
9459
  let usedCallback = callback;
9521
9460
  const usedLng = isString(language) ? language : this.language;
9522
9461
  if (typeof language === "function") usedCallback = language;
@@ -9605,11 +9544,10 @@ var I18n = class _I18n extends EventEmitter {
9605
9544
  }
9606
9545
  if (!this.resolvedLanguage && this.languages.indexOf(l2) < 0 && this.store.hasLanguageSomeTranslations(l2)) {
9607
9546
  this.resolvedLanguage = l2;
9608
- if (this.languages.indexOf(l2) < 0) this.languages.unshift(l2);
9547
+ this.languages.unshift(l2);
9609
9548
  }
9610
9549
  }
9611
9550
  changeLanguage(lng, callback) {
9612
- var _this2 = this;
9613
9551
  this.isLanguageChangingTo = lng;
9614
9552
  const deferred = defer();
9615
9553
  this.emit("languageChanging", lng);
@@ -9631,12 +9569,8 @@ var I18n = class _I18n extends EventEmitter {
9631
9569
  } else {
9632
9570
  this.isLanguageChangingTo = void 0;
9633
9571
  }
9634
- deferred.resolve(function() {
9635
- return _this2.t(...arguments);
9636
- });
9637
- if (callback) callback(err2, function() {
9638
- return _this2.t(...arguments);
9639
- });
9572
+ deferred.resolve((...args) => this.t(...args));
9573
+ if (callback) callback(err2, (...args) => this.t(...args));
9640
9574
  };
9641
9575
  const setLng = (lngs) => {
9642
9576
  if (!lng && !lngs && this.services.languageDetector) lngs = [];
@@ -9667,14 +9601,10 @@ var I18n = class _I18n extends EventEmitter {
9667
9601
  return deferred;
9668
9602
  }
9669
9603
  getFixedT(lng, ns, keyPrefix) {
9670
- var _this3 = this;
9671
- const fixedT = function(key, opts) {
9604
+ const fixedT = (key, opts, ...rest) => {
9672
9605
  let o2;
9673
9606
  if (typeof opts !== "object") {
9674
- for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
9675
- rest[_key3 - 2] = arguments[_key3];
9676
- }
9677
- o2 = _this3.options.overloadTranslationOptionHandler([key, opts].concat(rest));
9607
+ o2 = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
9678
9608
  } else {
9679
9609
  o2 = {
9680
9610
  ...opts
@@ -9684,14 +9614,14 @@ var I18n = class _I18n extends EventEmitter {
9684
9614
  o2.lngs = o2.lngs || fixedT.lngs;
9685
9615
  o2.ns = o2.ns || fixedT.ns;
9686
9616
  if (o2.keyPrefix !== "") o2.keyPrefix = o2.keyPrefix || keyPrefix || fixedT.keyPrefix;
9687
- const keySeparator = _this3.options.keySeparator || ".";
9617
+ const keySeparator = this.options.keySeparator || ".";
9688
9618
  let resultKey;
9689
9619
  if (o2.keyPrefix && Array.isArray(key)) {
9690
9620
  resultKey = key.map((k2) => `${o2.keyPrefix}${keySeparator}${k2}`);
9691
9621
  } else {
9692
9622
  resultKey = o2.keyPrefix ? `${o2.keyPrefix}${keySeparator}${key}` : key;
9693
9623
  }
9694
- return _this3.t(resultKey, o2);
9624
+ return this.t(resultKey, o2);
9695
9625
  };
9696
9626
  if (isString(lng)) {
9697
9627
  fixedT.lng = lng;
@@ -9702,23 +9632,16 @@ var I18n = class _I18n extends EventEmitter {
9702
9632
  fixedT.keyPrefix = keyPrefix;
9703
9633
  return fixedT;
9704
9634
  }
9705
- t() {
9706
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
9707
- args[_key4] = arguments[_key4];
9708
- }
9635
+ t(...args) {
9709
9636
  return this.translator?.translate(...args);
9710
9637
  }
9711
- exists() {
9712
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
9713
- args[_key5] = arguments[_key5];
9714
- }
9638
+ exists(...args) {
9715
9639
  return this.translator?.exists(...args);
9716
9640
  }
9717
9641
  setDefaultNamespace(ns) {
9718
9642
  this.options.defaultNS = ns;
9719
9643
  }
9720
- hasLoadedNamespace(ns) {
9721
- let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9644
+ hasLoadedNamespace(ns, options2 = {}) {
9722
9645
  if (!this.isInitialized) {
9723
9646
  this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
9724
9647
  return false;
@@ -9783,14 +9706,10 @@ var I18n = class _I18n extends EventEmitter {
9783
9706
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
9784
9707
  return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
9785
9708
  }
9786
- static createInstance() {
9787
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9788
- let callback = arguments.length > 1 ? arguments[1] : void 0;
9709
+ static createInstance(options2 = {}, callback) {
9789
9710
  return new _I18n(options2, callback);
9790
9711
  }
9791
- cloneInstance() {
9792
- let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9793
- let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
9712
+ cloneInstance(options2 = {}, callback = noop) {
9794
9713
  const forkResourceStore = options2.forkResourceStore;
9795
9714
  if (forkResourceStore) delete options2.forkResourceStore;
9796
9715
  const mergedOptions = {
@@ -9819,21 +9738,19 @@ var I18n = class _I18n extends EventEmitter {
9819
9738
  prev2[l2] = {
9820
9739
  ...this.store.data[l2]
9821
9740
  };
9822
- return Object.keys(prev2[l2]).reduce((acc, n) => {
9741
+ prev2[l2] = Object.keys(prev2[l2]).reduce((acc, n) => {
9823
9742
  acc[n] = {
9824
9743
  ...prev2[l2][n]
9825
9744
  };
9826
9745
  return acc;
9827
- }, {});
9746
+ }, prev2[l2]);
9747
+ return prev2;
9828
9748
  }, {});
9829
9749
  clone.store = new ResourceStore(clonedData, mergedOptions);
9830
9750
  clone.services.resourceStore = clone.store;
9831
9751
  }
9832
9752
  clone.translator = new Translator(clone.services, mergedOptions);
9833
- clone.translator.on("*", function(event) {
9834
- for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
9835
- args[_key6 - 1] = arguments[_key6];
9836
- }
9753
+ clone.translator.on("*", (event, ...args) => {
9837
9754
  clone.emit(event, ...args);
9838
9755
  });
9839
9756
  clone.init(mergedOptions, callback);
@@ -14681,6 +14598,8 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
14681
14598
  id: json["id"],
14682
14599
  interval: json["interval"],
14683
14600
  isActive: json["is_active"],
14601
+ meterEventName: json["meter_event_name"] == null ? void 0 : json["meter_event_name"],
14602
+ meterEventPayloadKey: json["meter_event_payload_key"] == null ? void 0 : json["meter_event_payload_key"],
14684
14603
  meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
14685
14604
  packageSize: json["package_size"],
14686
14605
  price: json["price"],
@@ -15221,12 +15140,12 @@ function EventSummaryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15221
15140
  return json;
15222
15141
  }
15223
15142
  return {
15224
- companyCount: json["company_count"],
15143
+ companyCount: json["company_count"] == null ? void 0 : json["company_count"],
15225
15144
  environmentId: json["environment_id"],
15226
15145
  eventCount: json["event_count"],
15227
15146
  eventSubtype: json["event_subtype"],
15228
15147
  lastSeenAt: json["last_seen_at"] == null ? void 0 : new Date(json["last_seen_at"]),
15229
- userCount: json["user_count"]
15148
+ userCount: json["user_count"] == null ? void 0 : json["user_count"]
15230
15149
  };
15231
15150
  }
15232
15151
 
@@ -15494,6 +15413,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15494
15413
  chargeType: json["charge_type"],
15495
15414
  companyCanTrial: json["company_can_trial"],
15496
15415
  companyCount: json["company_count"],
15416
+ controlledBy: json["controlled_by"],
15497
15417
  createdAt: new Date(json["created_at"]),
15498
15418
  current: json["current"],
15499
15419
  custom: json["custom"],
@@ -15579,6 +15499,7 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15579
15499
  billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON(json["billing_product"]),
15580
15500
  chargeType: json["charge_type"],
15581
15501
  companyCount: json["company_count"],
15502
+ controlledBy: json["controlled_by"],
15582
15503
  createdAt: new Date(json["created_at"]),
15583
15504
  description: json["description"],
15584
15505
  features: json["features"].map(
@@ -15725,31 +15646,45 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15725
15646
  };
15726
15647
  }
15727
15648
 
15728
- // src/api/checkoutexternal/models/DeletePaymentMethodResponse.ts
15729
- function DeletePaymentMethodResponseFromJSON(json) {
15730
- return DeletePaymentMethodResponseFromJSONTyped(json, false);
15649
+ // src/api/checkoutexternal/models/SetupIntentResponseData.ts
15650
+ function SetupIntentResponseDataFromJSON(json) {
15651
+ return SetupIntentResponseDataFromJSONTyped(json, false);
15731
15652
  }
15732
- function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
15653
+ function SetupIntentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15733
15654
  if (json == null) {
15734
15655
  return json;
15735
15656
  }
15736
15657
  return {
15737
- data: DeleteResponseFromJSON(json["data"]),
15658
+ publishableKey: json["publishable_key"],
15659
+ setupIntentClientSecret: json["setup_intent_client_secret"] == null ? void 0 : json["setup_intent_client_secret"]
15660
+ };
15661
+ }
15662
+
15663
+ // src/api/checkoutexternal/models/CreateSetupIntentResponse.ts
15664
+ function CreateSetupIntentResponseFromJSON(json) {
15665
+ return CreateSetupIntentResponseFromJSONTyped(json, false);
15666
+ }
15667
+ function CreateSetupIntentResponseFromJSONTyped(json, ignoreDiscriminator) {
15668
+ if (json == null) {
15669
+ return json;
15670
+ }
15671
+ return {
15672
+ data: SetupIntentResponseDataFromJSON(json["data"]),
15738
15673
  params: json["params"]
15739
15674
  };
15740
15675
  }
15741
15676
 
15742
- // src/api/checkoutexternal/models/SetupIntentResponseData.ts
15743
- function SetupIntentResponseDataFromJSON(json) {
15744
- return SetupIntentResponseDataFromJSONTyped(json, false);
15677
+ // src/api/checkoutexternal/models/DeletePaymentMethodResponse.ts
15678
+ function DeletePaymentMethodResponseFromJSON(json) {
15679
+ return DeletePaymentMethodResponseFromJSONTyped(json, false);
15745
15680
  }
15746
- function SetupIntentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15681
+ function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
15747
15682
  if (json == null) {
15748
15683
  return json;
15749
15684
  }
15750
15685
  return {
15751
- publishableKey: json["publishable_key"],
15752
- setupIntentClientSecret: json["setup_intent_client_secret"] == null ? void 0 : json["setup_intent_client_secret"]
15686
+ data: DeleteResponseFromJSON(json["data"]),
15687
+ params: json["params"]
15753
15688
  };
15754
15689
  }
15755
15690
 
@@ -15999,6 +15934,38 @@ var CheckoutexternalApi = class extends BaseAPI {
15999
15934
  const response = await this.checkoutUnsubscribeRaw(initOverrides);
16000
15935
  return await response.value();
16001
15936
  }
15937
+ /**
15938
+ * Create setup intent
15939
+ */
15940
+ async createSetupIntentRaw(initOverrides) {
15941
+ const queryParameters = {};
15942
+ const headerParameters = {};
15943
+ if (this.configuration && this.configuration.apiKey) {
15944
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
15945
+ "X-Schematic-Api-Key"
15946
+ );
15947
+ }
15948
+ const response = await this.request(
15949
+ {
15950
+ path: `/components/setup-intent`,
15951
+ method: "POST",
15952
+ headers: headerParameters,
15953
+ query: queryParameters
15954
+ },
15955
+ initOverrides
15956
+ );
15957
+ return new JSONApiResponse(
15958
+ response,
15959
+ (jsonValue) => CreateSetupIntentResponseFromJSON(jsonValue)
15960
+ );
15961
+ }
15962
+ /**
15963
+ * Create setup intent
15964
+ */
15965
+ async createSetupIntent(initOverrides) {
15966
+ const response = await this.createSetupIntentRaw(initOverrides);
15967
+ return await response.value();
15968
+ }
16002
15969
  /**
16003
15970
  * Delete payment method
16004
15971
  */
@@ -16362,8 +16329,10 @@ var en_default = {
16362
16329
  "Manage plan": "Manage plan",
16363
16330
  Monthly: "Monthly",
16364
16331
  Next: "Next",
16332
+ "No invoices created yet": "No invoices created yet",
16365
16333
  "No limit": "No limit",
16366
16334
  "No payment method added yet": "No payment method added yet",
16335
+ "No upcoming invoice": "No upcoming invoice",
16367
16336
  "Not ready to cancel?": "Not ready to cancel?",
16368
16337
  "On demand": "On demand",
16369
16338
  "One time ": "One time",
@@ -16373,6 +16342,7 @@ var en_default = {
16373
16342
  "Pay now": "Pay now",
16374
16343
  "Payment Method": "Payment Method",
16375
16344
  "Percent off": "{{percent}}% off",
16345
+ "Plan selected": "Plan selected",
16376
16346
  Plan: "Plan",
16377
16347
  Plans: "Plans",
16378
16348
  "Please provide an access token.": "Please provide an access token.",
@@ -16394,13 +16364,15 @@ var en_default = {
16394
16364
  "Session expired. Please refresh and try again.": "Session expired. Please refresh and try again.",
16395
16365
  "Show details": "Show details",
16396
16366
  "Start trial": "Start trial",
16367
+ "Start X day trial": "Start {{days}} day trial",
16397
16368
  "Subscribe and close": "Subscribe and close",
16398
16369
  "Subscription canceled": "Subscription canceled",
16399
16370
  Subscription: "Subscription",
16400
16371
  "Talk to support": "Talk to support",
16401
16372
  Total: "Total",
16402
16373
  "Trial ends in": "Trial ends in {{days}} days",
16403
- "Trial plan": "Try free for {{days}} days",
16374
+ "Trial in progress": "Trial in progress",
16375
+ "Trial selected": "Trial selected",
16404
16376
  Trial: "Trial",
16405
16377
  Unlimited: "Unlimited {{item}}",
16406
16378
  "Unsubscribe failed": "Unsubscribe failed",
@@ -17095,7 +17067,7 @@ var EmbedProvider = ({
17095
17067
  useEffect2(() => {
17096
17068
  if (accessToken) {
17097
17069
  const { headers = {} } = apiConfig ?? {};
17098
- headers["X-Schematic-Components-Version"] = "0.7.13";
17070
+ headers["X-Schematic-Components-Version"] = "0.7.15";
17099
17071
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
17100
17072
  const config = new Configuration({
17101
17073
  ...apiConfig,
@@ -17222,7 +17194,7 @@ var Box = dt.div((props) => {
17222
17194
  function reducer(acc, [key, value]) {
17223
17195
  if (key.startsWith("$") && !["$viewport"].includes(key)) {
17224
17196
  acc.push(
17225
- // keys will always be CSS properties
17197
+ // keys should always be CSS properties
17226
17198
  attr(camelToHyphen(key.slice(1)), value)
17227
17199
  );
17228
17200
  }
@@ -17232,11 +17204,11 @@ var Box = dt.div((props) => {
17232
17204
  for (const [key, value] of Object.entries(props.$viewport || {})) {
17233
17205
  styles.push(lt`
17234
17206
  ${{
17235
- sm: "@media (min-width: 640px)",
17236
- md: "@media (min-width: 768px)",
17237
- lg: "@media (min-width: 1024px)",
17238
- xl: "@media (min-width: 1280px)",
17239
- "2xl": "@media (min-width: 1536px)"
17207
+ sm: "@container (min-width: 640px)",
17208
+ md: "@container (min-width: 768px)",
17209
+ lg: "@container (min-width: 1024px)",
17210
+ xl: "@container (min-width: 1280px)",
17211
+ "2xl": "@container (min-width: 1536px)"
17240
17212
  }[key] || key} {
17241
17213
  ${Object.entries(value || {}).reduce(reducer, [])}
17242
17214
  }
@@ -17539,29 +17511,23 @@ var Button = dt.button(
17539
17511
  case "sm":
17540
17512
  return lt`
17541
17513
  font-size: ${15 / TEXT_BASE_SIZE}rem;
17542
- ${$variant !== "text" && lt`
17543
- height: ${40 / TEXT_BASE_SIZE}rem;
17544
- padding: ${7 / TEXT_BASE_SIZE}rem ${20 / TEXT_BASE_SIZE}rem;
17545
- border-radius: ${6 / TEXT_BASE_SIZE}rem;
17546
- `}
17514
+ height: ${40 / TEXT_BASE_SIZE}rem;
17515
+ padding: ${7 / TEXT_BASE_SIZE}rem ${20 / TEXT_BASE_SIZE}rem;
17516
+ border-radius: ${6 / TEXT_BASE_SIZE}rem;
17547
17517
  `;
17548
17518
  case "md":
17549
17519
  return lt`
17550
17520
  font-size: ${17 / TEXT_BASE_SIZE}rem;
17551
- ${$variant !== "text" && lt`
17552
- height: ${52 / TEXT_BASE_SIZE}rem;
17553
- padding: ${8 / TEXT_BASE_SIZE}rem ${24 / TEXT_BASE_SIZE}rem;
17554
- border-radius: ${8 / TEXT_BASE_SIZE}rem;
17555
- `}
17521
+ height: ${52 / TEXT_BASE_SIZE}rem;
17522
+ padding: ${8 / TEXT_BASE_SIZE}rem ${24 / TEXT_BASE_SIZE}rem;
17523
+ border-radius: ${8 / TEXT_BASE_SIZE}rem;
17556
17524
  `;
17557
17525
  case "lg":
17558
17526
  return lt`
17559
17527
  font-size: ${19 / TEXT_BASE_SIZE}rem;
17560
- ${$variant !== "text" && lt`
17561
- height: ${64 / TEXT_BASE_SIZE}rem;
17562
- padding: ${9 / TEXT_BASE_SIZE}rem ${28 / TEXT_BASE_SIZE}rem;
17563
- border-radius: ${10 / TEXT_BASE_SIZE}rem;
17564
- `}
17528
+ height: ${64 / TEXT_BASE_SIZE}rem;
17529
+ padding: ${9 / TEXT_BASE_SIZE}rem ${28 / TEXT_BASE_SIZE}rem;
17530
+ border-radius: ${10 / TEXT_BASE_SIZE}rem;
17565
17531
  `;
17566
17532
  }
17567
17533
  }}
@@ -18425,6 +18391,7 @@ var Container2 = dt.div`
18425
18391
  line-height: 1.35;
18426
18392
  width: 100%;
18427
18393
  height: 100%;
18394
+ container-type: inline-size;
18428
18395
 
18429
18396
  *,
18430
18397
  *::before,
@@ -18466,7 +18433,7 @@ import {
18466
18433
  useCallback as useCallback8,
18467
18434
  useEffect as useEffect4,
18468
18435
  useLayoutEffect as useLayoutEffect4,
18469
- useMemo as useMemo5,
18436
+ useMemo as useMemo6,
18470
18437
  useRef as useRef5,
18471
18438
  useState as useState8
18472
18439
  } from "react";
@@ -18589,7 +18556,8 @@ var StageButton = ({
18589
18556
  isLoading,
18590
18557
  requiresPayment,
18591
18558
  setCheckoutStage,
18592
- trialPaymentMethodRequired
18559
+ trialPaymentMethodRequired,
18560
+ willTrial
18593
18561
  }) => {
18594
18562
  const { t: t2 } = useTranslation();
18595
18563
  const NoPaymentRequired = () => {
@@ -18605,42 +18573,14 @@ var StageButton = ({
18605
18573
  );
18606
18574
  };
18607
18575
  if (checkoutStage === "plan") {
18608
- if (canTrial) {
18609
- if (trialPaymentMethodRequired) {
18610
- return /* @__PURE__ */ jsx12(
18611
- Button,
18612
- {
18613
- type: "button",
18614
- disabled: !hasAddOns && !canUpdateSubscription,
18615
- onClick: async () => {
18616
- setCheckoutStage?.("checkout");
18617
- },
18618
- $isLoading: isLoading,
18619
- children: /* @__PURE__ */ jsxs7(
18620
- Flex,
18621
- {
18622
- $gap: "0.5rem",
18623
- $justifyContent: "center",
18624
- $alignItems: "center",
18625
- $padding: "0 1rem",
18626
- children: [
18627
- t2("Next"),
18628
- ": ",
18629
- t2("Checkout"),
18630
- /* @__PURE__ */ jsx12(Icon2, { name: "arrow-right" })
18631
- ]
18632
- }
18633
- )
18634
- }
18635
- );
18636
- }
18576
+ if (canTrial && trialPaymentMethodRequired) {
18637
18577
  return /* @__PURE__ */ jsx12(
18638
18578
  Button,
18639
18579
  {
18640
18580
  type: "button",
18641
- disabled: !hasUnstagedChanges || !canUpdateSubscription,
18581
+ disabled: !hasAddOns && !canUpdateSubscription,
18642
18582
  onClick: async () => {
18643
- checkout();
18583
+ setCheckoutStage?.("checkout");
18644
18584
  },
18645
18585
  $isLoading: isLoading,
18646
18586
  children: /* @__PURE__ */ jsxs7(
@@ -18651,7 +18591,9 @@ var StageButton = ({
18651
18591
  $alignItems: "center",
18652
18592
  $padding: "0 1rem",
18653
18593
  children: [
18654
- t2("Subscribe and close"),
18594
+ t2("Next"),
18595
+ ": ",
18596
+ t2("Checkout"),
18655
18597
  /* @__PURE__ */ jsx12(Icon2, { name: "arrow-right" })
18656
18598
  ]
18657
18599
  }
@@ -18660,7 +18602,7 @@ var StageButton = ({
18660
18602
  );
18661
18603
  }
18662
18604
  if (!requiresPayment && !checkoutStages?.some(
18663
- (stage) => stage.id === "addons" || stage.id === "usage"
18605
+ (stage) => stage.id === "usage" || stage.id === "addons"
18664
18606
  )) {
18665
18607
  return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
18666
18608
  }
@@ -18686,7 +18628,7 @@ var StageButton = ({
18686
18628
  );
18687
18629
  }
18688
18630
  if (checkoutStage === "usage") {
18689
- if (!requiresPayment) {
18631
+ if (!requiresPayment && !checkoutStages?.some((stage) => stage.id === "addons")) {
18690
18632
  return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
18691
18633
  }
18692
18634
  return /* @__PURE__ */ jsx12(
@@ -18758,7 +18700,7 @@ var StageButton = ({
18758
18700
  disabled: isLoading || !hasUnstagedChanges || !canCheckout,
18759
18701
  onClick: checkout,
18760
18702
  $isLoading: isLoading,
18761
- children: canTrial ? t2("Start trial") : t2("Pay now")
18703
+ children: willTrial ? t2("Start trial") : t2("Pay now")
18762
18704
  }
18763
18705
  );
18764
18706
  }
@@ -18784,7 +18726,8 @@ var Sidebar = ({
18784
18726
  setError,
18785
18727
  setIsLoading,
18786
18728
  updatePromoCode,
18787
- showHeader = true
18729
+ showHeader = true,
18730
+ willTrial = false
18788
18731
  }) => {
18789
18732
  const { t: t2 } = useTranslation();
18790
18733
  const theme = nt();
@@ -18914,10 +18857,10 @@ var Sidebar = ({
18914
18857
  ...promoCode && { promoCode }
18915
18858
  }
18916
18859
  });
18917
- dispatchPlanChangedEvent(response.data);
18918
18860
  setIsLoading(false);
18919
18861
  setLayout("portal");
18920
- hydrate();
18862
+ await hydrate();
18863
+ dispatchPlanChangedEvent(response.data);
18921
18864
  } catch {
18922
18865
  setLayout("checkout");
18923
18866
  setError(
@@ -19015,6 +18958,7 @@ var Sidebar = ({
19015
18958
  currentUsageBasedEntitlements,
19016
18959
  usageBasedEntitlements
19017
18960
  ]);
18961
+ const willPeriodChange = planPeriod !== data.company?.plan?.planPeriod;
19018
18962
  const willPlanChange = typeof selectedPlan !== "undefined" && !selectedPlan.current;
19019
18963
  const removedAddOns = currentAddOns.filter(
19020
18964
  (current) => !selectedAddOns.some((selected) => current.id === selected.id) && current.planPeriod !== "one-time"
@@ -19024,10 +18968,10 @@ var Sidebar = ({
19024
18968
  );
19025
18969
  const willAddOnsChange = removedAddOns.length > 0 || addedAddOns.length > 0;
19026
18970
  const willPayInAdvanceEntitlementsChange = payInAdvanceEntitlements.length > 0 && payInAdvanceEntitlements.some(({ quantity, usage }) => quantity !== usage);
19027
- const hasUnstagedChanges = willPlanChange || willAddOnsChange || willPayInAdvanceEntitlementsChange;
18971
+ const hasUnstagedChanges = willPeriodChange || willPlanChange || willAddOnsChange || willPayInAdvanceEntitlementsChange;
19028
18972
  const canUpdateSubscription = mode === "edit" || api !== null && !isLoading;
19029
18973
  const canCheckout = canUpdateSubscription && (!!data.subscription?.paymentMethod || typeof paymentMethodId === "string");
19030
- const isTrialable = selectedPlan?.companyCanTrial;
18974
+ const isTrialable = selectedPlan?.companyCanTrial === true;
19031
18975
  const today = /* @__PURE__ */ new Date();
19032
18976
  const trialEndsOn = new Date(today);
19033
18977
  if (isTrialable && selectedPlan.trialDays) {
@@ -19103,7 +19047,7 @@ var Sidebar = ({
19103
19047
  }
19104
19048
  ) }),
19105
19049
  /* @__PURE__ */ jsxs8(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
19106
- data.company?.plan && /* @__PURE__ */ jsxs8(
19050
+ currentPlan && /* @__PURE__ */ jsxs8(
19107
19051
  Flex,
19108
19052
  {
19109
19053
  $justifyContent: "space-between",
@@ -19122,10 +19066,10 @@ var Sidebar = ({
19122
19066
  $size: theme.typography.heading4.fontSize,
19123
19067
  $weight: theme.typography.heading4.fontWeight,
19124
19068
  $color: theme.typography.heading4.color,
19125
- children: data.company.plan.name
19069
+ children: currentPlan.name
19126
19070
  }
19127
19071
  ) }),
19128
- typeof data.company.plan.planPrice === "number" && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
19072
+ typeof currentPlan.planPrice === "number" && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
19129
19073
  Text,
19130
19074
  {
19131
19075
  $font: theme.typography.text.fontFamily,
@@ -19134,14 +19078,12 @@ var Sidebar = ({
19134
19078
  $color: theme.typography.text.color,
19135
19079
  children: [
19136
19080
  formatCurrency(
19137
- data.company.plan.planPrice,
19138
- data.company.billingSubscription?.currency
19081
+ currentPlan.planPrice,
19082
+ data.company?.billingSubscription?.currency
19139
19083
  ),
19140
19084
  /* @__PURE__ */ jsxs8("sub", { children: [
19141
19085
  "/",
19142
- shortenPeriod(
19143
- data.company.plan.planPeriod || planPeriod
19144
- )
19086
+ shortenPeriod(currentPlan.planPeriod || planPeriod)
19145
19087
  ] })
19146
19088
  ]
19147
19089
  }
@@ -19907,7 +19849,7 @@ var Sidebar = ({
19907
19849
  layout === "checkout" && /* @__PURE__ */ jsx13(
19908
19850
  StageButton,
19909
19851
  {
19910
- canTrial: selectedPlan?.companyCanTrial === true,
19852
+ canTrial: isTrialable,
19911
19853
  canCheckout,
19912
19854
  canUpdateSubscription,
19913
19855
  checkout,
@@ -19919,7 +19861,8 @@ var Sidebar = ({
19919
19861
  isLoading,
19920
19862
  requiresPayment,
19921
19863
  setCheckoutStage,
19922
- trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
19864
+ trialPaymentMethodRequired: data.trialPaymentMethodRequired === true,
19865
+ willTrial
19923
19866
  }
19924
19867
  ),
19925
19868
  layout === "unsubscribe" && /* @__PURE__ */ jsx13(Button, { onClick: unsubscribe, $isLoading: isLoading, children: t2("Cancel subscription") }),
@@ -20229,13 +20172,11 @@ var Navigation = ({
20229
20172
  }
20230
20173
  ),
20231
20174
  /* @__PURE__ */ jsxs11(
20232
- Box,
20175
+ Text,
20233
20176
  {
20177
+ as: Box,
20234
20178
  tabIndex: 0,
20235
- $fontSize: `${16 / TEXT_BASE_SIZE}rem`,
20236
- $fontFamily: theme.typography.text.fontFamily,
20237
- $fontWeight: index === activeIndex ? 600 : 400,
20238
- $color: theme.typography.text.color,
20179
+ $weight: index === activeIndex ? 600 : 400,
20239
20180
  ...!showFullContent && {
20240
20181
  $overflow: "hidden",
20241
20182
  $whiteSpace: "nowrap",
@@ -20275,7 +20216,7 @@ var Navigation = ({
20275
20216
  };
20276
20217
 
20277
20218
  // src/components/shared/checkout-dialog/Plan.tsx
20278
- import { useState as useState7 } from "react";
20219
+ import { useMemo as useMemo5, useState as useState7 } from "react";
20279
20220
 
20280
20221
  // src/components/elements/pricing-table/styles.ts
20281
20222
  var ButtonLink = dt.a`
@@ -20288,15 +20229,162 @@ var ButtonLink = dt.a`
20288
20229
 
20289
20230
  // src/components/shared/checkout-dialog/Plan.tsx
20290
20231
  import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
20232
+ var Selected = ({ isCurrent = false, isTrial = false }) => {
20233
+ const { t: t2 } = useTranslation();
20234
+ const theme = nt();
20235
+ const text = useMemo5(() => {
20236
+ if (isCurrent) {
20237
+ return isTrial ? t2("Trial in progress") : t2("Current plan");
20238
+ }
20239
+ return isTrial ? t2("Trial selected") : t2("Plan selected");
20240
+ }, [t2, isCurrent, isTrial]);
20241
+ return /* @__PURE__ */ jsxs12(
20242
+ Flex,
20243
+ {
20244
+ $justifyContent: "center",
20245
+ $alignItems: "center",
20246
+ $gap: "0.25rem",
20247
+ $padding: "0.625rem 0",
20248
+ children: [
20249
+ /* @__PURE__ */ jsx17(
20250
+ Icon2,
20251
+ {
20252
+ name: "check-rounded",
20253
+ style: {
20254
+ fontSize: 20,
20255
+ lineHeight: 1,
20256
+ color: theme.primary
20257
+ }
20258
+ }
20259
+ ),
20260
+ /* @__PURE__ */ jsx17(
20261
+ Text,
20262
+ {
20263
+ $font: theme.typography.text.fontFamily,
20264
+ $size: 15 / 16 * theme.typography.text.fontSize,
20265
+ $weight: theme.typography.text.fontWeight,
20266
+ $color: theme.typography.text.color,
20267
+ $leading: 1,
20268
+ children: text
20269
+ }
20270
+ )
20271
+ ]
20272
+ }
20273
+ );
20274
+ };
20275
+ var PlanButtonGroup = ({
20276
+ plan,
20277
+ isLoading,
20278
+ isSelected,
20279
+ onSelect,
20280
+ willTrial
20281
+ }) => {
20282
+ const { t: t2 } = useTranslation();
20283
+ const { data } = useEmbed();
20284
+ const isCurrent = plan.id === data.company?.plan?.id;
20285
+ if (plan.companyCanTrial) {
20286
+ return /* @__PURE__ */ jsxs12(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
20287
+ data.subscription?.status !== "trialing" && /* @__PURE__ */ jsx17(Fragment8, { children: isSelected && willTrial ? /* @__PURE__ */ jsx17(
20288
+ Selected,
20289
+ {
20290
+ isCurrent,
20291
+ isTrial: plan.companyCanTrial && willTrial
20292
+ }
20293
+ ) : /* @__PURE__ */ jsx17(
20294
+ Button,
20295
+ {
20296
+ type: "button",
20297
+ disabled: (isLoading || !plan.valid) && !plan.custom,
20298
+ ...!plan.custom && {
20299
+ onClick: () => {
20300
+ onSelect({
20301
+ plan,
20302
+ shouldTrial: true
20303
+ });
20304
+ }
20305
+ },
20306
+ $size: "sm",
20307
+ $color: "primary",
20308
+ $variant: "filled",
20309
+ children: plan.custom ? /* @__PURE__ */ jsx17(
20310
+ ButtonLink,
20311
+ {
20312
+ href: plan.customPlanConfig?.ctaWebSite ?? "#",
20313
+ target: "_blank",
20314
+ children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
20315
+ }
20316
+ ) : !plan.valid ? /* @__PURE__ */ jsx17(
20317
+ Tooltip,
20318
+ {
20319
+ trigger: t2("Over usage limit"),
20320
+ content: t2("Current usage exceeds the limit of this plan.")
20321
+ }
20322
+ ) : t2("Start X day trial", { days: plan.trialDays })
20323
+ }
20324
+ ) }),
20325
+ !plan.custom && /* @__PURE__ */ jsx17(Fragment8, { children: isSelected && (!willTrial || data.subscription?.status === "trialing") ? /* @__PURE__ */ jsx17(Selected, { isCurrent }) : /* @__PURE__ */ jsx17(
20326
+ Button,
20327
+ {
20328
+ type: "button",
20329
+ disabled: isLoading || !plan.valid,
20330
+ onClick: () => {
20331
+ onSelect({ plan, shouldTrial: false });
20332
+ },
20333
+ $size: "sm",
20334
+ $color: "primary",
20335
+ $variant: data.subscription?.status === "trialing" ? "filled" : "text",
20336
+ children: !plan.valid ? /* @__PURE__ */ jsx17(
20337
+ Tooltip,
20338
+ {
20339
+ trigger: t2("Over usage limit"),
20340
+ content: t2("Current usage exceeds the limit of this plan.")
20341
+ }
20342
+ ) : t2("Choose plan")
20343
+ }
20344
+ ) })
20345
+ ] });
20346
+ }
20347
+ return isSelected ? /* @__PURE__ */ jsx17(Selected, { isCurrent }) : /* @__PURE__ */ jsx17(
20348
+ Button,
20349
+ {
20350
+ type: "button",
20351
+ disabled: (isLoading || !plan.valid) && !plan.custom,
20352
+ ...!plan.custom && {
20353
+ onClick: () => {
20354
+ onSelect({ plan });
20355
+ }
20356
+ },
20357
+ $size: "sm",
20358
+ $color: "primary",
20359
+ $variant: "filled",
20360
+ children: plan.custom ? /* @__PURE__ */ jsx17(
20361
+ ButtonLink,
20362
+ {
20363
+ href: plan.customPlanConfig?.ctaWebSite ?? "#",
20364
+ target: "_blank",
20365
+ children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
20366
+ }
20367
+ ) : !plan.valid ? /* @__PURE__ */ jsx17(
20368
+ Tooltip,
20369
+ {
20370
+ trigger: t2("Over usage limit"),
20371
+ content: t2("Current usage exceeds the limit of this plan.")
20372
+ }
20373
+ ) : t2("Choose plan")
20374
+ }
20375
+ );
20376
+ };
20291
20377
  var Plan = ({
20292
20378
  isLoading,
20293
20379
  plans,
20294
20380
  selectedPlan,
20295
20381
  period,
20296
- selectPlan
20382
+ selectPlan,
20383
+ willTrial
20297
20384
  }) => {
20298
20385
  const { t: t2 } = useTranslation();
20299
20386
  const theme = nt();
20387
+ const { data } = useEmbed();
20300
20388
  const isLightBackground = useIsLightBackground();
20301
20389
  const [entitlementCounts, setEntitlementCounts] = useState7(
20302
20390
  () => plans.reduce(
@@ -20310,7 +20398,6 @@ var Plan = ({
20310
20398
  {}
20311
20399
  )
20312
20400
  );
20313
- const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
20314
20401
  const handleToggleShowAll = (id) => {
20315
20402
  setEntitlementCounts((prev2) => {
20316
20403
  const count = { ...prev2[id] };
@@ -20323,6 +20410,7 @@ var Plan = ({
20323
20410
  };
20324
20411
  });
20325
20412
  };
20413
+ const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
20326
20414
  return /* @__PURE__ */ jsx17(Fragment8, { children: /* @__PURE__ */ jsx17(
20327
20415
  Box,
20328
20416
  {
@@ -20431,7 +20519,7 @@ var Plan = ({
20431
20519
  $size: 0.75 * theme.typography.text.fontSize,
20432
20520
  $weight: theme.typography.text.fontWeight,
20433
20521
  $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
20434
- children: t2("Active")
20522
+ children: data.subscription?.status === "trialing" ? t2("Trialing") : t2("Active")
20435
20523
  }
20436
20524
  )
20437
20525
  }
@@ -20646,70 +20734,14 @@ var Plan = ({
20646
20734
  }
20647
20735
  )
20648
20736
  ] }),
20649
- plan.id === selectedPlan?.id ? /* @__PURE__ */ jsxs12(
20650
- Flex,
20737
+ /* @__PURE__ */ jsx17(
20738
+ PlanButtonGroup,
20651
20739
  {
20652
- $justifyContent: "center",
20653
- $alignItems: "center",
20654
- $gap: "0.25rem",
20655
- $padding: "0.625rem 0",
20656
- children: [
20657
- /* @__PURE__ */ jsx17(
20658
- Icon2,
20659
- {
20660
- name: "check-rounded",
20661
- style: {
20662
- fontSize: 20,
20663
- lineHeight: 1,
20664
- color: theme.primary
20665
- }
20666
- }
20667
- ),
20668
- /* @__PURE__ */ jsx17(
20669
- Text,
20670
- {
20671
- $font: theme.typography.text.fontFamily,
20672
- $size: 15 / 16 * theme.typography.text.fontSize,
20673
- $weight: theme.typography.text.fontWeight,
20674
- $color: theme.typography.text.color,
20675
- $leading: 1,
20676
- children: plan.current ? t2("Current plan") : t2("Selected")
20677
- }
20678
- )
20679
- ]
20680
- }
20681
- ) : /* @__PURE__ */ jsx17(
20682
- Button,
20683
- {
20684
- type: "button",
20685
- disabled: (isLoading || !plan.valid) && !plan.custom,
20686
- ...{
20687
- onClick: () => {
20688
- if (plan.custom) {
20689
- return;
20690
- }
20691
- selectPlan({ plan });
20692
- }
20693
- },
20694
- $size: "sm",
20695
- $color: "primary",
20696
- $variant: plan.current ? "outline" : "filled",
20697
- children: plan.custom ? /* @__PURE__ */ jsx17(
20698
- ButtonLink,
20699
- {
20700
- href: plan.customPlanConfig?.ctaWebSite ?? "#",
20701
- target: "_blank",
20702
- children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
20703
- }
20704
- ) : !plan.valid ? /* @__PURE__ */ jsx17(
20705
- Tooltip,
20706
- {
20707
- trigger: t2("Over usage limit"),
20708
- content: t2(
20709
- "Current usage exceeds the limit of this plan."
20710
- )
20711
- }
20712
- ) : plan.companyCanTrial ? t2("Trial plan", { days: plan.trialDays }) : t2("Choose plan")
20740
+ plan,
20741
+ isLoading,
20742
+ isSelected: plan.id === selectedPlan?.id,
20743
+ onSelect: selectPlan,
20744
+ willTrial
20713
20745
  }
20714
20746
  )
20715
20747
  ]
@@ -20924,7 +20956,6 @@ var CheckoutDialog = ({ top = 0 }) => {
20924
20956
  );
20925
20957
  const [isLoading, setIsLoading] = useState8(false);
20926
20958
  const [error, setError] = useState8();
20927
- const [promoCode, setPromoCode] = useState8();
20928
20959
  const [planPeriod, setPlanPeriod] = useState8(
20929
20960
  selected.period || data.company?.plan?.planPeriod || "month"
20930
20961
  );
@@ -20938,6 +20969,9 @@ var CheckoutDialog = ({ top = 0 }) => {
20938
20969
  (plan) => selected.planId ? plan.id === selected.planId : plan.current
20939
20970
  )
20940
20971
  );
20972
+ const [willTrial, setWillTrial] = useState8(
20973
+ data.subscription?.status !== "trialing" && !data.trialPaymentMethodRequired
20974
+ );
20941
20975
  const [addOns, setAddOns] = useState8(
20942
20976
  () => availableAddOns.map((addOn) => ({
20943
20977
  ...addOn,
@@ -20946,7 +20980,8 @@ var CheckoutDialog = ({ top = 0 }) => {
20946
20980
  )
20947
20981
  }))
20948
20982
  );
20949
- const currentEntitlements = useMemo5(() => {
20983
+ const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
20984
+ const currentEntitlements = useMemo6(() => {
20950
20985
  return data.featureUsage?.features || [];
20951
20986
  }, [data.featureUsage?.features]);
20952
20987
  const [usageBasedEntitlements, setUsageBasedEntitlements] = useState8(
@@ -20958,18 +20993,21 @@ var CheckoutDialog = ({ top = 0 }) => {
20958
20993
  []
20959
20994
  )
20960
20995
  );
20961
- const payInAdvanceEntitlements = useMemo5(
20996
+ const payInAdvanceEntitlements = useMemo6(
20962
20997
  () => usageBasedEntitlements.filter(
20963
20998
  (entitlement) => entitlement.priceBehavior === "pay_in_advance"
20964
20999
  ),
20965
21000
  [usageBasedEntitlements]
20966
21001
  );
20967
- const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
20968
21002
  const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
20969
21003
  ({ quantity }) => quantity > 0
20970
21004
  );
20971
- const requiresPayment = (!selectedPlan?.companyCanTrial || !!data.trialPaymentMethodRequired) && (!selectedPlan?.isFree || hasActiveAddOns || hasActivePayInAdvanceEntitlements);
20972
- const checkoutStages = useMemo5(() => {
21005
+ const [promoCode, setPromoCode] = useState8();
21006
+ const isTrialable = selectedPlan?.isTrialable === true && selectedPlan?.companyCanTrial === true;
21007
+ const isTrialableAndFree = isTrialable && data.trialPaymentMethodRequired !== true;
21008
+ const planRequiresPayment = !isTrialableAndFree || !isTrialable && selectedPlan?.isFree !== true;
21009
+ const requiresPayment = planRequiresPayment || hasActiveAddOns || hasActivePayInAdvanceEntitlements;
21010
+ const checkoutStages = useMemo6(() => {
20973
21011
  const stages = [
20974
21012
  {
20975
21013
  id: "plan",
@@ -20978,13 +21016,16 @@ var CheckoutDialog = ({ top = 0 }) => {
20978
21016
  description: t2("Choose your base plan")
20979
21017
  }
20980
21018
  ];
20981
- if (payInAdvanceEntitlements.length) {
21019
+ if (willTrial) {
21020
+ return stages;
21021
+ }
21022
+ if (payInAdvanceEntitlements.length > 0) {
20982
21023
  stages.push({
20983
21024
  id: "usage",
20984
21025
  name: t2("Quantity")
20985
21026
  });
20986
21027
  }
20987
- if (availableAddOns.length && !selectedPlan?.companyCanTrial) {
21028
+ if (availableAddOns.length > 0) {
20988
21029
  stages.push({
20989
21030
  id: "addons",
20990
21031
  name: t2("Add-ons"),
@@ -21002,9 +21043,9 @@ var CheckoutDialog = ({ top = 0 }) => {
21002
21043
  return stages;
21003
21044
  }, [
21004
21045
  t2,
21046
+ willTrial,
21005
21047
  payInAdvanceEntitlements,
21006
21048
  availableAddOns,
21007
- selectedPlan?.companyCanTrial,
21008
21049
  requiresPayment
21009
21050
  ]);
21010
21051
  const [checkoutStage, setCheckoutStage] = useState8(() => {
@@ -21109,6 +21150,8 @@ var CheckoutDialog = ({ top = 0 }) => {
21109
21150
  setSelectedPlan(plan);
21110
21151
  setUsageBasedEntitlements(entitlements);
21111
21152
  }
21153
+ const shouldTrial = updates.shouldTrial ?? false;
21154
+ setWillTrial(shouldTrial && !data.trialPaymentMethodRequired);
21112
21155
  previewCheckout({
21113
21156
  period,
21114
21157
  plan: updates.plan,
@@ -21117,7 +21160,13 @@ var CheckoutDialog = ({ top = 0 }) => {
21117
21160
  )
21118
21161
  });
21119
21162
  },
21120
- [planPeriod, selectedPlan, currentEntitlements, previewCheckout]
21163
+ [
21164
+ data.trialPaymentMethodRequired,
21165
+ planPeriod,
21166
+ selectedPlan,
21167
+ currentEntitlements,
21168
+ previewCheckout
21169
+ ]
21121
21170
  );
21122
21171
  const changePlanPeriod = useCallback8(
21123
21172
  (period) => {
@@ -21314,7 +21363,8 @@ var CheckoutDialog = ({ top = 0 }) => {
21314
21363
  period: planPeriod,
21315
21364
  plans: availablePlans,
21316
21365
  selectedPlan,
21317
- selectPlan
21366
+ selectPlan,
21367
+ willTrial
21318
21368
  }
21319
21369
  ),
21320
21370
  checkoutStage === "usage" && /* @__PURE__ */ jsx19(
@@ -21366,7 +21416,8 @@ var CheckoutDialog = ({ top = 0 }) => {
21366
21416
  setCheckoutStage: (stage) => setCheckoutStage(stage),
21367
21417
  setError: (msg) => setError(msg),
21368
21418
  setIsLoading,
21369
- updatePromoCode: (code) => updatePromoCode(code)
21419
+ updatePromoCode: (code) => updatePromoCode(code),
21420
+ willTrial
21370
21421
  }
21371
21422
  )
21372
21423
  ]
@@ -21495,7 +21546,7 @@ var PaymentForm = ({ onConfirm }) => {
21495
21546
  };
21496
21547
 
21497
21548
  // src/components/shared/period-toggle/PeriodToggle.tsx
21498
- import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo6, useState as useState10 } from "react";
21549
+ import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo7, useState as useState10 } from "react";
21499
21550
  import { jsx as jsx22 } from "react/jsx-runtime";
21500
21551
  var PeriodToggle = ({
21501
21552
  options: options2,
@@ -21508,7 +21559,7 @@ var PeriodToggle = ({
21508
21559
  const theme = nt();
21509
21560
  const isLightBackground = useIsLightBackground();
21510
21561
  const [tooltipZIndex, setTooltipZIndex] = useState10(1);
21511
- const savingsPercentage = useMemo6(() => {
21562
+ const savingsPercentage = useMemo7(() => {
21512
21563
  if (selectedPlan) {
21513
21564
  const monthlyBillingPrice = getBillingPrice(selectedPlan?.monthlyPrice);
21514
21565
  const yearlyBillingPrice = getBillingPrice(selectedPlan?.yearlyPrice);
@@ -21608,7 +21659,7 @@ var PeriodToggle = ({
21608
21659
  };
21609
21660
 
21610
21661
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
21611
- import { useCallback as useCallback9, useMemo as useMemo7, useRef as useRef6, useState as useState11 } from "react";
21662
+ import { useCallback as useCallback9, useMemo as useMemo8, useRef as useRef6, useState as useState11 } from "react";
21612
21663
  import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
21613
21664
  var UnsubscribeDialog = ({ top = 0 }) => {
21614
21665
  const { t: t2 } = useTranslation();
@@ -21617,12 +21668,12 @@ var UnsubscribeDialog = ({ top = 0 }) => {
21617
21668
  const contentRef = useRef6(null);
21618
21669
  const [error, setError] = useState11();
21619
21670
  const [isLoading, setIsLoading] = useState11(false);
21620
- const planPeriod = useMemo7(
21671
+ const planPeriod = useMemo8(
21621
21672
  () => data.company?.plan?.planPeriod ?? "month",
21622
21673
  [data.company?.plan?.planPeriod]
21623
21674
  );
21624
21675
  const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
21625
- const selectedPlan = useMemo7(
21676
+ const selectedPlan = useMemo8(
21626
21677
  () => availablePlans.find(
21627
21678
  (plan) => plan.id === data.company?.plan?.id && data.company?.plan.planPeriod === planPeriod
21628
21679
  ),
@@ -21633,7 +21684,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
21633
21684
  createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
21634
21685
  []
21635
21686
  );
21636
- const addOns = useMemo7(
21687
+ const addOns = useMemo8(
21637
21688
  () => availableAddOns.map((available) => ({
21638
21689
  ...available,
21639
21690
  isSelected: data.company?.addOns.some((current) => available.id === current.id) ?? false
@@ -21957,17 +22008,16 @@ var StyledViewport = dt.div.withConfig({
21957
22008
  shouldForwardProp: (prop) => !["$numberOfColumns", "numberOfColumns"].includes(prop)
21958
22009
  })`
21959
22010
  display: grid;
21960
- grid-template-columns: repeat(1, minmax(300px, 1fr));
21961
22011
  margin-left: auto;
21962
22012
  margin-right: auto;
21963
22013
  gap: 1rem;
21964
22014
 
21965
- @media (min-width: 768px) {
21966
- grid-template-columns: ${({ theme }) => lt`repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`};
22015
+ @container (max-width: 767px) {
22016
+ grid-template-columns: repeat(1, minmax(300px, 1fr));
21967
22017
  }
21968
22018
 
21969
- @container (max-width: 768px) {
21970
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
22019
+ @container (min-width: 768px) {
22020
+ grid-template-columns: ${({ theme }) => lt`repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`};
21971
22021
  }
21972
22022
  `;
21973
22023
 
@@ -22070,10 +22120,10 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
22070
22120
  ButtonElement.displayName = "Button";
22071
22121
 
22072
22122
  // src/components/elements/included-features/IncludedFeatures.tsx
22073
- import { forwardRef as forwardRef7, useMemo as useMemo9, useRef as useRef7, useState as useState13 } from "react";
22123
+ import { forwardRef as forwardRef7, useMemo as useMemo10, useRef as useRef7, useState as useState13 } from "react";
22074
22124
 
22075
22125
  // src/components/elements/included-features/Details.tsx
22076
- import { Fragment as Fragment11, useMemo as useMemo8 } from "react";
22126
+ import { Fragment as Fragment11, useMemo as useMemo9 } from "react";
22077
22127
  import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
22078
22128
  var Details = ({
22079
22129
  shouldWrapChildren,
@@ -22098,7 +22148,7 @@ var Details = ({
22098
22148
  priceTier,
22099
22149
  currency,
22100
22150
  packageSize = 1
22101
- } = useMemo8(() => {
22151
+ } = useMemo9(() => {
22102
22152
  const {
22103
22153
  price: entitlementPrice,
22104
22154
  priceDecimal: entitlementPriceDecimal,
@@ -22120,7 +22170,7 @@ var Details = ({
22120
22170
  monthlyUsageBasedPrice,
22121
22171
  yearlyUsageBasedPrice
22122
22172
  ]);
22123
- const text = useMemo8(() => {
22173
+ const text = useMemo9(() => {
22124
22174
  if (!feature) {
22125
22175
  return;
22126
22176
  }
@@ -22171,7 +22221,7 @@ var Details = ({
22171
22221
  packageSize,
22172
22222
  softLimit
22173
22223
  ]);
22174
- const usageText = useMemo8(() => {
22224
+ const usageText = useMemo9(() => {
22175
22225
  if (!feature) {
22176
22226
  return;
22177
22227
  }
@@ -22348,7 +22398,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
22348
22398
  const shouldWrapChildren = useWrapChildren(elements.current);
22349
22399
  const isLightBackground = useIsLightBackground();
22350
22400
  const [showCount, setShowCount] = useState13(VISIBLE_ENTITLEMENT_COUNT);
22351
- const featureUsage = useMemo9(() => {
22401
+ const featureUsage = useMemo10(() => {
22352
22402
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
22353
22403
  (acc, id) => {
22354
22404
  const mappedFeatureUsage = data.featureUsage?.features.find(
@@ -22507,7 +22557,7 @@ IncludedFeatures.displayName = "IncludedFeatures";
22507
22557
 
22508
22558
  // src/components/elements/invoices/Invoices.tsx
22509
22559
  import { forwardRef as forwardRef8, useEffect as useEffect5, useState as useState14 } from "react";
22510
- import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
22560
+ import { Fragment as Fragment13, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
22511
22561
  function resolveDesignProps3(props) {
22512
22562
  return {
22513
22563
  header: {
@@ -22578,9 +22628,6 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
22578
22628
  useEffect5(() => {
22579
22629
  setInvoices(formatInvoices(data));
22580
22630
  }, [data]);
22581
- if (invoices.length === 0) {
22582
- return null;
22583
- }
22584
22631
  return /* @__PURE__ */ jsx30(Element, { ref, className, children: /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: "1rem", children: [
22585
22632
  props.header.isVisible && /* @__PURE__ */ jsx30(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx30(
22586
22633
  Text,
@@ -22592,54 +22639,56 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
22592
22639
  children: t2("Invoices")
22593
22640
  }
22594
22641
  ) }),
22595
- /* @__PURE__ */ jsx30(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
22596
- return /* @__PURE__ */ jsxs23(Flex, { $justifyContent: "space-between", children: [
22597
- props.date.isVisible && date && /* @__PURE__ */ jsx30(
22598
- InvoiceDate,
22642
+ invoices.length > 0 ? /* @__PURE__ */ jsxs23(Fragment13, { children: [
22643
+ /* @__PURE__ */ jsx30(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
22644
+ return /* @__PURE__ */ jsxs23(Flex, { $justifyContent: "space-between", children: [
22645
+ props.date.isVisible && date && /* @__PURE__ */ jsx30(
22646
+ InvoiceDate,
22647
+ {
22648
+ date,
22649
+ fontStyle: props.date.fontStyle,
22650
+ url
22651
+ }
22652
+ ),
22653
+ props.amount.isVisible && /* @__PURE__ */ jsx30(
22654
+ Text,
22655
+ {
22656
+ $font: theme.typography[props.amount.fontStyle].fontFamily,
22657
+ $size: theme.typography[props.amount.fontStyle].fontSize,
22658
+ $weight: theme.typography[props.amount.fontStyle].fontWeight,
22659
+ $color: theme.typography[props.amount.fontStyle].color,
22660
+ children: amount
22661
+ }
22662
+ )
22663
+ ] }, index);
22664
+ }) }),
22665
+ props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs23(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
22666
+ /* @__PURE__ */ jsx30(
22667
+ Icon2,
22599
22668
  {
22600
- date,
22601
- fontStyle: props.date.fontStyle,
22602
- url
22669
+ name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
22670
+ style: { color: "#D0D0D0" }
22603
22671
  }
22604
22672
  ),
22605
- props.amount.isVisible && /* @__PURE__ */ jsx30(
22673
+ /* @__PURE__ */ jsx30(
22606
22674
  Text,
22607
22675
  {
22608
- $font: theme.typography[props.amount.fontStyle].fontFamily,
22609
- $size: theme.typography[props.amount.fontStyle].fontSize,
22610
- $weight: theme.typography[props.amount.fontStyle].fontWeight,
22611
- $color: theme.typography[props.amount.fontStyle].color,
22612
- children: amount
22676
+ onClick: toggleListSize,
22677
+ $font: theme.typography[props.collapse.fontStyle].fontFamily,
22678
+ $size: theme.typography[props.collapse.fontStyle].fontSize,
22679
+ $weight: theme.typography[props.collapse.fontStyle].fontWeight,
22680
+ $color: theme.typography[props.collapse.fontStyle].color,
22681
+ children: listSize === props.limit.number ? t2("See more") : t2("See less")
22613
22682
  }
22614
22683
  )
22615
- ] }, index);
22616
- }) }),
22617
- props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs23(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
22618
- /* @__PURE__ */ jsx30(
22619
- Icon2,
22620
- {
22621
- name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
22622
- style: { color: "#D0D0D0" }
22623
- }
22624
- ),
22625
- /* @__PURE__ */ jsx30(
22626
- Text,
22627
- {
22628
- onClick: toggleListSize,
22629
- $font: theme.typography[props.collapse.fontStyle].fontFamily,
22630
- $size: theme.typography[props.collapse.fontStyle].fontSize,
22631
- $weight: theme.typography[props.collapse.fontStyle].fontWeight,
22632
- $color: theme.typography[props.collapse.fontStyle].color,
22633
- children: listSize === props.limit.number ? t2("See more") : t2("See less")
22634
- }
22635
- )
22636
- ] })
22684
+ ] })
22685
+ ] }) : /* @__PURE__ */ jsx30(Text, { display: "heading2", children: t2("No invoices created yet") })
22637
22686
  ] }) });
22638
22687
  });
22639
22688
  Invoices.displayName = "Invoices";
22640
22689
 
22641
22690
  // src/components/elements/metered-features/MeteredFeatures.tsx
22642
- import { forwardRef as forwardRef9, useMemo as useMemo10, useRef as useRef8 } from "react";
22691
+ import { forwardRef as forwardRef9, useMemo as useMemo11, useRef as useRef8 } from "react";
22643
22692
 
22644
22693
  // src/components/elements/metered-features/styles.ts
22645
22694
  var Container3 = dt.div`
@@ -22647,11 +22696,10 @@ var Container3 = dt.div`
22647
22696
  flex-direction: column;
22648
22697
 
22649
22698
  &:last-child {
22650
- overflow: hidden;
22651
-
22652
22699
  ${({ theme }) => {
22653
22700
  const borderRadius = `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`;
22654
22701
  return theme.sectionLayout === "merged" && lt`
22702
+ overflow: hidden;
22655
22703
  border-bottom-left-radius: ${borderRadius};
22656
22704
  border-bottom-right-radius: ${borderRadius};
22657
22705
  `;
@@ -22660,7 +22708,7 @@ var Container3 = dt.div`
22660
22708
  `;
22661
22709
 
22662
22710
  // src/components/elements/metered-features/MeteredFeatures.tsx
22663
- import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
22711
+ import { Fragment as Fragment14, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
22664
22712
  function resolveDesignProps4(props) {
22665
22713
  return {
22666
22714
  isVisible: props.isVisible ?? true,
@@ -22694,7 +22742,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
22694
22742
  const theme = nt();
22695
22743
  const { data, setLayout, setSelected } = useEmbed();
22696
22744
  const isLightBackground = useIsLightBackground();
22697
- const featureUsage = useMemo10(() => {
22745
+ const featureUsage = useMemo11(() => {
22698
22746
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
22699
22747
  (acc, id) => {
22700
22748
  const mappedFeatureUsage = data.featureUsage?.features.find(
@@ -22799,7 +22847,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
22799
22847
  $weight: theme.typography[props.header.fontStyle].fontWeight,
22800
22848
  $color: theme.typography[props.header.fontStyle].color,
22801
22849
  $leading: 1.35,
22802
- children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
22850
+ children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
22803
22851
  formatNumber(usage),
22804
22852
  " ",
22805
22853
  getFeatureName(feature, usage)
@@ -22837,15 +22885,15 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
22837
22885
  style: {
22838
22886
  whiteSpace: "nowrap"
22839
22887
  },
22840
- children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
22888
+ children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
22841
22889
  formatNumber(allocation),
22842
22890
  " ",
22843
22891
  getFeatureName(feature, allocation)
22844
- ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
22892
+ ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
22845
22893
  formatNumber(usage),
22846
22894
  " ",
22847
22895
  getFeatureName(feature, usage),
22848
- priceBehavior === "overage" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
22896
+ priceBehavior === "overage" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
22849
22897
  " ",
22850
22898
  t2("used")
22851
22899
  ] })
@@ -22938,18 +22986,18 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
22938
22986
  $weight: theme.typography.text.fontWeight,
22939
22987
  $color: theme.typography.text.color,
22940
22988
  $leading: 1.35,
22941
- children: /* @__PURE__ */ jsxs24(Fragment13, { children: [
22989
+ children: /* @__PURE__ */ jsxs24(Fragment14, { children: [
22942
22990
  t2("Additional"),
22943
22991
  ": ",
22944
22992
  formatCurrency(price, currency),
22945
22993
  feature && /* @__PURE__ */ jsxs24(Box, { as: "sub", $whiteSpace: "nowrap", children: [
22946
22994
  "/",
22947
- packageSize > 1 && /* @__PURE__ */ jsxs24(Fragment13, { children: [
22995
+ packageSize > 1 && /* @__PURE__ */ jsxs24(Fragment14, { children: [
22948
22996
  packageSize,
22949
22997
  " "
22950
22998
  ] }),
22951
22999
  getFeatureName(feature, packageSize),
22952
- feature.featureType === "trait" && planPeriod && /* @__PURE__ */ jsxs24(Fragment13, { children: [
23000
+ feature.featureType === "trait" && planPeriod && /* @__PURE__ */ jsxs24(Fragment14, { children: [
22953
23001
  "/",
22954
23002
  shortenPeriod(planPeriod)
22955
23003
  ] })
@@ -22991,10 +23039,10 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
22991
23039
  MeteredFeatures.displayName = "MeteredFeatures";
22992
23040
 
22993
23041
  // src/components/elements/payment-method/PaymentMethod.tsx
22994
- import { forwardRef as forwardRef10, useMemo as useMemo12 } from "react";
23042
+ import { forwardRef as forwardRef10, useMemo as useMemo13 } from "react";
22995
23043
 
22996
23044
  // src/components/elements/payment-method/PaymentMethodElement.tsx
22997
- import { useMemo as useMemo11 } from "react";
23045
+ import { useMemo as useMemo12 } from "react";
22998
23046
  import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
22999
23047
  var PaymentElement2 = ({
23000
23048
  iconName,
@@ -23169,7 +23217,7 @@ var PaymentListElement = ({
23169
23217
  const isLightBackground = useIsLightBackground();
23170
23218
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
23171
23219
  const iconStyles = getIconStyles({ size: "lg", theme });
23172
- const expirationDate = useMemo11(() => {
23220
+ const expirationDate = useMemo12(() => {
23173
23221
  const { cardExpMonth, cardExpYear } = paymentMethod;
23174
23222
  if (!cardExpMonth && !cardExpYear) {
23175
23223
  return "";
@@ -23284,10 +23332,10 @@ var resolveDesignProps5 = (props) => {
23284
23332
  var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
23285
23333
  const props = resolveDesignProps5(rest);
23286
23334
  const { data, setLayout } = useEmbed();
23287
- const paymentMethod = useMemo12(() => {
23335
+ const paymentMethod = useMemo13(() => {
23288
23336
  return data.subscription?.paymentMethod || data.company?.defaultPaymentMethod;
23289
23337
  }, [data.company?.defaultPaymentMethod, data.subscription?.paymentMethod]);
23290
- const monthsToExpiration = useMemo12(() => {
23338
+ const monthsToExpiration = useMemo13(() => {
23291
23339
  let expiration;
23292
23340
  if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
23293
23341
  const today = /* @__PURE__ */ new Date();
@@ -23356,7 +23404,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
23356
23404
  }
23357
23405
  stripe._registerWrapper({
23358
23406
  name: "stripe-js",
23359
- version: "7.2.0",
23407
+ version: "7.3.0",
23360
23408
  startTime
23361
23409
  });
23362
23410
  };
@@ -23431,7 +23479,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
23431
23479
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
23432
23480
  var expectedVersion = RELEASE_TRAIN;
23433
23481
  if (isTestKey && version !== expectedVersion) {
23434
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.2.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
23482
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.3.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
23435
23483
  }
23436
23484
  var stripe = maybeStripe.apply(void 0, args);
23437
23485
  registerWrapper(stripe, startTime);
@@ -23468,7 +23516,7 @@ var loadStripe = function loadStripe2() {
23468
23516
  };
23469
23517
 
23470
23518
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
23471
- import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo13, useState as useState15 } from "react";
23519
+ import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo14, useState as useState15 } from "react";
23472
23520
  import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
23473
23521
  var resolveDesignProps6 = () => {
23474
23522
  return {
@@ -23497,7 +23545,7 @@ var PaymentMethodDetails = ({
23497
23545
  const [setupIntent, setSetupIntent] = useState15();
23498
23546
  const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState15(false);
23499
23547
  const [paymentMethod, setPaymentMethod] = useState15(data.subscription?.paymentMethod || data.company?.defaultPaymentMethod);
23500
- const monthsToExpiration = useMemo13(() => {
23548
+ const monthsToExpiration = useMemo14(() => {
23501
23549
  let expiration;
23502
23550
  if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
23503
23551
  const today = /* @__PURE__ */ new Date();
@@ -23767,8 +23815,8 @@ var PaymentMethodDetails = ({
23767
23815
  };
23768
23816
 
23769
23817
  // src/components/elements/plan-manager/PlanManager.tsx
23770
- import { forwardRef as forwardRef11, useMemo as useMemo14 } from "react";
23771
- import { Fragment as Fragment14, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
23818
+ import { forwardRef as forwardRef11, useMemo as useMemo15 } from "react";
23819
+ import { Fragment as Fragment15, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
23772
23820
  var resolveDesignProps7 = (props) => {
23773
23821
  return {
23774
23822
  header: {
@@ -23823,7 +23871,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
23823
23871
  []
23824
23872
  );
23825
23873
  const billingSubscription = data.company?.billingSubscription;
23826
- const trialEndDays = useMemo14(() => {
23874
+ const trialEndDays = useMemo15(() => {
23827
23875
  const trialEnd = billingSubscription?.trialEnd;
23828
23876
  const trialEndDate = trialEnd ? new Date(trialEnd * 1e3) : /* @__PURE__ */ new Date();
23829
23877
  const todayDate = /* @__PURE__ */ new Date();
@@ -23836,7 +23884,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
23836
23884
  const willSubscriptionCancel = billingSubscription?.cancelAtPeriodEnd;
23837
23885
  const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
23838
23886
  const headerPriceFontStyle = isUsageBasedPlan ? "heading3" : props.header.price.fontStyle;
23839
- return /* @__PURE__ */ jsxs27(Fragment14, { children: [
23887
+ return /* @__PURE__ */ jsxs27(Fragment15, { children: [
23840
23888
  isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs27(
23841
23889
  Notice,
23842
23890
  {
@@ -23981,12 +24029,12 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
23981
24029
  $gap: "1rem",
23982
24030
  children: [
23983
24031
  /* @__PURE__ */ jsxs27(Text, { display: props.addOns.fontStyle, children: [
23984
- entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ jsxs27(Fragment14, { children: [
24032
+ entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ jsxs27(Fragment15, { children: [
23985
24033
  limit,
23986
24034
  " ",
23987
24035
  getFeatureName(entitlement.feature, limit)
23988
24036
  ] }) : entitlement.feature.name,
23989
- entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs27(Fragment14, { children: [
24037
+ entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs27(Fragment15, { children: [
23990
24038
  "/",
23991
24039
  shortenPeriod(currentPlan.planPeriod)
23992
24040
  ] })
@@ -23999,7 +24047,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
23999
24047
  $color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
24000
24048
  children: typeof overageAmount === "number" && overageAmount > 0 ? t2("X additional", {
24001
24049
  amount: overageAmount
24002
- }) : /* @__PURE__ */ jsxs27(Fragment14, { children: [
24050
+ }) : /* @__PURE__ */ jsxs27(Fragment15, { children: [
24003
24051
  t2("Additional"),
24004
24052
  ":",
24005
24053
  " ",
@@ -24009,7 +24057,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
24009
24057
  ),
24010
24058
  /* @__PURE__ */ jsxs27("sub", { children: [
24011
24059
  "/",
24012
- packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment14, { children: [
24060
+ packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment15, { children: [
24013
24061
  packageSize,
24014
24062
  " "
24015
24063
  ] }),
@@ -24017,7 +24065,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
24017
24065
  entitlement.feature,
24018
24066
  packageSize
24019
24067
  ),
24020
- entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs27(Fragment14, { children: [
24068
+ entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs27(Fragment15, { children: [
24021
24069
  "/",
24022
24070
  shortenPeriod(currentPlan.planPeriod)
24023
24071
  ] })
@@ -24036,7 +24084,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
24036
24084
  ),
24037
24085
  /* @__PURE__ */ jsxs27("sub", { children: [
24038
24086
  "/",
24039
- packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment14, { children: [
24087
+ packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment15, { children: [
24040
24088
  packageSize,
24041
24089
  " "
24042
24090
  ] }),
@@ -24057,8 +24105,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
24057
24105
  ),
24058
24106
  (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ jsxs27("sub", { children: [
24059
24107
  "/",
24060
- currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : /* @__PURE__ */ jsxs27(Fragment14, { children: [
24061
- packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment14, { children: [
24108
+ currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : /* @__PURE__ */ jsxs27(Fragment15, { children: [
24109
+ packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment15, { children: [
24062
24110
  packageSize,
24063
24111
  " "
24064
24112
  ] }),
@@ -24107,7 +24155,7 @@ PlanManager.displayName = "PlanManager";
24107
24155
 
24108
24156
  // src/components/elements/pricing-table/PricingTable.tsx
24109
24157
  import { forwardRef as forwardRef12, useState as useState16 } from "react";
24110
- import { Fragment as Fragment15, jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
24158
+ import { Fragment as Fragment16, jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
24111
24159
  var resolveDesignProps8 = (props) => {
24112
24160
  return {
24113
24161
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -24418,7 +24466,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24418
24466
  $weight: theme.typography.text.fontWeight,
24419
24467
  $color: theme.typography.text.color,
24420
24468
  $leading: 1.35,
24421
- children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
24469
+ children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
24422
24470
  formatCurrency(
24423
24471
  entitlementPrice,
24424
24472
  entitlementCurrency
@@ -24426,7 +24474,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24426
24474
  " ",
24427
24475
  t2("per"),
24428
24476
  " ",
24429
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24477
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24430
24478
  entitlementPackageSize,
24431
24479
  " "
24432
24480
  ] }),
@@ -24434,18 +24482,18 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24434
24482
  entitlement.feature,
24435
24483
  entitlementPackageSize
24436
24484
  ),
24437
- entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24485
+ entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24438
24486
  " ",
24439
24487
  t2("per"),
24440
24488
  " ",
24441
24489
  selectedPeriod
24442
24490
  ] })
24443
- ] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
24491
+ ] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
24444
24492
  entitlement.valueType === "unlimited" && !entitlement.priceBehavior ? t2("Unlimited", {
24445
24493
  item: getFeatureName(
24446
24494
  entitlement.feature
24447
24495
  )
24448
- }) : typeof limit === "number" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24496
+ }) : typeof limit === "number" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24449
24497
  formatNumber(limit),
24450
24498
  " ",
24451
24499
  getFeatureName(
@@ -24453,7 +24501,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24453
24501
  limit
24454
24502
  )
24455
24503
  ] }),
24456
- entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
24504
+ entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
24457
24505
  " ",
24458
24506
  t2("per"),
24459
24507
  " ",
@@ -24463,7 +24511,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24463
24511
  current_month: "month",
24464
24512
  current_year: "year"
24465
24513
  }[entitlement.metricPeriod]
24466
- ] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24514
+ ] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24467
24515
  "/",
24468
24516
  shortenPeriod(
24469
24517
  selectedPeriod
@@ -24494,7 +24542,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24494
24542
  entitlementCurrency
24495
24543
  ),
24496
24544
  "/",
24497
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24545
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24498
24546
  entitlementPackageSize,
24499
24547
  " "
24500
24548
  ] }),
@@ -24502,7 +24550,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24502
24550
  entitlement.feature,
24503
24551
  entitlementPackageSize
24504
24552
  ),
24505
- entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24553
+ entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24506
24554
  "/",
24507
24555
  shortenPeriod(selectedPeriod)
24508
24556
  ] }),
@@ -24627,7 +24675,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24627
24675
  "Current usage exceeds the limit of this plan."
24628
24676
  )
24629
24677
  }
24630
- ) : plan.companyCanTrial ? t2("Trial plan", { days: plan.trialDays }) : t2("Choose plan")
24678
+ ) : plan.companyCanTrial ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
24631
24679
  }
24632
24680
  )
24633
24681
  ]
@@ -24641,7 +24689,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24641
24689
  }
24642
24690
  )
24643
24691
  ] }),
24644
- /* @__PURE__ */ jsx36(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24692
+ /* @__PURE__ */ jsx36(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24645
24693
  props.header.isVisible && /* @__PURE__ */ jsx36(
24646
24694
  Flex,
24647
24695
  {
@@ -24796,12 +24844,12 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24796
24844
  $size: theme.typography.text.fontSize,
24797
24845
  $weight: theme.typography.text.fontWeight,
24798
24846
  $color: theme.typography.text.color,
24799
- children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
24847
+ children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
24800
24848
  entitlement.valueType === "unlimited" ? t2("Unlimited", {
24801
24849
  item: getFeatureName(
24802
24850
  entitlement.feature
24803
24851
  )
24804
- }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24852
+ }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24805
24853
  formatNumber(
24806
24854
  entitlement.valueNumeric
24807
24855
  ),
@@ -24811,7 +24859,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
24811
24859
  entitlement.valueNumeric
24812
24860
  )
24813
24861
  ] }),
24814
- entitlement.metricPeriod && /* @__PURE__ */ jsxs28(Fragment15, { children: [
24862
+ entitlement.metricPeriod && /* @__PURE__ */ jsxs28(Fragment16, { children: [
24815
24863
  " ",
24816
24864
  t2("per"),
24817
24865
  " ",
@@ -24961,8 +25009,8 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
24961
25009
  UnsubscribeButton.displayName = "UnsubscribeButton";
24962
25010
 
24963
25011
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
24964
- import { forwardRef as forwardRef15, useMemo as useMemo15 } from "react";
24965
- import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
25012
+ import { forwardRef as forwardRef15, useMemo as useMemo16 } from "react";
25013
+ import { Fragment as Fragment17, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
24966
25014
  function resolveDesignProps11(props) {
24967
25015
  return {
24968
25016
  header: {
@@ -24987,7 +25035,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
24987
25035
  const theme = nt();
24988
25036
  const { data } = useEmbed();
24989
25037
  const isLightBackground = useIsLightBackground();
24990
- const { upcomingInvoice, discounts } = useMemo15(() => {
25038
+ const { discounts, upcomingInvoice } = useMemo16(() => {
24991
25039
  const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
24992
25040
  amountOff: discount.amountOff,
24993
25041
  couponId: discount.couponId,
@@ -24997,24 +25045,10 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
24997
25045
  }));
24998
25046
  return {
24999
25047
  discounts: discounts2,
25000
- upcomingInvoice: {
25001
- ...typeof data.upcomingInvoice?.amountDue === "number" && {
25002
- amountDue: data.upcomingInvoice.amountDue
25003
- },
25004
- ...data.subscription?.interval && {
25005
- interval: data.subscription.interval
25006
- },
25007
- ...data.upcomingInvoice?.dueDate && {
25008
- dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
25009
- },
25010
- currency: data.upcomingInvoice?.currency
25011
- }
25048
+ upcomingInvoice: data.upcomingInvoice
25012
25049
  };
25013
25050
  }, [data.subscription, data.upcomingInvoice]);
25014
- if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
25015
- return null;
25016
- }
25017
- return /* @__PURE__ */ jsxs29(
25051
+ return /* @__PURE__ */ jsx39(
25018
25052
  Element,
25019
25053
  {
25020
25054
  as: Flex,
@@ -25022,8 +25056,8 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
25022
25056
  className,
25023
25057
  $flexDirection: "column",
25024
25058
  $gap: "1rem",
25025
- children: [
25026
- props.header.isVisible && /* @__PURE__ */ jsx39(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsxs29(
25059
+ children: upcomingInvoice ? /* @__PURE__ */ jsxs29(Fragment17, { children: [
25060
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsx39(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsxs29(
25027
25061
  Text,
25028
25062
  {
25029
25063
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -25033,7 +25067,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
25033
25067
  children: [
25034
25068
  props.header.prefix,
25035
25069
  " ",
25036
- upcomingInvoice.dueDate
25070
+ toPrettyDate(upcomingInvoice.dueDate)
25037
25071
  ]
25038
25072
  }
25039
25073
  ) }),
@@ -25075,41 +25109,49 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
25075
25109
  children: t2("Discount")
25076
25110
  }
25077
25111
  ) }),
25078
- /* @__PURE__ */ jsx39(Box, { children: discounts.map((discount) => /* @__PURE__ */ jsxs29(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
25079
- /* @__PURE__ */ jsx39(
25080
- Flex,
25081
- {
25082
- $alignItems: "center",
25083
- $padding: "0.1875rem 0.375rem",
25084
- $borderWidth: "1px",
25085
- $borderStyle: "solid",
25086
- $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
25087
- $borderRadius: "0.3125rem",
25088
- children: /* @__PURE__ */ jsx39(
25112
+ /* @__PURE__ */ jsx39(Box, { children: discounts.map((discount) => /* @__PURE__ */ jsxs29(
25113
+ Flex,
25114
+ {
25115
+ $alignItems: "center",
25116
+ $gap: "0.5rem",
25117
+ children: [
25118
+ /* @__PURE__ */ jsx39(
25119
+ Flex,
25120
+ {
25121
+ $alignItems: "center",
25122
+ $padding: "0.1875rem 0.375rem",
25123
+ $borderWidth: "1px",
25124
+ $borderStyle: "solid",
25125
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
25126
+ $borderRadius: "0.3125rem",
25127
+ children: /* @__PURE__ */ jsx39(
25128
+ Text,
25129
+ {
25130
+ $font: theme.typography.text.fontFamily,
25131
+ $size: 0.75 * theme.typography.text.fontSize,
25132
+ $weight: theme.typography.text.fontWeight,
25133
+ $color: theme.typography.text.color,
25134
+ children: discount.customerFacingCode
25135
+ }
25136
+ )
25137
+ }
25138
+ ),
25139
+ /* @__PURE__ */ jsx39(Box, { children: /* @__PURE__ */ jsx39(
25089
25140
  Text,
25090
25141
  {
25091
25142
  $font: theme.typography.text.fontFamily,
25092
- $size: 0.75 * theme.typography.text.fontSize,
25143
+ $size: theme.typography.text.fontSize,
25093
25144
  $weight: theme.typography.text.fontWeight,
25094
25145
  $color: theme.typography.text.color,
25095
- children: discount.customerFacingCode
25146
+ children: t2("Percent off", { percent: discount.percentOff })
25096
25147
  }
25097
- )
25098
- }
25099
- ),
25100
- /* @__PURE__ */ jsx39(Box, { children: /* @__PURE__ */ jsx39(
25101
- Text,
25102
- {
25103
- $font: theme.typography.text.fontFamily,
25104
- $size: theme.typography.text.fontSize,
25105
- $weight: theme.typography.text.fontWeight,
25106
- $color: theme.typography.text.color,
25107
- children: t2("Percent off", { percent: discount.percentOff })
25108
- }
25109
- ) })
25110
- ] }, discount.couponId)) })
25148
+ ) })
25149
+ ]
25150
+ },
25151
+ discount.couponId
25152
+ )) })
25111
25153
  ] })
25112
- ]
25154
+ ] }) : /* @__PURE__ */ jsx39(Text, { display: "heading2", children: t2("No upcoming invoice") })
25113
25155
  }
25114
25156
  );
25115
25157
  });
@@ -25167,7 +25209,7 @@ function createRenderer(options2) {
25167
25209
  }
25168
25210
 
25169
25211
  // src/components/embed/ComponentTree.tsx
25170
- import { Fragment as Fragment16, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
25212
+ import { Fragment as Fragment18, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
25171
25213
  var Loading = () => {
25172
25214
  const theme = nt();
25173
25215
  return /* @__PURE__ */ jsx40(
@@ -25235,7 +25277,7 @@ var ComponentTree = () => {
25235
25277
  if (isPending) {
25236
25278
  return /* @__PURE__ */ jsx40(Loading, {});
25237
25279
  }
25238
- return /* @__PURE__ */ jsx40(Fragment16, { children });
25280
+ return /* @__PURE__ */ jsx40(Fragment18, { children });
25239
25281
  };
25240
25282
 
25241
25283
  // src/components/embed/Embed.tsx