@schematichq/schematic-components 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-components.cjs.js +278 -218
- package/dist/schematic-components.d.ts +43 -0
- package/dist/schematic-components.esm.js +278 -218
- package/package.json +1 -1
|
@@ -283,17 +283,17 @@ var require_debounce = __commonJS({
|
|
|
283
283
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
284
284
|
var nativeMax = Math.max;
|
|
285
285
|
var nativeMin = Math.min;
|
|
286
|
-
function debounce4(func, wait,
|
|
286
|
+
function debounce4(func, wait, options) {
|
|
287
287
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
288
288
|
if (typeof func != "function") {
|
|
289
289
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
290
290
|
}
|
|
291
291
|
wait = toNumber(wait) || 0;
|
|
292
|
-
if (isObject2(
|
|
293
|
-
leading = !!
|
|
294
|
-
maxing = "maxWait" in
|
|
295
|
-
maxWait = maxing ? nativeMax(toNumber(
|
|
296
|
-
trailing = "trailing" in
|
|
292
|
+
if (isObject2(options)) {
|
|
293
|
+
leading = !!options.leading;
|
|
294
|
+
maxing = "maxWait" in options;
|
|
295
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
296
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
297
297
|
}
|
|
298
298
|
function invokeFunc(time) {
|
|
299
299
|
var args = lastArgs, thisArg = lastThis;
|
|
@@ -1879,8 +1879,8 @@ function getPriceValue(billingPrice) {
|
|
|
1879
1879
|
const price = typeof billingPrice.priceDecimal === "string" ? Number(billingPrice.priceDecimal) : billingPrice.price;
|
|
1880
1880
|
return price;
|
|
1881
1881
|
}
|
|
1882
|
-
function getPlanPrice(plan, period = "month",
|
|
1883
|
-
const billingPrice =
|
|
1882
|
+
function getPlanPrice(plan, period = "month", options = { useSelectedPeriod: true }) {
|
|
1883
|
+
const billingPrice = options.useSelectedPeriod ? period === "year" ? plan.yearlyPrice : plan.monthlyPrice : plan.yearlyPrice && !plan.monthlyPrice ? plan.yearlyPrice : plan.monthlyPrice;
|
|
1884
1884
|
if (billingPrice) {
|
|
1885
1885
|
return { ...billingPrice, price: getPriceValue(billingPrice) };
|
|
1886
1886
|
}
|
|
@@ -2012,14 +2012,14 @@ function groupPlanCreditGrants(creditGrants) {
|
|
|
2012
2012
|
);
|
|
2013
2013
|
return Object.values(map);
|
|
2014
2014
|
}
|
|
2015
|
-
function groupCreditGrants(creditGrants,
|
|
2015
|
+
function groupCreditGrants(creditGrants, options) {
|
|
2016
2016
|
const today = /* @__PURE__ */ new Date();
|
|
2017
2017
|
const map = creditGrants.reduce(
|
|
2018
2018
|
(acc, grant) => {
|
|
2019
2019
|
const isExpired = !!grant.expiresAt && grant.expiresAt <= today;
|
|
2020
2020
|
const isZeroedOut = !!grant.zeroedOutDate;
|
|
2021
2021
|
if (!isExpired && !isZeroedOut) {
|
|
2022
|
-
const key =
|
|
2022
|
+
const key = options?.groupBy === "bundle" ? grant.billingCreditBundleId || grant.id : options?.groupBy === "credit" ? grant.billingCreditId : grant.id;
|
|
2023
2023
|
const current = acc[key];
|
|
2024
2024
|
acc[key] = {
|
|
2025
2025
|
// credit-specific attributes
|
|
@@ -4079,7 +4079,7 @@ attr.rem = function propAsRem(key, value) {
|
|
|
4079
4079
|
};
|
|
4080
4080
|
|
|
4081
4081
|
// src/hooks/useAvailablePlans.ts
|
|
4082
|
-
function useAvailablePlans(activePeriod,
|
|
4082
|
+
function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true }) {
|
|
4083
4083
|
const { data, settings } = useEmbed();
|
|
4084
4084
|
const getAvailablePeriods = useCallback(() => {
|
|
4085
4085
|
const periods = [];
|
|
@@ -4094,14 +4094,14 @@ function useAvailablePlans(activePeriod, options2 = { useSelectedPeriod: true })
|
|
|
4094
4094
|
const getActivePlans = useCallback(
|
|
4095
4095
|
(plans) => {
|
|
4096
4096
|
const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
|
|
4097
|
-
if (
|
|
4097
|
+
if (options.useSelectedPeriod) {
|
|
4098
4098
|
return activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
4099
4099
|
}
|
|
4100
4100
|
return plan.monthlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
4101
4101
|
});
|
|
4102
4102
|
return activePlans.map((plan) => ({ ...plan, isSelected: false }));
|
|
4103
4103
|
},
|
|
4104
|
-
[activePeriod,
|
|
4104
|
+
[activePeriod, options.useSelectedPeriod, settings.mode]
|
|
4105
4105
|
);
|
|
4106
4106
|
return useMemo(() => {
|
|
4107
4107
|
return {
|
|
@@ -4431,14 +4431,14 @@ var consoleLogger = {
|
|
|
4431
4431
|
}
|
|
4432
4432
|
};
|
|
4433
4433
|
var Logger = class _Logger {
|
|
4434
|
-
constructor(concreteLogger,
|
|
4435
|
-
this.init(concreteLogger,
|
|
4434
|
+
constructor(concreteLogger, options = {}) {
|
|
4435
|
+
this.init(concreteLogger, options);
|
|
4436
4436
|
}
|
|
4437
|
-
init(concreteLogger,
|
|
4438
|
-
this.prefix =
|
|
4437
|
+
init(concreteLogger, options = {}) {
|
|
4438
|
+
this.prefix = options.prefix || "i18next:";
|
|
4439
4439
|
this.logger = concreteLogger || consoleLogger;
|
|
4440
|
-
this.options =
|
|
4441
|
-
this.debug =
|
|
4440
|
+
this.options = options;
|
|
4441
|
+
this.debug = options.debug;
|
|
4442
4442
|
}
|
|
4443
4443
|
log(...args) {
|
|
4444
4444
|
return this.forward(args, "log", "", true);
|
|
@@ -4465,10 +4465,10 @@ var Logger = class _Logger {
|
|
|
4465
4465
|
...this.options
|
|
4466
4466
|
});
|
|
4467
4467
|
}
|
|
4468
|
-
clone(
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
return new _Logger(this.logger,
|
|
4468
|
+
clone(options) {
|
|
4469
|
+
options = options || this.options;
|
|
4470
|
+
options.prefix = options.prefix || this.prefix;
|
|
4471
|
+
return new _Logger(this.logger, options);
|
|
4472
4472
|
}
|
|
4473
4473
|
};
|
|
4474
4474
|
var baseLogger = new Logger();
|
|
@@ -4512,13 +4512,13 @@ var EventEmitter = class {
|
|
|
4512
4512
|
}
|
|
4513
4513
|
};
|
|
4514
4514
|
var ResourceStore = class extends EventEmitter {
|
|
4515
|
-
constructor(data,
|
|
4515
|
+
constructor(data, options = {
|
|
4516
4516
|
ns: ["translation"],
|
|
4517
4517
|
defaultNS: "translation"
|
|
4518
4518
|
}) {
|
|
4519
4519
|
super();
|
|
4520
4520
|
this.data = data || {};
|
|
4521
|
-
this.options =
|
|
4521
|
+
this.options = options;
|
|
4522
4522
|
if (this.options.keySeparator === void 0) {
|
|
4523
4523
|
this.options.keySeparator = ".";
|
|
4524
4524
|
}
|
|
@@ -4537,9 +4537,9 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4537
4537
|
this.options.ns.splice(index, 1);
|
|
4538
4538
|
}
|
|
4539
4539
|
}
|
|
4540
|
-
getResource(lng, ns, key,
|
|
4541
|
-
const keySeparator =
|
|
4542
|
-
const ignoreJSONStructure =
|
|
4540
|
+
getResource(lng, ns, key, options = {}) {
|
|
4541
|
+
const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
|
|
4542
|
+
const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
4543
4543
|
let path;
|
|
4544
4544
|
if (lng.indexOf(".") > -1) {
|
|
4545
4545
|
path = lng.split(".");
|
|
@@ -4564,10 +4564,10 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4564
4564
|
if (result || !ignoreJSONStructure || !isString(key)) return result;
|
|
4565
4565
|
return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
|
|
4566
4566
|
}
|
|
4567
|
-
addResource(lng, ns, key, value,
|
|
4567
|
+
addResource(lng, ns, key, value, options = {
|
|
4568
4568
|
silent: false
|
|
4569
4569
|
}) {
|
|
4570
|
-
const keySeparator =
|
|
4570
|
+
const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
|
|
4571
4571
|
let path = [lng, ns];
|
|
4572
4572
|
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
4573
4573
|
if (lng.indexOf(".") > -1) {
|
|
@@ -4577,9 +4577,9 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4577
4577
|
}
|
|
4578
4578
|
this.addNamespaces(ns);
|
|
4579
4579
|
setPath(this.data, path, value);
|
|
4580
|
-
if (!
|
|
4580
|
+
if (!options.silent) this.emit("added", lng, ns, key, value);
|
|
4581
4581
|
}
|
|
4582
|
-
addResources(lng, ns, resources,
|
|
4582
|
+
addResources(lng, ns, resources, options = {
|
|
4583
4583
|
silent: false
|
|
4584
4584
|
}) {
|
|
4585
4585
|
for (const m2 in resources) {
|
|
@@ -4587,9 +4587,9 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4587
4587
|
silent: true
|
|
4588
4588
|
});
|
|
4589
4589
|
}
|
|
4590
|
-
if (!
|
|
4590
|
+
if (!options.silent) this.emit("added", lng, ns, resources);
|
|
4591
4591
|
}
|
|
4592
|
-
addResourceBundle(lng, ns, resources, deep, overwrite,
|
|
4592
|
+
addResourceBundle(lng, ns, resources, deep, overwrite, options = {
|
|
4593
4593
|
silent: false,
|
|
4594
4594
|
skipCopy: false
|
|
4595
4595
|
}) {
|
|
@@ -4602,7 +4602,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4602
4602
|
}
|
|
4603
4603
|
this.addNamespaces(ns);
|
|
4604
4604
|
let pack = getPath(this.data, path) || {};
|
|
4605
|
-
if (!
|
|
4605
|
+
if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
|
|
4606
4606
|
if (deep) {
|
|
4607
4607
|
deepExtend(pack, resources, overwrite);
|
|
4608
4608
|
} else {
|
|
@@ -4612,7 +4612,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4612
4612
|
};
|
|
4613
4613
|
}
|
|
4614
4614
|
setPath(this.data, path, pack);
|
|
4615
|
-
if (!
|
|
4615
|
+
if (!options.silent) this.emit("added", lng, ns, resources);
|
|
4616
4616
|
}
|
|
4617
4617
|
removeResourceBundle(lng, ns) {
|
|
4618
4618
|
if (this.hasResourceBundle(lng, ns)) {
|
|
@@ -4645,9 +4645,9 @@ var postProcessor = {
|
|
|
4645
4645
|
addPostProcessor(module) {
|
|
4646
4646
|
this.processors[module.name] = module;
|
|
4647
4647
|
},
|
|
4648
|
-
handle(processors, value, key,
|
|
4648
|
+
handle(processors, value, key, options, translator) {
|
|
4649
4649
|
processors.forEach((processor) => {
|
|
4650
|
-
value = this.processors[processor]?.process(value, key,
|
|
4650
|
+
value = this.processors[processor]?.process(value, key, options, translator) ?? value;
|
|
4651
4651
|
});
|
|
4652
4652
|
return value;
|
|
4653
4653
|
}
|
|
@@ -4675,10 +4675,10 @@ function keysFromSelector(selector, opts) {
|
|
|
4675
4675
|
var checkedLoadedFor = {};
|
|
4676
4676
|
var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
|
|
4677
4677
|
var Translator = class _Translator extends EventEmitter {
|
|
4678
|
-
constructor(services,
|
|
4678
|
+
constructor(services, options = {}) {
|
|
4679
4679
|
super();
|
|
4680
4680
|
copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
|
|
4681
|
-
this.options =
|
|
4681
|
+
this.options = options;
|
|
4682
4682
|
if (this.options.keySeparator === void 0) {
|
|
4683
4683
|
this.options.keySeparator = ".";
|
|
4684
4684
|
}
|
|
@@ -4728,12 +4728,15 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4728
4728
|
if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
|
|
4729
4729
|
opt = this.options.overloadTranslationOptionHandler(arguments);
|
|
4730
4730
|
}
|
|
4731
|
-
if (typeof
|
|
4731
|
+
if (typeof opt === "object") opt = {
|
|
4732
4732
|
...opt
|
|
4733
4733
|
};
|
|
4734
4734
|
if (!opt) opt = {};
|
|
4735
4735
|
if (keys == null) return "";
|
|
4736
|
-
if (typeof keys === "function") keys = keysFromSelector(keys,
|
|
4736
|
+
if (typeof keys === "function") keys = keysFromSelector(keys, {
|
|
4737
|
+
...this.options,
|
|
4738
|
+
...opt
|
|
4739
|
+
});
|
|
4737
4740
|
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
4738
4741
|
const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
|
|
4739
4742
|
const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
|
|
@@ -5054,16 +5057,16 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
5054
5057
|
isValidLookup(res) {
|
|
5055
5058
|
return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
|
|
5056
5059
|
}
|
|
5057
|
-
getResource(code, ns, key,
|
|
5058
|
-
if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key,
|
|
5059
|
-
return this.resourceStore.getResource(code, ns, key,
|
|
5060
|
+
getResource(code, ns, key, options = {}) {
|
|
5061
|
+
if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
5062
|
+
return this.resourceStore.getResource(code, ns, key, options);
|
|
5060
5063
|
}
|
|
5061
|
-
getUsedParamsDetails(
|
|
5064
|
+
getUsedParamsDetails(options = {}) {
|
|
5062
5065
|
const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
|
|
5063
|
-
const useOptionsReplaceForData =
|
|
5064
|
-
let data = useOptionsReplaceForData ?
|
|
5065
|
-
if (useOptionsReplaceForData && typeof
|
|
5066
|
-
data.count =
|
|
5066
|
+
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
5067
|
+
let data = useOptionsReplaceForData ? options.replace : options;
|
|
5068
|
+
if (useOptionsReplaceForData && typeof options.count !== "undefined") {
|
|
5069
|
+
data.count = options.count;
|
|
5067
5070
|
}
|
|
5068
5071
|
if (this.options.interpolation.defaultVariables) {
|
|
5069
5072
|
data = {
|
|
@@ -5081,10 +5084,10 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
5081
5084
|
}
|
|
5082
5085
|
return data;
|
|
5083
5086
|
}
|
|
5084
|
-
static hasDefaultValue(
|
|
5087
|
+
static hasDefaultValue(options) {
|
|
5085
5088
|
const prefix2 = "defaultValue";
|
|
5086
|
-
for (const option in
|
|
5087
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
5089
|
+
for (const option in options) {
|
|
5090
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && prefix2 === option.substring(0, prefix2.length) && void 0 !== options[option]) {
|
|
5088
5091
|
return true;
|
|
5089
5092
|
}
|
|
5090
5093
|
}
|
|
@@ -5092,8 +5095,8 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
5092
5095
|
}
|
|
5093
5096
|
};
|
|
5094
5097
|
var LanguageUtil = class {
|
|
5095
|
-
constructor(
|
|
5096
|
-
this.options =
|
|
5098
|
+
constructor(options) {
|
|
5099
|
+
this.options = options;
|
|
5097
5100
|
this.supportedLngs = this.options.supportedLngs || false;
|
|
5098
5101
|
this.logger = baseLogger.create("languageUtils");
|
|
5099
5102
|
}
|
|
@@ -5214,9 +5217,9 @@ var dummyRule = {
|
|
|
5214
5217
|
})
|
|
5215
5218
|
};
|
|
5216
5219
|
var PluralResolver = class {
|
|
5217
|
-
constructor(languageUtils,
|
|
5220
|
+
constructor(languageUtils, options = {}) {
|
|
5218
5221
|
this.languageUtils = languageUtils;
|
|
5219
|
-
this.options =
|
|
5222
|
+
this.options = options;
|
|
5220
5223
|
this.logger = baseLogger.create("pluralResolver");
|
|
5221
5224
|
this.pluralRulesCache = {};
|
|
5222
5225
|
}
|
|
@@ -5226,9 +5229,9 @@ var PluralResolver = class {
|
|
|
5226
5229
|
clearCache() {
|
|
5227
5230
|
this.pluralRulesCache = {};
|
|
5228
5231
|
}
|
|
5229
|
-
getRule(code,
|
|
5232
|
+
getRule(code, options = {}) {
|
|
5230
5233
|
const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
|
|
5231
|
-
const type =
|
|
5234
|
+
const type = options.ordinal ? "ordinal" : "cardinal";
|
|
5232
5235
|
const cacheKey = JSON.stringify({
|
|
5233
5236
|
cleanedCode,
|
|
5234
5237
|
type
|
|
@@ -5248,32 +5251,32 @@ var PluralResolver = class {
|
|
|
5248
5251
|
}
|
|
5249
5252
|
if (!code.match(/-|_/)) return dummyRule;
|
|
5250
5253
|
const lngPart = this.languageUtils.getLanguagePartFromCode(code);
|
|
5251
|
-
rule = this.getRule(lngPart,
|
|
5254
|
+
rule = this.getRule(lngPart, options);
|
|
5252
5255
|
}
|
|
5253
5256
|
this.pluralRulesCache[cacheKey] = rule;
|
|
5254
5257
|
return rule;
|
|
5255
5258
|
}
|
|
5256
|
-
needsPlural(code,
|
|
5257
|
-
let rule = this.getRule(code,
|
|
5258
|
-
if (!rule) rule = this.getRule("dev",
|
|
5259
|
+
needsPlural(code, options = {}) {
|
|
5260
|
+
let rule = this.getRule(code, options);
|
|
5261
|
+
if (!rule) rule = this.getRule("dev", options);
|
|
5259
5262
|
return rule?.resolvedOptions().pluralCategories.length > 1;
|
|
5260
5263
|
}
|
|
5261
|
-
getPluralFormsOfKey(code, key,
|
|
5262
|
-
return this.getSuffixes(code,
|
|
5264
|
+
getPluralFormsOfKey(code, key, options = {}) {
|
|
5265
|
+
return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
|
|
5263
5266
|
}
|
|
5264
|
-
getSuffixes(code,
|
|
5265
|
-
let rule = this.getRule(code,
|
|
5266
|
-
if (!rule) rule = this.getRule("dev",
|
|
5267
|
+
getSuffixes(code, options = {}) {
|
|
5268
|
+
let rule = this.getRule(code, options);
|
|
5269
|
+
if (!rule) rule = this.getRule("dev", options);
|
|
5267
5270
|
if (!rule) return [];
|
|
5268
|
-
return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${
|
|
5271
|
+
return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
|
|
5269
5272
|
}
|
|
5270
|
-
getSuffix(code, count,
|
|
5271
|
-
const rule = this.getRule(code,
|
|
5273
|
+
getSuffix(code, count, options = {}) {
|
|
5274
|
+
const rule = this.getRule(code, options);
|
|
5272
5275
|
if (rule) {
|
|
5273
|
-
return `${this.options.prepend}${
|
|
5276
|
+
return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
|
|
5274
5277
|
}
|
|
5275
5278
|
this.logger.warn(`no plural rule found for: ${code}`);
|
|
5276
|
-
return this.getSuffix("dev", count,
|
|
5279
|
+
return this.getSuffix("dev", count, options);
|
|
5277
5280
|
}
|
|
5278
5281
|
};
|
|
5279
5282
|
var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
|
|
@@ -5286,14 +5289,14 @@ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJS
|
|
|
5286
5289
|
};
|
|
5287
5290
|
var regexSafe = (val) => val.replace(/\$/g, "$$$$");
|
|
5288
5291
|
var Interpolator = class {
|
|
5289
|
-
constructor(
|
|
5292
|
+
constructor(options = {}) {
|
|
5290
5293
|
this.logger = baseLogger.create("interpolator");
|
|
5291
|
-
this.options =
|
|
5292
|
-
this.format =
|
|
5293
|
-
this.init(
|
|
5294
|
+
this.options = options;
|
|
5295
|
+
this.format = options?.interpolation?.format || ((value) => value);
|
|
5296
|
+
this.init(options);
|
|
5294
5297
|
}
|
|
5295
|
-
init(
|
|
5296
|
-
if (!
|
|
5298
|
+
init(options = {}) {
|
|
5299
|
+
if (!options.interpolation) options.interpolation = {
|
|
5297
5300
|
escapeValue: true
|
|
5298
5301
|
};
|
|
5299
5302
|
const {
|
|
@@ -5314,7 +5317,7 @@ var Interpolator = class {
|
|
|
5314
5317
|
nestingOptionsSeparator,
|
|
5315
5318
|
maxReplaces,
|
|
5316
5319
|
alwaysFormat
|
|
5317
|
-
} =
|
|
5320
|
+
} = options.interpolation;
|
|
5318
5321
|
this.escape = escape$1 !== void 0 ? escape$1 : escape;
|
|
5319
5322
|
this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
|
|
5320
5323
|
this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
|
|
@@ -5345,7 +5348,7 @@ var Interpolator = class {
|
|
|
5345
5348
|
this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
|
|
5346
5349
|
this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
5347
5350
|
}
|
|
5348
|
-
interpolate(str, data, lng,
|
|
5351
|
+
interpolate(str, data, lng, options) {
|
|
5349
5352
|
let match2;
|
|
5350
5353
|
let value;
|
|
5351
5354
|
let replaces;
|
|
@@ -5354,7 +5357,7 @@ var Interpolator = class {
|
|
|
5354
5357
|
if (key.indexOf(this.formatSeparator) < 0) {
|
|
5355
5358
|
const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
5356
5359
|
return this.alwaysFormat ? this.format(path, void 0, lng, {
|
|
5357
|
-
...
|
|
5360
|
+
...options,
|
|
5358
5361
|
...data,
|
|
5359
5362
|
interpolationkey: key
|
|
5360
5363
|
}) : path;
|
|
@@ -5363,14 +5366,14 @@ var Interpolator = class {
|
|
|
5363
5366
|
const k2 = p2.shift().trim();
|
|
5364
5367
|
const f2 = p2.join(this.formatSeparator).trim();
|
|
5365
5368
|
return this.format(deepFindWithDefaults(data, defaultData, k2, this.options.keySeparator, this.options.ignoreJSONStructure), f2, lng, {
|
|
5366
|
-
...
|
|
5369
|
+
...options,
|
|
5367
5370
|
...data,
|
|
5368
5371
|
interpolationkey: k2
|
|
5369
5372
|
});
|
|
5370
5373
|
};
|
|
5371
5374
|
this.resetRegExp();
|
|
5372
|
-
const missingInterpolationHandler =
|
|
5373
|
-
const skipOnVariables =
|
|
5375
|
+
const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
5376
|
+
const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
5374
5377
|
const todos = [{
|
|
5375
5378
|
regex: this.regexpUnescape,
|
|
5376
5379
|
safeValue: (val) => regexSafe(val)
|
|
@@ -5385,9 +5388,9 @@ var Interpolator = class {
|
|
|
5385
5388
|
value = handleFormat(matchedVar);
|
|
5386
5389
|
if (value === void 0) {
|
|
5387
5390
|
if (typeof missingInterpolationHandler === "function") {
|
|
5388
|
-
const temp = missingInterpolationHandler(str, match2,
|
|
5391
|
+
const temp = missingInterpolationHandler(str, match2, options);
|
|
5389
5392
|
value = isString(temp) ? temp : "";
|
|
5390
|
-
} else if (
|
|
5393
|
+
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
5391
5394
|
value = "";
|
|
5392
5395
|
} else if (skipOnVariables) {
|
|
5393
5396
|
value = match2[0];
|
|
@@ -5415,7 +5418,7 @@ var Interpolator = class {
|
|
|
5415
5418
|
});
|
|
5416
5419
|
return str;
|
|
5417
5420
|
}
|
|
5418
|
-
nest(str, fc,
|
|
5421
|
+
nest(str, fc, options = {}) {
|
|
5419
5422
|
let match2;
|
|
5420
5423
|
let value;
|
|
5421
5424
|
let clonedOptions;
|
|
@@ -5447,7 +5450,7 @@ var Interpolator = class {
|
|
|
5447
5450
|
while (match2 = this.nestingRegexp.exec(str)) {
|
|
5448
5451
|
let formatters = [];
|
|
5449
5452
|
clonedOptions = {
|
|
5450
|
-
...
|
|
5453
|
+
...options
|
|
5451
5454
|
};
|
|
5452
5455
|
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
5453
5456
|
clonedOptions.applyPostProcessor = false;
|
|
@@ -5465,8 +5468,8 @@ var Interpolator = class {
|
|
|
5465
5468
|
value = "";
|
|
5466
5469
|
}
|
|
5467
5470
|
if (formatters.length) {
|
|
5468
|
-
value = formatters.reduce((v2, f2) => this.format(v2, f2,
|
|
5469
|
-
...
|
|
5471
|
+
value = formatters.reduce((v2, f2) => this.format(v2, f2, options.lng, {
|
|
5472
|
+
...options,
|
|
5470
5473
|
interpolationkey: match2[1].trim()
|
|
5471
5474
|
}), value.trim());
|
|
5472
5475
|
}
|
|
@@ -5528,16 +5531,16 @@ var createCachedFormatter = (fn) => {
|
|
|
5528
5531
|
};
|
|
5529
5532
|
var createNonCachedFormatter = (fn) => (v2, l2, o2) => fn(getCleanedCode(l2), o2)(v2);
|
|
5530
5533
|
var Formatter = class {
|
|
5531
|
-
constructor(
|
|
5534
|
+
constructor(options = {}) {
|
|
5532
5535
|
this.logger = baseLogger.create("formatter");
|
|
5533
|
-
this.options =
|
|
5534
|
-
this.init(
|
|
5536
|
+
this.options = options;
|
|
5537
|
+
this.init(options);
|
|
5535
5538
|
}
|
|
5536
|
-
init(services,
|
|
5539
|
+
init(services, options = {
|
|
5537
5540
|
interpolation: {}
|
|
5538
5541
|
}) {
|
|
5539
|
-
this.formatSeparator =
|
|
5540
|
-
const cf =
|
|
5542
|
+
this.formatSeparator = options.interpolation.formatSeparator || ",";
|
|
5543
|
+
const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
|
|
5541
5544
|
this.formats = {
|
|
5542
5545
|
number: cf((lng, opt) => {
|
|
5543
5546
|
const formatter = new Intl.NumberFormat(lng, {
|
|
@@ -5578,7 +5581,7 @@ var Formatter = class {
|
|
|
5578
5581
|
addCached(name, fc) {
|
|
5579
5582
|
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
5580
5583
|
}
|
|
5581
|
-
format(value, format, lng,
|
|
5584
|
+
format(value, format, lng, options = {}) {
|
|
5582
5585
|
const formats = format.split(this.formatSeparator);
|
|
5583
5586
|
if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f2) => f2.indexOf(")") > -1)) {
|
|
5584
5587
|
const lastIndex = formats.findIndex((f2) => f2.indexOf(")") > -1);
|
|
@@ -5592,11 +5595,11 @@ var Formatter = class {
|
|
|
5592
5595
|
if (this.formats[formatName]) {
|
|
5593
5596
|
let formatted = mem;
|
|
5594
5597
|
try {
|
|
5595
|
-
const valOptions =
|
|
5596
|
-
const l2 = valOptions.locale || valOptions.lng ||
|
|
5598
|
+
const valOptions = options?.formatParams?.[options.interpolationkey] || {};
|
|
5599
|
+
const l2 = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
5597
5600
|
formatted = this.formats[formatName](mem, l2, {
|
|
5598
5601
|
...formatOptions,
|
|
5599
|
-
...
|
|
5602
|
+
...options,
|
|
5600
5603
|
...valOptions
|
|
5601
5604
|
});
|
|
5602
5605
|
} catch (error) {
|
|
@@ -5618,24 +5621,24 @@ var removePending = (q2, name) => {
|
|
|
5618
5621
|
}
|
|
5619
5622
|
};
|
|
5620
5623
|
var Connector = class extends EventEmitter {
|
|
5621
|
-
constructor(backend, store, services,
|
|
5624
|
+
constructor(backend, store, services, options = {}) {
|
|
5622
5625
|
super();
|
|
5623
5626
|
this.backend = backend;
|
|
5624
5627
|
this.store = store;
|
|
5625
5628
|
this.services = services;
|
|
5626
5629
|
this.languageUtils = services.languageUtils;
|
|
5627
|
-
this.options =
|
|
5630
|
+
this.options = options;
|
|
5628
5631
|
this.logger = baseLogger.create("backendConnector");
|
|
5629
5632
|
this.waitingReads = [];
|
|
5630
|
-
this.maxParallelReads =
|
|
5633
|
+
this.maxParallelReads = options.maxParallelReads || 10;
|
|
5631
5634
|
this.readingCalls = 0;
|
|
5632
|
-
this.maxRetries =
|
|
5633
|
-
this.retryTimeout =
|
|
5635
|
+
this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
5636
|
+
this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
5634
5637
|
this.state = {};
|
|
5635
5638
|
this.queue = [];
|
|
5636
|
-
this.backend?.init?.(services,
|
|
5639
|
+
this.backend?.init?.(services, options.backend, options);
|
|
5637
5640
|
}
|
|
5638
|
-
queueLoad(languages, namespaces,
|
|
5641
|
+
queueLoad(languages, namespaces, options, callback) {
|
|
5639
5642
|
const toLoad = {};
|
|
5640
5643
|
const pending = {};
|
|
5641
5644
|
const toLoadLanguages = {};
|
|
@@ -5644,7 +5647,7 @@ var Connector = class extends EventEmitter {
|
|
|
5644
5647
|
let hasAllNamespaces = true;
|
|
5645
5648
|
namespaces.forEach((ns) => {
|
|
5646
5649
|
const name = `${lng}|${ns}`;
|
|
5647
|
-
if (!
|
|
5650
|
+
if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
5648
5651
|
this.state[name] = 2;
|
|
5649
5652
|
} else if (this.state[name] < 0) ;
|
|
5650
5653
|
else if (this.state[name] === 1) {
|
|
@@ -5757,14 +5760,14 @@ var Connector = class extends EventEmitter {
|
|
|
5757
5760
|
}
|
|
5758
5761
|
return fc(lng, ns, resolver);
|
|
5759
5762
|
}
|
|
5760
|
-
prepareLoading(languages, namespaces,
|
|
5763
|
+
prepareLoading(languages, namespaces, options = {}, callback) {
|
|
5761
5764
|
if (!this.backend) {
|
|
5762
5765
|
this.logger.warn("No backend was added via i18next.use. Will not load resources.");
|
|
5763
5766
|
return callback && callback();
|
|
5764
5767
|
}
|
|
5765
5768
|
if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
|
|
5766
5769
|
if (isString(namespaces)) namespaces = [namespaces];
|
|
5767
|
-
const toLoad = this.queueLoad(languages, namespaces,
|
|
5770
|
+
const toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
5768
5771
|
if (!toLoad.toLoad.length) {
|
|
5769
5772
|
if (!toLoad.pending.length) callback();
|
|
5770
5773
|
return null;
|
|
@@ -5791,7 +5794,7 @@ var Connector = class extends EventEmitter {
|
|
|
5791
5794
|
this.loaded(name, err2, data);
|
|
5792
5795
|
});
|
|
5793
5796
|
}
|
|
5794
|
-
saveMissing(languages, namespace, key, fallbackValue, isUpdate,
|
|
5797
|
+
saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {
|
|
5795
5798
|
}) {
|
|
5796
5799
|
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
|
|
5797
5800
|
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!!!");
|
|
@@ -5800,7 +5803,7 @@ var Connector = class extends EventEmitter {
|
|
|
5800
5803
|
if (key === void 0 || key === null || key === "") return;
|
|
5801
5804
|
if (this.backend?.create) {
|
|
5802
5805
|
const opts = {
|
|
5803
|
-
...
|
|
5806
|
+
...options,
|
|
5804
5807
|
isUpdate
|
|
5805
5808
|
};
|
|
5806
5809
|
const fc = this.backend.create.bind(this.backend);
|
|
@@ -5867,9 +5870,9 @@ var get = () => ({
|
|
|
5867
5870
|
if (isString(args[1])) ret.defaultValue = args[1];
|
|
5868
5871
|
if (isString(args[2])) ret.tDescription = args[2];
|
|
5869
5872
|
if (typeof args[2] === "object" || typeof args[3] === "object") {
|
|
5870
|
-
const
|
|
5871
|
-
Object.keys(
|
|
5872
|
-
ret[key] =
|
|
5873
|
+
const options = args[3] || args[2];
|
|
5874
|
+
Object.keys(options).forEach((key) => {
|
|
5875
|
+
ret[key] = options[key];
|
|
5873
5876
|
});
|
|
5874
5877
|
}
|
|
5875
5878
|
return ret;
|
|
@@ -5889,15 +5892,15 @@ var get = () => ({
|
|
|
5889
5892
|
},
|
|
5890
5893
|
cacheInBuiltFormats: true
|
|
5891
5894
|
});
|
|
5892
|
-
var transformOptions = (
|
|
5893
|
-
if (isString(
|
|
5894
|
-
if (isString(
|
|
5895
|
-
if (isString(
|
|
5896
|
-
if (
|
|
5897
|
-
|
|
5895
|
+
var transformOptions = (options) => {
|
|
5896
|
+
if (isString(options.ns)) options.ns = [options.ns];
|
|
5897
|
+
if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
|
|
5898
|
+
if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
|
|
5899
|
+
if (options.supportedLngs?.indexOf?.("cimode") < 0) {
|
|
5900
|
+
options.supportedLngs = options.supportedLngs.concat(["cimode"]);
|
|
5898
5901
|
}
|
|
5899
|
-
if (typeof
|
|
5900
|
-
return
|
|
5902
|
+
if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
|
|
5903
|
+
return options;
|
|
5901
5904
|
};
|
|
5902
5905
|
var noop = () => {
|
|
5903
5906
|
};
|
|
@@ -5910,53 +5913,53 @@ var bindMemberFunctions = (inst) => {
|
|
|
5910
5913
|
});
|
|
5911
5914
|
};
|
|
5912
5915
|
var I18n = class _I18n extends EventEmitter {
|
|
5913
|
-
constructor(
|
|
5916
|
+
constructor(options = {}, callback) {
|
|
5914
5917
|
super();
|
|
5915
|
-
this.options = transformOptions(
|
|
5918
|
+
this.options = transformOptions(options);
|
|
5916
5919
|
this.services = {};
|
|
5917
5920
|
this.logger = baseLogger;
|
|
5918
5921
|
this.modules = {
|
|
5919
5922
|
external: []
|
|
5920
5923
|
};
|
|
5921
5924
|
bindMemberFunctions(this);
|
|
5922
|
-
if (callback && !this.isInitialized && !
|
|
5925
|
+
if (callback && !this.isInitialized && !options.isClone) {
|
|
5923
5926
|
if (!this.options.initAsync) {
|
|
5924
|
-
this.init(
|
|
5927
|
+
this.init(options, callback);
|
|
5925
5928
|
return this;
|
|
5926
5929
|
}
|
|
5927
5930
|
setTimeout(() => {
|
|
5928
|
-
this.init(
|
|
5931
|
+
this.init(options, callback);
|
|
5929
5932
|
}, 0);
|
|
5930
5933
|
}
|
|
5931
5934
|
}
|
|
5932
|
-
init(
|
|
5935
|
+
init(options = {}, callback) {
|
|
5933
5936
|
this.isInitializing = true;
|
|
5934
|
-
if (typeof
|
|
5935
|
-
callback =
|
|
5936
|
-
|
|
5937
|
+
if (typeof options === "function") {
|
|
5938
|
+
callback = options;
|
|
5939
|
+
options = {};
|
|
5937
5940
|
}
|
|
5938
|
-
if (
|
|
5939
|
-
if (isString(
|
|
5940
|
-
|
|
5941
|
-
} else if (
|
|
5942
|
-
|
|
5941
|
+
if (options.defaultNS == null && options.ns) {
|
|
5942
|
+
if (isString(options.ns)) {
|
|
5943
|
+
options.defaultNS = options.ns;
|
|
5944
|
+
} else if (options.ns.indexOf("translation") < 0) {
|
|
5945
|
+
options.defaultNS = options.ns[0];
|
|
5943
5946
|
}
|
|
5944
5947
|
}
|
|
5945
5948
|
const defOpts = get();
|
|
5946
5949
|
this.options = {
|
|
5947
5950
|
...defOpts,
|
|
5948
5951
|
...this.options,
|
|
5949
|
-
...transformOptions(
|
|
5952
|
+
...transformOptions(options)
|
|
5950
5953
|
};
|
|
5951
5954
|
this.options.interpolation = {
|
|
5952
5955
|
...defOpts.interpolation,
|
|
5953
5956
|
...this.options.interpolation
|
|
5954
5957
|
};
|
|
5955
|
-
if (
|
|
5956
|
-
this.options.userDefinedKeySeparator =
|
|
5958
|
+
if (options.keySeparator !== void 0) {
|
|
5959
|
+
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
5957
5960
|
}
|
|
5958
|
-
if (
|
|
5959
|
-
this.options.userDefinedNsSeparator =
|
|
5961
|
+
if (options.nsSeparator !== void 0) {
|
|
5962
|
+
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
5960
5963
|
}
|
|
5961
5964
|
const createClassOnDemand = (ClassOrObject) => {
|
|
5962
5965
|
if (!ClassOrObject) return null;
|
|
@@ -6221,8 +6224,18 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6221
6224
|
const keySeparator = this.options.keySeparator || ".";
|
|
6222
6225
|
let resultKey;
|
|
6223
6226
|
if (o2.keyPrefix && Array.isArray(key)) {
|
|
6224
|
-
resultKey = key.map((k2) =>
|
|
6227
|
+
resultKey = key.map((k2) => {
|
|
6228
|
+
if (typeof k2 === "function") k2 = keysFromSelector(k2, {
|
|
6229
|
+
...this.options,
|
|
6230
|
+
...opts
|
|
6231
|
+
});
|
|
6232
|
+
return `${o2.keyPrefix}${keySeparator}${k2}`;
|
|
6233
|
+
});
|
|
6225
6234
|
} else {
|
|
6235
|
+
if (typeof key === "function") key = keysFromSelector(key, {
|
|
6236
|
+
...this.options,
|
|
6237
|
+
...opts
|
|
6238
|
+
});
|
|
6226
6239
|
resultKey = o2.keyPrefix ? `${o2.keyPrefix}${keySeparator}${key}` : key;
|
|
6227
6240
|
}
|
|
6228
6241
|
return this.t(resultKey, o2);
|
|
@@ -6245,7 +6258,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6245
6258
|
setDefaultNamespace(ns) {
|
|
6246
6259
|
this.options.defaultNS = ns;
|
|
6247
6260
|
}
|
|
6248
|
-
hasLoadedNamespace(ns,
|
|
6261
|
+
hasLoadedNamespace(ns, options = {}) {
|
|
6249
6262
|
if (!this.isInitialized) {
|
|
6250
6263
|
this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
|
|
6251
6264
|
return false;
|
|
@@ -6254,7 +6267,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6254
6267
|
this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
|
|
6255
6268
|
return false;
|
|
6256
6269
|
}
|
|
6257
|
-
const lng =
|
|
6270
|
+
const lng = options.lng || this.resolvedLanguage || this.languages[0];
|
|
6258
6271
|
const fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
6259
6272
|
const lastLng = this.languages[this.languages.length - 1];
|
|
6260
6273
|
if (lng.toLowerCase() === "cimode") return true;
|
|
@@ -6262,8 +6275,8 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6262
6275
|
const loadState = this.services.backendConnector.state[`${l2}|${n}`];
|
|
6263
6276
|
return loadState === -1 || loadState === 0 || loadState === 2;
|
|
6264
6277
|
};
|
|
6265
|
-
if (
|
|
6266
|
-
const preResult =
|
|
6278
|
+
if (options.precheck) {
|
|
6279
|
+
const preResult = options.precheck(this, loadNotPending);
|
|
6267
6280
|
if (preResult !== void 0) return preResult;
|
|
6268
6281
|
}
|
|
6269
6282
|
if (this.hasResourceBundle(lng, ns)) return true;
|
|
@@ -6319,22 +6332,22 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6319
6332
|
if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
|
|
6320
6333
|
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
6321
6334
|
}
|
|
6322
|
-
static createInstance(
|
|
6323
|
-
return new _I18n(
|
|
6335
|
+
static createInstance(options = {}, callback) {
|
|
6336
|
+
return new _I18n(options, callback);
|
|
6324
6337
|
}
|
|
6325
|
-
cloneInstance(
|
|
6326
|
-
const forkResourceStore =
|
|
6327
|
-
if (forkResourceStore) delete
|
|
6338
|
+
cloneInstance(options = {}, callback = noop) {
|
|
6339
|
+
const forkResourceStore = options.forkResourceStore;
|
|
6340
|
+
if (forkResourceStore) delete options.forkResourceStore;
|
|
6328
6341
|
const mergedOptions = {
|
|
6329
6342
|
...this.options,
|
|
6330
|
-
...
|
|
6343
|
+
...options,
|
|
6331
6344
|
...{
|
|
6332
6345
|
isClone: true
|
|
6333
6346
|
}
|
|
6334
6347
|
};
|
|
6335
6348
|
const clone = new _I18n(mergedOptions);
|
|
6336
|
-
if (
|
|
6337
|
-
clone.logger = clone.logger.clone(
|
|
6349
|
+
if (options.debug !== void 0 || options.prefix !== void 0) {
|
|
6350
|
+
clone.logger = clone.logger.clone(options);
|
|
6338
6351
|
}
|
|
6339
6352
|
const membersToCopy = ["store", "services", "language"];
|
|
6340
6353
|
membersToCopy.forEach((m2) => {
|
|
@@ -6455,7 +6468,7 @@ var loadLanguages2 = (i18n, lng, ns, cb) => {
|
|
|
6455
6468
|
});
|
|
6456
6469
|
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
6457
6470
|
};
|
|
6458
|
-
var hasLoadedNamespace2 = (ns, i18n,
|
|
6471
|
+
var hasLoadedNamespace2 = (ns, i18n, options = {}) => {
|
|
6459
6472
|
if (!i18n.languages || !i18n.languages.length) {
|
|
6460
6473
|
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
6461
6474
|
languages: i18n.languages
|
|
@@ -6463,9 +6476,9 @@ var hasLoadedNamespace2 = (ns, i18n, options2 = {}) => {
|
|
|
6463
6476
|
return true;
|
|
6464
6477
|
}
|
|
6465
6478
|
return i18n.hasLoadedNamespace(ns, {
|
|
6466
|
-
lng:
|
|
6479
|
+
lng: options.lng,
|
|
6467
6480
|
precheck: (i18nInstance2, loadNotPending) => {
|
|
6468
|
-
if (
|
|
6481
|
+
if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
|
|
6469
6482
|
}
|
|
6470
6483
|
});
|
|
6471
6484
|
};
|
|
@@ -6510,10 +6523,10 @@ var defaultOptions = {
|
|
|
6510
6523
|
useSuspense: true,
|
|
6511
6524
|
unescape
|
|
6512
6525
|
};
|
|
6513
|
-
var setDefaults = (
|
|
6526
|
+
var setDefaults = (options = {}) => {
|
|
6514
6527
|
defaultOptions = {
|
|
6515
6528
|
...defaultOptions,
|
|
6516
|
-
...
|
|
6529
|
+
...options
|
|
6517
6530
|
};
|
|
6518
6531
|
};
|
|
6519
6532
|
var getDefaults = () => defaultOptions;
|
|
@@ -7044,12 +7057,12 @@ var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.ra
|
|
|
7044
7057
|
var native_default = { randomUUID };
|
|
7045
7058
|
|
|
7046
7059
|
// node_modules/uuid/dist/esm-browser/v4.js
|
|
7047
|
-
function v4(
|
|
7048
|
-
if (native_default.randomUUID && !buf && !
|
|
7060
|
+
function v4(options, buf, offset) {
|
|
7061
|
+
if (native_default.randomUUID && !buf && !options) {
|
|
7049
7062
|
return native_default.randomUUID();
|
|
7050
7063
|
}
|
|
7051
|
-
|
|
7052
|
-
const rnds =
|
|
7064
|
+
options = options || {};
|
|
7065
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
7053
7066
|
if (rnds.length < 16) {
|
|
7054
7067
|
throw new Error("Random bytes length must be >= 16");
|
|
7055
7068
|
}
|
|
@@ -8473,6 +8486,21 @@ function ComponentCapabilitiesFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8473
8486
|
};
|
|
8474
8487
|
}
|
|
8475
8488
|
|
|
8489
|
+
// src/api/checkoutexternal/models/ComponentCheckoutSettings.ts
|
|
8490
|
+
function ComponentCheckoutSettingsFromJSON(json) {
|
|
8491
|
+
return ComponentCheckoutSettingsFromJSONTyped(json, false);
|
|
8492
|
+
}
|
|
8493
|
+
function ComponentCheckoutSettingsFromJSONTyped(json, ignoreDiscriminator) {
|
|
8494
|
+
if (json == null) {
|
|
8495
|
+
return json;
|
|
8496
|
+
}
|
|
8497
|
+
return {
|
|
8498
|
+
collectAddress: json["collect_address"],
|
|
8499
|
+
collectEmail: json["collect_email"],
|
|
8500
|
+
collectPhone: json["collect_phone"]
|
|
8501
|
+
};
|
|
8502
|
+
}
|
|
8503
|
+
|
|
8476
8504
|
// src/api/checkoutexternal/models/PlanDetailResponseData.ts
|
|
8477
8505
|
function PlanDetailResponseDataFromJSON(json) {
|
|
8478
8506
|
return PlanDetailResponseDataFromJSONTyped(json, false);
|
|
@@ -8670,6 +8698,9 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8670
8698
|
CompatiblePlansFromJSON
|
|
8671
8699
|
),
|
|
8672
8700
|
capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON(json["capabilities"]),
|
|
8701
|
+
checkoutSettings: ComponentCheckoutSettingsFromJSON(
|
|
8702
|
+
json["checkout_settings"]
|
|
8703
|
+
),
|
|
8673
8704
|
company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
|
|
8674
8705
|
component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
|
|
8675
8706
|
creditBundles: json["credit_bundles"].map(
|
|
@@ -10420,18 +10451,18 @@ var EmbedProvider = ({
|
|
|
10420
10451
|
children,
|
|
10421
10452
|
apiKey,
|
|
10422
10453
|
apiConfig,
|
|
10423
|
-
...
|
|
10454
|
+
...options
|
|
10424
10455
|
}) => {
|
|
10425
10456
|
const sessionIdRef = useRef2(v4_default());
|
|
10426
10457
|
const styleRef = useRef2(null);
|
|
10427
|
-
const [state, dispatch] = useReducer(reducer,
|
|
10458
|
+
const [state, dispatch] = useReducer(reducer, options, (opts) => {
|
|
10428
10459
|
const providedState = { settings: opts.settings || {} };
|
|
10429
10460
|
const resolvedState = (0, import_merge2.default)({}, initialState, providedState);
|
|
10430
10461
|
return resolvedState;
|
|
10431
10462
|
});
|
|
10432
10463
|
const customHeaders = useMemo3(
|
|
10433
10464
|
() => ({
|
|
10434
|
-
"X-Schematic-Components-Version": "1.4.
|
|
10465
|
+
"X-Schematic-Components-Version": "1.4.2",
|
|
10435
10466
|
"X-Schematic-Session-ID": sessionIdRef.current
|
|
10436
10467
|
}),
|
|
10437
10468
|
[]
|
|
@@ -10439,11 +10470,11 @@ var EmbedProvider = ({
|
|
|
10439
10470
|
const [api, setApi] = useState2({});
|
|
10440
10471
|
const debug = useCallback3(
|
|
10441
10472
|
(message, ...args) => {
|
|
10442
|
-
if (
|
|
10473
|
+
if (options.debug) {
|
|
10443
10474
|
console.debug(`[Schematic] ${message}`, ...args);
|
|
10444
10475
|
}
|
|
10445
10476
|
},
|
|
10446
|
-
[
|
|
10477
|
+
[options.debug]
|
|
10447
10478
|
);
|
|
10448
10479
|
const hydratePublic = useCallback3(async () => {
|
|
10449
10480
|
dispatch({ type: "HYDRATE_STARTED" });
|
|
@@ -10653,8 +10684,8 @@ var EmbedProvider = ({
|
|
|
10653
10684
|
dispatch({ type: "SET_DATA", data });
|
|
10654
10685
|
}, []);
|
|
10655
10686
|
const updateSettings = useCallback3(
|
|
10656
|
-
(settings = {},
|
|
10657
|
-
dispatch({ type: "UPDATE_SETTINGS", settings, update:
|
|
10687
|
+
(settings = {}, options2) => {
|
|
10688
|
+
dispatch({ type: "UPDATE_SETTINGS", settings, update: options2?.update });
|
|
10658
10689
|
},
|
|
10659
10690
|
[]
|
|
10660
10691
|
);
|
|
@@ -10745,9 +10776,9 @@ var EmbedProvider = ({
|
|
|
10745
10776
|
}
|
|
10746
10777
|
}, [debug, state.error]);
|
|
10747
10778
|
useEffect2(() => {
|
|
10748
|
-
const providedSettings = { ...
|
|
10779
|
+
const providedSettings = { ...options.settings || {} };
|
|
10749
10780
|
updateSettings(providedSettings, { update: false });
|
|
10750
|
-
}, [
|
|
10781
|
+
}, [options.settings, updateSettings]);
|
|
10751
10782
|
useEffect2(() => {
|
|
10752
10783
|
const planChanged = (event) => {
|
|
10753
10784
|
if (event instanceof CustomEvent) {
|
|
@@ -12440,6 +12471,7 @@ var Sidebar = ({
|
|
|
12440
12471
|
addOns,
|
|
12441
12472
|
creditBundles = [],
|
|
12442
12473
|
usageBasedEntitlements,
|
|
12474
|
+
addOnUsageBasedEntitlements = [],
|
|
12443
12475
|
charges,
|
|
12444
12476
|
checkoutRef,
|
|
12445
12477
|
checkoutStage,
|
|
@@ -12624,6 +12656,35 @@ var Sidebar = ({
|
|
|
12624
12656
|
}
|
|
12625
12657
|
setError(void 0);
|
|
12626
12658
|
setIsLoading(true);
|
|
12659
|
+
const planPayInAdvance = payInAdvanceEntitlements.reduce(
|
|
12660
|
+
(acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
|
|
12661
|
+
const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
|
|
12662
|
+
if (priceId2) {
|
|
12663
|
+
acc.push({
|
|
12664
|
+
priceId: priceId2,
|
|
12665
|
+
quantity
|
|
12666
|
+
});
|
|
12667
|
+
}
|
|
12668
|
+
return acc;
|
|
12669
|
+
},
|
|
12670
|
+
[]
|
|
12671
|
+
);
|
|
12672
|
+
const addOnPayInAdvance = addOnUsageBasedEntitlements.filter(
|
|
12673
|
+
(entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
|
|
12674
|
+
).reduce(
|
|
12675
|
+
(acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
|
|
12676
|
+
const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
|
|
12677
|
+
if (priceId2) {
|
|
12678
|
+
acc.push({
|
|
12679
|
+
priceId: priceId2,
|
|
12680
|
+
quantity
|
|
12681
|
+
});
|
|
12682
|
+
}
|
|
12683
|
+
return acc;
|
|
12684
|
+
},
|
|
12685
|
+
[]
|
|
12686
|
+
);
|
|
12687
|
+
const allPayInAdvance = [...planPayInAdvance, ...addOnPayInAdvance];
|
|
12627
12688
|
await checkout({
|
|
12628
12689
|
newPlanId: planId,
|
|
12629
12690
|
newPriceId: priceId,
|
|
@@ -12639,19 +12700,7 @@ var Sidebar = ({
|
|
|
12639
12700
|
}
|
|
12640
12701
|
return acc;
|
|
12641
12702
|
}, []),
|
|
12642
|
-
payInAdvance:
|
|
12643
|
-
(acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
|
|
12644
|
-
const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
|
|
12645
|
-
if (priceId2) {
|
|
12646
|
-
acc.push({
|
|
12647
|
-
priceId: priceId2,
|
|
12648
|
-
quantity
|
|
12649
|
-
});
|
|
12650
|
-
}
|
|
12651
|
-
return acc;
|
|
12652
|
-
},
|
|
12653
|
-
[]
|
|
12654
|
-
),
|
|
12703
|
+
payInAdvance: allPayInAdvance,
|
|
12655
12704
|
creditBundles: creditBundles.reduce(
|
|
12656
12705
|
(acc, { id, count }) => {
|
|
12657
12706
|
if (count > 0) {
|
|
@@ -12689,6 +12738,7 @@ var Sidebar = ({
|
|
|
12689
12738
|
setIsLoading,
|
|
12690
12739
|
setLayout,
|
|
12691
12740
|
payInAdvanceEntitlements,
|
|
12741
|
+
addOnUsageBasedEntitlements,
|
|
12692
12742
|
willTrialWithoutPaymentMethod,
|
|
12693
12743
|
promoCode
|
|
12694
12744
|
]);
|
|
@@ -14384,6 +14434,12 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14384
14434
|
),
|
|
14385
14435
|
[usageBasedEntitlements]
|
|
14386
14436
|
);
|
|
14437
|
+
const addOnPayInAdvanceEntitlements = useMemo9(
|
|
14438
|
+
() => addOnUsageBasedEntitlements.filter(
|
|
14439
|
+
(entitlement) => entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */
|
|
14440
|
+
),
|
|
14441
|
+
[addOnUsageBasedEntitlements]
|
|
14442
|
+
);
|
|
14387
14443
|
const [promoCode, setPromoCode] = useState9(null);
|
|
14388
14444
|
const [isPaymentMethodRequired, setIsPaymentMethodRequired] = useState9(false);
|
|
14389
14445
|
const willTrialWithoutPaymentMethod = useMemo9(
|
|
@@ -14678,7 +14734,10 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14678
14734
|
}))
|
|
14679
14735
|
);
|
|
14680
14736
|
setAddOnUsageBasedEntitlements(updatedAddOnEntitlements);
|
|
14681
|
-
handlePreviewCheckout({
|
|
14737
|
+
handlePreviewCheckout({
|
|
14738
|
+
addOns: updated,
|
|
14739
|
+
addOnPayInAdvanceEntitlements: updatedAddOnEntitlements
|
|
14740
|
+
});
|
|
14682
14741
|
return updated;
|
|
14683
14742
|
});
|
|
14684
14743
|
},
|
|
@@ -14924,7 +14983,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14924
14983
|
isLoading,
|
|
14925
14984
|
period: planPeriod,
|
|
14926
14985
|
selectedPlan,
|
|
14927
|
-
entitlements:
|
|
14986
|
+
entitlements: addOnPayInAdvanceEntitlements,
|
|
14928
14987
|
updateQuantity: updateAddOnEntitlementQuantity
|
|
14929
14988
|
}
|
|
14930
14989
|
) : checkoutStage === "credits" ? /* @__PURE__ */ jsx20(
|
|
@@ -14952,6 +15011,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14952
15011
|
selectedPlan,
|
|
14953
15012
|
addOns,
|
|
14954
15013
|
usageBasedEntitlements,
|
|
15014
|
+
addOnUsageBasedEntitlements,
|
|
14955
15015
|
creditBundles,
|
|
14956
15016
|
charges,
|
|
14957
15017
|
checkoutRef,
|
|
@@ -15077,7 +15137,7 @@ var PaymentForm = ({ onConfirm }) => {
|
|
|
15077
15137
|
import { useMemo as useMemo10 } from "react";
|
|
15078
15138
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
15079
15139
|
var PeriodToggle = ({
|
|
15080
|
-
options
|
|
15140
|
+
options,
|
|
15081
15141
|
selectedOption,
|
|
15082
15142
|
selectedPlan,
|
|
15083
15143
|
onSelect
|
|
@@ -15110,7 +15170,7 @@ var PeriodToggle = ({
|
|
|
15110
15170
|
$width: "fit-content"
|
|
15111
15171
|
}
|
|
15112
15172
|
},
|
|
15113
|
-
children:
|
|
15173
|
+
children: options.map((option) => {
|
|
15114
15174
|
const element = /* @__PURE__ */ jsx23(
|
|
15115
15175
|
Flex,
|
|
15116
15176
|
{
|
|
@@ -16162,8 +16222,8 @@ function resolveDesignProps3(props) {
|
|
|
16162
16222
|
}
|
|
16163
16223
|
};
|
|
16164
16224
|
}
|
|
16165
|
-
function formatInvoices(invoices,
|
|
16166
|
-
const { hideUpcoming = true } =
|
|
16225
|
+
function formatInvoices(invoices, options) {
|
|
16226
|
+
const { hideUpcoming = true } = options || {};
|
|
16167
16227
|
const now = /* @__PURE__ */ new Date();
|
|
16168
16228
|
return (invoices || []).filter(({ dueDate }) => !hideUpcoming || dueDate && +dueDate <= +now).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url, currency }) => ({
|
|
16169
16229
|
amount: formatCurrency(amountDue, currency),
|
|
@@ -17084,7 +17144,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
17084
17144
|
}
|
|
17085
17145
|
stripe._registerWrapper({
|
|
17086
17146
|
name: "stripe-js",
|
|
17087
|
-
version: "7.
|
|
17147
|
+
version: "7.9.0",
|
|
17088
17148
|
startTime
|
|
17089
17149
|
});
|
|
17090
17150
|
};
|
|
@@ -17159,7 +17219,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
17159
17219
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
17160
17220
|
var expectedVersion = RELEASE_TRAIN;
|
|
17161
17221
|
if (isTestKey && version !== expectedVersion) {
|
|
17162
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.
|
|
17222
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
17163
17223
|
}
|
|
17164
17224
|
var stripe = maybeStripe.apply(void 0, args);
|
|
17165
17225
|
registerWrapper(stripe, startTime);
|
|
@@ -21185,7 +21245,7 @@ var {
|
|
|
21185
21245
|
Z_DEFAULT_STRATEGY,
|
|
21186
21246
|
Z_DEFLATED: Z_DEFLATED$1
|
|
21187
21247
|
} = constants$2;
|
|
21188
|
-
function Deflate$1(
|
|
21248
|
+
function Deflate$1(options) {
|
|
21189
21249
|
this.options = common.assign({
|
|
21190
21250
|
level: Z_DEFAULT_COMPRESSION,
|
|
21191
21251
|
method: Z_DEFLATED$1,
|
|
@@ -21193,7 +21253,7 @@ function Deflate$1(options2) {
|
|
|
21193
21253
|
windowBits: 15,
|
|
21194
21254
|
memLevel: 8,
|
|
21195
21255
|
strategy: Z_DEFAULT_STRATEGY
|
|
21196
|
-
},
|
|
21256
|
+
}, options || {});
|
|
21197
21257
|
let opt = this.options;
|
|
21198
21258
|
if (opt.raw && opt.windowBits > 0) {
|
|
21199
21259
|
opt.windowBits = -opt.windowBits;
|
|
@@ -21299,23 +21359,23 @@ Deflate$1.prototype.onEnd = function(status) {
|
|
|
21299
21359
|
this.err = status;
|
|
21300
21360
|
this.msg = this.strm.msg;
|
|
21301
21361
|
};
|
|
21302
|
-
function deflate$1(input,
|
|
21303
|
-
const deflator = new Deflate$1(
|
|
21362
|
+
function deflate$1(input, options) {
|
|
21363
|
+
const deflator = new Deflate$1(options);
|
|
21304
21364
|
deflator.push(input, true);
|
|
21305
21365
|
if (deflator.err) {
|
|
21306
21366
|
throw deflator.msg || messages[deflator.err];
|
|
21307
21367
|
}
|
|
21308
21368
|
return deflator.result;
|
|
21309
21369
|
}
|
|
21310
|
-
function deflateRaw$1(input,
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
return deflate$1(input,
|
|
21370
|
+
function deflateRaw$1(input, options) {
|
|
21371
|
+
options = options || {};
|
|
21372
|
+
options.raw = true;
|
|
21373
|
+
return deflate$1(input, options);
|
|
21314
21374
|
}
|
|
21315
|
-
function gzip$1(input,
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
return deflate$1(input,
|
|
21375
|
+
function gzip$1(input, options) {
|
|
21376
|
+
options = options || {};
|
|
21377
|
+
options.gzip = true;
|
|
21378
|
+
return deflate$1(input, options);
|
|
21319
21379
|
}
|
|
21320
21380
|
var Deflate_1$1 = Deflate$1;
|
|
21321
21381
|
var deflate_2 = deflate$1;
|
|
@@ -23128,12 +23188,12 @@ var {
|
|
|
23128
23188
|
Z_DATA_ERROR,
|
|
23129
23189
|
Z_MEM_ERROR
|
|
23130
23190
|
} = constants$2;
|
|
23131
|
-
function Inflate$1(
|
|
23191
|
+
function Inflate$1(options) {
|
|
23132
23192
|
this.options = common.assign({
|
|
23133
23193
|
chunkSize: 1024 * 64,
|
|
23134
23194
|
windowBits: 15,
|
|
23135
23195
|
to: ""
|
|
23136
|
-
},
|
|
23196
|
+
}, options || {});
|
|
23137
23197
|
const opt = this.options;
|
|
23138
23198
|
if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
|
|
23139
23199
|
opt.windowBits = -opt.windowBits;
|
|
@@ -23141,7 +23201,7 @@ function Inflate$1(options2) {
|
|
|
23141
23201
|
opt.windowBits = -15;
|
|
23142
23202
|
}
|
|
23143
23203
|
}
|
|
23144
|
-
if (opt.windowBits >= 0 && opt.windowBits < 16 && !(
|
|
23204
|
+
if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
|
|
23145
23205
|
opt.windowBits += 32;
|
|
23146
23206
|
}
|
|
23147
23207
|
if (opt.windowBits > 15 && opt.windowBits < 48) {
|
|
@@ -23263,16 +23323,16 @@ Inflate$1.prototype.onEnd = function(status) {
|
|
|
23263
23323
|
this.err = status;
|
|
23264
23324
|
this.msg = this.strm.msg;
|
|
23265
23325
|
};
|
|
23266
|
-
function inflate$1(input,
|
|
23267
|
-
const inflator = new Inflate$1(
|
|
23326
|
+
function inflate$1(input, options) {
|
|
23327
|
+
const inflator = new Inflate$1(options);
|
|
23268
23328
|
inflator.push(input);
|
|
23269
23329
|
if (inflator.err) throw inflator.msg || messages[inflator.err];
|
|
23270
23330
|
return inflator.result;
|
|
23271
23331
|
}
|
|
23272
|
-
function inflateRaw$1(input,
|
|
23273
|
-
|
|
23274
|
-
|
|
23275
|
-
return inflate$1(input,
|
|
23332
|
+
function inflateRaw$1(input, options) {
|
|
23333
|
+
options = options || {};
|
|
23334
|
+
options.raw = true;
|
|
23335
|
+
return inflate$1(input, options);
|
|
23276
23336
|
}
|
|
23277
23337
|
var Inflate_1$1 = Inflate$1;
|
|
23278
23338
|
var inflate_2 = inflate$1;
|
|
@@ -23340,8 +23400,8 @@ function parseEditorState(data) {
|
|
|
23340
23400
|
});
|
|
23341
23401
|
return arr;
|
|
23342
23402
|
}
|
|
23343
|
-
function createRenderer(
|
|
23344
|
-
const { useFallback = false } =
|
|
23403
|
+
function createRenderer(options) {
|
|
23404
|
+
const { useFallback = false } = options || {};
|
|
23345
23405
|
return function renderNode(node2, index) {
|
|
23346
23406
|
const { type, props = {}, children } = node2;
|
|
23347
23407
|
const name = typeof type !== "string" ? type.resolvedName : type;
|