@opencx/widget 2.5.0 → 2.6.0
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/basic.cjs +1 -1
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +1 -1
- package/dist/basic.js.map +1 -1
- package/dist/core/client/api.d.ts +1 -1
- package/dist/core/client/chat.d.ts +37 -2
- package/dist/core/client/contact.d.ts +2 -2
- package/dist/core/errors/index.d.ts +6 -0
- package/dist/core/platform/audio.d.ts +38 -0
- package/dist/core/platform/index.d.ts +6 -2
- package/dist/core/platform/storage.d.ts +8 -2
- package/dist/core/tests/client/integration.test.d.ts +1 -0
- package/dist/core/tests/platform/audio.test.d.ts +1 -0
- package/dist/core/tests/platform/logger.test.d.ts +1 -0
- package/dist/core/tests/platform/storage.test.d.ts +1 -0
- package/dist/core/tests/test-utils.d.ts +2 -0
- package/dist/core/tests/types/pub-sub.test.d.ts +1 -0
- package/dist/core/tests/utils/create-fetch.test.d.ts +1 -0
- package/dist/core/types/helpers.d.ts +2 -2
- package/dist/core/types/pub-sub.d.ts +1 -0
- package/dist/core/types/schemas-v2.d.ts +6 -3
- package/dist/core/utils/create-fetch.d.ts +2 -1
- package/dist/core/utils/genUuid.d.ts +1 -0
- package/dist/{schemas-v2-DZ3nwfID.js → genUuid-C12yFv3j.js} +18 -19
- package/dist/genUuid-C12yFv3j.js.map +1 -0
- package/dist/genUuid-DdeSE04H.cjs +2 -0
- package/dist/genUuid-DdeSE04H.cjs.map +1 -0
- package/dist/{index-CJ_skeU7.js → index-C87obATS.js} +583 -569
- package/dist/index-C87obATS.js.map +1 -0
- package/dist/index-ChwS_h0D.cjs +18 -0
- package/dist/index-ChwS_h0D.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +668 -471
- package/dist/index.js.map +1 -1
- package/dist/package.json.d.ts +3 -1
- package/dist/react-web/utils/getters.d.ts +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/src/@components/BotOrAgentMessageGroup.d.ts +2 -1
- package/dist-embed/script.js +101 -101
- package/dist-embed/script.js.map +1 -1
- package/package.json +3 -1
- package/dist/index-9gKFMrIK.cjs +0 -18
- package/dist/index-9gKFMrIK.cjs.map +0 -1
- package/dist/index-CJ_skeU7.js.map +0 -1
- package/dist/schemas-v2-BiJWHypc.cjs +0 -2
- package/dist/schemas-v2-BiJWHypc.cjs.map +0 -1
- package/dist/schemas-v2-DZ3nwfID.js.map +0 -1
- /package/dist/core/{utils/genId.test.d.ts → tests/client/integration-perisitance.test.d.ts} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var ln = Object.defineProperty;
|
|
2
2
|
var dn = (e, t, n) => t in e ? ln(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { jsx as ee } from "react/jsx-runtime";
|
|
3
|
+
var it = (e, t, n) => dn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import fe, { useMemo as ne, useState as Je, useCallback as me, useEffect as de, createContext as yt, useContext as St, useRef as ae, useReducer as fn, useLayoutEffect as pn, useDebugValue as gn } from "react";
|
|
5
|
+
import { jsx as te } from "react/jsx-runtime";
|
|
7
6
|
import { create as mn } from "mutative";
|
|
8
7
|
import l from "zod";
|
|
8
|
+
import { c as vt, g as ve } from "./genUuid-C12yFv3j.js";
|
|
9
9
|
import hn from "lodash.set";
|
|
10
10
|
import yn from "axios";
|
|
11
|
-
const Sn = typeof window > "u",
|
|
11
|
+
const Sn = typeof window > "u", ct = {
|
|
12
12
|
getItem: () => null,
|
|
13
13
|
setItem: () => {
|
|
14
14
|
},
|
|
@@ -16,10 +16,10 @@ const Sn = typeof window > "u", it = {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
function vn(e) {
|
|
19
|
-
return Sn ?
|
|
19
|
+
return Sn ? ct : e === "local" ? localStorage : e === "session" ? sessionStorage : ct;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const r =
|
|
21
|
+
function Ze(e, t, n = "session") {
|
|
22
|
+
const r = ne(() => vn(n), [n]), [s, o] = Je(() => {
|
|
23
23
|
const g = r.getItem(e);
|
|
24
24
|
if (g !== null)
|
|
25
25
|
try {
|
|
@@ -55,7 +55,7 @@ function Je(e, t, n = "session") {
|
|
|
55
55
|
};
|
|
56
56
|
}, [e, s]), [s, a, d];
|
|
57
57
|
}
|
|
58
|
-
const En = "@opencx/widget",
|
|
58
|
+
const En = "@opencx/widget", Et = "2.6.0", bn = "module", wn = {
|
|
59
59
|
access: "public"
|
|
60
60
|
}, On = {
|
|
61
61
|
clean: "rm -rf ./dist ./dist-embed",
|
|
@@ -100,6 +100,8 @@ const En = "@opencx/widget", vt = "2.5.0", bn = "module", wn = {
|
|
|
100
100
|
"react-dropzone": "^14.3.5",
|
|
101
101
|
"react-hot-toast": "^2.4.1",
|
|
102
102
|
tinycolor2: "^1.6.0",
|
|
103
|
+
uuid: "^11.0.4",
|
|
104
|
+
"whatwg-fetch": "^3.6.20",
|
|
103
105
|
zod: "^3.23.8"
|
|
104
106
|
}, Dn = {
|
|
105
107
|
"@opencx/widget": {
|
|
@@ -189,7 +191,7 @@ const En = "@opencx/widget", vt = "2.5.0", bn = "module", wn = {
|
|
|
189
191
|
}, Vn = {
|
|
190
192
|
name: En,
|
|
191
193
|
private: !1,
|
|
192
|
-
version:
|
|
194
|
+
version: Et,
|
|
193
195
|
type: bn,
|
|
194
196
|
publishConfig: wn,
|
|
195
197
|
scripts: On,
|
|
@@ -209,16 +211,16 @@ const En = "@opencx/widget", vt = "2.5.0", bn = "module", wn = {
|
|
|
209
211
|
exports: Fn,
|
|
210
212
|
devDependencies: Mn
|
|
211
213
|
}, Un = "X-Bot-Token", Hn = "X-Widget-Version";
|
|
212
|
-
function
|
|
213
|
-
const t =
|
|
214
|
+
function bt(e) {
|
|
215
|
+
const t = ne(() => yn.create({
|
|
214
216
|
baseURL: e.apiUrl,
|
|
215
217
|
headers: {
|
|
216
218
|
[Un]: e.botToken,
|
|
217
|
-
[Hn]:
|
|
219
|
+
[Hn]: Et,
|
|
218
220
|
"X-Use-Guard": !0
|
|
219
221
|
}
|
|
220
222
|
}), [e]);
|
|
221
|
-
return { apis:
|
|
223
|
+
return { apis: ne(
|
|
222
224
|
() => ({
|
|
223
225
|
createSession: (r) => {
|
|
224
226
|
if (!r)
|
|
@@ -303,7 +305,7 @@ function Et(e) {
|
|
|
303
305
|
[t]
|
|
304
306
|
), options: e };
|
|
305
307
|
}
|
|
306
|
-
function
|
|
308
|
+
function Ne(e) {
|
|
307
309
|
const t = yt({});
|
|
308
310
|
return [() => {
|
|
309
311
|
const r = St(t);
|
|
@@ -471,7 +473,7 @@ const Gn = {
|
|
|
471
473
|
"start-chat": "Talk to support",
|
|
472
474
|
"starting-chat": "Connecting...",
|
|
473
475
|
"hello-greeting": "Hi there!"
|
|
474
|
-
},
|
|
476
|
+
}, qn = {
|
|
475
477
|
ok: "D'accord",
|
|
476
478
|
yes: "Oui",
|
|
477
479
|
no: "Non",
|
|
@@ -524,7 +526,7 @@ const Gn = {
|
|
|
524
526
|
"start-chat": "Parler au support",
|
|
525
527
|
"starting-chat": "Connexion...",
|
|
526
528
|
"hello-greeting": "Bonjour ! Comment pouvons-nous vous aider aujourd'hui ?"
|
|
527
|
-
},
|
|
529
|
+
}, Bn = {
|
|
528
530
|
ok: "OK",
|
|
529
531
|
yes: "Ja",
|
|
530
532
|
no: "Nee",
|
|
@@ -633,8 +635,8 @@ const Gn = {
|
|
|
633
635
|
}, Qn = {
|
|
634
636
|
en: Yn,
|
|
635
637
|
ar: Gn,
|
|
636
|
-
nl:
|
|
637
|
-
fr:
|
|
638
|
+
nl: Bn,
|
|
639
|
+
fr: qn,
|
|
638
640
|
de: zn,
|
|
639
641
|
pt: Xn
|
|
640
642
|
};
|
|
@@ -642,10 +644,10 @@ function Wn(e, t) {
|
|
|
642
644
|
const n = Qn[t];
|
|
643
645
|
return n && n[e] || "";
|
|
644
646
|
}
|
|
645
|
-
const [
|
|
646
|
-
function
|
|
647
|
-
const t =
|
|
648
|
-
return /* @__PURE__ */
|
|
647
|
+
const [Es, Kn] = Ne();
|
|
648
|
+
function wt({ children: e }) {
|
|
649
|
+
const t = le();
|
|
650
|
+
return /* @__PURE__ */ te(
|
|
649
651
|
Kn,
|
|
650
652
|
{
|
|
651
653
|
value: {
|
|
@@ -658,7 +660,7 @@ function bt({ children: e }) {
|
|
|
658
660
|
}
|
|
659
661
|
class Jn {
|
|
660
662
|
constructor(t) {
|
|
661
|
-
|
|
663
|
+
it(this, "components", [
|
|
662
664
|
{
|
|
663
665
|
key: "FALLBACK",
|
|
664
666
|
component: (t) => "fallback"
|
|
@@ -697,7 +699,7 @@ const Zn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAA
|
|
|
697
699
|
triggerOffset: "20px"
|
|
698
700
|
};
|
|
699
701
|
function er(e) {
|
|
700
|
-
return
|
|
702
|
+
return ne(() => {
|
|
701
703
|
var s, o, a, d;
|
|
702
704
|
const t = {
|
|
703
705
|
messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
|
|
@@ -729,25 +731,25 @@ function er(e) {
|
|
|
729
731
|
};
|
|
730
732
|
}, [e]);
|
|
731
733
|
}
|
|
732
|
-
const [
|
|
734
|
+
const [le, tr] = Ne(), nr = "en";
|
|
733
735
|
function rr({
|
|
734
736
|
children: e,
|
|
735
737
|
data: t
|
|
736
738
|
}) {
|
|
737
|
-
const n =
|
|
739
|
+
const n = ne(
|
|
738
740
|
() => new Jn({
|
|
739
741
|
components: t.components
|
|
740
742
|
}),
|
|
741
743
|
[t]
|
|
742
|
-
), r = er(t), s =
|
|
744
|
+
), r = er(t), s = bt({
|
|
743
745
|
apiUrl: r.apiUrl,
|
|
744
746
|
botToken: r.token
|
|
745
|
-
}), [o, a] =
|
|
747
|
+
}), [o, a] = Ze(
|
|
746
748
|
"open_settings",
|
|
747
749
|
r.defaultSettings,
|
|
748
750
|
"local"
|
|
749
751
|
);
|
|
750
|
-
return /* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ te(
|
|
751
753
|
tr,
|
|
752
754
|
{
|
|
753
755
|
value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (g) => {
|
|
@@ -759,12 +761,12 @@ function rr({
|
|
|
759
761
|
);
|
|
760
762
|
a(u);
|
|
761
763
|
} },
|
|
762
|
-
children: /* @__PURE__ */
|
|
764
|
+
children: /* @__PURE__ */ te(wt, { children: e })
|
|
763
765
|
}
|
|
764
766
|
);
|
|
765
767
|
}
|
|
766
|
-
var
|
|
767
|
-
function
|
|
768
|
+
var bs = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
769
|
+
function ws(e) {
|
|
768
770
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
769
771
|
}
|
|
770
772
|
function sr(e) {
|
|
@@ -786,32 +788,32 @@ function sr(e) {
|
|
|
786
788
|
});
|
|
787
789
|
}), n;
|
|
788
790
|
}
|
|
789
|
-
var
|
|
790
|
-
return
|
|
791
|
+
var Ot = {}, ze = function(e, t) {
|
|
792
|
+
return ze = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
791
793
|
n.__proto__ = r;
|
|
792
794
|
} || function(n, r) {
|
|
793
795
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
794
|
-
},
|
|
796
|
+
}, ze(e, t);
|
|
795
797
|
};
|
|
796
|
-
function
|
|
798
|
+
function At(e, t) {
|
|
797
799
|
if (typeof t != "function" && t !== null)
|
|
798
800
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
799
|
-
|
|
801
|
+
ze(e, t);
|
|
800
802
|
function n() {
|
|
801
803
|
this.constructor = e;
|
|
802
804
|
}
|
|
803
805
|
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
804
806
|
}
|
|
805
|
-
var
|
|
806
|
-
return
|
|
807
|
+
var Te = function() {
|
|
808
|
+
return Te = Object.assign || function(t) {
|
|
807
809
|
for (var n, r = 1, s = arguments.length; r < s; r++) {
|
|
808
810
|
n = arguments[r];
|
|
809
811
|
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
|
|
810
812
|
}
|
|
811
813
|
return t;
|
|
812
|
-
},
|
|
814
|
+
}, Te.apply(this, arguments);
|
|
813
815
|
};
|
|
814
|
-
function
|
|
816
|
+
function _t(e, t) {
|
|
815
817
|
var n = {};
|
|
816
818
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
817
819
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -819,18 +821,18 @@ function At(e, t) {
|
|
|
819
821
|
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (n[r[s]] = e[r[s]]);
|
|
820
822
|
return n;
|
|
821
823
|
}
|
|
822
|
-
function
|
|
824
|
+
function Rt(e, t, n, r) {
|
|
823
825
|
var s = arguments.length, o = s < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, a;
|
|
824
826
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, n, r);
|
|
825
827
|
else for (var d = e.length - 1; d >= 0; d--) (a = e[d]) && (o = (s < 3 ? a(o) : s > 3 ? a(t, n, o) : a(t, n)) || o);
|
|
826
828
|
return s > 3 && o && Object.defineProperty(t, n, o), o;
|
|
827
829
|
}
|
|
828
|
-
function
|
|
830
|
+
function Tt(e, t) {
|
|
829
831
|
return function(n, r) {
|
|
830
832
|
t(n, r, e);
|
|
831
833
|
};
|
|
832
834
|
}
|
|
833
|
-
function
|
|
835
|
+
function Dt(e, t, n, r, s, o) {
|
|
834
836
|
function a(h) {
|
|
835
837
|
if (h !== void 0 && typeof h != "function") throw new TypeError("Function expected");
|
|
836
838
|
return h;
|
|
@@ -852,21 +854,21 @@ function Tt(e, t, n, r, s, o) {
|
|
|
852
854
|
}
|
|
853
855
|
u && Object.defineProperty(u, r.name, c), m = !0;
|
|
854
856
|
}
|
|
855
|
-
function
|
|
857
|
+
function Nt(e, t, n) {
|
|
856
858
|
for (var r = arguments.length > 2, s = 0; s < t.length; s++)
|
|
857
859
|
n = r ? t[s].call(e, n) : t[s].call(e);
|
|
858
860
|
return r ? n : void 0;
|
|
859
861
|
}
|
|
860
|
-
function
|
|
862
|
+
function Ct(e) {
|
|
861
863
|
return typeof e == "symbol" ? e : "".concat(e);
|
|
862
864
|
}
|
|
863
|
-
function
|
|
865
|
+
function xt(e, t, n) {
|
|
864
866
|
return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
|
|
865
867
|
}
|
|
866
|
-
function
|
|
868
|
+
function Pt(e, t) {
|
|
867
869
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
868
870
|
}
|
|
869
|
-
function
|
|
871
|
+
function It(e, t, n, r) {
|
|
870
872
|
function s(o) {
|
|
871
873
|
return o instanceof n ? o : new n(function(a) {
|
|
872
874
|
a(o);
|
|
@@ -893,7 +895,7 @@ function Pt(e, t, n, r) {
|
|
|
893
895
|
u((r = r.apply(e, t || [])).next());
|
|
894
896
|
});
|
|
895
897
|
}
|
|
896
|
-
function
|
|
898
|
+
function jt(e, t) {
|
|
897
899
|
var n = { label: 0, sent: function() {
|
|
898
900
|
if (o[0] & 1) throw o[1];
|
|
899
901
|
return o[1];
|
|
@@ -953,7 +955,7 @@ function It(e, t) {
|
|
|
953
955
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
954
956
|
}
|
|
955
957
|
}
|
|
956
|
-
var
|
|
958
|
+
var Ce = Object.create ? function(e, t, n, r) {
|
|
957
959
|
r === void 0 && (r = n);
|
|
958
960
|
var s = Object.getOwnPropertyDescriptor(t, n);
|
|
959
961
|
(!s || ("get" in s ? !t.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: function() {
|
|
@@ -962,10 +964,10 @@ var Ne = Object.create ? function(e, t, n, r) {
|
|
|
962
964
|
} : function(e, t, n, r) {
|
|
963
965
|
r === void 0 && (r = n), e[r] = t[n];
|
|
964
966
|
};
|
|
965
|
-
function
|
|
966
|
-
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) &&
|
|
967
|
+
function Lt(e, t) {
|
|
968
|
+
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && Ce(t, e, n);
|
|
967
969
|
}
|
|
968
|
-
function
|
|
970
|
+
function De(e) {
|
|
969
971
|
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
|
|
970
972
|
if (n) return n.call(e);
|
|
971
973
|
if (e && typeof e.length == "number") return {
|
|
@@ -975,7 +977,7 @@ function Te(e) {
|
|
|
975
977
|
};
|
|
976
978
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
977
979
|
}
|
|
978
|
-
function
|
|
980
|
+
function $e(e, t) {
|
|
979
981
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
980
982
|
if (!n) return e;
|
|
981
983
|
var r = n.call(e), s, o = [], a;
|
|
@@ -992,19 +994,19 @@ function Ze(e, t) {
|
|
|
992
994
|
}
|
|
993
995
|
return o;
|
|
994
996
|
}
|
|
995
|
-
function
|
|
997
|
+
function kt() {
|
|
996
998
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
997
|
-
e = e.concat(
|
|
999
|
+
e = e.concat($e(arguments[t]));
|
|
998
1000
|
return e;
|
|
999
1001
|
}
|
|
1000
|
-
function
|
|
1002
|
+
function Ft() {
|
|
1001
1003
|
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
|
|
1002
1004
|
for (var r = Array(e), s = 0, t = 0; t < n; t++)
|
|
1003
1005
|
for (var o = arguments[t], a = 0, d = o.length; a < d; a++, s++)
|
|
1004
1006
|
r[s] = o[a];
|
|
1005
1007
|
return r;
|
|
1006
1008
|
}
|
|
1007
|
-
function
|
|
1009
|
+
function Mt(e, t, n) {
|
|
1008
1010
|
if (n || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
|
|
1009
1011
|
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
1010
1012
|
return e.concat(o || Array.prototype.slice.call(t));
|
|
@@ -1012,7 +1014,7 @@ function Ft(e, t, n) {
|
|
|
1012
1014
|
function he(e) {
|
|
1013
1015
|
return this instanceof he ? (this.v = e, this) : new he(e);
|
|
1014
1016
|
}
|
|
1015
|
-
function
|
|
1017
|
+
function Vt(e, t, n) {
|
|
1016
1018
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1017
1019
|
var r = n.apply(e, t || []), s, o = [];
|
|
1018
1020
|
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), d("next"), d("throw"), d("return", a), s[Symbol.asyncIterator] = function() {
|
|
@@ -1050,7 +1052,7 @@ function Mt(e, t, n) {
|
|
|
1050
1052
|
p(y), o.shift(), o.length && g(o[0][0], o[0][1]);
|
|
1051
1053
|
}
|
|
1052
1054
|
}
|
|
1053
|
-
function
|
|
1055
|
+
function Ut(e) {
|
|
1054
1056
|
var t, n;
|
|
1055
1057
|
return t = {}, r("next"), r("throw", function(s) {
|
|
1056
1058
|
throw s;
|
|
@@ -1063,10 +1065,10 @@ function Vt(e) {
|
|
|
1063
1065
|
} : o;
|
|
1064
1066
|
}
|
|
1065
1067
|
}
|
|
1066
|
-
function
|
|
1068
|
+
function Ht(e) {
|
|
1067
1069
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1068
1070
|
var t = e[Symbol.asyncIterator], n;
|
|
1069
|
-
return t ? t.call(e) : (e = typeof
|
|
1071
|
+
return t ? t.call(e) : (e = typeof De == "function" ? De(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
|
|
1070
1072
|
return this;
|
|
1071
1073
|
}, n);
|
|
1072
1074
|
function r(o) {
|
|
@@ -1082,7 +1084,7 @@ function Ut(e) {
|
|
|
1082
1084
|
}, a);
|
|
1083
1085
|
}
|
|
1084
1086
|
}
|
|
1085
|
-
function
|
|
1087
|
+
function Gt(e, t) {
|
|
1086
1088
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1087
1089
|
}
|
|
1088
1090
|
var or = Object.create ? function(e, t) {
|
|
@@ -1090,16 +1092,16 @@ var or = Object.create ? function(e, t) {
|
|
|
1090
1092
|
} : function(e, t) {
|
|
1091
1093
|
e.default = t;
|
|
1092
1094
|
};
|
|
1093
|
-
function
|
|
1095
|
+
function zt(e) {
|
|
1094
1096
|
if (e && e.__esModule) return e;
|
|
1095
1097
|
var t = {};
|
|
1096
|
-
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) &&
|
|
1098
|
+
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && Ce(t, e, n);
|
|
1097
1099
|
return or(t, e), t;
|
|
1098
1100
|
}
|
|
1099
|
-
function
|
|
1101
|
+
function Yt(e) {
|
|
1100
1102
|
return e && e.__esModule ? e : { default: e };
|
|
1101
1103
|
}
|
|
1102
|
-
function
|
|
1104
|
+
function qt(e, t, n, r) {
|
|
1103
1105
|
if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
1104
1106
|
if (typeof t == "function" ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1105
1107
|
return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
|
|
@@ -1110,11 +1112,11 @@ function Bt(e, t, n, r, s) {
|
|
|
1110
1112
|
if (typeof t == "function" ? e !== t || !s : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1111
1113
|
return r === "a" ? s.call(e, n) : s ? s.value = n : t.set(e, n), n;
|
|
1112
1114
|
}
|
|
1113
|
-
function
|
|
1115
|
+
function Xt(e, t) {
|
|
1114
1116
|
if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1115
1117
|
return typeof e == "function" ? t === e : e.has(t);
|
|
1116
1118
|
}
|
|
1117
|
-
function
|
|
1119
|
+
function Qt(e, t, n) {
|
|
1118
1120
|
if (t != null) {
|
|
1119
1121
|
if (typeof t != "object" && typeof t != "function") throw new TypeError("Object expected.");
|
|
1120
1122
|
var r, s;
|
|
@@ -1141,7 +1143,7 @@ var ar = typeof SuppressedError == "function" ? SuppressedError : function(e, t,
|
|
|
1141
1143
|
var r = new Error(n);
|
|
1142
1144
|
return r.name = "SuppressedError", r.error = e, r.suppressed = t, r;
|
|
1143
1145
|
};
|
|
1144
|
-
function
|
|
1146
|
+
function Wt(e) {
|
|
1145
1147
|
function t(o) {
|
|
1146
1148
|
e.error = e.hasError ? new ar(o, e.error, "An error was suppressed during disposal.") : o, e.hasError = !0;
|
|
1147
1149
|
}
|
|
@@ -1164,86 +1166,86 @@ function Qt(e) {
|
|
|
1164
1166
|
}
|
|
1165
1167
|
return s();
|
|
1166
1168
|
}
|
|
1167
|
-
function
|
|
1169
|
+
function Kt(e, t) {
|
|
1168
1170
|
return typeof e == "string" && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(n, r, s, o, a) {
|
|
1169
1171
|
return r ? t ? ".jsx" : ".js" : s && (!o || !a) ? n : s + o + "." + a.toLowerCase() + "js";
|
|
1170
1172
|
}) : e;
|
|
1171
1173
|
}
|
|
1172
1174
|
const ir = {
|
|
1173
|
-
__extends:
|
|
1174
|
-
__assign:
|
|
1175
|
-
__rest:
|
|
1176
|
-
__decorate:
|
|
1177
|
-
__param:
|
|
1178
|
-
__esDecorate:
|
|
1179
|
-
__runInitializers:
|
|
1180
|
-
__propKey:
|
|
1181
|
-
__setFunctionName:
|
|
1182
|
-
__metadata:
|
|
1183
|
-
__awaiter:
|
|
1184
|
-
__generator:
|
|
1185
|
-
__createBinding:
|
|
1186
|
-
__exportStar:
|
|
1187
|
-
__values:
|
|
1188
|
-
__read:
|
|
1189
|
-
__spread:
|
|
1190
|
-
__spreadArrays:
|
|
1191
|
-
__spreadArray:
|
|
1175
|
+
__extends: At,
|
|
1176
|
+
__assign: Te,
|
|
1177
|
+
__rest: _t,
|
|
1178
|
+
__decorate: Rt,
|
|
1179
|
+
__param: Tt,
|
|
1180
|
+
__esDecorate: Dt,
|
|
1181
|
+
__runInitializers: Nt,
|
|
1182
|
+
__propKey: Ct,
|
|
1183
|
+
__setFunctionName: xt,
|
|
1184
|
+
__metadata: Pt,
|
|
1185
|
+
__awaiter: It,
|
|
1186
|
+
__generator: jt,
|
|
1187
|
+
__createBinding: Ce,
|
|
1188
|
+
__exportStar: Lt,
|
|
1189
|
+
__values: De,
|
|
1190
|
+
__read: $e,
|
|
1191
|
+
__spread: kt,
|
|
1192
|
+
__spreadArrays: Ft,
|
|
1193
|
+
__spreadArray: Mt,
|
|
1192
1194
|
__await: he,
|
|
1193
|
-
__asyncGenerator:
|
|
1194
|
-
__asyncDelegator:
|
|
1195
|
-
__asyncValues:
|
|
1196
|
-
__makeTemplateObject:
|
|
1197
|
-
__importStar:
|
|
1198
|
-
__importDefault:
|
|
1199
|
-
__classPrivateFieldGet:
|
|
1195
|
+
__asyncGenerator: Vt,
|
|
1196
|
+
__asyncDelegator: Ut,
|
|
1197
|
+
__asyncValues: Ht,
|
|
1198
|
+
__makeTemplateObject: Gt,
|
|
1199
|
+
__importStar: zt,
|
|
1200
|
+
__importDefault: Yt,
|
|
1201
|
+
__classPrivateFieldGet: qt,
|
|
1200
1202
|
__classPrivateFieldSet: Bt,
|
|
1201
|
-
__classPrivateFieldIn:
|
|
1202
|
-
__addDisposableResource:
|
|
1203
|
-
__disposeResources:
|
|
1204
|
-
__rewriteRelativeImportExtension:
|
|
1203
|
+
__classPrivateFieldIn: Xt,
|
|
1204
|
+
__addDisposableResource: Qt,
|
|
1205
|
+
__disposeResources: Wt,
|
|
1206
|
+
__rewriteRelativeImportExtension: Kt
|
|
1205
1207
|
}, cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1206
1208
|
__proto__: null,
|
|
1207
|
-
__addDisposableResource:
|
|
1209
|
+
__addDisposableResource: Qt,
|
|
1208
1210
|
get __assign() {
|
|
1209
|
-
return
|
|
1211
|
+
return Te;
|
|
1210
1212
|
},
|
|
1211
|
-
__asyncDelegator:
|
|
1212
|
-
__asyncGenerator:
|
|
1213
|
-
__asyncValues:
|
|
1213
|
+
__asyncDelegator: Ut,
|
|
1214
|
+
__asyncGenerator: Vt,
|
|
1215
|
+
__asyncValues: Ht,
|
|
1214
1216
|
__await: he,
|
|
1215
|
-
__awaiter:
|
|
1216
|
-
__classPrivateFieldGet:
|
|
1217
|
-
__classPrivateFieldIn:
|
|
1217
|
+
__awaiter: It,
|
|
1218
|
+
__classPrivateFieldGet: qt,
|
|
1219
|
+
__classPrivateFieldIn: Xt,
|
|
1218
1220
|
__classPrivateFieldSet: Bt,
|
|
1219
|
-
__createBinding:
|
|
1220
|
-
__decorate:
|
|
1221
|
-
__disposeResources:
|
|
1222
|
-
__esDecorate:
|
|
1223
|
-
__exportStar:
|
|
1224
|
-
__extends:
|
|
1225
|
-
__generator:
|
|
1226
|
-
__importDefault:
|
|
1227
|
-
__importStar:
|
|
1228
|
-
__makeTemplateObject:
|
|
1229
|
-
__metadata:
|
|
1230
|
-
__param:
|
|
1231
|
-
__propKey:
|
|
1232
|
-
__read:
|
|
1233
|
-
__rest:
|
|
1234
|
-
__rewriteRelativeImportExtension:
|
|
1235
|
-
__runInitializers:
|
|
1236
|
-
__setFunctionName:
|
|
1237
|
-
__spread:
|
|
1238
|
-
__spreadArray:
|
|
1239
|
-
__spreadArrays:
|
|
1240
|
-
__values:
|
|
1221
|
+
__createBinding: Ce,
|
|
1222
|
+
__decorate: Rt,
|
|
1223
|
+
__disposeResources: Wt,
|
|
1224
|
+
__esDecorate: Dt,
|
|
1225
|
+
__exportStar: Lt,
|
|
1226
|
+
__extends: At,
|
|
1227
|
+
__generator: jt,
|
|
1228
|
+
__importDefault: Yt,
|
|
1229
|
+
__importStar: zt,
|
|
1230
|
+
__makeTemplateObject: Gt,
|
|
1231
|
+
__metadata: Pt,
|
|
1232
|
+
__param: Tt,
|
|
1233
|
+
__propKey: Ct,
|
|
1234
|
+
__read: $e,
|
|
1235
|
+
__rest: _t,
|
|
1236
|
+
__rewriteRelativeImportExtension: Kt,
|
|
1237
|
+
__runInitializers: Nt,
|
|
1238
|
+
__setFunctionName: xt,
|
|
1239
|
+
__spread: kt,
|
|
1240
|
+
__spreadArray: Mt,
|
|
1241
|
+
__spreadArrays: Ft,
|
|
1242
|
+
__values: De,
|
|
1241
1243
|
default: ir
|
|
1242
1244
|
}, Symbol.toStringTag, { value: "Module" })), ur = /* @__PURE__ */ sr(cr);
|
|
1243
|
-
var
|
|
1245
|
+
var Ae = {}, ut;
|
|
1244
1246
|
function lr() {
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1247
|
+
if (ut) return Ae;
|
|
1248
|
+
ut = 1, Object.defineProperty(Ae, "__esModule", { value: !0 });
|
|
1247
1249
|
var e = fe;
|
|
1248
1250
|
function t() {
|
|
1249
1251
|
var n = e.useRef(!1), r = e.useCallback(function() {
|
|
@@ -1255,18 +1257,18 @@ function lr() {
|
|
|
1255
1257
|
};
|
|
1256
1258
|
}, []), r;
|
|
1257
1259
|
}
|
|
1258
|
-
return
|
|
1260
|
+
return Ae.default = t, Ae;
|
|
1259
1261
|
}
|
|
1260
|
-
Object.defineProperty(
|
|
1261
|
-
var
|
|
1262
|
+
Object.defineProperty(Ot, "__esModule", { value: !0 });
|
|
1263
|
+
var Ye = ur, Le = fe, dr = Ye.__importDefault(lr());
|
|
1262
1264
|
function fr(e, t, n) {
|
|
1263
1265
|
t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
|
|
1264
|
-
var r =
|
|
1266
|
+
var r = Le.useRef(0), s = dr.default(), o = Le.useState(n), a = o[0], d = o[1], g = Le.useCallback(function() {
|
|
1265
1267
|
for (var u = [], c = 0; c < arguments.length; c++)
|
|
1266
1268
|
u[c] = arguments[c];
|
|
1267
1269
|
var i = ++r.current;
|
|
1268
1270
|
return a.loading || d(function(m) {
|
|
1269
|
-
return
|
|
1271
|
+
return Ye.__assign(Ye.__assign({}, m), { loading: !0 });
|
|
1270
1272
|
}), e.apply(void 0, u).then(function(m) {
|
|
1271
1273
|
return s() && i === r.current && d({ value: m, loading: !1 }), m;
|
|
1272
1274
|
}, function(m) {
|
|
@@ -1275,14 +1277,20 @@ function fr(e, t, n) {
|
|
|
1275
1277
|
}, t);
|
|
1276
1278
|
return [a, g];
|
|
1277
1279
|
}
|
|
1278
|
-
var
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1281
|
-
|
|
1280
|
+
var ie = Ot.default = fr;
|
|
1281
|
+
const pr = (e = 20) => {
|
|
1282
|
+
const t = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
1283
|
+
let n = "";
|
|
1284
|
+
for (let r = 0; r < e; r++)
|
|
1285
|
+
n += t[Math.floor(Math.random() * t.length)];
|
|
1286
|
+
return n;
|
|
1287
|
+
}, oe = /* @__PURE__ */ new Map();
|
|
1288
|
+
function Os() {
|
|
1289
|
+
const [e, t] = Je([]), { http: n } = le();
|
|
1282
1290
|
function r(c) {
|
|
1283
1291
|
const i = c.map((m) => ({
|
|
1284
1292
|
file: m,
|
|
1285
|
-
id:
|
|
1293
|
+
id: pr(10),
|
|
1286
1294
|
status: "pending",
|
|
1287
1295
|
progress: 0
|
|
1288
1296
|
}));
|
|
@@ -1298,7 +1306,7 @@ function ws() {
|
|
|
1298
1306
|
}
|
|
1299
1307
|
const a = async (c) => {
|
|
1300
1308
|
const i = new AbortController();
|
|
1301
|
-
|
|
1309
|
+
oe.set(c.id, i);
|
|
1302
1310
|
try {
|
|
1303
1311
|
t(
|
|
1304
1312
|
(p) => p.map(
|
|
@@ -1327,17 +1335,17 @@ function ws() {
|
|
|
1327
1335
|
progress: 0
|
|
1328
1336
|
});
|
|
1329
1337
|
} finally {
|
|
1330
|
-
|
|
1338
|
+
oe.delete(c.id);
|
|
1331
1339
|
}
|
|
1332
1340
|
}, d = (c) => {
|
|
1333
|
-
const i =
|
|
1334
|
-
i && (i.abort(),
|
|
1335
|
-
}, g =
|
|
1341
|
+
const i = oe.get(c);
|
|
1342
|
+
i && (i.abort(), oe.delete(c)), o(c);
|
|
1343
|
+
}, g = ne(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
|
|
1336
1344
|
function u() {
|
|
1337
|
-
|
|
1345
|
+
oe.forEach((c) => c.abort()), oe.clear(), t([]);
|
|
1338
1346
|
}
|
|
1339
1347
|
return de(() => () => {
|
|
1340
|
-
|
|
1348
|
+
oe.forEach((c) => c.abort()), oe.clear();
|
|
1341
1349
|
}, []), {
|
|
1342
1350
|
allFiles: e,
|
|
1343
1351
|
appendFiles: r,
|
|
@@ -1357,14 +1365,14 @@ function ws() {
|
|
|
1357
1365
|
isUploading: e.some((c) => c.status === "uploading")
|
|
1358
1366
|
};
|
|
1359
1367
|
}
|
|
1360
|
-
var
|
|
1361
|
-
const
|
|
1368
|
+
var xe = /* @__PURE__ */ ((e) => (e[e.OPEN = 0] = "OPEN", e[e.CLOSED_RESOLVED = 1] = "CLOSED_RESOLVED", e[e.CLOSED_UNRESOLVED = 2] = "CLOSED_UNRESOLVED", e))(xe || {}), Jt = /* @__PURE__ */ ((e) => (e.WEB = "web", e.WEB_VOICE = "web_voice", e.PHONE_VOICE = "phone_voice", e.EMAIL = "email", e.SMS = "sms", e.WHATSAPP = "whatsapp", e.API = "api", e))(Jt || {}), et = /* @__PURE__ */ ((e) => (e.resolved = "resolved", e.assumed_resolved = "assumed_resolved", e.handed_off = "handed_off", e))(et || {}), Zt = /* @__PURE__ */ ((e) => (e.happy = "happy", e.neutral = "neutral", e.angry = "angry", e))(Zt || {}), $t = /* @__PURE__ */ ((e) => (e.MESSAGE = "message", e.HANDOFF = "handoff", e.HANDOFF_TO_ZENDESK = "handoff_to_zendesk", e.AGENT_MESSAGE = "agent_message", e.AGENT_JOINED = "agent_joined", e.AGENT_TOOK_SESSION_FROM_AI = "agent_took_session_from_ai", e.AI_DECIDED_TO_RESOLVE_THE_ISSUE = "ai_decided_to_resolve_the_issue", e.EMAIL_DRAFT_MESSAGE = "email_draft_message", e.FOLLOWUP = "followup", e))($t || {});
|
|
1369
|
+
const gr = l.object({
|
|
1362
1370
|
id: l.string(),
|
|
1363
|
-
ai_closure_type: l.nativeEnum(
|
|
1371
|
+
ai_closure_type: l.nativeEnum(et).nullable(),
|
|
1364
1372
|
assignee_id: l.number().nullable(),
|
|
1365
|
-
channel: l.nativeEnum(
|
|
1373
|
+
channel: l.nativeEnum(Jt),
|
|
1366
1374
|
summary: l.string().nullable(),
|
|
1367
|
-
status: l.nativeEnum(
|
|
1375
|
+
status: l.nativeEnum(xe),
|
|
1368
1376
|
language: l.string().nullable(),
|
|
1369
1377
|
last_message: l.string().nullable(),
|
|
1370
1378
|
last_message_at: l.date().nullable(),
|
|
@@ -1373,7 +1381,7 @@ const pr = l.object({
|
|
|
1373
1381
|
email: l.string(),
|
|
1374
1382
|
avatar_url: l.string().optional()
|
|
1375
1383
|
}).nullable().optional(),
|
|
1376
|
-
sentiment: l.nativeEnum(
|
|
1384
|
+
sentiment: l.nativeEnum(Zt).nullable()
|
|
1377
1385
|
});
|
|
1378
1386
|
l.object({
|
|
1379
1387
|
publicId: l.string().uuid(),
|
|
@@ -1387,25 +1395,25 @@ l.object({
|
|
|
1387
1395
|
handoff_happened_during_office_hours: l.boolean().nullable(),
|
|
1388
1396
|
session_id: l.string(),
|
|
1389
1397
|
updated_at: l.string().nullable(),
|
|
1390
|
-
attachments: l.array(
|
|
1398
|
+
attachments: l.array(vt).optional()
|
|
1391
1399
|
});
|
|
1392
|
-
const
|
|
1400
|
+
const mr = l.object({
|
|
1393
1401
|
name: l.string(),
|
|
1394
1402
|
is_ai: l.boolean(),
|
|
1395
1403
|
profile_picture: l.string().optional().nullable(),
|
|
1396
1404
|
id: l.string().nullable()
|
|
1397
|
-
}),
|
|
1405
|
+
}), hr = l.object({
|
|
1398
1406
|
type: l.literal("message"),
|
|
1399
1407
|
value: l.string(),
|
|
1400
|
-
attachments: l.array(
|
|
1408
|
+
attachments: l.array(vt).optional(),
|
|
1401
1409
|
is_stream_chunk: l.boolean().optional(),
|
|
1402
1410
|
server_session_id: l.string(),
|
|
1403
1411
|
client_message_id: l.string().optional(),
|
|
1404
1412
|
server_message_id: l.string()
|
|
1405
|
-
}),
|
|
1413
|
+
}), yr = l.object({
|
|
1406
1414
|
type: l.literal("info"),
|
|
1407
1415
|
value: l.string()
|
|
1408
|
-
}),
|
|
1416
|
+
}), Sr = l.object({
|
|
1409
1417
|
type: l.literal("ui"),
|
|
1410
1418
|
value: l.object({
|
|
1411
1419
|
type: l.string(),
|
|
@@ -1416,36 +1424,36 @@ const gr = l.object({
|
|
|
1416
1424
|
}),
|
|
1417
1425
|
client_message_id: l.string().optional(),
|
|
1418
1426
|
server_session_id: l.string()
|
|
1419
|
-
}),
|
|
1427
|
+
}), vr = l.object({
|
|
1420
1428
|
type: l.literal("chat_event"),
|
|
1421
1429
|
value: l.object({
|
|
1422
|
-
event: l.nativeEnum(
|
|
1430
|
+
event: l.nativeEnum($t),
|
|
1423
1431
|
message: l.string()
|
|
1424
1432
|
})
|
|
1425
|
-
}),
|
|
1433
|
+
}), Er = l.object({
|
|
1426
1434
|
type: l.literal("options"),
|
|
1427
1435
|
value: l.object({
|
|
1428
1436
|
options: l.array(l.string())
|
|
1429
1437
|
}),
|
|
1430
1438
|
server_session_id: l.string()
|
|
1431
|
-
}),
|
|
1439
|
+
}), br = l.object({
|
|
1432
1440
|
type: l.literal("session_update"),
|
|
1433
1441
|
value: l.object({
|
|
1434
|
-
session:
|
|
1442
|
+
session: gr
|
|
1435
1443
|
}),
|
|
1436
1444
|
server_session_id: l.string()
|
|
1437
1445
|
});
|
|
1438
1446
|
l.discriminatedUnion("type", [
|
|
1439
|
-
mr,
|
|
1440
1447
|
hr,
|
|
1441
1448
|
yr,
|
|
1442
1449
|
Sr,
|
|
1443
1450
|
vr,
|
|
1444
|
-
Er
|
|
1451
|
+
Er,
|
|
1452
|
+
br
|
|
1445
1453
|
]).and(
|
|
1446
1454
|
l.object({
|
|
1447
1455
|
timestamp: l.string(),
|
|
1448
|
-
agent:
|
|
1456
|
+
agent: mr
|
|
1449
1457
|
})
|
|
1450
1458
|
);
|
|
1451
1459
|
l.object({
|
|
@@ -1455,7 +1463,7 @@ l.object({
|
|
|
1455
1463
|
avatar_url: l.string().nullable(),
|
|
1456
1464
|
email: l.string().nullable()
|
|
1457
1465
|
});
|
|
1458
|
-
function
|
|
1466
|
+
function lt(e) {
|
|
1459
1467
|
var n, r, s;
|
|
1460
1468
|
const t = [];
|
|
1461
1469
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -1464,7 +1472,7 @@ function ut(e) {
|
|
|
1464
1472
|
a.message && a.message.length > 0 && t.push({
|
|
1465
1473
|
type: "FROM_USER",
|
|
1466
1474
|
content: a.message,
|
|
1467
|
-
id: a.publicId
|
|
1475
|
+
id: a.publicId,
|
|
1468
1476
|
deliveredAt: a.created_at || "",
|
|
1469
1477
|
attachments: a.attachments,
|
|
1470
1478
|
timestamp: a.created_at || ""
|
|
@@ -1478,7 +1486,7 @@ function ut(e) {
|
|
|
1478
1486
|
data: {
|
|
1479
1487
|
message: a.message ?? ""
|
|
1480
1488
|
},
|
|
1481
|
-
id: a.publicId
|
|
1489
|
+
id: a.publicId,
|
|
1482
1490
|
timestamp: a.created_at || "",
|
|
1483
1491
|
original: a,
|
|
1484
1492
|
attachments: a.attachments,
|
|
@@ -1497,7 +1505,7 @@ function ut(e) {
|
|
|
1497
1505
|
data: {
|
|
1498
1506
|
message: a.message ?? ""
|
|
1499
1507
|
},
|
|
1500
|
-
id: a.publicId
|
|
1508
|
+
id: a.publicId,
|
|
1501
1509
|
timestamp: a.created_at || "",
|
|
1502
1510
|
original: a,
|
|
1503
1511
|
attachments: a.attachments,
|
|
@@ -1517,7 +1525,7 @@ function ut(e) {
|
|
|
1517
1525
|
event: a.type,
|
|
1518
1526
|
message: a.message ?? ""
|
|
1519
1527
|
},
|
|
1520
|
-
id: a.publicId ||
|
|
1528
|
+
id: a.publicId || ve(),
|
|
1521
1529
|
original: a,
|
|
1522
1530
|
attachments: a.attachments,
|
|
1523
1531
|
timestamp: a.created_at || "",
|
|
@@ -1532,8 +1540,8 @@ function ut(e) {
|
|
|
1532
1540
|
}
|
|
1533
1541
|
return t;
|
|
1534
1542
|
}
|
|
1535
|
-
function
|
|
1536
|
-
const t =
|
|
1543
|
+
function wr(e) {
|
|
1544
|
+
const t = ae(null);
|
|
1537
1545
|
return de(() => {
|
|
1538
1546
|
if (!t.current) {
|
|
1539
1547
|
const n = new Audio(e.src);
|
|
@@ -1554,18 +1562,18 @@ function br(e) {
|
|
|
1554
1562
|
}
|
|
1555
1563
|
};
|
|
1556
1564
|
}
|
|
1557
|
-
function
|
|
1558
|
-
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } =
|
|
1565
|
+
function Or() {
|
|
1566
|
+
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = le(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
|
|
1559
1567
|
return {
|
|
1560
|
-
messageArrivedSound:
|
|
1568
|
+
messageArrivedSound: wr({
|
|
1561
1569
|
src: e.messageArrived,
|
|
1562
1570
|
soundEnabled: r,
|
|
1563
1571
|
volume: 0.5
|
|
1564
1572
|
})
|
|
1565
1573
|
};
|
|
1566
1574
|
}
|
|
1567
|
-
const
|
|
1568
|
-
function
|
|
1575
|
+
const Ar = 5e3;
|
|
1576
|
+
function _r(e, t) {
|
|
1569
1577
|
return mn(e, (n) => {
|
|
1570
1578
|
const r = () => {
|
|
1571
1579
|
n.lastUpdated = Date.now();
|
|
@@ -1615,27 +1623,27 @@ function Ar(e, t) {
|
|
|
1615
1623
|
}
|
|
1616
1624
|
});
|
|
1617
1625
|
}
|
|
1618
|
-
function
|
|
1626
|
+
function Rr({
|
|
1619
1627
|
persist: e,
|
|
1620
1628
|
sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
|
|
1621
1629
|
}) {
|
|
1622
|
-
const { botToken: n, http: r, user: s } =
|
|
1630
|
+
const { botToken: n, http: r, user: s } = le(), [o, a, d] = Ze(
|
|
1623
1631
|
t(n, s),
|
|
1624
1632
|
void 0,
|
|
1625
1633
|
e ? "local" : "memory"
|
|
1626
1634
|
), g = (f) => ({
|
|
1627
1635
|
...f,
|
|
1628
|
-
isSessionClosed: f.status !==
|
|
1636
|
+
isSessionClosed: f.status !== xe.OPEN,
|
|
1629
1637
|
isAssignedToAi: f.assignee_id === 555,
|
|
1630
1638
|
isAssignedToHuman: f.assignee_id !== 555,
|
|
1631
|
-
isPendingHuman: f.assignee_id === 555 && f.ai_closure_type ===
|
|
1632
|
-
}), u =
|
|
1639
|
+
isPendingHuman: f.assignee_id === 555 && f.ai_closure_type === et.handed_off
|
|
1640
|
+
}), u = ne(() => o ? g(o) : null, [o]), [c, i] = ie(
|
|
1633
1641
|
async (f) => {
|
|
1634
1642
|
let v = await r.apis.fetchSession(f);
|
|
1635
1643
|
return v.data && a(v.data), v.data;
|
|
1636
1644
|
},
|
|
1637
1645
|
[r, a]
|
|
1638
|
-
), [m, p] =
|
|
1646
|
+
), [m, p] = ie(
|
|
1639
1647
|
async (f) => {
|
|
1640
1648
|
try {
|
|
1641
1649
|
const v = await i(f);
|
|
@@ -1659,45 +1667,45 @@ function _r({
|
|
|
1659
1667
|
pollSession: p
|
|
1660
1668
|
};
|
|
1661
1669
|
}
|
|
1662
|
-
function
|
|
1663
|
-
const [t, n] = fn(
|
|
1670
|
+
function Tr({ onSessionDestroy: e }) {
|
|
1671
|
+
const [t, n] = fn(_r, {
|
|
1664
1672
|
lastUpdated: null,
|
|
1665
1673
|
messages: [],
|
|
1666
1674
|
keyboard: null
|
|
1667
|
-
}), [r, s] =
|
|
1675
|
+
}), [r, s] = Je({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: d, widgetSettings: g, defaultSettings: u, language: c, ...i } = le(), { messageArrivedSound: m } = Or(), p = (g == null ? void 0 : g.persistSession) || u.persistSession, { refreshSession: y, session: f, deleteSession: v, setSession: h, pollSession: B } = Rr({
|
|
1668
1676
|
persist: p
|
|
1669
|
-
}), [
|
|
1670
|
-
async (
|
|
1677
|
+
}), [T, S] = ie(
|
|
1678
|
+
async (A) => {
|
|
1671
1679
|
if (!f) return [];
|
|
1672
1680
|
try {
|
|
1673
|
-
const { data: N } = await d.apis.fetchHistory(
|
|
1674
|
-
return N ? Array.isArray(N) ?
|
|
1681
|
+
const { data: N } = await d.apis.fetchHistory(A);
|
|
1682
|
+
return N ? Array.isArray(N) ? lt(N) : [] : [];
|
|
1675
1683
|
} catch (N) {
|
|
1676
1684
|
throw console.error("Error fetching history:", N), N;
|
|
1677
1685
|
}
|
|
1678
1686
|
},
|
|
1679
1687
|
[f, d.apis]
|
|
1680
|
-
), [
|
|
1681
|
-
async (
|
|
1688
|
+
), [w, E] = ie(
|
|
1689
|
+
async (A, N) => {
|
|
1682
1690
|
try {
|
|
1683
1691
|
const M = await d.apis.getHistoryPooling({
|
|
1684
|
-
sessionId:
|
|
1692
|
+
sessionId: A,
|
|
1685
1693
|
lastMessageTimestamp: N
|
|
1686
1694
|
});
|
|
1687
1695
|
if (M.data) {
|
|
1688
|
-
const
|
|
1689
|
-
if (
|
|
1696
|
+
const U = lt(M.data);
|
|
1697
|
+
if (U.length > 0) {
|
|
1690
1698
|
n({
|
|
1691
1699
|
type: "APPEND_MESSAGES",
|
|
1692
|
-
payload:
|
|
1700
|
+
payload: U
|
|
1693
1701
|
});
|
|
1694
1702
|
try {
|
|
1695
1703
|
m.play();
|
|
1696
|
-
} catch (
|
|
1697
|
-
console.error("Error playing sound:",
|
|
1704
|
+
} catch (G) {
|
|
1705
|
+
console.error("Error playing sound:", G);
|
|
1698
1706
|
}
|
|
1699
1707
|
}
|
|
1700
|
-
return
|
|
1708
|
+
return U;
|
|
1701
1709
|
}
|
|
1702
1710
|
return [];
|
|
1703
1711
|
} catch (M) {
|
|
@@ -1707,88 +1715,136 @@ function Rr({ onSessionDestroy: e }) {
|
|
|
1707
1715
|
[d.apis, n, m]
|
|
1708
1716
|
);
|
|
1709
1717
|
de(() => {
|
|
1710
|
-
let
|
|
1711
|
-
return f && (
|
|
1718
|
+
let A;
|
|
1719
|
+
return f && (A = setInterval(() => {
|
|
1712
1720
|
var M;
|
|
1713
1721
|
B(f.id);
|
|
1714
1722
|
const N = (M = t.messages.at(-1)) == null ? void 0 : M.timestamp;
|
|
1715
1723
|
N && E(f.id, N);
|
|
1716
|
-
},
|
|
1717
|
-
clearInterval(
|
|
1724
|
+
}, Ar)), () => {
|
|
1725
|
+
clearInterval(A);
|
|
1718
1726
|
};
|
|
1719
1727
|
}, [f, B, E]);
|
|
1720
|
-
const [F,
|
|
1728
|
+
const [F, O] = ie(
|
|
1721
1729
|
async () => {
|
|
1722
1730
|
if (f)
|
|
1723
1731
|
try {
|
|
1724
|
-
const
|
|
1725
|
-
if (
|
|
1726
|
-
const N = await S(
|
|
1732
|
+
const A = await y(f.id);
|
|
1733
|
+
if (A) {
|
|
1734
|
+
const N = await S(A.id);
|
|
1727
1735
|
N && n({ type: "PREPEND_HISTORY", payload: N });
|
|
1728
1736
|
}
|
|
1729
|
-
} catch (
|
|
1730
|
-
throw console.error("Error initializing session:",
|
|
1737
|
+
} catch (A) {
|
|
1738
|
+
throw console.error("Error initializing session:", A), A;
|
|
1731
1739
|
}
|
|
1732
1740
|
},
|
|
1733
1741
|
[f, y, S, n]
|
|
1734
1742
|
);
|
|
1735
1743
|
de(() => {
|
|
1736
|
-
|
|
1744
|
+
O();
|
|
1737
1745
|
}, []);
|
|
1738
|
-
const [x, P] =
|
|
1746
|
+
const [x, P] = ie(
|
|
1739
1747
|
async () => {
|
|
1740
1748
|
try {
|
|
1741
1749
|
v(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
|
|
1742
|
-
} catch (
|
|
1743
|
-
throw console.error("Error clearing session:",
|
|
1750
|
+
} catch (A) {
|
|
1751
|
+
throw console.error("Error clearing session:", A), A;
|
|
1744
1752
|
}
|
|
1745
1753
|
},
|
|
1746
1754
|
[v, n, e, s]
|
|
1747
|
-
), [
|
|
1755
|
+
), [X, K] = ie(
|
|
1748
1756
|
async () => {
|
|
1749
1757
|
try {
|
|
1750
1758
|
await P();
|
|
1751
|
-
const { data:
|
|
1752
|
-
return h(
|
|
1753
|
-
} catch (
|
|
1754
|
-
throw console.error("Error recreating session:",
|
|
1759
|
+
const { data: A } = await d.apis.createSession(a);
|
|
1760
|
+
return h(A), A;
|
|
1761
|
+
} catch (A) {
|
|
1762
|
+
throw console.error("Error recreating session:", A), A;
|
|
1755
1763
|
}
|
|
1756
1764
|
},
|
|
1757
1765
|
[P, d.apis, a, h]
|
|
1758
|
-
), L = async ({ content:
|
|
1759
|
-
var le;
|
|
1766
|
+
), L = async ({ content: A, user: N, attachments: M, ...U }) => {
|
|
1760
1767
|
try {
|
|
1761
|
-
let
|
|
1768
|
+
let G = function() {
|
|
1769
|
+
var D;
|
|
1770
|
+
if (se.data.success) {
|
|
1771
|
+
const q = se.data;
|
|
1772
|
+
if (q.uiResponse) {
|
|
1773
|
+
const Oe = q.uiResponse.value;
|
|
1774
|
+
n({
|
|
1775
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1776
|
+
payload: {
|
|
1777
|
+
type: "FROM_BOT",
|
|
1778
|
+
id: ve(),
|
|
1779
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1780
|
+
component: Oe.name,
|
|
1781
|
+
data: Oe.request_response
|
|
1782
|
+
}
|
|
1783
|
+
});
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
if (q.autopilotResponse) {
|
|
1787
|
+
n({
|
|
1788
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1789
|
+
payload: {
|
|
1790
|
+
type: "FROM_BOT",
|
|
1791
|
+
id: q.autopilotResponse.id || ve(),
|
|
1792
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1793
|
+
component: "TEXT",
|
|
1794
|
+
data: {
|
|
1795
|
+
message: q.autopilotResponse.value.content
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
});
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
} else {
|
|
1802
|
+
const q = ((D = se.data.error) == null ? void 0 : D.message) || "Unknown error occurred";
|
|
1803
|
+
n({
|
|
1804
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1805
|
+
payload: {
|
|
1806
|
+
type: "FROM_BOT",
|
|
1807
|
+
id: ve(),
|
|
1808
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1809
|
+
component: "TEXT",
|
|
1810
|
+
data: {
|
|
1811
|
+
message: q,
|
|
1812
|
+
variant: "error"
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
}), s({ state: "error", error: q });
|
|
1816
|
+
}
|
|
1817
|
+
}, z = f, J = !1;
|
|
1762
1818
|
if ((!f || f != null && f.isAssignedToAi) && s({ state: "loading" }), !f && o)
|
|
1763
1819
|
try {
|
|
1764
|
-
const { data:
|
|
1765
|
-
if (
|
|
1766
|
-
h(
|
|
1767
|
-
...
|
|
1768
|
-
isSessionClosed:
|
|
1769
|
-
isAssignedToAi:
|
|
1820
|
+
const { data: D } = await d.apis.createSession(a);
|
|
1821
|
+
if (D)
|
|
1822
|
+
h(D), z = {
|
|
1823
|
+
...D,
|
|
1824
|
+
isSessionClosed: D.status !== xe.OPEN,
|
|
1825
|
+
isAssignedToAi: D.assignee_id === 555,
|
|
1770
1826
|
isAssignedToHuman: !1,
|
|
1771
1827
|
isPendingHuman: !1
|
|
1772
|
-
},
|
|
1828
|
+
}, J = !0;
|
|
1773
1829
|
else
|
|
1774
1830
|
throw new Error("Failed to create new chat session");
|
|
1775
|
-
} catch (
|
|
1831
|
+
} catch (D) {
|
|
1776
1832
|
throw s({
|
|
1777
1833
|
state: "error",
|
|
1778
|
-
error:
|
|
1779
|
-
}),
|
|
1834
|
+
error: D instanceof Error ? D.message : "Failed to create session"
|
|
1835
|
+
}), D;
|
|
1780
1836
|
}
|
|
1781
|
-
if (!
|
|
1782
|
-
const
|
|
1783
|
-
throw s({ state: "error", error:
|
|
1837
|
+
if (!z) {
|
|
1838
|
+
const D = new Error("No active session available");
|
|
1839
|
+
throw s({ state: "error", error: D.message }), D;
|
|
1784
1840
|
}
|
|
1785
|
-
const Y =
|
|
1841
|
+
const Y = ve(), { headers: pe, queryParams: we } = i;
|
|
1786
1842
|
if (n({
|
|
1787
1843
|
type: "APPEND_USER_MESSAGE",
|
|
1788
1844
|
payload: {
|
|
1789
1845
|
type: "FROM_USER",
|
|
1790
1846
|
id: Y,
|
|
1791
|
-
content:
|
|
1847
|
+
content: A.text,
|
|
1792
1848
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1793
1849
|
user: {
|
|
1794
1850
|
...i.user,
|
|
@@ -1800,17 +1856,17 @@ function Rr({ onSessionDestroy: e }) {
|
|
|
1800
1856
|
}), t.keyboard && n({
|
|
1801
1857
|
type: "SET_KEYBOARD",
|
|
1802
1858
|
payload: null
|
|
1803
|
-
}), !
|
|
1859
|
+
}), !J && z.isAssignedToAi)
|
|
1804
1860
|
try {
|
|
1805
|
-
const
|
|
1806
|
-
|
|
1807
|
-
} catch (
|
|
1808
|
-
console.error("Error polling session:",
|
|
1861
|
+
const D = await B(z.id);
|
|
1862
|
+
D && (z = D);
|
|
1863
|
+
} catch (D) {
|
|
1864
|
+
console.error("Error polling session:", D);
|
|
1809
1865
|
}
|
|
1810
|
-
const
|
|
1866
|
+
const se = await d.apis.sendMessage({
|
|
1811
1867
|
id: Y,
|
|
1812
|
-
content:
|
|
1813
|
-
session_id:
|
|
1868
|
+
content: A.text,
|
|
1869
|
+
session_id: z.id,
|
|
1814
1870
|
bot_token: a,
|
|
1815
1871
|
headers: pe,
|
|
1816
1872
|
query_params: we,
|
|
@@ -1820,66 +1876,24 @@ function Rr({ onSessionDestroy: e }) {
|
|
|
1820
1876
|
},
|
|
1821
1877
|
language: c,
|
|
1822
1878
|
attachments: M,
|
|
1823
|
-
...
|
|
1879
|
+
...U
|
|
1824
1880
|
});
|
|
1825
|
-
|
|
1881
|
+
return n({
|
|
1826
1882
|
type: "SET_DELIVERED_AT",
|
|
1827
1883
|
payload: {
|
|
1828
1884
|
clientMessageId: Y,
|
|
1829
1885
|
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1830
1886
|
}
|
|
1831
|
-
}),
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
payload: {
|
|
1836
|
-
type: "FROM_BOT",
|
|
1837
|
-
id: w.autopilotResponse.id || $(),
|
|
1838
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1839
|
-
component: "TEXT",
|
|
1840
|
-
data: {
|
|
1841
|
-
message: w.autopilotResponse.value.content
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
}), w.uiResponse) {
|
|
1845
|
-
const ye = w.uiResponse.value;
|
|
1846
|
-
n({
|
|
1847
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1848
|
-
payload: {
|
|
1849
|
-
type: "FROM_BOT",
|
|
1850
|
-
id: $(),
|
|
1851
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1852
|
-
component: ye.name,
|
|
1853
|
-
data: ye.request_response
|
|
1854
|
-
}
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
} else {
|
|
1858
|
-
const w = ((le = re.data.error) == null ? void 0 : le.message) || "Unknown error occurred";
|
|
1859
|
-
n({
|
|
1860
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1861
|
-
payload: {
|
|
1862
|
-
type: "FROM_BOT",
|
|
1863
|
-
id: $(),
|
|
1864
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1865
|
-
component: "TEXT",
|
|
1866
|
-
data: {
|
|
1867
|
-
message: w,
|
|
1868
|
-
variant: "error"
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
}), s({ state: "error", error: w });
|
|
1872
|
-
}
|
|
1873
|
-
return s({ state: "idle" }), { id: Y };
|
|
1874
|
-
} catch (U) {
|
|
1875
|
-
const G = U instanceof Error ? U.message : "An unexpected error occurred";
|
|
1876
|
-
throw console.error("Error in sendMessage:", G, U), (!f || f != null && f.isAssignedToAi) && s({ state: "error", error: G }), U;
|
|
1887
|
+
}), G(), s({ state: "idle" }), { id: Y };
|
|
1888
|
+
} catch (G) {
|
|
1889
|
+
const z = G instanceof Error ? G.message : "An unexpected error occurred";
|
|
1890
|
+
throw console.error("Error in sendMessage:", z, G), (!f || f != null && f.isAssignedToAi) && s({ state: "error", error: z }), G;
|
|
1877
1891
|
}
|
|
1878
|
-
},
|
|
1879
|
-
(
|
|
1892
|
+
}, re = me(
|
|
1893
|
+
(A) => {
|
|
1880
1894
|
L({
|
|
1881
1895
|
content: {
|
|
1882
|
-
text:
|
|
1896
|
+
text: A
|
|
1883
1897
|
}
|
|
1884
1898
|
}).catch((N) => {
|
|
1885
1899
|
console.error("Error handling keyboard input:", N);
|
|
@@ -1897,32 +1911,32 @@ function Rr({ onSessionDestroy: e }) {
|
|
|
1897
1911
|
noMessages: o,
|
|
1898
1912
|
initState: F,
|
|
1899
1913
|
clearSessionState: x,
|
|
1900
|
-
recreateSessionState:
|
|
1914
|
+
recreateSessionState: X,
|
|
1901
1915
|
hookState: r,
|
|
1902
|
-
recreateSession:
|
|
1916
|
+
recreateSession: K,
|
|
1903
1917
|
clearSession: P,
|
|
1904
1918
|
sendMessage: L,
|
|
1905
|
-
handleKeyboard:
|
|
1919
|
+
handleKeyboard: re
|
|
1906
1920
|
};
|
|
1907
1921
|
}
|
|
1908
|
-
const [
|
|
1909
|
-
function
|
|
1922
|
+
const [As, Dr] = Ne();
|
|
1923
|
+
function Nr({
|
|
1910
1924
|
children: e
|
|
1911
1925
|
}) {
|
|
1912
|
-
const { settings: t } =
|
|
1926
|
+
const { settings: t } = le(), n = Tr({
|
|
1913
1927
|
defaultHookSettings: {
|
|
1914
1928
|
persistSession: (t == null ? void 0 : t.persistSession) ?? !0,
|
|
1915
1929
|
useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
|
|
1916
1930
|
}
|
|
1917
1931
|
});
|
|
1918
|
-
return /* @__PURE__ */
|
|
1932
|
+
return /* @__PURE__ */ te(Dr, { value: n, children: e });
|
|
1919
1933
|
}
|
|
1920
|
-
function
|
|
1921
|
-
const { http: e, botToken: t, user: n, collectUserData: r } =
|
|
1934
|
+
function Cr() {
|
|
1935
|
+
const { http: e, botToken: t, user: n, collectUserData: r } = le(), [s, o] = Ze(
|
|
1922
1936
|
`${t}:contact:${n.external_id}`,
|
|
1923
1937
|
null,
|
|
1924
1938
|
"local"
|
|
1925
|
-
), [a, d] =
|
|
1939
|
+
), [a, d] = ie(
|
|
1926
1940
|
async (u) => {
|
|
1927
1941
|
var c;
|
|
1928
1942
|
try {
|
|
@@ -1939,7 +1953,7 @@ function Nr() {
|
|
|
1939
1953
|
de(() => {
|
|
1940
1954
|
n && t && d(n);
|
|
1941
1955
|
}, [n, t]);
|
|
1942
|
-
const g =
|
|
1956
|
+
const g = ne(() => !(s != null && s.id) && r ? {
|
|
1943
1957
|
should: !0,
|
|
1944
1958
|
reason: "No contact id and collectUserData is true"
|
|
1945
1959
|
} : {
|
|
@@ -1952,18 +1966,18 @@ function Nr() {
|
|
|
1952
1966
|
shouldCollectData: g
|
|
1953
1967
|
};
|
|
1954
1968
|
}
|
|
1955
|
-
const [
|
|
1956
|
-
function
|
|
1957
|
-
const t =
|
|
1958
|
-
return /* @__PURE__ */
|
|
1969
|
+
const [_s, xr] = Ne();
|
|
1970
|
+
function Pr({ children: e }) {
|
|
1971
|
+
const t = Cr();
|
|
1972
|
+
return /* @__PURE__ */ te(xr, { value: t, children: e });
|
|
1959
1973
|
}
|
|
1960
|
-
function
|
|
1974
|
+
function Rs({
|
|
1961
1975
|
children: e,
|
|
1962
1976
|
options: t
|
|
1963
1977
|
}) {
|
|
1964
|
-
return /* @__PURE__ */
|
|
1978
|
+
return /* @__PURE__ */ te(rr, { data: t, children: /* @__PURE__ */ te(Pr, { children: /* @__PURE__ */ te(wt, { children: /* @__PURE__ */ te(Nr, { children: e }) }) }) });
|
|
1965
1979
|
}
|
|
1966
|
-
var
|
|
1980
|
+
var qe = { exports: {} }, ke = {};
|
|
1967
1981
|
/**
|
|
1968
1982
|
* @license React
|
|
1969
1983
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -1973,10 +1987,10 @@ var Ye = { exports: {} }, Le = {};
|
|
|
1973
1987
|
* This source code is licensed under the MIT license found in the
|
|
1974
1988
|
* LICENSE file in the root directory of this source tree.
|
|
1975
1989
|
*/
|
|
1976
|
-
var
|
|
1977
|
-
function
|
|
1978
|
-
if (
|
|
1979
|
-
|
|
1990
|
+
var dt;
|
|
1991
|
+
function Ir() {
|
|
1992
|
+
if (dt) return ke;
|
|
1993
|
+
dt = 1;
|
|
1980
1994
|
var e = fe;
|
|
1981
1995
|
function t(i, m) {
|
|
1982
1996
|
return i === m && (i !== 0 || 1 / i === 1 / m) || i !== i && m !== m;
|
|
@@ -2006,9 +2020,9 @@ function Pr() {
|
|
|
2006
2020
|
return m();
|
|
2007
2021
|
}
|
|
2008
2022
|
var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : d;
|
|
2009
|
-
return
|
|
2023
|
+
return ke.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, ke;
|
|
2010
2024
|
}
|
|
2011
|
-
var
|
|
2025
|
+
var Fe = {};
|
|
2012
2026
|
/**
|
|
2013
2027
|
* @license React
|
|
2014
2028
|
* use-sync-external-store-shim.development.js
|
|
@@ -2018,158 +2032,158 @@ var ke = {};
|
|
|
2018
2032
|
* This source code is licensed under the MIT license found in the
|
|
2019
2033
|
* LICENSE file in the root directory of this source tree.
|
|
2020
2034
|
*/
|
|
2021
|
-
var
|
|
2022
|
-
function
|
|
2023
|
-
return
|
|
2035
|
+
var ft;
|
|
2036
|
+
function jr() {
|
|
2037
|
+
return ft || (ft = 1, process.env.NODE_ENV !== "production" && function() {
|
|
2024
2038
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
2025
2039
|
var e = fe, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
2026
|
-
function n(
|
|
2040
|
+
function n(T) {
|
|
2027
2041
|
{
|
|
2028
|
-
for (var S = arguments.length,
|
|
2029
|
-
|
|
2030
|
-
r("error",
|
|
2042
|
+
for (var S = arguments.length, w = new Array(S > 1 ? S - 1 : 0), E = 1; E < S; E++)
|
|
2043
|
+
w[E - 1] = arguments[E];
|
|
2044
|
+
r("error", T, w);
|
|
2031
2045
|
}
|
|
2032
2046
|
}
|
|
2033
|
-
function r(
|
|
2047
|
+
function r(T, S, w) {
|
|
2034
2048
|
{
|
|
2035
2049
|
var E = t.ReactDebugCurrentFrame, F = E.getStackAddendum();
|
|
2036
|
-
F !== "" && (S += "%s",
|
|
2037
|
-
var
|
|
2050
|
+
F !== "" && (S += "%s", w = w.concat([F]));
|
|
2051
|
+
var O = w.map(function(x) {
|
|
2038
2052
|
return String(x);
|
|
2039
2053
|
});
|
|
2040
|
-
|
|
2054
|
+
O.unshift("Warning: " + S), Function.prototype.apply.call(console[T], console, O);
|
|
2041
2055
|
}
|
|
2042
2056
|
}
|
|
2043
|
-
function s(
|
|
2044
|
-
return
|
|
2057
|
+
function s(T, S) {
|
|
2058
|
+
return T === S && (T !== 0 || 1 / T === 1 / S) || T !== T && S !== S;
|
|
2045
2059
|
}
|
|
2046
2060
|
var o = typeof Object.is == "function" ? Object.is : s, a = e.useState, d = e.useEffect, g = e.useLayoutEffect, u = e.useDebugValue, c = !1, i = !1;
|
|
2047
|
-
function m(
|
|
2061
|
+
function m(T, S, w) {
|
|
2048
2062
|
c || e.startTransition !== void 0 && (c = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
2049
2063
|
var E = S();
|
|
2050
2064
|
if (!i) {
|
|
2051
2065
|
var F = S();
|
|
2052
2066
|
o(E, F) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), i = !0);
|
|
2053
2067
|
}
|
|
2054
|
-
var
|
|
2068
|
+
var O = a({
|
|
2055
2069
|
inst: {
|
|
2056
2070
|
value: E,
|
|
2057
2071
|
getSnapshot: S
|
|
2058
2072
|
}
|
|
2059
|
-
}), x =
|
|
2073
|
+
}), x = O[0].inst, P = O[1];
|
|
2060
2074
|
return g(function() {
|
|
2061
2075
|
x.value = E, x.getSnapshot = S, p(x) && P({
|
|
2062
2076
|
inst: x
|
|
2063
2077
|
});
|
|
2064
|
-
}, [
|
|
2078
|
+
}, [T, E, S]), d(function() {
|
|
2065
2079
|
p(x) && P({
|
|
2066
2080
|
inst: x
|
|
2067
2081
|
});
|
|
2068
|
-
var
|
|
2082
|
+
var X = function() {
|
|
2069
2083
|
p(x) && P({
|
|
2070
2084
|
inst: x
|
|
2071
2085
|
});
|
|
2072
2086
|
};
|
|
2073
|
-
return
|
|
2074
|
-
}, [
|
|
2087
|
+
return T(X);
|
|
2088
|
+
}, [T]), u(E), E;
|
|
2075
2089
|
}
|
|
2076
|
-
function p(
|
|
2077
|
-
var S =
|
|
2090
|
+
function p(T) {
|
|
2091
|
+
var S = T.getSnapshot, w = T.value;
|
|
2078
2092
|
try {
|
|
2079
2093
|
var E = S();
|
|
2080
|
-
return !o(
|
|
2094
|
+
return !o(w, E);
|
|
2081
2095
|
} catch {
|
|
2082
2096
|
return !0;
|
|
2083
2097
|
}
|
|
2084
2098
|
}
|
|
2085
|
-
function y(
|
|
2099
|
+
function y(T, S, w) {
|
|
2086
2100
|
return S();
|
|
2087
2101
|
}
|
|
2088
2102
|
var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !f, h = v ? y : m, B = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
|
|
2089
|
-
|
|
2090
|
-
}()),
|
|
2103
|
+
Fe.useSyncExternalStore = B, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2104
|
+
}()), Fe;
|
|
2091
2105
|
}
|
|
2092
|
-
process.env.NODE_ENV === "production" ?
|
|
2093
|
-
var
|
|
2094
|
-
const
|
|
2106
|
+
process.env.NODE_ENV === "production" ? qe.exports = Ir() : qe.exports = jr();
|
|
2107
|
+
var Lr = qe.exports;
|
|
2108
|
+
const ce = () => {
|
|
2095
2109
|
}, V = (
|
|
2096
2110
|
/*#__NOINLINE__*/
|
|
2097
|
-
|
|
2098
|
-
),
|
|
2111
|
+
ce()
|
|
2112
|
+
), Me = Object, b = (e) => e === V, W = (e) => typeof e == "function", ue = (e, t) => ({
|
|
2099
2113
|
...e,
|
|
2100
2114
|
...t
|
|
2101
|
-
}),
|
|
2102
|
-
let
|
|
2115
|
+
}), kr = (e) => W(e.then), _e = /* @__PURE__ */ new WeakMap();
|
|
2116
|
+
let Fr = 0;
|
|
2103
2117
|
const Ee = (e) => {
|
|
2104
2118
|
const t = typeof e, n = e && e.constructor, r = n == Date;
|
|
2105
2119
|
let s, o;
|
|
2106
|
-
if (
|
|
2107
|
-
if (s =
|
|
2108
|
-
if (s = ++
|
|
2120
|
+
if (Me(e) === e && !r && n != RegExp) {
|
|
2121
|
+
if (s = _e.get(e), s) return s;
|
|
2122
|
+
if (s = ++Fr + "~", _e.set(e, s), n == Array) {
|
|
2109
2123
|
for (s = "@", o = 0; o < e.length; o++)
|
|
2110
2124
|
s += Ee(e[o]) + ",";
|
|
2111
|
-
|
|
2125
|
+
_e.set(e, s);
|
|
2112
2126
|
}
|
|
2113
|
-
if (n ==
|
|
2127
|
+
if (n == Me) {
|
|
2114
2128
|
s = "#";
|
|
2115
|
-
const a =
|
|
2129
|
+
const a = Me.keys(e).sort();
|
|
2116
2130
|
for (; !b(o = a.pop()); )
|
|
2117
2131
|
b(e[o]) || (s += o + ":" + Ee(e[o]) + ",");
|
|
2118
|
-
|
|
2132
|
+
_e.set(e, s);
|
|
2119
2133
|
}
|
|
2120
2134
|
} else
|
|
2121
2135
|
s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
2122
2136
|
return s;
|
|
2123
|
-
},
|
|
2124
|
-
const n =
|
|
2137
|
+
}, ee = /* @__PURE__ */ new WeakMap(), Ve = {}, Re = {}, tt = "undefined", Pe = typeof window != tt, Be = typeof document != tt, Mr = () => Pe && typeof window.requestAnimationFrame != tt, en = (e, t) => {
|
|
2138
|
+
const n = ee.get(e);
|
|
2125
2139
|
return [
|
|
2126
2140
|
// Getter
|
|
2127
|
-
() => !b(t) && e.get(t) ||
|
|
2141
|
+
() => !b(t) && e.get(t) || Ve,
|
|
2128
2142
|
// Setter
|
|
2129
2143
|
(r) => {
|
|
2130
2144
|
if (!b(t)) {
|
|
2131
2145
|
const s = e.get(t);
|
|
2132
|
-
t in
|
|
2146
|
+
t in Re || (Re[t] = s), n[5](t, ue(s, r), s || Ve);
|
|
2133
2147
|
}
|
|
2134
2148
|
},
|
|
2135
2149
|
// Subscriber
|
|
2136
2150
|
n[6],
|
|
2137
2151
|
// Get server cache snapshot
|
|
2138
|
-
() => !b(t) && t in
|
|
2152
|
+
() => !b(t) && t in Re ? Re[t] : !b(t) && e.get(t) || Ve
|
|
2139
2153
|
];
|
|
2140
2154
|
};
|
|
2141
|
-
let
|
|
2142
|
-
const
|
|
2155
|
+
let Xe = !0;
|
|
2156
|
+
const Vr = () => Xe, [Qe, We] = Pe && window.addEventListener ? [
|
|
2143
2157
|
window.addEventListener.bind(window),
|
|
2144
2158
|
window.removeEventListener.bind(window)
|
|
2145
2159
|
] : [
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
],
|
|
2160
|
+
ce,
|
|
2161
|
+
ce
|
|
2162
|
+
], Ur = () => {
|
|
2149
2163
|
const e = Be && document.visibilityState;
|
|
2150
2164
|
return b(e) || e !== "hidden";
|
|
2151
|
-
},
|
|
2152
|
-
Be && document.removeEventListener("visibilitychange", e),
|
|
2153
|
-
}),
|
|
2165
|
+
}, Hr = (e) => (Be && document.addEventListener("visibilitychange", e), Qe("focus", e), () => {
|
|
2166
|
+
Be && document.removeEventListener("visibilitychange", e), We("focus", e);
|
|
2167
|
+
}), Gr = (e) => {
|
|
2154
2168
|
const t = () => {
|
|
2155
|
-
|
|
2169
|
+
Xe = !0, e();
|
|
2156
2170
|
}, n = () => {
|
|
2157
|
-
|
|
2171
|
+
Xe = !1;
|
|
2158
2172
|
};
|
|
2159
|
-
return
|
|
2160
|
-
|
|
2173
|
+
return Qe("online", t), Qe("offline", n), () => {
|
|
2174
|
+
We("online", t), We("offline", n);
|
|
2161
2175
|
};
|
|
2162
|
-
}, Gr = {
|
|
2163
|
-
isOnline: Mr,
|
|
2164
|
-
isVisible: Vr
|
|
2165
2176
|
}, zr = {
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
},
|
|
2177
|
+
isOnline: Vr,
|
|
2178
|
+
isVisible: Ur
|
|
2179
|
+
}, Yr = {
|
|
2180
|
+
initFocus: Hr,
|
|
2181
|
+
initReconnect: Gr
|
|
2182
|
+
}, pt = !fe.useId, be = !Pe || "Deno" in window, qr = (e) => Mr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ue = be ? de : pn, He = typeof navigator < "u" && navigator.connection, gt = !be && He && ([
|
|
2169
2183
|
"slow-2g",
|
|
2170
2184
|
"2g"
|
|
2171
|
-
].includes(
|
|
2172
|
-
if (
|
|
2185
|
+
].includes(He.effectiveType) || He.saveData), nt = (e) => {
|
|
2186
|
+
if (W(e))
|
|
2173
2187
|
try {
|
|
2174
2188
|
e = e();
|
|
2175
2189
|
} catch {
|
|
@@ -2182,16 +2196,16 @@ const Mr = () => qe, [Xe, Qe] = xe && window.addEventListener ? [
|
|
|
2182
2196
|
];
|
|
2183
2197
|
};
|
|
2184
2198
|
let Br = 0;
|
|
2185
|
-
const
|
|
2186
|
-
var
|
|
2199
|
+
const Ke = () => ++Br, tn = 0, nn = 1, rn = 2, Xr = 3;
|
|
2200
|
+
var Se = {
|
|
2187
2201
|
__proto__: null,
|
|
2188
|
-
ERROR_REVALIDATE_EVENT:
|
|
2189
|
-
FOCUS_EVENT:
|
|
2190
|
-
MUTATE_EVENT:
|
|
2191
|
-
RECONNECT_EVENT:
|
|
2202
|
+
ERROR_REVALIDATE_EVENT: Xr,
|
|
2203
|
+
FOCUS_EVENT: tn,
|
|
2204
|
+
MUTATE_EVENT: rn,
|
|
2205
|
+
RECONNECT_EVENT: nn
|
|
2192
2206
|
};
|
|
2193
|
-
async function
|
|
2194
|
-
const [t, n, r, s] = e, o =
|
|
2207
|
+
async function sn(...e) {
|
|
2208
|
+
const [t, n, r, s] = e, o = ue({
|
|
2195
2209
|
populateCache: !0,
|
|
2196
2210
|
throwOnError: !0
|
|
2197
2211
|
}, typeof s == "boolean" ? {
|
|
@@ -2201,7 +2215,7 @@ async function rn(...e) {
|
|
|
2201
2215
|
const d = o.rollbackOnError;
|
|
2202
2216
|
let g = o.optimisticData;
|
|
2203
2217
|
const u = (m) => typeof d == "function" ? d(m) : d !== !1, c = o.throwOnError;
|
|
2204
|
-
if (
|
|
2218
|
+
if (W(n)) {
|
|
2205
2219
|
const m = n, p = [], y = t.keys();
|
|
2206
2220
|
for (const f of y)
|
|
2207
2221
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -2210,43 +2224,43 @@ async function rn(...e) {
|
|
|
2210
2224
|
}
|
|
2211
2225
|
return i(n);
|
|
2212
2226
|
async function i(m) {
|
|
2213
|
-
const [p] =
|
|
2227
|
+
const [p] = nt(m);
|
|
2214
2228
|
if (!p) return;
|
|
2215
|
-
const [y, f] =
|
|
2229
|
+
const [y, f] = en(t, p), [v, h, B, T] = ee.get(t), S = () => {
|
|
2216
2230
|
const L = v[p];
|
|
2217
|
-
return (
|
|
2231
|
+
return (W(o.revalidate) ? o.revalidate(y().data, m) : o.revalidate !== !1) && (delete B[p], delete T[p], L && L[0]) ? L[0](rn).then(() => y().data) : y().data;
|
|
2218
2232
|
};
|
|
2219
2233
|
if (e.length < 3)
|
|
2220
2234
|
return S();
|
|
2221
|
-
let
|
|
2222
|
-
const F =
|
|
2235
|
+
let w = r, E;
|
|
2236
|
+
const F = Ke();
|
|
2223
2237
|
h[p] = [
|
|
2224
2238
|
F,
|
|
2225
2239
|
0
|
|
2226
2240
|
];
|
|
2227
|
-
const
|
|
2228
|
-
if (
|
|
2241
|
+
const O = !b(g), x = y(), P = x.data, X = x._c, K = b(X) ? P : X;
|
|
2242
|
+
if (O && (g = W(g) ? g(K, P) : g, f({
|
|
2229
2243
|
data: g,
|
|
2230
|
-
_c:
|
|
2231
|
-
})),
|
|
2244
|
+
_c: K
|
|
2245
|
+
})), W(w))
|
|
2232
2246
|
try {
|
|
2233
|
-
|
|
2247
|
+
w = w(K);
|
|
2234
2248
|
} catch (L) {
|
|
2235
2249
|
E = L;
|
|
2236
2250
|
}
|
|
2237
|
-
if (
|
|
2238
|
-
if (
|
|
2251
|
+
if (w && kr(w))
|
|
2252
|
+
if (w = await w.catch((L) => {
|
|
2239
2253
|
E = L;
|
|
2240
2254
|
}), F !== h[p][0]) {
|
|
2241
2255
|
if (E) throw E;
|
|
2242
|
-
return
|
|
2243
|
-
} else E &&
|
|
2244
|
-
data:
|
|
2256
|
+
return w;
|
|
2257
|
+
} else E && O && u(E) && (a = !0, f({
|
|
2258
|
+
data: K,
|
|
2245
2259
|
_c: V
|
|
2246
2260
|
}));
|
|
2247
2261
|
if (a && !E)
|
|
2248
|
-
if (
|
|
2249
|
-
const L = a(
|
|
2262
|
+
if (W(a)) {
|
|
2263
|
+
const L = a(w, K);
|
|
2250
2264
|
f({
|
|
2251
2265
|
data: L,
|
|
2252
2266
|
error: V,
|
|
@@ -2254,11 +2268,11 @@ async function rn(...e) {
|
|
|
2254
2268
|
});
|
|
2255
2269
|
} else
|
|
2256
2270
|
f({
|
|
2257
|
-
data:
|
|
2271
|
+
data: w,
|
|
2258
2272
|
error: V,
|
|
2259
2273
|
_c: V
|
|
2260
2274
|
});
|
|
2261
|
-
if (h[p][1] =
|
|
2275
|
+
if (h[p][1] = Ke(), Promise.resolve(S()).then(() => {
|
|
2262
2276
|
f({
|
|
2263
2277
|
_c: V
|
|
2264
2278
|
});
|
|
@@ -2266,16 +2280,16 @@ async function rn(...e) {
|
|
|
2266
2280
|
if (c) throw E;
|
|
2267
2281
|
return;
|
|
2268
2282
|
}
|
|
2269
|
-
return
|
|
2283
|
+
return w;
|
|
2270
2284
|
}
|
|
2271
2285
|
}
|
|
2272
|
-
const
|
|
2286
|
+
const mt = (e, t) => {
|
|
2273
2287
|
for (const n in e)
|
|
2274
2288
|
e[n][0] && e[n][0](t);
|
|
2275
|
-
},
|
|
2276
|
-
if (!
|
|
2277
|
-
const n =
|
|
2278
|
-
let o =
|
|
2289
|
+
}, Qr = (e, t) => {
|
|
2290
|
+
if (!ee.has(e)) {
|
|
2291
|
+
const n = ue(Yr, t), r = {}, s = sn.bind(V, e);
|
|
2292
|
+
let o = ce;
|
|
2279
2293
|
const a = {}, d = (c, i) => {
|
|
2280
2294
|
const m = a[c] || [];
|
|
2281
2295
|
return a[c] = m, m.push(i), () => m.splice(m.indexOf(i), 1);
|
|
@@ -2286,7 +2300,7 @@ const gt = (e, t) => {
|
|
|
2286
2300
|
for (const y of p)
|
|
2287
2301
|
y(i, m);
|
|
2288
2302
|
}, u = () => {
|
|
2289
|
-
if (!
|
|
2303
|
+
if (!ee.has(e) && (ee.set(e, [
|
|
2290
2304
|
r,
|
|
2291
2305
|
{},
|
|
2292
2306
|
{},
|
|
@@ -2295,9 +2309,9 @@ const gt = (e, t) => {
|
|
|
2295
2309
|
g,
|
|
2296
2310
|
d
|
|
2297
2311
|
]), !be)) {
|
|
2298
|
-
const c = n.initFocus(setTimeout.bind(V,
|
|
2312
|
+
const c = n.initFocus(setTimeout.bind(V, mt.bind(V, r, tn))), i = n.initReconnect(setTimeout.bind(V, mt.bind(V, r, nn)));
|
|
2299
2313
|
o = () => {
|
|
2300
|
-
c && c(), i && i(),
|
|
2314
|
+
c && c(), i && i(), ee.delete(e);
|
|
2301
2315
|
};
|
|
2302
2316
|
}
|
|
2303
2317
|
};
|
|
@@ -2310,48 +2324,48 @@ const gt = (e, t) => {
|
|
|
2310
2324
|
}
|
|
2311
2325
|
return [
|
|
2312
2326
|
e,
|
|
2313
|
-
|
|
2327
|
+
ee.get(e)[4]
|
|
2314
2328
|
];
|
|
2315
|
-
},
|
|
2329
|
+
}, Wr = (e, t, n, r, s) => {
|
|
2316
2330
|
const o = n.errorRetryCount, a = s.retryCount, d = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
|
|
2317
2331
|
!b(o) && a > o || setTimeout(r, d, s);
|
|
2318
|
-
},
|
|
2332
|
+
}, Kr = (e, t) => Ee(e) == Ee(t), [on, Jr] = Qr(/* @__PURE__ */ new Map()), Zr = ue(
|
|
2319
2333
|
{
|
|
2320
2334
|
// events
|
|
2321
|
-
onLoadingSlow:
|
|
2322
|
-
onSuccess:
|
|
2323
|
-
onError:
|
|
2324
|
-
onErrorRetry:
|
|
2325
|
-
onDiscarded:
|
|
2335
|
+
onLoadingSlow: ce,
|
|
2336
|
+
onSuccess: ce,
|
|
2337
|
+
onError: ce,
|
|
2338
|
+
onErrorRetry: Wr,
|
|
2339
|
+
onDiscarded: ce,
|
|
2326
2340
|
// switches
|
|
2327
2341
|
revalidateOnFocus: !0,
|
|
2328
2342
|
revalidateOnReconnect: !0,
|
|
2329
2343
|
revalidateIfStale: !0,
|
|
2330
2344
|
shouldRetryOnError: !0,
|
|
2331
2345
|
// timeouts
|
|
2332
|
-
errorRetryInterval:
|
|
2346
|
+
errorRetryInterval: gt ? 1e4 : 5e3,
|
|
2333
2347
|
focusThrottleInterval: 5 * 1e3,
|
|
2334
2348
|
dedupingInterval: 2 * 1e3,
|
|
2335
|
-
loadingTimeout:
|
|
2349
|
+
loadingTimeout: gt ? 5e3 : 3e3,
|
|
2336
2350
|
// providers
|
|
2337
|
-
compare:
|
|
2351
|
+
compare: Kr,
|
|
2338
2352
|
isPaused: () => !1,
|
|
2339
|
-
cache:
|
|
2340
|
-
mutate:
|
|
2353
|
+
cache: on,
|
|
2354
|
+
mutate: Jr,
|
|
2341
2355
|
fallback: {}
|
|
2342
2356
|
},
|
|
2343
2357
|
// use web preset by default
|
|
2344
|
-
|
|
2345
|
-
),
|
|
2346
|
-
const n =
|
|
2358
|
+
zr
|
|
2359
|
+
), $r = (e, t) => {
|
|
2360
|
+
const n = ue(e, t);
|
|
2347
2361
|
if (t) {
|
|
2348
2362
|
const { use: r, fallback: s } = e, { use: o, fallback: a } = t;
|
|
2349
|
-
r && o && (n.use = r.concat(o)), s && a && (n.fallback =
|
|
2363
|
+
r && o && (n.use = r.concat(o)), s && a && (n.fallback = ue(s, a));
|
|
2350
2364
|
}
|
|
2351
2365
|
return n;
|
|
2352
|
-
},
|
|
2353
|
-
|
|
2354
|
-
},
|
|
2366
|
+
}, es = yt({}), ts = "$inf$", an = Pe && window.__SWR_DEVTOOLS_USE__, ns = an ? window.__SWR_DEVTOOLS_USE__ : [], rs = () => {
|
|
2367
|
+
an && (window.__SWR_DEVTOOLS_REACT__ = fe);
|
|
2368
|
+
}, ss = (e) => W(e[1]) ? [
|
|
2355
2369
|
e[0],
|
|
2356
2370
|
e[1],
|
|
2357
2371
|
e[2] || {}
|
|
@@ -2359,28 +2373,28 @@ const gt = (e, t) => {
|
|
|
2359
2373
|
e[0],
|
|
2360
2374
|
null,
|
|
2361
2375
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
2362
|
-
],
|
|
2363
|
-
const [a] =
|
|
2364
|
-
if (a.startsWith(
|
|
2376
|
+
], os = () => ue(Zr, St(es)), as = (e) => (t, n, r) => e(t, n && ((...o) => {
|
|
2377
|
+
const [a] = nt(t), [, , , d] = ee.get(on);
|
|
2378
|
+
if (a.startsWith(ts))
|
|
2365
2379
|
return n(...o);
|
|
2366
2380
|
const g = d[a];
|
|
2367
2381
|
return b(g) ? n(...o) : (delete d[a], g);
|
|
2368
|
-
}), r),
|
|
2369
|
-
const r =
|
|
2382
|
+
}), r), is = ns.concat(as), cs = (e) => function(...n) {
|
|
2383
|
+
const r = os(), [s, o, a] = ss(n), d = $r(r, a);
|
|
2370
2384
|
let g = e;
|
|
2371
|
-
const { use: u } = d, c = (u || []).concat(
|
|
2385
|
+
const { use: u } = d, c = (u || []).concat(is);
|
|
2372
2386
|
for (let i = c.length; i--; )
|
|
2373
2387
|
g = c[i](g);
|
|
2374
2388
|
return g(s, o || d.fetcher || null, d);
|
|
2375
|
-
},
|
|
2389
|
+
}, us = (e, t, n) => {
|
|
2376
2390
|
const r = t[e] || (t[e] = []);
|
|
2377
2391
|
return r.push(n), () => {
|
|
2378
2392
|
const s = r.indexOf(n);
|
|
2379
2393
|
s >= 0 && (r[s] = r[r.length - 1], r.pop());
|
|
2380
2394
|
};
|
|
2381
2395
|
};
|
|
2382
|
-
|
|
2383
|
-
const
|
|
2396
|
+
rs();
|
|
2397
|
+
const ht = fe.use || ((e) => {
|
|
2384
2398
|
if (e.status === "pending")
|
|
2385
2399
|
throw e;
|
|
2386
2400
|
if (e.status === "fulfilled")
|
|
@@ -2390,32 +2404,32 @@ const mt = fe.use || ((e) => {
|
|
|
2390
2404
|
}, (t) => {
|
|
2391
2405
|
e.status = "rejected", e.reason = t;
|
|
2392
2406
|
}), e);
|
|
2393
|
-
}),
|
|
2407
|
+
}), Ge = {
|
|
2394
2408
|
dedupe: !0
|
|
2395
|
-
},
|
|
2396
|
-
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: d, revalidateIfStale: g, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: m } = n, [p, y, f, v] =
|
|
2397
|
-
for (const j in
|
|
2409
|
+
}, ls = (e, t, n) => {
|
|
2410
|
+
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: d, revalidateIfStale: g, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: m } = n, [p, y, f, v] = ee.get(r), [h, B] = nt(e), T = ae(!1), S = ae(!1), w = ae(h), E = ae(t), F = ae(n), O = () => F.current, x = () => O().isVisible() && O().isOnline(), [P, X, K, L] = en(r, h), re = ae({}).current, A = b(a) ? n.fallback[h] : a, N = (_, R) => {
|
|
2411
|
+
for (const j in re) {
|
|
2398
2412
|
const C = j;
|
|
2399
2413
|
if (C === "data") {
|
|
2400
|
-
if (!s(
|
|
2414
|
+
if (!s(_[C], R[C]) && (!b(_[C]) || !s(se, R[C])))
|
|
2401
2415
|
return !1;
|
|
2402
|
-
} else if (
|
|
2416
|
+
} else if (R[C] !== _[C])
|
|
2403
2417
|
return !1;
|
|
2404
2418
|
}
|
|
2405
2419
|
return !0;
|
|
2406
|
-
}, M =
|
|
2407
|
-
const
|
|
2408
|
-
const
|
|
2409
|
-
return delete
|
|
2420
|
+
}, M = ne(() => {
|
|
2421
|
+
const _ = !h || !t ? !1 : b(d) ? O().isPaused() || o ? !1 : b(g) ? !0 : g : d, R = (k) => {
|
|
2422
|
+
const Z = ue(k);
|
|
2423
|
+
return delete Z._k, _ ? {
|
|
2410
2424
|
isValidating: !0,
|
|
2411
2425
|
isLoading: !0,
|
|
2412
|
-
...
|
|
2413
|
-
} :
|
|
2414
|
-
}, j = P(), C = L(),
|
|
2415
|
-
let I =
|
|
2426
|
+
...Z
|
|
2427
|
+
} : Z;
|
|
2428
|
+
}, j = P(), C = L(), Q = R(j), ge = j === C ? Q : R(C);
|
|
2429
|
+
let I = Q;
|
|
2416
2430
|
return [
|
|
2417
2431
|
() => {
|
|
2418
|
-
const k =
|
|
2432
|
+
const k = R(P());
|
|
2419
2433
|
return N(k, I) ? (I.data = k.data, I.isLoading = k.isLoading, I.isValidating = k.isValidating, I.error = k.error, I) : (I = k, k);
|
|
2420
2434
|
},
|
|
2421
2435
|
() => ge
|
|
@@ -2423,62 +2437,62 @@ const mt = fe.use || ((e) => {
|
|
|
2423
2437
|
}, [
|
|
2424
2438
|
r,
|
|
2425
2439
|
h
|
|
2426
|
-
]),
|
|
2427
|
-
(
|
|
2428
|
-
N(j,
|
|
2440
|
+
]), U = Lr.useSyncExternalStore(me(
|
|
2441
|
+
(_) => K(h, (R, j) => {
|
|
2442
|
+
N(j, R) || _();
|
|
2429
2443
|
}),
|
|
2430
2444
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2431
2445
|
[
|
|
2432
2446
|
r,
|
|
2433
2447
|
h
|
|
2434
2448
|
]
|
|
2435
|
-
), M[0], M[1]),
|
|
2436
|
-
async (
|
|
2437
|
-
const
|
|
2438
|
-
if (!h || !
|
|
2449
|
+
), M[0], M[1]), G = !T.current, z = p[h] && p[h].length > 0, J = U.data, Y = b(J) ? A : J, pe = U.error, we = ae(Y), se = m ? b(J) ? we.current : J : Y, D = z && !b(pe) ? !1 : G && !b(d) ? d : O().isPaused() ? !1 : o ? b(Y) ? !1 : g : b(Y) || g, q = !!(h && t && G && D), Oe = b(U.isValidating) ? q : U.isValidating, cn = b(U.isLoading) ? q : U.isLoading, ye = me(
|
|
2450
|
+
async (_) => {
|
|
2451
|
+
const R = E.current;
|
|
2452
|
+
if (!h || !R || S.current || O().isPaused())
|
|
2439
2453
|
return !1;
|
|
2440
|
-
let j, C,
|
|
2441
|
-
const ge =
|
|
2454
|
+
let j, C, Q = !0;
|
|
2455
|
+
const ge = _ || {}, I = !f[h] || !ge.dedupe, k = () => pt ? !S.current && h === w.current && T.current : h === w.current, Z = {
|
|
2442
2456
|
isValidating: !1,
|
|
2443
2457
|
isLoading: !1
|
|
2444
|
-
}, rt = () => {
|
|
2445
|
-
q(K);
|
|
2446
2458
|
}, st = () => {
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2459
|
+
X(Z);
|
|
2460
|
+
}, ot = () => {
|
|
2461
|
+
const H = f[h];
|
|
2462
|
+
H && H[1] === C && delete f[h];
|
|
2463
|
+
}, at = {
|
|
2450
2464
|
isValidating: !0
|
|
2451
2465
|
};
|
|
2452
|
-
b(P().data) && (
|
|
2466
|
+
b(P().data) && (at.isLoading = !0);
|
|
2453
2467
|
try {
|
|
2454
|
-
if (I && (
|
|
2455
|
-
|
|
2468
|
+
if (I && (X(at), n.loadingTimeout && b(P().data) && setTimeout(() => {
|
|
2469
|
+
Q && k() && O().onLoadingSlow(h, n);
|
|
2456
2470
|
}, n.loadingTimeout), f[h] = [
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
]), [j, C] = f[h], j = await j, I && setTimeout(
|
|
2460
|
-
return I && k() &&
|
|
2461
|
-
|
|
2462
|
-
const
|
|
2463
|
-
if (!b(
|
|
2464
|
-
(C <=
|
|
2465
|
-
C <=
|
|
2466
|
-
|
|
2467
|
-
return
|
|
2468
|
-
const
|
|
2469
|
-
|
|
2470
|
-
} catch (
|
|
2471
|
-
|
|
2472
|
-
const
|
|
2473
|
-
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2471
|
+
R(B),
|
|
2472
|
+
Ke()
|
|
2473
|
+
]), [j, C] = f[h], j = await j, I && setTimeout(ot, n.dedupingInterval), !f[h] || f[h][1] !== C)
|
|
2474
|
+
return I && k() && O().onDiscarded(h), !1;
|
|
2475
|
+
Z.error = V;
|
|
2476
|
+
const H = y[h];
|
|
2477
|
+
if (!b(H) && // case 1
|
|
2478
|
+
(C <= H[0] || // case 2
|
|
2479
|
+
C <= H[1] || // case 3
|
|
2480
|
+
H[1] === 0))
|
|
2481
|
+
return st(), I && k() && O().onDiscarded(h), !1;
|
|
2482
|
+
const $ = P().data;
|
|
2483
|
+
Z.data = s($, j) ? $ : j, I && k() && O().onSuccess(j, h, n);
|
|
2484
|
+
} catch (H) {
|
|
2485
|
+
ot();
|
|
2486
|
+
const $ = O(), { shouldRetryOnError: Ie } = $;
|
|
2487
|
+
$.isPaused() || (Z.error = H, I && k() && ($.onError(H, h, $), (Ie === !0 || W(Ie) && Ie(H)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || x()) && $.onErrorRetry(H, h, $, (un) => {
|
|
2488
|
+
const je = p[h];
|
|
2489
|
+
je && je[0] && je[0](Se.ERROR_REVALIDATE_EVENT, un);
|
|
2476
2490
|
}, {
|
|
2477
2491
|
retryCount: (ge.retryCount || 0) + 1,
|
|
2478
2492
|
dedupe: !0
|
|
2479
2493
|
})));
|
|
2480
2494
|
}
|
|
2481
|
-
return
|
|
2495
|
+
return Q = !1, st(), !0;
|
|
2482
2496
|
},
|
|
2483
2497
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
2484
2498
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -2495,108 +2509,108 @@ const mt = fe.use || ((e) => {
|
|
|
2495
2509
|
h,
|
|
2496
2510
|
r
|
|
2497
2511
|
]
|
|
2498
|
-
),
|
|
2512
|
+
), rt = me(
|
|
2499
2513
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
2500
|
-
(...
|
|
2514
|
+
(..._) => sn(r, w.current, ..._),
|
|
2501
2515
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2502
2516
|
[]
|
|
2503
2517
|
);
|
|
2504
|
-
if (
|
|
2505
|
-
E.current = t, F.current = n, b(
|
|
2506
|
-
}),
|
|
2518
|
+
if (Ue(() => {
|
|
2519
|
+
E.current = t, F.current = n, b(J) || (we.current = J);
|
|
2520
|
+
}), Ue(() => {
|
|
2507
2521
|
if (!h) return;
|
|
2508
|
-
const
|
|
2509
|
-
let
|
|
2510
|
-
const C =
|
|
2511
|
-
if (
|
|
2522
|
+
const _ = ye.bind(V, Ge);
|
|
2523
|
+
let R = 0;
|
|
2524
|
+
const C = us(h, p, (Q, ge = {}) => {
|
|
2525
|
+
if (Q == Se.FOCUS_EVENT) {
|
|
2512
2526
|
const I = Date.now();
|
|
2513
|
-
|
|
2514
|
-
} else if (
|
|
2515
|
-
|
|
2527
|
+
O().revalidateOnFocus && I > R && x() && (R = I + O().focusThrottleInterval, _());
|
|
2528
|
+
} else if (Q == Se.RECONNECT_EVENT)
|
|
2529
|
+
O().revalidateOnReconnect && x() && _();
|
|
2516
2530
|
else {
|
|
2517
|
-
if (
|
|
2518
|
-
return
|
|
2519
|
-
if (
|
|
2520
|
-
return
|
|
2531
|
+
if (Q == Se.MUTATE_EVENT)
|
|
2532
|
+
return ye();
|
|
2533
|
+
if (Q == Se.ERROR_REVALIDATE_EVENT)
|
|
2534
|
+
return ye(ge);
|
|
2521
2535
|
}
|
|
2522
2536
|
});
|
|
2523
|
-
return S.current = !1,
|
|
2537
|
+
return S.current = !1, w.current = h, T.current = !0, X({
|
|
2524
2538
|
_k: B
|
|
2525
|
-
}),
|
|
2539
|
+
}), D && (b(Y) || be ? _() : qr(_)), () => {
|
|
2526
2540
|
S.current = !0, C();
|
|
2527
2541
|
};
|
|
2528
2542
|
}, [
|
|
2529
2543
|
h
|
|
2530
|
-
]),
|
|
2531
|
-
let
|
|
2532
|
-
function
|
|
2533
|
-
const C =
|
|
2534
|
-
C &&
|
|
2544
|
+
]), Ue(() => {
|
|
2545
|
+
let _;
|
|
2546
|
+
function R() {
|
|
2547
|
+
const C = W(u) ? u(P().data) : u;
|
|
2548
|
+
C && _ !== -1 && (_ = setTimeout(j, C));
|
|
2535
2549
|
}
|
|
2536
2550
|
function j() {
|
|
2537
|
-
!P().error && (c ||
|
|
2551
|
+
!P().error && (c || O().isVisible()) && (i || O().isOnline()) ? ye(Ge).then(R) : R();
|
|
2538
2552
|
}
|
|
2539
|
-
return
|
|
2540
|
-
|
|
2553
|
+
return R(), () => {
|
|
2554
|
+
_ && (clearTimeout(_), _ = -1);
|
|
2541
2555
|
};
|
|
2542
2556
|
}, [
|
|
2543
2557
|
u,
|
|
2544
2558
|
c,
|
|
2545
2559
|
i,
|
|
2546
2560
|
h
|
|
2547
|
-
]), gn(
|
|
2548
|
-
if (!
|
|
2561
|
+
]), gn(se), o && b(Y) && h) {
|
|
2562
|
+
if (!pt && be)
|
|
2549
2563
|
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
2550
2564
|
E.current = t, F.current = n, S.current = !1;
|
|
2551
|
-
const
|
|
2552
|
-
if (!b(
|
|
2553
|
-
const
|
|
2554
|
-
|
|
2565
|
+
const _ = v[h];
|
|
2566
|
+
if (!b(_)) {
|
|
2567
|
+
const R = rt(_);
|
|
2568
|
+
ht(R);
|
|
2555
2569
|
}
|
|
2556
2570
|
if (b(pe)) {
|
|
2557
|
-
const
|
|
2558
|
-
b(
|
|
2571
|
+
const R = ye(Ge);
|
|
2572
|
+
b(se) || (R.status = "fulfilled", R.value = !0), ht(R);
|
|
2559
2573
|
} else
|
|
2560
2574
|
throw pe;
|
|
2561
2575
|
}
|
|
2562
2576
|
return {
|
|
2563
|
-
mutate:
|
|
2577
|
+
mutate: rt,
|
|
2564
2578
|
get data() {
|
|
2565
|
-
return
|
|
2579
|
+
return re.data = !0, se;
|
|
2566
2580
|
},
|
|
2567
2581
|
get error() {
|
|
2568
|
-
return
|
|
2582
|
+
return re.error = !0, pe;
|
|
2569
2583
|
},
|
|
2570
2584
|
get isValidating() {
|
|
2571
|
-
return
|
|
2585
|
+
return re.isValidating = !0, Oe;
|
|
2572
2586
|
},
|
|
2573
2587
|
get isLoading() {
|
|
2574
|
-
return
|
|
2588
|
+
return re.isLoading = !0, cn;
|
|
2575
2589
|
}
|
|
2576
2590
|
};
|
|
2577
|
-
},
|
|
2578
|
-
function
|
|
2579
|
-
const { apiUrl: e, botToken: t } =
|
|
2591
|
+
}, ds = cs(ls);
|
|
2592
|
+
function Ts() {
|
|
2593
|
+
const { apiUrl: e, botToken: t } = le(), n = bt({
|
|
2580
2594
|
apiUrl: e,
|
|
2581
2595
|
botToken: t
|
|
2582
2596
|
});
|
|
2583
|
-
return
|
|
2597
|
+
return ds(n.options, n.apis.fetchPreludeData);
|
|
2584
2598
|
}
|
|
2585
2599
|
export {
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2600
|
+
et as A,
|
|
2601
|
+
Rs as W,
|
|
2602
|
+
ie as _,
|
|
2603
|
+
_s as a,
|
|
2604
|
+
As as b,
|
|
2605
|
+
bs as c,
|
|
2606
|
+
Es as d,
|
|
2607
|
+
Os as e,
|
|
2608
|
+
Ts as f,
|
|
2609
|
+
ws as g,
|
|
2610
|
+
Te as h,
|
|
2611
|
+
_t as i,
|
|
2612
|
+
Mt as j,
|
|
2613
|
+
Or as k,
|
|
2614
|
+
le as u
|
|
2601
2615
|
};
|
|
2602
|
-
//# sourceMappingURL=index-
|
|
2616
|
+
//# sourceMappingURL=index-C87obATS.js.map
|