@botonic/webchat-react 2.37.0 → 2.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/embedded-config-CmlPSd0n.js +17 -0
- package/embedded.d.ts +2 -0
- package/embedded.js +28 -0
- package/index.d.ts +10 -1
- package/index.js +103 -64
- package/lib/components/debug-event/debug-event-wrapper.d.ts +40 -0
- package/lib/components/debug-event/index.d.ts +4 -0
- package/lib/components/{preview-events/preview-event-message → debug-event}/preview-event-message.d.ts +2 -2
- package/lib/components/debug-event/use-preview-event-message.d.ts +31 -0
- package/lib/components/dialog/dialog-types.d.ts +4 -1
- package/lib/components/image-previewer/image-previewer-portal.d.ts +8 -0
- package/lib/components/image-previewer/image-previewer.d.ts +6 -0
- package/lib/components/image-previewer/index.d.ts +3 -0
- package/lib/components/message/image-message/use-image-preview.d.ts +17 -0
- package/lib/components/message/index.d.ts +1 -0
- package/lib/components/message/message/message-info/message-info.d.ts +2 -0
- package/lib/components/message/message/message.d.ts +1 -0
- package/lib/components/message/message/use-message.d.ts +1 -0
- package/lib/components/message/whatsapp-request-contact-info/index.d.ts +1 -0
- package/lib/components/message/whatsapp-request-contact-info/whatsapp-request-contact-info-message.d.ts +10 -0
- package/lib/components/message-machine-renderer/use-message-machine-renderer.d.ts +1 -0
- package/lib/components/preview-events/events/index.d.ts +0 -14
- package/lib/components/preview-events/events/types.d.ts +9 -12
- package/lib/components/webchat-app/webchat-app.d.ts +3 -1
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-download-transcript.d.ts +6 -2
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-conversation.d.ts +2 -1
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-session.d.ts +5 -2
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-sounds.d.ts +3 -2
- package/lib/components/webchat-header/webchat-menu/use-dropdown-menu-item-download-transcript.d.ts +25 -0
- package/lib/components/webchat-header/webchat-menu/use-dropdown-menu-item-reset-conversation.d.ts +10 -0
- package/lib/components/webchat-header/webchat-menu/use-dropdown-menu-item-reset-session.d.ts +9 -2
- package/lib/components/webchat-header/webchat-menu/use-dropdown-menu-item-sounds.d.ts +6 -0
- package/lib/components/webchat-input/emoji-picker/index.d.ts +3 -0
- package/lib/components/webchat-input/emoji-picker/use-webchat-emoji-picker.d.ts +16 -0
- package/lib/components/webchat-input/emoji-picker/webchat-emoji-picker-panel.d.ts +6 -0
- package/lib/components/webchat-input/emoji-picker/webchat-emoji-picker-trigger-button.d.ts +8 -0
- package/lib/components/webchat-input/use-webchat-input.d.ts +8 -1
- package/lib/components/webchat-provider/webchat-context.d.ts +8 -1
- package/lib/components/webchat-trigger/read-css-duration-ms.d.ts +4 -0
- package/lib/components/webchat-trigger/use-trigger-hover-expand.d.ts +19 -0
- package/lib/components/webchat-trigger/use-trigger-preview-channels.d.ts +18 -0
- package/lib/components/webchat-trigger/use-trigger-proactive-popup.d.ts +13 -0
- package/lib/components/webchat-trigger/use-webchat-trigger.d.ts +15 -1
- package/lib/components/webchat-trigger/webchat-trigger-channels-panel.d.ts +10 -0
- package/lib/domain/supported-trigger-channels.d.ts +16 -0
- package/lib/embedded/embedded-config.d.ts +17 -0
- package/lib/embedded/embedded-container.d.ts +7 -0
- package/lib/embedded/mount-embedded-webchat.d.ts +5 -0
- package/lib/hooks/use-embed-trigger-state.d.ts +6 -0
- package/lib/hooks/use-webchat-download-transcript.d.ts +5 -0
- package/lib/hooks/use-webchat-reset-conversation.d.ts +6 -0
- package/lib/hooks/use-webchat-reset-session.d.ts +3 -0
- package/lib/hooks/use-webchat-tracking.d.ts +7 -0
- package/lib/types/webchat-props.d.ts +61 -3
- package/package.json +10 -4
- package/styles.css +123 -87
- package/supported-trigger-channels-JiTUD-jK.js +9 -0
- package/trigger.d.ts +4 -1
- package/trigger.js +592 -215
- package/webchat-app-md1b0_ze.js +5072 -0
- package/lib/components/preview-events/events/ai-agent/ai-agent.d.ts +0 -3
- package/lib/components/preview-events/events/ai-agent/executed-tools.d.ts +0 -7
- package/lib/components/preview-events/events/ai-agent/index.d.ts +0 -1
- package/lib/components/preview-events/events/ai-agent/parse-tools.d.ts +0 -9
- package/lib/components/preview-events/events/ai-agent-router/ai-agent-router.d.ts +0 -3
- package/lib/components/preview-events/events/ai-agent-router/index.d.ts +0 -1
- package/lib/components/preview-events/events/bot-action.d.ts +0 -3
- package/lib/components/preview-events/events/components/guardrail-item.d.ts +0 -14
- package/lib/components/preview-events/events/components/index.d.ts +0 -2
- package/lib/components/preview-events/events/components/sources-section.d.ts +0 -11
- package/lib/components/preview-events/events/conditional-channel.d.ts +0 -3
- package/lib/components/preview-events/events/conditional-country.d.ts +0 -3
- package/lib/components/preview-events/events/conditional-custom.d.ts +0 -3
- package/lib/components/preview-events/events/conditional-queue-status.d.ts +0 -3
- package/lib/components/preview-events/events/constants.d.ts +0 -35
- package/lib/components/preview-events/events/fallback.d.ts +0 -3
- package/lib/components/preview-events/events/handoff-success.d.ts +0 -3
- package/lib/components/preview-events/events/keyword.d.ts +0 -3
- package/lib/components/preview-events/events/knowledge-base.d.ts +0 -3
- package/lib/components/preview-events/events/redirect-flow.d.ts +0 -3
- package/lib/components/preview-events/events/smart-intent.d.ts +0 -3
- package/lib/components/preview-events/events/webview-action-triggered.d.ts +0 -3
- package/lib/components/preview-events/hooks/use-knowledge-base-info.d.ts +0 -19
- package/lib/components/preview-events/hooks/use-last-label-position.d.ts +0 -9
- package/lib/components/preview-events/icons/ai-router-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/ai-specialist-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/arrow-progress-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/brain-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/caret-down-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/caret-up-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/circle-check-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/code-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/file-pdf-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/file-word-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/hand-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/head-set-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/index.d.ts +0 -19
- package/lib/components/preview-events/icons/life-ring-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/link-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/quote-right-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/screwdriver-wrench-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/split-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/wand-icon.d.ts +0 -1
- package/lib/components/preview-events/icons/window-restore-icon.d.ts +0 -1
- package/lib/components/preview-events/index.d.ts +0 -3
- package/lib/components/preview-events/preview-event-message/index.d.ts +0 -1
- package/lib/components/preview-events/preview-event-message/use-preview-event-message.d.ts +0 -17
- package/lib/components/preview-events/preview-events-types.d.ts +0 -12
- package/webchat-app-BrBET32o.js +0 -5447
package/trigger.js
CHANGED
|
@@ -1,9 +1,462 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { embedTriggerMachine as We, ensureGlobalWebchatAPI as Oe, setupGlobalWebchatAPI as Ve, signalWebchatReady as Fe, registerOnOpen as Ge } from "@botonic/webchat-core";
|
|
2
|
+
import { useCallback as E, useState as L, useRef as m, useEffect as h, useMemo as ge, lazy as he, Component as ke, Suspense as Be } from "react";
|
|
3
|
+
import { a as ze } from "./embedded-config-CmlPSd0n.js";
|
|
4
|
+
import { useMachine as Ue } from "@xstate/react";
|
|
5
|
+
import { a as Ye } from "./supported-trigger-channels-JiTUD-jK.js";
|
|
6
|
+
import { S as Mn } from "./supported-trigger-channels-JiTUD-jK.js";
|
|
7
|
+
import { jsx as p, jsxs as ue, Fragment as je } from "react/jsx-runtime";
|
|
8
|
+
import { cx as ne, cva as Xe } from "class-variance-authority";
|
|
9
|
+
import { DropdownMenu as Ke, DropdownMenuItem as Ze } from "@lilara/ui-web-react";
|
|
10
|
+
function qe() {
|
|
11
|
+
const [n, t] = Ue(We, { input: {} }), a = E(() => {
|
|
12
|
+
t({ type: "MARK_FIRST_HOVER_EXPAND_SHOWN" });
|
|
13
|
+
}, [t]);
|
|
14
|
+
return {
|
|
15
|
+
isHydrated: n.matches("ready"),
|
|
16
|
+
firstHoverExpandShown: n.context.firstHoverExpandShown,
|
|
17
|
+
markFirstHoverExpandShown: a
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const Je = {
|
|
21
|
+
ms: 1,
|
|
22
|
+
s: 1e3
|
|
23
|
+
};
|
|
24
|
+
function de(n, t) {
|
|
25
|
+
const a = n.trim();
|
|
26
|
+
if (!a)
|
|
27
|
+
return t;
|
|
28
|
+
const c = /^(-?\d*\.?\d+)(ms|s)?$/i.exec(a);
|
|
29
|
+
if (!c)
|
|
30
|
+
return t;
|
|
31
|
+
const s = Number.parseFloat(c[1]);
|
|
32
|
+
if (!Number.isFinite(s))
|
|
33
|
+
return t;
|
|
34
|
+
const i = (c[2] ?? "ms").toLowerCase(), r = Je[i];
|
|
35
|
+
return r === void 0 ? t : Math.max(0, Math.round(s * r));
|
|
36
|
+
}
|
|
37
|
+
const Qe = "--webchat-trigger-first-visit-expand-delay", $e = "--webchat-trigger-first-visit-expand-duration";
|
|
38
|
+
function en({
|
|
39
|
+
hoverExpandLabel: n,
|
|
40
|
+
firstVisitHoverExpand: t,
|
|
41
|
+
forceHoverExpanded: a,
|
|
42
|
+
triggerRef: c,
|
|
43
|
+
isChannelsPanelVisible: s,
|
|
44
|
+
isOpen: i,
|
|
45
|
+
isEmbedTriggerHydrated: r,
|
|
46
|
+
firstHoverExpandShown: l,
|
|
47
|
+
markFirstHoverExpandShown: C
|
|
48
|
+
}) {
|
|
49
|
+
const [M, f] = L(!1), [w, R] = L(!1), [I, P] = L(!0), T = m({}), d = !!n && !I && (w || (a ?? M)), x = E(() => {
|
|
50
|
+
const b = T.current;
|
|
51
|
+
b.delayId !== void 0 && window.clearTimeout(b.delayId), b.collapseId !== void 0 && window.clearTimeout(b.collapseId), T.current = {};
|
|
52
|
+
}, []), g = E(() => {
|
|
53
|
+
R(!1), P(!0), f(!1), x();
|
|
54
|
+
}, [x]), v = E(() => {
|
|
55
|
+
n && (P(!1), R(!0), t && r && !l && (C(), x(), f(!1)));
|
|
56
|
+
}, [
|
|
57
|
+
n,
|
|
58
|
+
t,
|
|
59
|
+
r,
|
|
60
|
+
l,
|
|
61
|
+
C,
|
|
62
|
+
x
|
|
63
|
+
]), S = E(() => {
|
|
64
|
+
n && (R(!1), P(!0));
|
|
65
|
+
}, [n]);
|
|
66
|
+
return h(() => {
|
|
67
|
+
s && g();
|
|
68
|
+
}, [s, g]), h(() => {
|
|
69
|
+
i && g();
|
|
70
|
+
}, [i, g]), h(() => {
|
|
71
|
+
if (!t || !n || !r || l)
|
|
72
|
+
return;
|
|
73
|
+
let b = !1;
|
|
74
|
+
const A = () => {
|
|
75
|
+
const O = c.current;
|
|
76
|
+
if (!O || b)
|
|
77
|
+
return;
|
|
78
|
+
const H = getComputedStyle(O), D = de(
|
|
79
|
+
H.getPropertyValue(Qe),
|
|
80
|
+
6e3
|
|
81
|
+
), W = de(
|
|
82
|
+
H.getPropertyValue(
|
|
83
|
+
$e
|
|
84
|
+
),
|
|
85
|
+
8e3
|
|
86
|
+
), B = window.setTimeout(() => {
|
|
87
|
+
if (b || l)
|
|
88
|
+
return;
|
|
89
|
+
C(), P(!1), f(!0);
|
|
90
|
+
const V = window.setTimeout(() => {
|
|
91
|
+
f(!1), R(!1), P(!0);
|
|
92
|
+
}, W);
|
|
93
|
+
T.current = { delayId: B, collapseId: V };
|
|
94
|
+
}, D);
|
|
95
|
+
T.current = { delayId: B };
|
|
96
|
+
};
|
|
97
|
+
return c.current ? A() : requestAnimationFrame(A), () => {
|
|
98
|
+
b = !0, x();
|
|
99
|
+
};
|
|
100
|
+
}, [
|
|
101
|
+
t,
|
|
102
|
+
n,
|
|
103
|
+
r,
|
|
104
|
+
l,
|
|
105
|
+
C,
|
|
106
|
+
c,
|
|
107
|
+
x
|
|
108
|
+
]), {
|
|
109
|
+
hasHoverExpand: !!n,
|
|
110
|
+
isHoverExpandVisible: d,
|
|
111
|
+
handleTriggerMouseEnter: v,
|
|
112
|
+
handleTriggerMouseLeave: S,
|
|
113
|
+
collapseHoverExpand: g
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function nn({
|
|
117
|
+
onTriggerPreviewChannels: n,
|
|
118
|
+
requestOpen: t,
|
|
119
|
+
controller: a,
|
|
120
|
+
isOpen: c,
|
|
121
|
+
setIsChannelsPanelVisible: s
|
|
122
|
+
}) {
|
|
123
|
+
const i = ge(
|
|
124
|
+
() => n?.() ?? [],
|
|
125
|
+
[n]
|
|
126
|
+
), r = i.length > 1, l = E(
|
|
127
|
+
(w) => {
|
|
128
|
+
if (w.channel === Ye.Webchat) {
|
|
129
|
+
t();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
window.open(w.href, w.target ?? "_blank");
|
|
133
|
+
},
|
|
134
|
+
[t]
|
|
135
|
+
), C = E(
|
|
136
|
+
(w) => {
|
|
137
|
+
s(!1), l(w);
|
|
138
|
+
},
|
|
139
|
+
[l, s]
|
|
140
|
+
), M = E(() => {
|
|
141
|
+
s(!1);
|
|
142
|
+
}, [s]), f = E(
|
|
143
|
+
(w) => {
|
|
144
|
+
if (r) {
|
|
145
|
+
if (a && c) {
|
|
146
|
+
a.close();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
s((R) => !R);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (i.length === 1) {
|
|
153
|
+
l(i[0]);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
w();
|
|
157
|
+
},
|
|
158
|
+
[
|
|
159
|
+
r,
|
|
160
|
+
a,
|
|
161
|
+
c,
|
|
162
|
+
i,
|
|
163
|
+
l,
|
|
164
|
+
s
|
|
165
|
+
]
|
|
166
|
+
);
|
|
167
|
+
return {
|
|
168
|
+
previewChannels: i,
|
|
169
|
+
useChannelsMenu: r,
|
|
170
|
+
channels: r ? i : void 0,
|
|
171
|
+
onSelectChannel: C,
|
|
172
|
+
onDismissChannelsPanel: M,
|
|
173
|
+
handleTriggerClickWithChannels: f
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function tn({
|
|
177
|
+
proactiveMessage: n,
|
|
178
|
+
proactiveDelay: t = 5,
|
|
179
|
+
triggerRef: a,
|
|
180
|
+
isOpen: c
|
|
181
|
+
}) {
|
|
182
|
+
const [s, i] = L(!1), [r, l] = L(!1), [C, M] = L(0), f = m(!1), w = m(!1), R = m(c), I = m(0), P = m({ x: 0, y: 0 }), T = m({ x: 0, y: 0 }), u = m(null), d = m(null);
|
|
183
|
+
h(() => {
|
|
184
|
+
w.current = s;
|
|
185
|
+
}, [s]), h(() => {
|
|
186
|
+
R.current = c;
|
|
187
|
+
}, [c]), h(() => {
|
|
188
|
+
if (typeof window > "u") return;
|
|
189
|
+
const g = (v) => {
|
|
190
|
+
P.current = { x: v.clientX, y: v.clientY };
|
|
191
|
+
};
|
|
192
|
+
return window.addEventListener("mousemove", g, { passive: !0 }), () => window.removeEventListener("mousemove", g);
|
|
193
|
+
}, []), h(() => {
|
|
194
|
+
if (!n || f.current) return;
|
|
195
|
+
const g = setTimeout(() => {
|
|
196
|
+
if (f.current || R.current || a.current?.matches(":hover")) return;
|
|
197
|
+
I.current = window.scrollY, T.current = { ...P.current }, i(!0);
|
|
198
|
+
const v = () => {
|
|
199
|
+
window.removeEventListener("scroll", S), window.removeEventListener("mousemove", b), u.current = null, d.current = null, l(!0);
|
|
200
|
+
}, S = () => {
|
|
201
|
+
Math.abs(window.scrollY - I.current) > 80 && v();
|
|
202
|
+
}, b = (A) => {
|
|
203
|
+
const { x: O, y: H } = T.current, D = A.clientX - O, W = A.clientY - H;
|
|
204
|
+
Math.sqrt(D * D + W * W) > 80 && v();
|
|
205
|
+
};
|
|
206
|
+
u.current = S, d.current = b, window.addEventListener("scroll", S, { passive: !0 }), window.addEventListener("mousemove", b, { passive: !0 });
|
|
207
|
+
}, t * 1e3);
|
|
208
|
+
return () => {
|
|
209
|
+
clearTimeout(g), u.current && (window.removeEventListener("scroll", u.current), u.current = null), d.current && (window.removeEventListener("mousemove", d.current), d.current = null);
|
|
210
|
+
};
|
|
211
|
+
}, [C]), h(() => {
|
|
212
|
+
!c || !s || (f.current = !0, u.current && (window.removeEventListener("scroll", u.current), u.current = null), d.current && (window.removeEventListener("mousemove", d.current), d.current = null), l(!0));
|
|
213
|
+
}, [c, s]), h(() => {
|
|
214
|
+
if (typeof window > "u") return;
|
|
215
|
+
const g = () => {
|
|
216
|
+
f.current || !n || (I.current = window.scrollY, i(!0));
|
|
217
|
+
}, v = () => {
|
|
218
|
+
w.current && (f.current = !0, u.current && (window.removeEventListener("scroll", u.current), u.current = null), d.current && (window.removeEventListener("mousemove", d.current), d.current = null), l(!0));
|
|
219
|
+
};
|
|
220
|
+
return window.addEventListener("botonic:popup:show", g), window.addEventListener("botonic:popup:hide", v), () => {
|
|
221
|
+
window.removeEventListener("botonic:popup:show", g), window.removeEventListener("botonic:popup:hide", v);
|
|
222
|
+
};
|
|
223
|
+
}, []);
|
|
224
|
+
const x = E(() => {
|
|
225
|
+
l(!1), i(!1), w.current = !1, f.current || M((g) => g + 1);
|
|
226
|
+
}, []);
|
|
227
|
+
return {
|
|
228
|
+
isPopupVisible: s,
|
|
229
|
+
isPopupDismissing: r,
|
|
230
|
+
proactiveMessage: n,
|
|
231
|
+
onPopupAnimationEnd: x
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const me = "[botonic webchat lifecycle]";
|
|
235
|
+
async function $(n, t) {
|
|
236
|
+
if (t)
|
|
237
|
+
try {
|
|
238
|
+
await t();
|
|
239
|
+
} catch (a) {
|
|
240
|
+
console.error(me, n, a);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const rn = he(
|
|
244
|
+
() => import("./webchat-app-md1b0_ze.js").then((n) => n.a5).then((n) => ({ default: n.WebchatApp }))
|
|
245
|
+
);
|
|
246
|
+
function on(n, t) {
|
|
247
|
+
const {
|
|
248
|
+
appId: a,
|
|
249
|
+
position: c = "bottom-right",
|
|
250
|
+
isPulsing: s,
|
|
251
|
+
hoverExpandLabel: i,
|
|
252
|
+
forceHoverExpanded: r,
|
|
253
|
+
firstVisitHoverExpand: l,
|
|
254
|
+
icon: C,
|
|
255
|
+
"aria-label": M,
|
|
256
|
+
className: f,
|
|
257
|
+
webchatConfig: w,
|
|
258
|
+
onReady: R,
|
|
259
|
+
embeddedUser: I,
|
|
260
|
+
onInit: P,
|
|
261
|
+
onOpen: T,
|
|
262
|
+
onClose: u,
|
|
263
|
+
onMessage: d,
|
|
264
|
+
loader: x,
|
|
265
|
+
proactiveMessage: g,
|
|
266
|
+
proactiveDelay: v = 5,
|
|
267
|
+
onTriggerPreviewChannels: S
|
|
268
|
+
} = n, {
|
|
269
|
+
isHydrated: b,
|
|
270
|
+
firstHoverExpandShown: A,
|
|
271
|
+
markFirstHoverExpandShown: O
|
|
272
|
+
} = qe(), [H, D] = L(!1), [W, B] = L(!1), [V, q] = L(!1), [fe, te] = L(0), [y, j] = L(!1), [e, _e] = L(null), [F, we] = L(!1), [z, X] = L("appearing"), [be, re] = L(!1), oe = m(!1), se = m(null), J = m(!1), Q = m(0), U = m(null), K = m(!1), ie = m(!1), Z = m(0);
|
|
273
|
+
ie.current || (ie.current = !0, Oe());
|
|
274
|
+
const ve = ge(
|
|
275
|
+
() => x ? he(x) : rn,
|
|
276
|
+
[x]
|
|
277
|
+
), Ee = E(
|
|
278
|
+
(o) => {
|
|
279
|
+
o.target === o.currentTarget && z !== null && X(null);
|
|
280
|
+
},
|
|
281
|
+
[z]
|
|
282
|
+
);
|
|
283
|
+
h(() => {
|
|
284
|
+
if (!e) return;
|
|
285
|
+
const o = e.machine.subscribe((N) => {
|
|
286
|
+
const G = N.context.isOpen ?? !1, k = N.context.messageActors?.size ?? 0;
|
|
287
|
+
we(N.context.connectionStatus === "connected"), j(G), G ? (re(!1), Z.current = k) : (k > Z.current && re(!0), Z.current = k);
|
|
288
|
+
});
|
|
289
|
+
return () => o.unsubscribe();
|
|
290
|
+
}, [e]), h(() => {
|
|
291
|
+
const o = oe.current, N = e !== null && se.current === null;
|
|
292
|
+
if (oe.current = y, se.current = e, !!e) {
|
|
293
|
+
if (N && y) {
|
|
294
|
+
X("opening");
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
o === !1 && y ? X("opening") : o === !0 && !y && X("closing");
|
|
298
|
+
}
|
|
299
|
+
}, [y, e]);
|
|
300
|
+
const Ce = E(
|
|
301
|
+
(o) => {
|
|
302
|
+
if (e === o || U.current === o)
|
|
303
|
+
return;
|
|
304
|
+
U.current = o;
|
|
305
|
+
const N = Q.current += 1;
|
|
306
|
+
(async () => {
|
|
307
|
+
try {
|
|
308
|
+
await ze(o, I), P && await P(o);
|
|
309
|
+
} catch (G) {
|
|
310
|
+
U.current === o && (U.current = null), console.error(me, "onInit", G);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
Q.current === N && (_e(o), Ve(o));
|
|
314
|
+
})();
|
|
315
|
+
},
|
|
316
|
+
[e, I, P]
|
|
317
|
+
);
|
|
318
|
+
h(() => {
|
|
319
|
+
!e || !F || J.current || (J.current = !0, Fe(), R?.(e));
|
|
320
|
+
}, [e, F, R]), h(() => {
|
|
321
|
+
if (!(!e || !F || !T))
|
|
322
|
+
return Ge(e, (o) => {
|
|
323
|
+
$("onOpen", () => T(o));
|
|
324
|
+
});
|
|
325
|
+
}, [e, F, T]), h(() => {
|
|
326
|
+
if (!(!e || !u))
|
|
327
|
+
return e.on("WEBCHAT_CLOSED", () => {
|
|
328
|
+
$("onClose", () => u(e));
|
|
329
|
+
});
|
|
330
|
+
}, [e, u]), h(() => {
|
|
331
|
+
if (!e || !d) return;
|
|
332
|
+
const o = (k) => {
|
|
333
|
+
$(
|
|
334
|
+
"onMessage",
|
|
335
|
+
() => d(e, k.message)
|
|
336
|
+
);
|
|
337
|
+
}, N = e.on("MESSAGE_RECEIVED", o), G = e.on("MESSAGE_SENT", o);
|
|
338
|
+
return () => {
|
|
339
|
+
N(), G();
|
|
340
|
+
};
|
|
341
|
+
}, [e, d]), h(() => () => {
|
|
342
|
+
Q.current += 1, J.current = !1, U.current = null;
|
|
343
|
+
}, []), h(() => {
|
|
344
|
+
!e || !F || !K.current || (K.current = !1, e.open());
|
|
345
|
+
}, [e, F]);
|
|
346
|
+
const Y = E(() => {
|
|
347
|
+
V && (q(!1), te((o) => o + 1)), B(!1), K.current = !0, H ? e ? (K.current = !1, e.open()) : j(!0) : (D(!0), j(!0));
|
|
348
|
+
}, [V, H, e]), {
|
|
349
|
+
channels: ye,
|
|
350
|
+
onSelectChannel: Le,
|
|
351
|
+
onDismissChannelsPanel: Re,
|
|
352
|
+
handleTriggerClickWithChannels: ae
|
|
353
|
+
} = nn({
|
|
354
|
+
onTriggerPreviewChannels: S,
|
|
355
|
+
requestOpen: Y,
|
|
356
|
+
controller: e,
|
|
357
|
+
isOpen: y,
|
|
358
|
+
setIsChannelsPanelVisible: B
|
|
359
|
+
}), {
|
|
360
|
+
hasHoverExpand: Pe,
|
|
361
|
+
isHoverExpandVisible: xe,
|
|
362
|
+
handleTriggerMouseEnter: Te,
|
|
363
|
+
handleTriggerMouseLeave: Ie,
|
|
364
|
+
collapseHoverExpand: ce
|
|
365
|
+
} = en({
|
|
366
|
+
hoverExpandLabel: i,
|
|
367
|
+
firstVisitHoverExpand: l,
|
|
368
|
+
forceHoverExpanded: r,
|
|
369
|
+
triggerRef: t,
|
|
370
|
+
isChannelsPanelVisible: W,
|
|
371
|
+
isOpen: y,
|
|
372
|
+
isEmbedTriggerHydrated: b,
|
|
373
|
+
firstHoverExpandShown: A,
|
|
374
|
+
markFirstHoverExpandShown: O
|
|
375
|
+
}), {
|
|
376
|
+
isPopupVisible: Ae,
|
|
377
|
+
isPopupDismissing: Me,
|
|
378
|
+
proactiveMessage: Se,
|
|
379
|
+
onPopupAnimationEnd: He
|
|
380
|
+
} = tn({
|
|
381
|
+
proactiveMessage: g,
|
|
382
|
+
proactiveDelay: v,
|
|
383
|
+
triggerRef: t,
|
|
384
|
+
isOpen: y
|
|
385
|
+
}), Ne = E(() => {
|
|
386
|
+
ce(), ae(() => {
|
|
387
|
+
e ? y ? e.close() : e.open() : Y();
|
|
388
|
+
});
|
|
389
|
+
}, [
|
|
390
|
+
ce,
|
|
391
|
+
ae,
|
|
392
|
+
e,
|
|
393
|
+
y,
|
|
394
|
+
Y
|
|
395
|
+
]), le = E(() => {
|
|
396
|
+
q(!1), te((o) => o + 1), D(!0), j(!0);
|
|
397
|
+
}, []), De = E((o) => {
|
|
398
|
+
console.error("Failed to load webchat:", o), q(!0);
|
|
399
|
+
}, []);
|
|
400
|
+
return h(() => {
|
|
401
|
+
if (typeof window > "u") return;
|
|
402
|
+
const o = () => Y();
|
|
403
|
+
return window.addEventListener("botonic:open", o), () => window.removeEventListener("botonic:open", o);
|
|
404
|
+
}, [Y]), {
|
|
405
|
+
triggerProps: {
|
|
406
|
+
ref: t,
|
|
407
|
+
type: "button",
|
|
408
|
+
onClick: V ? le : Ne,
|
|
409
|
+
onMouseEnter: Te,
|
|
410
|
+
onMouseLeave: Ie,
|
|
411
|
+
onAnimationEnd: Ee,
|
|
412
|
+
"aria-label": M || (y ? "Close chat" : "Open chat"),
|
|
413
|
+
"aria-expanded": y
|
|
414
|
+
},
|
|
415
|
+
icon: C,
|
|
416
|
+
isOpen: y,
|
|
417
|
+
className: f,
|
|
418
|
+
hoverExpandLabel: i,
|
|
419
|
+
variants: {
|
|
420
|
+
position: c,
|
|
421
|
+
isPulsing: s,
|
|
422
|
+
hasHoverExpand: Pe,
|
|
423
|
+
isHoverExpandVisible: xe,
|
|
424
|
+
isAppearing: z === "appearing",
|
|
425
|
+
isOpening: z === "opening",
|
|
426
|
+
isClosing: z === "closing",
|
|
427
|
+
isLoading: H && !e,
|
|
428
|
+
isOpen: y
|
|
429
|
+
},
|
|
430
|
+
webchatProps: {
|
|
431
|
+
appId: a,
|
|
432
|
+
isOpen: y,
|
|
433
|
+
onClose: () => e?.close(),
|
|
434
|
+
onControllerReady: Ce,
|
|
435
|
+
...w
|
|
436
|
+
},
|
|
437
|
+
shouldRenderWebchat: H,
|
|
438
|
+
LazyWebchat: ve,
|
|
439
|
+
loadError: V,
|
|
440
|
+
retryLoad: le,
|
|
441
|
+
handleLoadError: De,
|
|
442
|
+
retryKey: fe,
|
|
443
|
+
hasNewMessages: be,
|
|
444
|
+
isPopupVisible: Ae,
|
|
445
|
+
isPopupDismissing: Me,
|
|
446
|
+
proactiveMessage: Se,
|
|
447
|
+
onPopupAnimationEnd: He,
|
|
448
|
+
isChannelsPanelVisible: W,
|
|
449
|
+
channels: ye,
|
|
450
|
+
onSelectChannel: Le,
|
|
451
|
+
onDismissChannelsPanel: Re,
|
|
452
|
+
embedTrigger: {
|
|
453
|
+
isHydrated: b,
|
|
454
|
+
firstHoverExpandShown: A
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function sn() {
|
|
459
|
+
return /* @__PURE__ */ p(
|
|
7
460
|
"svg",
|
|
8
461
|
{
|
|
9
462
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -16,12 +469,12 @@ function Ie() {
|
|
|
16
469
|
strokeLinejoin: "round",
|
|
17
470
|
role: "img",
|
|
18
471
|
"aria-hidden": !0,
|
|
19
|
-
children: /* @__PURE__ */
|
|
472
|
+
children: /* @__PURE__ */ p("path", { d: "M11.9824 1H12.0068C16.6626 1.00019 20.8294 3.94825 22.3779 8.34766V8.34863C23.9256 12.7351 22.5189 17.6607 18.8877 20.5752L18.8867 20.5762C15.366 23.4132 10.4571 23.7848 6.55273 21.5576C6.37266 21.455 6.16579 21.4117 5.96094 21.4316L5.87305 21.4443L1.80176 22.209L2.56738 18.1328C2.61117 17.8992 2.57029 17.6574 2.45215 17.4512C0.544246 14.1225 0.50971 10.0164 2.38574 6.64258C4.32746 3.1601 8.00376 1.00006 11.9824 1Z" })
|
|
20
473
|
}
|
|
21
474
|
);
|
|
22
475
|
}
|
|
23
|
-
function
|
|
24
|
-
return /* @__PURE__ */
|
|
476
|
+
function an() {
|
|
477
|
+
return /* @__PURE__ */ p(
|
|
25
478
|
"svg",
|
|
26
479
|
{
|
|
27
480
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -35,165 +488,20 @@ function We() {
|
|
|
35
488
|
strokeLinejoin: "round",
|
|
36
489
|
role: "img",
|
|
37
490
|
"aria-hidden": !0,
|
|
38
|
-
children: /* @__PURE__ */
|
|
491
|
+
children: /* @__PURE__ */ p("path", { d: "M6 9l6 6 6-6" })
|
|
39
492
|
}
|
|
40
493
|
);
|
|
41
494
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
position: S = "bottom-right",
|
|
49
|
-
isPulsing: f,
|
|
50
|
-
icon: D,
|
|
51
|
-
"aria-label": L,
|
|
52
|
-
className: z,
|
|
53
|
-
webchatConfig: V,
|
|
54
|
-
onReady: E,
|
|
55
|
-
loader: y,
|
|
56
|
-
proactiveMessage: C,
|
|
57
|
-
proactiveDelay: H = 5
|
|
58
|
-
} = p, [w, A] = l(!1), [d, b] = l(!1), [T, I] = l(0), [r, W] = l(!1), [t, ae] = l(null), [j, ce] = l(!1), [R, N] = l("appearing"), [le, q] = l(!1), [P, Y] = l(!1), [ue, M] = l(!1), [pe, de] = l(0), F = i(!1), K = i(null), U = i(!1), Q = i(!1), O = i(0), Z = i(!1), B = i(0), J = i({ x: 0, y: 0 }), X = i({ x: 0, y: 0 }), a = i(null), c = i(null), _ = i(!1), G = i(!1);
|
|
59
|
-
Q.current || (Q.current = !0, Pe()), u(() => {
|
|
60
|
-
G.current = P;
|
|
61
|
-
}, [P]), u(() => {
|
|
62
|
-
Z.current = r;
|
|
63
|
-
}, [r]);
|
|
64
|
-
const ge = ye(
|
|
65
|
-
() => y ? ie(y) : Ne,
|
|
66
|
-
[y]
|
|
67
|
-
), he = h(
|
|
68
|
-
(e) => {
|
|
69
|
-
e.target === e.currentTarget && R !== null && N(null);
|
|
70
|
-
},
|
|
71
|
-
[R]
|
|
72
|
-
);
|
|
73
|
-
u(() => {
|
|
74
|
-
if (!t) return;
|
|
75
|
-
const e = t.machine.subscribe((s) => {
|
|
76
|
-
const v = s.context.isOpen ?? !1, g = s.context.messageActors?.size ?? 0;
|
|
77
|
-
ce(s.context.connectionStatus === "connected"), W(v), v ? (q(!1), O.current = g) : (g > O.current && q(!0), O.current = g);
|
|
78
|
-
});
|
|
79
|
-
return () => e.unsubscribe();
|
|
80
|
-
}, [t]), u(() => {
|
|
81
|
-
const e = F.current, s = t !== null && K.current === null;
|
|
82
|
-
if (F.current = r, K.current = t, !!t) {
|
|
83
|
-
if (s && r) {
|
|
84
|
-
N("opening");
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
e === !1 && r ? N("opening") : e === !0 && !r && N("closing");
|
|
88
|
-
}
|
|
89
|
-
}, [r, t]);
|
|
90
|
-
const me = h((e) => {
|
|
91
|
-
ae(e), xe(e);
|
|
92
|
-
}, []);
|
|
93
|
-
u(() => {
|
|
94
|
-
!t || !j || U.current || (U.current = !0, Ae(), E?.(t));
|
|
95
|
-
}, [t, j, E]);
|
|
96
|
-
const k = h(() => {
|
|
97
|
-
d && (b(!1), I((e) => e + 1)), w ? t ? t.open() : W(!0) : (A(!0), W(!0));
|
|
98
|
-
}, [d, w, t]), fe = h(() => {
|
|
99
|
-
t ? r ? t.close() : t.open() : k();
|
|
100
|
-
}, [t, r, k]), $ = h(() => {
|
|
101
|
-
b(!1), I((e) => e + 1), A(!0), W(!0);
|
|
102
|
-
}, []), we = h((e) => {
|
|
103
|
-
console.error("Failed to load webchat:", e), b(!0);
|
|
104
|
-
}, []);
|
|
105
|
-
u(() => {
|
|
106
|
-
if (typeof window > "u") return;
|
|
107
|
-
const e = () => k();
|
|
108
|
-
return window.addEventListener("botonic:open", e), () => window.removeEventListener("botonic:open", e);
|
|
109
|
-
}, [k]), u(() => {
|
|
110
|
-
if (typeof window > "u") return;
|
|
111
|
-
const e = (s) => {
|
|
112
|
-
J.current = { x: s.clientX, y: s.clientY };
|
|
113
|
-
};
|
|
114
|
-
return window.addEventListener("mousemove", e, { passive: !0 }), () => window.removeEventListener("mousemove", e);
|
|
115
|
-
}, []), u(() => {
|
|
116
|
-
if (!C || _.current) return;
|
|
117
|
-
const e = setTimeout(() => {
|
|
118
|
-
if (_.current || Z.current || m.current?.matches(":hover")) return;
|
|
119
|
-
B.current = window.scrollY, X.current = { ...J.current }, Y(!0);
|
|
120
|
-
const s = () => {
|
|
121
|
-
window.removeEventListener("scroll", v), window.removeEventListener("mousemove", g), a.current = null, c.current = null, M(!0);
|
|
122
|
-
}, v = () => {
|
|
123
|
-
Math.abs(window.scrollY - B.current) > 80 && s();
|
|
124
|
-
}, g = (ee) => {
|
|
125
|
-
const { x: _e, y: ve } = X.current, te = ee.clientX - _e, re = ee.clientY - ve;
|
|
126
|
-
Math.sqrt(te * te + re * re) > 80 && s();
|
|
127
|
-
};
|
|
128
|
-
a.current = v, c.current = g, window.addEventListener("scroll", v, { passive: !0 }), window.addEventListener("mousemove", g, { passive: !0 });
|
|
129
|
-
}, H * 1e3);
|
|
130
|
-
return () => {
|
|
131
|
-
clearTimeout(e), a.current && (window.removeEventListener("scroll", a.current), a.current = null), c.current && (window.removeEventListener("mousemove", c.current), c.current = null);
|
|
132
|
-
};
|
|
133
|
-
}, [pe]), u(() => {
|
|
134
|
-
!r || !P || (_.current = !0, a.current && (window.removeEventListener("scroll", a.current), a.current = null), c.current && (window.removeEventListener("mousemove", c.current), c.current = null), M(!0));
|
|
135
|
-
}, [r, P]), u(() => {
|
|
136
|
-
if (typeof window > "u") return;
|
|
137
|
-
const e = () => {
|
|
138
|
-
_.current || !C || (B.current = window.scrollY, Y(!0));
|
|
139
|
-
}, s = () => {
|
|
140
|
-
G.current && (_.current = !0, a.current && (window.removeEventListener("scroll", a.current), a.current = null), c.current && (window.removeEventListener("mousemove", c.current), c.current = null), M(!0));
|
|
141
|
-
};
|
|
142
|
-
return window.addEventListener("botonic:popup:show", e), window.addEventListener("botonic:popup:hide", s), () => {
|
|
143
|
-
window.removeEventListener("botonic:popup:show", e), window.removeEventListener("botonic:popup:hide", s);
|
|
144
|
-
};
|
|
145
|
-
}, []);
|
|
146
|
-
const be = h(() => {
|
|
147
|
-
M(!1), Y(!1), G.current = !1, _.current || de((e) => e + 1);
|
|
148
|
-
}, []);
|
|
149
|
-
return {
|
|
150
|
-
triggerProps: {
|
|
151
|
-
ref: m,
|
|
152
|
-
type: "button",
|
|
153
|
-
onClick: d ? $ : fe,
|
|
154
|
-
onAnimationEnd: he,
|
|
155
|
-
"aria-label": L || (r ? "Close chat" : "Open chat"),
|
|
156
|
-
"aria-expanded": r
|
|
157
|
-
},
|
|
158
|
-
icon: D,
|
|
159
|
-
isOpen: r,
|
|
160
|
-
className: z,
|
|
161
|
-
variants: {
|
|
162
|
-
position: S,
|
|
163
|
-
isPulsing: f,
|
|
164
|
-
isAppearing: R === "appearing",
|
|
165
|
-
isOpening: R === "opening",
|
|
166
|
-
isClosing: R === "closing",
|
|
167
|
-
isLoading: w && !t,
|
|
168
|
-
isOpen: r
|
|
169
|
-
},
|
|
170
|
-
webchatProps: {
|
|
171
|
-
appId: x,
|
|
172
|
-
isOpen: r,
|
|
173
|
-
onClose: () => t?.close(),
|
|
174
|
-
onControllerReady: me,
|
|
175
|
-
...V
|
|
176
|
-
},
|
|
177
|
-
shouldRenderWebchat: w,
|
|
178
|
-
LazyWebchat: ge,
|
|
179
|
-
loadError: d,
|
|
180
|
-
retryLoad: $,
|
|
181
|
-
handleLoadError: we,
|
|
182
|
-
retryKey: T,
|
|
183
|
-
hasNewMessages: le,
|
|
184
|
-
isPopupVisible: P,
|
|
185
|
-
isPopupDismissing: ue,
|
|
186
|
-
proactiveMessage: C,
|
|
187
|
-
onPopupAnimationEnd: be
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const Oe = "webchat-trigger-module__base___BpGIN", o = {
|
|
191
|
-
base: Oe,
|
|
495
|
+
const cn = "webchat-trigger-module__base___BpGIN", _ = {
|
|
496
|
+
base: cn,
|
|
497
|
+
"has-hover-expand": "webchat-trigger-module__has-hover-expand___tePjn",
|
|
498
|
+
"is-hover-expand-visible": "webchat-trigger-module__is-hover-expand-visible___wMU4J",
|
|
499
|
+
"hover-expand-label": "webchat-trigger-module__hover-expand-label___ZSUf7",
|
|
500
|
+
"trigger-icon": "webchat-trigger-module__trigger-icon___8oGUm",
|
|
192
501
|
"bottom-right": "webchat-trigger-module__bottom-right___Q9RB7",
|
|
193
502
|
"bottom-left": "webchat-trigger-module__bottom-left___O0h6i",
|
|
194
503
|
"top-right": "webchat-trigger-module__top-right___fRZQ7",
|
|
195
504
|
"top-left": "webchat-trigger-module__top-left___HIH3L",
|
|
196
|
-
"trigger-icon": "webchat-trigger-module__trigger-icon___8oGUm",
|
|
197
505
|
"new-messages-badge": "webchat-trigger-module__new-messages-badge___N3N26",
|
|
198
506
|
"loading-spinner": "webchat-trigger-module__loading-spinner___UrhIi",
|
|
199
507
|
"is-pulsing": "webchat-trigger-module__is-pulsing___bVsxi",
|
|
@@ -202,110 +510,179 @@ const Oe = "webchat-trigger-module__base___BpGIN", o = {
|
|
|
202
510
|
"is-closing": "webchat-trigger-module__is-closing___Gbp3t",
|
|
203
511
|
"is-loading": "webchat-trigger-module__is-loading___Qnwvi",
|
|
204
512
|
"is-open": "webchat-trigger-module__is-open___qJce6"
|
|
513
|
+
}, ln = "webchat-trigger-channels-panel-module__panel___uLZtx", un = "webchat-trigger-channels-panel-module__bottom-right___mDVyM", dn = "webchat-trigger-channels-panel-module__bottom-left___5fp0H", pn = "webchat-trigger-channels-panel-module__top-right___fmmGT", gn = "webchat-trigger-channels-panel-module__top-left___zjNN-", hn = "webchat-trigger-channels-panel-module__menu___H5kYG", ee = {
|
|
514
|
+
panel: ln,
|
|
515
|
+
"bottom-right": "webchat-trigger-channels-panel-module__bottom-right___mDVyM",
|
|
516
|
+
bottomRight: un,
|
|
517
|
+
"bottom-left": "webchat-trigger-channels-panel-module__bottom-left___5fp0H",
|
|
518
|
+
bottomLeft: dn,
|
|
519
|
+
"top-right": "webchat-trigger-channels-panel-module__top-right___fmmGT",
|
|
520
|
+
topRight: pn,
|
|
521
|
+
"top-left": "webchat-trigger-channels-panel-module__top-left___zjNN-",
|
|
522
|
+
topLeft: gn,
|
|
523
|
+
menu: hn
|
|
205
524
|
};
|
|
206
|
-
|
|
525
|
+
function mn({
|
|
526
|
+
channels: n,
|
|
527
|
+
position: t,
|
|
528
|
+
triggerRef: a,
|
|
529
|
+
onSelectChannel: c,
|
|
530
|
+
onDismiss: s
|
|
531
|
+
}) {
|
|
532
|
+
const i = m(null);
|
|
533
|
+
return h(() => {
|
|
534
|
+
const r = (l) => {
|
|
535
|
+
const C = l.target;
|
|
536
|
+
i.current?.contains(C) || a.current?.contains(C) || s();
|
|
537
|
+
};
|
|
538
|
+
return document.addEventListener("pointerdown", r), () => document.removeEventListener("pointerdown", r);
|
|
539
|
+
}, [s, a]), /* @__PURE__ */ p(
|
|
540
|
+
"div",
|
|
541
|
+
{
|
|
542
|
+
ref: i,
|
|
543
|
+
className: ne(ee.panel, ee[t]),
|
|
544
|
+
"data-testid": "webchat-channels-panel",
|
|
545
|
+
children: /* @__PURE__ */ p(Ke, { className: ee.menu, children: n.map((r) => /* @__PURE__ */ p(
|
|
546
|
+
Ze,
|
|
547
|
+
{
|
|
548
|
+
icon: r.icon,
|
|
549
|
+
testId: `webchat-channel-${r.channel}`,
|
|
550
|
+
onPress: () => c(r),
|
|
551
|
+
children: r.label
|
|
552
|
+
},
|
|
553
|
+
r.channel
|
|
554
|
+
)) })
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
class fn extends ke {
|
|
207
559
|
constructor() {
|
|
208
560
|
super(...arguments), this.state = { hasError: !1 };
|
|
209
561
|
}
|
|
210
562
|
static getDerivedStateFromError() {
|
|
211
563
|
return { hasError: !0 };
|
|
212
564
|
}
|
|
213
|
-
componentDidCatch(
|
|
214
|
-
this.props.onError(
|
|
565
|
+
componentDidCatch(t) {
|
|
566
|
+
this.props.onError(t);
|
|
215
567
|
}
|
|
216
568
|
render() {
|
|
217
569
|
return this.state.hasError ? null : this.props.children;
|
|
218
570
|
}
|
|
219
571
|
}
|
|
220
|
-
const
|
|
221
|
-
popup:
|
|
572
|
+
const _n = "webchat-trigger-popup-module__popup___8qvlu", pe = {
|
|
573
|
+
popup: _n,
|
|
222
574
|
"popup-dismiss": "webchat-trigger-popup-module__popup-dismiss___wucZD"
|
|
223
|
-
},
|
|
575
|
+
}, wn = Xe(_.base, {
|
|
224
576
|
variants: {
|
|
225
577
|
position: {
|
|
226
|
-
"bottom-right":
|
|
227
|
-
"bottom-left":
|
|
228
|
-
"top-right":
|
|
229
|
-
"top-left":
|
|
578
|
+
"bottom-right": _["bottom-right"],
|
|
579
|
+
"bottom-left": _["bottom-left"],
|
|
580
|
+
"top-right": _["top-right"],
|
|
581
|
+
"top-left": _["top-left"]
|
|
230
582
|
},
|
|
231
583
|
isPulsing: {
|
|
232
|
-
true:
|
|
584
|
+
true: _["is-pulsing"]
|
|
585
|
+
},
|
|
586
|
+
hasHoverExpand: {
|
|
587
|
+
true: _["has-hover-expand"]
|
|
588
|
+
},
|
|
589
|
+
isHoverExpandVisible: {
|
|
590
|
+
true: _["is-hover-expand-visible"]
|
|
233
591
|
},
|
|
234
592
|
isAppearing: {
|
|
235
|
-
true:
|
|
593
|
+
true: _["is-appearing"]
|
|
236
594
|
},
|
|
237
595
|
isOpening: {
|
|
238
|
-
true:
|
|
596
|
+
true: _["is-opening"]
|
|
239
597
|
},
|
|
240
598
|
isClosing: {
|
|
241
|
-
true:
|
|
599
|
+
true: _["is-closing"]
|
|
242
600
|
},
|
|
243
601
|
isLoading: {
|
|
244
|
-
true:
|
|
602
|
+
true: _["is-loading"]
|
|
245
603
|
},
|
|
246
604
|
isOpen: {
|
|
247
|
-
true:
|
|
605
|
+
true: _["is-open"]
|
|
248
606
|
}
|
|
249
607
|
},
|
|
250
608
|
defaultVariants: {
|
|
251
609
|
position: "bottom-right"
|
|
252
610
|
}
|
|
253
611
|
});
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
triggerProps:
|
|
257
|
-
icon:
|
|
258
|
-
isOpen:
|
|
259
|
-
className:
|
|
260
|
-
variants:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
612
|
+
function Tn(n) {
|
|
613
|
+
const t = m(null), {
|
|
614
|
+
triggerProps: a,
|
|
615
|
+
icon: c,
|
|
616
|
+
isOpen: s,
|
|
617
|
+
className: i,
|
|
618
|
+
variants: r,
|
|
619
|
+
hoverExpandLabel: l,
|
|
620
|
+
webchatProps: C,
|
|
621
|
+
shouldRenderWebchat: M,
|
|
622
|
+
LazyWebchat: f,
|
|
623
|
+
loadError: w,
|
|
624
|
+
handleLoadError: R,
|
|
625
|
+
retryKey: I,
|
|
626
|
+
hasNewMessages: P,
|
|
627
|
+
isPopupVisible: T,
|
|
628
|
+
isPopupDismissing: u,
|
|
629
|
+
proactiveMessage: d,
|
|
630
|
+
onPopupAnimationEnd: x,
|
|
631
|
+
isChannelsPanelVisible: g,
|
|
632
|
+
channels: v,
|
|
633
|
+
onSelectChannel: S,
|
|
634
|
+
onDismissChannelsPanel: b
|
|
635
|
+
} = on(n, t), A = s ? /* @__PURE__ */ p(an, {}) : /* @__PURE__ */ p(sn, {});
|
|
636
|
+
return /* @__PURE__ */ ue(je, { children: [
|
|
637
|
+
g && v && v.length > 0 && /* @__PURE__ */ p(
|
|
638
|
+
mn,
|
|
639
|
+
{
|
|
640
|
+
channels: v,
|
|
641
|
+
position: r.position,
|
|
642
|
+
triggerRef: t,
|
|
643
|
+
onSelectChannel: S,
|
|
644
|
+
onDismiss: b
|
|
645
|
+
}
|
|
646
|
+
),
|
|
647
|
+
(T || u) && d && /* @__PURE__ */ p(
|
|
275
648
|
"div",
|
|
276
649
|
{
|
|
277
|
-
className:
|
|
278
|
-
|
|
279
|
-
|
|
650
|
+
className: ne(
|
|
651
|
+
pe.popup,
|
|
652
|
+
u && pe["popup-dismiss"]
|
|
280
653
|
),
|
|
281
654
|
role: "status",
|
|
282
655
|
"aria-live": "polite",
|
|
283
|
-
onAnimationEnd:
|
|
284
|
-
children: /* @__PURE__ */
|
|
656
|
+
onAnimationEnd: u ? x : void 0,
|
|
657
|
+
children: /* @__PURE__ */ p("p", { children: d })
|
|
285
658
|
}
|
|
286
659
|
),
|
|
287
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ ue(
|
|
288
661
|
"button",
|
|
289
662
|
{
|
|
290
|
-
...
|
|
291
|
-
className:
|
|
663
|
+
...a,
|
|
664
|
+
className: ne(wn(r), i),
|
|
292
665
|
"data-testid": "webchat-trigger",
|
|
293
|
-
"aria-label":
|
|
666
|
+
"aria-label": w ? "Retry loading chat" : a["aria-label"],
|
|
294
667
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
|
|
668
|
+
/* @__PURE__ */ p("div", { className: _["trigger-icon"], children: r.isLoading && s ? /* @__PURE__ */ p("span", { className: _["loading-spinner"] }) : c || A }),
|
|
669
|
+
l ? /* @__PURE__ */ p("span", { className: _["hover-expand-label"], children: l }) : void 0,
|
|
670
|
+
P && !s && /* @__PURE__ */ p("div", { className: _["new-messages-badge"], "aria-hidden": !0 })
|
|
297
671
|
]
|
|
298
672
|
}
|
|
299
673
|
),
|
|
300
|
-
|
|
301
|
-
|
|
674
|
+
M && f && /* @__PURE__ */ p(fn, { onError: R, children: /* @__PURE__ */ p(
|
|
675
|
+
Be,
|
|
302
676
|
{
|
|
303
|
-
fallback:
|
|
304
|
-
children: /* @__PURE__ */
|
|
677
|
+
fallback: r.isLoading && s ? /* @__PURE__ */ p("span", { className: _["loading-spinner"], "aria-hidden": !0 }) : null,
|
|
678
|
+
children: /* @__PURE__ */ p(f, { ...C })
|
|
305
679
|
}
|
|
306
|
-
) },
|
|
680
|
+
) }, I)
|
|
307
681
|
] });
|
|
308
682
|
}
|
|
309
683
|
export {
|
|
310
|
-
|
|
684
|
+
Mn as SupportedChannels,
|
|
685
|
+
Ye as SupportedTriggerChannels,
|
|
686
|
+
Tn as WebchatTrigger,
|
|
687
|
+
on as useWebchatTrigger
|
|
311
688
|
};
|