@botonic/webchat-react 2.26.0 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/CLAUDE.md +174 -0
- package/index.d.ts +12 -5
- package/index.js +59 -28
- package/lib/components/dialog/backdrop/backdrop.d.ts +5 -0
- package/lib/components/dialog/dialog/dialog.d.ts +7 -0
- package/lib/components/dialog/dialog-context.d.ts +3 -0
- package/lib/components/dialog/dialog-provider.d.ts +17 -0
- package/lib/components/dialog/dialog-types.d.ts +24 -0
- package/lib/components/dialog/icons/check-icon.d.ts +1 -0
- package/lib/components/dialog/icons/xmark-icon.d.ts +1 -0
- package/lib/components/dialog/index.d.ts +5 -0
- package/lib/components/dialog/webchat-dialog-provider.d.ts +6 -0
- package/lib/components/message/audio-message/audio-message.d.ts +2 -0
- package/lib/components/message/audio-message/use-audio-message.d.ts +294 -0
- package/lib/components/message/button-message/button-message.d.ts +6 -1
- package/lib/components/message/carousel-message/carousel-message.d.ts +2 -2
- package/lib/components/message/carousel-message/icons/chevron-left-icon.d.ts +1 -0
- package/lib/components/message/carousel-message/icons/chevron-right-icon.d.ts +1 -0
- package/lib/components/message/carousel-message/index.d.ts +1 -1
- package/lib/components/message/carousel-message/use-carousel-message.d.ts +47 -0
- package/lib/components/message/document-message/document-message.d.ts +2 -8
- package/lib/components/message/document-message/use-document-message.d.ts +11 -0
- package/lib/components/message/image-message/use-image-message.d.ts +10 -0
- package/lib/components/message/index.d.ts +2 -1
- package/lib/components/message/message/message-avatar/message-avatar.d.ts +2 -0
- package/lib/components/message/message/message-bubble/message-bubble.d.ts +4 -3
- package/lib/components/message/message/message-info/message-info.d.ts +2 -0
- package/lib/components/message/message/message.d.ts +10 -0
- package/lib/components/message/message/use-message.d.ts +11 -3
- package/lib/components/{typing-indicator → message/typing-message}/index.d.ts +1 -1
- package/lib/components/{typing-indicator/typing-indicator.d.ts → message/typing-message/typing-message.d.ts} +0 -5
- package/lib/components/message/video-message/use-video-message.d.ts +21 -0
- package/lib/components/message/video-message/video-message.d.ts +3 -1
- package/lib/components/message-machine-renderer/message-machine-renderer.d.ts +1 -0
- package/lib/components/message-machine-renderer/use-message-machine-renderer.d.ts +3 -2
- package/lib/components/shared/button-component/external-link-icon.d.ts +1 -0
- package/lib/components/webchat-app/webchat-app.d.ts +10 -3
- package/lib/components/webchat-container/use-webchat-container.d.ts +1 -0
- package/lib/components/webchat-header/icons/close-icon.d.ts +1 -0
- package/lib/components/webchat-header/icons/download-icon.d.ts +1 -0
- package/lib/components/webchat-header/icons/leave-icon.d.ts +1 -0
- package/lib/components/webchat-header/icons/menu-icon.d.ts +1 -0
- package/lib/components/webchat-header/icons/sounds-icon.d.ts +1 -0
- package/lib/components/webchat-header/icons/start-over-icon.d.ts +1 -0
- package/lib/components/webchat-header/use-webchat-header.d.ts +11 -2
- package/lib/components/webchat-header/webchat-header.d.ts +4 -1
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-download-transcript.d.ts +5 -0
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-conversation.d.ts +5 -0
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-session.d.ts +5 -0
- package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-sounds.d.ts +5 -0
- package/lib/components/webchat-header/webchat-menu/use-dropdown-menu-item-reset-session.d.ts +9 -0
- package/lib/components/webchat-input/attachment-preview/attachment-preview.d.ts +2 -0
- package/lib/components/webchat-input/attachment-preview/index.d.ts +3 -0
- package/lib/components/webchat-input/attachment-preview/use-attachment-preview.d.ts +23 -0
- package/lib/components/webchat-input/audio-input/audio-input.d.ts +2 -0
- package/lib/components/webchat-input/audio-input/index.d.ts +3 -0
- package/lib/components/webchat-input/audio-input/use-audio-input.d.ts +34 -0
- package/lib/components/webchat-input/audio-waveform/audio-waveform.d.ts +5 -0
- package/lib/components/webchat-input/audio-waveform/index.d.ts +1 -0
- package/lib/components/webchat-input/audio-waveform/static-waveform.d.ts +9 -0
- package/lib/components/webchat-input/constants.d.ts +3 -0
- package/lib/components/webchat-input/icons/cancel-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/close-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/confirm-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/file-icon.d.ts +2 -0
- package/lib/components/webchat-input/icons/file-pdf-icon.d.ts +2 -0
- package/lib/components/webchat-input/icons/pause-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/play-icon.d.ts +1 -0
- package/lib/components/webchat-input/use-webchat-input.d.ts +21 -10
- package/lib/components/webchat-input/webchat-input.d.ts +6 -1
- package/lib/components/webchat-messages/use-webchat-messages-list-scroll.d.ts +15 -0
- package/lib/components/webchat-messages/use-webchat-messages.d.ts +19 -1
- package/lib/components/webchat-provider/webchat-context.d.ts +8 -0
- package/lib/components/webchat-provider/webchat-provider.d.ts +1 -10
- package/lib/components/webchat-trigger/icons/chat-icon.d.ts +1 -0
- package/lib/components/webchat-trigger/icons/chevron-down-icon.d.ts +1 -0
- package/lib/components/webchat-trigger/use-webchat-trigger.d.ts +10 -0
- package/lib/contexts/media-playback-context.d.ts +11 -0
- package/lib/hero-header-layout/index.d.ts +3 -0
- package/lib/hero-header-layout/use-webchat-hero-header-layout.d.ts +40 -0
- package/lib/hero-header-layout/webchat-hero-header-layout-config.d.ts +26 -0
- package/lib/hero-header-layout/webchat-hero-header-layout-utils.d.ts +2 -0
- package/lib/hooks/use-audio-recorder.d.ts +20 -0
- package/lib/hooks/use-webchat-state.d.ts +7 -0
- package/lib/hooks/webchat-client-settings-behaviors.d.ts +13 -0
- package/lib/types/webchat-props.d.ts +43 -2
- package/lib/utils/audio-utils.d.ts +1 -0
- package/lib/utils/uuid-utils.d.ts +1 -0
- package/package.json +4 -3
- package/styles.css +179 -35
- package/trigger.js +231 -135
- package/webchat-app-I5AArwfY.js +4122 -0
- package/lib/components/webchat-messages/use-custom-scrollbar.d.ts +0 -11
- package/webchat-app-CLGvs-LL.js +0 -2518
package/trigger.js
CHANGED
|
@@ -1,114 +1,200 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { cx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { ensureGlobalWebchatAPI as
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as n, jsxs as ne, Fragment as Le } from "react/jsx-runtime";
|
|
2
|
+
import { cx as oe, cva as Ee } from "class-variance-authority";
|
|
3
|
+
import { useState as l, useRef as i, useEffect as u, useMemo as ye, lazy as ie, useCallback as h, Component as Ce, Suspense as Re } from "react";
|
|
4
|
+
import { ensureGlobalWebchatAPI as Pe, setupGlobalWebchatAPI as xe, signalWebchatReady as Ae } from "@botonic/webchat-core";
|
|
5
|
+
function Ie() {
|
|
6
|
+
return /* @__PURE__ */ n(
|
|
7
|
+
"svg",
|
|
8
|
+
{
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
width: "24",
|
|
11
|
+
height: "24",
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
strokeWidth: "2",
|
|
16
|
+
strokeLinejoin: "round",
|
|
17
|
+
role: "img",
|
|
18
|
+
"aria-hidden": !0,
|
|
19
|
+
children: /* @__PURE__ */ n("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
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function Ne() {
|
|
24
|
+
return /* @__PURE__ */ n(
|
|
25
|
+
"svg",
|
|
26
|
+
{
|
|
27
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
+
width: "16",
|
|
29
|
+
height: "16",
|
|
30
|
+
viewBox: "0 0 24 24",
|
|
31
|
+
fill: "none",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
strokeWidth: "2.5",
|
|
34
|
+
strokeLinecap: "round",
|
|
35
|
+
strokeLinejoin: "round",
|
|
36
|
+
role: "img",
|
|
37
|
+
"aria-hidden": !0,
|
|
38
|
+
children: /* @__PURE__ */ n("path", { d: "M6 9l6 6 6-6" })
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const We = ie(
|
|
43
|
+
() => import("./webchat-app-I5AArwfY.js").then((p) => p.N).then((p) => ({ default: p.WebchatApp }))
|
|
7
44
|
);
|
|
8
|
-
function
|
|
45
|
+
function Me(p, m) {
|
|
9
46
|
const {
|
|
10
|
-
appId:
|
|
11
|
-
position:
|
|
12
|
-
isPulsing:
|
|
13
|
-
icon:
|
|
14
|
-
"aria-label":
|
|
15
|
-
className:
|
|
16
|
-
webchatConfig:
|
|
17
|
-
onReady:
|
|
18
|
-
loader:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
appId: x,
|
|
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, N] = l(!1), [t, ae] = l(null), [j, ce] = l(!1), [R, W] = l("appearing"), [le, q] = l(!1), [P, Y] = l(!1), [ue, M] = l(!1), [pe, de] = l(0), F = i(!1), K = i(null), Q = i(!1), U = 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
|
+
U.current || (U.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) : We,
|
|
66
|
+
[y]
|
|
67
|
+
), he = h(
|
|
29
68
|
(e) => {
|
|
30
|
-
e.target === e.currentTarget &&
|
|
69
|
+
e.target === e.currentTarget && R !== null && W(null);
|
|
31
70
|
},
|
|
32
|
-
[
|
|
71
|
+
[R]
|
|
33
72
|
);
|
|
34
|
-
|
|
73
|
+
u(() => {
|
|
35
74
|
if (!t) return;
|
|
36
|
-
const e = t.machine.subscribe((
|
|
37
|
-
|
|
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"), N(v), v ? (q(!1), O.current = g) : (g > O.current && q(!0), O.current = g);
|
|
38
78
|
});
|
|
39
79
|
return () => e.unsubscribe();
|
|
40
|
-
}, [t]),
|
|
41
|
-
const e =
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
44
|
-
|
|
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
|
+
W("opening");
|
|
45
85
|
return;
|
|
46
86
|
}
|
|
47
|
-
e === !1 &&
|
|
87
|
+
e === !1 && r ? W("opening") : e === !0 && !r && W("closing");
|
|
48
88
|
}
|
|
49
|
-
}, [
|
|
50
|
-
const
|
|
51
|
-
|
|
89
|
+
}, [r, t]);
|
|
90
|
+
const me = h((e) => {
|
|
91
|
+
ae(e), xe(e);
|
|
52
92
|
}, []);
|
|
53
|
-
|
|
54
|
-
!t || !
|
|
55
|
-
}, [t,
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
}, [
|
|
59
|
-
t ?
|
|
60
|
-
}, [t,
|
|
61
|
-
|
|
62
|
-
}, []),
|
|
63
|
-
console.error("Failed to load webchat:", e),
|
|
93
|
+
u(() => {
|
|
94
|
+
!t || !j || Q.current || (Q.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() : N(!0) : (A(!0), N(!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), N(!0);
|
|
102
|
+
}, []), we = h((e) => {
|
|
103
|
+
console.error("Failed to load webchat:", e), b(!0);
|
|
64
104
|
}, []);
|
|
65
|
-
|
|
105
|
+
u(() => {
|
|
66
106
|
if (typeof window > "u") return;
|
|
67
|
-
const e = () =>
|
|
107
|
+
const e = () => k();
|
|
68
108
|
return window.addEventListener("botonic:open", e), () => window.removeEventListener("botonic:open", e);
|
|
69
|
-
}, [
|
|
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 {
|
|
70
150
|
triggerProps: {
|
|
71
|
-
ref:
|
|
151
|
+
ref: m,
|
|
72
152
|
type: "button",
|
|
73
|
-
onClick:
|
|
74
|
-
onAnimationEnd:
|
|
75
|
-
"aria-label":
|
|
76
|
-
"aria-expanded":
|
|
153
|
+
onClick: d ? $ : fe,
|
|
154
|
+
onAnimationEnd: he,
|
|
155
|
+
"aria-label": L || (r ? "Close chat" : "Open chat"),
|
|
156
|
+
"aria-expanded": r
|
|
77
157
|
},
|
|
78
|
-
icon:
|
|
79
|
-
isOpen:
|
|
80
|
-
className:
|
|
158
|
+
icon: D,
|
|
159
|
+
isOpen: r,
|
|
160
|
+
className: z,
|
|
81
161
|
variants: {
|
|
82
|
-
position:
|
|
83
|
-
isPulsing:
|
|
84
|
-
isAppearing:
|
|
85
|
-
isOpening:
|
|
86
|
-
isClosing:
|
|
87
|
-
isLoading:
|
|
88
|
-
isOpen:
|
|
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
|
|
89
169
|
},
|
|
90
170
|
webchatProps: {
|
|
91
|
-
appId:
|
|
92
|
-
isOpen:
|
|
171
|
+
appId: x,
|
|
172
|
+
isOpen: r,
|
|
93
173
|
onClose: () => t?.close(),
|
|
94
|
-
onControllerReady:
|
|
95
|
-
...
|
|
174
|
+
onControllerReady: me,
|
|
175
|
+
...V
|
|
96
176
|
},
|
|
97
|
-
shouldRenderWebchat:
|
|
98
|
-
LazyWebchat:
|
|
99
|
-
loadError:
|
|
100
|
-
retryLoad:
|
|
101
|
-
handleLoadError:
|
|
102
|
-
retryKey:
|
|
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
|
|
103
188
|
};
|
|
104
189
|
}
|
|
105
|
-
const
|
|
106
|
-
base:
|
|
190
|
+
const Oe = "webchat-trigger-module__base___BpGIN", o = {
|
|
191
|
+
base: Oe,
|
|
107
192
|
"bottom-right": "webchat-trigger-module__bottom-right___Q9RB7",
|
|
108
193
|
"bottom-left": "webchat-trigger-module__bottom-left___O0h6i",
|
|
109
194
|
"top-right": "webchat-trigger-module__top-right___fRZQ7",
|
|
110
195
|
"top-left": "webchat-trigger-module__top-left___HIH3L",
|
|
111
196
|
"trigger-icon": "webchat-trigger-module__trigger-icon___8oGUm",
|
|
197
|
+
"new-messages-badge": "webchat-trigger-module__new-messages-badge___N3N26",
|
|
112
198
|
"loading-spinner": "webchat-trigger-module__loading-spinner___UrhIi",
|
|
113
199
|
"is-pulsing": "webchat-trigger-module__is-pulsing___bVsxi",
|
|
114
200
|
"is-appearing": "webchat-trigger-module__is-appearing___WHdbF",
|
|
@@ -117,99 +203,109 @@ const re = "webchat-trigger-module__base___BpGIN", r = {
|
|
|
117
203
|
"is-loading": "webchat-trigger-module__is-loading___Qnwvi",
|
|
118
204
|
"is-open": "webchat-trigger-module__is-open___qJce6"
|
|
119
205
|
};
|
|
120
|
-
class
|
|
206
|
+
class ke extends Ce {
|
|
121
207
|
constructor() {
|
|
122
208
|
super(...arguments), this.state = { hasError: !1 };
|
|
123
209
|
}
|
|
124
210
|
static getDerivedStateFromError() {
|
|
125
211
|
return { hasError: !0 };
|
|
126
212
|
}
|
|
127
|
-
componentDidCatch(
|
|
128
|
-
this.props.onError(
|
|
213
|
+
componentDidCatch(m) {
|
|
214
|
+
this.props.onError(m);
|
|
129
215
|
}
|
|
130
216
|
render() {
|
|
131
217
|
return this.state.hasError ? null : this.props.children;
|
|
132
218
|
}
|
|
133
219
|
}
|
|
134
|
-
const
|
|
220
|
+
const Se = "webchat-trigger-popup-module__popup___8qvlu", se = {
|
|
221
|
+
popup: Se,
|
|
222
|
+
"popup-dismiss": "webchat-trigger-popup-module__popup-dismiss___wucZD"
|
|
223
|
+
}, De = Ee(o.base, {
|
|
135
224
|
variants: {
|
|
136
225
|
position: {
|
|
137
|
-
"bottom-right":
|
|
138
|
-
"bottom-left":
|
|
139
|
-
"top-right":
|
|
140
|
-
"top-left":
|
|
226
|
+
"bottom-right": o["bottom-right"],
|
|
227
|
+
"bottom-left": o["bottom-left"],
|
|
228
|
+
"top-right": o["top-right"],
|
|
229
|
+
"top-left": o["top-left"]
|
|
141
230
|
},
|
|
142
231
|
isPulsing: {
|
|
143
|
-
true:
|
|
232
|
+
true: o["is-pulsing"]
|
|
144
233
|
},
|
|
145
234
|
isAppearing: {
|
|
146
|
-
true:
|
|
235
|
+
true: o["is-appearing"]
|
|
147
236
|
},
|
|
148
237
|
isOpening: {
|
|
149
|
-
true:
|
|
238
|
+
true: o["is-opening"]
|
|
150
239
|
},
|
|
151
240
|
isClosing: {
|
|
152
|
-
true:
|
|
241
|
+
true: o["is-closing"]
|
|
153
242
|
},
|
|
154
243
|
isLoading: {
|
|
155
|
-
true:
|
|
244
|
+
true: o["is-loading"]
|
|
156
245
|
},
|
|
157
246
|
isOpen: {
|
|
158
|
-
true:
|
|
247
|
+
true: o["is-open"]
|
|
159
248
|
}
|
|
160
249
|
},
|
|
161
250
|
defaultVariants: {
|
|
162
251
|
position: "bottom-right"
|
|
163
252
|
}
|
|
164
253
|
});
|
|
165
|
-
function
|
|
166
|
-
const
|
|
167
|
-
triggerProps:
|
|
168
|
-
icon:
|
|
169
|
-
isOpen:
|
|
170
|
-
className:
|
|
171
|
-
variants:
|
|
172
|
-
webchatProps:
|
|
173
|
-
shouldRenderWebchat:
|
|
174
|
-
LazyWebchat:
|
|
175
|
-
loadError:
|
|
176
|
-
handleLoadError:
|
|
177
|
-
retryKey:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
254
|
+
function Be(p) {
|
|
255
|
+
const m = i(null), {
|
|
256
|
+
triggerProps: x,
|
|
257
|
+
icon: S,
|
|
258
|
+
isOpen: f,
|
|
259
|
+
className: D,
|
|
260
|
+
variants: L,
|
|
261
|
+
webchatProps: z,
|
|
262
|
+
shouldRenderWebchat: V,
|
|
263
|
+
LazyWebchat: E,
|
|
264
|
+
loadError: y,
|
|
265
|
+
handleLoadError: C,
|
|
266
|
+
retryKey: H,
|
|
267
|
+
hasNewMessages: w,
|
|
268
|
+
isPopupVisible: A,
|
|
269
|
+
isPopupDismissing: d,
|
|
270
|
+
proactiveMessage: b,
|
|
271
|
+
onPopupAnimationEnd: T
|
|
272
|
+
} = Me(p, m), I = f ? /* @__PURE__ */ n(Ne, {}) : /* @__PURE__ */ n(Ie, {});
|
|
273
|
+
return /* @__PURE__ */ ne(Le, { children: [
|
|
274
|
+
(A || d) && b && /* @__PURE__ */ n(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
className: oe(
|
|
278
|
+
se.popup,
|
|
279
|
+
d && se["popup-dismiss"]
|
|
280
|
+
),
|
|
281
|
+
role: "status",
|
|
282
|
+
"aria-live": "polite",
|
|
283
|
+
onAnimationEnd: d ? T : void 0,
|
|
284
|
+
children: /* @__PURE__ */ n("p", { children: b })
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ ne(
|
|
181
288
|
"button",
|
|
182
289
|
{
|
|
183
|
-
...
|
|
184
|
-
className:
|
|
290
|
+
...x,
|
|
291
|
+
className: oe(De(L), D),
|
|
185
292
|
"data-testid": "webchat-trigger",
|
|
186
|
-
"aria-label":
|
|
187
|
-
children:
|
|
188
|
-
"
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
width: "24",
|
|
192
|
-
height: "24",
|
|
193
|
-
viewBox: "0 0 24 24",
|
|
194
|
-
fill: "none",
|
|
195
|
-
stroke: "currentColor",
|
|
196
|
-
strokeWidth: "2",
|
|
197
|
-
strokeLinejoin: "round",
|
|
198
|
-
"aria-hidden": !0,
|
|
199
|
-
children: /* @__PURE__ */ o("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" })
|
|
200
|
-
}
|
|
201
|
-
) })
|
|
293
|
+
"aria-label": y ? "Retry loading chat" : x["aria-label"],
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ n("div", { className: o["trigger-icon"], children: L.isLoading && f ? /* @__PURE__ */ n("span", { className: o["loading-spinner"] }) : S || I }),
|
|
296
|
+
w && !f && /* @__PURE__ */ n("div", { className: o["new-messages-badge"], "aria-hidden": !0 })
|
|
297
|
+
]
|
|
202
298
|
}
|
|
203
299
|
),
|
|
204
|
-
|
|
205
|
-
|
|
300
|
+
V && E && /* @__PURE__ */ n(ke, { onError: C, children: /* @__PURE__ */ n(
|
|
301
|
+
Re,
|
|
206
302
|
{
|
|
207
|
-
fallback:
|
|
208
|
-
children: /* @__PURE__ */
|
|
303
|
+
fallback: L.isLoading && f ? /* @__PURE__ */ n("span", { className: o["loading-spinner"], "aria-hidden": !0 }) : null,
|
|
304
|
+
children: /* @__PURE__ */ n(E, { ...z })
|
|
209
305
|
}
|
|
210
|
-
) },
|
|
306
|
+
) }, H)
|
|
211
307
|
] });
|
|
212
308
|
}
|
|
213
309
|
export {
|
|
214
|
-
|
|
310
|
+
Be as WebchatTrigger
|
|
215
311
|
};
|