@nemme/js-sdk 0.8.0 → 0.9.1
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/chunks/client-DIdesTQt.js +2 -0
- package/dist/chunks/client-DIdesTQt.js.map +1 -0
- package/dist/chunks/{client-DNUAujt4.js → client-PmTyYyc6.js} +32 -26
- package/dist/chunks/client-PmTyYyc6.js.map +1 -0
- package/dist/chunks/form-manager-CdG9IzjD.js.map +1 -1
- package/dist/chunks/{form-manager-DRUgPPf5.js → form-manager-Cf8vMLbu.js} +38 -38
- package/dist/chunks/{form-manager-DRUgPPf5.js.map → form-manager-Cf8vMLbu.js.map} +1 -1
- package/dist/deliveries/delivery-manager.d.ts +9 -0
- package/dist/forms.esm.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/js-sdk.css +1 -1
- package/dist/nemme-sdk.umd.js +8 -8
- package/dist/nemme-sdk.umd.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.esm.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/client-DNUAujt4.js.map +0 -1
- package/dist/chunks/client-TSUaCkOO.js +0 -2
- package/dist/chunks/client-TSUaCkOO.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as b from "react";
|
|
2
2
|
import $e, { createContext as we, useContext as kt, useMemo as ue, useRef as fe, useCallback as G, useState as St, useEffect as en, createElement as me, forwardRef as tn } from "react";
|
|
3
3
|
import { createRoot as nn } from "react-dom/client";
|
|
4
|
-
import { c as rn, h as
|
|
4
|
+
import { c as rn, h as Ze } from "./httpClient-D2IO92uv.js";
|
|
5
5
|
import { j as k } from "./jsx-runtime-jIxVPx5o.js";
|
|
6
6
|
const E = (t) => typeof t == "string", se = () => {
|
|
7
7
|
let t, e;
|
|
@@ -158,7 +158,7 @@ class be {
|
|
|
158
158
|
return e = e || this.options, e.prefix = e.prefix || this.prefix, new be(this.logger, e);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
var
|
|
161
|
+
var Z = new be();
|
|
162
162
|
class ke {
|
|
163
163
|
constructor() {
|
|
164
164
|
this.observers = {};
|
|
@@ -284,7 +284,7 @@ function Be(t, e) {
|
|
|
284
284
|
const Je = {}, Re = (t) => !E(t) && typeof t != "boolean" && typeof t != "number";
|
|
285
285
|
class xe extends ke {
|
|
286
286
|
constructor(e, n = {}) {
|
|
287
|
-
super(), an(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
287
|
+
super(), an(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = Z.create("translator");
|
|
288
288
|
}
|
|
289
289
|
changeLanguage(e) {
|
|
290
290
|
e && (this.language = e);
|
|
@@ -411,14 +411,14 @@ class xe extends ke {
|
|
|
411
411
|
for (let P = 0; P < ee.length; P++)
|
|
412
412
|
$.push(ee[P]);
|
|
413
413
|
else this.options.saveMissingTo === "all" ? $ = this.languageUtils.toResolveHierarchy(a.lng || this.language) : $.push(a.lng || this.language);
|
|
414
|
-
const V = (P, H,
|
|
415
|
-
const te = A &&
|
|
414
|
+
const V = (P, H, q) => {
|
|
415
|
+
const te = A && q !== d ? q : I;
|
|
416
416
|
this.options.missingKeyHandler ? this.options.missingKeyHandler(P, l, H, te, M, a) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(P, l, H, te, M, a), this.emit("missingKey", P, l, H, d);
|
|
417
417
|
};
|
|
418
418
|
this.options.saveMissing && (this.options.saveMissingPlurals && S ? $.forEach((P) => {
|
|
419
419
|
const H = this.pluralResolver.getSuffixes(P, a);
|
|
420
|
-
_ && a[`defaultValue${this.options.pluralSeparator}zero`] && H.indexOf(`${this.options.pluralSeparator}zero`) < 0 && H.push(`${this.options.pluralSeparator}zero`), H.forEach((
|
|
421
|
-
V([P], o +
|
|
420
|
+
_ && a[`defaultValue${this.options.pluralSeparator}zero`] && H.indexOf(`${this.options.pluralSeparator}zero`) < 0 && H.push(`${this.options.pluralSeparator}zero`), H.forEach((q) => {
|
|
421
|
+
V([P], o + q, a[`defaultValue${q}`] || L);
|
|
422
422
|
});
|
|
423
423
|
}) : V($, o, L));
|
|
424
424
|
}
|
|
@@ -536,7 +536,7 @@ class xe extends ke {
|
|
|
536
536
|
}
|
|
537
537
|
class Qe {
|
|
538
538
|
constructor(e) {
|
|
539
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
539
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = Z.create("languageUtils");
|
|
540
540
|
}
|
|
541
541
|
getScriptPartFromCode(e) {
|
|
542
542
|
if (e = pe(e), !e || e.indexOf("-") < 0) return null;
|
|
@@ -613,7 +613,7 @@ const et = {
|
|
|
613
613
|
};
|
|
614
614
|
class yn {
|
|
615
615
|
constructor(e, n = {}) {
|
|
616
|
-
this.languageUtils = e, this.options = n, this.logger =
|
|
616
|
+
this.languageUtils = e, this.options = n, this.logger = Z.create("pluralResolver"), this.pluralRulesCache = {};
|
|
617
617
|
}
|
|
618
618
|
clearCache() {
|
|
619
619
|
this.pluralRulesCache = {};
|
|
@@ -661,7 +661,7 @@ const nt = (t, e, n, r = ".", a = !0) => {
|
|
|
661
661
|
}, Ne = (t) => t.replace(/\$/g, "$$$$");
|
|
662
662
|
class rt {
|
|
663
663
|
constructor(e = {}) {
|
|
664
|
-
this.logger =
|
|
664
|
+
this.logger = Z.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((n) => n), this.init(e);
|
|
665
665
|
}
|
|
666
666
|
init(e = {}) {
|
|
667
667
|
e.interpolation || (e.interpolation = {
|
|
@@ -810,7 +810,7 @@ const bn = (t) => {
|
|
|
810
810
|
}, xn = (t) => (e, n, r) => t(pe(n), r)(e);
|
|
811
811
|
class vn {
|
|
812
812
|
constructor(e = {}) {
|
|
813
|
-
this.logger =
|
|
813
|
+
this.logger = Z.create("formatter"), this.options = e, this.init(e);
|
|
814
814
|
}
|
|
815
815
|
init(e, n = {
|
|
816
816
|
interpolation: {}
|
|
@@ -892,7 +892,7 @@ const wn = (t, e) => {
|
|
|
892
892
|
};
|
|
893
893
|
class kn extends ke {
|
|
894
894
|
constructor(e, n, r, a = {}) {
|
|
895
|
-
super(), this.backend = e, this.store = n, this.services = r, this.languageUtils = r.languageUtils, this.options = a, this.logger =
|
|
895
|
+
super(), this.backend = e, this.store = n, this.services = r, this.languageUtils = r.languageUtils, this.options = a, this.logger = Z.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = a.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = a.maxRetries >= 0 ? a.maxRetries : 5, this.retryTimeout = a.retryTimeout >= 1 ? a.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(r, a.backend, a);
|
|
896
896
|
}
|
|
897
897
|
queueLoad(e, n, r, a) {
|
|
898
898
|
const s = {}, i = {}, o = {}, u = {};
|
|
@@ -1087,7 +1087,7 @@ let it = !1;
|
|
|
1087
1087
|
const En = (t) => !!(t?.modules?.backend?.name?.indexOf("Locize") > 0 || t?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0 || t?.options?.backend?.backends && t.options.backend.backends.some((e) => e?.name?.indexOf("Locize") > 0 || e?.constructor?.name?.indexOf("Locize") > 0));
|
|
1088
1088
|
class de extends ke {
|
|
1089
1089
|
constructor(e = {}, n) {
|
|
1090
|
-
if (super(), this.options = st(e), this.services = {}, this.logger =
|
|
1090
|
+
if (super(), this.options = st(e), this.services = {}, this.logger = Z, this.modules = {
|
|
1091
1091
|
external: []
|
|
1092
1092
|
}, Sn(this), n && !this.isInitialized && !e.isClone) {
|
|
1093
1093
|
if (!this.options.initAsync)
|
|
@@ -1110,13 +1110,13 @@ class de extends ke {
|
|
|
1110
1110
|
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = r.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !En(this) && !it && (typeof console < "u" && typeof console.info < "u" && console.info("🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), it = !0);
|
|
1111
1111
|
const a = (l) => l ? typeof l == "function" ? new l() : l : null;
|
|
1112
1112
|
if (!this.options.isClone) {
|
|
1113
|
-
this.modules.logger ?
|
|
1113
|
+
this.modules.logger ? Z.init(a(this.modules.logger), this.options) : Z.init(null, this.options);
|
|
1114
1114
|
let l;
|
|
1115
1115
|
this.modules.formatter ? l = this.modules.formatter : l = vn;
|
|
1116
1116
|
const p = new Qe(this.options);
|
|
1117
1117
|
this.store = new Xe(this.options.resources, this.options);
|
|
1118
1118
|
const c = this.services;
|
|
1119
|
-
c.logger =
|
|
1119
|
+
c.logger = Z, c.resourceStore = this.store, c.languageUtils = p, c.pluralResolver = new yn(p, {
|
|
1120
1120
|
prepend: this.options.pluralSeparator,
|
|
1121
1121
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1122
1122
|
}), this.options.interpolation.format && this.options.interpolation.format !== r.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), l && (!this.options.interpolation.format || this.options.interpolation.format === r.interpolation.format) && (c.formatter = a(l), c.formatter.init && c.formatter.init(c, this.options), this.options.interpolation.format = c.formatter.format.bind(c.formatter)), c.interpolator = new rt(this.options), c.utils = {
|
|
@@ -1586,7 +1586,7 @@ function Vn({
|
|
|
1586
1586
|
value: r
|
|
1587
1587
|
}, n);
|
|
1588
1588
|
}
|
|
1589
|
-
const
|
|
1589
|
+
const qn = ({ step: t, form: e, formState: n, onDismiss: r, onNextStep: a, onPreviousStep: s, onUpdateResponse: i }) => {
|
|
1590
1590
|
const { t: o } = Ue(), l = ((p) => {
|
|
1591
1591
|
let c = 0;
|
|
1592
1592
|
if (e.startTransition) {
|
|
@@ -1714,7 +1714,7 @@ const Zn = ({ step: t, form: e, formState: n, onDismiss: r, onNextStep: a, onPre
|
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
1716
|
return null;
|
|
1717
|
-
},
|
|
1717
|
+
}, Zn = ({ form: t, onDismiss: e, onComplete: n, zIndex: r = 100 }) => {
|
|
1718
1718
|
const s = (t.startTransition ? 1 : 0) + t.questions.length + (t.endTransition ? 1 : 0) - 1, [i, o] = St({
|
|
1719
1719
|
responses: {},
|
|
1720
1720
|
currentStep: 0,
|
|
@@ -1751,7 +1751,7 @@ const Zn = ({ step: t, form: e, formState: n, onDismiss: r, onNextStep: a, onPre
|
|
|
1751
1751
|
className: "flex flex-col justify-center items-center fixed inset-0 bg-overlay-background-default-light dark:bg-overlay-background-default-dark",
|
|
1752
1752
|
style: { zIndex: r },
|
|
1753
1753
|
children: /* @__PURE__ */ k.jsx(
|
|
1754
|
-
|
|
1754
|
+
qn,
|
|
1755
1755
|
{
|
|
1756
1756
|
step: i.currentStep,
|
|
1757
1757
|
form: t,
|
|
@@ -2461,12 +2461,12 @@ var Jn = Object.create, Ee = Object.defineProperty, Qn = Object.defineProperties
|
|
|
2461
2461
|
M--, I = d.slice(B, V), $.index -= B;
|
|
2462
2462
|
} else if ($ = u(j, 0, I, L), !$)
|
|
2463
2463
|
continue;
|
|
2464
|
-
var H = $.index,
|
|
2464
|
+
var H = $.index, q = $[0], te = I.slice(0, H), qe = I.slice(H + q.length), Fe = B + I.length;
|
|
2465
2465
|
w && Fe > w.reach && (w.reach = Fe);
|
|
2466
2466
|
var ge = C.prev;
|
|
2467
2467
|
te && (ge = c(g, ge, te), B += te.length), h(g, ge, M);
|
|
2468
|
-
var Qt = new o(S, _ ? i.tokenize(
|
|
2469
|
-
if (C = c(g, ge, Qt),
|
|
2468
|
+
var Qt = new o(S, _ ? i.tokenize(q, _) : q, N, q);
|
|
2469
|
+
if (C = c(g, ge, Qt), qe && c(g, C, qe), M > 1) {
|
|
2470
2470
|
var Oe = {
|
|
2471
2471
|
cause: S + "," + O,
|
|
2472
2472
|
reach: Fe
|
|
@@ -2777,7 +2777,7 @@ ar(lr, {
|
|
|
2777
2777
|
duotoneDark: () => pr,
|
|
2778
2778
|
duotoneLight: () => fr,
|
|
2779
2779
|
github: () => mr,
|
|
2780
|
-
gruvboxMaterialDark: () =>
|
|
2780
|
+
gruvboxMaterialDark: () => qr,
|
|
2781
2781
|
gruvboxMaterialLight: () => Wr,
|
|
2782
2782
|
jettwaveDark: () => $r,
|
|
2783
2783
|
jettwaveLight: () => Br,
|
|
@@ -4542,7 +4542,7 @@ var ur = {
|
|
|
4542
4542
|
}
|
|
4543
4543
|
}
|
|
4544
4544
|
]
|
|
4545
|
-
},
|
|
4545
|
+
}, qr = Vr, Zr = {
|
|
4546
4546
|
plain: {
|
|
4547
4547
|
color: "#654735",
|
|
4548
4548
|
backgroundColor: "#f9f5d7"
|
|
@@ -4614,7 +4614,7 @@ var ur = {
|
|
|
4614
4614
|
}
|
|
4615
4615
|
}
|
|
4616
4616
|
]
|
|
4617
|
-
}, Wr =
|
|
4617
|
+
}, Wr = Zr, Gr = (t) => G(
|
|
4618
4618
|
(e) => {
|
|
4619
4619
|
var n = e, { className: r, style: a, line: s } = n, i = Mt(n, ["className", "style", "line"]);
|
|
4620
4620
|
const o = Ae(W({}, i), {
|
|
@@ -4804,17 +4804,17 @@ function pa() {
|
|
|
4804
4804
|
return yt || (yt = 1, ht.exports = /* @__PURE__ */ da()), ht.exports;
|
|
4805
4805
|
}
|
|
4806
4806
|
var J = /* @__PURE__ */ pa();
|
|
4807
|
-
function
|
|
4807
|
+
function qt(t) {
|
|
4808
4808
|
var e, n, r = "";
|
|
4809
4809
|
if (typeof t == "string" || typeof t == "number") r += t;
|
|
4810
4810
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
4811
4811
|
var a = t.length;
|
|
4812
|
-
for (e = 0; e < a; e++) t[e] && (n =
|
|
4812
|
+
for (e = 0; e < a; e++) t[e] && (n = qt(t[e])) && (r && (r += " "), r += n);
|
|
4813
4813
|
} else for (n in t) t[n] && (r && (r += " "), r += n);
|
|
4814
4814
|
return r;
|
|
4815
4815
|
}
|
|
4816
4816
|
function ga() {
|
|
4817
|
-
for (var t, e, n = 0, r = "", a = arguments.length; n < a; n++) (t = arguments[n]) && (e =
|
|
4817
|
+
for (var t, e, n = 0, r = "", a = arguments.length; n < a; n++) (t = arguments[n]) && (e = qt(t)) && (r && (r += " "), r += e);
|
|
4818
4818
|
return r;
|
|
4819
4819
|
}
|
|
4820
4820
|
const z = ga, K = ({
|
|
@@ -4901,7 +4901,7 @@ const z = ga, K = ({
|
|
|
4901
4901
|
case "medium":
|
|
4902
4902
|
return "text-[15px] leading-[16px] -tracking-0,1";
|
|
4903
4903
|
}
|
|
4904
|
-
},
|
|
4904
|
+
}, Zt = {
|
|
4905
4905
|
Di1: "text-[72px] font-bold leading-[90px] -tracking-2,5",
|
|
4906
4906
|
Di2: "text-[60px] font-bold leading-[72px] -tracking-2,0",
|
|
4907
4907
|
Di3: "text-[48px] font-bold leading-[60px] -tracking-1,5",
|
|
@@ -4921,7 +4921,7 @@ const z = ga, K = ({
|
|
|
4921
4921
|
D1: "text-[12px] leading-[16px]",
|
|
4922
4922
|
M: "text-[10px] leading-[16px]"
|
|
4923
4923
|
}, Y = ({ children: t, className: e, variant: n = "B1", significance: r = "primary", as: a }) => {
|
|
4924
|
-
const s = a ?? ya[n], i =
|
|
4924
|
+
const s = a ?? ya[n], i = Zt[n];
|
|
4925
4925
|
return /* @__PURE__ */ J.jsx(s, { className: z("font-sans", ba[r], e, i), children: t });
|
|
4926
4926
|
}, ya = {
|
|
4927
4927
|
Di1: "h1",
|
|
@@ -5202,7 +5202,7 @@ const z = ga, K = ({
|
|
|
5202
5202
|
"overflow-hidden break-words outline-hidden resize-none material-medium",
|
|
5203
5203
|
"rounded-lg py-3 px-4 min-h-20 border border-separator-opaque-light dark:border-separator-opaque-dark",
|
|
5204
5204
|
"text-label-primary-light dark:text-label-primary-dark",
|
|
5205
|
-
|
|
5205
|
+
Zt.B1
|
|
5206
5206
|
),
|
|
5207
5207
|
value: o,
|
|
5208
5208
|
onChange: (d) => u(d.target.value)
|
|
@@ -5590,11 +5590,11 @@ const za = /^(\d+)(th|st|nd|rd)?/i, Ua = /\d+/i, Ha = {
|
|
|
5590
5590
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
5591
5591
|
}, Va = {
|
|
5592
5592
|
any: [/^b/i, /^(a|c)/i]
|
|
5593
|
-
},
|
|
5593
|
+
}, qa = {
|
|
5594
5594
|
narrow: /^[1234]/i,
|
|
5595
5595
|
abbreviated: /^q[1234]/i,
|
|
5596
5596
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
5597
|
-
},
|
|
5597
|
+
}, Za = {
|
|
5598
5598
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
5599
5599
|
}, Wa = {
|
|
5600
5600
|
narrow: /^[jfmasond]/i,
|
|
@@ -5664,9 +5664,9 @@ const za = /^(\d+)(th|st|nd|rd)?/i, Ua = /\d+/i, Ha = {
|
|
|
5664
5664
|
defaultParseWidth: "any"
|
|
5665
5665
|
}),
|
|
5666
5666
|
quarter: le({
|
|
5667
|
-
matchPatterns:
|
|
5667
|
+
matchPatterns: qa,
|
|
5668
5668
|
defaultMatchWidth: "wide",
|
|
5669
|
-
parsePatterns:
|
|
5669
|
+
parsePatterns: Za,
|
|
5670
5670
|
defaultParseWidth: "any",
|
|
5671
5671
|
valueCallback: (t) => t + 1
|
|
5672
5672
|
}),
|
|
@@ -6085,7 +6085,7 @@ class Fs {
|
|
|
6085
6085
|
async fetchAndDisplayForm(e, n, r) {
|
|
6086
6086
|
this.logger.debug(`Fetching form config for: ${e}`);
|
|
6087
6087
|
try {
|
|
6088
|
-
const a = await
|
|
6088
|
+
const a = await Ze.get(`/external/forms/${e}`, {
|
|
6089
6089
|
headers: this.headers
|
|
6090
6090
|
});
|
|
6091
6091
|
if (!a.ok && this.config.onFormError) {
|
|
@@ -6106,7 +6106,7 @@ class Fs {
|
|
|
6106
6106
|
const s = nn(a), i = me(
|
|
6107
6107
|
Vn,
|
|
6108
6108
|
{ i18n: D },
|
|
6109
|
-
me(
|
|
6109
|
+
me(Zn, {
|
|
6110
6110
|
form: e,
|
|
6111
6111
|
onDismiss: async (o) => {
|
|
6112
6112
|
await n(), s.unmount(), a.remove(), this.logger.info("Form dismissed", o);
|
|
@@ -6121,7 +6121,7 @@ class Fs {
|
|
|
6121
6121
|
}
|
|
6122
6122
|
async postFormResponse(e, n) {
|
|
6123
6123
|
this.logger.info("Posting form response", n);
|
|
6124
|
-
const r = await
|
|
6124
|
+
const r = await Ze.post(`/external/forms/${e.slug}`, n, {
|
|
6125
6125
|
headers: this.headers
|
|
6126
6126
|
});
|
|
6127
6127
|
if (!r.ok && this.config.onFormError) {
|
|
@@ -6140,4 +6140,4 @@ export {
|
|
|
6140
6140
|
Fs as a,
|
|
6141
6141
|
Ts as f
|
|
6142
6142
|
};
|
|
6143
|
-
//# sourceMappingURL=form-manager-
|
|
6143
|
+
//# sourceMappingURL=form-manager-Cf8vMLbu.js.map
|