@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.
Files changed (95) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/CLAUDE.md +174 -0
  3. package/index.d.ts +12 -5
  4. package/index.js +59 -28
  5. package/lib/components/dialog/backdrop/backdrop.d.ts +5 -0
  6. package/lib/components/dialog/dialog/dialog.d.ts +7 -0
  7. package/lib/components/dialog/dialog-context.d.ts +3 -0
  8. package/lib/components/dialog/dialog-provider.d.ts +17 -0
  9. package/lib/components/dialog/dialog-types.d.ts +24 -0
  10. package/lib/components/dialog/icons/check-icon.d.ts +1 -0
  11. package/lib/components/dialog/icons/xmark-icon.d.ts +1 -0
  12. package/lib/components/dialog/index.d.ts +5 -0
  13. package/lib/components/dialog/webchat-dialog-provider.d.ts +6 -0
  14. package/lib/components/message/audio-message/audio-message.d.ts +2 -0
  15. package/lib/components/message/audio-message/use-audio-message.d.ts +294 -0
  16. package/lib/components/message/button-message/button-message.d.ts +6 -1
  17. package/lib/components/message/carousel-message/carousel-message.d.ts +2 -2
  18. package/lib/components/message/carousel-message/icons/chevron-left-icon.d.ts +1 -0
  19. package/lib/components/message/carousel-message/icons/chevron-right-icon.d.ts +1 -0
  20. package/lib/components/message/carousel-message/index.d.ts +1 -1
  21. package/lib/components/message/carousel-message/use-carousel-message.d.ts +47 -0
  22. package/lib/components/message/document-message/document-message.d.ts +2 -8
  23. package/lib/components/message/document-message/use-document-message.d.ts +11 -0
  24. package/lib/components/message/image-message/use-image-message.d.ts +10 -0
  25. package/lib/components/message/index.d.ts +2 -1
  26. package/lib/components/message/message/message-avatar/message-avatar.d.ts +2 -0
  27. package/lib/components/message/message/message-bubble/message-bubble.d.ts +4 -3
  28. package/lib/components/message/message/message-info/message-info.d.ts +2 -0
  29. package/lib/components/message/message/message.d.ts +10 -0
  30. package/lib/components/message/message/use-message.d.ts +11 -3
  31. package/lib/components/{typing-indicator → message/typing-message}/index.d.ts +1 -1
  32. package/lib/components/{typing-indicator/typing-indicator.d.ts → message/typing-message/typing-message.d.ts} +0 -5
  33. package/lib/components/message/video-message/use-video-message.d.ts +21 -0
  34. package/lib/components/message/video-message/video-message.d.ts +3 -1
  35. package/lib/components/message-machine-renderer/message-machine-renderer.d.ts +1 -0
  36. package/lib/components/message-machine-renderer/use-message-machine-renderer.d.ts +3 -2
  37. package/lib/components/shared/button-component/external-link-icon.d.ts +1 -0
  38. package/lib/components/webchat-app/webchat-app.d.ts +10 -3
  39. package/lib/components/webchat-container/use-webchat-container.d.ts +1 -0
  40. package/lib/components/webchat-header/icons/close-icon.d.ts +1 -0
  41. package/lib/components/webchat-header/icons/download-icon.d.ts +1 -0
  42. package/lib/components/webchat-header/icons/leave-icon.d.ts +1 -0
  43. package/lib/components/webchat-header/icons/menu-icon.d.ts +1 -0
  44. package/lib/components/webchat-header/icons/sounds-icon.d.ts +1 -0
  45. package/lib/components/webchat-header/icons/start-over-icon.d.ts +1 -0
  46. package/lib/components/webchat-header/use-webchat-header.d.ts +11 -2
  47. package/lib/components/webchat-header/webchat-header.d.ts +4 -1
  48. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-download-transcript.d.ts +5 -0
  49. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-conversation.d.ts +5 -0
  50. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-session.d.ts +5 -0
  51. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-sounds.d.ts +5 -0
  52. package/lib/components/webchat-header/webchat-menu/use-dropdown-menu-item-reset-session.d.ts +9 -0
  53. package/lib/components/webchat-input/attachment-preview/attachment-preview.d.ts +2 -0
  54. package/lib/components/webchat-input/attachment-preview/index.d.ts +3 -0
  55. package/lib/components/webchat-input/attachment-preview/use-attachment-preview.d.ts +23 -0
  56. package/lib/components/webchat-input/audio-input/audio-input.d.ts +2 -0
  57. package/lib/components/webchat-input/audio-input/index.d.ts +3 -0
  58. package/lib/components/webchat-input/audio-input/use-audio-input.d.ts +34 -0
  59. package/lib/components/webchat-input/audio-waveform/audio-waveform.d.ts +5 -0
  60. package/lib/components/webchat-input/audio-waveform/index.d.ts +1 -0
  61. package/lib/components/webchat-input/audio-waveform/static-waveform.d.ts +9 -0
  62. package/lib/components/webchat-input/constants.d.ts +3 -0
  63. package/lib/components/webchat-input/icons/cancel-icon.d.ts +1 -0
  64. package/lib/components/webchat-input/icons/close-icon.d.ts +1 -0
  65. package/lib/components/webchat-input/icons/confirm-icon.d.ts +1 -0
  66. package/lib/components/webchat-input/icons/file-icon.d.ts +2 -0
  67. package/lib/components/webchat-input/icons/file-pdf-icon.d.ts +2 -0
  68. package/lib/components/webchat-input/icons/pause-icon.d.ts +1 -0
  69. package/lib/components/webchat-input/icons/play-icon.d.ts +1 -0
  70. package/lib/components/webchat-input/use-webchat-input.d.ts +21 -10
  71. package/lib/components/webchat-input/webchat-input.d.ts +6 -1
  72. package/lib/components/webchat-messages/use-webchat-messages-list-scroll.d.ts +15 -0
  73. package/lib/components/webchat-messages/use-webchat-messages.d.ts +19 -1
  74. package/lib/components/webchat-provider/webchat-context.d.ts +8 -0
  75. package/lib/components/webchat-provider/webchat-provider.d.ts +1 -10
  76. package/lib/components/webchat-trigger/icons/chat-icon.d.ts +1 -0
  77. package/lib/components/webchat-trigger/icons/chevron-down-icon.d.ts +1 -0
  78. package/lib/components/webchat-trigger/use-webchat-trigger.d.ts +10 -0
  79. package/lib/contexts/media-playback-context.d.ts +11 -0
  80. package/lib/hero-header-layout/index.d.ts +3 -0
  81. package/lib/hero-header-layout/use-webchat-hero-header-layout.d.ts +40 -0
  82. package/lib/hero-header-layout/webchat-hero-header-layout-config.d.ts +26 -0
  83. package/lib/hero-header-layout/webchat-hero-header-layout-utils.d.ts +2 -0
  84. package/lib/hooks/use-audio-recorder.d.ts +20 -0
  85. package/lib/hooks/use-webchat-state.d.ts +7 -0
  86. package/lib/hooks/webchat-client-settings-behaviors.d.ts +13 -0
  87. package/lib/types/webchat-props.d.ts +43 -2
  88. package/lib/utils/audio-utils.d.ts +1 -0
  89. package/lib/utils/uuid-utils.d.ts +1 -0
  90. package/package.json +4 -3
  91. package/styles.css +179 -35
  92. package/trigger.js +231 -135
  93. package/webchat-app-I5AArwfY.js +4122 -0
  94. package/lib/components/webchat-messages/use-custom-scrollbar.d.ts +0 -11
  95. package/webchat-app-CLGvs-LL.js +0 -2518
package/trigger.js CHANGED
@@ -1,114 +1,200 @@
1
- import { jsxs as V, Fragment as q, jsx as o } from "react/jsx-runtime";
2
- import { cx as D, cva as J } from "class-variance-authority";
3
- import { useState as s, useRef as h, useMemo as M, lazy as A, useCallback as l, useEffect as E, Component as Z, Suspense as X } from "react";
4
- import { ensureGlobalWebchatAPI as Y, setupGlobalWebchatAPI as $, signalWebchatReady as ee } from "@botonic/webchat-core";
5
- A(
6
- () => import("./webchat-app-CLGvs-LL.js").then((i) => i.w).then((i) => ({ default: i.WebchatApp }))
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 te(i, c) {
45
+ function Me(p, m) {
9
46
  const {
10
- appId: b,
11
- position: R = "bottom-right",
12
- isPulsing: _,
13
- icon: v,
14
- "aria-label": g,
15
- className: W,
16
- webchatConfig: O,
17
- onReady: u,
18
- loader: d
19
- } = i, [a, f] = s(!1), [m, x] = s(!1), [I, P] = s(0), [n, w] = s(!1), [t, F] = s(null), [N, H] = s(!1), [p, C] = s("appearing"), k = h(!1), S = h(null), G = h(!1), z = h(!1);
20
- z.current || (z.current = !0, Y());
21
- const K = M(
22
- () => d ? A(d) : A(
23
- () => import("./webchat-app-CLGvs-LL.js").then((e) => e.w).then((e) => ({
24
- default: e.WebchatApp
25
- }))
26
- ),
27
- [d, I]
28
- ), T = l(
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 && p !== null && C(null);
69
+ e.target === e.currentTarget && R !== null && W(null);
31
70
  },
32
- [p]
71
+ [R]
33
72
  );
34
- E(() => {
73
+ u(() => {
35
74
  if (!t) return;
36
- const e = t.machine.subscribe((L) => {
37
- H(L.context.connectionStatus === "connected"), w(L.context.isOpen ?? !1);
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]), E(() => {
41
- const e = k.current, L = t !== null && S.current === null;
42
- if (k.current = n, S.current = t, !!t) {
43
- if (L && n) {
44
- C("opening");
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 && n ? C("opening") : e === !0 && !n && C("closing");
87
+ e === !1 && r ? W("opening") : e === !0 && !r && W("closing");
48
88
  }
49
- }, [n, t]);
50
- const j = l((e) => {
51
- F(e), $(e);
89
+ }, [r, t]);
90
+ const me = h((e) => {
91
+ ae(e), xe(e);
52
92
  }, []);
53
- E(() => {
54
- !t || !N || G.current || (G.current = !0, ee(), u?.(t));
55
- }, [t, N, u]);
56
- const y = l(() => {
57
- m && (x(!1), P((e) => e + 1)), a ? t ? t.open() : w(!0) : (f(!0), w(!0));
58
- }, [m, a, t]), Q = l(() => {
59
- t ? n ? t.close() : t.open() : y();
60
- }, [t, n, y]), B = l(() => {
61
- x(!1), P((e) => e + 1), f(!0), w(!0);
62
- }, []), U = l((e) => {
63
- console.error("Failed to load webchat:", e), x(!0);
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
- return E(() => {
105
+ u(() => {
66
106
  if (typeof window > "u") return;
67
- const e = () => y();
107
+ const e = () => k();
68
108
  return window.addEventListener("botonic:open", e), () => window.removeEventListener("botonic:open", e);
69
- }, [y]), {
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: c,
151
+ ref: m,
72
152
  type: "button",
73
- onClick: m ? B : Q,
74
- onAnimationEnd: T,
75
- "aria-label": g || (n ? "Close chat" : "Open chat"),
76
- "aria-expanded": n
153
+ onClick: d ? $ : fe,
154
+ onAnimationEnd: he,
155
+ "aria-label": L || (r ? "Close chat" : "Open chat"),
156
+ "aria-expanded": r
77
157
  },
78
- icon: v,
79
- isOpen: n,
80
- className: W,
158
+ icon: D,
159
+ isOpen: r,
160
+ className: z,
81
161
  variants: {
82
- position: R,
83
- isPulsing: _,
84
- isAppearing: p === "appearing",
85
- isOpening: p === "opening",
86
- isClosing: p === "closing",
87
- isLoading: a && !t,
88
- isOpen: n
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: b,
92
- isOpen: n,
171
+ appId: x,
172
+ isOpen: r,
93
173
  onClose: () => t?.close(),
94
- onControllerReady: j,
95
- ...O
174
+ onControllerReady: me,
175
+ ...V
96
176
  },
97
- shouldRenderWebchat: a,
98
- LazyWebchat: K,
99
- loadError: m,
100
- retryLoad: B,
101
- handleLoadError: U,
102
- retryKey: I
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 re = "webchat-trigger-module__base___BpGIN", r = {
106
- base: re,
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 ne extends Z {
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(c) {
128
- this.props.onError(c);
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 oe = J(r.base, {
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": r["bottom-right"],
138
- "bottom-left": r["bottom-left"],
139
- "top-right": r["top-right"],
140
- "top-left": r["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: r["is-pulsing"]
232
+ true: o["is-pulsing"]
144
233
  },
145
234
  isAppearing: {
146
- true: r["is-appearing"]
235
+ true: o["is-appearing"]
147
236
  },
148
237
  isOpening: {
149
- true: r["is-opening"]
238
+ true: o["is-opening"]
150
239
  },
151
240
  isClosing: {
152
- true: r["is-closing"]
241
+ true: o["is-closing"]
153
242
  },
154
243
  isLoading: {
155
- true: r["is-loading"]
244
+ true: o["is-loading"]
156
245
  },
157
246
  isOpen: {
158
- true: r["is-open"]
247
+ true: o["is-open"]
159
248
  }
160
249
  },
161
250
  defaultVariants: {
162
251
  position: "bottom-right"
163
252
  }
164
253
  });
165
- function ge(i) {
166
- const c = h(null), {
167
- triggerProps: b,
168
- icon: R,
169
- isOpen: _,
170
- className: v,
171
- variants: g,
172
- webchatProps: W,
173
- shouldRenderWebchat: O,
174
- LazyWebchat: u,
175
- loadError: d,
176
- handleLoadError: a,
177
- retryKey: f
178
- } = te(i, c);
179
- return /* @__PURE__ */ V(q, { children: [
180
- /* @__PURE__ */ o(
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
- ...b,
184
- className: D(oe(g), v),
290
+ ...x,
291
+ className: oe(De(L), D),
185
292
  "data-testid": "webchat-trigger",
186
- "aria-label": d ? "Retry loading chat" : b["aria-label"],
187
- children: /* @__PURE__ */ o("div", { className: r["trigger-icon"], children: g.isLoading && _ ? /* @__PURE__ */ o("span", { className: r["loading-spinner"] }) : R || /* @__PURE__ */ o(
188
- "svg",
189
- {
190
- xmlns: "http://www.w3.org/2000/svg",
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
- O && u && /* @__PURE__ */ o(ne, { onError: a, children: /* @__PURE__ */ o(
205
- X,
300
+ V && E && /* @__PURE__ */ n(ke, { onError: C, children: /* @__PURE__ */ n(
301
+ Re,
206
302
  {
207
- fallback: g.isLoading && _ ? /* @__PURE__ */ o("span", { className: r["loading-spinner"], "aria-hidden": !0 }) : null,
208
- children: /* @__PURE__ */ o(u, { ...W })
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
- ) }, f)
306
+ ) }, H)
211
307
  ] });
212
308
  }
213
309
  export {
214
- ge as WebchatTrigger
310
+ Be as WebchatTrigger
215
311
  };