@opencx/widget 2.6.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-BEtFfKMB.cjs +2 -0
- package/dist/api-BEtFfKMB.cjs.map +1 -0
- package/dist/api-Cez5T-se.js +1393 -0
- package/dist/api-Cez5T-se.js.map +1 -0
- package/dist/basic.cjs +85 -85
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +13159 -12639
- package/dist/basic.js.map +1 -1
- package/dist/core/client/api.d.ts +414 -40
- package/dist/core/client/chat.d.ts +33 -19
- package/dist/core/client/config.d.ts +13 -3
- package/dist/core/client/contact.d.ts +9 -13
- package/dist/core/client/index.d.ts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/sdk/index.d.ts +11 -0
- package/dist/core/types/contact.d.ts +2 -0
- package/dist/core/types/helpers.d.ts +5 -2
- package/dist/core/types/index.d.ts +6 -6
- package/dist/core/types/messages.d.ts +20 -9
- package/dist/core/types/schemas-v2.d.ts +10 -713
- package/dist/index-BzidnDPX.cjs +18 -0
- package/dist/index-BzidnDPX.cjs.map +1 -0
- package/dist/index-DUlnC30_.js +1219 -0
- package/dist/index-DUlnC30_.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -1071
- package/dist/index.js.map +1 -1
- package/dist/react-web/core-integration/ChatProvider.d.ts +107 -0
- package/dist/react-web/core-integration/components.d.ts +11 -0
- package/dist/react-web/core-integration/hooks/useChatMessages.d.ts +70 -0
- package/dist/react-web/core-integration/hooks/useChatSession.d.ts +83 -0
- package/dist/react-web/core-integration/hooks/useConfig.d.ts +1 -0
- package/dist/react-web/core-integration/hooks/useContact.d.ts +17 -0
- package/dist/react-web/core-integration/hooks/useLocale.d.ts +4 -0
- package/dist/react-web/core-integration/hooks/usePreludeData.d.ts +36 -0
- package/dist/react-web/core-integration/hooks/usePubsub.d.ts +2 -0
- package/dist/react-web/{hooks → core-integration/hooks}/useUploadFiles.d.ts +2 -2
- package/dist/react-web/{hooks → core-integration/hooks}/useVote.d.ts +2 -2
- package/dist/react-web/core-integration/hooks.d.ts +9 -0
- package/dist/react-web/core-integration/index.d.ts +2 -0
- package/dist/react-web/index.d.ts +4 -10
- package/dist/react-web/types/components.d.ts +6 -3
- package/dist/react-web/types/index.d.ts +3 -2
- package/dist/react-web/types/options.d.ts +4 -30
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +10 -46
- package/dist/react.js.map +1 -1
- package/dist/src/@components/BotOrAgentMessageGroup.d.ts +1 -2
- package/dist/src/@components/BotOrAgentMessageWrapper.d.ts +2 -2
- package/dist/src/@components/ChatEvent.component.d.ts +3 -3
- package/dist/src/@components/Text.component.d.ts +1 -1
- package/dist/src/components/button.d.ts +1 -1
- package/dist/src/components/dialog.d.ts +9 -9
- package/dist/src/designs/basic/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist-embed/script.js +119 -124
- package/dist-embed/script.js.map +1 -1
- package/package.json +7 -4
- package/dist/core/tests/utils/create-fetch.test.d.ts +0 -1
- package/dist/core/types/schemas.d.ts +0 -543
- package/dist/core/utils/create-fetch.d.ts +0 -25
- package/dist/core/utils/genId.d.ts +0 -2
- package/dist/core/utils/history-to-widget-messages.d.ts +0 -4
- package/dist/genUuid-C12yFv3j.js +0 -137
- package/dist/genUuid-C12yFv3j.js.map +0 -1
- package/dist/genUuid-DdeSE04H.cjs +0 -2
- package/dist/genUuid-DdeSE04H.cjs.map +0 -1
- package/dist/index-C87obATS.js +0 -2616
- package/dist/index-C87obATS.js.map +0 -1
- package/dist/index-ChwS_h0D.cjs +0 -18
- package/dist/index-ChwS_h0D.cjs.map +0 -1
- package/dist/package.json.d.ts +0 -158
- package/dist/react-web/Root.d.ts +0 -6
- package/dist/react-web/hooks/index.d.ts +0 -6
- package/dist/react-web/hooks/use-sound.d.ts +0 -13
- package/dist/react-web/hooks/use-sound.test.d.ts +0 -1
- package/dist/react-web/hooks/use-sync-state.test.d.ts +0 -1
- package/dist/react-web/hooks/useAbstractChat.d.ts +0 -157
- package/dist/react-web/hooks/useAxiosInstance.d.ts +0 -190
- package/dist/react-web/hooks/useSyncState.d.ts +0 -4
- package/dist/react-web/hooks/useTimeoutState.d.ts +0 -3
- package/dist/react-web/providers/ChatProvider.d.ts +0 -143
- package/dist/react-web/providers/ConfigDataProvider.d.ts +0 -62
- package/dist/react-web/providers/ContactProvider.d.ts +0 -58
- package/dist/react-web/providers/LocalesProvider.d.ts +0 -11
- package/dist/react-web/providers/componentRegistry.d.ts +0 -13
- package/dist/react-web/providers/use-widget-sfx.d.ts +0 -7
- package/dist/react-web/providers/usePreludeData.d.ts +0 -2
- package/dist/react-web/utils/debug.d.ts +0 -2
- package/dist/react-web/utils/getters.d.ts +0 -24
- package/dist/react-web/utils/index.d.ts +0 -1
- package/dist/src/hooks/useShouldCollectData.d.ts +0 -3
- /package/dist/react-web/{locales → core-integration/locales}/ar.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/de.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/en.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/fr.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/helper.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/index.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/nl.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/pt.locale.d.ts +0 -0
|
@@ -0,0 +1,1219 @@
|
|
|
1
|
+
var dt = Object.defineProperty;
|
|
2
|
+
var ft = (e, t, n) => t in e ? dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var He = (e, t, n) => ft(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import se, { createContext as $e, useContext as Xe, useMemo as H, useState as Ze, useEffect as de, useSyncExternalStore as gt, useLayoutEffect as pt, useRef as P, useCallback as he, useDebugValue as ht } from "react";
|
|
5
|
+
import { v4 as mt } from "uuid";
|
|
6
|
+
import { jsx as St } from "react/jsx-runtime";
|
|
7
|
+
import { b as Et, A as vt, c as yt, d as wt, i as _t } from "./api-Cez5T-se.js";
|
|
8
|
+
import { z as me } from "zod";
|
|
9
|
+
function Ct(e) {
|
|
10
|
+
const t = $e({});
|
|
11
|
+
return [() => {
|
|
12
|
+
const i = Xe(t);
|
|
13
|
+
if (i === void 0)
|
|
14
|
+
throw new Error("useSafeContext must be used within a Provider");
|
|
15
|
+
return i;
|
|
16
|
+
}, t.Provider];
|
|
17
|
+
}
|
|
18
|
+
class bt {
|
|
19
|
+
constructor(t) {
|
|
20
|
+
He(this, "components", [
|
|
21
|
+
{
|
|
22
|
+
key: "fallback",
|
|
23
|
+
component: (t) => "fallback"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: "loading",
|
|
27
|
+
component: (t) => "loading"
|
|
28
|
+
}
|
|
29
|
+
]);
|
|
30
|
+
const { components: n } = t;
|
|
31
|
+
if (n && n.forEach((i) => this.register(i)), this.components.length === 0)
|
|
32
|
+
throw new Error("No components registered");
|
|
33
|
+
if (!this.get("fallback"))
|
|
34
|
+
throw new Error("No fallback component registered");
|
|
35
|
+
}
|
|
36
|
+
register(t) {
|
|
37
|
+
const n = this.components.findIndex((i) => i.key === t.key);
|
|
38
|
+
return n !== -1 ? this.components[n] = t : this.components.push(t), this;
|
|
39
|
+
}
|
|
40
|
+
get(t) {
|
|
41
|
+
const n = this.components.find(
|
|
42
|
+
(i) => i.key.toUpperCase() === t.toUpperCase()
|
|
43
|
+
);
|
|
44
|
+
return n || null;
|
|
45
|
+
}
|
|
46
|
+
getOrFallback(t) {
|
|
47
|
+
return t ? this.get(t) || this.get("fallback") : this.get("fallback");
|
|
48
|
+
}
|
|
49
|
+
getComponent(t, n) {
|
|
50
|
+
var i;
|
|
51
|
+
return n ? this.getOrFallback(t).component : (i = this.get(t)) == null ? void 0 : i.component;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const Ot = {
|
|
55
|
+
ok: "حسنا",
|
|
56
|
+
yes: "نعم",
|
|
57
|
+
no: "لا",
|
|
58
|
+
agree: "موافق",
|
|
59
|
+
cancel: "إلغاء",
|
|
60
|
+
"yes-exit": "نعم، اخرج",
|
|
61
|
+
"yes-reset": "نعم، إعادة تعيين",
|
|
62
|
+
"no-cancel": "لا، إلغاء",
|
|
63
|
+
"are-you-sure": "هل أنت متأكد؟",
|
|
64
|
+
recording: "تسجيل",
|
|
65
|
+
"thank-you": "شكرا",
|
|
66
|
+
"sorry-try-again": "عذرا، حاول مرة أخرى",
|
|
67
|
+
"error-occurred": "حدث خطأ",
|
|
68
|
+
"please-try-again": "يرجى المحاولة مرة أخرى",
|
|
69
|
+
"write-a-message": "اكتب رسالة...",
|
|
70
|
+
"send-message": "إرسال رسالة",
|
|
71
|
+
connected: "متصل",
|
|
72
|
+
connecting: "جاري الاتصال",
|
|
73
|
+
reconnecting: "جاري إعادة الاتصال",
|
|
74
|
+
reconnected: "تم إعادة الاتصال",
|
|
75
|
+
disconnecting: "جاري قطع الاتصال",
|
|
76
|
+
disconnected: "قطع الاتصال",
|
|
77
|
+
error: "خطأ",
|
|
78
|
+
"persist-session": "حفظ الجلسة",
|
|
79
|
+
settings: "إعدادات",
|
|
80
|
+
close: "إغلاق",
|
|
81
|
+
help: "مساعدة",
|
|
82
|
+
chat: "محادثة",
|
|
83
|
+
send: "إرسال",
|
|
84
|
+
copy: "نسخ",
|
|
85
|
+
copied: "تم النسخ",
|
|
86
|
+
"sound-effects": "التاثيرات الصوتية",
|
|
87
|
+
language: "اللغة",
|
|
88
|
+
select: "اختر",
|
|
89
|
+
agent: "الوكيل",
|
|
90
|
+
user: "المستخدم",
|
|
91
|
+
bot: "البوت",
|
|
92
|
+
"reset-conversation-confirm": "هل أنت متأكد من أنك تريد إعادة تعيين المحادثة؟",
|
|
93
|
+
"close-widget": "إغلاق الودجة",
|
|
94
|
+
"got-any-questions": "هل لديك أي أسئلة؟ تحدث معنا!",
|
|
95
|
+
"typical-response-time": "عادة ما نرد في أقل من دقيقة واحدة",
|
|
96
|
+
"session-closed-lead": "تم حل مشكلتك!",
|
|
97
|
+
exit: "خروج",
|
|
98
|
+
"create-new-ticket": "إنشاء تذكرة جديدة",
|
|
99
|
+
"reset-conversation": "إعادة تعيين المحادثة",
|
|
100
|
+
"welcome-title": "مرحبًا بك في دردشة الدعم الخاصة بنا",
|
|
101
|
+
"welcome-description": "نحن هنا للمساعدة! ابدأ محادثة وسنرد عليك في أقرب وقت ممكن.",
|
|
102
|
+
"your-name": "اسمك",
|
|
103
|
+
"your-email": "عنوان بريدك الإلكتروني",
|
|
104
|
+
"start-chat": "تحدث إلى الدعم",
|
|
105
|
+
"starting-chat": "جاري الاتصال...",
|
|
106
|
+
"hello-greeting": "مرحبًا! كيف يمكننا مساعدتك اليوم؟"
|
|
107
|
+
}, Rt = {
|
|
108
|
+
ok: "OK",
|
|
109
|
+
yes: "Ja",
|
|
110
|
+
no: "Nein",
|
|
111
|
+
agree: "Zustimmen",
|
|
112
|
+
cancel: "Stornieren",
|
|
113
|
+
"yes-exit": "Ja, beenden",
|
|
114
|
+
"yes-reset": "Ja, zurücksetzen",
|
|
115
|
+
"no-cancel": "Nein, abbrechen",
|
|
116
|
+
"are-you-sure": "Sind Sie sicher?",
|
|
117
|
+
recording: "Aufnahme läuft",
|
|
118
|
+
"thank-you": "Vielen Dank",
|
|
119
|
+
"sorry-try-again": "Entschuldigung, bitte versuchen Sie es erneut",
|
|
120
|
+
"error-occurred": "Ein Fehler ist aufgetreten",
|
|
121
|
+
"please-try-again": "Bitte versuchen Sie es erneut",
|
|
122
|
+
"write-a-message": "Nachricht schreiben...",
|
|
123
|
+
"send-message": "Nachricht senden",
|
|
124
|
+
connected: "Verbunden",
|
|
125
|
+
connecting: "Verbindung wird hergestellt",
|
|
126
|
+
reconnecting: "Verbindung wird wiederhergestellt",
|
|
127
|
+
reconnected: "Wieder verbunden",
|
|
128
|
+
disconnecting: "Verbindung wird getrennt",
|
|
129
|
+
disconnected: "Verbindung getrennt",
|
|
130
|
+
error: "Fehler",
|
|
131
|
+
"persist-session": "Sitzung beibehalten",
|
|
132
|
+
settings: "Einstellungen",
|
|
133
|
+
close: "Schließen",
|
|
134
|
+
help: "Hilfe",
|
|
135
|
+
chat: "Chat",
|
|
136
|
+
send: "Senden",
|
|
137
|
+
copy: "Kopieren",
|
|
138
|
+
copied: "Kopiert",
|
|
139
|
+
"sound-effects": "Soundeffekte",
|
|
140
|
+
language: "Sprache",
|
|
141
|
+
select: "Auswählen",
|
|
142
|
+
agent: "Agent",
|
|
143
|
+
user: "Benutzer",
|
|
144
|
+
bot: "Bot",
|
|
145
|
+
"got-any-questions": "Haben Sie Fragen? Chatten Sie mit uns!",
|
|
146
|
+
"typical-response-time": "Üblicherweise antworten wir in weniger als 1 Minute",
|
|
147
|
+
"reset-conversation-confirm": "Möchten Sie die Konversation wirklich zurücksetzen?",
|
|
148
|
+
"close-widget": "Widget schließen",
|
|
149
|
+
"session-closed-lead": "Ihr Problem wurde gelöst!",
|
|
150
|
+
"create-new-ticket": "Neues Ticket erstellen",
|
|
151
|
+
exit: "Beenden",
|
|
152
|
+
"reset-conversation": "Konversation zurücksetzen",
|
|
153
|
+
"welcome-title": "Willkommen in unserem Support-Chat",
|
|
154
|
+
"welcome-description": "Wir sind hier, um zu helfen! Beginnen Sie ein Gespräch und wir werden so schnell wie möglich antworten.",
|
|
155
|
+
"your-name": "Ihr Name",
|
|
156
|
+
"your-email": "Ihre E-Mail-Adresse",
|
|
157
|
+
"start-chat": "Mit dem Support sprechen",
|
|
158
|
+
"starting-chat": "Verbindung wird hergestellt...",
|
|
159
|
+
"hello-greeting": "Hallo! Wie können wir Ihnen heute helfen?"
|
|
160
|
+
}, Tt = {
|
|
161
|
+
ok: "OK",
|
|
162
|
+
yes: "Yes",
|
|
163
|
+
no: "No",
|
|
164
|
+
agree: "Agree",
|
|
165
|
+
cancel: "Cancel",
|
|
166
|
+
"yes-exit": "Yes, exit",
|
|
167
|
+
"yes-reset": "Yes, reset",
|
|
168
|
+
"no-cancel": "No, cancel",
|
|
169
|
+
"are-you-sure": "Are you sure?",
|
|
170
|
+
recording: "Recording...",
|
|
171
|
+
"thank-you": "Thank you",
|
|
172
|
+
"sorry-try-again": "Sorry, please try again",
|
|
173
|
+
"error-occurred": "An error occurred",
|
|
174
|
+
"please-try-again": "Please try again",
|
|
175
|
+
"write-a-message": "Write a message...",
|
|
176
|
+
"send-message": "Send message",
|
|
177
|
+
connected: "Connected",
|
|
178
|
+
connecting: "Connecting",
|
|
179
|
+
reconnecting: "Reconnecting",
|
|
180
|
+
reconnected: "Reconnected",
|
|
181
|
+
disconnecting: "Disconnecting",
|
|
182
|
+
disconnected: "Disconnected",
|
|
183
|
+
error: "Error",
|
|
184
|
+
"persist-session": "Persist session",
|
|
185
|
+
settings: "Settings",
|
|
186
|
+
close: "Close",
|
|
187
|
+
help: "Help",
|
|
188
|
+
chat: "Chat",
|
|
189
|
+
send: "Send",
|
|
190
|
+
copy: "Copy",
|
|
191
|
+
copied: "Copied",
|
|
192
|
+
"sound-effects": "Sound effects",
|
|
193
|
+
language: "Language",
|
|
194
|
+
select: "Select",
|
|
195
|
+
agent: "Agent",
|
|
196
|
+
user: "User",
|
|
197
|
+
bot: "Bot",
|
|
198
|
+
"reset-conversation-confirm": "Are you sure you want to reset the conversation?",
|
|
199
|
+
"close-widget": "Close widget",
|
|
200
|
+
"got-any-questions": "Got any questions? Chat with us!",
|
|
201
|
+
"typical-response-time": "Typically respond in less than 1 minute",
|
|
202
|
+
"session-closed-lead": "Your issue has been resolved!",
|
|
203
|
+
"create-new-ticket": "Create new ticket",
|
|
204
|
+
exit: "Exit",
|
|
205
|
+
"reset-conversation": "Reset conversation",
|
|
206
|
+
"welcome-title": "Welcome to our support chat",
|
|
207
|
+
"welcome-description": "We're here to help! Start a conversation and we'll get back to you as soon as possible.",
|
|
208
|
+
"your-name": "Your name",
|
|
209
|
+
"your-email": "Your email address",
|
|
210
|
+
"start-chat": "Talk to support",
|
|
211
|
+
"starting-chat": "Connecting...",
|
|
212
|
+
"hello-greeting": "Hi there!"
|
|
213
|
+
}, At = {
|
|
214
|
+
ok: "D'accord",
|
|
215
|
+
yes: "Oui",
|
|
216
|
+
no: "Non",
|
|
217
|
+
agree: "Accepter",
|
|
218
|
+
cancel: "Annuler",
|
|
219
|
+
"yes-exit": "Oui, quitter",
|
|
220
|
+
"yes-reset": "Oui, réinitialiser",
|
|
221
|
+
"no-cancel": "Non, annuler",
|
|
222
|
+
"are-you-sure": "Êtes-vous sûr ?",
|
|
223
|
+
recording: "Enregistrement...",
|
|
224
|
+
"thank-you": "Merci",
|
|
225
|
+
"sorry-try-again": "Désolé, veuillez réessayer",
|
|
226
|
+
"error-occurred": "Une erreur s'est produite",
|
|
227
|
+
"please-try-again": "Veuillez réessayer",
|
|
228
|
+
"write-a-message": "Écrivez un message...",
|
|
229
|
+
"send-message": "Envoyer le message",
|
|
230
|
+
connected: "Connecté",
|
|
231
|
+
connecting: "Connexion en cours",
|
|
232
|
+
reconnecting: "Reconnexion en cours",
|
|
233
|
+
reconnected: "Reconnecté",
|
|
234
|
+
disconnecting: "Déconnexion en cours",
|
|
235
|
+
disconnected: "Déconnecté",
|
|
236
|
+
error: "Erreur",
|
|
237
|
+
"persist-session": "Conserver la session",
|
|
238
|
+
settings: "Paramètres",
|
|
239
|
+
close: "Fermer",
|
|
240
|
+
help: "Aide",
|
|
241
|
+
chat: "Chat",
|
|
242
|
+
send: "Envoyer",
|
|
243
|
+
copy: "Copier",
|
|
244
|
+
copied: "Copié",
|
|
245
|
+
"sound-effects": "Effets sonores",
|
|
246
|
+
language: "Langue",
|
|
247
|
+
select: "Sélectionner",
|
|
248
|
+
agent: "Agent",
|
|
249
|
+
user: "Utilisateur",
|
|
250
|
+
bot: "Bot",
|
|
251
|
+
"reset-conversation-confirm": "Êtes-vous sûr de vouloir réinitialiser la conversation ?",
|
|
252
|
+
"close-widget": "Fermer le widget",
|
|
253
|
+
"got-any-questions": "Vous avez des questions ? Chattez avec nous !",
|
|
254
|
+
"typical-response-time": "Nous répondons généralement en moins d'une minute",
|
|
255
|
+
"session-closed-lead": "Votre problème a été résolu !",
|
|
256
|
+
"create-new-ticket": "Créer un nouveau ticket",
|
|
257
|
+
exit: "Sortie",
|
|
258
|
+
"reset-conversation": "Réinitialiser la conversation",
|
|
259
|
+
"welcome-title": "Bienvenue dans notre chat de support",
|
|
260
|
+
"welcome-description": "Nous sommes là pour vous aider ! Commencez une conversation et nous vous répondrons dès que possible.",
|
|
261
|
+
"your-name": "Votre nom",
|
|
262
|
+
"your-email": "Votre adresse e-mail",
|
|
263
|
+
"start-chat": "Parler au support",
|
|
264
|
+
"starting-chat": "Connexion...",
|
|
265
|
+
"hello-greeting": "Bonjour ! Comment pouvons-nous vous aider aujourd'hui ?"
|
|
266
|
+
}, Dt = {
|
|
267
|
+
ok: "OK",
|
|
268
|
+
yes: "Ja",
|
|
269
|
+
no: "Nee",
|
|
270
|
+
agree: "Akkoord",
|
|
271
|
+
cancel: "Annuleren",
|
|
272
|
+
"yes-exit": "Ja, afsluiten",
|
|
273
|
+
"yes-reset": "Ja, resetten",
|
|
274
|
+
"no-cancel": "Nee, annuleren",
|
|
275
|
+
"are-you-sure": "Weet u het zeker?",
|
|
276
|
+
recording: "Opname...",
|
|
277
|
+
"thank-you": "Dank u",
|
|
278
|
+
"sorry-try-again": "Sorry, probeer het opnieuw",
|
|
279
|
+
"error-occurred": "Er is een fout opgetreden",
|
|
280
|
+
"please-try-again": "Probeer het opnieuw",
|
|
281
|
+
"write-a-message": "Schrijf een bericht...",
|
|
282
|
+
"send-message": "Bericht verzenden",
|
|
283
|
+
connected: "Verbonden",
|
|
284
|
+
connecting: "Verbinding maken",
|
|
285
|
+
reconnecting: "Opnieuw verbinding maken",
|
|
286
|
+
reconnected: "Opnieuw verbonden",
|
|
287
|
+
disconnecting: "Verbinding verbreken",
|
|
288
|
+
disconnected: "Verbinding verbroken",
|
|
289
|
+
error: "Fout",
|
|
290
|
+
"persist-session": "Sessie behouden",
|
|
291
|
+
settings: "Instellingen",
|
|
292
|
+
close: "Sluiten",
|
|
293
|
+
help: "Help",
|
|
294
|
+
chat: "Chat",
|
|
295
|
+
send: "Verzenden",
|
|
296
|
+
copy: "Kopiëren",
|
|
297
|
+
copied: "Gekopieerd",
|
|
298
|
+
"sound-effects": "Geluidseffecten",
|
|
299
|
+
language: "Taal",
|
|
300
|
+
select: "Selecteren",
|
|
301
|
+
agent: "Agent",
|
|
302
|
+
user: "Gebruiker",
|
|
303
|
+
bot: "Bot",
|
|
304
|
+
"reset-conversation-confirm": "Weet u zeker dat u het gesprek wilt resetten?",
|
|
305
|
+
"close-widget": "Widget sluiten",
|
|
306
|
+
"got-any-questions": "Heeft u vragen? Chat met ons!",
|
|
307
|
+
"typical-response-time": "We reageren doorgaans binnen 1 minuut",
|
|
308
|
+
"session-closed-lead": "Uw probleem is opgelost!",
|
|
309
|
+
"create-new-ticket": "Nieuw ticket aanmaken",
|
|
310
|
+
exit: "Afsluiten",
|
|
311
|
+
"reset-conversation": "Gesprek resetten",
|
|
312
|
+
"welcome-title": "Welkom bij onze supportchat",
|
|
313
|
+
"welcome-description": "We zijn hier om te helpen! Begin een gesprek en we nemen zo snel mogelijk contact met u op.",
|
|
314
|
+
"your-name": "Uw naam",
|
|
315
|
+
"your-email": "Uw e-mailadres",
|
|
316
|
+
"start-chat": "Praat met ondersteuning",
|
|
317
|
+
"starting-chat": "Verbinding maken...",
|
|
318
|
+
"hello-greeting": "Hallo! Hoe kunnen we u vandaag helpen?"
|
|
319
|
+
}, Vt = {
|
|
320
|
+
ok: "OK",
|
|
321
|
+
yes: "Sim",
|
|
322
|
+
no: "Não",
|
|
323
|
+
agree: "Concordo",
|
|
324
|
+
cancel: "Cancelar",
|
|
325
|
+
"yes-exit": "Sim, sair",
|
|
326
|
+
"yes-reset": "Sim, redefinir",
|
|
327
|
+
"no-cancel": "Não, cancelar",
|
|
328
|
+
"are-you-sure": "Você tem certeza?",
|
|
329
|
+
recording: "Gravando...",
|
|
330
|
+
"thank-you": "Obrigado",
|
|
331
|
+
"sorry-try-again": "Desculpe, tente novamente",
|
|
332
|
+
"error-occurred": "Ocorreu um erro",
|
|
333
|
+
"please-try-again": "Por favor, tente novamente",
|
|
334
|
+
"write-a-message": "Escreva uma mensagem...",
|
|
335
|
+
"send-message": "Enviar mensagem",
|
|
336
|
+
connected: "Conectado",
|
|
337
|
+
connecting: "Conectando",
|
|
338
|
+
reconnecting: "Reconectando",
|
|
339
|
+
reconnected: "Reconectado",
|
|
340
|
+
disconnecting: "Desconectando",
|
|
341
|
+
disconnected: "Desconectado",
|
|
342
|
+
error: "Erro",
|
|
343
|
+
"persist-session": "Persistir sessão",
|
|
344
|
+
settings: "Configurações",
|
|
345
|
+
close: "Fechar",
|
|
346
|
+
help: "Ajuda",
|
|
347
|
+
chat: "Bate-papo",
|
|
348
|
+
send: "Enviar",
|
|
349
|
+
copy: "Copiar",
|
|
350
|
+
copied: "Copiado",
|
|
351
|
+
"sound-effects": "Efeitos sonoros",
|
|
352
|
+
language: "Idioma",
|
|
353
|
+
select: "Selecionar",
|
|
354
|
+
agent: "Agente",
|
|
355
|
+
user: "Usuário",
|
|
356
|
+
bot: "Bot",
|
|
357
|
+
"reset-conversation-confirm": "Você tem certeza de que deseja redefinir a conversa?",
|
|
358
|
+
"close-widget": "Fechar widget",
|
|
359
|
+
"got-any-questions": "Tem alguma dúvida? Converse conosco!",
|
|
360
|
+
"typical-response-time": "Geralmente respondemos em menos de 1 minuto",
|
|
361
|
+
"session-closed-lead": "Seu problema foi resolvido!",
|
|
362
|
+
"create-new-ticket": "Criar novo ticket",
|
|
363
|
+
exit: "Sair",
|
|
364
|
+
"reset-conversation": "Redefinir conversa",
|
|
365
|
+
"welcome-title": "Bem-vindo ao nosso chat de suporte",
|
|
366
|
+
"welcome-description": "Estamos aqui para ajudar! Inicie uma conversa e responderemos o mais rápido possível.",
|
|
367
|
+
"your-name": "Seu nome",
|
|
368
|
+
"your-email": "Seu endereço de email",
|
|
369
|
+
"start-chat": "Falar com o suporte",
|
|
370
|
+
"starting-chat": "Conectando...",
|
|
371
|
+
"hello-greeting": "Olá! Como podemos ajudar você hoje?"
|
|
372
|
+
}, Lt = {
|
|
373
|
+
en: Tt,
|
|
374
|
+
ar: Ot,
|
|
375
|
+
nl: Dt,
|
|
376
|
+
fr: At,
|
|
377
|
+
de: Rt,
|
|
378
|
+
pt: Vt
|
|
379
|
+
};
|
|
380
|
+
function kt(e, t) {
|
|
381
|
+
const n = Lt[t];
|
|
382
|
+
return n && n[e] || "";
|
|
383
|
+
}
|
|
384
|
+
const xt = {
|
|
385
|
+
getItem: async (e) => localStorage.getItem(e),
|
|
386
|
+
setItem: async (e, t) => localStorage.setItem(e, t),
|
|
387
|
+
removeItem: async (e) => localStorage.removeItem(e),
|
|
388
|
+
isAvailable: () => !0
|
|
389
|
+
}, ce = {
|
|
390
|
+
env: {
|
|
391
|
+
platform: "web"
|
|
392
|
+
},
|
|
393
|
+
storage: xt,
|
|
394
|
+
logger: wt({ level: "debug" })
|
|
395
|
+
}, It = me.object({
|
|
396
|
+
persistSession: me.boolean().optional(),
|
|
397
|
+
useSoundEffects: me.boolean().optional()
|
|
398
|
+
});
|
|
399
|
+
function Nt({
|
|
400
|
+
options: e,
|
|
401
|
+
platform: t
|
|
402
|
+
}) {
|
|
403
|
+
var f, C;
|
|
404
|
+
const [n, i] = Ze({
|
|
405
|
+
persistSession: ((f = e.settings) == null ? void 0 : f.persistSession) ?? !1,
|
|
406
|
+
useSoundEffects: ((C = e.settings) == null ? void 0 : C.useSoundEffects) ?? !1
|
|
407
|
+
}), o = H(() => {
|
|
408
|
+
var s;
|
|
409
|
+
return {
|
|
410
|
+
env: {
|
|
411
|
+
platform: ((s = t == null ? void 0 : t.env) == null ? void 0 : s.platform) ?? ce.env.platform
|
|
412
|
+
},
|
|
413
|
+
storage: (t == null ? void 0 : t.storage) ?? ce.storage,
|
|
414
|
+
logger: (t == null ? void 0 : t.logger) ?? ce.logger,
|
|
415
|
+
audio: (t == null ? void 0 : t.audio) ?? ce.audio
|
|
416
|
+
};
|
|
417
|
+
}, [t]), a = H(() => Et(
|
|
418
|
+
{
|
|
419
|
+
...e,
|
|
420
|
+
settings: n
|
|
421
|
+
},
|
|
422
|
+
o
|
|
423
|
+
), [e, o, n]);
|
|
424
|
+
de(() => {
|
|
425
|
+
(async () => {
|
|
426
|
+
if (_t(o.storage))
|
|
427
|
+
try {
|
|
428
|
+
const r = await o.storage.getItem(
|
|
429
|
+
`${e.token}:settings`
|
|
430
|
+
);
|
|
431
|
+
if (r) {
|
|
432
|
+
const c = It.parse(
|
|
433
|
+
JSON.parse(r)
|
|
434
|
+
);
|
|
435
|
+
i((l) => ({
|
|
436
|
+
...l,
|
|
437
|
+
...c
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
} catch (r) {
|
|
441
|
+
console.error("Failed to load settings:", r);
|
|
442
|
+
}
|
|
443
|
+
})();
|
|
444
|
+
}, [o.storage, e.token]);
|
|
445
|
+
const d = H(() => new vt({
|
|
446
|
+
config: a.getConfig()
|
|
447
|
+
}), [a.config]), g = H(() => yt({
|
|
448
|
+
api: d,
|
|
449
|
+
config: a,
|
|
450
|
+
platform: o
|
|
451
|
+
}), [a, o, d]);
|
|
452
|
+
return de(() => () => {
|
|
453
|
+
g.cleanup();
|
|
454
|
+
}, [g]), {
|
|
455
|
+
config: a,
|
|
456
|
+
chat: g,
|
|
457
|
+
api: d,
|
|
458
|
+
widgetSettings: n,
|
|
459
|
+
setWidgetSettings: i
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
const [J, Ft] = Ct();
|
|
463
|
+
function bn({
|
|
464
|
+
options: e,
|
|
465
|
+
children: t,
|
|
466
|
+
components: n,
|
|
467
|
+
platform: i
|
|
468
|
+
}) {
|
|
469
|
+
const o = Nt({ options: e, platform: i }), a = H(
|
|
470
|
+
() => new bt({
|
|
471
|
+
components: n
|
|
472
|
+
}),
|
|
473
|
+
[n]
|
|
474
|
+
), d = H(() => {
|
|
475
|
+
const g = o.config.getConfig();
|
|
476
|
+
return {
|
|
477
|
+
get: (f, C) => kt(f, g.language) + (C ?? ""),
|
|
478
|
+
lang: g.language
|
|
479
|
+
};
|
|
480
|
+
}, [o.config.getConfig().language]);
|
|
481
|
+
return /* @__PURE__ */ St(
|
|
482
|
+
Ft,
|
|
483
|
+
{
|
|
484
|
+
value: {
|
|
485
|
+
...o,
|
|
486
|
+
componentStore: a,
|
|
487
|
+
version: void 0,
|
|
488
|
+
locale: d
|
|
489
|
+
},
|
|
490
|
+
children: t
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
function Ve(e) {
|
|
495
|
+
return gt(e.subscribe, e.getState, e.getState);
|
|
496
|
+
}
|
|
497
|
+
function On() {
|
|
498
|
+
const { chat: e } = J();
|
|
499
|
+
return { chatState: Ve(e.chatState), chat: e };
|
|
500
|
+
}
|
|
501
|
+
function Rn() {
|
|
502
|
+
const { chat: e } = J(), t = Ve(e.sessionState);
|
|
503
|
+
return {
|
|
504
|
+
chat: e,
|
|
505
|
+
chatSession: t
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function Ut() {
|
|
509
|
+
const { config: e } = J();
|
|
510
|
+
return e;
|
|
511
|
+
}
|
|
512
|
+
var be = { exports: {} }, Se = {};
|
|
513
|
+
/**
|
|
514
|
+
* @license React
|
|
515
|
+
* use-sync-external-store-shim.production.min.js
|
|
516
|
+
*
|
|
517
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
518
|
+
*
|
|
519
|
+
* This source code is licensed under the MIT license found in the
|
|
520
|
+
* LICENSE file in the root directory of this source tree.
|
|
521
|
+
*/
|
|
522
|
+
var je;
|
|
523
|
+
function Wt() {
|
|
524
|
+
if (je) return Se;
|
|
525
|
+
je = 1;
|
|
526
|
+
var e = se;
|
|
527
|
+
function t(r, c) {
|
|
528
|
+
return r === c && (r !== 0 || 1 / r === 1 / c) || r !== r && c !== c;
|
|
529
|
+
}
|
|
530
|
+
var n = typeof Object.is == "function" ? Object.is : t, i = e.useState, o = e.useEffect, a = e.useLayoutEffect, d = e.useDebugValue;
|
|
531
|
+
function g(r, c) {
|
|
532
|
+
var l = c(), O = i({ inst: { value: l, getSnapshot: c } }), p = O[0].inst, U = O[1];
|
|
533
|
+
return a(function() {
|
|
534
|
+
p.value = l, p.getSnapshot = c, f(p) && U({ inst: p });
|
|
535
|
+
}, [r, l, c]), o(function() {
|
|
536
|
+
return f(p) && U({ inst: p }), r(function() {
|
|
537
|
+
f(p) && U({ inst: p });
|
|
538
|
+
});
|
|
539
|
+
}, [r]), d(l), l;
|
|
540
|
+
}
|
|
541
|
+
function f(r) {
|
|
542
|
+
var c = r.getSnapshot;
|
|
543
|
+
r = r.value;
|
|
544
|
+
try {
|
|
545
|
+
var l = c();
|
|
546
|
+
return !n(r, l);
|
|
547
|
+
} catch {
|
|
548
|
+
return !0;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
function C(r, c) {
|
|
552
|
+
return c();
|
|
553
|
+
}
|
|
554
|
+
var s = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? C : g;
|
|
555
|
+
return Se.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : s, Se;
|
|
556
|
+
}
|
|
557
|
+
var Ee = {};
|
|
558
|
+
/**
|
|
559
|
+
* @license React
|
|
560
|
+
* use-sync-external-store-shim.development.js
|
|
561
|
+
*
|
|
562
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
563
|
+
*
|
|
564
|
+
* This source code is licensed under the MIT license found in the
|
|
565
|
+
* LICENSE file in the root directory of this source tree.
|
|
566
|
+
*/
|
|
567
|
+
var Ge;
|
|
568
|
+
function Mt() {
|
|
569
|
+
return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && function() {
|
|
570
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
571
|
+
var e = se, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
572
|
+
function n(_) {
|
|
573
|
+
{
|
|
574
|
+
for (var m = arguments.length, E = new Array(m > 1 ? m - 1 : 0), S = 1; S < m; S++)
|
|
575
|
+
E[S - 1] = arguments[S];
|
|
576
|
+
i("error", _, E);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function i(_, m, E) {
|
|
580
|
+
{
|
|
581
|
+
var S = t.ReactDebugCurrentFrame, k = S.getStackAddendum();
|
|
582
|
+
k !== "" && (m += "%s", E = E.concat([k]));
|
|
583
|
+
var v = E.map(function(R) {
|
|
584
|
+
return String(R);
|
|
585
|
+
});
|
|
586
|
+
v.unshift("Warning: " + m), Function.prototype.apply.call(console[_], console, v);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
function o(_, m) {
|
|
590
|
+
return _ === m && (_ !== 0 || 1 / _ === 1 / m) || _ !== _ && m !== m;
|
|
591
|
+
}
|
|
592
|
+
var a = typeof Object.is == "function" ? Object.is : o, d = e.useState, g = e.useEffect, f = e.useLayoutEffect, C = e.useDebugValue, s = !1, r = !1;
|
|
593
|
+
function c(_, m, E) {
|
|
594
|
+
s || e.startTransition !== void 0 && (s = !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."));
|
|
595
|
+
var S = m();
|
|
596
|
+
if (!r) {
|
|
597
|
+
var k = m();
|
|
598
|
+
a(S, k) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), r = !0);
|
|
599
|
+
}
|
|
600
|
+
var v = d({
|
|
601
|
+
inst: {
|
|
602
|
+
value: S,
|
|
603
|
+
getSnapshot: m
|
|
604
|
+
}
|
|
605
|
+
}), R = v[0].inst, V = v[1];
|
|
606
|
+
return f(function() {
|
|
607
|
+
R.value = S, R.getSnapshot = m, l(R) && V({
|
|
608
|
+
inst: R
|
|
609
|
+
});
|
|
610
|
+
}, [_, S, m]), g(function() {
|
|
611
|
+
l(R) && V({
|
|
612
|
+
inst: R
|
|
613
|
+
});
|
|
614
|
+
var q = function() {
|
|
615
|
+
l(R) && V({
|
|
616
|
+
inst: R
|
|
617
|
+
});
|
|
618
|
+
};
|
|
619
|
+
return _(q);
|
|
620
|
+
}, [_]), C(S), S;
|
|
621
|
+
}
|
|
622
|
+
function l(_) {
|
|
623
|
+
var m = _.getSnapshot, E = _.value;
|
|
624
|
+
try {
|
|
625
|
+
var S = m();
|
|
626
|
+
return !a(E, S);
|
|
627
|
+
} catch {
|
|
628
|
+
return !0;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function O(_, m, E) {
|
|
632
|
+
return m();
|
|
633
|
+
}
|
|
634
|
+
var p = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", U = !p, u = U ? O : c, Y = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u;
|
|
635
|
+
Ee.useSyncExternalStore = Y, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
636
|
+
}()), Ee;
|
|
637
|
+
}
|
|
638
|
+
process.env.NODE_ENV === "production" ? be.exports = Wt() : be.exports = Mt();
|
|
639
|
+
var zt = be.exports;
|
|
640
|
+
const j = () => {
|
|
641
|
+
}, L = (
|
|
642
|
+
/*#__NOINLINE__*/
|
|
643
|
+
j()
|
|
644
|
+
), ve = Object, h = (e) => e === L, F = (e) => typeof e == "function", G = (e, t) => ({
|
|
645
|
+
...e,
|
|
646
|
+
...t
|
|
647
|
+
}), qt = (e) => F(e.then), ue = /* @__PURE__ */ new WeakMap();
|
|
648
|
+
let Bt = 0;
|
|
649
|
+
const re = (e) => {
|
|
650
|
+
const t = typeof e, n = e && e.constructor, i = n == Date;
|
|
651
|
+
let o, a;
|
|
652
|
+
if (ve(e) === e && !i && n != RegExp) {
|
|
653
|
+
if (o = ue.get(e), o) return o;
|
|
654
|
+
if (o = ++Bt + "~", ue.set(e, o), n == Array) {
|
|
655
|
+
for (o = "@", a = 0; a < e.length; a++)
|
|
656
|
+
o += re(e[a]) + ",";
|
|
657
|
+
ue.set(e, o);
|
|
658
|
+
}
|
|
659
|
+
if (n == ve) {
|
|
660
|
+
o = "#";
|
|
661
|
+
const d = ve.keys(e).sort();
|
|
662
|
+
for (; !h(a = d.pop()); )
|
|
663
|
+
h(e[a]) || (o += a + ":" + re(e[a]) + ",");
|
|
664
|
+
ue.set(e, o);
|
|
665
|
+
}
|
|
666
|
+
} else
|
|
667
|
+
o = i ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
668
|
+
return o;
|
|
669
|
+
}, z = /* @__PURE__ */ new WeakMap(), ye = {}, le = {}, Le = "undefined", fe = typeof window != Le, Oe = typeof document != Le, Ht = () => fe && typeof window.requestAnimationFrame != Le, Qe = (e, t) => {
|
|
670
|
+
const n = z.get(e);
|
|
671
|
+
return [
|
|
672
|
+
// Getter
|
|
673
|
+
() => !h(t) && e.get(t) || ye,
|
|
674
|
+
// Setter
|
|
675
|
+
(i) => {
|
|
676
|
+
if (!h(t)) {
|
|
677
|
+
const o = e.get(t);
|
|
678
|
+
t in le || (le[t] = o), n[5](t, G(o, i), o || ye);
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
// Subscriber
|
|
682
|
+
n[6],
|
|
683
|
+
// Get server cache snapshot
|
|
684
|
+
() => !h(t) && t in le ? le[t] : !h(t) && e.get(t) || ye
|
|
685
|
+
];
|
|
686
|
+
};
|
|
687
|
+
let Re = !0;
|
|
688
|
+
const jt = () => Re, [Te, Ae] = fe && window.addEventListener ? [
|
|
689
|
+
window.addEventListener.bind(window),
|
|
690
|
+
window.removeEventListener.bind(window)
|
|
691
|
+
] : [
|
|
692
|
+
j,
|
|
693
|
+
j
|
|
694
|
+
], Gt = () => {
|
|
695
|
+
const e = Oe && document.visibilityState;
|
|
696
|
+
return h(e) || e !== "hidden";
|
|
697
|
+
}, Kt = (e) => (Oe && document.addEventListener("visibilitychange", e), Te("focus", e), () => {
|
|
698
|
+
Oe && document.removeEventListener("visibilitychange", e), Ae("focus", e);
|
|
699
|
+
}), Pt = (e) => {
|
|
700
|
+
const t = () => {
|
|
701
|
+
Re = !0, e();
|
|
702
|
+
}, n = () => {
|
|
703
|
+
Re = !1;
|
|
704
|
+
};
|
|
705
|
+
return Te("online", t), Te("offline", n), () => {
|
|
706
|
+
Ae("online", t), Ae("offline", n);
|
|
707
|
+
};
|
|
708
|
+
}, Jt = {
|
|
709
|
+
isOnline: jt,
|
|
710
|
+
isVisible: Gt
|
|
711
|
+
}, Yt = {
|
|
712
|
+
initFocus: Kt,
|
|
713
|
+
initReconnect: Pt
|
|
714
|
+
}, Ke = !se.useId, oe = !fe || "Deno" in window, $t = (e) => Ht() ? window.requestAnimationFrame(e) : setTimeout(e, 1), we = oe ? de : pt, _e = typeof navigator < "u" && navigator.connection, Pe = !oe && _e && ([
|
|
715
|
+
"slow-2g",
|
|
716
|
+
"2g"
|
|
717
|
+
].includes(_e.effectiveType) || _e.saveData), ke = (e) => {
|
|
718
|
+
if (F(e))
|
|
719
|
+
try {
|
|
720
|
+
e = e();
|
|
721
|
+
} catch {
|
|
722
|
+
e = "";
|
|
723
|
+
}
|
|
724
|
+
const t = e;
|
|
725
|
+
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? re(e) : "", [
|
|
726
|
+
e,
|
|
727
|
+
t
|
|
728
|
+
];
|
|
729
|
+
};
|
|
730
|
+
let Xt = 0;
|
|
731
|
+
const De = () => ++Xt, et = 0, tt = 1, nt = 2, Zt = 3;
|
|
732
|
+
var ne = {
|
|
733
|
+
__proto__: null,
|
|
734
|
+
ERROR_REVALIDATE_EVENT: Zt,
|
|
735
|
+
FOCUS_EVENT: et,
|
|
736
|
+
MUTATE_EVENT: nt,
|
|
737
|
+
RECONNECT_EVENT: tt
|
|
738
|
+
};
|
|
739
|
+
async function rt(...e) {
|
|
740
|
+
const [t, n, i, o] = e, a = G({
|
|
741
|
+
populateCache: !0,
|
|
742
|
+
throwOnError: !0
|
|
743
|
+
}, typeof o == "boolean" ? {
|
|
744
|
+
revalidate: o
|
|
745
|
+
} : o || {});
|
|
746
|
+
let d = a.populateCache;
|
|
747
|
+
const g = a.rollbackOnError;
|
|
748
|
+
let f = a.optimisticData;
|
|
749
|
+
const C = (c) => typeof g == "function" ? g(c) : g !== !1, s = a.throwOnError;
|
|
750
|
+
if (F(n)) {
|
|
751
|
+
const c = n, l = [], O = t.keys();
|
|
752
|
+
for (const p of O)
|
|
753
|
+
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
754
|
+
!/^\$(inf|sub)\$/.test(p) && c(t.get(p)._k) && l.push(p);
|
|
755
|
+
return Promise.all(l.map(r));
|
|
756
|
+
}
|
|
757
|
+
return r(n);
|
|
758
|
+
async function r(c) {
|
|
759
|
+
const [l] = ke(c);
|
|
760
|
+
if (!l) return;
|
|
761
|
+
const [O, p] = Qe(t, l), [U, u, Y, _] = z.get(t), m = () => {
|
|
762
|
+
const I = U[l];
|
|
763
|
+
return (F(a.revalidate) ? a.revalidate(O().data, c) : a.revalidate !== !1) && (delete Y[l], delete _[l], I && I[0]) ? I[0](nt).then(() => O().data) : O().data;
|
|
764
|
+
};
|
|
765
|
+
if (e.length < 3)
|
|
766
|
+
return m();
|
|
767
|
+
let E = i, S;
|
|
768
|
+
const k = De();
|
|
769
|
+
u[l] = [
|
|
770
|
+
k,
|
|
771
|
+
0
|
|
772
|
+
];
|
|
773
|
+
const v = !h(f), R = O(), V = R.data, q = R._c, K = h(q) ? V : q;
|
|
774
|
+
if (v && (f = F(f) ? f(K, V) : f, p({
|
|
775
|
+
data: f,
|
|
776
|
+
_c: K
|
|
777
|
+
})), F(E))
|
|
778
|
+
try {
|
|
779
|
+
E = E(K);
|
|
780
|
+
} catch (I) {
|
|
781
|
+
S = I;
|
|
782
|
+
}
|
|
783
|
+
if (E && qt(E))
|
|
784
|
+
if (E = await E.catch((I) => {
|
|
785
|
+
S = I;
|
|
786
|
+
}), k !== u[l][0]) {
|
|
787
|
+
if (S) throw S;
|
|
788
|
+
return E;
|
|
789
|
+
} else S && v && C(S) && (d = !0, p({
|
|
790
|
+
data: K,
|
|
791
|
+
_c: L
|
|
792
|
+
}));
|
|
793
|
+
if (d && !S)
|
|
794
|
+
if (F(d)) {
|
|
795
|
+
const I = d(E, K);
|
|
796
|
+
p({
|
|
797
|
+
data: I,
|
|
798
|
+
error: L,
|
|
799
|
+
_c: L
|
|
800
|
+
});
|
|
801
|
+
} else
|
|
802
|
+
p({
|
|
803
|
+
data: E,
|
|
804
|
+
error: L,
|
|
805
|
+
_c: L
|
|
806
|
+
});
|
|
807
|
+
if (u[l][1] = De(), Promise.resolve(m()).then(() => {
|
|
808
|
+
p({
|
|
809
|
+
_c: L
|
|
810
|
+
});
|
|
811
|
+
}), S) {
|
|
812
|
+
if (s) throw S;
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
return E;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
const Je = (e, t) => {
|
|
819
|
+
for (const n in e)
|
|
820
|
+
e[n][0] && e[n][0](t);
|
|
821
|
+
}, Qt = (e, t) => {
|
|
822
|
+
if (!z.has(e)) {
|
|
823
|
+
const n = G(Yt, t), i = {}, o = rt.bind(L, e);
|
|
824
|
+
let a = j;
|
|
825
|
+
const d = {}, g = (s, r) => {
|
|
826
|
+
const c = d[s] || [];
|
|
827
|
+
return d[s] = c, c.push(r), () => c.splice(c.indexOf(r), 1);
|
|
828
|
+
}, f = (s, r, c) => {
|
|
829
|
+
e.set(s, r);
|
|
830
|
+
const l = d[s];
|
|
831
|
+
if (l)
|
|
832
|
+
for (const O of l)
|
|
833
|
+
O(r, c);
|
|
834
|
+
}, C = () => {
|
|
835
|
+
if (!z.has(e) && (z.set(e, [
|
|
836
|
+
i,
|
|
837
|
+
{},
|
|
838
|
+
{},
|
|
839
|
+
{},
|
|
840
|
+
o,
|
|
841
|
+
f,
|
|
842
|
+
g
|
|
843
|
+
]), !oe)) {
|
|
844
|
+
const s = n.initFocus(setTimeout.bind(L, Je.bind(L, i, et))), r = n.initReconnect(setTimeout.bind(L, Je.bind(L, i, tt)));
|
|
845
|
+
a = () => {
|
|
846
|
+
s && s(), r && r(), z.delete(e);
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
return C(), [
|
|
851
|
+
e,
|
|
852
|
+
o,
|
|
853
|
+
C,
|
|
854
|
+
a
|
|
855
|
+
];
|
|
856
|
+
}
|
|
857
|
+
return [
|
|
858
|
+
e,
|
|
859
|
+
z.get(e)[4]
|
|
860
|
+
];
|
|
861
|
+
}, en = (e, t, n, i, o) => {
|
|
862
|
+
const a = n.errorRetryCount, d = o.retryCount, g = ~~((Math.random() + 0.5) * (1 << (d < 8 ? d : 8))) * n.errorRetryInterval;
|
|
863
|
+
!h(a) && d > a || setTimeout(i, g, o);
|
|
864
|
+
}, tn = (e, t) => re(e) == re(t), [ot, nn] = Qt(/* @__PURE__ */ new Map()), rn = G(
|
|
865
|
+
{
|
|
866
|
+
// events
|
|
867
|
+
onLoadingSlow: j,
|
|
868
|
+
onSuccess: j,
|
|
869
|
+
onError: j,
|
|
870
|
+
onErrorRetry: en,
|
|
871
|
+
onDiscarded: j,
|
|
872
|
+
// switches
|
|
873
|
+
revalidateOnFocus: !0,
|
|
874
|
+
revalidateOnReconnect: !0,
|
|
875
|
+
revalidateIfStale: !0,
|
|
876
|
+
shouldRetryOnError: !0,
|
|
877
|
+
// timeouts
|
|
878
|
+
errorRetryInterval: Pe ? 1e4 : 5e3,
|
|
879
|
+
focusThrottleInterval: 5 * 1e3,
|
|
880
|
+
dedupingInterval: 2 * 1e3,
|
|
881
|
+
loadingTimeout: Pe ? 5e3 : 3e3,
|
|
882
|
+
// providers
|
|
883
|
+
compare: tn,
|
|
884
|
+
isPaused: () => !1,
|
|
885
|
+
cache: ot,
|
|
886
|
+
mutate: nn,
|
|
887
|
+
fallback: {}
|
|
888
|
+
},
|
|
889
|
+
// use web preset by default
|
|
890
|
+
Jt
|
|
891
|
+
), on = (e, t) => {
|
|
892
|
+
const n = G(e, t);
|
|
893
|
+
if (t) {
|
|
894
|
+
const { use: i, fallback: o } = e, { use: a, fallback: d } = t;
|
|
895
|
+
i && a && (n.use = i.concat(a)), o && d && (n.fallback = G(o, d));
|
|
896
|
+
}
|
|
897
|
+
return n;
|
|
898
|
+
}, sn = $e({}), an = "$inf$", st = fe && window.__SWR_DEVTOOLS_USE__, cn = st ? window.__SWR_DEVTOOLS_USE__ : [], un = () => {
|
|
899
|
+
st && (window.__SWR_DEVTOOLS_REACT__ = se);
|
|
900
|
+
}, ln = (e) => F(e[1]) ? [
|
|
901
|
+
e[0],
|
|
902
|
+
e[1],
|
|
903
|
+
e[2] || {}
|
|
904
|
+
] : [
|
|
905
|
+
e[0],
|
|
906
|
+
null,
|
|
907
|
+
(e[1] === null ? e[2] : e[1]) || {}
|
|
908
|
+
], dn = () => G(rn, Xe(sn)), fn = (e) => (t, n, i) => e(t, n && ((...a) => {
|
|
909
|
+
const [d] = ke(t), [, , , g] = z.get(ot);
|
|
910
|
+
if (d.startsWith(an))
|
|
911
|
+
return n(...a);
|
|
912
|
+
const f = g[d];
|
|
913
|
+
return h(f) ? n(...a) : (delete g[d], f);
|
|
914
|
+
}), i), gn = cn.concat(fn), pn = (e) => function(...n) {
|
|
915
|
+
const i = dn(), [o, a, d] = ln(n), g = on(i, d);
|
|
916
|
+
let f = e;
|
|
917
|
+
const { use: C } = g, s = (C || []).concat(gn);
|
|
918
|
+
for (let r = s.length; r--; )
|
|
919
|
+
f = s[r](f);
|
|
920
|
+
return f(o, a || g.fetcher || null, g);
|
|
921
|
+
}, hn = (e, t, n) => {
|
|
922
|
+
const i = t[e] || (t[e] = []);
|
|
923
|
+
return i.push(n), () => {
|
|
924
|
+
const o = i.indexOf(n);
|
|
925
|
+
o >= 0 && (i[o] = i[i.length - 1], i.pop());
|
|
926
|
+
};
|
|
927
|
+
};
|
|
928
|
+
un();
|
|
929
|
+
const Ye = se.use || ((e) => {
|
|
930
|
+
if (e.status === "pending")
|
|
931
|
+
throw e;
|
|
932
|
+
if (e.status === "fulfilled")
|
|
933
|
+
return e.value;
|
|
934
|
+
throw e.status === "rejected" ? e.reason : (e.status = "pending", e.then((t) => {
|
|
935
|
+
e.status = "fulfilled", e.value = t;
|
|
936
|
+
}, (t) => {
|
|
937
|
+
e.status = "rejected", e.reason = t;
|
|
938
|
+
}), e);
|
|
939
|
+
}), Ce = {
|
|
940
|
+
dedupe: !0
|
|
941
|
+
}, mn = (e, t, n) => {
|
|
942
|
+
const { cache: i, compare: o, suspense: a, fallbackData: d, revalidateOnMount: g, revalidateIfStale: f, refreshInterval: C, refreshWhenHidden: s, refreshWhenOffline: r, keepPreviousData: c } = n, [l, O, p, U] = z.get(i), [u, Y] = ke(e), _ = P(!1), m = P(!1), E = P(u), S = P(t), k = P(n), v = () => k.current, R = () => v().isVisible() && v().isOnline(), [V, q, K, I] = Qe(i, u), $ = P({}).current, it = h(d) ? n.fallback[u] : d, xe = (y, w) => {
|
|
943
|
+
for (const A in $) {
|
|
944
|
+
const b = A;
|
|
945
|
+
if (b === "data") {
|
|
946
|
+
if (!o(y[b], w[b]) && (!h(y[b]) || !o(ae, w[b])))
|
|
947
|
+
return !1;
|
|
948
|
+
} else if (w[b] !== y[b])
|
|
949
|
+
return !1;
|
|
950
|
+
}
|
|
951
|
+
return !0;
|
|
952
|
+
}, Ie = H(() => {
|
|
953
|
+
const y = !u || !t ? !1 : h(g) ? v().isPaused() || a ? !1 : h(f) ? !0 : f : g, w = (D) => {
|
|
954
|
+
const W = G(D);
|
|
955
|
+
return delete W._k, y ? {
|
|
956
|
+
isValidating: !0,
|
|
957
|
+
isLoading: !0,
|
|
958
|
+
...W
|
|
959
|
+
} : W;
|
|
960
|
+
}, A = V(), b = I(), N = w(A), ee = A === b ? N : w(b);
|
|
961
|
+
let T = N;
|
|
962
|
+
return [
|
|
963
|
+
() => {
|
|
964
|
+
const D = w(V());
|
|
965
|
+
return xe(D, T) ? (T.data = D.data, T.isLoading = D.isLoading, T.isValidating = D.isValidating, T.error = D.error, T) : (T = D, D);
|
|
966
|
+
},
|
|
967
|
+
() => ee
|
|
968
|
+
];
|
|
969
|
+
}, [
|
|
970
|
+
i,
|
|
971
|
+
u
|
|
972
|
+
]), X = zt.useSyncExternalStore(he(
|
|
973
|
+
(y) => K(u, (w, A) => {
|
|
974
|
+
xe(A, w) || y();
|
|
975
|
+
}),
|
|
976
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
977
|
+
[
|
|
978
|
+
i,
|
|
979
|
+
u
|
|
980
|
+
]
|
|
981
|
+
), Ie[0], Ie[1]), Ne = !_.current, at = l[u] && l[u].length > 0, Z = X.data, Q = h(Z) ? it : Z, ie = X.error, Fe = P(Q), ae = c ? h(Z) ? Fe.current : Z : Q, Ue = at && !h(ie) ? !1 : Ne && !h(g) ? g : v().isPaused() ? !1 : a ? h(Q) ? !1 : f : h(Q) || f, We = !!(u && t && Ne && Ue), ct = h(X.isValidating) ? We : X.isValidating, ut = h(X.isLoading) ? We : X.isLoading, te = he(
|
|
982
|
+
async (y) => {
|
|
983
|
+
const w = S.current;
|
|
984
|
+
if (!u || !w || m.current || v().isPaused())
|
|
985
|
+
return !1;
|
|
986
|
+
let A, b, N = !0;
|
|
987
|
+
const ee = y || {}, T = !p[u] || !ee.dedupe, D = () => Ke ? !m.current && u === E.current && _.current : u === E.current, W = {
|
|
988
|
+
isValidating: !1,
|
|
989
|
+
isLoading: !1
|
|
990
|
+
}, ze = () => {
|
|
991
|
+
q(W);
|
|
992
|
+
}, qe = () => {
|
|
993
|
+
const x = p[u];
|
|
994
|
+
x && x[1] === b && delete p[u];
|
|
995
|
+
}, Be = {
|
|
996
|
+
isValidating: !0
|
|
997
|
+
};
|
|
998
|
+
h(V().data) && (Be.isLoading = !0);
|
|
999
|
+
try {
|
|
1000
|
+
if (T && (q(Be), n.loadingTimeout && h(V().data) && setTimeout(() => {
|
|
1001
|
+
N && D() && v().onLoadingSlow(u, n);
|
|
1002
|
+
}, n.loadingTimeout), p[u] = [
|
|
1003
|
+
w(Y),
|
|
1004
|
+
De()
|
|
1005
|
+
]), [A, b] = p[u], A = await A, T && setTimeout(qe, n.dedupingInterval), !p[u] || p[u][1] !== b)
|
|
1006
|
+
return T && D() && v().onDiscarded(u), !1;
|
|
1007
|
+
W.error = L;
|
|
1008
|
+
const x = O[u];
|
|
1009
|
+
if (!h(x) && // case 1
|
|
1010
|
+
(b <= x[0] || // case 2
|
|
1011
|
+
b <= x[1] || // case 3
|
|
1012
|
+
x[1] === 0))
|
|
1013
|
+
return ze(), T && D() && v().onDiscarded(u), !1;
|
|
1014
|
+
const M = V().data;
|
|
1015
|
+
W.data = o(M, A) ? M : A, T && D() && v().onSuccess(A, u, n);
|
|
1016
|
+
} catch (x) {
|
|
1017
|
+
qe();
|
|
1018
|
+
const M = v(), { shouldRetryOnError: ge } = M;
|
|
1019
|
+
M.isPaused() || (W.error = x, T && D() && (M.onError(x, u, M), (ge === !0 || F(ge) && ge(x)) && (!v().revalidateOnFocus || !v().revalidateOnReconnect || R()) && M.onErrorRetry(x, u, M, (lt) => {
|
|
1020
|
+
const pe = l[u];
|
|
1021
|
+
pe && pe[0] && pe[0](ne.ERROR_REVALIDATE_EVENT, lt);
|
|
1022
|
+
}, {
|
|
1023
|
+
retryCount: (ee.retryCount || 0) + 1,
|
|
1024
|
+
dedupe: !0
|
|
1025
|
+
})));
|
|
1026
|
+
}
|
|
1027
|
+
return N = !1, ze(), !0;
|
|
1028
|
+
},
|
|
1029
|
+
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
1030
|
+
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
1031
|
+
// the deps array.
|
|
1032
|
+
//
|
|
1033
|
+
// FIXME:
|
|
1034
|
+
// `fn` and `config` might be changed during the lifecycle,
|
|
1035
|
+
// but they might be changed every render like this.
|
|
1036
|
+
// `useSWR('key', () => fetch('/api/'), { suspense: true })`
|
|
1037
|
+
// So we omit the values from the deps array
|
|
1038
|
+
// even though it might cause unexpected behaviors.
|
|
1039
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1040
|
+
[
|
|
1041
|
+
u,
|
|
1042
|
+
i
|
|
1043
|
+
]
|
|
1044
|
+
), Me = he(
|
|
1045
|
+
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
1046
|
+
(...y) => rt(i, E.current, ...y),
|
|
1047
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1048
|
+
[]
|
|
1049
|
+
);
|
|
1050
|
+
if (we(() => {
|
|
1051
|
+
S.current = t, k.current = n, h(Z) || (Fe.current = Z);
|
|
1052
|
+
}), we(() => {
|
|
1053
|
+
if (!u) return;
|
|
1054
|
+
const y = te.bind(L, Ce);
|
|
1055
|
+
let w = 0;
|
|
1056
|
+
const b = hn(u, l, (N, ee = {}) => {
|
|
1057
|
+
if (N == ne.FOCUS_EVENT) {
|
|
1058
|
+
const T = Date.now();
|
|
1059
|
+
v().revalidateOnFocus && T > w && R() && (w = T + v().focusThrottleInterval, y());
|
|
1060
|
+
} else if (N == ne.RECONNECT_EVENT)
|
|
1061
|
+
v().revalidateOnReconnect && R() && y();
|
|
1062
|
+
else {
|
|
1063
|
+
if (N == ne.MUTATE_EVENT)
|
|
1064
|
+
return te();
|
|
1065
|
+
if (N == ne.ERROR_REVALIDATE_EVENT)
|
|
1066
|
+
return te(ee);
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
return m.current = !1, E.current = u, _.current = !0, q({
|
|
1070
|
+
_k: Y
|
|
1071
|
+
}), Ue && (h(Q) || oe ? y() : $t(y)), () => {
|
|
1072
|
+
m.current = !0, b();
|
|
1073
|
+
};
|
|
1074
|
+
}, [
|
|
1075
|
+
u
|
|
1076
|
+
]), we(() => {
|
|
1077
|
+
let y;
|
|
1078
|
+
function w() {
|
|
1079
|
+
const b = F(C) ? C(V().data) : C;
|
|
1080
|
+
b && y !== -1 && (y = setTimeout(A, b));
|
|
1081
|
+
}
|
|
1082
|
+
function A() {
|
|
1083
|
+
!V().error && (s || v().isVisible()) && (r || v().isOnline()) ? te(Ce).then(w) : w();
|
|
1084
|
+
}
|
|
1085
|
+
return w(), () => {
|
|
1086
|
+
y && (clearTimeout(y), y = -1);
|
|
1087
|
+
};
|
|
1088
|
+
}, [
|
|
1089
|
+
C,
|
|
1090
|
+
s,
|
|
1091
|
+
r,
|
|
1092
|
+
u
|
|
1093
|
+
]), ht(ae), a && h(Q) && u) {
|
|
1094
|
+
if (!Ke && oe)
|
|
1095
|
+
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
1096
|
+
S.current = t, k.current = n, m.current = !1;
|
|
1097
|
+
const y = U[u];
|
|
1098
|
+
if (!h(y)) {
|
|
1099
|
+
const w = Me(y);
|
|
1100
|
+
Ye(w);
|
|
1101
|
+
}
|
|
1102
|
+
if (h(ie)) {
|
|
1103
|
+
const w = te(Ce);
|
|
1104
|
+
h(ae) || (w.status = "fulfilled", w.value = !0), Ye(w);
|
|
1105
|
+
} else
|
|
1106
|
+
throw ie;
|
|
1107
|
+
}
|
|
1108
|
+
return {
|
|
1109
|
+
mutate: Me,
|
|
1110
|
+
get data() {
|
|
1111
|
+
return $.data = !0, ae;
|
|
1112
|
+
},
|
|
1113
|
+
get error() {
|
|
1114
|
+
return $.error = !0, ie;
|
|
1115
|
+
},
|
|
1116
|
+
get isValidating() {
|
|
1117
|
+
return $.isValidating = !0, ct;
|
|
1118
|
+
},
|
|
1119
|
+
get isLoading() {
|
|
1120
|
+
return $.isLoading = !0, ut;
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
}, Sn = pn(mn);
|
|
1124
|
+
function Tn() {
|
|
1125
|
+
const { api: e } = J(), t = Ut();
|
|
1126
|
+
return Sn([t.config.apiUrl], e.widgetPrelude);
|
|
1127
|
+
}
|
|
1128
|
+
function An() {
|
|
1129
|
+
const { locale: e } = J();
|
|
1130
|
+
return e;
|
|
1131
|
+
}
|
|
1132
|
+
const B = /* @__PURE__ */ new Map();
|
|
1133
|
+
function Dn() {
|
|
1134
|
+
const [e, t] = Ze([]), { api: n } = J();
|
|
1135
|
+
function i(s) {
|
|
1136
|
+
const r = s.map((c) => ({
|
|
1137
|
+
file: c,
|
|
1138
|
+
id: mt(),
|
|
1139
|
+
status: "pending",
|
|
1140
|
+
progress: 0
|
|
1141
|
+
}));
|
|
1142
|
+
t((c) => [...c, ...r]), r.forEach(d);
|
|
1143
|
+
}
|
|
1144
|
+
function o(s, r) {
|
|
1145
|
+
t(
|
|
1146
|
+
(c) => c.map((l) => l.id === s ? { ...l, ...r } : l)
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
function a(s) {
|
|
1150
|
+
t((r) => r.filter((c) => c.id !== s));
|
|
1151
|
+
}
|
|
1152
|
+
const d = async (s) => {
|
|
1153
|
+
const r = new AbortController();
|
|
1154
|
+
B.set(s.id, r), t(
|
|
1155
|
+
(O) => O.map(
|
|
1156
|
+
(p) => p.id === s.id ? { ...p, status: "uploading", progress: 0 } : p
|
|
1157
|
+
)
|
|
1158
|
+
);
|
|
1159
|
+
const { data: c, error: l } = await n.uploadFile({
|
|
1160
|
+
file: s,
|
|
1161
|
+
abortSignal: r.signal
|
|
1162
|
+
});
|
|
1163
|
+
c ? o(s.id, {
|
|
1164
|
+
status: "success",
|
|
1165
|
+
fileUrl: c.fileUrl,
|
|
1166
|
+
progress: 100
|
|
1167
|
+
}) : r.signal.aborted || o(s.id, {
|
|
1168
|
+
status: "error",
|
|
1169
|
+
error: l.message || "Upload failed",
|
|
1170
|
+
progress: 0
|
|
1171
|
+
}), B.delete(s.id);
|
|
1172
|
+
}, g = (s) => {
|
|
1173
|
+
const r = B.get(s);
|
|
1174
|
+
r && (r.abort(), B.delete(s)), a(s);
|
|
1175
|
+
}, f = H(() => e.filter((s) => s.status === "success" && s.fileUrl), [e]);
|
|
1176
|
+
function C() {
|
|
1177
|
+
B.forEach((s) => s.abort()), B.clear(), t([]);
|
|
1178
|
+
}
|
|
1179
|
+
return de(() => () => {
|
|
1180
|
+
B.forEach((s) => s.abort()), B.clear();
|
|
1181
|
+
}, []), {
|
|
1182
|
+
allFiles: e,
|
|
1183
|
+
appendFiles: i,
|
|
1184
|
+
handleCancelUpload: g,
|
|
1185
|
+
successFiles: f,
|
|
1186
|
+
emptyTheFiles: C,
|
|
1187
|
+
getFileById: (s) => e.find((r) => r.id === s),
|
|
1188
|
+
getUploadProgress: (s) => {
|
|
1189
|
+
var r;
|
|
1190
|
+
return ((r = e.find((c) => c.id === s)) == null ? void 0 : r.progress) ?? 0;
|
|
1191
|
+
},
|
|
1192
|
+
getUploadStatus: (s) => {
|
|
1193
|
+
var r;
|
|
1194
|
+
return (r = e.find((c) => c.id === s)) == null ? void 0 : r.status;
|
|
1195
|
+
},
|
|
1196
|
+
hasErrors: e.some((s) => s.status === "error"),
|
|
1197
|
+
isUploading: e.some((s) => s.status === "uploading")
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function Vn() {
|
|
1201
|
+
const { chat: e } = J();
|
|
1202
|
+
return {
|
|
1203
|
+
contactState: Ve(e.contactState),
|
|
1204
|
+
contactManager: e.contactManager
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
export {
|
|
1208
|
+
bn as C,
|
|
1209
|
+
On as a,
|
|
1210
|
+
Rn as b,
|
|
1211
|
+
Ut as c,
|
|
1212
|
+
Tn as d,
|
|
1213
|
+
An as e,
|
|
1214
|
+
Vn as f,
|
|
1215
|
+
Dn as g,
|
|
1216
|
+
Ve as h,
|
|
1217
|
+
J as u
|
|
1218
|
+
};
|
|
1219
|
+
//# sourceMappingURL=index-DUlnC30_.js.map
|