@inploi/plugin-chatbot 7.1.0 → 7.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/cdn/index.js +3 -3
- package/dist/{chatbot-body-b4327f15.js → chatbot-body-4fc6a204.js} +107 -106
- package/dist/chatbot-body-b0bae6c4.cjs +1 -0
- package/dist/{index-05d5a78d.js → index-086aae7d.js} +1 -1
- package/dist/{index-d80370e4.cjs → index-5d6165c2.cjs} +1 -1
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +2 -2
- package/dist/chatbot-body-f1401333.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as Ke, i as rr, k as Oe, a as nr, b as me, A as De, c as Tr, M as Ge, z as R, h as se, _ as ae, p as ue, F as ft, u as Y, o as c, d as je, e as lt, y as ye, s as A, f as Xe, j as we, l as Dr, m as ge, n as Rr, q as it, r as Q, t as Or, v as sr, w as Br, x as Pr, B as $r, C as Fe, D as G, E as jr, G as Ur, H as pe, I as Be, J as He, K as ar, L as zr, N as qr, O as Hr, P as Kr, Q as Gr, R as Wr, S as ir, T as Jr, U as Xr, V as Zr, W as Yr, X as Qr } from "./index-
|
|
1
|
+
import { g as Ke, i as rr, k as Oe, a as nr, b as me, A as De, c as Tr, M as Ge, z as R, h as se, _ as ae, p as ue, F as ft, u as Y, o as c, d as je, e as lt, y as ye, s as A, f as Xe, j as we, l as Dr, m as ge, n as Rr, q as it, r as Q, t as Or, v as sr, w as Br, x as Pr, B as $r, C as Fe, D as G, E as jr, G as Ur, H as pe, I as Be, J as He, K as ar, L as zr, N as qr, O as Hr, P as Kr, Q as Gr, R as Wr, S as ir, T as Jr, U as Xr, V as Zr, W as Yr, X as Qr } from "./index-086aae7d.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const Mt = ({
|
|
4
4
|
condition: e,
|
|
@@ -38,8 +38,9 @@ const Mt = ({
|
|
|
38
38
|
const i = Ke(o.value, s.join(".")), f = {
|
|
39
39
|
...n,
|
|
40
40
|
data: {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
compareKey: "_temp",
|
|
42
|
+
compare: e.compare,
|
|
43
|
+
compareValue: e.compareValue
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
switch (typeof i) {
|
|
@@ -273,9 +274,9 @@ const Mt = ({
|
|
|
273
274
|
...t.customProperties
|
|
274
275
|
}
|
|
275
276
|
})
|
|
276
|
-
}, y = async (b,
|
|
277
|
-
const
|
|
278
|
-
p == null || p(b,
|
|
277
|
+
}, y = async (b, E) => {
|
|
278
|
+
const V = o();
|
|
279
|
+
p == null || p(b, E);
|
|
279
280
|
try {
|
|
280
281
|
await nn({
|
|
281
282
|
flow: e,
|
|
@@ -285,7 +286,7 @@ const Mt = ({
|
|
|
285
286
|
apiClient: s,
|
|
286
287
|
context: a,
|
|
287
288
|
node: b,
|
|
288
|
-
submissions:
|
|
289
|
+
submissions: V,
|
|
289
290
|
t: C,
|
|
290
291
|
chat: {
|
|
291
292
|
sendMessage: async (x) => i.send({
|
|
@@ -316,21 +317,21 @@ const Mt = ({
|
|
|
316
317
|
};
|
|
317
318
|
return {
|
|
318
319
|
interpret: async (b) => {
|
|
319
|
-
const
|
|
320
|
-
return y(
|
|
320
|
+
const E = e.nodes.find((V) => V.id === b) ?? nr(e.nodes);
|
|
321
|
+
return y(E);
|
|
321
322
|
},
|
|
322
323
|
undo: (b) => {
|
|
323
|
-
let
|
|
324
|
-
const
|
|
324
|
+
let E = 1;
|
|
325
|
+
const V = e.nodes.find((_) => _.id === b[b.length - 1]);
|
|
325
326
|
for (let _ = b.length - 2; _ > 0; _--) {
|
|
326
327
|
const I = b[_], O = e.nodes.find((M) => M.id === I);
|
|
327
|
-
if (!O || (
|
|
328
|
+
if (!O || (E++, O.type.startsWith("question-")))
|
|
328
329
|
break;
|
|
329
330
|
}
|
|
330
331
|
v.abort(), v = new AbortController();
|
|
331
|
-
const x = e.nodes.find((_) => _.id === b[b.length -
|
|
332
|
-
return me(x, "Undo failed: new start node not found"), y(x,
|
|
333
|
-
removed:
|
|
332
|
+
const x = e.nodes.find((_) => _.id === b[b.length - E]);
|
|
333
|
+
return me(x, "Undo failed: new start node not found"), y(x, V), {
|
|
334
|
+
removed: E
|
|
334
335
|
};
|
|
335
336
|
},
|
|
336
337
|
abort: () => {
|
|
@@ -437,7 +438,7 @@ async function nn(e) {
|
|
|
437
438
|
throw new Error(`Unknown node: ${JSON.stringify(t)}`);
|
|
438
439
|
}
|
|
439
440
|
}
|
|
440
|
-
const
|
|
441
|
+
const Ve = (e, t) => {
|
|
441
442
|
var n;
|
|
442
443
|
const r = (n = e[t]) == null ? void 0 : n.value;
|
|
443
444
|
if (typeof r != "string" && typeof r != "number")
|
|
@@ -463,11 +464,11 @@ async function an({
|
|
|
463
464
|
r.log({
|
|
464
465
|
event: "IDENTIFY",
|
|
465
466
|
properties: {
|
|
466
|
-
identifier:
|
|
467
|
-
first_name: t.data.firstName ?
|
|
468
|
-
last_name: t.data.lastName ?
|
|
469
|
-
email: t.data.email ?
|
|
470
|
-
phone_number: t.data.phoneNumber ?
|
|
467
|
+
identifier: Ve(n, t.data.key).toString(),
|
|
468
|
+
first_name: t.data.firstName ? Ve(n, t.data.firstName).toString() : void 0,
|
|
469
|
+
last_name: t.data.lastName ? Ve(n, t.data.lastName).toString() : void 0,
|
|
470
|
+
email: t.data.email ? Ve(n, t.data.email).toString() : void 0,
|
|
471
|
+
phone_number: t.data.phoneNumber ? Ve(n, t.data.phoneNumber).toString() : void 0,
|
|
471
472
|
custom_traits: t.data.customTraits ? Object.fromEntries(t.data.customTraits.map(({
|
|
472
473
|
key: s,
|
|
473
474
|
value: o
|
|
@@ -501,7 +502,7 @@ async function on({
|
|
|
501
502
|
if (t.data.scope === "company" || p != null)
|
|
502
503
|
try {
|
|
503
504
|
i = await r.checkDuplicate({
|
|
504
|
-
email:
|
|
505
|
+
email: Ve(n, t.data.email).toString(),
|
|
505
506
|
jobId: p,
|
|
506
507
|
scope: t.data.scope
|
|
507
508
|
});
|
|
@@ -622,10 +623,10 @@ async function un({
|
|
|
622
623
|
text: b.redirect.message ?? f("submission_redirect_message")
|
|
623
624
|
});
|
|
624
625
|
try {
|
|
625
|
-
const
|
|
626
|
-
v && !
|
|
626
|
+
const E = new URL(b.redirect.redirect_url);
|
|
627
|
+
v && !E.searchParams.has("anonymous_id") && E.searchParams.set("anonymous_id", v), await e.sendMessage({
|
|
627
628
|
type: "link",
|
|
628
|
-
href:
|
|
629
|
+
href: E.toString(),
|
|
629
630
|
text: b.redirect.button_text ?? f("complete_submission"),
|
|
630
631
|
onClick: () => {
|
|
631
632
|
if (!h) {
|
|
@@ -639,14 +640,14 @@ async function un({
|
|
|
639
640
|
flow_id: i.id,
|
|
640
641
|
flow_session_id: h,
|
|
641
642
|
flow_version: i.version,
|
|
642
|
-
href:
|
|
643
|
+
href: E.toString(),
|
|
643
644
|
job: i.job
|
|
644
645
|
}
|
|
645
646
|
});
|
|
646
647
|
}
|
|
647
648
|
});
|
|
648
|
-
} catch (
|
|
649
|
-
n.error(`Invalid redirect URL: ${b.redirect.redirect_url}`,
|
|
649
|
+
} catch (E) {
|
|
650
|
+
n.error(`Invalid redirect URL: ${b.redirect.redirect_url}`, E), e.sendMessage({
|
|
650
651
|
type: "system",
|
|
651
652
|
variant: "error",
|
|
652
653
|
text: f("redirect_url_error")
|
|
@@ -1074,24 +1075,24 @@ function _n({ debounce: e, scroll: t, polyfill: r, offsetSize: n } = { debounce:
|
|
|
1074
1075
|
if (!i.current.element)
|
|
1075
1076
|
return;
|
|
1076
1077
|
const { left: _, top: I, width: O, height: M, bottom: be, right: Ce, x: oe, y: de } = i.current.element.getBoundingClientRect(), z = { left: _, top: I, width: O, height: M, bottom: be, right: Ce, x: oe, y: de };
|
|
1077
|
-
i.current.element instanceof HTMLElement && n && (z.height = i.current.element.offsetHeight, z.width = i.current.element.offsetWidth), Object.freeze(z), C.current && !
|
|
1078
|
+
i.current.element instanceof HTMLElement && n && (z.height = i.current.element.offsetHeight, z.width = i.current.element.offsetWidth), Object.freeze(z), C.current && !En(i.current.lastBounds, z) && o(i.current.lastBounds = z);
|
|
1078
1079
|
};
|
|
1079
1080
|
return [x, p ? Lt(x, p) : x, f ? Lt(x, f) : x];
|
|
1080
1081
|
}, [o, n, f, p]);
|
|
1081
1082
|
function b() {
|
|
1082
1083
|
i.current.scrollContainers && (i.current.scrollContainers.forEach((x) => x.removeEventListener("scroll", y, !0)), i.current.scrollContainers = null), i.current.resizeObserver && (i.current.resizeObserver.disconnect(), i.current.resizeObserver = null), i.current.orientationHandler && ("orientation" in screen && "removeEventListener" in screen.orientation ? screen.orientation.removeEventListener("change", i.current.orientationHandler) : "onorientationchange" in window && window.removeEventListener("orientationchange", i.current.orientationHandler));
|
|
1083
1084
|
}
|
|
1084
|
-
function
|
|
1085
|
+
function E() {
|
|
1085
1086
|
i.current.element && (i.current.resizeObserver = new a(y), i.current.resizeObserver.observe(i.current.element), t && i.current.scrollContainers && i.current.scrollContainers.forEach((x) => x.addEventListener("scroll", y, { capture: !0, passive: !0 })), i.current.orientationHandler = () => {
|
|
1086
1087
|
y();
|
|
1087
1088
|
}, "orientation" in screen && "addEventListener" in screen.orientation ? screen.orientation.addEventListener("change", i.current.orientationHandler) : "onorientationchange" in window && window.addEventListener("orientationchange", i.current.orientationHandler));
|
|
1088
1089
|
}
|
|
1089
|
-
const
|
|
1090
|
-
!x || x === i.current.element || (b(), i.current.element = x, i.current.scrollContainers = cr(x),
|
|
1090
|
+
const V = (x) => {
|
|
1091
|
+
!x || x === i.current.element || (b(), i.current.element = x, i.current.scrollContainers = cr(x), E());
|
|
1091
1092
|
};
|
|
1092
1093
|
return Sn(y, !!t), Cn(h), ue(() => {
|
|
1093
|
-
b(),
|
|
1094
|
-
}, [t, y, h]), ue(() => b, []), [
|
|
1094
|
+
b(), E();
|
|
1095
|
+
}, [t, y, h]), ue(() => b, []), [V, s, v];
|
|
1095
1096
|
}
|
|
1096
1097
|
function Cn(e) {
|
|
1097
1098
|
ue(() => {
|
|
@@ -1114,7 +1115,7 @@ function cr(e) {
|
|
|
1114
1115
|
const { overflow: r, overflowX: n, overflowY: a } = window.getComputedStyle(e);
|
|
1115
1116
|
return [r, n, a].some((s) => s === "auto" || s === "scroll") && t.push(e), [...t, ...cr(e.parentElement)];
|
|
1116
1117
|
}
|
|
1117
|
-
const
|
|
1118
|
+
const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En = (e, t) => Vn.every((r) => e[r] === t[r]), ke = ({
|
|
1118
1119
|
class: e,
|
|
1119
1120
|
...t
|
|
1120
1121
|
}) => {
|
|
@@ -1591,14 +1592,14 @@ const En = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Vn =
|
|
|
1591
1592
|
return {
|
|
1592
1593
|
ok: !0,
|
|
1593
1594
|
data: C.map((h) => {
|
|
1594
|
-
var y, b,
|
|
1595
|
+
var y, b, E, V, x, _, I, O, M;
|
|
1595
1596
|
return {
|
|
1596
1597
|
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1597
1598
|
id: h.mapbox_id,
|
|
1598
1599
|
address: {
|
|
1599
1600
|
line1: ((y = h.context.address) == null ? void 0 : y.name) ?? ((b = h.context.street) == null ? void 0 : b.name),
|
|
1600
1601
|
line2: void 0,
|
|
1601
|
-
line3: ((
|
|
1602
|
+
line3: ((E = h.context.neighborhood) == null ? void 0 : E.name) ?? ((V = h.context.locality) == null ? void 0 : V.name),
|
|
1602
1603
|
city: ((x = h.context.place) == null ? void 0 : x.name) ?? ((_ = h.context.district) == null ? void 0 : _.name),
|
|
1603
1604
|
state: (I = h.context.region) == null ? void 0 : I.name,
|
|
1604
1605
|
postcode: (O = h.context.postcode) == null ? void 0 : O.name,
|
|
@@ -1647,10 +1648,10 @@ const En = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Vn =
|
|
|
1647
1648
|
} = Tn({
|
|
1648
1649
|
logger: r,
|
|
1649
1650
|
t: n
|
|
1650
|
-
}), [C, v] = se(f ? "query" : "manual"), [h, y] = se(""), [b,
|
|
1651
|
-
me(f, "Query state should not be enabled"), x = x.trim(), x !== (h == null ? void 0 : h.trim()) && (y(x), x === "" && i([]),
|
|
1651
|
+
}), [C, v] = se(f ? "query" : "manual"), [h, y] = se(""), [b, E] = se(), V = (x) => {
|
|
1652
|
+
me(f, "Query state should not be enabled"), x = x.trim(), x !== (h == null ? void 0 : h.trim()) && (y(x), x === "" && i([]), E(void 0), p(x).then((_) => {
|
|
1652
1653
|
if (_.ok === !1) {
|
|
1653
|
-
i([]),
|
|
1654
|
+
i([]), E(_.error);
|
|
1654
1655
|
return;
|
|
1655
1656
|
}
|
|
1656
1657
|
i(_.data);
|
|
@@ -1670,7 +1671,7 @@ const En = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Vn =
|
|
|
1670
1671
|
_ && (s(_.address), v("details"));
|
|
1671
1672
|
},
|
|
1672
1673
|
onAddressSearch: (x) => {
|
|
1673
|
-
|
|
1674
|
+
V(x);
|
|
1674
1675
|
},
|
|
1675
1676
|
suggestions: o,
|
|
1676
1677
|
query: h,
|
|
@@ -2115,23 +2116,23 @@ const En = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Vn =
|
|
|
2115
2116
|
id: "dropzone-file",
|
|
2116
2117
|
onInput: async (h) => {
|
|
2117
2118
|
me(h.target instanceof HTMLInputElement);
|
|
2118
|
-
const y = h.target.files ? Array.from(h.target.files) : [], b = await Promise.allSettled(y.map(async (
|
|
2119
|
-
const x = await $n(
|
|
2119
|
+
const y = h.target.files ? Array.from(h.target.files) : [], b = await Promise.allSettled(y.map(async (V) => {
|
|
2120
|
+
const x = await $n(V);
|
|
2120
2121
|
return {
|
|
2121
|
-
name: Hn(
|
|
2122
|
+
name: Hn(V.name, 42),
|
|
2122
2123
|
data: x,
|
|
2123
|
-
sizeKb:
|
|
2124
|
+
sizeKb: V.size / 1e3
|
|
2124
2125
|
};
|
|
2125
2126
|
}));
|
|
2126
2127
|
if (b.some(({
|
|
2127
|
-
status:
|
|
2128
|
-
}) =>
|
|
2128
|
+
status: V
|
|
2129
|
+
}) => V === "rejected"))
|
|
2129
2130
|
return o({
|
|
2130
2131
|
type: "invalid",
|
|
2131
2132
|
message: "Invalid file"
|
|
2132
2133
|
});
|
|
2133
|
-
const
|
|
2134
|
-
a(
|
|
2134
|
+
const E = b.map((V) => V.status === "fulfilled" ? V.value : null).filter(Boolean);
|
|
2135
|
+
a(E);
|
|
2135
2136
|
},
|
|
2136
2137
|
multiple: e.config.allowMultiple,
|
|
2137
2138
|
type: "file",
|
|
@@ -2329,12 +2330,12 @@ function dt(e, t = {}) {
|
|
|
2329
2330
|
}
|
|
2330
2331
|
return t;
|
|
2331
2332
|
}
|
|
2332
|
-
function
|
|
2333
|
+
function Ee(e, t, r) {
|
|
2333
2334
|
r || (r = dt(t));
|
|
2334
2335
|
for (const n in e) {
|
|
2335
2336
|
const a = e[n];
|
|
2336
2337
|
if (vr(a))
|
|
2337
|
-
B(t) || ut(r[n]) ? r[n] = dt(a, Array.isArray(a) ? [] : {}) :
|
|
2338
|
+
B(t) || ut(r[n]) ? r[n] = dt(a, Array.isArray(a) ? [] : {}) : Ee(a, J(t) ? {} : t[n], r[n]);
|
|
2338
2339
|
else {
|
|
2339
2340
|
const s = t[n];
|
|
2340
2341
|
r[n] = !he(a, s);
|
|
@@ -2457,14 +2458,14 @@ var Se = (e) => $(e) && !Je(e) ? e : {
|
|
|
2457
2458
|
value: e,
|
|
2458
2459
|
message: ""
|
|
2459
2460
|
}, Jt = async (e, t, r, n, a, s) => {
|
|
2460
|
-
const { ref: o, refs: i, required: f, maxLength: p, minLength: C, min: v, max: h, pattern: y, validate: b, name:
|
|
2461
|
-
if (!x || t.has(
|
|
2461
|
+
const { ref: o, refs: i, required: f, maxLength: p, minLength: C, min: v, max: h, pattern: y, validate: b, name: E, valueAsNumber: V, mount: x } = e._f, _ = k(r, E);
|
|
2462
|
+
if (!x || t.has(E))
|
|
2462
2463
|
return {};
|
|
2463
2464
|
const I = i ? i[0] : o, O = (F) => {
|
|
2464
2465
|
a && I.reportValidity && (I.setCustomValidity(ne(F) ? "" : F || ""), I.reportValidity());
|
|
2465
|
-
}, M = {}, be = vt(o), Ce = ze(o), oe = be || Ce, de = (
|
|
2466
|
+
}, M = {}, be = vt(o), Ce = ze(o), oe = be || Ce, de = (V || bt(o)) && B(o.value) && B(_) || We(o) && o.value === "" || _ === "" || Array.isArray(_) && !_.length, z = gr.bind(null, E, n, M), qe = (F, L, j, q = ce.maxLength, ee = ce.minLength) => {
|
|
2466
2467
|
const X = F ? L : j;
|
|
2467
|
-
M[
|
|
2468
|
+
M[E] = {
|
|
2468
2469
|
type: F ? q : ee,
|
|
2469
2470
|
message: X,
|
|
2470
2471
|
ref: o,
|
|
@@ -2473,7 +2474,7 @@ var Se = (e) => $(e) && !Je(e) ? e : {
|
|
|
2473
2474
|
};
|
|
2474
2475
|
if (s ? !Array.isArray(_) || !_.length : f && (!oe && (de || J(_)) || ne(_) && !_ || Ce && !xr(i).isValid || be && !kr(i).isValid)) {
|
|
2475
2476
|
const { value: F, message: L } = Z(f) ? { value: !!f, message: f } : Se(f);
|
|
2476
|
-
if (F && (M[
|
|
2477
|
+
if (F && (M[E] = {
|
|
2477
2478
|
type: ce.required,
|
|
2478
2479
|
message: L,
|
|
2479
2480
|
ref: I,
|
|
@@ -2492,16 +2493,16 @@ var Se = (e) => $(e) && !Je(e) ? e : {
|
|
|
2492
2493
|
Z(j.value) && _ && (F = Ae ? X(_) > X(j.value) : Me ? _ > j.value : ee > new Date(j.value)), Z(q.value) && _ && (L = Ae ? X(_) < X(q.value) : Me ? _ < q.value : ee < new Date(q.value));
|
|
2493
2494
|
}
|
|
2494
2495
|
if ((F || L) && (qe(!!F, j.message, q.message, ce.max, ce.min), !n))
|
|
2495
|
-
return O(M[
|
|
2496
|
+
return O(M[E].message), M;
|
|
2496
2497
|
}
|
|
2497
2498
|
if ((p || C) && !de && (Z(_) || s && Array.isArray(_))) {
|
|
2498
2499
|
const F = Se(p), L = Se(C), j = !J(F.value) && _.length > +F.value, q = !J(L.value) && _.length < +L.value;
|
|
2499
2500
|
if ((j || q) && (qe(j, F.message, L.message), !n))
|
|
2500
|
-
return O(M[
|
|
2501
|
+
return O(M[E].message), M;
|
|
2501
2502
|
}
|
|
2502
2503
|
if (y && !de && Z(_)) {
|
|
2503
2504
|
const { value: F, message: L } = Se(y);
|
|
2504
|
-
if (Je(F) && !_.match(F) && (M[
|
|
2505
|
+
if (Je(F) && !_.match(F) && (M[E] = {
|
|
2505
2506
|
type: ce.pattern,
|
|
2506
2507
|
message: L,
|
|
2507
2508
|
ref: o,
|
|
@@ -2512,7 +2513,7 @@ var Se = (e) => $(e) && !Je(e) ? e : {
|
|
|
2512
2513
|
if (b) {
|
|
2513
2514
|
if (te(b)) {
|
|
2514
2515
|
const F = await b(_, r), L = Wt(F, I);
|
|
2515
|
-
if (L && (M[
|
|
2516
|
+
if (L && (M[E] = {
|
|
2516
2517
|
...L,
|
|
2517
2518
|
...z(ce.validate, L.message)
|
|
2518
2519
|
}, !n))
|
|
@@ -2526,9 +2527,9 @@ var Se = (e) => $(e) && !Je(e) ? e : {
|
|
|
2526
2527
|
j && (F = {
|
|
2527
2528
|
...j,
|
|
2528
2529
|
...z(L, j.message)
|
|
2529
|
-
}, O(j.message), n && (M[
|
|
2530
|
+
}, O(j.message), n && (M[E] = F));
|
|
2530
2531
|
}
|
|
2531
|
-
if (!W(F) && (M[
|
|
2532
|
+
if (!W(F) && (M[E] = {
|
|
2532
2533
|
ref: I,
|
|
2533
2534
|
...F
|
|
2534
2535
|
}, !n))
|
|
@@ -2590,9 +2591,9 @@ function ms(e = {}) {
|
|
|
2590
2591
|
const y = {
|
|
2591
2592
|
array: Pt(),
|
|
2592
2593
|
state: Pt()
|
|
2593
|
-
}, b = t.criteriaMode === re.all,
|
|
2594
|
+
}, b = t.criteriaMode === re.all, E = (l) => (u) => {
|
|
2594
2595
|
clearTimeout(p), p = setTimeout(l, u);
|
|
2595
|
-
},
|
|
2596
|
+
}, V = async (l) => {
|
|
2596
2597
|
if (!o.keepIsValid && !t.disabled && (v.isValid || h.isValid || l)) {
|
|
2597
2598
|
let u;
|
|
2598
2599
|
t.resolver ? (u = W((await oe()).errors), x()) : u = await z(n, !0), u !== r.isValid && y.state.next({
|
|
@@ -2620,7 +2621,7 @@ function ms(e = {}) {
|
|
|
2620
2621
|
const S = d(k(r.touchedFields, l), w.argA, w.argB);
|
|
2621
2622
|
g && D(r.touchedFields, l, S);
|
|
2622
2623
|
}
|
|
2623
|
-
(v.dirtyFields || h.dirtyFields) && (r.dirtyFields =
|
|
2624
|
+
(v.dirtyFields || h.dirtyFields) && (r.dirtyFields = Ee(a, s)), y.state.next({
|
|
2624
2625
|
name: l,
|
|
2625
2626
|
isDirty: F(l, u),
|
|
2626
2627
|
dirtyFields: r.dirtyFields,
|
|
@@ -2642,7 +2643,7 @@ function ms(e = {}) {
|
|
|
2642
2643
|
const g = k(n, l);
|
|
2643
2644
|
if (g) {
|
|
2644
2645
|
const m = k(s, l, B(d) ? k(a, l) : d);
|
|
2645
|
-
B(m) || w && w.defaultChecked || u ? D(s, l, u ? m : zt(g._f)) : q(l, m), o.mount && !o.action &&
|
|
2646
|
+
B(m) || w && w.defaultChecked || u ? D(s, l, u ? m : zt(g._f)) : q(l, m), o.mount && !o.action && V();
|
|
2646
2647
|
}
|
|
2647
2648
|
}, be = (l, u, d, w, g) => {
|
|
2648
2649
|
let m = !1, S = !1;
|
|
@@ -2664,7 +2665,7 @@ function ms(e = {}) {
|
|
|
2664
2665
|
return m ? N : {};
|
|
2665
2666
|
}, Ce = (l, u, d, w) => {
|
|
2666
2667
|
const g = k(r.errors, l), m = (v.isValid || h.isValid) && ne(u) && r.isValid !== u;
|
|
2667
|
-
if (t.delayError && d ? (f =
|
|
2668
|
+
if (t.delayError && d ? (f = E(() => I(l, d)), f(t.delayError)) : (clearTimeout(p), f = null, d ? D(r.errors, l, d) : P(r.errors, l)), (d ? !he(g, d) : g) || !W(w) || m) {
|
|
2668
2669
|
const S = {
|
|
2669
2670
|
...w,
|
|
2670
2671
|
...m && ne(u) ? { isValid: u } : {},
|
|
@@ -2740,7 +2741,7 @@ function ms(e = {}) {
|
|
|
2740
2741
|
values: U(s)
|
|
2741
2742
|
}), (v.isDirty || v.dirtyFields || h.isDirty || h.dirtyFields) && d.shouldDirty && y.state.next({
|
|
2742
2743
|
name: l,
|
|
2743
|
-
dirtyFields:
|
|
2744
|
+
dirtyFields: Ee(a, s),
|
|
2744
2745
|
isDirty: F(l, m)
|
|
2745
2746
|
})) : w && !w._f && !J(m) ? ee(l, m, d) : q(l, m, d), Kt(l, i) ? y.state.next({
|
|
2746
2747
|
...r,
|
|
@@ -2767,7 +2768,7 @@ function ms(e = {}) {
|
|
|
2767
2768
|
type: l.type,
|
|
2768
2769
|
values: U(s)
|
|
2769
2770
|
}), Mr)
|
|
2770
|
-
return (v.isValid || h.isValid) && (t.mode === "onBlur" ? fe &&
|
|
2771
|
+
return (v.isValid || h.isValid) && (t.mode === "onBlur" ? fe && V() : fe || V()), Lr && y.state.next({ name: d, ...st ? {} : at });
|
|
2771
2772
|
if (!fe && st && y.state.next({ ...r }), t.resolver) {
|
|
2772
2773
|
const { errors: It } = await oe([d]);
|
|
2773
2774
|
if (x([d]), m(ve), w) {
|
|
@@ -2791,7 +2792,7 @@ function ms(e = {}) {
|
|
|
2791
2792
|
l ? (w = (await Promise.all(g.map(async (m) => {
|
|
2792
2793
|
const S = k(n, m);
|
|
2793
2794
|
return await z(S && S._f ? { [m]: S } : S);
|
|
2794
|
-
}))).every(Boolean), !(!w && !r.isValid) &&
|
|
2795
|
+
}))).every(Boolean), !(!w && !r.isValid) && V()) : w = d = await z(n);
|
|
2795
2796
|
return y.state.next({
|
|
2796
2797
|
...!Z(l) || (v.isValid || h.isValid) && d !== r.isValid ? {} : { name: l },
|
|
2797
2798
|
...t.resolver || !l ? { isValid: d } : {},
|
|
@@ -2840,7 +2841,7 @@ function ms(e = {}) {
|
|
|
2840
2841
|
defaultValues: a
|
|
2841
2842
|
});
|
|
2842
2843
|
}
|
|
2843
|
-
}).unsubscribe,
|
|
2844
|
+
}).unsubscribe, Vr = (l) => (o.mount = !0, h = {
|
|
2844
2845
|
...h,
|
|
2845
2846
|
...l.formState
|
|
2846
2847
|
}, _t({
|
|
@@ -2857,11 +2858,11 @@ function ms(e = {}) {
|
|
|
2857
2858
|
}), y.state.next({
|
|
2858
2859
|
...r,
|
|
2859
2860
|
...u.keepDirty ? { isDirty: F() } : {}
|
|
2860
|
-
}), !u.keepIsValid &&
|
|
2861
|
+
}), !u.keepIsValid && V();
|
|
2861
2862
|
}, Ct = ({ disabled: l, name: u }) => {
|
|
2862
2863
|
if (ne(l) && o.mount || l || i.disabled.has(u)) {
|
|
2863
2864
|
const g = i.disabled.has(u) !== !!l;
|
|
2864
|
-
l ? i.disabled.add(u) : i.disabled.delete(u), g && o.mount && !o.action &&
|
|
2865
|
+
l ? i.disabled.add(u) : i.disabled.delete(u), g && o.mount && !o.action && V();
|
|
2865
2866
|
}
|
|
2866
2867
|
}, rt = (l, u = {}) => {
|
|
2867
2868
|
let d = k(n, l);
|
|
@@ -2913,7 +2914,7 @@ function ms(e = {}) {
|
|
|
2913
2914
|
d = k(n, l, {}), d._f && (d._f.mount = !1), (t.shouldUnregister || u.shouldUnregister) && !(Jn(i.array, l) && o.action) && i.unMount.add(l);
|
|
2914
2915
|
}
|
|
2915
2916
|
};
|
|
2916
|
-
}, nt = () => t.shouldFocusError && $e(n, Me, i.mount),
|
|
2917
|
+
}, nt = () => t.shouldFocusError && $e(n, Me, i.mount), Er = (l) => {
|
|
2917
2918
|
ne(l) && (y.state.next({ disabled: l }), $e(n, (u, d) => {
|
|
2918
2919
|
const w = k(n, d);
|
|
2919
2920
|
w && (u.disabled = w._f.disabled || l, Array.isArray(w._f.refs) && w._f.refs.forEach((g) => {
|
|
@@ -2954,14 +2955,14 @@ function ms(e = {}) {
|
|
|
2954
2955
|
}), w)
|
|
2955
2956
|
throw w;
|
|
2956
2957
|
}, Fr = (l, u = {}) => {
|
|
2957
|
-
k(n, l) && (B(u.defaultValue) ? X(l, U(k(a, l))) : (X(l, u.defaultValue), D(a, l, U(u.defaultValue))), u.keepTouched || P(r.touchedFields, l), u.keepDirty || (P(r.dirtyFields, l), r.isDirty = u.defaultValue ? F(l, U(k(a, l))) : F()), u.keepError || (P(r.errors, l), v.isValid &&
|
|
2958
|
-
},
|
|
2958
|
+
k(n, l) && (B(u.defaultValue) ? X(l, U(k(a, l))) : (X(l, u.defaultValue), D(a, l, U(u.defaultValue))), u.keepTouched || P(r.touchedFields, l), u.keepDirty || (P(r.dirtyFields, l), r.isDirty = u.defaultValue ? F(l, U(k(a, l))) : F()), u.keepError || (P(r.errors, l), v.isValid && V()), y.state.next({ ...r }));
|
|
2959
|
+
}, Vt = (l, u = {}) => {
|
|
2959
2960
|
const d = l ? U(l) : a, w = U(d), g = W(l), m = g ? a : w;
|
|
2960
2961
|
if (u.keepDefaultValues || (a = d), !u.keepValues) {
|
|
2961
2962
|
if (u.keepDirtyValues) {
|
|
2962
2963
|
const S = /* @__PURE__ */ new Set([
|
|
2963
2964
|
...i.mount,
|
|
2964
|
-
...Object.keys(
|
|
2965
|
+
...Object.keys(Ee(a, s))
|
|
2965
2966
|
]);
|
|
2966
2967
|
for (const N of Array.from(S)) {
|
|
2967
2968
|
const T = k(r.dirtyFields, N), K = k(s, N), ve = k(m, N);
|
|
@@ -3006,14 +3007,14 @@ function ms(e = {}) {
|
|
|
3006
3007
|
submitCount: u.keepSubmitCount ? r.submitCount : 0,
|
|
3007
3008
|
isDirty: g ? !1 : u.keepDirty ? r.isDirty : !!(u.keepDefaultValues && !he(l, a)),
|
|
3008
3009
|
isSubmitted: u.keepIsSubmitted ? r.isSubmitted : !1,
|
|
3009
|
-
dirtyFields: g ? {} : u.keepDirtyValues ? u.keepDefaultValues && s ?
|
|
3010
|
+
dirtyFields: g ? {} : u.keepDirtyValues ? u.keepDefaultValues && s ? Ee(a, s) : r.dirtyFields : u.keepDefaultValues && l ? Ee(a, l) : u.keepDirty ? r.dirtyFields : {},
|
|
3010
3011
|
touchedFields: u.keepTouched ? r.touchedFields : {},
|
|
3011
3012
|
errors: u.keepErrors ? r.errors : {},
|
|
3012
3013
|
isSubmitSuccessful: u.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
3013
3014
|
isSubmitting: !1,
|
|
3014
3015
|
defaultValues: a
|
|
3015
3016
|
});
|
|
3016
|
-
},
|
|
3017
|
+
}, Et = (l, u) => Vt(te(l) ? l(s) : l, { ...t.resetOptions, ...u }), Ir = (l, u = {}) => {
|
|
3017
3018
|
const d = k(n, l), w = d && d._f;
|
|
3018
3019
|
if (w) {
|
|
3019
3020
|
const g = w.refs ? w.refs[0] : w.ref;
|
|
@@ -3039,19 +3040,19 @@ function ms(e = {}) {
|
|
|
3039
3040
|
_focusError: nt,
|
|
3040
3041
|
_getWatch: L,
|
|
3041
3042
|
_getDirty: F,
|
|
3042
|
-
_setValid:
|
|
3043
|
+
_setValid: V,
|
|
3043
3044
|
_setFieldArray: _,
|
|
3044
3045
|
_setDisabledField: Ct,
|
|
3045
3046
|
_setErrors: O,
|
|
3046
3047
|
_getFieldArray: j,
|
|
3047
|
-
_reset:
|
|
3048
|
+
_reset: Vt,
|
|
3048
3049
|
_resetDefaultValues: () => te(t.defaultValues) && t.defaultValues().then((l) => {
|
|
3049
|
-
|
|
3050
|
+
Et(l, t.resetOptions), y.state.next({
|
|
3050
3051
|
isLoading: !1
|
|
3051
3052
|
});
|
|
3052
3053
|
}),
|
|
3053
3054
|
_removeUnmounted: qe,
|
|
3054
|
-
_disableForm:
|
|
3055
|
+
_disableForm: Er,
|
|
3055
3056
|
_subjects: y,
|
|
3056
3057
|
_proxyFormState: v,
|
|
3057
3058
|
get _fields() {
|
|
@@ -3088,14 +3089,14 @@ function ms(e = {}) {
|
|
|
3088
3089
|
};
|
|
3089
3090
|
}
|
|
3090
3091
|
},
|
|
3091
|
-
subscribe:
|
|
3092
|
+
subscribe: Vr,
|
|
3092
3093
|
trigger: Le,
|
|
3093
3094
|
register: rt,
|
|
3094
3095
|
handleSubmit: St,
|
|
3095
3096
|
watch: Sr,
|
|
3096
3097
|
setValue: X,
|
|
3097
3098
|
getValues: xt,
|
|
3098
|
-
reset:
|
|
3099
|
+
reset: Et,
|
|
3099
3100
|
resetField: Fr,
|
|
3100
3101
|
clearErrors: Cr,
|
|
3101
3102
|
unregister: tt,
|
|
@@ -3317,8 +3318,8 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3317
3318
|
}),
|
|
3318
3319
|
children: e.config.options.map((h, y) => {
|
|
3319
3320
|
const b = `checked.${h.value}`, {
|
|
3320
|
-
ref:
|
|
3321
|
-
...
|
|
3321
|
+
ref: E,
|
|
3322
|
+
...V
|
|
3322
3323
|
} = o(b);
|
|
3323
3324
|
return c("li", {
|
|
3324
3325
|
class: "relative",
|
|
@@ -3326,10 +3327,10 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3326
3327
|
option: h,
|
|
3327
3328
|
autoFocus: y === 0,
|
|
3328
3329
|
ref: (x) => {
|
|
3329
|
-
x && y === 0 && (p.current = x),
|
|
3330
|
+
x && y === 0 && (p.current = x), E(x);
|
|
3330
3331
|
},
|
|
3331
3332
|
id: b,
|
|
3332
|
-
...
|
|
3333
|
+
...V,
|
|
3333
3334
|
onClick: n ? () => t({
|
|
3334
3335
|
type: "enum",
|
|
3335
3336
|
value: [h.value]
|
|
@@ -3432,7 +3433,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3432
3433
|
error: i.number
|
|
3433
3434
|
})]
|
|
3434
3435
|
});
|
|
3435
|
-
},
|
|
3436
|
+
}, Vs = (e) => {
|
|
3436
3437
|
if (e === "")
|
|
3437
3438
|
return {
|
|
3438
3439
|
countryCode: "",
|
|
@@ -3446,7 +3447,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3446
3447
|
countryCode: "",
|
|
3447
3448
|
phoneNumber: ""
|
|
3448
3449
|
};
|
|
3449
|
-
},
|
|
3450
|
+
}, Es = "44", Fs = /^[0-9 ]+$/, Is = Fe("string"), As = Fe("phone"), Ms = (e) => {
|
|
3450
3451
|
const t = pe(Q(e("validation_country_code")), ir(Fs, e("validation_country_code"))), r = pe(Q(e("validation_phone")), Be(1, e("validation_phone")), ar((n) => n.replace(/[^0-9]/g, "")));
|
|
3451
3452
|
return et(ge({
|
|
3452
3453
|
countryCode: t,
|
|
@@ -3456,10 +3457,10 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3456
3457
|
input: e,
|
|
3457
3458
|
onSubmitSuccess: t
|
|
3458
3459
|
}) => {
|
|
3459
|
-
var
|
|
3460
|
-
const r = e.key ? (
|
|
3460
|
+
var E;
|
|
3461
|
+
const r = e.key ? (E = A.current$.value.flow) == null ? void 0 : E.data.submissions[e.key] : void 0, {
|
|
3461
3462
|
t: n
|
|
3462
|
-
} = Y(), [a, s] = se(), o = Is(r) ?
|
|
3463
|
+
} = Y(), [a, s] = se(), o = Is(r) ? Vs(r.value) : As(r) ? r.value : void 0, {
|
|
3463
3464
|
register: i,
|
|
3464
3465
|
handleSubmit: f,
|
|
3465
3466
|
formState: {
|
|
@@ -3468,7 +3469,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3468
3469
|
watch: C
|
|
3469
3470
|
} = Qe({
|
|
3470
3471
|
defaultValues: {
|
|
3471
|
-
countryCode: (o == null ? void 0 : o.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3472
|
+
countryCode: (o == null ? void 0 : o.countryCode) ?? e.config.defaultValue.countryCode ?? Es,
|
|
3472
3473
|
phoneNumber: (o == null ? void 0 : o.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3473
3474
|
},
|
|
3474
3475
|
resolver: Ms(n)
|
|
@@ -3483,8 +3484,8 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3483
3484
|
}, []), c("form", {
|
|
3484
3485
|
noValidate: !0,
|
|
3485
3486
|
class: "flex flex-col gap-1 p-2.5",
|
|
3486
|
-
onSubmit: f((
|
|
3487
|
-
const x =
|
|
3487
|
+
onSubmit: f((V) => {
|
|
3488
|
+
const x = V.phoneNumber.replace(/[^0-9]/g, ""), _ = V.countryCode.replace(/[^0-9]/g, "");
|
|
3488
3489
|
s(void 0);
|
|
3489
3490
|
const I = e.config.minChars ?? 7, O = x.length + _.length;
|
|
3490
3491
|
if (O < I)
|
|
@@ -3504,7 +3505,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3504
3505
|
}
|
|
3505
3506
|
}) : t({
|
|
3506
3507
|
type: "string",
|
|
3507
|
-
value: b +
|
|
3508
|
+
value: b + V.phoneNumber
|
|
3508
3509
|
});
|
|
3509
3510
|
}),
|
|
3510
3511
|
children: [c("div", {
|
|
@@ -3520,10 +3521,10 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3520
3521
|
...i("countryCode", {}),
|
|
3521
3522
|
id: `isdk_phone_${e.key}`,
|
|
3522
3523
|
class: "absolute inset-0 opacity-0",
|
|
3523
|
-
children: Object.entries(ht).map(([
|
|
3524
|
+
children: Object.entries(ht).map(([V, x]) => c("option", {
|
|
3524
3525
|
value: x,
|
|
3525
|
-
children: [
|
|
3526
|
-
},
|
|
3526
|
+
children: [V, " (+", x, ")"]
|
|
3527
|
+
}, V))
|
|
3527
3528
|
})]
|
|
3528
3529
|
}), c("input", {
|
|
3529
3530
|
...h,
|
|
@@ -3534,8 +3535,8 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3534
3535
|
autoCapitalize: "off",
|
|
3535
3536
|
autoCorrect: "off",
|
|
3536
3537
|
autoFocus: !0,
|
|
3537
|
-
ref: (
|
|
3538
|
-
|
|
3538
|
+
ref: (V) => {
|
|
3539
|
+
V && (y.current = V), v(V);
|
|
3539
3540
|
},
|
|
3540
3541
|
class: Ue({
|
|
3541
3542
|
optional: e.config.optional,
|
|
@@ -3990,8 +3991,8 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3990
3991
|
})) : A.removeMessagesSentByNodeIds([y]);
|
|
3991
3992
|
const {
|
|
3992
3993
|
interpret: b,
|
|
3993
|
-
abort:
|
|
3994
|
-
undo:
|
|
3994
|
+
abort: E,
|
|
3995
|
+
undo: V
|
|
3995
3996
|
} = rn({
|
|
3996
3997
|
context: a.context,
|
|
3997
3998
|
analytics: {
|
|
@@ -4027,7 +4028,7 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
4027
4028
|
});
|
|
4028
4029
|
}
|
|
4029
4030
|
});
|
|
4030
|
-
return C(() =>
|
|
4031
|
+
return C(() => V), b(y), E;
|
|
4031
4032
|
}, [r, t, i, e, a, n, f]), c(we, {
|
|
4032
4033
|
children: [c("div", {
|
|
4033
4034
|
ref: o,
|