@schematichq/schematic-components 0.7.14 → 0.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-components.cjs.js +260 -306
- package/dist/schematic-components.d.ts +41 -1
- package/dist/schematic-components.esm.js +296 -342
- package/package.json +1 -1
|
@@ -7801,8 +7801,7 @@ var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
|
|
|
7801
7801
|
}
|
|
7802
7802
|
return matched;
|
|
7803
7803
|
};
|
|
7804
|
-
var deepFind =
|
|
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((
|
|
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((
|
|
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
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
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
|
-
|
|
8010
|
-
|
|
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
|
-
|
|
8026
|
-
|
|
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
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
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,10 +8086,9 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8112
8086
|
changeLanguage(lng) {
|
|
8113
8087
|
if (lng) this.language = lng;
|
|
8114
8088
|
}
|
|
8115
|
-
exists(key
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
};
|
|
8089
|
+
exists(key, o2 = {
|
|
8090
|
+
interpolation: {}
|
|
8091
|
+
}) {
|
|
8119
8092
|
const opt = {
|
|
8120
8093
|
...o2
|
|
8121
8094
|
};
|
|
@@ -8167,11 +8140,12 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8167
8140
|
namespaces
|
|
8168
8141
|
} = this.extractFromKey(keys[keys.length - 1], opt);
|
|
8169
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 = ":";
|
|
8170
8145
|
const lng = opt.lng || this.language;
|
|
8171
8146
|
const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
8172
8147
|
if (lng?.toLowerCase() === "cimode") {
|
|
8173
8148
|
if (appendNamespaceToCIMode) {
|
|
8174
|
-
const nsSeparator = opt.nsSeparator || this.options.nsSeparator;
|
|
8175
8149
|
if (returnDetails) {
|
|
8176
8150
|
return {
|
|
8177
8151
|
res: `${namespace}${nsSeparator}${key}`,
|
|
@@ -8326,9 +8300,11 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8326
8300
|
}
|
|
8327
8301
|
}
|
|
8328
8302
|
res = this.extendTranslation(res, keys, opt, resolved, lastKey);
|
|
8329
|
-
if (usedKey && res === key && this.options.appendNamespaceToMissingKey)
|
|
8303
|
+
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
|
|
8304
|
+
res = `${namespace}${nsSeparator}${key}`;
|
|
8305
|
+
}
|
|
8330
8306
|
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
8331
|
-
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}
|
|
8307
|
+
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : void 0, opt);
|
|
8332
8308
|
}
|
|
8333
8309
|
}
|
|
8334
8310
|
if (returnDetails) {
|
|
@@ -8339,7 +8315,6 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8339
8315
|
return res;
|
|
8340
8316
|
}
|
|
8341
8317
|
extendTranslation(res, key, opt, resolved, lastKey) {
|
|
8342
|
-
var _this = this;
|
|
8343
8318
|
if (this.i18nFormat?.parse) {
|
|
8344
8319
|
res = this.i18nFormat.parse(res, {
|
|
8345
8320
|
...this.options.interpolation.defaultVariables,
|
|
@@ -8375,15 +8350,12 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8375
8350
|
if (nestBef < nestAft) opt.nest = false;
|
|
8376
8351
|
}
|
|
8377
8352
|
if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
|
|
8378
|
-
if (opt.nest !== false) res = this.interpolator.nest(res,
|
|
8379
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8380
|
-
args[_key] = arguments[_key];
|
|
8381
|
-
}
|
|
8353
|
+
if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
|
|
8382
8354
|
if (lastKey?.[0] === args[0] && !opt.context) {
|
|
8383
|
-
|
|
8355
|
+
this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
|
|
8384
8356
|
return null;
|
|
8385
8357
|
}
|
|
8386
|
-
return
|
|
8358
|
+
return this.translate(...args, key);
|
|
8387
8359
|
}, opt);
|
|
8388
8360
|
if (opt.interpolation) this.interpolator.reset();
|
|
8389
8361
|
}
|
|
@@ -8400,8 +8372,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8400
8372
|
}
|
|
8401
8373
|
return res;
|
|
8402
8374
|
}
|
|
8403
|
-
resolve(keys) {
|
|
8404
|
-
let opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8375
|
+
resolve(keys, opt = {}) {
|
|
8405
8376
|
let found;
|
|
8406
8377
|
let usedKey;
|
|
8407
8378
|
let exactUsedKey;
|
|
@@ -8481,13 +8452,11 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8481
8452
|
isValidLookup(res) {
|
|
8482
8453
|
return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
|
|
8483
8454
|
}
|
|
8484
|
-
getResource(code, ns, key) {
|
|
8485
|
-
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
8455
|
+
getResource(code, ns, key, options2 = {}) {
|
|
8486
8456
|
if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options2);
|
|
8487
8457
|
return this.resourceStore.getResource(code, ns, key, options2);
|
|
8488
8458
|
}
|
|
8489
|
-
getUsedParamsDetails() {
|
|
8490
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8459
|
+
getUsedParamsDetails(options2 = {}) {
|
|
8491
8460
|
const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
|
|
8492
8461
|
const useOptionsReplaceForData = options2.replace && !isString(options2.replace);
|
|
8493
8462
|
let data = useOptionsReplaceForData ? options2.replace : options2;
|
|
@@ -8643,8 +8612,7 @@ var dummyRule = {
|
|
|
8643
8612
|
})
|
|
8644
8613
|
};
|
|
8645
8614
|
var PluralResolver = class {
|
|
8646
|
-
constructor(languageUtils) {
|
|
8647
|
-
let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8615
|
+
constructor(languageUtils, options2 = {}) {
|
|
8648
8616
|
this.languageUtils = languageUtils;
|
|
8649
8617
|
this.options = options2;
|
|
8650
8618
|
this.logger = baseLogger.create("pluralResolver");
|
|
@@ -8656,8 +8624,7 @@ var PluralResolver = class {
|
|
|
8656
8624
|
clearCache() {
|
|
8657
8625
|
this.pluralRulesCache = {};
|
|
8658
8626
|
}
|
|
8659
|
-
getRule(code) {
|
|
8660
|
-
let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8627
|
+
getRule(code, options2 = {}) {
|
|
8661
8628
|
const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
|
|
8662
8629
|
const type = options2.ordinal ? "ordinal" : "cardinal";
|
|
8663
8630
|
const cacheKey = JSON.stringify({
|
|
@@ -8684,25 +8651,21 @@ var PluralResolver = class {
|
|
|
8684
8651
|
this.pluralRulesCache[cacheKey] = rule;
|
|
8685
8652
|
return rule;
|
|
8686
8653
|
}
|
|
8687
|
-
needsPlural(code) {
|
|
8688
|
-
let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8654
|
+
needsPlural(code, options2 = {}) {
|
|
8689
8655
|
let rule = this.getRule(code, options2);
|
|
8690
8656
|
if (!rule) rule = this.getRule("dev", options2);
|
|
8691
8657
|
return rule?.resolvedOptions().pluralCategories.length > 1;
|
|
8692
8658
|
}
|
|
8693
|
-
getPluralFormsOfKey(code, key) {
|
|
8694
|
-
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8659
|
+
getPluralFormsOfKey(code, key, options2 = {}) {
|
|
8695
8660
|
return this.getSuffixes(code, options2).map((suffix) => `${key}${suffix}`);
|
|
8696
8661
|
}
|
|
8697
|
-
getSuffixes(code) {
|
|
8698
|
-
let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8662
|
+
getSuffixes(code, options2 = {}) {
|
|
8699
8663
|
let rule = this.getRule(code, options2);
|
|
8700
8664
|
if (!rule) rule = this.getRule("dev", options2);
|
|
8701
8665
|
if (!rule) return [];
|
|
8702
8666
|
return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
|
|
8703
8667
|
}
|
|
8704
|
-
getSuffix(code, count) {
|
|
8705
|
-
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8668
|
+
getSuffix(code, count, options2 = {}) {
|
|
8706
8669
|
const rule = this.getRule(code, options2);
|
|
8707
8670
|
if (rule) {
|
|
8708
8671
|
return `${this.options.prepend}${options2.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
|
|
@@ -8711,9 +8674,7 @@ var PluralResolver = class {
|
|
|
8711
8674
|
return this.getSuffix("dev", count, options2);
|
|
8712
8675
|
}
|
|
8713
8676
|
};
|
|
8714
|
-
var deepFindWithDefaults =
|
|
8715
|
-
let keySeparator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".";
|
|
8716
|
-
let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
|
|
8677
|
+
var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
|
|
8717
8678
|
let path = getPathWithDefaults(data, defaultData, key);
|
|
8718
8679
|
if (!path && ignoreJSONStructure && isString(key)) {
|
|
8719
8680
|
path = deepFind(data, key, keySeparator);
|
|
@@ -8723,15 +8684,13 @@ var deepFindWithDefaults = function(data, defaultData, key) {
|
|
|
8723
8684
|
};
|
|
8724
8685
|
var regexSafe = (val) => val.replace(/\$/g, "$$$$");
|
|
8725
8686
|
var Interpolator = class {
|
|
8726
|
-
constructor() {
|
|
8727
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8687
|
+
constructor(options2 = {}) {
|
|
8728
8688
|
this.logger = baseLogger.create("interpolator");
|
|
8729
8689
|
this.options = options2;
|
|
8730
8690
|
this.format = options2?.interpolation?.format || ((value) => value);
|
|
8731
8691
|
this.init(options2);
|
|
8732
8692
|
}
|
|
8733
|
-
init() {
|
|
8734
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8693
|
+
init(options2 = {}) {
|
|
8735
8694
|
if (!options2.interpolation) options2.interpolation = {
|
|
8736
8695
|
escapeValue: true
|
|
8737
8696
|
};
|
|
@@ -8854,8 +8813,7 @@ var Interpolator = class {
|
|
|
8854
8813
|
});
|
|
8855
8814
|
return str;
|
|
8856
8815
|
}
|
|
8857
|
-
nest(str, fc) {
|
|
8858
|
-
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8816
|
+
nest(str, fc, options2 = {}) {
|
|
8859
8817
|
let match2;
|
|
8860
8818
|
let value;
|
|
8861
8819
|
let clonedOptions;
|
|
@@ -8951,68 +8909,68 @@ var parseFormatStr = (formatStr) => {
|
|
|
8951
8909
|
};
|
|
8952
8910
|
var createCachedFormatter = (fn) => {
|
|
8953
8911
|
const cache = {};
|
|
8954
|
-
return (
|
|
8955
|
-
let optForCache =
|
|
8956
|
-
if (
|
|
8912
|
+
return (v2, l2, o2) => {
|
|
8913
|
+
let optForCache = o2;
|
|
8914
|
+
if (o2 && o2.interpolationkey && o2.formatParams && o2.formatParams[o2.interpolationkey] && o2[o2.interpolationkey]) {
|
|
8957
8915
|
optForCache = {
|
|
8958
8916
|
...optForCache,
|
|
8959
|
-
[
|
|
8917
|
+
[o2.interpolationkey]: void 0
|
|
8960
8918
|
};
|
|
8961
8919
|
}
|
|
8962
|
-
const key =
|
|
8963
|
-
let
|
|
8964
|
-
if (!
|
|
8965
|
-
|
|
8966
|
-
cache[key] =
|
|
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;
|
|
8967
8925
|
}
|
|
8968
|
-
return
|
|
8926
|
+
return frm(v2);
|
|
8969
8927
|
};
|
|
8970
8928
|
};
|
|
8929
|
+
var createNonCachedFormatter = (fn) => (v2, l2, o2) => fn(getCleanedCode(l2), o2)(v2);
|
|
8971
8930
|
var Formatter = class {
|
|
8972
|
-
constructor() {
|
|
8973
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8931
|
+
constructor(options2 = {}) {
|
|
8974
8932
|
this.logger = baseLogger.create("formatter");
|
|
8975
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;
|
|
8976
8941
|
this.formats = {
|
|
8977
|
-
number:
|
|
8942
|
+
number: cf((lng, opt) => {
|
|
8978
8943
|
const formatter = new Intl.NumberFormat(lng, {
|
|
8979
8944
|
...opt
|
|
8980
8945
|
});
|
|
8981
8946
|
return (val) => formatter.format(val);
|
|
8982
8947
|
}),
|
|
8983
|
-
currency:
|
|
8948
|
+
currency: cf((lng, opt) => {
|
|
8984
8949
|
const formatter = new Intl.NumberFormat(lng, {
|
|
8985
8950
|
...opt,
|
|
8986
8951
|
style: "currency"
|
|
8987
8952
|
});
|
|
8988
8953
|
return (val) => formatter.format(val);
|
|
8989
8954
|
}),
|
|
8990
|
-
datetime:
|
|
8955
|
+
datetime: cf((lng, opt) => {
|
|
8991
8956
|
const formatter = new Intl.DateTimeFormat(lng, {
|
|
8992
8957
|
...opt
|
|
8993
8958
|
});
|
|
8994
8959
|
return (val) => formatter.format(val);
|
|
8995
8960
|
}),
|
|
8996
|
-
relativetime:
|
|
8961
|
+
relativetime: cf((lng, opt) => {
|
|
8997
8962
|
const formatter = new Intl.RelativeTimeFormat(lng, {
|
|
8998
8963
|
...opt
|
|
8999
8964
|
});
|
|
9000
8965
|
return (val) => formatter.format(val, opt.range || "day");
|
|
9001
8966
|
}),
|
|
9002
|
-
list:
|
|
8967
|
+
list: cf((lng, opt) => {
|
|
9003
8968
|
const formatter = new Intl.ListFormat(lng, {
|
|
9004
8969
|
...opt
|
|
9005
8970
|
});
|
|
9006
8971
|
return (val) => formatter.format(val);
|
|
9007
8972
|
})
|
|
9008
8973
|
};
|
|
9009
|
-
this.init(options2);
|
|
9010
|
-
}
|
|
9011
|
-
init(services) {
|
|
9012
|
-
let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
9013
|
-
interpolation: {}
|
|
9014
|
-
};
|
|
9015
|
-
this.formatSeparator = options2.interpolation.formatSeparator || ",";
|
|
9016
8974
|
}
|
|
9017
8975
|
add(name, fc) {
|
|
9018
8976
|
this.formats[name.toLowerCase().trim()] = fc;
|
|
@@ -9020,8 +8978,7 @@ var Formatter = class {
|
|
|
9020
8978
|
addCached(name, fc) {
|
|
9021
8979
|
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
9022
8980
|
}
|
|
9023
|
-
format(value, format, lng) {
|
|
9024
|
-
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
8981
|
+
format(value, format, lng, options2 = {}) {
|
|
9025
8982
|
const formats = format.split(this.formatSeparator);
|
|
9026
8983
|
if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
|
|
9027
8984
|
const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
|
|
@@ -9061,8 +9018,7 @@ var removePending = (q2, name) => {
|
|
|
9061
9018
|
}
|
|
9062
9019
|
};
|
|
9063
9020
|
var Connector = class extends EventEmitter {
|
|
9064
|
-
constructor(backend, store, services) {
|
|
9065
|
-
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
9021
|
+
constructor(backend, store, services, options2 = {}) {
|
|
9066
9022
|
super();
|
|
9067
9023
|
this.backend = backend;
|
|
9068
9024
|
this.store = store;
|
|
@@ -9157,10 +9113,7 @@ var Connector = class extends EventEmitter {
|
|
|
9157
9113
|
this.emit("loaded", loaded);
|
|
9158
9114
|
this.queue = this.queue.filter((q2) => !q2.done);
|
|
9159
9115
|
}
|
|
9160
|
-
read(lng, ns, fcName) {
|
|
9161
|
-
let tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
|
|
9162
|
-
let wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout;
|
|
9163
|
-
let callback = arguments.length > 5 ? arguments[5] : void 0;
|
|
9116
|
+
read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
|
|
9164
9117
|
if (!lng.length) return callback(null, {});
|
|
9165
9118
|
if (this.readingCalls >= this.maxParallelReads) {
|
|
9166
9119
|
this.waitingReads.push({
|
|
@@ -9204,9 +9157,7 @@ var Connector = class extends EventEmitter {
|
|
|
9204
9157
|
}
|
|
9205
9158
|
return fc(lng, ns, resolver);
|
|
9206
9159
|
}
|
|
9207
|
-
prepareLoading(languages, namespaces) {
|
|
9208
|
-
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
9209
|
-
let callback = arguments.length > 3 ? arguments[3] : void 0;
|
|
9160
|
+
prepareLoading(languages, namespaces, options2 = {}, callback) {
|
|
9210
9161
|
if (!this.backend) {
|
|
9211
9162
|
this.logger.warn("No backend was added via i18next.use. Will not load resources.");
|
|
9212
9163
|
return callback && callback();
|
|
@@ -9230,8 +9181,7 @@ var Connector = class extends EventEmitter {
|
|
|
9230
9181
|
reload: true
|
|
9231
9182
|
}, callback);
|
|
9232
9183
|
}
|
|
9233
|
-
loadOne(name) {
|
|
9234
|
-
let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
9184
|
+
loadOne(name, prefix2 = "") {
|
|
9235
9185
|
const s2 = name.split("|");
|
|
9236
9186
|
const lng = s2[0];
|
|
9237
9187
|
const ns = s2[1];
|
|
@@ -9241,10 +9191,8 @@ var Connector = class extends EventEmitter {
|
|
|
9241
9191
|
this.loaded(name, err2, data);
|
|
9242
9192
|
});
|
|
9243
9193
|
}
|
|
9244
|
-
saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
9245
|
-
|
|
9246
|
-
let clb = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
|
|
9247
|
-
};
|
|
9194
|
+
saveMissing(languages, namespace, key, fallbackValue, isUpdate, options2 = {}, clb = () => {
|
|
9195
|
+
}) {
|
|
9248
9196
|
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
|
|
9249
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!!!");
|
|
9250
9198
|
return;
|
|
@@ -9338,7 +9286,8 @@ var get = () => ({
|
|
|
9338
9286
|
nestingOptionsSeparator: ",",
|
|
9339
9287
|
maxReplaces: 1e3,
|
|
9340
9288
|
skipOnVariables: true
|
|
9341
|
-
}
|
|
9289
|
+
},
|
|
9290
|
+
cacheInBuiltFormats: true
|
|
9342
9291
|
});
|
|
9343
9292
|
var transformOptions = (options2) => {
|
|
9344
9293
|
if (isString(options2.ns)) options2.ns = [options2.ns];
|
|
@@ -9361,9 +9310,7 @@ var bindMemberFunctions = (inst) => {
|
|
|
9361
9310
|
});
|
|
9362
9311
|
};
|
|
9363
9312
|
var I18n = class _I18n extends EventEmitter {
|
|
9364
|
-
constructor() {
|
|
9365
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
9366
|
-
let callback = arguments.length > 1 ? arguments[1] : void 0;
|
|
9313
|
+
constructor(options2 = {}, callback) {
|
|
9367
9314
|
super();
|
|
9368
9315
|
this.options = transformOptions(options2);
|
|
9369
9316
|
this.services = {};
|
|
@@ -9382,10 +9329,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9382
9329
|
}, 0);
|
|
9383
9330
|
}
|
|
9384
9331
|
}
|
|
9385
|
-
init() {
|
|
9386
|
-
var _this = this;
|
|
9387
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
9388
|
-
let callback = arguments.length > 1 ? arguments[1] : void 0;
|
|
9332
|
+
init(options2 = {}, callback) {
|
|
9389
9333
|
this.isInitializing = true;
|
|
9390
9334
|
if (typeof options2 === "function") {
|
|
9391
9335
|
callback = options2;
|
|
@@ -9451,11 +9395,8 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9451
9395
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
9452
9396
|
};
|
|
9453
9397
|
s2.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s2.resourceStore, s2, this.options);
|
|
9454
|
-
s2.backendConnector.on("*",
|
|
9455
|
-
|
|
9456
|
-
args[_key - 1] = arguments[_key];
|
|
9457
|
-
}
|
|
9458
|
-
_this.emit(event, ...args);
|
|
9398
|
+
s2.backendConnector.on("*", (event, ...args) => {
|
|
9399
|
+
this.emit(event, ...args);
|
|
9459
9400
|
});
|
|
9460
9401
|
if (this.modules.languageDetector) {
|
|
9461
9402
|
s2.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
@@ -9466,11 +9407,8 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9466
9407
|
if (s2.i18nFormat.init) s2.i18nFormat.init(this);
|
|
9467
9408
|
}
|
|
9468
9409
|
this.translator = new Translator(this.services, this.options);
|
|
9469
|
-
this.translator.on("*",
|
|
9470
|
-
|
|
9471
|
-
args[_key2 - 1] = arguments[_key2];
|
|
9472
|
-
}
|
|
9473
|
-
_this.emit(event, ...args);
|
|
9410
|
+
this.translator.on("*", (event, ...args) => {
|
|
9411
|
+
this.emit(event, ...args);
|
|
9474
9412
|
});
|
|
9475
9413
|
this.modules.external.forEach((m2) => {
|
|
9476
9414
|
if (m2.init) m2.init(this);
|
|
@@ -9487,15 +9425,13 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9487
9425
|
}
|
|
9488
9426
|
const storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
|
|
9489
9427
|
storeApi.forEach((fcName) => {
|
|
9490
|
-
this[fcName] =
|
|
9491
|
-
return _this.store[fcName](...arguments);
|
|
9492
|
-
};
|
|
9428
|
+
this[fcName] = (...args) => this.store[fcName](...args);
|
|
9493
9429
|
});
|
|
9494
9430
|
const storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
|
|
9495
9431
|
storeApiChained.forEach((fcName) => {
|
|
9496
|
-
this[fcName] =
|
|
9497
|
-
|
|
9498
|
-
return
|
|
9432
|
+
this[fcName] = (...args) => {
|
|
9433
|
+
this.store[fcName](...args);
|
|
9434
|
+
return this;
|
|
9499
9435
|
};
|
|
9500
9436
|
});
|
|
9501
9437
|
const deferred = defer();
|
|
@@ -9519,8 +9455,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9519
9455
|
}
|
|
9520
9456
|
return deferred;
|
|
9521
9457
|
}
|
|
9522
|
-
loadResources(language) {
|
|
9523
|
-
let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
9458
|
+
loadResources(language, callback = noop) {
|
|
9524
9459
|
let usedCallback = callback;
|
|
9525
9460
|
const usedLng = isString(language) ? language : this.language;
|
|
9526
9461
|
if (typeof language === "function") usedCallback = language;
|
|
@@ -9613,7 +9548,6 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9613
9548
|
}
|
|
9614
9549
|
}
|
|
9615
9550
|
changeLanguage(lng, callback) {
|
|
9616
|
-
var _this2 = this;
|
|
9617
9551
|
this.isLanguageChangingTo = lng;
|
|
9618
9552
|
const deferred = defer();
|
|
9619
9553
|
this.emit("languageChanging", lng);
|
|
@@ -9635,12 +9569,8 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9635
9569
|
} else {
|
|
9636
9570
|
this.isLanguageChangingTo = void 0;
|
|
9637
9571
|
}
|
|
9638
|
-
deferred.resolve(
|
|
9639
|
-
|
|
9640
|
-
});
|
|
9641
|
-
if (callback) callback(err2, function() {
|
|
9642
|
-
return _this2.t(...arguments);
|
|
9643
|
-
});
|
|
9572
|
+
deferred.resolve((...args) => this.t(...args));
|
|
9573
|
+
if (callback) callback(err2, (...args) => this.t(...args));
|
|
9644
9574
|
};
|
|
9645
9575
|
const setLng = (lngs) => {
|
|
9646
9576
|
if (!lng && !lngs && this.services.languageDetector) lngs = [];
|
|
@@ -9671,14 +9601,10 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9671
9601
|
return deferred;
|
|
9672
9602
|
}
|
|
9673
9603
|
getFixedT(lng, ns, keyPrefix) {
|
|
9674
|
-
|
|
9675
|
-
const fixedT = function(key, opts) {
|
|
9604
|
+
const fixedT = (key, opts, ...rest) => {
|
|
9676
9605
|
let o2;
|
|
9677
9606
|
if (typeof opts !== "object") {
|
|
9678
|
-
|
|
9679
|
-
rest[_key3 - 2] = arguments[_key3];
|
|
9680
|
-
}
|
|
9681
|
-
o2 = _this3.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
9607
|
+
o2 = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
9682
9608
|
} else {
|
|
9683
9609
|
o2 = {
|
|
9684
9610
|
...opts
|
|
@@ -9688,14 +9614,14 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9688
9614
|
o2.lngs = o2.lngs || fixedT.lngs;
|
|
9689
9615
|
o2.ns = o2.ns || fixedT.ns;
|
|
9690
9616
|
if (o2.keyPrefix !== "") o2.keyPrefix = o2.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
9691
|
-
const keySeparator =
|
|
9617
|
+
const keySeparator = this.options.keySeparator || ".";
|
|
9692
9618
|
let resultKey;
|
|
9693
9619
|
if (o2.keyPrefix && Array.isArray(key)) {
|
|
9694
9620
|
resultKey = key.map((k2) => `${o2.keyPrefix}${keySeparator}${k2}`);
|
|
9695
9621
|
} else {
|
|
9696
9622
|
resultKey = o2.keyPrefix ? `${o2.keyPrefix}${keySeparator}${key}` : key;
|
|
9697
9623
|
}
|
|
9698
|
-
return
|
|
9624
|
+
return this.t(resultKey, o2);
|
|
9699
9625
|
};
|
|
9700
9626
|
if (isString(lng)) {
|
|
9701
9627
|
fixedT.lng = lng;
|
|
@@ -9706,23 +9632,16 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9706
9632
|
fixedT.keyPrefix = keyPrefix;
|
|
9707
9633
|
return fixedT;
|
|
9708
9634
|
}
|
|
9709
|
-
t() {
|
|
9710
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
9711
|
-
args[_key4] = arguments[_key4];
|
|
9712
|
-
}
|
|
9635
|
+
t(...args) {
|
|
9713
9636
|
return this.translator?.translate(...args);
|
|
9714
9637
|
}
|
|
9715
|
-
exists() {
|
|
9716
|
-
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
9717
|
-
args[_key5] = arguments[_key5];
|
|
9718
|
-
}
|
|
9638
|
+
exists(...args) {
|
|
9719
9639
|
return this.translator?.exists(...args);
|
|
9720
9640
|
}
|
|
9721
9641
|
setDefaultNamespace(ns) {
|
|
9722
9642
|
this.options.defaultNS = ns;
|
|
9723
9643
|
}
|
|
9724
|
-
hasLoadedNamespace(ns) {
|
|
9725
|
-
let options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
9644
|
+
hasLoadedNamespace(ns, options2 = {}) {
|
|
9726
9645
|
if (!this.isInitialized) {
|
|
9727
9646
|
this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
|
|
9728
9647
|
return false;
|
|
@@ -9787,14 +9706,10 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9787
9706
|
const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
|
|
9788
9707
|
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
9789
9708
|
}
|
|
9790
|
-
static createInstance() {
|
|
9791
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
9792
|
-
let callback = arguments.length > 1 ? arguments[1] : void 0;
|
|
9709
|
+
static createInstance(options2 = {}, callback) {
|
|
9793
9710
|
return new _I18n(options2, callback);
|
|
9794
9711
|
}
|
|
9795
|
-
cloneInstance() {
|
|
9796
|
-
let options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
9797
|
-
let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
9712
|
+
cloneInstance(options2 = {}, callback = noop) {
|
|
9798
9713
|
const forkResourceStore = options2.forkResourceStore;
|
|
9799
9714
|
if (forkResourceStore) delete options2.forkResourceStore;
|
|
9800
9715
|
const mergedOptions = {
|
|
@@ -9835,10 +9750,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9835
9750
|
clone.services.resourceStore = clone.store;
|
|
9836
9751
|
}
|
|
9837
9752
|
clone.translator = new Translator(clone.services, mergedOptions);
|
|
9838
|
-
clone.translator.on("*",
|
|
9839
|
-
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
9840
|
-
args[_key6 - 1] = arguments[_key6];
|
|
9841
|
-
}
|
|
9753
|
+
clone.translator.on("*", (event, ...args) => {
|
|
9842
9754
|
clone.emit(event, ...args);
|
|
9843
9755
|
});
|
|
9844
9756
|
clone.init(mergedOptions, callback);
|
|
@@ -15501,6 +15413,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
15501
15413
|
chargeType: json["charge_type"],
|
|
15502
15414
|
companyCanTrial: json["company_can_trial"],
|
|
15503
15415
|
companyCount: json["company_count"],
|
|
15416
|
+
controlledBy: json["controlled_by"],
|
|
15504
15417
|
createdAt: new Date(json["created_at"]),
|
|
15505
15418
|
current: json["current"],
|
|
15506
15419
|
custom: json["custom"],
|
|
@@ -15586,6 +15499,7 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
15586
15499
|
billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON(json["billing_product"]),
|
|
15587
15500
|
chargeType: json["charge_type"],
|
|
15588
15501
|
companyCount: json["company_count"],
|
|
15502
|
+
controlledBy: json["controlled_by"],
|
|
15589
15503
|
createdAt: new Date(json["created_at"]),
|
|
15590
15504
|
description: json["description"],
|
|
15591
15505
|
features: json["features"].map(
|
|
@@ -15732,31 +15646,45 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
15732
15646
|
};
|
|
15733
15647
|
}
|
|
15734
15648
|
|
|
15735
|
-
// src/api/checkoutexternal/models/
|
|
15736
|
-
function
|
|
15737
|
-
return
|
|
15649
|
+
// src/api/checkoutexternal/models/SetupIntentResponseData.ts
|
|
15650
|
+
function SetupIntentResponseDataFromJSON(json) {
|
|
15651
|
+
return SetupIntentResponseDataFromJSONTyped(json, false);
|
|
15738
15652
|
}
|
|
15739
|
-
function
|
|
15653
|
+
function SetupIntentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
15740
15654
|
if (json == null) {
|
|
15741
15655
|
return json;
|
|
15742
15656
|
}
|
|
15743
15657
|
return {
|
|
15744
|
-
|
|
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"]),
|
|
15745
15673
|
params: json["params"]
|
|
15746
15674
|
};
|
|
15747
15675
|
}
|
|
15748
15676
|
|
|
15749
|
-
// src/api/checkoutexternal/models/
|
|
15750
|
-
function
|
|
15751
|
-
return
|
|
15677
|
+
// src/api/checkoutexternal/models/DeletePaymentMethodResponse.ts
|
|
15678
|
+
function DeletePaymentMethodResponseFromJSON(json) {
|
|
15679
|
+
return DeletePaymentMethodResponseFromJSONTyped(json, false);
|
|
15752
15680
|
}
|
|
15753
|
-
function
|
|
15681
|
+
function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
15754
15682
|
if (json == null) {
|
|
15755
15683
|
return json;
|
|
15756
15684
|
}
|
|
15757
15685
|
return {
|
|
15758
|
-
|
|
15759
|
-
|
|
15686
|
+
data: DeleteResponseFromJSON(json["data"]),
|
|
15687
|
+
params: json["params"]
|
|
15760
15688
|
};
|
|
15761
15689
|
}
|
|
15762
15690
|
|
|
@@ -16006,6 +15934,38 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
16006
15934
|
const response = await this.checkoutUnsubscribeRaw(initOverrides);
|
|
16007
15935
|
return await response.value();
|
|
16008
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
|
+
}
|
|
16009
15969
|
/**
|
|
16010
15970
|
* Delete payment method
|
|
16011
15971
|
*/
|
|
@@ -16369,8 +16329,10 @@ var en_default = {
|
|
|
16369
16329
|
"Manage plan": "Manage plan",
|
|
16370
16330
|
Monthly: "Monthly",
|
|
16371
16331
|
Next: "Next",
|
|
16332
|
+
"No invoices created yet": "No invoices created yet",
|
|
16372
16333
|
"No limit": "No limit",
|
|
16373
16334
|
"No payment method added yet": "No payment method added yet",
|
|
16335
|
+
"No upcoming invoice": "No upcoming invoice",
|
|
16374
16336
|
"Not ready to cancel?": "Not ready to cancel?",
|
|
16375
16337
|
"On demand": "On demand",
|
|
16376
16338
|
"One time ": "One time",
|
|
@@ -17105,7 +17067,7 @@ var EmbedProvider = ({
|
|
|
17105
17067
|
useEffect2(() => {
|
|
17106
17068
|
if (accessToken) {
|
|
17107
17069
|
const { headers = {} } = apiConfig ?? {};
|
|
17108
|
-
headers["X-Schematic-Components-Version"] = "0.7.
|
|
17070
|
+
headers["X-Schematic-Components-Version"] = "0.7.15";
|
|
17109
17071
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
17110
17072
|
const config = new Configuration({
|
|
17111
17073
|
...apiConfig,
|
|
@@ -17232,7 +17194,7 @@ var Box = dt.div((props) => {
|
|
|
17232
17194
|
function reducer(acc, [key, value]) {
|
|
17233
17195
|
if (key.startsWith("$") && !["$viewport"].includes(key)) {
|
|
17234
17196
|
acc.push(
|
|
17235
|
-
// keys
|
|
17197
|
+
// keys should always be CSS properties
|
|
17236
17198
|
attr(camelToHyphen(key.slice(1)), value)
|
|
17237
17199
|
);
|
|
17238
17200
|
}
|
|
@@ -17242,11 +17204,11 @@ var Box = dt.div((props) => {
|
|
|
17242
17204
|
for (const [key, value] of Object.entries(props.$viewport || {})) {
|
|
17243
17205
|
styles.push(lt`
|
|
17244
17206
|
${{
|
|
17245
|
-
sm: "@
|
|
17246
|
-
md: "@
|
|
17247
|
-
lg: "@
|
|
17248
|
-
xl: "@
|
|
17249
|
-
"2xl": "@
|
|
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)"
|
|
17250
17212
|
}[key] || key} {
|
|
17251
17213
|
${Object.entries(value || {}).reduce(reducer, [])}
|
|
17252
17214
|
}
|
|
@@ -18429,6 +18391,7 @@ var Container2 = dt.div`
|
|
|
18429
18391
|
line-height: 1.35;
|
|
18430
18392
|
width: 100%;
|
|
18431
18393
|
height: 100%;
|
|
18394
|
+
container-type: inline-size;
|
|
18432
18395
|
|
|
18433
18396
|
*,
|
|
18434
18397
|
*::before,
|
|
@@ -22045,17 +22008,16 @@ var StyledViewport = dt.div.withConfig({
|
|
|
22045
22008
|
shouldForwardProp: (prop) => !["$numberOfColumns", "numberOfColumns"].includes(prop)
|
|
22046
22009
|
})`
|
|
22047
22010
|
display: grid;
|
|
22048
|
-
grid-template-columns: repeat(1, minmax(300px, 1fr));
|
|
22049
22011
|
margin-left: auto;
|
|
22050
22012
|
margin-right: auto;
|
|
22051
22013
|
gap: 1rem;
|
|
22052
22014
|
|
|
22053
|
-
@
|
|
22054
|
-
grid-template-columns:
|
|
22015
|
+
@container (max-width: 767px) {
|
|
22016
|
+
grid-template-columns: repeat(1, minmax(300px, 1fr));
|
|
22055
22017
|
}
|
|
22056
22018
|
|
|
22057
|
-
@container (
|
|
22058
|
-
grid-template-columns: repeat(
|
|
22019
|
+
@container (min-width: 768px) {
|
|
22020
|
+
grid-template-columns: ${({ theme }) => lt`repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`};
|
|
22059
22021
|
}
|
|
22060
22022
|
`;
|
|
22061
22023
|
|
|
@@ -22595,7 +22557,7 @@ IncludedFeatures.displayName = "IncludedFeatures";
|
|
|
22595
22557
|
|
|
22596
22558
|
// src/components/elements/invoices/Invoices.tsx
|
|
22597
22559
|
import { forwardRef as forwardRef8, useEffect as useEffect5, useState as useState14 } from "react";
|
|
22598
|
-
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";
|
|
22599
22561
|
function resolveDesignProps3(props) {
|
|
22600
22562
|
return {
|
|
22601
22563
|
header: {
|
|
@@ -22666,9 +22628,6 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
22666
22628
|
useEffect5(() => {
|
|
22667
22629
|
setInvoices(formatInvoices(data));
|
|
22668
22630
|
}, [data]);
|
|
22669
|
-
if (invoices.length === 0) {
|
|
22670
|
-
return null;
|
|
22671
|
-
}
|
|
22672
22631
|
return /* @__PURE__ */ jsx30(Element, { ref, className, children: /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
22673
22632
|
props.header.isVisible && /* @__PURE__ */ jsx30(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx30(
|
|
22674
22633
|
Text,
|
|
@@ -22680,48 +22639,50 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
22680
22639
|
children: t2("Invoices")
|
|
22681
22640
|
}
|
|
22682
22641
|
) }),
|
|
22683
|
-
/* @__PURE__ */
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
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,
|
|
22687
22668
|
{
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
url
|
|
22669
|
+
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
22670
|
+
style: { color: "#D0D0D0" }
|
|
22691
22671
|
}
|
|
22692
22672
|
),
|
|
22693
|
-
|
|
22673
|
+
/* @__PURE__ */ jsx30(
|
|
22694
22674
|
Text,
|
|
22695
22675
|
{
|
|
22696
|
-
|
|
22697
|
-
$
|
|
22698
|
-
$
|
|
22699
|
-
$
|
|
22700
|
-
|
|
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")
|
|
22701
22682
|
}
|
|
22702
22683
|
)
|
|
22703
|
-
] }
|
|
22704
|
-
}) })
|
|
22705
|
-
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs23(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
22706
|
-
/* @__PURE__ */ jsx30(
|
|
22707
|
-
Icon2,
|
|
22708
|
-
{
|
|
22709
|
-
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
22710
|
-
style: { color: "#D0D0D0" }
|
|
22711
|
-
}
|
|
22712
|
-
),
|
|
22713
|
-
/* @__PURE__ */ jsx30(
|
|
22714
|
-
Text,
|
|
22715
|
-
{
|
|
22716
|
-
onClick: toggleListSize,
|
|
22717
|
-
$font: theme.typography[props.collapse.fontStyle].fontFamily,
|
|
22718
|
-
$size: theme.typography[props.collapse.fontStyle].fontSize,
|
|
22719
|
-
$weight: theme.typography[props.collapse.fontStyle].fontWeight,
|
|
22720
|
-
$color: theme.typography[props.collapse.fontStyle].color,
|
|
22721
|
-
children: listSize === props.limit.number ? t2("See more") : t2("See less")
|
|
22722
|
-
}
|
|
22723
|
-
)
|
|
22724
|
-
] })
|
|
22684
|
+
] })
|
|
22685
|
+
] }) : /* @__PURE__ */ jsx30(Text, { display: "heading2", children: t2("No invoices created yet") })
|
|
22725
22686
|
] }) });
|
|
22726
22687
|
});
|
|
22727
22688
|
Invoices.displayName = "Invoices";
|
|
@@ -22735,11 +22696,10 @@ var Container3 = dt.div`
|
|
|
22735
22696
|
flex-direction: column;
|
|
22736
22697
|
|
|
22737
22698
|
&:last-child {
|
|
22738
|
-
overflow: hidden;
|
|
22739
|
-
|
|
22740
22699
|
${({ theme }) => {
|
|
22741
22700
|
const borderRadius = `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`;
|
|
22742
22701
|
return theme.sectionLayout === "merged" && lt`
|
|
22702
|
+
overflow: hidden;
|
|
22743
22703
|
border-bottom-left-radius: ${borderRadius};
|
|
22744
22704
|
border-bottom-right-radius: ${borderRadius};
|
|
22745
22705
|
`;
|
|
@@ -22748,7 +22708,7 @@ var Container3 = dt.div`
|
|
|
22748
22708
|
`;
|
|
22749
22709
|
|
|
22750
22710
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
22751
|
-
import { Fragment as
|
|
22711
|
+
import { Fragment as Fragment14, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22752
22712
|
function resolveDesignProps4(props) {
|
|
22753
22713
|
return {
|
|
22754
22714
|
isVisible: props.isVisible ?? true,
|
|
@@ -22887,7 +22847,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22887
22847
|
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
22888
22848
|
$color: theme.typography[props.header.fontStyle].color,
|
|
22889
22849
|
$leading: 1.35,
|
|
22890
|
-
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs24(
|
|
22850
|
+
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
22891
22851
|
formatNumber(usage),
|
|
22892
22852
|
" ",
|
|
22893
22853
|
getFeatureName(feature, usage)
|
|
@@ -22925,15 +22885,15 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22925
22885
|
style: {
|
|
22926
22886
|
whiteSpace: "nowrap"
|
|
22927
22887
|
},
|
|
22928
|
-
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs24(
|
|
22888
|
+
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
22929
22889
|
formatNumber(allocation),
|
|
22930
22890
|
" ",
|
|
22931
22891
|
getFeatureName(feature, allocation)
|
|
22932
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs24(
|
|
22892
|
+
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
22933
22893
|
formatNumber(usage),
|
|
22934
22894
|
" ",
|
|
22935
22895
|
getFeatureName(feature, usage),
|
|
22936
|
-
priceBehavior === "overage" && /* @__PURE__ */ jsxs24(
|
|
22896
|
+
priceBehavior === "overage" && /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
22937
22897
|
" ",
|
|
22938
22898
|
t2("used")
|
|
22939
22899
|
] })
|
|
@@ -23026,18 +22986,18 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
23026
22986
|
$weight: theme.typography.text.fontWeight,
|
|
23027
22987
|
$color: theme.typography.text.color,
|
|
23028
22988
|
$leading: 1.35,
|
|
23029
|
-
children: /* @__PURE__ */ jsxs24(
|
|
22989
|
+
children: /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
23030
22990
|
t2("Additional"),
|
|
23031
22991
|
": ",
|
|
23032
22992
|
formatCurrency(price, currency),
|
|
23033
22993
|
feature && /* @__PURE__ */ jsxs24(Box, { as: "sub", $whiteSpace: "nowrap", children: [
|
|
23034
22994
|
"/",
|
|
23035
|
-
packageSize > 1 && /* @__PURE__ */ jsxs24(
|
|
22995
|
+
packageSize > 1 && /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
23036
22996
|
packageSize,
|
|
23037
22997
|
" "
|
|
23038
22998
|
] }),
|
|
23039
22999
|
getFeatureName(feature, packageSize),
|
|
23040
|
-
feature.featureType === "trait" && planPeriod && /* @__PURE__ */ jsxs24(
|
|
23000
|
+
feature.featureType === "trait" && planPeriod && /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
23041
23001
|
"/",
|
|
23042
23002
|
shortenPeriod(planPeriod)
|
|
23043
23003
|
] })
|
|
@@ -23856,7 +23816,7 @@ var PaymentMethodDetails = ({
|
|
|
23856
23816
|
|
|
23857
23817
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
23858
23818
|
import { forwardRef as forwardRef11, useMemo as useMemo15 } from "react";
|
|
23859
|
-
import { Fragment as
|
|
23819
|
+
import { Fragment as Fragment15, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
23860
23820
|
var resolveDesignProps7 = (props) => {
|
|
23861
23821
|
return {
|
|
23862
23822
|
header: {
|
|
@@ -23924,7 +23884,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23924
23884
|
const willSubscriptionCancel = billingSubscription?.cancelAtPeriodEnd;
|
|
23925
23885
|
const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
|
|
23926
23886
|
const headerPriceFontStyle = isUsageBasedPlan ? "heading3" : props.header.price.fontStyle;
|
|
23927
|
-
return /* @__PURE__ */ jsxs27(
|
|
23887
|
+
return /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
23928
23888
|
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs27(
|
|
23929
23889
|
Notice,
|
|
23930
23890
|
{
|
|
@@ -24069,12 +24029,12 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
24069
24029
|
$gap: "1rem",
|
|
24070
24030
|
children: [
|
|
24071
24031
|
/* @__PURE__ */ jsxs27(Text, { display: props.addOns.fontStyle, children: [
|
|
24072
|
-
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ jsxs27(
|
|
24032
|
+
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24073
24033
|
limit,
|
|
24074
24034
|
" ",
|
|
24075
24035
|
getFeatureName(entitlement.feature, limit)
|
|
24076
24036
|
] }) : entitlement.feature.name,
|
|
24077
|
-
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs27(
|
|
24037
|
+
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24078
24038
|
"/",
|
|
24079
24039
|
shortenPeriod(currentPlan.planPeriod)
|
|
24080
24040
|
] })
|
|
@@ -24087,7 +24047,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
24087
24047
|
$color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
|
|
24088
24048
|
children: typeof overageAmount === "number" && overageAmount > 0 ? t2("X additional", {
|
|
24089
24049
|
amount: overageAmount
|
|
24090
|
-
}) : /* @__PURE__ */ jsxs27(
|
|
24050
|
+
}) : /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24091
24051
|
t2("Additional"),
|
|
24092
24052
|
":",
|
|
24093
24053
|
" ",
|
|
@@ -24097,7 +24057,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
24097
24057
|
),
|
|
24098
24058
|
/* @__PURE__ */ jsxs27("sub", { children: [
|
|
24099
24059
|
"/",
|
|
24100
|
-
packageSize > 1 && /* @__PURE__ */ jsxs27(
|
|
24060
|
+
packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24101
24061
|
packageSize,
|
|
24102
24062
|
" "
|
|
24103
24063
|
] }),
|
|
@@ -24105,7 +24065,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
24105
24065
|
entitlement.feature,
|
|
24106
24066
|
packageSize
|
|
24107
24067
|
),
|
|
24108
|
-
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs27(
|
|
24068
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24109
24069
|
"/",
|
|
24110
24070
|
shortenPeriod(currentPlan.planPeriod)
|
|
24111
24071
|
] })
|
|
@@ -24124,7 +24084,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
24124
24084
|
),
|
|
24125
24085
|
/* @__PURE__ */ jsxs27("sub", { children: [
|
|
24126
24086
|
"/",
|
|
24127
|
-
packageSize > 1 && /* @__PURE__ */ jsxs27(
|
|
24087
|
+
packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24128
24088
|
packageSize,
|
|
24129
24089
|
" "
|
|
24130
24090
|
] }),
|
|
@@ -24145,8 +24105,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
24145
24105
|
),
|
|
24146
24106
|
(entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ jsxs27("sub", { children: [
|
|
24147
24107
|
"/",
|
|
24148
|
-
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : /* @__PURE__ */ jsxs27(
|
|
24149
|
-
packageSize > 1 && /* @__PURE__ */ jsxs27(
|
|
24108
|
+
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24109
|
+
packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
24150
24110
|
packageSize,
|
|
24151
24111
|
" "
|
|
24152
24112
|
] }),
|
|
@@ -24195,7 +24155,7 @@ PlanManager.displayName = "PlanManager";
|
|
|
24195
24155
|
|
|
24196
24156
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
24197
24157
|
import { forwardRef as forwardRef12, useState as useState16 } from "react";
|
|
24198
|
-
import { Fragment as
|
|
24158
|
+
import { Fragment as Fragment16, jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
24199
24159
|
var resolveDesignProps8 = (props) => {
|
|
24200
24160
|
return {
|
|
24201
24161
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -24506,7 +24466,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24506
24466
|
$weight: theme.typography.text.fontWeight,
|
|
24507
24467
|
$color: theme.typography.text.color,
|
|
24508
24468
|
$leading: 1.35,
|
|
24509
|
-
children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ jsxs28(
|
|
24469
|
+
children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24510
24470
|
formatCurrency(
|
|
24511
24471
|
entitlementPrice,
|
|
24512
24472
|
entitlementCurrency
|
|
@@ -24514,7 +24474,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24514
24474
|
" ",
|
|
24515
24475
|
t2("per"),
|
|
24516
24476
|
" ",
|
|
24517
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(
|
|
24477
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24518
24478
|
entitlementPackageSize,
|
|
24519
24479
|
" "
|
|
24520
24480
|
] }),
|
|
@@ -24522,18 +24482,18 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24522
24482
|
entitlement.feature,
|
|
24523
24483
|
entitlementPackageSize
|
|
24524
24484
|
),
|
|
24525
|
-
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs28(
|
|
24485
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24526
24486
|
" ",
|
|
24527
24487
|
t2("per"),
|
|
24528
24488
|
" ",
|
|
24529
24489
|
selectedPeriod
|
|
24530
24490
|
] })
|
|
24531
|
-
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(
|
|
24491
|
+
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24532
24492
|
entitlement.valueType === "unlimited" && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
24533
24493
|
item: getFeatureName(
|
|
24534
24494
|
entitlement.feature
|
|
24535
24495
|
)
|
|
24536
|
-
}) : typeof limit === "number" && /* @__PURE__ */ jsxs28(
|
|
24496
|
+
}) : typeof limit === "number" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24537
24497
|
formatNumber(limit),
|
|
24538
24498
|
" ",
|
|
24539
24499
|
getFeatureName(
|
|
@@ -24541,7 +24501,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24541
24501
|
limit
|
|
24542
24502
|
)
|
|
24543
24503
|
] }),
|
|
24544
|
-
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ jsxs28(
|
|
24504
|
+
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24545
24505
|
" ",
|
|
24546
24506
|
t2("per"),
|
|
24547
24507
|
" ",
|
|
@@ -24551,7 +24511,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24551
24511
|
current_month: "month",
|
|
24552
24512
|
current_year: "year"
|
|
24553
24513
|
}[entitlement.metricPeriod]
|
|
24554
|
-
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ jsxs28(
|
|
24514
|
+
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24555
24515
|
"/",
|
|
24556
24516
|
shortenPeriod(
|
|
24557
24517
|
selectedPeriod
|
|
@@ -24582,7 +24542,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24582
24542
|
entitlementCurrency
|
|
24583
24543
|
),
|
|
24584
24544
|
"/",
|
|
24585
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(
|
|
24545
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24586
24546
|
entitlementPackageSize,
|
|
24587
24547
|
" "
|
|
24588
24548
|
] }),
|
|
@@ -24590,7 +24550,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24590
24550
|
entitlement.feature,
|
|
24591
24551
|
entitlementPackageSize
|
|
24592
24552
|
),
|
|
24593
|
-
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs28(
|
|
24553
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24594
24554
|
"/",
|
|
24595
24555
|
shortenPeriod(selectedPeriod)
|
|
24596
24556
|
] }),
|
|
@@ -24729,7 +24689,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24729
24689
|
}
|
|
24730
24690
|
)
|
|
24731
24691
|
] }),
|
|
24732
|
-
/* @__PURE__ */ jsx36(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs28(
|
|
24692
|
+
/* @__PURE__ */ jsx36(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24733
24693
|
props.header.isVisible && /* @__PURE__ */ jsx36(
|
|
24734
24694
|
Flex,
|
|
24735
24695
|
{
|
|
@@ -24884,12 +24844,12 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24884
24844
|
$size: theme.typography.text.fontSize,
|
|
24885
24845
|
$weight: theme.typography.text.fontWeight,
|
|
24886
24846
|
$color: theme.typography.text.color,
|
|
24887
|
-
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(
|
|
24847
|
+
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24888
24848
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
24889
24849
|
item: getFeatureName(
|
|
24890
24850
|
entitlement.feature
|
|
24891
24851
|
)
|
|
24892
|
-
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs28(
|
|
24852
|
+
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24893
24853
|
formatNumber(
|
|
24894
24854
|
entitlement.valueNumeric
|
|
24895
24855
|
),
|
|
@@ -24899,7 +24859,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24899
24859
|
entitlement.valueNumeric
|
|
24900
24860
|
)
|
|
24901
24861
|
] }),
|
|
24902
|
-
entitlement.metricPeriod && /* @__PURE__ */ jsxs28(
|
|
24862
|
+
entitlement.metricPeriod && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
24903
24863
|
" ",
|
|
24904
24864
|
t2("per"),
|
|
24905
24865
|
" ",
|
|
@@ -25050,7 +25010,7 @@ UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
|
25050
25010
|
|
|
25051
25011
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
25052
25012
|
import { forwardRef as forwardRef15, useMemo as useMemo16 } from "react";
|
|
25053
|
-
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
25013
|
+
import { Fragment as Fragment17, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
25054
25014
|
function resolveDesignProps11(props) {
|
|
25055
25015
|
return {
|
|
25056
25016
|
header: {
|
|
@@ -25075,7 +25035,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
25075
25035
|
const theme = nt();
|
|
25076
25036
|
const { data } = useEmbed();
|
|
25077
25037
|
const isLightBackground = useIsLightBackground();
|
|
25078
|
-
const {
|
|
25038
|
+
const { discounts, upcomingInvoice } = useMemo16(() => {
|
|
25079
25039
|
const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
|
|
25080
25040
|
amountOff: discount.amountOff,
|
|
25081
25041
|
couponId: discount.couponId,
|
|
@@ -25085,24 +25045,10 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
25085
25045
|
}));
|
|
25086
25046
|
return {
|
|
25087
25047
|
discounts: discounts2,
|
|
25088
|
-
upcomingInvoice:
|
|
25089
|
-
...typeof data.upcomingInvoice?.amountDue === "number" && {
|
|
25090
|
-
amountDue: data.upcomingInvoice.amountDue
|
|
25091
|
-
},
|
|
25092
|
-
...data.subscription?.interval && {
|
|
25093
|
-
interval: data.subscription.interval
|
|
25094
|
-
},
|
|
25095
|
-
...data.upcomingInvoice?.dueDate && {
|
|
25096
|
-
dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
|
|
25097
|
-
},
|
|
25098
|
-
currency: data.upcomingInvoice?.currency
|
|
25099
|
-
}
|
|
25048
|
+
upcomingInvoice: data.upcomingInvoice
|
|
25100
25049
|
};
|
|
25101
25050
|
}, [data.subscription, data.upcomingInvoice]);
|
|
25102
|
-
|
|
25103
|
-
return null;
|
|
25104
|
-
}
|
|
25105
|
-
return /* @__PURE__ */ jsxs29(
|
|
25051
|
+
return /* @__PURE__ */ jsx39(
|
|
25106
25052
|
Element,
|
|
25107
25053
|
{
|
|
25108
25054
|
as: Flex,
|
|
@@ -25110,8 +25056,8 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
25110
25056
|
className,
|
|
25111
25057
|
$flexDirection: "column",
|
|
25112
25058
|
$gap: "1rem",
|
|
25113
|
-
children: [
|
|
25114
|
-
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(
|
|
25115
25061
|
Text,
|
|
25116
25062
|
{
|
|
25117
25063
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -25121,7 +25067,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
25121
25067
|
children: [
|
|
25122
25068
|
props.header.prefix,
|
|
25123
25069
|
" ",
|
|
25124
|
-
upcomingInvoice.dueDate
|
|
25070
|
+
toPrettyDate(upcomingInvoice.dueDate)
|
|
25125
25071
|
]
|
|
25126
25072
|
}
|
|
25127
25073
|
) }),
|
|
@@ -25163,41 +25109,49 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
25163
25109
|
children: t2("Discount")
|
|
25164
25110
|
}
|
|
25165
25111
|
) }),
|
|
25166
|
-
/* @__PURE__ */ jsx39(Box, { children: discounts.map((discount) => /* @__PURE__ */ jsxs29(
|
|
25167
|
-
|
|
25168
|
-
|
|
25169
|
-
|
|
25170
|
-
|
|
25171
|
-
|
|
25172
|
-
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
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(
|
|
25177
25140
|
Text,
|
|
25178
25141
|
{
|
|
25179
25142
|
$font: theme.typography.text.fontFamily,
|
|
25180
|
-
$size:
|
|
25143
|
+
$size: theme.typography.text.fontSize,
|
|
25181
25144
|
$weight: theme.typography.text.fontWeight,
|
|
25182
25145
|
$color: theme.typography.text.color,
|
|
25183
|
-
children: discount.
|
|
25146
|
+
children: t2("Percent off", { percent: discount.percentOff })
|
|
25184
25147
|
}
|
|
25185
|
-
)
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
-
{
|
|
25191
|
-
$font: theme.typography.text.fontFamily,
|
|
25192
|
-
$size: theme.typography.text.fontSize,
|
|
25193
|
-
$weight: theme.typography.text.fontWeight,
|
|
25194
|
-
$color: theme.typography.text.color,
|
|
25195
|
-
children: t2("Percent off", { percent: discount.percentOff })
|
|
25196
|
-
}
|
|
25197
|
-
) })
|
|
25198
|
-
] }, discount.couponId)) })
|
|
25148
|
+
) })
|
|
25149
|
+
]
|
|
25150
|
+
},
|
|
25151
|
+
discount.couponId
|
|
25152
|
+
)) })
|
|
25199
25153
|
] })
|
|
25200
|
-
]
|
|
25154
|
+
] }) : /* @__PURE__ */ jsx39(Text, { display: "heading2", children: t2("No upcoming invoice") })
|
|
25201
25155
|
}
|
|
25202
25156
|
);
|
|
25203
25157
|
});
|
|
@@ -25255,7 +25209,7 @@ function createRenderer(options2) {
|
|
|
25255
25209
|
}
|
|
25256
25210
|
|
|
25257
25211
|
// src/components/embed/ComponentTree.tsx
|
|
25258
|
-
import { Fragment as
|
|
25212
|
+
import { Fragment as Fragment18, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
25259
25213
|
var Loading = () => {
|
|
25260
25214
|
const theme = nt();
|
|
25261
25215
|
return /* @__PURE__ */ jsx40(
|
|
@@ -25323,7 +25277,7 @@ var ComponentTree = () => {
|
|
|
25323
25277
|
if (isPending) {
|
|
25324
25278
|
return /* @__PURE__ */ jsx40(Loading, {});
|
|
25325
25279
|
}
|
|
25326
|
-
return /* @__PURE__ */ jsx40(
|
|
25280
|
+
return /* @__PURE__ */ jsx40(Fragment18, { children });
|
|
25327
25281
|
};
|
|
25328
25282
|
|
|
25329
25283
|
// src/components/embed/Embed.tsx
|