@nemme/js-sdk 1.1.0 → 1.1.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/CHANGELOG.md +34 -0
- package/dist/chunks/{chunk-CZZ4p3Yf.js → chunk-DWNI8pZO.js} +1 -1
- package/dist/chunks/{client-DhBV0jqm.js → client-CKvtSbpa.js} +3 -3
- package/dist/chunks/{client-DhBV0jqm.js.map → client-CKvtSbpa.js.map} +1 -1
- package/dist/chunks/{client-C3wRx9Wo.js → client-Db2ZE5y9.js} +2 -2
- package/dist/chunks/{client-C3wRx9Wo.js.map → client-Db2ZE5y9.js.map} +1 -1
- package/dist/chunks/{config-C6VpkZGH.js → config-DCrsd6gZ.js} +1 -1
- package/dist/chunks/{config-C6VpkZGH.js.map → config-DCrsd6gZ.js.map} +1 -1
- package/dist/chunks/{config-BnABfG_n.js → config-hiNBGctX.js} +2 -2
- package/dist/chunks/{config-BnABfG_n.js.map → config-hiNBGctX.js.map} +1 -1
- package/dist/chunks/form-manager-BG1qr31N.js +12 -0
- package/dist/chunks/form-manager-BG1qr31N.js.map +1 -0
- package/dist/chunks/{form-manager-Cm1pBxZ2.js → form-manager-Dit5tdsl.js} +91 -83
- package/dist/chunks/form-manager-Dit5tdsl.js.map +1 -0
- package/dist/forms.cjs +1 -1
- package/dist/forms.esm.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/js-sdk.css +1 -1
- package/dist/nemme-sdk.umd.js +7 -7
- package/dist/nemme-sdk.umd.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.esm.js +1 -1
- package/dist/react.esm.js.map +1 -1
- package/dist/utils/safe-url.d.ts +1 -0
- package/package.json +16 -15
- package/dist/chunks/form-manager-BYkXaNNz.js +0 -12
- package/dist/chunks/form-manager-BYkXaNNz.js.map +0 -1
- package/dist/chunks/form-manager-Cm1pBxZ2.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./config-
|
|
1
|
+
import { t as e } from "./config-DCrsd6gZ.js";
|
|
2
2
|
import * as t from "react";
|
|
3
3
|
import n, { createContext as r, createElement as i, forwardRef as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
|
|
4
4
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
@@ -257,10 +257,10 @@ function ue() {
|
|
|
257
257
|
return t.get = (r, i) => (n?.revoke?.(), i === le ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
258
258
|
}
|
|
259
259
|
function L(e, t) {
|
|
260
|
-
let { [le]: n } = e(ue()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
260
|
+
let { [le]: n } = e(ue()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":", a = t?.enableSelector === "strict";
|
|
261
261
|
if (n.length > 1 && i) {
|
|
262
|
-
let e = t?.ns,
|
|
263
|
-
if (
|
|
262
|
+
let e = t?.ns, o = a ? Array.isArray(e) ? e : e ? [e] : null : Array.isArray(e) ? e : null;
|
|
263
|
+
if (o && (a ? o : o.length > 1 ? o.slice(1) : []).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
264
264
|
}
|
|
265
265
|
return n.join(r);
|
|
266
266
|
}
|
|
@@ -938,6 +938,7 @@ var de = (e) => !y(e) && typeof e != "boolean" && typeof e != "number", fe = cla
|
|
|
938
938
|
nsSeparator: ":",
|
|
939
939
|
pluralSeparator: "_",
|
|
940
940
|
contextSeparator: "_",
|
|
941
|
+
enableSelector: !1,
|
|
941
942
|
partialBundledLanguages: !1,
|
|
942
943
|
saveMissing: !1,
|
|
943
944
|
updateMissing: !1,
|
|
@@ -1443,7 +1444,7 @@ var $e = ({ step: e, form: t, formState: n, onDismiss: r, onNextStep: i, onPrevi
|
|
|
1443
1444
|
})(e);
|
|
1444
1445
|
if (c.type === "start") {
|
|
1445
1446
|
let { title: e, description: a, image: o, includeOptOut: l, customStartButton: u, startButtonText: d, customOptOutButton: f, optOutButtonText: p } = c.transition;
|
|
1446
|
-
return /* @__PURE__ */ m(
|
|
1447
|
+
return /* @__PURE__ */ m(Jn, {
|
|
1447
1448
|
title: e,
|
|
1448
1449
|
description: a,
|
|
1449
1450
|
icon: t.icon,
|
|
@@ -1456,7 +1457,7 @@ var $e = ({ step: e, form: t, formState: n, onDismiss: r, onNextStep: i, onPrevi
|
|
|
1456
1457
|
}
|
|
1457
1458
|
if (c.type === "end") {
|
|
1458
1459
|
let { title: e, description: n, image: r, customEndButton: a, endButtonText: o, customEndButtonLink: l, endButtonLink: u } = c.transition;
|
|
1459
|
-
return /* @__PURE__ */ m(
|
|
1460
|
+
return /* @__PURE__ */ m(qn, {
|
|
1460
1461
|
title: e,
|
|
1461
1462
|
description: n,
|
|
1462
1463
|
icon: t.icon,
|
|
@@ -6146,7 +6147,14 @@ var Vn = ({ title: e, icon: t, description: n, image: r, children: i, onPrevious
|
|
|
6146
6147
|
})]
|
|
6147
6148
|
})
|
|
6148
6149
|
});
|
|
6149
|
-
}, Gn = (
|
|
6150
|
+
}, Gn = (e) => {
|
|
6151
|
+
try {
|
|
6152
|
+
let { protocol: t } = new URL(e);
|
|
6153
|
+
return t === "http:" || t === "https:";
|
|
6154
|
+
} catch {
|
|
6155
|
+
return !1;
|
|
6156
|
+
}
|
|
6157
|
+
}, Kn = ({ title: e, icon: t, description: n, image: r, children: i, wrapperClassName: a }) => /* @__PURE__ */ h("div", {
|
|
6150
6158
|
className: K("grid mx-4 my-8 rounded-xl border", "grid-cols-1 p-4 pt-10", "md:p-8 md:gap-16 md:max-w-[960px] md:min-w-[660px]", r ? "md:grid-cols-2" : "md:grid-cols-1", "border-separator-opaque-light dark:border-separator-opaque-dark material-ultra-thick", a),
|
|
6151
6159
|
children: [/* @__PURE__ */ h("div", {
|
|
6152
6160
|
className: "flex flex-col justify-between gap-6 md:gap-8 order-2 md:order-1",
|
|
@@ -6178,7 +6186,7 @@ var Vn = ({ title: e, icon: t, description: n, image: r, children: i, onPrevious
|
|
|
6178
6186
|
})
|
|
6179
6187
|
})
|
|
6180
6188
|
})]
|
|
6181
|
-
}),
|
|
6189
|
+
}), qn = ({ title: e, icon: t, description: n, image: r, quitText: i, onQuit: a, externalLink: o }) => /* @__PURE__ */ h(Kn, {
|
|
6182
6190
|
title: e,
|
|
6183
6191
|
icon: t,
|
|
6184
6192
|
description: n,
|
|
@@ -6190,7 +6198,7 @@ var Vn = ({ title: e, icon: t, description: n, image: r, children: i, onPrevious
|
|
|
6190
6198
|
text: i,
|
|
6191
6199
|
iconAfter: /* @__PURE__ */ m(ft, {}),
|
|
6192
6200
|
onClick: () => {
|
|
6193
|
-
window.open(o, "_blank"), a();
|
|
6201
|
+
o && Gn(o) && window.open(o, "_blank", "noopener,noreferrer"), a();
|
|
6194
6202
|
}
|
|
6195
6203
|
}) : /* @__PURE__ */ m(q, {
|
|
6196
6204
|
variant: "secondary",
|
|
@@ -6205,7 +6213,7 @@ var Vn = ({ title: e, icon: t, description: n, image: r, children: i, onPrevious
|
|
|
6205
6213
|
iconAfter: /* @__PURE__ */ m(xt, {}),
|
|
6206
6214
|
"aria-label": "quit"
|
|
6207
6215
|
})]
|
|
6208
|
-
}),
|
|
6216
|
+
}), Jn = ({ title: e, icon: t, description: n, image: r, quitText: i, onQuit: a, startText: o, onStart: s }) => /* @__PURE__ */ h(Kn, {
|
|
6209
6217
|
title: e,
|
|
6210
6218
|
icon: t,
|
|
6211
6219
|
description: n,
|
|
@@ -6230,16 +6238,16 @@ var Vn = ({ title: e, icon: t, description: n, image: r, children: i, onPrevious
|
|
|
6230
6238
|
iconAfter: /* @__PURE__ */ m(xt, {}),
|
|
6231
6239
|
"aria-label": "quit"
|
|
6232
6240
|
})]
|
|
6233
|
-
}),
|
|
6234
|
-
function
|
|
6235
|
-
return
|
|
6241
|
+
}), Yn = {};
|
|
6242
|
+
function Xn() {
|
|
6243
|
+
return Yn;
|
|
6236
6244
|
}
|
|
6237
|
-
function
|
|
6238
|
-
|
|
6245
|
+
function Zn(e) {
|
|
6246
|
+
Yn = e;
|
|
6239
6247
|
}
|
|
6240
6248
|
//#endregion
|
|
6241
6249
|
//#region ../node_modules/date-fns/locale/en-US/_lib/formatDistance.js
|
|
6242
|
-
var
|
|
6250
|
+
var Qn = {
|
|
6243
6251
|
lessThanXSeconds: {
|
|
6244
6252
|
one: "less than a second",
|
|
6245
6253
|
other: "less than {{count}} seconds"
|
|
@@ -6301,13 +6309,13 @@ var Zn = {
|
|
|
6301
6309
|
one: "almost 1 year",
|
|
6302
6310
|
other: "almost {{count}} years"
|
|
6303
6311
|
}
|
|
6304
|
-
},
|
|
6305
|
-
let r, i =
|
|
6312
|
+
}, $n = (e, t, n) => {
|
|
6313
|
+
let r, i = Qn[e];
|
|
6306
6314
|
return r = typeof i == "string" ? i : t === 1 ? i.one : i.other.replace("{{count}}", t.toString()), n?.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
|
|
6307
6315
|
};
|
|
6308
6316
|
//#endregion
|
|
6309
6317
|
//#region ../node_modules/date-fns/locale/_lib/buildFormatLongFn.js
|
|
6310
|
-
function
|
|
6318
|
+
function er(e) {
|
|
6311
6319
|
return (t = {}) => {
|
|
6312
6320
|
let n = t.width ? String(t.width) : e.defaultWidth;
|
|
6313
6321
|
return e.formats[n] || e.formats[e.defaultWidth];
|
|
@@ -6315,14 +6323,14 @@ function $n(e) {
|
|
|
6315
6323
|
}
|
|
6316
6324
|
//#endregion
|
|
6317
6325
|
//#region ../node_modules/date-fns/locale/en-US/_lib/formatRelative.js
|
|
6318
|
-
var
|
|
6326
|
+
var tr = {
|
|
6319
6327
|
lastWeek: "'last' eeee 'at' p",
|
|
6320
6328
|
yesterday: "'yesterday at' p",
|
|
6321
6329
|
today: "'today at' p",
|
|
6322
6330
|
tomorrow: "'tomorrow at' p",
|
|
6323
6331
|
nextWeek: "eeee 'at' p",
|
|
6324
6332
|
other: "P"
|
|
6325
|
-
},
|
|
6333
|
+
}, nr = (e, t, n, r) => tr[e];
|
|
6326
6334
|
//#endregion
|
|
6327
6335
|
//#region ../node_modules/date-fns/locale/_lib/buildLocalizeFn.js
|
|
6328
6336
|
function X(e) {
|
|
@@ -6339,7 +6347,7 @@ function X(e) {
|
|
|
6339
6347
|
return i[a];
|
|
6340
6348
|
};
|
|
6341
6349
|
}
|
|
6342
|
-
var
|
|
6350
|
+
var rr = {
|
|
6343
6351
|
ordinalNumber: (e, t) => {
|
|
6344
6352
|
let n = Number(e), r = n % 100;
|
|
6345
6353
|
if (r > 20 || r < 10) switch (r % 10) {
|
|
@@ -6544,7 +6552,7 @@ function Z(e) {
|
|
|
6544
6552
|
return (t, n = {}) => {
|
|
6545
6553
|
let r = n.width, i = r && e.matchPatterns[r] || e.matchPatterns[e.defaultMatchWidth], a = t.match(i);
|
|
6546
6554
|
if (!a) return null;
|
|
6547
|
-
let o = a[0], s = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(s) ?
|
|
6555
|
+
let o = a[0], s = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(s) ? ar(s, (e) => e.test(o)) : ir(s, (e) => e.test(o)), l;
|
|
6548
6556
|
l = e.valueCallback ? e.valueCallback(c) : c, l = n.valueCallback ? n.valueCallback(l) : l;
|
|
6549
6557
|
let u = t.slice(o.length);
|
|
6550
6558
|
return {
|
|
@@ -6553,15 +6561,15 @@ function Z(e) {
|
|
|
6553
6561
|
};
|
|
6554
6562
|
};
|
|
6555
6563
|
}
|
|
6556
|
-
function
|
|
6564
|
+
function ir(e, t) {
|
|
6557
6565
|
for (let n in e) if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n])) return n;
|
|
6558
6566
|
}
|
|
6559
|
-
function
|
|
6567
|
+
function ar(e, t) {
|
|
6560
6568
|
for (let n = 0; n < e.length; n++) if (t(e[n])) return n;
|
|
6561
6569
|
}
|
|
6562
6570
|
//#endregion
|
|
6563
6571
|
//#region ../node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
|
|
6564
|
-
function
|
|
6572
|
+
function or(e) {
|
|
6565
6573
|
return (t, n = {}) => {
|
|
6566
6574
|
let r = t.match(e.matchPattern);
|
|
6567
6575
|
if (!r) return null;
|
|
@@ -6576,8 +6584,8 @@ function ar(e) {
|
|
|
6576
6584
|
};
|
|
6577
6585
|
};
|
|
6578
6586
|
}
|
|
6579
|
-
var
|
|
6580
|
-
ordinalNumber:
|
|
6587
|
+
var sr = {
|
|
6588
|
+
ordinalNumber: or({
|
|
6581
6589
|
matchPattern: /^(\d+)(th|st|nd|rd)?/i,
|
|
6582
6590
|
parsePattern: /\d+/i,
|
|
6583
6591
|
valueCallback: (e) => parseInt(e, 10)
|
|
@@ -6698,19 +6706,19 @@ var or = {
|
|
|
6698
6706
|
};
|
|
6699
6707
|
//#endregion
|
|
6700
6708
|
//#region ../node_modules/date-fns/setDefaultOptions.js
|
|
6701
|
-
function
|
|
6702
|
-
let t = {}, n =
|
|
6709
|
+
function cr(e) {
|
|
6710
|
+
let t = {}, n = Xn();
|
|
6703
6711
|
for (let e in n) Object.prototype.hasOwnProperty.call(n, e) && (t[e] = n[e]);
|
|
6704
6712
|
for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (e[n] === void 0 ? delete t[n] : t[n] = e[n]);
|
|
6705
|
-
|
|
6713
|
+
Zn(t);
|
|
6706
6714
|
}
|
|
6707
6715
|
//#endregion
|
|
6708
6716
|
//#region ../node_modules/date-fns/locale/en-GB.js
|
|
6709
|
-
var
|
|
6717
|
+
var lr = {
|
|
6710
6718
|
code: "en-GB",
|
|
6711
|
-
formatDistance:
|
|
6719
|
+
formatDistance: $n,
|
|
6712
6720
|
formatLong: {
|
|
6713
|
-
date:
|
|
6721
|
+
date: er({
|
|
6714
6722
|
formats: {
|
|
6715
6723
|
full: "EEEE, d MMMM yyyy",
|
|
6716
6724
|
long: "d MMMM yyyy",
|
|
@@ -6719,7 +6727,7 @@ var cr = {
|
|
|
6719
6727
|
},
|
|
6720
6728
|
defaultWidth: "full"
|
|
6721
6729
|
}),
|
|
6722
|
-
time:
|
|
6730
|
+
time: er({
|
|
6723
6731
|
formats: {
|
|
6724
6732
|
full: "HH:mm:ss zzzz",
|
|
6725
6733
|
long: "HH:mm:ss z",
|
|
@@ -6728,7 +6736,7 @@ var cr = {
|
|
|
6728
6736
|
},
|
|
6729
6737
|
defaultWidth: "full"
|
|
6730
6738
|
}),
|
|
6731
|
-
dateTime:
|
|
6739
|
+
dateTime: er({
|
|
6732
6740
|
formats: {
|
|
6733
6741
|
full: "{{date}} 'at' {{time}}",
|
|
6734
6742
|
long: "{{date}} 'at' {{time}}",
|
|
@@ -6738,20 +6746,20 @@ var cr = {
|
|
|
6738
6746
|
defaultWidth: "full"
|
|
6739
6747
|
})
|
|
6740
6748
|
},
|
|
6741
|
-
formatRelative:
|
|
6742
|
-
localize:
|
|
6743
|
-
match:
|
|
6749
|
+
formatRelative: nr,
|
|
6750
|
+
localize: rr,
|
|
6751
|
+
match: sr,
|
|
6744
6752
|
options: {
|
|
6745
6753
|
weekStartsOn: 1,
|
|
6746
6754
|
firstWeekContainsDate: 4
|
|
6747
6755
|
}
|
|
6748
|
-
}, { slice:
|
|
6749
|
-
function
|
|
6750
|
-
return
|
|
6756
|
+
}, { slice: ur, forEach: dr } = [];
|
|
6757
|
+
function fr(e) {
|
|
6758
|
+
return dr.call(ur.call(arguments, 1), (t) => {
|
|
6751
6759
|
if (t) for (let n in t) e[n] === void 0 && (e[n] = t[n]);
|
|
6752
6760
|
}), e;
|
|
6753
6761
|
}
|
|
6754
|
-
function
|
|
6762
|
+
function pr(e) {
|
|
6755
6763
|
return typeof e == "string" ? [
|
|
6756
6764
|
/<\s*script.*?>/i,
|
|
6757
6765
|
/<\s*\/\s*script\s*>/i,
|
|
@@ -6768,7 +6776,7 @@ function fr(e) {
|
|
|
6768
6776
|
/innerHTML/i
|
|
6769
6777
|
].some((t) => t.test(e)) : !1;
|
|
6770
6778
|
}
|
|
6771
|
-
var
|
|
6779
|
+
var mr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, hr = function(e, t) {
|
|
6772
6780
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { path: "/" }, r = `${e}=${encodeURIComponent(t)}`;
|
|
6773
6781
|
if (n.maxAge > 0) {
|
|
6774
6782
|
let e = n.maxAge - 0;
|
|
@@ -6776,11 +6784,11 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6776
6784
|
r += `; Max-Age=${Math.floor(e)}`;
|
|
6777
6785
|
}
|
|
6778
6786
|
if (n.domain) {
|
|
6779
|
-
if (!
|
|
6787
|
+
if (!mr.test(n.domain)) throw TypeError("option domain is invalid");
|
|
6780
6788
|
r += `; Domain=${n.domain}`;
|
|
6781
6789
|
}
|
|
6782
6790
|
if (n.path) {
|
|
6783
|
-
if (!
|
|
6791
|
+
if (!mr.test(n.path)) throw TypeError("option path is invalid");
|
|
6784
6792
|
r += `; Path=${n.path}`;
|
|
6785
6793
|
}
|
|
6786
6794
|
if (n.expires) {
|
|
@@ -6803,13 +6811,13 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6803
6811
|
default: throw TypeError("option sameSite is invalid");
|
|
6804
6812
|
}
|
|
6805
6813
|
return n.partitioned && (r += "; Partitioned"), r;
|
|
6806
|
-
},
|
|
6814
|
+
}, gr = {
|
|
6807
6815
|
create(e, t, n, r) {
|
|
6808
6816
|
let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
6809
6817
|
path: "/",
|
|
6810
6818
|
sameSite: "strict"
|
|
6811
6819
|
};
|
|
6812
|
-
n && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + n * 60 * 1e3)), r && (i.domain = r), document.cookie =
|
|
6820
|
+
n && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + n * 60 * 1e3)), r && (i.domain = r), document.cookie = hr(e, t, i);
|
|
6813
6821
|
},
|
|
6814
6822
|
read(e) {
|
|
6815
6823
|
let t = `${e}=`, n = document.cookie.split(";");
|
|
@@ -6823,17 +6831,17 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6823
6831
|
remove(e, t) {
|
|
6824
6832
|
this.create(e, "", -1, t);
|
|
6825
6833
|
}
|
|
6826
|
-
},
|
|
6834
|
+
}, _r = {
|
|
6827
6835
|
name: "cookie",
|
|
6828
6836
|
lookup(e) {
|
|
6829
6837
|
let { lookupCookie: t } = e;
|
|
6830
|
-
if (t && typeof document < "u") return
|
|
6838
|
+
if (t && typeof document < "u") return gr.read(t) || void 0;
|
|
6831
6839
|
},
|
|
6832
6840
|
cacheUserLanguage(e, t) {
|
|
6833
6841
|
let { lookupCookie: n, cookieMinutes: r, cookieDomain: i, cookieOptions: a } = t;
|
|
6834
|
-
n && typeof document < "u" &&
|
|
6842
|
+
n && typeof document < "u" && gr.create(n, e, r, i, a);
|
|
6835
6843
|
}
|
|
6836
|
-
},
|
|
6844
|
+
}, vr = {
|
|
6837
6845
|
name: "querystring",
|
|
6838
6846
|
lookup(e) {
|
|
6839
6847
|
let { lookupQuerystring: t } = e, n;
|
|
@@ -6848,7 +6856,7 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6848
6856
|
}
|
|
6849
6857
|
return n;
|
|
6850
6858
|
}
|
|
6851
|
-
},
|
|
6859
|
+
}, yr = {
|
|
6852
6860
|
name: "hash",
|
|
6853
6861
|
lookup(e) {
|
|
6854
6862
|
let { lookupHash: t, lookupFromHashIndex: n } = e, r;
|
|
@@ -6872,7 +6880,7 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6872
6880
|
}
|
|
6873
6881
|
return r;
|
|
6874
6882
|
}
|
|
6875
|
-
}, Q = null,
|
|
6883
|
+
}, Q = null, br = () => {
|
|
6876
6884
|
if (Q !== null) return Q;
|
|
6877
6885
|
try {
|
|
6878
6886
|
if (Q = typeof window < "u" && window.localStorage !== null, !Q) return !1;
|
|
@@ -6882,17 +6890,17 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6882
6890
|
Q = !1;
|
|
6883
6891
|
}
|
|
6884
6892
|
return Q;
|
|
6885
|
-
},
|
|
6893
|
+
}, xr = {
|
|
6886
6894
|
name: "localStorage",
|
|
6887
6895
|
lookup(e) {
|
|
6888
6896
|
let { lookupLocalStorage: t } = e;
|
|
6889
|
-
if (t &&
|
|
6897
|
+
if (t && br()) return window.localStorage.getItem(t) || void 0;
|
|
6890
6898
|
},
|
|
6891
6899
|
cacheUserLanguage(e, t) {
|
|
6892
6900
|
let { lookupLocalStorage: n } = t;
|
|
6893
|
-
n &&
|
|
6901
|
+
n && br() && window.localStorage.setItem(n, e);
|
|
6894
6902
|
}
|
|
6895
|
-
}, $ = null,
|
|
6903
|
+
}, $ = null, Sr = () => {
|
|
6896
6904
|
if ($ !== null) return $;
|
|
6897
6905
|
try {
|
|
6898
6906
|
if ($ = typeof window < "u" && window.sessionStorage !== null, !$) return !1;
|
|
@@ -6902,17 +6910,17 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6902
6910
|
$ = !1;
|
|
6903
6911
|
}
|
|
6904
6912
|
return $;
|
|
6905
|
-
},
|
|
6913
|
+
}, Cr = {
|
|
6906
6914
|
name: "sessionStorage",
|
|
6907
6915
|
lookup(e) {
|
|
6908
6916
|
let { lookupSessionStorage: t } = e;
|
|
6909
|
-
if (t &&
|
|
6917
|
+
if (t && Sr()) return window.sessionStorage.getItem(t) || void 0;
|
|
6910
6918
|
},
|
|
6911
6919
|
cacheUserLanguage(e, t) {
|
|
6912
6920
|
let { lookupSessionStorage: n } = t;
|
|
6913
|
-
n &&
|
|
6921
|
+
n && Sr() && window.sessionStorage.setItem(n, e);
|
|
6914
6922
|
}
|
|
6915
|
-
},
|
|
6923
|
+
}, wr = {
|
|
6916
6924
|
name: "navigator",
|
|
6917
6925
|
lookup(e) {
|
|
6918
6926
|
let t = [];
|
|
@@ -6923,13 +6931,13 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6923
6931
|
}
|
|
6924
6932
|
return t.length > 0 ? t : void 0;
|
|
6925
6933
|
}
|
|
6926
|
-
},
|
|
6934
|
+
}, Tr = {
|
|
6927
6935
|
name: "htmlTag",
|
|
6928
6936
|
lookup(e) {
|
|
6929
6937
|
let { htmlTag: t } = e, n, r = t || (typeof document < "u" ? document.documentElement : null);
|
|
6930
6938
|
return r && typeof r.getAttribute == "function" && (n = r.getAttribute("lang")), n;
|
|
6931
6939
|
}
|
|
6932
|
-
},
|
|
6940
|
+
}, Er = {
|
|
6933
6941
|
name: "path",
|
|
6934
6942
|
lookup(e) {
|
|
6935
6943
|
let { lookupFromPathIndex: t } = e;
|
|
@@ -6937,17 +6945,17 @@ var pr = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, mr = function(e, t) {
|
|
|
6937
6945
|
let n = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
6938
6946
|
if (Array.isArray(n)) return n[typeof t == "number" ? t : 0]?.replace("/", "");
|
|
6939
6947
|
}
|
|
6940
|
-
},
|
|
6948
|
+
}, Dr = {
|
|
6941
6949
|
name: "subdomain",
|
|
6942
6950
|
lookup(e) {
|
|
6943
6951
|
let { lookupFromSubdomainIndex: t } = e, n = typeof t == "number" ? t + 1 : 1, r = typeof window < "u" && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
|
|
6944
6952
|
if (r) return r[n];
|
|
6945
6953
|
}
|
|
6946
|
-
},
|
|
6954
|
+
}, Or = !1;
|
|
6947
6955
|
try {
|
|
6948
|
-
document.cookie,
|
|
6956
|
+
document.cookie, Or = !0;
|
|
6949
6957
|
} catch {}
|
|
6950
|
-
var
|
|
6958
|
+
var kr = [
|
|
6951
6959
|
"querystring",
|
|
6952
6960
|
"cookie",
|
|
6953
6961
|
"localStorage",
|
|
@@ -6955,9 +6963,9 @@ var Or = [
|
|
|
6955
6963
|
"navigator",
|
|
6956
6964
|
"htmlTag"
|
|
6957
6965
|
];
|
|
6958
|
-
|
|
6959
|
-
var
|
|
6960
|
-
order:
|
|
6966
|
+
Or || kr.splice(1, 1);
|
|
6967
|
+
var Ar = () => ({
|
|
6968
|
+
order: kr,
|
|
6961
6969
|
lookupQuerystring: "lng",
|
|
6962
6970
|
lookupCookie: "i18next",
|
|
6963
6971
|
lookupLocalStorage: "i18nextLng",
|
|
@@ -6965,14 +6973,14 @@ var kr = () => ({
|
|
|
6965
6973
|
caches: ["localStorage"],
|
|
6966
6974
|
excludeCacheFor: ["cimode"],
|
|
6967
6975
|
convertDetectedLanguage: (e) => e
|
|
6968
|
-
}),
|
|
6976
|
+
}), jr = class {
|
|
6969
6977
|
constructor(e) {
|
|
6970
6978
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
6971
6979
|
this.type = "languageDetector", this.detectors = {}, this.init(e, t);
|
|
6972
6980
|
}
|
|
6973
6981
|
init() {
|
|
6974
6982
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { languageUtils: {} }, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
6975
|
-
this.services = e, this.options =
|
|
6983
|
+
this.services = e, this.options = fr(t, this.options || {}, Ar()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (e) => e.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = n, this.addDetector(_r), this.addDetector(vr), this.addDetector(xr), this.addDetector(Cr), this.addDetector(wr), this.addDetector(Tr), this.addDetector(Er), this.addDetector(Dr), this.addDetector(yr);
|
|
6976
6984
|
}
|
|
6977
6985
|
addDetector(e) {
|
|
6978
6986
|
return this.detectors[e.name] = e, this;
|
|
@@ -6984,7 +6992,7 @@ var kr = () => ({
|
|
|
6984
6992
|
let n = this.detectors[e].lookup(this.options);
|
|
6985
6993
|
n && typeof n == "string" && (n = [n]), n && (t = t.concat(n));
|
|
6986
6994
|
}
|
|
6987
|
-
}), t = t.filter((e) => e != null && !
|
|
6995
|
+
}), t = t.filter((e) => e != null && !pr(e)).map((e) => this.options.convertDetectedLanguage(e)), this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes ? t : t.length > 0 ? t[0] : null;
|
|
6988
6996
|
}
|
|
6989
6997
|
cacheUserLanguage(e) {
|
|
6990
6998
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.caches;
|
|
@@ -6993,7 +7001,7 @@ var kr = () => ({
|
|
|
6993
7001
|
}));
|
|
6994
7002
|
}
|
|
6995
7003
|
};
|
|
6996
|
-
|
|
7004
|
+
jr.type = "languageDetector", cr({ locale: lr }), z.use(jr).use(Ke).init({
|
|
6997
7005
|
debug: e.debug,
|
|
6998
7006
|
fallbackLng: "en",
|
|
6999
7007
|
interpolation: { escapeValue: !1 },
|
|
@@ -7009,12 +7017,12 @@ Ar.type = "languageDetector", sr({ locale: cr }), z.use(Ar).use(Ke).init({
|
|
|
7009
7017
|
nb: { tranlation: {} }
|
|
7010
7018
|
}
|
|
7011
7019
|
});
|
|
7012
|
-
var
|
|
7020
|
+
var Mr = z, Nr = class extends Error {
|
|
7013
7021
|
errorType;
|
|
7014
7022
|
constructor(e, t) {
|
|
7015
7023
|
super(t), this.name = "FormError", this.errorType = e;
|
|
7016
7024
|
}
|
|
7017
|
-
},
|
|
7025
|
+
}, Pr = /* @__PURE__ */ v({ FormManager: () => Fr }), Fr = class {
|
|
7018
7026
|
logger;
|
|
7019
7027
|
headers;
|
|
7020
7028
|
http;
|
|
@@ -7027,13 +7035,13 @@ var jr = z, Mr = class extends Error {
|
|
|
7027
7035
|
try {
|
|
7028
7036
|
let r = await this.http.get(`/external/forms/${e}`, { headers: this.headers });
|
|
7029
7037
|
if (!r.ok && this.config.onFormError) {
|
|
7030
|
-
let e = new
|
|
7038
|
+
let e = new Nr("FETCH_ERROR", r.error?.message);
|
|
7031
7039
|
this.config.onFormError(e);
|
|
7032
7040
|
}
|
|
7033
7041
|
r.ok && r.data ? (this.logger.info(`Form config loaded for: ${e}`, r.data), this.displayForm(r.data, t, n)) : this.logger.warn(`No form config found for: ${e}`);
|
|
7034
7042
|
} catch (t) {
|
|
7035
7043
|
if (this.logger.error(`Failed to fetch form config for: ${e}`, t), this.config.onFormError) {
|
|
7036
|
-
let e = new
|
|
7044
|
+
let e = new Nr("FETCH_ERROR");
|
|
7037
7045
|
this.config.onFormError(e);
|
|
7038
7046
|
}
|
|
7039
7047
|
}
|
|
@@ -7041,7 +7049,7 @@ var jr = z, Mr = class extends Error {
|
|
|
7041
7049
|
displayForm(e, t, n) {
|
|
7042
7050
|
let r = document.createElement("div");
|
|
7043
7051
|
r.id = "nm", document.body.appendChild(r);
|
|
7044
|
-
let a = g(r), o = i(Qe, { i18n:
|
|
7052
|
+
let a = g(r), o = i(Qe, { i18n: Mr }, i(et, {
|
|
7045
7053
|
form: e,
|
|
7046
7054
|
onDismiss: async (e) => {
|
|
7047
7055
|
await t(), a.unmount(), r.remove(), this.logger.info("Form dismissed", e);
|
|
@@ -7057,12 +7065,12 @@ var jr = z, Mr = class extends Error {
|
|
|
7057
7065
|
this.logger.info("Posting form response", t);
|
|
7058
7066
|
let n = await this.http.post(`/external/forms/${e.slug}`, t, { headers: this.headers });
|
|
7059
7067
|
if (!n.ok && this.config.onFormError) {
|
|
7060
|
-
let e = new
|
|
7068
|
+
let e = new Nr("SUBMISSION_ERROR", n.error?.message);
|
|
7061
7069
|
this.config.onFormError(e);
|
|
7062
7070
|
} else this.logger.info("Form response posted", n.data);
|
|
7063
7071
|
}
|
|
7064
7072
|
};
|
|
7065
7073
|
//#endregion
|
|
7066
|
-
export {
|
|
7074
|
+
export { Pr as n, Nr as r, Fr as t };
|
|
7067
7075
|
|
|
7068
|
-
//# sourceMappingURL=form-manager-
|
|
7076
|
+
//# sourceMappingURL=form-manager-Dit5tdsl.js.map
|