@eduzz-automacoes/webchat-widget 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -2
- package/dist/eduzz-webchat.cjs +5 -5
- package/dist/eduzz-webchat.js +641 -498
- package/dist/index.d.ts +264 -112
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/eduzz-webchat.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as o, jsxs as l, Fragment as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Container as
|
|
4
|
-
import './style.css';const
|
|
1
|
+
import { jsx as o, jsxs as l, Fragment as Ve } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Re, createElement as ke, useState as S, useEffect as M, useRef as Z, useMemo as C, useCallback as ce, useReducer as Ge } from "react";
|
|
3
|
+
import { Container as Ke, MessageList as Je, Composer as Xe, WebchatProvider as Ze, useActiveConversation as Ye, useConversations as Qe, useUser as et, useConversationList as tt, Block as ot, StylesheetProvider as at } from "@botpress/webchat";
|
|
4
|
+
import './style.css';const X = {
|
|
5
5
|
botName: "Assistente Virtual",
|
|
6
6
|
subtitle: "Conectado ao bot real",
|
|
7
7
|
botAvatar: "",
|
|
@@ -64,8 +64,8 @@ import './style.css';const j = {
|
|
|
64
64
|
welcomeCloseLabel: "Fechar painel",
|
|
65
65
|
openFabBackgroundColor: "#2563eb",
|
|
66
66
|
openFabIconColor: "#ffffff"
|
|
67
|
-
},
|
|
68
|
-
switch (
|
|
67
|
+
}, De = (e) => e === "bottom-left" || e === "top-left" ? "bottom-left" : "bottom-right", nt = (e) => {
|
|
68
|
+
switch (De(e)) {
|
|
69
69
|
case "bottom-left":
|
|
70
70
|
return {
|
|
71
71
|
bottom: "24px",
|
|
@@ -82,12 +82,12 @@ import './style.css';const j = {
|
|
|
82
82
|
"--panel-transform-origin": "right bottom"
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
},
|
|
85
|
+
}, Fe = (e, t, a) => Math.min(Math.max(e, t), a), xe = (e) => {
|
|
86
86
|
if (typeof e != "string") return null;
|
|
87
87
|
let t = e.trim();
|
|
88
88
|
return !t || (t.startsWith("#") && (t = t.slice(1)), t.length === 3 && (t = t.split("").map((a) => `${a}${a}`).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toLowerCase()}`;
|
|
89
|
-
},
|
|
90
|
-
const t =
|
|
89
|
+
}, Ne = (e) => {
|
|
90
|
+
const t = xe(e);
|
|
91
91
|
if (!t) return null;
|
|
92
92
|
const a = t.slice(1);
|
|
93
93
|
return {
|
|
@@ -95,19 +95,19 @@ import './style.css';const j = {
|
|
|
95
95
|
g: Number.parseInt(a.slice(2, 4), 16),
|
|
96
96
|
b: Number.parseInt(a.slice(4, 6), 16)
|
|
97
97
|
};
|
|
98
|
-
},
|
|
99
|
-
(r) =>
|
|
100
|
-
).join("")}`,
|
|
101
|
-
const r =
|
|
98
|
+
}, rt = ({ r: e, g: t, b: a }) => `#${[e, t, a].map(
|
|
99
|
+
(r) => Fe(Math.round(r), 0, 255).toString(16).padStart(2, "0")
|
|
100
|
+
).join("")}`, pe = (e, t, a) => {
|
|
101
|
+
const r = Ne(e), s = Ne(t);
|
|
102
102
|
if (!r || !s) return null;
|
|
103
|
-
const n =
|
|
104
|
-
return
|
|
103
|
+
const n = Fe(a, 0, 1);
|
|
104
|
+
return rt({
|
|
105
105
|
r: r.r * (1 - n) + s.r * n,
|
|
106
106
|
g: r.g * (1 - n) + s.g * n,
|
|
107
107
|
b: r.b * (1 - n) + s.b * n
|
|
108
108
|
});
|
|
109
|
-
},
|
|
110
|
-
const t =
|
|
109
|
+
}, st = (e, t) => t < 0 ? pe(e, "#000000", Math.abs(t)) : pe(e, "#ffffff", t), me = (e) => {
|
|
110
|
+
const t = Ne(e);
|
|
111
111
|
return t && [t.r, t.g, t.b].map((r) => {
|
|
112
112
|
const s = r / 255;
|
|
113
113
|
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
@@ -115,43 +115,43 @@ import './style.css';const j = {
|
|
|
115
115
|
(r, s, n) => r + s * [0.2126, 0.7152, 0.0722][n],
|
|
116
116
|
0
|
|
117
117
|
) > 0.42 ? "#18181b" : "#ffffff";
|
|
118
|
-
},
|
|
119
|
-
const a =
|
|
118
|
+
}, L = (e, t) => e && Object.prototype.hasOwnProperty.call(e, t) && e[t] != null && e[t] !== "", ct = (e, t) => {
|
|
119
|
+
const a = xe(e.brandColor);
|
|
120
120
|
if (!a) return e;
|
|
121
|
-
const r =
|
|
121
|
+
const r = xe(e.brandTextColor) || me(a), s = pe(a, "#ffffff", 0.82) || X.secondaryButtonBorderColor, n = pe(a, "#ffffff", 0.92) || X.secondaryButtonHoverBackgroundColor, c = st(a, -0.12) || X.primaryButtonHoverBackgroundColor;
|
|
122
122
|
return {
|
|
123
123
|
...e,
|
|
124
124
|
brandColor: a,
|
|
125
125
|
brandTextColor: r,
|
|
126
|
-
primaryButtonBackgroundColor:
|
|
126
|
+
primaryButtonBackgroundColor: L(
|
|
127
127
|
t,
|
|
128
128
|
"primaryButtonBackgroundColor"
|
|
129
129
|
) ? e.primaryButtonBackgroundColor : a,
|
|
130
|
-
primaryButtonTextColor:
|
|
131
|
-
primaryButtonHoverBackgroundColor:
|
|
130
|
+
primaryButtonTextColor: L(t, "primaryButtonTextColor") ? e.primaryButtonTextColor : r,
|
|
131
|
+
primaryButtonHoverBackgroundColor: L(
|
|
132
132
|
t,
|
|
133
133
|
"primaryButtonHoverBackgroundColor"
|
|
134
134
|
) ? e.primaryButtonHoverBackgroundColor : c,
|
|
135
|
-
secondaryButtonBackgroundColor:
|
|
135
|
+
secondaryButtonBackgroundColor: L(
|
|
136
136
|
t,
|
|
137
137
|
"secondaryButtonBackgroundColor"
|
|
138
138
|
) ? e.secondaryButtonBackgroundColor : "#ffffff",
|
|
139
|
-
secondaryButtonTextColor:
|
|
140
|
-
secondaryButtonBorderColor:
|
|
141
|
-
secondaryButtonHoverBackgroundColor:
|
|
139
|
+
secondaryButtonTextColor: L(t, "secondaryButtonTextColor") ? e.secondaryButtonTextColor : a,
|
|
140
|
+
secondaryButtonBorderColor: L(t, "secondaryButtonBorderColor") ? e.secondaryButtonBorderColor : s,
|
|
141
|
+
secondaryButtonHoverBackgroundColor: L(
|
|
142
142
|
t,
|
|
143
143
|
"secondaryButtonHoverBackgroundColor"
|
|
144
144
|
) ? e.secondaryButtonHoverBackgroundColor : n,
|
|
145
|
-
iconButtonBackgroundColor:
|
|
146
|
-
iconButtonIconColor:
|
|
147
|
-
iconButtonBorderColor:
|
|
148
|
-
iconButtonHoverBackgroundColor:
|
|
145
|
+
iconButtonBackgroundColor: L(t, "iconButtonBackgroundColor") ? e.iconButtonBackgroundColor : "#ffffff",
|
|
146
|
+
iconButtonIconColor: L(t, "iconButtonIconColor") ? e.iconButtonIconColor : a,
|
|
147
|
+
iconButtonBorderColor: L(t, "iconButtonBorderColor") ? e.iconButtonBorderColor : s,
|
|
148
|
+
iconButtonHoverBackgroundColor: L(
|
|
149
149
|
t,
|
|
150
150
|
"iconButtonHoverBackgroundColor"
|
|
151
151
|
) ? e.iconButtonHoverBackgroundColor : n
|
|
152
152
|
};
|
|
153
|
-
},
|
|
154
|
-
const t = e.fabBackgroundColor || e.openFabBackgroundColor ||
|
|
153
|
+
}, lt = (e) => {
|
|
154
|
+
const t = e.fabBackgroundColor || e.openFabBackgroundColor || X.fabBackgroundColor, a = e.fabIconColor || e.openFabIconColor || X.fabIconColor;
|
|
155
155
|
return {
|
|
156
156
|
...e,
|
|
157
157
|
fabBackgroundColor: t,
|
|
@@ -159,17 +159,17 @@ import './style.css';const j = {
|
|
|
159
159
|
openFabBackgroundColor: t,
|
|
160
160
|
openFabIconColor: a
|
|
161
161
|
};
|
|
162
|
-
},
|
|
163
|
-
|
|
162
|
+
}, it = (e = {}) => lt(
|
|
163
|
+
ct(
|
|
164
164
|
{
|
|
165
|
-
...
|
|
165
|
+
...X,
|
|
166
166
|
...e,
|
|
167
|
-
position:
|
|
167
|
+
position: De(e.position ?? X.position)
|
|
168
168
|
},
|
|
169
169
|
e
|
|
170
170
|
)
|
|
171
|
-
),
|
|
172
|
-
...
|
|
171
|
+
), le = (e) => ({
|
|
172
|
+
...nt(e.position),
|
|
173
173
|
"--widget-width": e.width,
|
|
174
174
|
"--widget-height": e.height,
|
|
175
175
|
"--bpGray-1": "var(--ui-bg)",
|
|
@@ -185,9 +185,9 @@ import './style.css';const j = {
|
|
|
185
185
|
"--bpGray-900": "var(--ui-text)",
|
|
186
186
|
"--bpGray-950": "var(--ui-text)",
|
|
187
187
|
"--accent-color": e.accentColor,
|
|
188
|
-
"--accent-text-color":
|
|
188
|
+
"--accent-text-color": me(e.accentColor),
|
|
189
189
|
"--header-avatar-bg": e.accentColor,
|
|
190
|
-
"--header-avatar-text":
|
|
190
|
+
"--header-avatar-text": me(e.accentColor),
|
|
191
191
|
"--primary-button-background-color": e.primaryButtonBackgroundColor,
|
|
192
192
|
"--primary-button-text-color": e.primaryButtonTextColor,
|
|
193
193
|
"--primary-button-hover-background-color": e.primaryButtonHoverBackgroundColor,
|
|
@@ -228,7 +228,7 @@ import './style.css';const j = {
|
|
|
228
228
|
"--button-text": e.secondaryButtonTextColor,
|
|
229
229
|
"--fab-background-color": e.fabBackgroundColor,
|
|
230
230
|
"--fab-icon-color": e.fabIconColor
|
|
231
|
-
}),
|
|
231
|
+
}), dt = (e) => ({
|
|
232
232
|
color: e.color || e.accentColor,
|
|
233
233
|
fontFamily: e.fontFamily,
|
|
234
234
|
radius: e.radius,
|
|
@@ -238,18 +238,18 @@ import './style.css';const j = {
|
|
|
238
238
|
additionalStylesheet: e.additionalStylesheet,
|
|
239
239
|
additionalStylesheetUrl: e.additionalStylesheetUrl
|
|
240
240
|
});
|
|
241
|
-
const
|
|
241
|
+
const ut = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), bt = (e) => e.replace(
|
|
242
242
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
243
243
|
(t, a, r) => r ? r.toUpperCase() : a.toLowerCase()
|
|
244
|
-
),
|
|
245
|
-
const t =
|
|
244
|
+
), Me = (e) => {
|
|
245
|
+
const t = bt(e);
|
|
246
246
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
247
|
-
},
|
|
247
|
+
}, Pe = (...e) => e.filter((t, a, r) => !!t && t.trim() !== "" && r.indexOf(t) === a).join(" ").trim(), ht = (e) => {
|
|
248
248
|
for (const t in e)
|
|
249
249
|
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
250
250
|
return !0;
|
|
251
251
|
};
|
|
252
|
-
var
|
|
252
|
+
var pt = {
|
|
253
253
|
xmlns: "http://www.w3.org/2000/svg",
|
|
254
254
|
width: 24,
|
|
255
255
|
height: 24,
|
|
@@ -260,7 +260,7 @@ var ht = {
|
|
|
260
260
|
strokeLinecap: "round",
|
|
261
261
|
strokeLinejoin: "round"
|
|
262
262
|
};
|
|
263
|
-
const mt =
|
|
263
|
+
const mt = Re(
|
|
264
264
|
({
|
|
265
265
|
color: e = "currentColor",
|
|
266
266
|
size: t = 24,
|
|
@@ -269,47 +269,48 @@ const mt = Ie(
|
|
|
269
269
|
className: s = "",
|
|
270
270
|
children: n,
|
|
271
271
|
iconNode: c,
|
|
272
|
-
...
|
|
273
|
-
},
|
|
272
|
+
...i
|
|
273
|
+
}, u) => ke(
|
|
274
274
|
"svg",
|
|
275
275
|
{
|
|
276
|
-
ref:
|
|
277
|
-
...
|
|
276
|
+
ref: u,
|
|
277
|
+
...pt,
|
|
278
278
|
width: t,
|
|
279
279
|
height: t,
|
|
280
280
|
stroke: e,
|
|
281
281
|
strokeWidth: r ? Number(a) * 24 / Number(t) : a,
|
|
282
|
-
className:
|
|
283
|
-
...!n && !
|
|
284
|
-
...
|
|
282
|
+
className: Pe("lucide", s),
|
|
283
|
+
...!n && !ht(i) && { "aria-hidden": "true" },
|
|
284
|
+
...i
|
|
285
285
|
},
|
|
286
286
|
[
|
|
287
|
-
...c.map(([
|
|
287
|
+
...c.map(([w, m]) => ke(w, m)),
|
|
288
288
|
...Array.isArray(n) ? n : [n]
|
|
289
289
|
]
|
|
290
290
|
)
|
|
291
291
|
);
|
|
292
|
-
const
|
|
293
|
-
const a =
|
|
294
|
-
({ className: r, ...s }, n) =>
|
|
292
|
+
const A = (e, t) => {
|
|
293
|
+
const a = Re(
|
|
294
|
+
({ className: r, ...s }, n) => ke(mt, {
|
|
295
295
|
ref: n,
|
|
296
296
|
iconNode: t,
|
|
297
|
-
className:
|
|
298
|
-
`lucide-${
|
|
297
|
+
className: Pe(
|
|
298
|
+
`lucide-${ut(Me(e))}`,
|
|
299
299
|
`lucide-${e}`,
|
|
300
300
|
r
|
|
301
301
|
),
|
|
302
302
|
...s
|
|
303
303
|
})
|
|
304
304
|
);
|
|
305
|
-
return a.displayName =
|
|
305
|
+
return a.displayName = Me(e), a;
|
|
306
306
|
};
|
|
307
|
-
const
|
|
307
|
+
const wt = [
|
|
308
308
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
309
309
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
310
|
-
],
|
|
311
|
-
const
|
|
312
|
-
const
|
|
310
|
+
], ft = A("arrow-right", wt);
|
|
311
|
+
const gt = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], yt = A("chevron-down", gt);
|
|
312
|
+
const vt = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], Ct = A("chevron-right", vt);
|
|
313
|
+
const Bt = [
|
|
313
314
|
["path", { d: "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8", key: "5wwlr5" }],
|
|
314
315
|
[
|
|
315
316
|
"path",
|
|
@@ -318,8 +319,8 @@ const yt = [
|
|
|
318
319
|
key: "r6nss1"
|
|
319
320
|
}
|
|
320
321
|
]
|
|
321
|
-
],
|
|
322
|
-
const
|
|
322
|
+
], kt = A("house", Bt);
|
|
323
|
+
const xt = [
|
|
323
324
|
[
|
|
324
325
|
"path",
|
|
325
326
|
{
|
|
@@ -330,8 +331,8 @@ const vt = [
|
|
|
330
331
|
["path", { d: "M8 12h.01", key: "czm47f" }],
|
|
331
332
|
["path", { d: "M12 12h.01", key: "1mp3jc" }],
|
|
332
333
|
["path", { d: "M16 12h.01", key: "1l6xoz" }]
|
|
333
|
-
],
|
|
334
|
-
const
|
|
334
|
+
], Nt = A("message-circle-more", xt);
|
|
335
|
+
const It = [
|
|
335
336
|
[
|
|
336
337
|
"path",
|
|
337
338
|
{
|
|
@@ -339,8 +340,8 @@ const kt = [
|
|
|
339
340
|
key: "1sd12s"
|
|
340
341
|
}
|
|
341
342
|
]
|
|
342
|
-
],
|
|
343
|
-
const
|
|
343
|
+
], Mt = A("message-circle", It);
|
|
344
|
+
const St = [
|
|
344
345
|
[
|
|
345
346
|
"path",
|
|
346
347
|
{
|
|
@@ -348,8 +349,8 @@ const Nt = [
|
|
|
348
349
|
key: "18887p"
|
|
349
350
|
}
|
|
350
351
|
]
|
|
351
|
-
],
|
|
352
|
-
const
|
|
352
|
+
], He = A("message-square", St);
|
|
353
|
+
const Tt = [
|
|
353
354
|
[
|
|
354
355
|
"path",
|
|
355
356
|
{
|
|
@@ -364,12 +365,12 @@ const It = [
|
|
|
364
365
|
key: "1qfcsi"
|
|
365
366
|
}
|
|
366
367
|
]
|
|
367
|
-
],
|
|
368
|
-
const
|
|
368
|
+
], $e = A("messages-square", Tt);
|
|
369
|
+
const At = [
|
|
369
370
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
370
371
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
371
|
-
],
|
|
372
|
-
const
|
|
372
|
+
], Ut = A("rotate-ccw", At);
|
|
373
|
+
const Vt = [
|
|
373
374
|
["path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7", key: "1m0v6g" }],
|
|
374
375
|
[
|
|
375
376
|
"path",
|
|
@@ -378,8 +379,8 @@ const Tt = [
|
|
|
378
379
|
key: "ohrbg2"
|
|
379
380
|
}
|
|
380
381
|
]
|
|
381
|
-
],
|
|
382
|
-
const
|
|
382
|
+
], Rt = A("square-pen", Vt);
|
|
383
|
+
const Dt = [
|
|
383
384
|
[
|
|
384
385
|
"path",
|
|
385
386
|
{
|
|
@@ -388,8 +389,8 @@ const Vt = [
|
|
|
388
389
|
}
|
|
389
390
|
],
|
|
390
391
|
["path", { d: "M17 14V2", key: "8ymqnk" }]
|
|
391
|
-
],
|
|
392
|
-
const
|
|
392
|
+
], Ft = A("thumbs-down", Dt);
|
|
393
|
+
const Pt = [
|
|
393
394
|
[
|
|
394
395
|
"path",
|
|
395
396
|
{
|
|
@@ -398,67 +399,103 @@ const Ft = [
|
|
|
398
399
|
}
|
|
399
400
|
],
|
|
400
401
|
["path", { d: "M7 10v12", key: "1qc93n" }]
|
|
401
|
-
],
|
|
402
|
-
const
|
|
402
|
+
], Ht = A("thumbs-up", Pt);
|
|
403
|
+
const $t = [
|
|
403
404
|
["circle", { cx: "12", cy: "8", r: "5", key: "1hypcn" }],
|
|
404
405
|
["path", { d: "M20 21a8 8 0 0 0-16 0", key: "rfgkzh" }]
|
|
405
|
-
],
|
|
406
|
-
const
|
|
406
|
+
], Lt = A("user-round", $t);
|
|
407
|
+
const _t = [
|
|
407
408
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
408
409
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
409
|
-
],
|
|
410
|
-
"message-circle-more": /* @__PURE__ */ o(
|
|
411
|
-
"message-circle": /* @__PURE__ */ o(
|
|
412
|
-
"message-square": /* @__PURE__ */ o(
|
|
413
|
-
"messages-square": /* @__PURE__ */ o(
|
|
414
|
-
},
|
|
415
|
-
const a = (e || "B").trim().charAt(0).toUpperCase() || "B", r =
|
|
416
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" role="img" aria-label="${
|
|
417
|
-
<rect width="96" height="96" rx="48" fill="${
|
|
418
|
-
<text x="50%" y="52%" dominant-baseline="middle" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="42" font-weight="700" fill="${
|
|
410
|
+
], Le = A("x", _t), k = { "aria-hidden": !0, strokeWidth: 1.9 }, zt = /* @__PURE__ */ o(Ut, { ...k }), we = /* @__PURE__ */ o(Le, { ...k }), Et = /* @__PURE__ */ o(Le, { ...k }), Se = {
|
|
411
|
+
"message-circle-more": /* @__PURE__ */ o(Nt, { ...k }),
|
|
412
|
+
"message-circle": /* @__PURE__ */ o(Mt, { ...k }),
|
|
413
|
+
"message-square": /* @__PURE__ */ o(He, { ...k }),
|
|
414
|
+
"messages-square": /* @__PURE__ */ o($e, { ...k })
|
|
415
|
+
}, Ot = (e = "messages-square") => Se[e] || Se["messages-square"], qt = /* @__PURE__ */ o(ft, { ...k }), _e = /* @__PURE__ */ o(kt, { ...k }), jt = /* @__PURE__ */ o(He, { ...k }), Wt = /* @__PURE__ */ o(Ht, { ...k }), Gt = /* @__PURE__ */ o(Ft, { ...k }), Kt = /* @__PURE__ */ o($e, { ...k }), Jt = /* @__PURE__ */ o(Ct, { ...k }), Xt = /* @__PURE__ */ o(yt, { ...k }), Zt = /* @__PURE__ */ o(Rt, { ...k }), Yt = /* @__PURE__ */ o(Lt, { ...k }), he = (e) => String(e).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'"), Qt = ({ name: e, backgroundColor: t }) => {
|
|
416
|
+
const a = (e || "B").trim().charAt(0).toUpperCase() || "B", r = me(t), s = `
|
|
417
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" role="img" aria-label="${he(e || "Bot")}">
|
|
418
|
+
<rect width="96" height="96" rx="48" fill="${he(t)}" />
|
|
419
|
+
<text x="50%" y="52%" dominant-baseline="middle" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="42" font-weight="700" fill="${he(r)}">${he(a)}</text>
|
|
419
420
|
</svg>
|
|
420
421
|
`.trim();
|
|
421
422
|
return `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(s)}`;
|
|
422
|
-
},
|
|
423
|
+
}, eo = (e) => e ? e.payload?.type === "text" ? e.payload.text : e.payload?.type === "bloc" && e.payload.items?.some((t) => t.type === "text") ? e.payload.items.find((a) => a.type === "text")?.payload.text ?? "Conversa sem mensagens" : "Anexo enviado" : "Conversa sem mensagens", Te = [
|
|
423
424
|
{ unit: "minute", seconds: 60 },
|
|
424
425
|
{ unit: "hour", seconds: 3600 },
|
|
425
426
|
{ unit: "day", seconds: 3600 * 24 },
|
|
426
427
|
{ unit: "week", seconds: 3600 * 24 * 7 },
|
|
427
428
|
{ unit: "month", seconds: 3600 * 24 * 30 },
|
|
428
429
|
{ unit: "year", seconds: 3600 * 24 * 365 }
|
|
429
|
-
],
|
|
430
|
+
], to = new Intl.RelativeTimeFormat("pt-BR", { numeric: "auto" }), oo = (e) => {
|
|
430
431
|
const t = Math.round((new Date(e).getTime() - Date.now()) / 1e3);
|
|
431
432
|
if (Math.abs(t) < 45) return "agora";
|
|
432
|
-
let a =
|
|
433
|
-
for (const r of
|
|
433
|
+
let a = Te[0];
|
|
434
|
+
for (const r of Te)
|
|
434
435
|
Math.abs(t) >= r.seconds && (a = r);
|
|
435
|
-
return
|
|
436
|
-
},
|
|
436
|
+
return to.format(Math.round(t / a.seconds), a.unit);
|
|
437
|
+
}, ao = ({ messages: e, user: t, botName: a, botAvatar: r }) => e.map((s) => {
|
|
437
438
|
const n = s.authorId === t?.userId;
|
|
438
439
|
return {
|
|
439
440
|
...s,
|
|
440
441
|
direction: n ? "outgoing" : "incoming",
|
|
441
442
|
sender: n ? { name: t?.name ?? "Você", avatar: t?.pictureUrl } : { name: a, avatar: r }
|
|
442
443
|
};
|
|
443
|
-
}),
|
|
444
|
-
const [s, n] =
|
|
445
|
-
return
|
|
444
|
+
}), no = ({ activeView: e, clientState: t, conversationId: a, messagesLength: r }) => {
|
|
445
|
+
const [s, n] = S(!1), c = e === "chat", i = c && t === "connecting", u = c && t === "connected" && r === 0, w = s && (!c || r > 0 || t !== "connecting" && t !== "connected");
|
|
446
|
+
return M(() => {
|
|
446
447
|
if (s) {
|
|
447
|
-
if (
|
|
448
|
-
const
|
|
449
|
-
return () => window.clearTimeout(
|
|
448
|
+
if (u) {
|
|
449
|
+
const m = window.setTimeout(() => n(!1), 900);
|
|
450
|
+
return () => window.clearTimeout(m);
|
|
450
451
|
}
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
453
|
-
return () => window.clearTimeout(
|
|
452
|
+
if (w) {
|
|
453
|
+
const m = window.setTimeout(() => n(!1), 0);
|
|
454
|
+
return () => window.clearTimeout(m);
|
|
454
455
|
}
|
|
455
456
|
}
|
|
456
|
-
}, [a, s,
|
|
457
|
-
showInitialLoading:
|
|
457
|
+
}, [a, s, u, w]), {
|
|
458
|
+
showInitialLoading: i || s && c,
|
|
458
459
|
setShowInitialLoading: n
|
|
459
460
|
};
|
|
461
|
+
}, ro = 3e4, so = ({
|
|
462
|
+
getSession: e,
|
|
463
|
+
sessionKey: t,
|
|
464
|
+
onSessionChange: a
|
|
465
|
+
}) => {
|
|
466
|
+
const [r, s] = S(null), [n, c] = S(!!e), i = Z(e);
|
|
467
|
+
i.current = e;
|
|
468
|
+
const u = Z(a);
|
|
469
|
+
return u.current = a, M(() => {
|
|
470
|
+
let w = !0, m;
|
|
471
|
+
const b = (f) => {
|
|
472
|
+
w && (s(f), u.current?.(f));
|
|
473
|
+
};
|
|
474
|
+
if (!i.current) {
|
|
475
|
+
c(!1), b(null);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const U = async () => {
|
|
479
|
+
try {
|
|
480
|
+
const f = await i.current();
|
|
481
|
+
if (!f?.userToken)
|
|
482
|
+
throw new Error("Webchat session not created or empty");
|
|
483
|
+
if (!w) return;
|
|
484
|
+
b(f);
|
|
485
|
+
const B = f.expiresAt - Date.now() - ro;
|
|
486
|
+
m = setTimeout(U, Math.max(B, 0));
|
|
487
|
+
} catch (f) {
|
|
488
|
+
console.error("[EduzzWebchat] error creating session: ", f), b(null);
|
|
489
|
+
} finally {
|
|
490
|
+
w && c(!1);
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
return c(!0), U(), () => {
|
|
494
|
+
w = !1, m && clearTimeout(m);
|
|
495
|
+
};
|
|
496
|
+
}, [t, !!e]), { session: r, resolving: n };
|
|
460
497
|
};
|
|
461
|
-
function
|
|
498
|
+
function co({
|
|
462
499
|
botName: e,
|
|
463
500
|
botAvatar: t,
|
|
464
501
|
subtitle: a,
|
|
@@ -483,7 +520,7 @@ function to({
|
|
|
483
520
|
type: "button",
|
|
484
521
|
"aria-label": "Abrir início",
|
|
485
522
|
onClick: r,
|
|
486
|
-
children:
|
|
523
|
+
children: _e
|
|
487
524
|
}
|
|
488
525
|
) : null,
|
|
489
526
|
/* @__PURE__ */ o(
|
|
@@ -493,7 +530,7 @@ function to({
|
|
|
493
530
|
type: "button",
|
|
494
531
|
"aria-label": "Abrir conversas",
|
|
495
532
|
onClick: s,
|
|
496
|
-
children:
|
|
533
|
+
children: Kt
|
|
497
534
|
}
|
|
498
535
|
),
|
|
499
536
|
/* @__PURE__ */ o(
|
|
@@ -503,7 +540,7 @@ function to({
|
|
|
503
540
|
type: "button",
|
|
504
541
|
"aria-label": "Reiniciar conversa",
|
|
505
542
|
onClick: n,
|
|
506
|
-
children:
|
|
543
|
+
children: zt
|
|
507
544
|
}
|
|
508
545
|
),
|
|
509
546
|
c ? /* @__PURE__ */ o(
|
|
@@ -513,13 +550,13 @@ function to({
|
|
|
513
550
|
type: "button",
|
|
514
551
|
"aria-label": "Fechar webchat",
|
|
515
552
|
onClick: c,
|
|
516
|
-
children:
|
|
553
|
+
children: we
|
|
517
554
|
}
|
|
518
555
|
) : null
|
|
519
556
|
] })
|
|
520
557
|
] });
|
|
521
558
|
}
|
|
522
|
-
function
|
|
559
|
+
function ze() {
|
|
523
560
|
return /* @__PURE__ */ l("div", { className: "bp-webchat-loading", children: [
|
|
524
561
|
/* @__PURE__ */ l("div", { className: "bp-webchat-loading-hero", children: [
|
|
525
562
|
/* @__PURE__ */ o("div", { className: "bp-webchat-loading-circle" }),
|
|
@@ -537,7 +574,7 @@ function Pe() {
|
|
|
537
574
|
] })
|
|
538
575
|
] });
|
|
539
576
|
}
|
|
540
|
-
function
|
|
577
|
+
function lo({
|
|
541
578
|
config: e,
|
|
542
579
|
allowFileUpload: t,
|
|
543
580
|
clientState: a,
|
|
@@ -545,36 +582,36 @@ function oo({
|
|
|
545
582
|
messages: s,
|
|
546
583
|
renderers: n,
|
|
547
584
|
sendMessage: c,
|
|
548
|
-
uploadFile:
|
|
549
|
-
addMessageFeedback:
|
|
550
|
-
showInitialLoading:
|
|
551
|
-
onShowHome:
|
|
552
|
-
onOpenHistory:
|
|
553
|
-
onRestartConversation:
|
|
554
|
-
onCloseWidget:
|
|
585
|
+
uploadFile: i,
|
|
586
|
+
addMessageFeedback: u,
|
|
587
|
+
showInitialLoading: w,
|
|
588
|
+
onShowHome: m,
|
|
589
|
+
onOpenHistory: b,
|
|
590
|
+
onRestartConversation: U,
|
|
591
|
+
onCloseWidget: f
|
|
555
592
|
}) {
|
|
556
593
|
return /* @__PURE__ */ l("div", { className: "bp-webchat-layout", children: [
|
|
557
594
|
/* @__PURE__ */ o(
|
|
558
|
-
|
|
595
|
+
co,
|
|
559
596
|
{
|
|
560
597
|
botName: e.botName,
|
|
561
598
|
botAvatar: e.botAvatar,
|
|
562
599
|
subtitle: e.subtitle,
|
|
563
|
-
onShowHome:
|
|
564
|
-
onOpenHistory:
|
|
565
|
-
onRestartConversation:
|
|
566
|
-
onCloseWidget:
|
|
600
|
+
onShowHome: m,
|
|
601
|
+
onOpenHistory: b,
|
|
602
|
+
onRestartConversation: U,
|
|
603
|
+
onCloseWidget: f
|
|
567
604
|
}
|
|
568
605
|
),
|
|
569
606
|
/* @__PURE__ */ o(
|
|
570
|
-
|
|
607
|
+
Ke,
|
|
571
608
|
{
|
|
572
609
|
className: "bp-webchat-container",
|
|
573
|
-
uploadFile:
|
|
610
|
+
uploadFile: i,
|
|
574
611
|
allowFileUpload: t,
|
|
575
|
-
children:
|
|
612
|
+
children: w ? /* @__PURE__ */ o(ze, {}) : /* @__PURE__ */ l(Ve, { children: [
|
|
576
613
|
/* @__PURE__ */ o(
|
|
577
|
-
|
|
614
|
+
Je,
|
|
578
615
|
{
|
|
579
616
|
botName: e.botName,
|
|
580
617
|
botDescription: e.subtitle,
|
|
@@ -582,7 +619,7 @@ function oo({
|
|
|
582
619
|
isTyping: r,
|
|
583
620
|
messages: s,
|
|
584
621
|
sendMessage: c,
|
|
585
|
-
addMessageFeedback:
|
|
622
|
+
addMessageFeedback: u,
|
|
586
623
|
renderers: n,
|
|
587
624
|
showDateSystemMessage: !1,
|
|
588
625
|
showMessageStatus: !1,
|
|
@@ -591,11 +628,11 @@ function oo({
|
|
|
591
628
|
}
|
|
592
629
|
),
|
|
593
630
|
/* @__PURE__ */ o(
|
|
594
|
-
|
|
631
|
+
Xe,
|
|
595
632
|
{
|
|
596
633
|
connected: a !== "disconnected",
|
|
597
634
|
sendMessage: c,
|
|
598
|
-
uploadFile:
|
|
635
|
+
uploadFile: i,
|
|
599
636
|
allowFileUpload: t,
|
|
600
637
|
composerPlaceholder: e.placeholder,
|
|
601
638
|
disableSendButton: !1
|
|
@@ -606,7 +643,7 @@ function oo({
|
|
|
606
643
|
)
|
|
607
644
|
] });
|
|
608
645
|
}
|
|
609
|
-
function
|
|
646
|
+
function Ee({ activeView: e, onShowHome: t, onShowConversations: a }) {
|
|
610
647
|
return /* @__PURE__ */ l("div", { className: "bp-webchat-tabs bp-webchat-welcome-bottom", children: [
|
|
611
648
|
/* @__PURE__ */ l(
|
|
612
649
|
"button",
|
|
@@ -616,7 +653,7 @@ function He({ activeView: e, onShowHome: t, onShowConversations: a }) {
|
|
|
616
653
|
type: "button",
|
|
617
654
|
onClick: t,
|
|
618
655
|
children: [
|
|
619
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-tab-icon bp-webchat-welcome-tab-icon", children:
|
|
656
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-tab-icon bp-webchat-welcome-tab-icon", children: _e }),
|
|
620
657
|
/* @__PURE__ */ o("span", { children: "Início" })
|
|
621
658
|
]
|
|
622
659
|
}
|
|
@@ -629,14 +666,14 @@ function He({ activeView: e, onShowHome: t, onShowConversations: a }) {
|
|
|
629
666
|
type: "button",
|
|
630
667
|
onClick: a,
|
|
631
668
|
children: [
|
|
632
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-tab-icon bp-webchat-welcome-tab-icon", children:
|
|
669
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-tab-icon bp-webchat-welcome-tab-icon", children: jt }),
|
|
633
670
|
/* @__PURE__ */ o("span", { children: "Conversas" })
|
|
634
671
|
]
|
|
635
672
|
}
|
|
636
673
|
)
|
|
637
674
|
] });
|
|
638
675
|
}
|
|
639
|
-
function
|
|
676
|
+
function io({
|
|
640
677
|
conversations: e,
|
|
641
678
|
currentConversationId: t,
|
|
642
679
|
isLoading: a,
|
|
@@ -644,10 +681,10 @@ function ao({
|
|
|
644
681
|
botName: s,
|
|
645
682
|
onClose: n,
|
|
646
683
|
onCloseWidget: c,
|
|
647
|
-
onShowHome:
|
|
648
|
-
onShowConversations:
|
|
649
|
-
onNewConversation:
|
|
650
|
-
onConversationClick:
|
|
684
|
+
onShowHome: i,
|
|
685
|
+
onShowConversations: u,
|
|
686
|
+
onNewConversation: w,
|
|
687
|
+
onConversationClick: m
|
|
651
688
|
}) {
|
|
652
689
|
return /* @__PURE__ */ l("div", { className: "bp-webchat-history", children: [
|
|
653
690
|
/* @__PURE__ */ l("div", { className: "bp-webchat-history-header", children: [
|
|
@@ -660,7 +697,7 @@ function ao({
|
|
|
660
697
|
type: "button",
|
|
661
698
|
onClick: n,
|
|
662
699
|
"aria-label": "Fechar conversas",
|
|
663
|
-
children:
|
|
700
|
+
children: we
|
|
664
701
|
}
|
|
665
702
|
),
|
|
666
703
|
c ? /* @__PURE__ */ o(
|
|
@@ -670,47 +707,143 @@ function ao({
|
|
|
670
707
|
type: "button",
|
|
671
708
|
onClick: c,
|
|
672
709
|
"aria-label": "Fechar webchat",
|
|
673
|
-
children:
|
|
710
|
+
children: we
|
|
674
711
|
}
|
|
675
712
|
) : null
|
|
676
713
|
] })
|
|
677
714
|
] }),
|
|
678
|
-
/* @__PURE__ */ o("div", { className: "bp-webchat-history-list", children: a ? /* @__PURE__ */ o("div", { className: "bp-webchat-history-loading", children: "Carregando conversas..." }) : e.length === 0 ? /* @__PURE__ */ o("div", { className: "bp-webchat-history-empty", children: "Nenhuma conversa iniciada ainda." }) : e.map((
|
|
679
|
-
const
|
|
715
|
+
/* @__PURE__ */ o("div", { className: "bp-webchat-history-list", children: a ? /* @__PURE__ */ o("div", { className: "bp-webchat-history-loading", children: "Carregando conversas..." }) : e.length === 0 ? /* @__PURE__ */ o("div", { className: "bp-webchat-history-empty", children: "Nenhuma conversa iniciada ainda." }) : e.map((b) => {
|
|
716
|
+
const U = eo(b.lastMessage), f = b.lastMessage?.author?.type === "bot";
|
|
680
717
|
return /* @__PURE__ */ l(
|
|
681
718
|
"button",
|
|
682
719
|
{
|
|
683
720
|
className: "bp-webchat-history-item",
|
|
684
721
|
type: "button",
|
|
685
|
-
onClick: () =>
|
|
686
|
-
"data-current":
|
|
722
|
+
onClick: () => m(b.id),
|
|
723
|
+
"data-current": b.id === t || void 0,
|
|
687
724
|
children: [
|
|
688
|
-
/* @__PURE__ */ o("div", { className: "bp-webchat-history-avatar", "data-kind":
|
|
725
|
+
/* @__PURE__ */ o("div", { className: "bp-webchat-history-avatar", "data-kind": f ? "bot" : "user", children: f && r ? /* @__PURE__ */ o("img", { src: r, alt: "" }) : f ? /* @__PURE__ */ o("span", { children: (s || "B").slice(0, 1).toUpperCase() }) : Yt }),
|
|
689
726
|
/* @__PURE__ */ l("div", { className: "bp-webchat-history-content", children: [
|
|
690
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-history-name", children:
|
|
691
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-history-time", children:
|
|
727
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-history-name", children: U }),
|
|
728
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-history-time", children: oo(b.updatedAt) })
|
|
692
729
|
] }),
|
|
693
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-history-chevron", children:
|
|
730
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-history-chevron", children: Jt })
|
|
694
731
|
]
|
|
695
732
|
},
|
|
696
|
-
|
|
733
|
+
b.id
|
|
697
734
|
);
|
|
698
735
|
}) }),
|
|
699
|
-
/* @__PURE__ */ o("div", { className: "bp-webchat-history-footer", children: /* @__PURE__ */ l("button", { className: "bp-webchat-history-new", type: "button", onClick:
|
|
700
|
-
|
|
736
|
+
/* @__PURE__ */ o("div", { className: "bp-webchat-history-footer", children: /* @__PURE__ */ l("button", { className: "bp-webchat-history-new", type: "button", onClick: w, children: [
|
|
737
|
+
Zt,
|
|
701
738
|
/* @__PURE__ */ o("span", { children: "Nova conversa" })
|
|
702
739
|
] }) }),
|
|
703
740
|
/* @__PURE__ */ o(
|
|
704
|
-
|
|
741
|
+
Ee,
|
|
705
742
|
{
|
|
706
743
|
activeView: "conversations",
|
|
707
|
-
onShowHome:
|
|
708
|
-
onShowConversations:
|
|
744
|
+
onShowHome: i,
|
|
745
|
+
onShowConversations: u
|
|
709
746
|
}
|
|
710
747
|
)
|
|
711
748
|
] });
|
|
712
749
|
}
|
|
713
|
-
|
|
750
|
+
const Ae = (e) => String(e ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim();
|
|
751
|
+
function uo(e) {
|
|
752
|
+
const { label: t, options: a = [], sendMessage: r, isReadOnly: s, messageId: n } = e, [c, i] = S(!1), [u, w] = S(""), [m, b] = S(0), [U, f] = S(null), B = Z(null), F = Z([]), _ = s || U !== null || a.length === 0, V = C(() => {
|
|
753
|
+
const d = Ae(u);
|
|
754
|
+
return d ? a.filter((p) => Ae(p.label).includes(d)) : a;
|
|
755
|
+
}, [a, u]);
|
|
756
|
+
M(() => {
|
|
757
|
+
b(0);
|
|
758
|
+
}, [u]), M(() => {
|
|
759
|
+
if (!c) return;
|
|
760
|
+
const d = (p) => {
|
|
761
|
+
B.current && !B.current.contains(p.target) && i(!1);
|
|
762
|
+
};
|
|
763
|
+
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
764
|
+
}, [c]), M(() => {
|
|
765
|
+
c && F.current[m]?.scrollIntoView({ block: "nearest" });
|
|
766
|
+
}, [m, c]);
|
|
767
|
+
const j = (d) => {
|
|
768
|
+
d && (r?.({ type: "text", text: d.label, value: d.value }), f(d.label), w(""), i(!1));
|
|
769
|
+
}, W = (d) => {
|
|
770
|
+
if (!_)
|
|
771
|
+
switch (d.key) {
|
|
772
|
+
case "ArrowDown":
|
|
773
|
+
if (d.preventDefault(), !c) {
|
|
774
|
+
i(!0);
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
b((p) => Math.min(p + 1, V.length - 1));
|
|
778
|
+
break;
|
|
779
|
+
case "ArrowUp":
|
|
780
|
+
d.preventDefault(), b((p) => Math.max(p - 1, 0));
|
|
781
|
+
break;
|
|
782
|
+
case "Enter":
|
|
783
|
+
d.preventDefault(), c && j(V[m]);
|
|
784
|
+
break;
|
|
785
|
+
case "Escape":
|
|
786
|
+
i(!1);
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
}, x = `bpDropdownList-${n ?? "x"}`;
|
|
790
|
+
return /* @__PURE__ */ l(
|
|
791
|
+
"div",
|
|
792
|
+
{
|
|
793
|
+
className: "bpDropdown",
|
|
794
|
+
"data-open": c || void 0,
|
|
795
|
+
"data-disabled": _ || void 0,
|
|
796
|
+
ref: B,
|
|
797
|
+
children: [
|
|
798
|
+
t ? /* @__PURE__ */ o("span", { className: "bpDropdownLabel", children: t }) : null,
|
|
799
|
+
/* @__PURE__ */ l("div", { className: "bpDropdownControl", children: [
|
|
800
|
+
/* @__PURE__ */ o(
|
|
801
|
+
"input",
|
|
802
|
+
{
|
|
803
|
+
className: "bpDropdownInput",
|
|
804
|
+
type: "text",
|
|
805
|
+
role: "combobox",
|
|
806
|
+
"aria-expanded": c,
|
|
807
|
+
"aria-controls": x,
|
|
808
|
+
"aria-autocomplete": "list",
|
|
809
|
+
autoComplete: "off",
|
|
810
|
+
placeholder: "Selecione...",
|
|
811
|
+
value: U ?? u,
|
|
812
|
+
disabled: _,
|
|
813
|
+
onFocus: () => {
|
|
814
|
+
_ || i(!0);
|
|
815
|
+
},
|
|
816
|
+
onChange: (d) => {
|
|
817
|
+
w(d.target.value), i(!0);
|
|
818
|
+
},
|
|
819
|
+
onKeyDown: W
|
|
820
|
+
}
|
|
821
|
+
),
|
|
822
|
+
/* @__PURE__ */ o("span", { className: "bpDropdownChevron", children: Xt })
|
|
823
|
+
] }),
|
|
824
|
+
c && !_ ? /* @__PURE__ */ o("ul", { className: "bpDropdownMenu", id: x, role: "listbox", children: V.length > 0 ? V.map((d, p) => /* @__PURE__ */ o(
|
|
825
|
+
"li",
|
|
826
|
+
{
|
|
827
|
+
ref: (R) => {
|
|
828
|
+
F.current[p] = R;
|
|
829
|
+
},
|
|
830
|
+
className: "bpDropdownOption",
|
|
831
|
+
role: "option",
|
|
832
|
+
"aria-selected": p === m,
|
|
833
|
+
"data-active": p === m || void 0,
|
|
834
|
+
onMouseEnter: () => b(p),
|
|
835
|
+
onMouseDown: (R) => {
|
|
836
|
+
R.preventDefault(), j(d);
|
|
837
|
+
},
|
|
838
|
+
children: d.label
|
|
839
|
+
},
|
|
840
|
+
d.value
|
|
841
|
+
)) : /* @__PURE__ */ o("li", { className: "bpDropdownEmpty", role: "presentation", children: "Nenhuma opção encontrada" }) }) : null
|
|
842
|
+
]
|
|
843
|
+
}
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
function bo({ open: e, draft: t, setDraft: a, onConfirm: r, onCancel: s }) {
|
|
714
847
|
return e ? /* @__PURE__ */ o("div", { className: "bp-webchat-modal-backdrop", children: /* @__PURE__ */ l("div", { className: "bp-webchat-modal", children: [
|
|
715
848
|
/* @__PURE__ */ o("h3", { className: "bp-webchat-modal-title", children: "Nos ajude a melhorar" }),
|
|
716
849
|
/* @__PURE__ */ o("p", { className: "bp-webchat-modal-description", children: "Conte o que não ficou bom nesta resposta." }),
|
|
@@ -737,7 +870,7 @@ function no({ open: e, draft: t, setDraft: a, onConfirm: r, onCancel: s }) {
|
|
|
737
870
|
] })
|
|
738
871
|
] }) }) : null;
|
|
739
872
|
}
|
|
740
|
-
function
|
|
873
|
+
function ho({ open: e, onConfirm: t, onCancel: a }) {
|
|
741
874
|
return e ? /* @__PURE__ */ o("div", { className: "bp-webchat-modal-backdrop", children: /* @__PURE__ */ l("div", { className: "bp-webchat-modal", children: [
|
|
742
875
|
/* @__PURE__ */ o("h3", { className: "bp-webchat-modal-title", children: "Criar nova conversa" }),
|
|
743
876
|
/* @__PURE__ */ o("p", { className: "bp-webchat-modal-description", children: "Isso vai limpar a conversa atual e iniciar uma nova sessão com o bot." }),
|
|
@@ -755,7 +888,7 @@ function ro({ open: e, onConfirm: t, onCancel: a }) {
|
|
|
755
888
|
] })
|
|
756
889
|
] }) }) : null;
|
|
757
890
|
}
|
|
758
|
-
function
|
|
891
|
+
function po({ config: e, activeView: t, onShowHome: a, onShowConversations: r, onStart: s, onClose: n }) {
|
|
759
892
|
const c = e.welcomeCardImage || e.botAvatar;
|
|
760
893
|
return /* @__PURE__ */ l("div", { className: "bp-webchat-welcome", children: [
|
|
761
894
|
/* @__PURE__ */ l("div", { className: "bp-webchat-welcome-hero", children: [
|
|
@@ -766,7 +899,7 @@ function so({ config: e, activeView: t, onShowHome: a, onShowConversations: r, o
|
|
|
766
899
|
type: "button",
|
|
767
900
|
onClick: n,
|
|
768
901
|
"aria-label": e.welcomeCloseLabel,
|
|
769
|
-
children:
|
|
902
|
+
children: we
|
|
770
903
|
}
|
|
771
904
|
),
|
|
772
905
|
e.welcomeCoverImage ? /* @__PURE__ */ o("img", { className: "bp-webchat-welcome-cover", src: e.welcomeCoverImage, alt: "" }) : null
|
|
@@ -781,11 +914,11 @@ function so({ config: e, activeView: t, onShowHome: a, onShowConversations: r, o
|
|
|
781
914
|
/* @__PURE__ */ o("span", { className: "bp-webchat-welcome-cta-title", children: e.welcomeCtaLabel }),
|
|
782
915
|
e.welcomeButtonDescription ? /* @__PURE__ */ o("span", { className: "bp-webchat-welcome-cta-description", children: e.welcomeButtonDescription }) : null
|
|
783
916
|
] }) }),
|
|
784
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-welcome-cta-right", children:
|
|
917
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-welcome-cta-right", children: qt })
|
|
785
918
|
] })
|
|
786
919
|
] }) }),
|
|
787
920
|
/* @__PURE__ */ o(
|
|
788
|
-
|
|
921
|
+
Ee,
|
|
789
922
|
{
|
|
790
923
|
activeView: t,
|
|
791
924
|
onShowHome: a,
|
|
@@ -794,47 +927,47 @@ function so({ config: e, activeView: t, onShowHome: a, onShowConversations: r, o
|
|
|
794
927
|
)
|
|
795
928
|
] });
|
|
796
929
|
}
|
|
797
|
-
const
|
|
930
|
+
const mo = 220, fe = "eduzz-webchat", Be = Object.freeze({
|
|
798
931
|
allowFileUpload: !1,
|
|
799
932
|
allowMessageFeedback: !1
|
|
800
|
-
}),
|
|
933
|
+
}), wo = "anonymous-id", fo = (e) => !!e && typeof e == "object" && !Array.isArray(e), Oe = (e) => e.replace(/\/+$/, ""), Ie = ({ webchatProxyUrl: e }) => {
|
|
801
934
|
if (typeof e != "string" || !e.trim())
|
|
802
935
|
return null;
|
|
803
|
-
const t =
|
|
936
|
+
const t = Oe(e.trim()), a = "/webchat/proxy";
|
|
804
937
|
return t.endsWith(a) ? t.slice(0, -a.length) : null;
|
|
805
|
-
},
|
|
938
|
+
}, go = ({ webchatProxyUrl: e, clientId: t }) => !e || !t ? null : `${e.endsWith("/") ? e.slice(0, -1) : e}/${encodeURIComponent(t)}/runtime-config`, yo = ({ webchatProxyUrl: e, clientId: t, presetSlug: a }) => {
|
|
806
939
|
if (!e || !t)
|
|
807
940
|
return null;
|
|
808
|
-
const r =
|
|
941
|
+
const r = Ie({ webchatProxyUrl: e });
|
|
809
942
|
if (!r)
|
|
810
943
|
return null;
|
|
811
944
|
const s = new URLSearchParams();
|
|
812
945
|
typeof a == "string" && a.trim() && s.set("slug", a.trim());
|
|
813
946
|
const n = s.toString();
|
|
814
947
|
return `${r}/webchat/bootstrap/${encodeURIComponent(t)}${n ? `?${n}` : ""}`;
|
|
815
|
-
},
|
|
948
|
+
}, vo = (e) => {
|
|
816
949
|
const t = e && typeof e == "object" && e.data && typeof e.data == "object" ? e.data : e;
|
|
817
950
|
return t && typeof t == "object" ? t : null;
|
|
818
|
-
},
|
|
951
|
+
}, ne = (e) => fo(e) ? e : null, Co = (e) => {
|
|
819
952
|
if (!e) return "";
|
|
820
953
|
try {
|
|
821
954
|
return JSON.stringify(e);
|
|
822
955
|
} catch {
|
|
823
956
|
return String(Date.now());
|
|
824
957
|
}
|
|
825
|
-
},
|
|
958
|
+
}, qe = (e) => {
|
|
826
959
|
if (typeof window > "u") return null;
|
|
827
960
|
try {
|
|
828
961
|
return e === "sessionStorage" ? window.sessionStorage : window.localStorage;
|
|
829
962
|
} catch {
|
|
830
963
|
return null;
|
|
831
964
|
}
|
|
832
|
-
},
|
|
833
|
-
const a =
|
|
965
|
+
}, je = ({ storageKey: e, storageLocation: t }) => {
|
|
966
|
+
const a = qe(t);
|
|
834
967
|
if (!a) return null;
|
|
835
968
|
try {
|
|
836
969
|
const r = a.getItem(
|
|
837
|
-
`${e ||
|
|
970
|
+
`${e || fe}-client`
|
|
838
971
|
);
|
|
839
972
|
if (!r) return null;
|
|
840
973
|
const s = JSON.parse(r), n = typeof s?.state == "string" ? JSON.parse(s.state) : s?.state ?? s;
|
|
@@ -842,10 +975,10 @@ const co = 220, ie = "eduzz-webchat", be = Object.freeze({
|
|
|
842
975
|
} catch {
|
|
843
976
|
return;
|
|
844
977
|
}
|
|
845
|
-
},
|
|
846
|
-
const a =
|
|
978
|
+
}, Bo = ({ storageKey: e, storageLocation: t }) => {
|
|
979
|
+
const a = je({ storageKey: e, storageLocation: t });
|
|
847
980
|
return typeof a?.conversationId == "string" && a.conversationId.trim() || void 0;
|
|
848
|
-
},
|
|
981
|
+
}, Ue = () => {
|
|
849
982
|
try {
|
|
850
983
|
if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
|
|
851
984
|
return crypto.randomUUID();
|
|
@@ -859,19 +992,19 @@ const co = 220, ie = "eduzz-webchat", be = Object.freeze({
|
|
|
859
992
|
const t = Math.random() * 16 | 0;
|
|
860
993
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
861
994
|
});
|
|
862
|
-
},
|
|
863
|
-
const a =
|
|
995
|
+
}, ko = (e) => `${e || fe}-${wo}`, xo = ({ storageKey: e, storageLocation: t }) => {
|
|
996
|
+
const a = qe(t), r = ko(e);
|
|
864
997
|
try {
|
|
865
998
|
const s = a?.getItem(r);
|
|
866
999
|
if (s)
|
|
867
1000
|
return s;
|
|
868
|
-
const n = `anon_${
|
|
1001
|
+
const n = `anon_${Ue()}`;
|
|
869
1002
|
return a?.setItem(r, n), n;
|
|
870
1003
|
} catch {
|
|
871
|
-
return `anon_${
|
|
1004
|
+
return `anon_${Ue()}`;
|
|
872
1005
|
}
|
|
873
|
-
},
|
|
874
|
-
const r =
|
|
1006
|
+
}, No = async ({ webchatProxyUrl: e, clientId: t, accountId: a }) => {
|
|
1007
|
+
const r = Ie({ webchatProxyUrl: e });
|
|
875
1008
|
if (!r)
|
|
876
1009
|
throw new Error("public session request requires a valid webchatProxyUrl");
|
|
877
1010
|
const s = await fetch(
|
|
@@ -895,11 +1028,11 @@ const co = 220, ie = "eduzz-webchat", be = Object.freeze({
|
|
|
895
1028
|
userId: c.userId,
|
|
896
1029
|
userToken: c.userToken
|
|
897
1030
|
};
|
|
898
|
-
},
|
|
1031
|
+
}, Io = (e) => ({
|
|
899
1032
|
...typeof e.name == "string" && e.name.trim() ? { name: e.name.trim() } : {},
|
|
900
1033
|
...typeof e.pictureUrl == "string" && e.pictureUrl.trim() ? { pictureUrl: e.pictureUrl.trim() } : {},
|
|
901
1034
|
userData: e
|
|
902
|
-
}),
|
|
1035
|
+
}), Mo = ({
|
|
903
1036
|
showWelcomeScreen: e,
|
|
904
1037
|
storageKey: t,
|
|
905
1038
|
storageLocation: a,
|
|
@@ -910,14 +1043,14 @@ const co = 220, ie = "eduzz-webchat", be = Object.freeze({
|
|
|
910
1043
|
return { activeView: "chat", historyReturnView: "chat", bootstrapView: "chat" };
|
|
911
1044
|
if (r && s)
|
|
912
1045
|
return { activeView: "chat", historyReturnView: "chat", bootstrapView: "chat" };
|
|
913
|
-
const n =
|
|
1046
|
+
const n = je({ storageKey: t, storageLocation: a });
|
|
914
1047
|
if (n == null)
|
|
915
1048
|
return { activeView: "home", historyReturnView: "home", bootstrapView: "home" };
|
|
916
1049
|
if (n === void 0)
|
|
917
1050
|
return { activeView: "pending", historyReturnView: "home", bootstrapView: "pending" };
|
|
918
|
-
const c = typeof n.conversationId == "string" ? n.conversationId.trim() : "",
|
|
919
|
-
return c &&
|
|
920
|
-
},
|
|
1051
|
+
const c = typeof n.conversationId == "string" ? n.conversationId.trim() : "", i = typeof n.user?.userToken == "string" ? n.user.userToken.trim() : "";
|
|
1052
|
+
return c && i ? { activeView: "chat", historyReturnView: "chat", bootstrapView: "chat" } : !c && !i ? { activeView: "home", historyReturnView: "home", bootstrapView: "home" } : { activeView: "pending", historyReturnView: "home", bootstrapView: "pending" };
|
|
1053
|
+
}, So = (e, t) => {
|
|
921
1054
|
switch (t.type) {
|
|
922
1055
|
case "show":
|
|
923
1056
|
return { isPanelMounted: !0, isPanelVisible: e.isPanelVisible };
|
|
@@ -931,7 +1064,7 @@ const co = 220, ie = "eduzz-webchat", be = Object.freeze({
|
|
|
931
1064
|
return e;
|
|
932
1065
|
}
|
|
933
1066
|
};
|
|
934
|
-
function
|
|
1067
|
+
function Ro({
|
|
935
1068
|
clientId: e,
|
|
936
1069
|
webchatProxyUrl: t,
|
|
937
1070
|
userCredentials: a,
|
|
@@ -939,199 +1072,206 @@ function Io({
|
|
|
939
1072
|
config: s,
|
|
940
1073
|
defaultUserData: n,
|
|
941
1074
|
presetSlug: c,
|
|
942
|
-
storageKey:
|
|
943
|
-
storageLocation:
|
|
944
|
-
defaultOpen:
|
|
945
|
-
onUserApiChange:
|
|
1075
|
+
storageKey: i = fe,
|
|
1076
|
+
storageLocation: u = "localStorage",
|
|
1077
|
+
defaultOpen: w,
|
|
1078
|
+
onUserApiChange: m,
|
|
1079
|
+
getSession: b,
|
|
1080
|
+
sessionKey: U,
|
|
1081
|
+
onSessionChange: f
|
|
946
1082
|
}) {
|
|
947
|
-
const
|
|
1083
|
+
const { session: B, resolving: F } = so({
|
|
1084
|
+
getSession: b,
|
|
1085
|
+
sessionKey: U,
|
|
1086
|
+
onSessionChange: f
|
|
1087
|
+
}), Y = !!B && Date.now() < B.expiresAt, _ = Y ? { userId: B.userId, userToken: B.userToken } : void 0, V = b ? _ : a, j = Y ? B.conversationId : void 0, W = C(
|
|
948
1088
|
() => typeof c == "string" && c.trim() ? c.trim() : void 0,
|
|
949
1089
|
[c]
|
|
950
|
-
),
|
|
951
|
-
() => typeof t == "string" && t.trim() ?
|
|
1090
|
+
), x = C(
|
|
1091
|
+
() => typeof t == "string" && t.trim() ? Oe(t.trim()) : void 0,
|
|
952
1092
|
[t]
|
|
953
1093
|
);
|
|
954
|
-
|
|
955
|
-
() =>
|
|
956
|
-
[
|
|
1094
|
+
C(
|
|
1095
|
+
() => x ? Ie({ webchatProxyUrl: x }) : null,
|
|
1096
|
+
[x]
|
|
957
1097
|
);
|
|
958
|
-
const
|
|
959
|
-
() =>
|
|
960
|
-
webchatProxyUrl:
|
|
1098
|
+
const d = !!(e && x && (W || !V)), p = C(
|
|
1099
|
+
() => d ? yo({
|
|
1100
|
+
webchatProxyUrl: x,
|
|
961
1101
|
clientId: e,
|
|
962
|
-
presetSlug:
|
|
1102
|
+
presetSlug: W
|
|
963
1103
|
}) : null,
|
|
964
|
-
[e,
|
|
965
|
-
), [
|
|
1104
|
+
[e, W, x, d]
|
|
1105
|
+
), [R, Q] = S({
|
|
966
1106
|
error: null,
|
|
967
1107
|
isLoading: !1,
|
|
968
1108
|
payload: null,
|
|
969
1109
|
url: null
|
|
970
1110
|
});
|
|
971
|
-
|
|
972
|
-
if (!
|
|
973
|
-
|
|
1111
|
+
M(() => {
|
|
1112
|
+
if (!p) {
|
|
1113
|
+
Q({ error: null, isLoading: !1, payload: null, url: null });
|
|
974
1114
|
return;
|
|
975
1115
|
}
|
|
976
|
-
const
|
|
977
|
-
return
|
|
1116
|
+
const N = new AbortController();
|
|
1117
|
+
return Q({ error: null, isLoading: !0, payload: null, url: p }), fetch(p, {
|
|
978
1118
|
headers: {
|
|
979
1119
|
accept: "application/json"
|
|
980
1120
|
},
|
|
981
|
-
signal:
|
|
982
|
-
}).then(async (
|
|
983
|
-
if (!
|
|
984
|
-
throw new Error(`bootstrap request failed with status ${
|
|
985
|
-
return
|
|
986
|
-
}).then((
|
|
987
|
-
const
|
|
988
|
-
if (!
|
|
1121
|
+
signal: N.signal
|
|
1122
|
+
}).then(async (v) => {
|
|
1123
|
+
if (!v.ok)
|
|
1124
|
+
throw new Error(`bootstrap request failed with status ${v.status}`);
|
|
1125
|
+
return v.json();
|
|
1126
|
+
}).then((v) => {
|
|
1127
|
+
const H = vo(v);
|
|
1128
|
+
if (!H)
|
|
989
1129
|
throw new Error("bootstrap response is invalid");
|
|
990
|
-
|
|
1130
|
+
Q({
|
|
991
1131
|
error: null,
|
|
992
1132
|
isLoading: !1,
|
|
993
|
-
payload:
|
|
994
|
-
url:
|
|
1133
|
+
payload: H,
|
|
1134
|
+
url: p
|
|
995
1135
|
});
|
|
996
|
-
}).catch((
|
|
997
|
-
|
|
998
|
-
}), () =>
|
|
999
|
-
}, [
|
|
1000
|
-
const y =
|
|
1136
|
+
}).catch((v) => {
|
|
1137
|
+
N.signal.aborted || (console.warn("[EduzzWebchat] failed to load bootstrap", v), Q({ error: v, isLoading: !1, payload: null, url: p }));
|
|
1138
|
+
}), () => N.abort();
|
|
1139
|
+
}, [p]);
|
|
1140
|
+
const y = p && R.url === p ? R.payload : null, ie = p && R.url === p ? R.error : null, T = y?.clientId || e, P = x || y?.webchatProxyUrl || void 0, z = i === fe && y?.storageKey ? y.storageKey : i, G = typeof w == "boolean" ? w : typeof y?.defaultOpen == "boolean" ? y.defaultOpen : w, D = C(
|
|
1001
1141
|
() => ({
|
|
1002
|
-
...
|
|
1003
|
-
...
|
|
1142
|
+
...ne(y?.config) || {},
|
|
1143
|
+
...ne(s) || {}
|
|
1004
1144
|
}),
|
|
1005
1145
|
[y, s]
|
|
1006
|
-
),
|
|
1146
|
+
), ge = C(
|
|
1007
1147
|
() => {
|
|
1008
|
-
const
|
|
1009
|
-
...
|
|
1010
|
-
...
|
|
1148
|
+
const N = {
|
|
1149
|
+
...ne(y?.defaultUserData) || {},
|
|
1150
|
+
...ne(n) || {}
|
|
1011
1151
|
};
|
|
1012
|
-
return Object.keys(
|
|
1152
|
+
return Object.keys(N).length > 0 ? N : null;
|
|
1013
1153
|
},
|
|
1014
1154
|
[n, y]
|
|
1015
|
-
),
|
|
1155
|
+
), E = !!(!V && !F && y?.sessionMode === "service-hub" && P && T), [re, ee] = S({
|
|
1016
1156
|
error: null,
|
|
1017
1157
|
isLoading: !1,
|
|
1018
1158
|
payload: null,
|
|
1019
1159
|
key: null
|
|
1020
1160
|
});
|
|
1021
|
-
|
|
1022
|
-
if (!
|
|
1023
|
-
|
|
1161
|
+
M(() => {
|
|
1162
|
+
if (!E) {
|
|
1163
|
+
ee({ error: null, isLoading: !1, payload: null, key: null });
|
|
1024
1164
|
return;
|
|
1025
1165
|
}
|
|
1026
|
-
const
|
|
1027
|
-
storageKey:
|
|
1028
|
-
storageLocation:
|
|
1029
|
-
}),
|
|
1030
|
-
let
|
|
1031
|
-
return
|
|
1166
|
+
const N = xo({
|
|
1167
|
+
storageKey: z,
|
|
1168
|
+
storageLocation: u
|
|
1169
|
+
}), v = `${T}:${P}:${N}`;
|
|
1170
|
+
let H = !1;
|
|
1171
|
+
return ee({
|
|
1032
1172
|
error: null,
|
|
1033
1173
|
isLoading: !0,
|
|
1034
1174
|
payload: null,
|
|
1035
|
-
key:
|
|
1036
|
-
}),
|
|
1175
|
+
key: v
|
|
1176
|
+
}), No({
|
|
1037
1177
|
webchatProxyUrl: P,
|
|
1038
|
-
clientId:
|
|
1039
|
-
accountId:
|
|
1040
|
-
}).then((
|
|
1041
|
-
|
|
1178
|
+
clientId: T,
|
|
1179
|
+
accountId: N
|
|
1180
|
+
}).then((g) => {
|
|
1181
|
+
H || ee({
|
|
1042
1182
|
error: null,
|
|
1043
1183
|
isLoading: !1,
|
|
1044
|
-
payload:
|
|
1045
|
-
key:
|
|
1184
|
+
payload: g,
|
|
1185
|
+
key: v
|
|
1046
1186
|
});
|
|
1047
|
-
}).catch((
|
|
1048
|
-
|
|
1049
|
-
error:
|
|
1187
|
+
}).catch((g) => {
|
|
1188
|
+
H || (console.warn("[EduzzWebchat] failed to open public session", g), ee({
|
|
1189
|
+
error: g,
|
|
1050
1190
|
isLoading: !1,
|
|
1051
1191
|
payload: null,
|
|
1052
|
-
key:
|
|
1192
|
+
key: v
|
|
1053
1193
|
}));
|
|
1054
1194
|
}), () => {
|
|
1055
|
-
|
|
1195
|
+
H = !0;
|
|
1056
1196
|
};
|
|
1057
1197
|
}, [
|
|
1058
|
-
S,
|
|
1059
1198
|
T,
|
|
1199
|
+
z,
|
|
1060
1200
|
P,
|
|
1061
|
-
|
|
1062
|
-
|
|
1201
|
+
E,
|
|
1202
|
+
u
|
|
1063
1203
|
]);
|
|
1064
|
-
const
|
|
1065
|
-
() => r ||
|
|
1066
|
-
storageKey:
|
|
1067
|
-
storageLocation:
|
|
1204
|
+
const K = E ? re.payload : null, te = V || K, O = C(() => it(D), [D]), oe = C(
|
|
1205
|
+
() => j || r || Bo({
|
|
1206
|
+
storageKey: z,
|
|
1207
|
+
storageLocation: u
|
|
1068
1208
|
}),
|
|
1069
|
-
[r,
|
|
1070
|
-
),
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
}, [
|
|
1074
|
-
const
|
|
1075
|
-
return
|
|
1076
|
-
const
|
|
1209
|
+
[j, r, z, u]
|
|
1210
|
+
), $ = G ?? O.initiallyOpen ?? !0, [ye, J] = S($), se = Z($), [q, ae] = S(Be), ve = ce(() => J((N) => !N), []);
|
|
1211
|
+
M(() => {
|
|
1212
|
+
se.current !== $ && (se.current = $, J($));
|
|
1213
|
+
}, [$]);
|
|
1214
|
+
const de = d && !y && !ie, Ce = E && !K && !re.error;
|
|
1215
|
+
return M(() => {
|
|
1216
|
+
const N = go({
|
|
1077
1217
|
webchatProxyUrl: P,
|
|
1078
|
-
clientId:
|
|
1218
|
+
clientId: T
|
|
1079
1219
|
});
|
|
1080
|
-
if (
|
|
1220
|
+
if (ae(Be), !N)
|
|
1081
1221
|
return;
|
|
1082
|
-
const
|
|
1083
|
-
let
|
|
1084
|
-
return fetch(
|
|
1222
|
+
const v = new AbortController();
|
|
1223
|
+
let H = !1;
|
|
1224
|
+
return fetch(N, {
|
|
1085
1225
|
headers: {
|
|
1086
1226
|
accept: "application/json"
|
|
1087
1227
|
},
|
|
1088
|
-
signal:
|
|
1089
|
-
}).then(async (
|
|
1090
|
-
if (!
|
|
1091
|
-
throw new Error(`runtime config request failed with status ${
|
|
1092
|
-
return
|
|
1093
|
-
}).then((
|
|
1094
|
-
if (
|
|
1228
|
+
signal: v.signal
|
|
1229
|
+
}).then(async (g) => {
|
|
1230
|
+
if (!g.ok)
|
|
1231
|
+
throw new Error(`runtime config request failed with status ${g.status}`);
|
|
1232
|
+
return g.json();
|
|
1233
|
+
}).then((g) => {
|
|
1234
|
+
if (H)
|
|
1095
1235
|
return;
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
allowFileUpload:
|
|
1099
|
-
allowMessageFeedback:
|
|
1236
|
+
const ue = g && typeof g == "object" && g.data && typeof g.data == "object" ? g.data : {};
|
|
1237
|
+
ae({
|
|
1238
|
+
allowFileUpload: ue.allowFileUpload === !0,
|
|
1239
|
+
allowMessageFeedback: ue.allowMessageFeedback === !0
|
|
1100
1240
|
});
|
|
1101
|
-
}).catch((
|
|
1102
|
-
|
|
1241
|
+
}).catch((g) => {
|
|
1242
|
+
v.signal.aborted || H || (console.warn("[EduzzWebchat] failed to load runtime config", g), ae(Be));
|
|
1103
1243
|
}), () => {
|
|
1104
|
-
|
|
1244
|
+
H = !0, v.abort();
|
|
1105
1245
|
};
|
|
1106
|
-
}, [
|
|
1246
|
+
}, [T, P]), de || Ce || b && F ? null : ie && !y ? /* @__PURE__ */ o("div", { className: "bp-webchat-shell", style: le(O), children: /* @__PURE__ */ o("div", { className: "bp-webchat-error", children: "Nao foi possivel carregar a configuracao publica do webchat." }) }) : re.error && !K ? /* @__PURE__ */ o("div", { className: "bp-webchat-shell", style: le(O), children: /* @__PURE__ */ o("div", { className: "bp-webchat-error", children: "Nao foi possivel abrir a sessao publica do webchat." }) }) : P ? T ? /* @__PURE__ */ o(
|
|
1107
1247
|
Ze,
|
|
1108
1248
|
{
|
|
1109
|
-
clientId:
|
|
1249
|
+
clientId: T,
|
|
1110
1250
|
apiUrl: P,
|
|
1111
|
-
conversationId:
|
|
1112
|
-
userCredentials:
|
|
1113
|
-
storageKey:
|
|
1114
|
-
storageLocation:
|
|
1251
|
+
conversationId: oe,
|
|
1252
|
+
userCredentials: te,
|
|
1253
|
+
storageKey: z,
|
|
1254
|
+
storageLocation: u,
|
|
1115
1255
|
children: /* @__PURE__ */ o(
|
|
1116
|
-
|
|
1256
|
+
To,
|
|
1117
1257
|
{
|
|
1118
|
-
clientId:
|
|
1119
|
-
config:
|
|
1120
|
-
defaultUserData:
|
|
1121
|
-
conversationIdProp:
|
|
1122
|
-
isOpen:
|
|
1123
|
-
onUserApiChange:
|
|
1124
|
-
onToggle:
|
|
1125
|
-
runtimeCapabilities:
|
|
1126
|
-
storageKey:
|
|
1127
|
-
storageLocation:
|
|
1128
|
-
userToken:
|
|
1258
|
+
clientId: T,
|
|
1259
|
+
config: O,
|
|
1260
|
+
defaultUserData: ge,
|
|
1261
|
+
conversationIdProp: oe,
|
|
1262
|
+
isOpen: ye,
|
|
1263
|
+
onUserApiChange: m,
|
|
1264
|
+
onToggle: ve,
|
|
1265
|
+
runtimeCapabilities: q,
|
|
1266
|
+
storageKey: z,
|
|
1267
|
+
storageLocation: u,
|
|
1268
|
+
userToken: te?.userToken
|
|
1129
1269
|
}
|
|
1130
1270
|
)
|
|
1131
1271
|
}
|
|
1132
|
-
) : /* @__PURE__ */ o("div", { className: "bp-webchat-shell", style:
|
|
1272
|
+
) : /* @__PURE__ */ o("div", { className: "bp-webchat-shell", style: le(O), children: /* @__PURE__ */ o("div", { className: "bp-webchat-error", children: "Nenhum clientId foi informado." }) }) : /* @__PURE__ */ o("div", { className: "bp-webchat-shell", style: le(O), children: /* @__PURE__ */ o("div", { className: "bp-webchat-error", children: "Nenhuma URL publica do proxy do webchat foi informada." }) });
|
|
1133
1273
|
}
|
|
1134
|
-
function
|
|
1274
|
+
function To({
|
|
1135
1275
|
clientId: e,
|
|
1136
1276
|
config: t,
|
|
1137
1277
|
defaultUserData: a,
|
|
@@ -1139,167 +1279,167 @@ function Bo({
|
|
|
1139
1279
|
isOpen: s,
|
|
1140
1280
|
onUserApiChange: n,
|
|
1141
1281
|
onToggle: c,
|
|
1142
|
-
runtimeCapabilities:
|
|
1143
|
-
storageKey:
|
|
1144
|
-
storageLocation:
|
|
1145
|
-
userToken:
|
|
1282
|
+
runtimeCapabilities: i,
|
|
1283
|
+
storageKey: u,
|
|
1284
|
+
storageLocation: w,
|
|
1285
|
+
userToken: m
|
|
1146
1286
|
}) {
|
|
1147
|
-
const
|
|
1148
|
-
() =>
|
|
1287
|
+
const b = C(
|
|
1288
|
+
() => Mo({
|
|
1149
1289
|
showWelcomeScreen: t.showWelcomeScreen,
|
|
1150
|
-
storageKey:
|
|
1151
|
-
storageLocation:
|
|
1290
|
+
storageKey: u,
|
|
1291
|
+
storageLocation: w,
|
|
1152
1292
|
conversationId: r,
|
|
1153
|
-
userToken:
|
|
1293
|
+
userToken: m
|
|
1154
1294
|
}),
|
|
1155
1295
|
[
|
|
1156
1296
|
t.showWelcomeScreen,
|
|
1157
1297
|
r,
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1298
|
+
u,
|
|
1299
|
+
w,
|
|
1300
|
+
m
|
|
1161
1301
|
]
|
|
1162
|
-
), [
|
|
1302
|
+
), [U, f] = S(!1), [B, F] = S({ open: !1, messageId: null, draft: "" }), [{ isPanelMounted: Y, isPanelVisible: _ }, V] = Ge(So, {
|
|
1163
1303
|
isPanelMounted: s,
|
|
1164
1304
|
isPanelVisible: s
|
|
1165
1305
|
}), {
|
|
1166
|
-
conversationId:
|
|
1167
|
-
isTyping:
|
|
1168
|
-
messages:
|
|
1169
|
-
saveMessageFeedback:
|
|
1170
|
-
sendMessage:
|
|
1171
|
-
status:
|
|
1172
|
-
uploadFile:
|
|
1173
|
-
} =
|
|
1174
|
-
userCredentials:
|
|
1175
|
-
listConversations:
|
|
1306
|
+
conversationId: j,
|
|
1307
|
+
isTyping: W,
|
|
1308
|
+
messages: x,
|
|
1309
|
+
saveMessageFeedback: d,
|
|
1310
|
+
sendMessage: p,
|
|
1311
|
+
status: R,
|
|
1312
|
+
uploadFile: Q
|
|
1313
|
+
} = Ye(), { openConversation: y, listConversations: ie } = Qe(), { updateUser: T, userCredentials: P } = et(), z = Z({}), [G, D] = S(() => b.activeView), [ge, E] = S(() => b.historyReturnView), { conversations: re, isLoading: ee, refresh: K } = tt({
|
|
1314
|
+
userCredentials: P,
|
|
1315
|
+
listConversations: ie,
|
|
1176
1316
|
clientId: e
|
|
1177
|
-
}),
|
|
1178
|
-
() =>
|
|
1317
|
+
}), te = C(
|
|
1318
|
+
() => Co(a),
|
|
1179
1319
|
[a]
|
|
1180
|
-
),
|
|
1181
|
-
async (
|
|
1182
|
-
if (!
|
|
1320
|
+
), O = ce(
|
|
1321
|
+
async (I = {}) => {
|
|
1322
|
+
if (!T)
|
|
1183
1323
|
return;
|
|
1184
|
-
const
|
|
1185
|
-
...
|
|
1186
|
-
...
|
|
1187
|
-
...
|
|
1324
|
+
const h = {
|
|
1325
|
+
...ne(a) || {},
|
|
1326
|
+
...z.current,
|
|
1327
|
+
...ne(I) || {}
|
|
1188
1328
|
};
|
|
1189
|
-
return
|
|
1329
|
+
return z.current = h, T(Io(h));
|
|
1190
1330
|
},
|
|
1191
|
-
[a,
|
|
1192
|
-
),
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
}, [
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}, [
|
|
1331
|
+
[a, T]
|
|
1332
|
+
), oe = Z(O);
|
|
1333
|
+
M(() => {
|
|
1334
|
+
oe.current = O;
|
|
1335
|
+
}, [O]);
|
|
1336
|
+
const $ = !!T;
|
|
1337
|
+
M(() => {
|
|
1338
|
+
z.current = {};
|
|
1339
|
+
}, [te]), M(() => {
|
|
1200
1340
|
if (n)
|
|
1201
1341
|
return n({
|
|
1202
|
-
updateUserData:
|
|
1342
|
+
updateUserData: $ ? (I) => oe.current(I) : void 0
|
|
1203
1343
|
}), () => n(null);
|
|
1204
|
-
}, [n,
|
|
1205
|
-
|
|
1206
|
-
}, [
|
|
1207
|
-
|
|
1208
|
-
}, [
|
|
1209
|
-
const { showInitialLoading:
|
|
1210
|
-
activeView:
|
|
1211
|
-
clientState:
|
|
1212
|
-
conversationId:
|
|
1213
|
-
messagesLength:
|
|
1214
|
-
}),
|
|
1215
|
-
() => t.botAvatar ||
|
|
1344
|
+
}, [n, $]), M(() => {
|
|
1345
|
+
!$ || !te || oe.current();
|
|
1346
|
+
}, [te, $]), M(() => {
|
|
1347
|
+
i.allowMessageFeedback || F({ open: !1, messageId: null, draft: "" });
|
|
1348
|
+
}, [i.allowMessageFeedback]);
|
|
1349
|
+
const { showInitialLoading: ye, setShowInitialLoading: J } = no({
|
|
1350
|
+
activeView: G,
|
|
1351
|
+
clientState: R,
|
|
1352
|
+
conversationId: j,
|
|
1353
|
+
messagesLength: x.length
|
|
1354
|
+
}), se = C(
|
|
1355
|
+
() => t.botAvatar || Qt({ name: t.botName, backgroundColor: t.accentColor }),
|
|
1216
1356
|
[t.accentColor, t.botAvatar, t.botName]
|
|
1217
|
-
),
|
|
1218
|
-
() => ({ ...t, botAvatar:
|
|
1219
|
-
[t,
|
|
1220
|
-
),
|
|
1221
|
-
async (
|
|
1222
|
-
|
|
1357
|
+
), q = C(
|
|
1358
|
+
() => ({ ...t, botAvatar: se }),
|
|
1359
|
+
[t, se]
|
|
1360
|
+
), ae = ce(
|
|
1361
|
+
async (I) => {
|
|
1362
|
+
E(I), D("conversations"), await K();
|
|
1223
1363
|
},
|
|
1224
|
-
[
|
|
1225
|
-
),
|
|
1226
|
-
(
|
|
1227
|
-
|
|
1364
|
+
[K]
|
|
1365
|
+
), ve = ce(
|
|
1366
|
+
(I) => {
|
|
1367
|
+
J(!0), y(I), D("chat");
|
|
1228
1368
|
},
|
|
1229
|
-
[
|
|
1230
|
-
),
|
|
1231
|
-
|
|
1232
|
-
}, [
|
|
1233
|
-
() =>
|
|
1234
|
-
messages:
|
|
1235
|
-
user:
|
|
1236
|
-
botName:
|
|
1237
|
-
botAvatar:
|
|
1369
|
+
[y, J]
|
|
1370
|
+
), de = ce(() => {
|
|
1371
|
+
J(!0), y(), D("chat");
|
|
1372
|
+
}, [y, J]), Ce = C(
|
|
1373
|
+
() => ao({
|
|
1374
|
+
messages: x,
|
|
1375
|
+
user: P,
|
|
1376
|
+
botName: q.botName,
|
|
1377
|
+
botAvatar: q.botAvatar
|
|
1238
1378
|
}),
|
|
1239
|
-
[
|
|
1240
|
-
),
|
|
1241
|
-
|
|
1379
|
+
[x, q.botAvatar, q.botName, P]
|
|
1380
|
+
), N = le(t), v = C(() => dt(t), [t]), H = C(() => Ot(t.fabChatIconVariant), [t.fabChatIconVariant]);
|
|
1381
|
+
M(() => {
|
|
1242
1382
|
if (s) {
|
|
1243
|
-
|
|
1244
|
-
const
|
|
1245
|
-
return () => window.cancelAnimationFrame(
|
|
1383
|
+
V({ type: "show" });
|
|
1384
|
+
const be = window.requestAnimationFrame(() => V({ type: "visible" }));
|
|
1385
|
+
return () => window.cancelAnimationFrame(be);
|
|
1246
1386
|
}
|
|
1247
|
-
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
}, 0),
|
|
1387
|
+
V({ type: "hide" });
|
|
1388
|
+
const I = window.setTimeout(() => {
|
|
1389
|
+
f(!1), F({ open: !1, messageId: null, draft: "" });
|
|
1390
|
+
}, 0), h = window.setTimeout(() => V({ type: "unmount" }), mo);
|
|
1251
1391
|
return () => {
|
|
1252
|
-
window.clearTimeout(
|
|
1392
|
+
window.clearTimeout(I), window.clearTimeout(h);
|
|
1253
1393
|
};
|
|
1254
|
-
}, [s]),
|
|
1255
|
-
if (
|
|
1256
|
-
if (
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1394
|
+
}, [s]), M(() => {
|
|
1395
|
+
if (b.bootstrapView === "pending") {
|
|
1396
|
+
if (x.length > 0) {
|
|
1397
|
+
const I = window.setTimeout(() => {
|
|
1398
|
+
D("chat"), E("chat");
|
|
1259
1399
|
}, 0);
|
|
1260
|
-
return () => window.clearTimeout(
|
|
1400
|
+
return () => window.clearTimeout(I);
|
|
1261
1401
|
}
|
|
1262
|
-
if (
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1402
|
+
if (R !== "connecting") {
|
|
1403
|
+
const I = window.setTimeout(() => {
|
|
1404
|
+
D("home"), E("home");
|
|
1265
1405
|
}, 0);
|
|
1266
|
-
return () => window.clearTimeout(
|
|
1406
|
+
return () => window.clearTimeout(I);
|
|
1267
1407
|
}
|
|
1268
1408
|
}
|
|
1269
|
-
}, [
|
|
1270
|
-
const
|
|
1271
|
-
() => function(
|
|
1272
|
-
const
|
|
1273
|
-
...
|
|
1274
|
-
direction:
|
|
1275
|
-
sender:
|
|
1276
|
-
timestamp:
|
|
1277
|
-
messageId:
|
|
1278
|
-
metadata:
|
|
1279
|
-
isReadOnly:
|
|
1280
|
-
status:
|
|
1281
|
-
feedback:
|
|
1282
|
-
sendMessage:
|
|
1283
|
-
addMessageFeedback:
|
|
1409
|
+
}, [R, b.bootstrapView, x.length]);
|
|
1410
|
+
const g = C(
|
|
1411
|
+
() => function(h) {
|
|
1412
|
+
const be = i.allowMessageFeedback && h.direction === "incoming" && typeof h.addMessageFeedback == "function", We = {
|
|
1413
|
+
...h.block,
|
|
1414
|
+
direction: h.direction,
|
|
1415
|
+
sender: h.sender,
|
|
1416
|
+
timestamp: h.timestamp,
|
|
1417
|
+
messageId: h.messageId,
|
|
1418
|
+
metadata: h.metadata,
|
|
1419
|
+
isReadOnly: h.isReadOnly,
|
|
1420
|
+
status: h.status,
|
|
1421
|
+
feedback: h.feedback,
|
|
1422
|
+
sendMessage: h.sendMessage,
|
|
1423
|
+
addMessageFeedback: h.addMessageFeedback
|
|
1284
1424
|
};
|
|
1285
1425
|
return /* @__PURE__ */ l(
|
|
1286
1426
|
"div",
|
|
1287
1427
|
{
|
|
1288
1428
|
className: "bpMessageBlocksBubble",
|
|
1289
|
-
"data-direction":
|
|
1290
|
-
"data-feedback":
|
|
1429
|
+
"data-direction": h.direction,
|
|
1430
|
+
"data-feedback": be || void 0,
|
|
1291
1431
|
children: [
|
|
1292
|
-
/* @__PURE__ */ o(
|
|
1293
|
-
|
|
1432
|
+
/* @__PURE__ */ o(ot, { block: We }),
|
|
1433
|
+
be ? /* @__PURE__ */ l("div", { className: "bpMessageBlocksBubbleFeedbackContainer", children: [
|
|
1294
1434
|
/* @__PURE__ */ o(
|
|
1295
1435
|
"button",
|
|
1296
1436
|
{
|
|
1297
1437
|
className: "bpMessageBlocksBubbleFeedbackIcon",
|
|
1298
1438
|
type: "button",
|
|
1299
|
-
"data-selected":
|
|
1439
|
+
"data-selected": h.feedback === "positive",
|
|
1300
1440
|
"aria-label": "Feedback positivo",
|
|
1301
|
-
onClick: () =>
|
|
1302
|
-
children:
|
|
1441
|
+
onClick: () => h.addMessageFeedback(h.messageId, { value: "positive" }),
|
|
1442
|
+
children: Wt
|
|
1303
1443
|
}
|
|
1304
1444
|
),
|
|
1305
1445
|
/* @__PURE__ */ o(
|
|
@@ -1307,14 +1447,14 @@ function Bo({
|
|
|
1307
1447
|
{
|
|
1308
1448
|
className: "bpMessageBlocksBubbleFeedbackIcon",
|
|
1309
1449
|
type: "button",
|
|
1310
|
-
"data-selected":
|
|
1450
|
+
"data-selected": h.feedback === "negative",
|
|
1311
1451
|
"aria-label": "Feedback negativo",
|
|
1312
|
-
onClick: () =>
|
|
1452
|
+
onClick: () => F({
|
|
1313
1453
|
open: !0,
|
|
1314
|
-
messageId:
|
|
1454
|
+
messageId: h.messageId,
|
|
1315
1455
|
draft: ""
|
|
1316
1456
|
}),
|
|
1317
|
-
children:
|
|
1457
|
+
children: Gt
|
|
1318
1458
|
}
|
|
1319
1459
|
)
|
|
1320
1460
|
] }) : null
|
|
@@ -1322,88 +1462,91 @@ function Bo({
|
|
|
1322
1462
|
}
|
|
1323
1463
|
);
|
|
1324
1464
|
},
|
|
1325
|
-
[
|
|
1326
|
-
),
|
|
1465
|
+
[i.allowMessageFeedback]
|
|
1466
|
+
), ue = C(
|
|
1467
|
+
() => ({ bubble: g, dropdown: uo }),
|
|
1468
|
+
[g]
|
|
1469
|
+
);
|
|
1327
1470
|
return /* @__PURE__ */ l(
|
|
1328
1471
|
"div",
|
|
1329
1472
|
{
|
|
1330
1473
|
className: "bp-webchat-shell",
|
|
1331
|
-
"data-panel-mounted":
|
|
1332
|
-
"data-panel-open":
|
|
1333
|
-
style:
|
|
1474
|
+
"data-panel-mounted": Y,
|
|
1475
|
+
"data-panel-open": _,
|
|
1476
|
+
style: N,
|
|
1334
1477
|
children: [
|
|
1335
|
-
/* @__PURE__ */ o(
|
|
1336
|
-
|
|
1337
|
-
|
|
1478
|
+
/* @__PURE__ */ o(at, { ...v }),
|
|
1479
|
+
Y ? /* @__PURE__ */ o("div", { className: "bp-webchat-panel", "data-state": _ ? "open" : "closed", children: G === "home" ? /* @__PURE__ */ o(
|
|
1480
|
+
po,
|
|
1338
1481
|
{
|
|
1339
|
-
config:
|
|
1340
|
-
activeView:
|
|
1482
|
+
config: q,
|
|
1483
|
+
activeView: G,
|
|
1341
1484
|
onClose: c,
|
|
1342
|
-
onShowHome: () =>
|
|
1343
|
-
onShowConversations: () =>
|
|
1344
|
-
onStart: () =>
|
|
1485
|
+
onShowHome: () => D("home"),
|
|
1486
|
+
onShowConversations: () => ae("home"),
|
|
1487
|
+
onStart: () => D("chat")
|
|
1345
1488
|
}
|
|
1346
|
-
) :
|
|
1347
|
-
|
|
1489
|
+
) : G === "conversations" ? /* @__PURE__ */ o(
|
|
1490
|
+
io,
|
|
1348
1491
|
{
|
|
1349
|
-
conversations:
|
|
1350
|
-
currentConversationId:
|
|
1351
|
-
isLoading:
|
|
1352
|
-
botAvatar:
|
|
1353
|
-
botName:
|
|
1354
|
-
onClose: () =>
|
|
1492
|
+
conversations: re,
|
|
1493
|
+
currentConversationId: j,
|
|
1494
|
+
isLoading: ee,
|
|
1495
|
+
botAvatar: q.botAvatar,
|
|
1496
|
+
botName: q.botName,
|
|
1497
|
+
onClose: () => D(ge),
|
|
1355
1498
|
onCloseWidget: c,
|
|
1356
1499
|
onShowHome: () => {
|
|
1357
|
-
|
|
1500
|
+
D("home"), E("home");
|
|
1358
1501
|
},
|
|
1359
|
-
onShowConversations:
|
|
1360
|
-
onNewConversation:
|
|
1361
|
-
onConversationClick:
|
|
1502
|
+
onShowConversations: K,
|
|
1503
|
+
onNewConversation: de,
|
|
1504
|
+
onConversationClick: ve
|
|
1362
1505
|
}
|
|
1363
|
-
) :
|
|
1506
|
+
) : G === "pending" ? /* @__PURE__ */ o("div", { className: "bp-webchat-layout", children: /* @__PURE__ */ o(ze, {}) }) : /* @__PURE__ */ l(Ve, { children: [
|
|
1364
1507
|
/* @__PURE__ */ o(
|
|
1365
|
-
|
|
1508
|
+
lo,
|
|
1366
1509
|
{
|
|
1367
|
-
config:
|
|
1368
|
-
allowFileUpload:
|
|
1369
|
-
clientState:
|
|
1370
|
-
isTyping:
|
|
1371
|
-
messages:
|
|
1372
|
-
renderers:
|
|
1373
|
-
sendMessage:
|
|
1374
|
-
uploadFile:
|
|
1375
|
-
addMessageFeedback:
|
|
1376
|
-
showInitialLoading:
|
|
1510
|
+
config: q,
|
|
1511
|
+
allowFileUpload: i.allowFileUpload,
|
|
1512
|
+
clientState: R,
|
|
1513
|
+
isTyping: W,
|
|
1514
|
+
messages: Ce,
|
|
1515
|
+
renderers: ue,
|
|
1516
|
+
sendMessage: p,
|
|
1517
|
+
uploadFile: Q,
|
|
1518
|
+
addMessageFeedback: i.allowMessageFeedback ? d : void 0,
|
|
1519
|
+
showInitialLoading: ye,
|
|
1377
1520
|
onShowHome: t.showWelcomeScreen ? () => {
|
|
1378
|
-
|
|
1521
|
+
D("home"), E("home");
|
|
1379
1522
|
} : void 0,
|
|
1380
|
-
onOpenHistory: () =>
|
|
1381
|
-
onRestartConversation: () =>
|
|
1523
|
+
onOpenHistory: () => ae("chat"),
|
|
1524
|
+
onRestartConversation: () => f(!0),
|
|
1382
1525
|
onCloseWidget: c
|
|
1383
1526
|
}
|
|
1384
1527
|
),
|
|
1385
1528
|
/* @__PURE__ */ o(
|
|
1386
|
-
|
|
1529
|
+
ho,
|
|
1387
1530
|
{
|
|
1388
|
-
open:
|
|
1389
|
-
onCancel: () =>
|
|
1531
|
+
open: U,
|
|
1532
|
+
onCancel: () => f(!1),
|
|
1390
1533
|
onConfirm: () => {
|
|
1391
|
-
|
|
1534
|
+
f(!1), de();
|
|
1392
1535
|
}
|
|
1393
1536
|
}
|
|
1394
1537
|
),
|
|
1395
|
-
|
|
1396
|
-
|
|
1538
|
+
i.allowMessageFeedback ? /* @__PURE__ */ o(
|
|
1539
|
+
bo,
|
|
1397
1540
|
{
|
|
1398
|
-
open:
|
|
1399
|
-
draft:
|
|
1400
|
-
setDraft: (
|
|
1401
|
-
onCancel: () =>
|
|
1541
|
+
open: B.open,
|
|
1542
|
+
draft: B.draft,
|
|
1543
|
+
setDraft: (I) => F((h) => ({ ...h, draft: I })),
|
|
1544
|
+
onCancel: () => F({ open: !1, messageId: null, draft: "" }),
|
|
1402
1545
|
onConfirm: async () => {
|
|
1403
|
-
|
|
1546
|
+
B.messageId && d && await d(B.messageId, {
|
|
1404
1547
|
value: "negative",
|
|
1405
|
-
comment:
|
|
1406
|
-
}),
|
|
1548
|
+
comment: B.draft
|
|
1549
|
+
}), F({ open: !1, messageId: null, draft: "" });
|
|
1407
1550
|
}
|
|
1408
1551
|
}
|
|
1409
1552
|
) : null
|
|
@@ -1417,8 +1560,8 @@ function Bo({
|
|
|
1417
1560
|
type: "button",
|
|
1418
1561
|
"aria-label": s ? "Fechar webchat" : "Abrir webchat",
|
|
1419
1562
|
children: [
|
|
1420
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-fab-icon bp-webchat-fab-icon--chat", children:
|
|
1421
|
-
/* @__PURE__ */ o("span", { className: "bp-webchat-fab-icon bp-webchat-fab-icon--close", children:
|
|
1563
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-fab-icon bp-webchat-fab-icon--chat", children: H }),
|
|
1564
|
+
/* @__PURE__ */ o("span", { className: "bp-webchat-fab-icon bp-webchat-fab-icon--close", children: Et })
|
|
1422
1565
|
]
|
|
1423
1566
|
}
|
|
1424
1567
|
)
|
|
@@ -1427,9 +1570,9 @@ function Bo({
|
|
|
1427
1570
|
);
|
|
1428
1571
|
}
|
|
1429
1572
|
export {
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1573
|
+
Ro as Webchat,
|
|
1574
|
+
X as defaultConfig,
|
|
1575
|
+
me as getContrastingTextColor,
|
|
1576
|
+
le as getShellStyle,
|
|
1577
|
+
it as normalizeConfig
|
|
1435
1578
|
};
|