@leadbot/components 2.21.1 → 2.24.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 (56) hide show
  1. package/README.md +49 -3
  2. package/dist/agentChat-0mQZrzM9.js +366 -0
  3. package/dist/agentChat-C1wUvNcg.cjs +1 -0
  4. package/dist/agentChat.d.ts +2 -0
  5. package/dist/agentChat.d.ts.map +1 -1
  6. package/dist/buttons-ecViBEJ9.js +85 -0
  7. package/dist/buttons-rml8Kh8z.cjs +1 -0
  8. package/dist/buttons.cjs +1 -0
  9. package/dist/buttons.js +3 -0
  10. package/dist/chat.cjs +1 -0
  11. package/dist/chat.js +3 -0
  12. package/dist/entries/_shared.d.ts +5 -0
  13. package/dist/entries/_shared.d.ts.map +1 -0
  14. package/dist/entries/buttons.d.ts +3 -0
  15. package/dist/entries/buttons.d.ts.map +1 -0
  16. package/dist/entries/chat.d.ts +3 -0
  17. package/dist/entries/chat.d.ts.map +1 -0
  18. package/dist/entries/flow.d.ts +3 -0
  19. package/dist/entries/flow.d.ts.map +1 -0
  20. package/dist/entries/form.d.ts +3 -0
  21. package/dist/entries/form.d.ts.map +1 -0
  22. package/dist/entries/whatsapp.d.ts +3 -0
  23. package/dist/entries/whatsapp.d.ts.map +1 -0
  24. package/dist/flow-BY5oslmc.js +5006 -0
  25. package/dist/flow-CNUyZA89.cjs +82 -0
  26. package/dist/flow.cjs +1 -0
  27. package/dist/flow.d.ts.map +1 -1
  28. package/dist/flow.js +3 -0
  29. package/dist/form-Dc8AaZBV.cjs +1 -0
  30. package/dist/form-Df53ALbk.js +290 -0
  31. package/dist/form.cjs +1 -0
  32. package/dist/form.d.ts +1 -0
  33. package/dist/form.d.ts.map +1 -1
  34. package/dist/form.js +3 -0
  35. package/dist/i18n-DyDsn-Fk.js +93 -0
  36. package/dist/i18n-gV6rxSod.cjs +1 -0
  37. package/dist/i18n.d.ts +25 -0
  38. package/dist/i18n.d.ts.map +1 -0
  39. package/dist/index.cjs +1 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +9 -6779
  43. package/dist/jsxRuntime.module-CT7yzySL.cjs +1 -0
  44. package/dist/jsxRuntime.module-DsRxbn3o.js +657 -0
  45. package/dist/mount.d.ts +38 -2
  46. package/dist/mount.d.ts.map +1 -1
  47. package/dist/styles.css +79 -1
  48. package/dist/useStep.d.ts +47 -1
  49. package/dist/useStep.d.ts.map +1 -1
  50. package/dist/whatsapp-B3GO1RDT.cjs +1 -0
  51. package/dist/whatsapp-DGnyaume.js +128 -0
  52. package/dist/whatsapp.cjs +1 -0
  53. package/dist/whatsapp.d.ts +1 -0
  54. package/dist/whatsapp.d.ts.map +1 -1
  55. package/dist/whatsapp.js +3 -0
  56. package/package.json +39 -11
package/README.md CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  } from "@leadbot/components";
22
22
  import "@leadbot/components/styles.css";
23
23
 
24
- init({ domainKey: "your-domain-key", apiHost: "https://collector.example.com" });
24
+ init({ domainKey: "your-domain-key" });
25
25
 
26
26
  const chat = mountAgentChat(document.querySelector("#chat")!, {
27
27
  leadbotId: 18,
@@ -54,8 +54,10 @@ Every mount requires a `leadbotId` — the id of the component leadbot the
54
54
  component belongs to (each embed can target a different one) — and an `id`,
55
55
  the uuid of the published step it renders. Mounts also
56
56
  accept `domainKey` / `apiHost` to override the `init()` defaults, a
57
- `className` for the container, and a `labels` object to translate every UI
58
- string (defaults are English).
57
+ `className` for the container, and a `labels` object to override individual UI
58
+ strings. Defaults are not English: every component renders its own copy in the
59
+ language of the bot as published, which arrives with the boot fetch — the
60
+ page's `<html lang>` is only the fallback until it does.
59
61
 
60
62
  `preview` / `previewToken` exist for the dashboard preview of unpublished draft
61
63
  flows: `preview` keeps submissions out of the inbox, `previewToken` authorizes
@@ -63,6 +65,50 @@ the draft. The token is ignored unless `preview` is set, and it must never be
63
65
  committed into a production build — anyone reading the shipped JS could then
64
66
  read your unpublished flows.
65
67
 
68
+ ## Without a bundler (script tag / CDN)
69
+
70
+ One script tag and one container div — no npm, no build step. The bundle boots
71
+ from its own script tag, injects the stylesheet, and mounts every
72
+ `[data-leadbot-step]` container; the component to render comes from the
73
+ published step's own type.
74
+
75
+ ```html
76
+ <script
77
+ src="https://cdn.leadbot.com/components.js"
78
+ data-leadbot-domain-key="your-domain-key"
79
+ data-leadbot-api-host="https://collector.example.com"
80
+ data-leadbot-id="18"
81
+ ></script>
82
+
83
+ <div data-leadbot-step="chat-step-uuid"></div>
84
+ ```
85
+
86
+ The full API is on `window.LeadBot` (`init`, every `mount*`, `mountAll`,
87
+ `openWidget`). Container attributes and the rest of the reference live in
88
+ [docs/SDK.md](../../docs/SDK.md).
89
+
90
+ ## Module formats and subpath entries
91
+
92
+ The package ships ESM and CommonJS (`require` works, for older Next.js setups
93
+ and CJS toolchains), plus a subpath entry per component:
94
+
95
+ ```ts
96
+ import { init, mountForm } from "@leadbot/components/form";
97
+ ```
98
+
99
+ `form`, `chat`, `whatsapp`, `buttons` and `flow` each carry the shared
100
+ configuration surface (`init`, `loadFlow`, `useStep`) and nothing from the
101
+ other components — a form-only page is ~24 kB gzipped instead of ~81 kB. The
102
+ barrel import is tree-shakeable too; the subpath is the guarantee.
103
+
104
+ ## Configuration precedence
105
+
106
+ **The value on the mount always wins.** Everything in `init()` is a default;
107
+ an option set on a `mount*()` call overrides it for that mount only, and an
108
+ option left `undefined` overrides nothing. `leadbotId` included — set it once
109
+ in `init()`, and pass it per mount only where an embed belongs to a different
110
+ component leadbot.
111
+
66
112
  ## Published steps
67
113
 
68
114
  Every component is backed by a published step. Its `id` is the step uuid, and
@@ -0,0 +1,366 @@
1
+ import { b as e, d as t, g as n, h as r, i, l as a, n as o, o as s, r as c, t as l, x as u } from "./jsxRuntime.module-DsRxbn3o.js";
2
+ import { i as d, t as f } from "./i18n-DyDsn-Fk.js";
3
+ import { CHAT_ERROR_CODE_MAP as ee, FIXED_ANSWER_TYPING_MS as p, generateUUID as m, getOrCreateVisitorId as te, getVariableValue as h, sanitizeConversationStarters as g, setActiveChatSession as ne, streamChat as _ } from "@leadbot/core";
4
+ //#region src/agentChat.tsx
5
+ var v = f("en"), y = /\[\[C(\d+)\]\]/g;
6
+ function b(e) {
7
+ return e.replace(y, "");
8
+ }
9
+ function x(e, t) {
10
+ if (!t?.length) return [];
11
+ let n = new Map(t.map((e) => [e.chunk_id, e])), r = /* @__PURE__ */ new Set(), i = [];
12
+ for (let t of e.matchAll(y)) {
13
+ let e = parseInt(t[1], 10), a = n.get(e);
14
+ !a || r.has(e) || (r.add(e), /^https?:\/\//i.test(a.filename) && i.push({
15
+ index: i.length + 1,
16
+ url: a.filename
17
+ }));
18
+ }
19
+ return i;
20
+ }
21
+ function S(e, t) {
22
+ let n = e[e.length - 1];
23
+ return n?.role === "assistant" ? [...e.slice(0, -1), {
24
+ ...n,
25
+ content: n.content + t
26
+ }] : [...e, {
27
+ role: "assistant",
28
+ content: t
29
+ }];
30
+ }
31
+ function C(n) {
32
+ let v = d(n), y = {
33
+ ...f(v),
34
+ ...n.labels
35
+ }, { step: C, missing: w, forbidden: re } = i(n), T = C?.attributes ?? {}, E = T.agent_id ?? "", D = n.initialMessage ?? T.initial_message, O = n.eventLabel ?? C?.event_label ?? void 0, [k, ie] = a([]), [A, j] = a(!1), [M, N] = a(null), [P, F] = a(!1), [I, L] = a(!1), R = s(null), z = s(null), B = s(k), V = s(null), H = s(null), U = s(n.chatSessionId ?? m()), W = s(n);
36
+ W.current = n;
37
+ let G = s(O);
38
+ G.current = O;
39
+ let K = (e) => {
40
+ ie((t) => {
41
+ let n = typeof e == "function" ? e(t) : e;
42
+ return B.current = n, n;
43
+ });
44
+ };
45
+ t(() => {
46
+ setTimeout(() => {
47
+ z.current && (z.current.scrollTop = z.current.scrollHeight);
48
+ }, 0);
49
+ }, [
50
+ k,
51
+ A,
52
+ M
53
+ ]), t(() => {
54
+ D && B.current.length === 0 && K([{
55
+ role: "assistant",
56
+ content: D
57
+ }]);
58
+ }, [D]), t(() => () => {
59
+ V.current?.abort(), H.current && clearTimeout(H.current);
60
+ }, []);
61
+ let q = (e) => y[e] ?? y.chatbot_error_default, J = (e) => {
62
+ let t = q(e), n = B.current, r = n[n.length - 1];
63
+ r?.role === "assistant" && r.content === "" ? K([...n.slice(0, -1), {
64
+ role: "assistant",
65
+ content: t
66
+ }]) : K([...n, {
67
+ role: "assistant",
68
+ content: t
69
+ }]);
70
+ }, Y = (e) => {
71
+ let t = B.current, n = t[t.length - 1];
72
+ if (n?.role !== "assistant") return;
73
+ if (n.content === "") {
74
+ K(t.slice(0, -1));
75
+ return;
76
+ }
77
+ let r = e.length > 0 ? {
78
+ ...n,
79
+ citations: e
80
+ } : n;
81
+ K([...t.slice(0, -1), r]), W.current.onMessage?.(r);
82
+ }, ae = () => (ne(U.current), U.current), X = async (t) => {
83
+ if (A) return;
84
+ let n = {
85
+ role: "user",
86
+ content: t
87
+ }, i = [...B.current, n];
88
+ W.current.onMessage?.(n), K([...i, {
89
+ role: "assistant",
90
+ content: ""
91
+ }]), j(!0), N("thinking");
92
+ let a = new AbortController();
93
+ V.current = a;
94
+ let o = [], s = !1;
95
+ try {
96
+ let t = u(W.current), n = i.map((e) => ({
97
+ role: e.role,
98
+ content: e.content
99
+ })).slice(-50), c = _({
100
+ url: t.buildUrl("/client/chat/stream"),
101
+ domainKey: t.domainKey ?? "",
102
+ leadbotId: W.current.leadbotId,
103
+ stepUuid: W.current.id,
104
+ visitorId: te(),
105
+ chatSessionId: ae(),
106
+ messages: n,
107
+ eventLabel: G.current,
108
+ analytics: r(),
109
+ ...e(W.current),
110
+ signal: a.signal
111
+ });
112
+ for await (let e of c) {
113
+ if (e.type === "reasoning") {
114
+ s = !0, N("thinking");
115
+ continue;
116
+ }
117
+ if (s && (s = !1, N("searching"), await new Promise((e) => setTimeout(e, 0))), e.type === "token" && typeof e.content == "string") N(null), K((t) => S(t, e.content)), await new Promise((e) => setTimeout(e, 0));
118
+ else if (e.type === "correction" && typeof e.content == "string") K((t) => {
119
+ let n = t[t.length - 1];
120
+ return n?.role === "assistant" ? [...t.slice(0, -1), {
121
+ ...n,
122
+ content: e.content
123
+ }] : [...t, {
124
+ role: "assistant",
125
+ content: e.content
126
+ }];
127
+ }), await new Promise((e) => setTimeout(e, 0));
128
+ else if (e.type === "citations" && Array.isArray(e.citations)) o = e.citations;
129
+ else if (e.type === "tool_call") N("tool"), await new Promise((e) => setTimeout(e, 0));
130
+ else if (e.type === "done") {
131
+ Y(o);
132
+ break;
133
+ } else if (e.type === "error") {
134
+ Y([]), J(ee[e.error_code ?? ""] || "chatbot_error_default"), W.current.onError?.(Error(e.error_code || "chatbot_error_default"));
135
+ break;
136
+ }
137
+ }
138
+ } catch (e) {
139
+ e instanceof DOMException && e.name === "AbortError" || (Y([]), J(e instanceof Error && e.message.startsWith("chatbot_error_") ? e.message : "chatbot_error_default"), W.current.onError?.(e));
140
+ } finally {
141
+ j(!1), N(null), V.current = null;
142
+ }
143
+ }, oe = (e) => {
144
+ if (A) return;
145
+ if (!e.answer) return void X(e.question);
146
+ let t = {
147
+ role: "user",
148
+ content: e.question
149
+ }, n = {
150
+ role: "assistant",
151
+ content: e.answer
152
+ };
153
+ W.current.onMessage?.(t), K([...B.current, t]), j(!0), H.current = setTimeout(() => {
154
+ H.current = null, j(!1), K([...B.current, n]), W.current.onMessage?.(n);
155
+ }, p);
156
+ }, se = (e) => {
157
+ e.preventDefault();
158
+ let t = R.current?.value?.trim();
159
+ !t || A || (R.current.value = "", L(!1), X(t));
160
+ }, ce = () => {
161
+ V.current?.abort(), V.current = null, U.current = W.current.chatSessionId ?? m(), j(!1), N(null), F(!1), K(D ? [{
162
+ role: "assistant",
163
+ content: D
164
+ }] : []);
165
+ }, Z = M === "searching" ? y.searching : M === "tool" ? y.usingTool : y.thinking, Q = k[k.length - 1], le = A && M !== null && Q?.role === "assistant" && Q.content !== "", ue = k.some((e) => e.role !== "assistant"), $ = n.conversationStarters ? n.conversationStarters.map((e) => ({
166
+ question: e,
167
+ answer: null
168
+ })) : g(T.conversation_starters), de = $.length > 0 && !ue && !A;
169
+ return E ? /* @__PURE__ */ l("div", {
170
+ className: "leadbot-chatbot-interface",
171
+ children: [
172
+ /* @__PURE__ */ l("div", {
173
+ className: "leadbot-chatbot-header",
174
+ children: [
175
+ /* @__PURE__ */ l("div", {
176
+ className: "leadbot-chatbot-header-info",
177
+ children: [/* @__PURE__ */ l("div", {
178
+ className: "leadbot-chatbot-title",
179
+ children: y.title
180
+ }), /* @__PURE__ */ l("div", {
181
+ className: "leadbot-chatbot-status",
182
+ children: [/* @__PURE__ */ l("span", { className: "leadbot-chatbot-online-dot" }), /* @__PURE__ */ l("span", { children: y.status })]
183
+ })]
184
+ }),
185
+ /* @__PURE__ */ l("button", {
186
+ type: "button",
187
+ className: "leadbot-chatbot-menu-btn",
188
+ "aria-label": y.menu,
189
+ onClick: () => F(!P),
190
+ children: /* @__PURE__ */ l("svg", {
191
+ width: "18",
192
+ height: "18",
193
+ viewBox: "0 0 20 20",
194
+ fill: "none",
195
+ children: [
196
+ /* @__PURE__ */ l("circle", {
197
+ cx: "10",
198
+ cy: "4",
199
+ r: "1.5",
200
+ fill: "currentColor"
201
+ }),
202
+ /* @__PURE__ */ l("circle", {
203
+ cx: "10",
204
+ cy: "10",
205
+ r: "1.5",
206
+ fill: "currentColor"
207
+ }),
208
+ /* @__PURE__ */ l("circle", {
209
+ cx: "10",
210
+ cy: "16",
211
+ r: "1.5",
212
+ fill: "currentColor"
213
+ })
214
+ ]
215
+ })
216
+ }),
217
+ P && /* @__PURE__ */ l("div", {
218
+ className: "leadbot-chatbot-menu",
219
+ children: /* @__PURE__ */ l("button", {
220
+ type: "button",
221
+ className: "leadbot-chatbot-menu-item",
222
+ onClick: ce,
223
+ children: [/* @__PURE__ */ l("span", {
224
+ className: "leadbot-chatbot-menu-item-icon",
225
+ children: /* @__PURE__ */ l("svg", {
226
+ width: "14",
227
+ height: "14",
228
+ viewBox: "0 0 24 24",
229
+ fill: "none",
230
+ children: /* @__PURE__ */ l("path", {
231
+ d: "M3 12a9 9 0 1 0 3-6.7M3 4v5h5",
232
+ stroke: "currentColor",
233
+ strokeWidth: "2",
234
+ strokeLinecap: "round",
235
+ strokeLinejoin: "round"
236
+ })
237
+ })
238
+ }), /* @__PURE__ */ l("span", { children: y.reset })]
239
+ })
240
+ })
241
+ ]
242
+ }),
243
+ /* @__PURE__ */ l("div", {
244
+ className: "leadbot-chatbot-messages",
245
+ ref: z,
246
+ children: [k.map((e, t) => {
247
+ if (e.role === "user") return /* @__PURE__ */ l("div", {
248
+ className: "leadbot-chatbot-message leadbot-chatbot-message-user",
249
+ children: /* @__PURE__ */ l("div", {
250
+ className: "leadbot-chatbot-message-content",
251
+ children: e.content
252
+ })
253
+ }, t);
254
+ if (A && e.content === "" && t === k.length - 1) return /* @__PURE__ */ l("div", {
255
+ className: "leadbot-chatbot-message leadbot-chatbot-message-bot leadbot-chatbot-message-typing",
256
+ children: /* @__PURE__ */ l("div", {
257
+ className: "leadbot-chatbot-thinking",
258
+ children: [/* @__PURE__ */ l("span", {
259
+ className: "leadbot-chatbot-typing-dots",
260
+ children: [
261
+ /* @__PURE__ */ l("span", {}),
262
+ /* @__PURE__ */ l("span", {}),
263
+ /* @__PURE__ */ l("span", {})
264
+ ]
265
+ }), /* @__PURE__ */ l("span", {
266
+ className: "leadbot-chatbot-thinking-text",
267
+ children: [Z, "..."]
268
+ })]
269
+ })
270
+ }, t);
271
+ let n = x(e.content, e.citations);
272
+ return /* @__PURE__ */ l("div", {
273
+ className: "leadbot-chatbot-message leadbot-chatbot-message-bot",
274
+ children: [/* @__PURE__ */ l("div", {
275
+ className: "leadbot-chatbot-message-content",
276
+ children: b(e.content)
277
+ }), n.length > 0 && /* @__PURE__ */ l("div", {
278
+ className: "leadbot-chatbot-citations",
279
+ children: n.map((e) => /* @__PURE__ */ l("a", {
280
+ href: e.url,
281
+ target: "_blank",
282
+ rel: "noopener noreferrer",
283
+ className: "leadbot-chatbot-citation-item",
284
+ children: [/* @__PURE__ */ l("span", {
285
+ className: "leadbot-chatbot-citation-number",
286
+ children: e.index
287
+ }), /* @__PURE__ */ l("span", {
288
+ className: "leadbot-chatbot-citation-url",
289
+ children: e.url.replace(/^https?:\/\//, "")
290
+ })]
291
+ }, e.index))
292
+ })]
293
+ }, t);
294
+ }), le && /* @__PURE__ */ l("div", {
295
+ className: "leadbot-chatbot-message leadbot-chatbot-message-bot leadbot-chatbot-message-typing",
296
+ children: /* @__PURE__ */ l("div", {
297
+ className: "leadbot-chatbot-thinking",
298
+ children: [/* @__PURE__ */ l("span", {
299
+ className: "leadbot-chatbot-typing-dots",
300
+ children: [
301
+ /* @__PURE__ */ l("span", {}),
302
+ /* @__PURE__ */ l("span", {}),
303
+ /* @__PURE__ */ l("span", {})
304
+ ]
305
+ }), /* @__PURE__ */ l("span", {
306
+ className: "leadbot-chatbot-thinking-text",
307
+ children: [Z, "..."]
308
+ })]
309
+ })
310
+ })]
311
+ }),
312
+ de && /* @__PURE__ */ l("div", {
313
+ className: "leadbot-chatbot-starters",
314
+ children: $.map((e) => /* @__PURE__ */ l("button", {
315
+ type: "button",
316
+ className: "leadbot-chatbot-starter-btn",
317
+ disabled: A,
318
+ onClick: () => oe(e),
319
+ children: e.question
320
+ }, e.question))
321
+ }),
322
+ /* @__PURE__ */ l("div", {
323
+ className: "leadbot-chatbot-input",
324
+ children: /* @__PURE__ */ l("form", {
325
+ className: "leadbot-chatbot-input-field",
326
+ onSubmit: se,
327
+ children: [/* @__PURE__ */ l("input", {
328
+ ref: R,
329
+ type: "text",
330
+ placeholder: n.placeholder ?? h("chatbot_placeholder", v),
331
+ className: "leadbot-chatbot-message-input",
332
+ disabled: A,
333
+ onInput: () => L(!!R.current?.value?.trim())
334
+ }), /* @__PURE__ */ l("button", {
335
+ type: "submit",
336
+ "aria-label": y.send,
337
+ className: `leadbot-chatbot-send-btn${I && !A ? " leadbot-chatbot-send-btn--active" : ""}`,
338
+ disabled: A || !I,
339
+ children: /* @__PURE__ */ l("svg", {
340
+ width: "20",
341
+ height: "20",
342
+ viewBox: "0 0 20 20",
343
+ fill: "none",
344
+ children: /* @__PURE__ */ l("path", {
345
+ d: "M10 4L10 16M10 4L5 9M10 4L15 9",
346
+ stroke: "currentColor",
347
+ strokeWidth: "2",
348
+ strokeLinecap: "round",
349
+ strokeLinejoin: "round"
350
+ })
351
+ })
352
+ })]
353
+ })
354
+ })
355
+ ]
356
+ }) : w ? /* @__PURE__ */ l(o, {
357
+ ...c(n),
358
+ forbidden: re,
359
+ lang: v
360
+ }) : null;
361
+ }
362
+ function w(e, t) {
363
+ return n(C, e, t);
364
+ }
365
+ //#endregion
366
+ export { v as n, w as r, C as t };
@@ -0,0 +1 @@
1
+ const e=require("./jsxRuntime.module-CT7yzySL.cjs"),t=require("./i18n-gV6rxSod.cjs");let n=require("@leadbot/core");var r=t.t(`en`),i=/\[\[C(\d+)\]\]/g;function a(e){return e.replace(i,``)}function o(e,t){if(!t?.length)return[];let n=new Map(t.map(e=>[e.chunk_id,e])),r=new Set,a=[];for(let t of e.matchAll(i)){let e=parseInt(t[1],10),i=n.get(e);!i||r.has(e)||(r.add(e),/^https?:\/\//i.test(i.filename)&&a.push({index:a.length+1,url:i.filename}))}return a}function s(e,t){let n=e[e.length-1];return n?.role===`assistant`?[...e.slice(0,-1),{...n,content:n.content+t}]:[...e,{role:`assistant`,content:t}]}function c(r){let i=t.i(r),c={...t.t(i),...r.labels},{step:l,missing:u,forbidden:d}=e.i(r),f=l?.attributes??{},p=f.agent_id??``,m=r.initialMessage??f.initial_message,h=r.eventLabel??l?.event_label??void 0,[g,_]=e.l([]),[v,y]=e.l(!1),[b,x]=e.l(null),[S,C]=e.l(!1),[w,T]=e.l(!1),E=e.o(null),D=e.o(null),O=e.o(g),k=e.o(null),A=e.o(null),j=e.o(r.chatSessionId??(0,n.generateUUID)()),M=e.o(r);M.current=r;let N=e.o(h);N.current=h;let P=e=>{_(t=>{let n=typeof e==`function`?e(t):e;return O.current=n,n})};e.d(()=>{setTimeout(()=>{D.current&&(D.current.scrollTop=D.current.scrollHeight)},0)},[g,v,b]),e.d(()=>{m&&O.current.length===0&&P([{role:`assistant`,content:m}])},[m]),e.d(()=>()=>{k.current?.abort(),A.current&&clearTimeout(A.current)},[]);let F=e=>c[e]??c.chatbot_error_default,I=e=>{let t=F(e),n=O.current,r=n[n.length-1];r?.role===`assistant`&&r.content===``?P([...n.slice(0,-1),{role:`assistant`,content:t}]):P([...n,{role:`assistant`,content:t}])},L=e=>{let t=O.current,n=t[t.length-1];if(n?.role!==`assistant`)return;if(n.content===``){P(t.slice(0,-1));return}let r=e.length>0?{...n,citations:e}:n;P([...t.slice(0,-1),r]),M.current.onMessage?.(r)},R=()=>((0,n.setActiveChatSession)(j.current),j.current),z=async t=>{if(v)return;let r={role:`user`,content:t},i=[...O.current,r];M.current.onMessage?.(r),P([...i,{role:`assistant`,content:``}]),y(!0),x(`thinking`);let a=new AbortController;k.current=a;let o=[],c=!1;try{let t=e.b(M.current),r=i.map(e=>({role:e.role,content:e.content})).slice(-50),l=(0,n.streamChat)({url:t.buildUrl(`/client/chat/stream`),domainKey:t.domainKey??``,leadbotId:M.current.leadbotId,stepUuid:M.current.id,visitorId:(0,n.getOrCreateVisitorId)(),chatSessionId:R(),messages:r,eventLabel:N.current,analytics:(0,n.buildAnalytics)(),...e.y(M.current),signal:a.signal});for await(let e of l){if(e.type===`reasoning`){c=!0,x(`thinking`);continue}if(c&&(c=!1,x(`searching`),await new Promise(e=>setTimeout(e,0))),e.type===`token`&&typeof e.content==`string`)x(null),P(t=>s(t,e.content)),await new Promise(e=>setTimeout(e,0));else if(e.type===`correction`&&typeof e.content==`string`)P(t=>{let n=t[t.length-1];return n?.role===`assistant`?[...t.slice(0,-1),{...n,content:e.content}]:[...t,{role:`assistant`,content:e.content}]}),await new Promise(e=>setTimeout(e,0));else if(e.type===`citations`&&Array.isArray(e.citations))o=e.citations;else if(e.type===`tool_call`)x(`tool`),await new Promise(e=>setTimeout(e,0));else if(e.type===`done`){L(o);break}else if(e.type===`error`){L([]),I(n.CHAT_ERROR_CODE_MAP[e.error_code??``]||`chatbot_error_default`),M.current.onError?.(Error(e.error_code||`chatbot_error_default`));break}}}catch(e){e instanceof DOMException&&e.name===`AbortError`||(L([]),I(e instanceof Error&&e.message.startsWith(`chatbot_error_`)?e.message:`chatbot_error_default`),M.current.onError?.(e))}finally{y(!1),x(null),k.current=null}},B=e=>{if(v)return;if(!e.answer)return void z(e.question);let t={role:`user`,content:e.question},r={role:`assistant`,content:e.answer};M.current.onMessage?.(t),P([...O.current,t]),y(!0),A.current=setTimeout(()=>{A.current=null,y(!1),P([...O.current,r]),M.current.onMessage?.(r)},n.FIXED_ANSWER_TYPING_MS)},V=e=>{e.preventDefault();let t=E.current?.value?.trim();!t||v||(E.current.value=``,T(!1),z(t))},H=()=>{k.current?.abort(),k.current=null,j.current=M.current.chatSessionId??(0,n.generateUUID)(),y(!1),x(null),C(!1),P(m?[{role:`assistant`,content:m}]:[])},U=b===`searching`?c.searching:b===`tool`?c.usingTool:c.thinking,W=g[g.length-1],G=v&&b!==null&&W?.role===`assistant`&&W.content!==``,K=g.some(e=>e.role!==`assistant`),q=r.conversationStarters?r.conversationStarters.map(e=>({question:e,answer:null})):(0,n.sanitizeConversationStarters)(f.conversation_starters),J=q.length>0&&!K&&!v;return p?e.t(`div`,{className:`leadbot-chatbot-interface`,children:[e.t(`div`,{className:`leadbot-chatbot-header`,children:[e.t(`div`,{className:`leadbot-chatbot-header-info`,children:[e.t(`div`,{className:`leadbot-chatbot-title`,children:c.title}),e.t(`div`,{className:`leadbot-chatbot-status`,children:[e.t(`span`,{className:`leadbot-chatbot-online-dot`}),e.t(`span`,{children:c.status})]})]}),e.t(`button`,{type:`button`,className:`leadbot-chatbot-menu-btn`,"aria-label":c.menu,onClick:()=>C(!S),children:e.t(`svg`,{width:`18`,height:`18`,viewBox:`0 0 20 20`,fill:`none`,children:[e.t(`circle`,{cx:`10`,cy:`4`,r:`1.5`,fill:`currentColor`}),e.t(`circle`,{cx:`10`,cy:`10`,r:`1.5`,fill:`currentColor`}),e.t(`circle`,{cx:`10`,cy:`16`,r:`1.5`,fill:`currentColor`})]})}),S&&e.t(`div`,{className:`leadbot-chatbot-menu`,children:e.t(`button`,{type:`button`,className:`leadbot-chatbot-menu-item`,onClick:H,children:[e.t(`span`,{className:`leadbot-chatbot-menu-item-icon`,children:e.t(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,children:e.t(`path`,{d:`M3 12a9 9 0 1 0 3-6.7M3 4v5h5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),e.t(`span`,{children:c.reset})]})})]}),e.t(`div`,{className:`leadbot-chatbot-messages`,ref:D,children:[g.map((t,n)=>{if(t.role===`user`)return e.t(`div`,{className:`leadbot-chatbot-message leadbot-chatbot-message-user`,children:e.t(`div`,{className:`leadbot-chatbot-message-content`,children:t.content})},n);if(v&&t.content===``&&n===g.length-1)return e.t(`div`,{className:`leadbot-chatbot-message leadbot-chatbot-message-bot leadbot-chatbot-message-typing`,children:e.t(`div`,{className:`leadbot-chatbot-thinking`,children:[e.t(`span`,{className:`leadbot-chatbot-typing-dots`,children:[e.t(`span`,{}),e.t(`span`,{}),e.t(`span`,{})]}),e.t(`span`,{className:`leadbot-chatbot-thinking-text`,children:[U,`...`]})]})},n);let r=o(t.content,t.citations);return e.t(`div`,{className:`leadbot-chatbot-message leadbot-chatbot-message-bot`,children:[e.t(`div`,{className:`leadbot-chatbot-message-content`,children:a(t.content)}),r.length>0&&e.t(`div`,{className:`leadbot-chatbot-citations`,children:r.map(t=>e.t(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,className:`leadbot-chatbot-citation-item`,children:[e.t(`span`,{className:`leadbot-chatbot-citation-number`,children:t.index}),e.t(`span`,{className:`leadbot-chatbot-citation-url`,children:t.url.replace(/^https?:\/\//,``)})]},t.index))})]},n)}),G&&e.t(`div`,{className:`leadbot-chatbot-message leadbot-chatbot-message-bot leadbot-chatbot-message-typing`,children:e.t(`div`,{className:`leadbot-chatbot-thinking`,children:[e.t(`span`,{className:`leadbot-chatbot-typing-dots`,children:[e.t(`span`,{}),e.t(`span`,{}),e.t(`span`,{})]}),e.t(`span`,{className:`leadbot-chatbot-thinking-text`,children:[U,`...`]})]})})]}),J&&e.t(`div`,{className:`leadbot-chatbot-starters`,children:q.map(t=>e.t(`button`,{type:`button`,className:`leadbot-chatbot-starter-btn`,disabled:v,onClick:()=>B(t),children:t.question},t.question))}),e.t(`div`,{className:`leadbot-chatbot-input`,children:e.t(`form`,{className:`leadbot-chatbot-input-field`,onSubmit:V,children:[e.t(`input`,{ref:E,type:`text`,placeholder:r.placeholder??(0,n.getVariableValue)(`chatbot_placeholder`,i),className:`leadbot-chatbot-message-input`,disabled:v,onInput:()=>T(!!E.current?.value?.trim())}),e.t(`button`,{type:`submit`,"aria-label":c.send,className:`leadbot-chatbot-send-btn${w&&!v?` leadbot-chatbot-send-btn--active`:``}`,disabled:v||!w,children:e.t(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,children:e.t(`path`,{d:`M10 4L10 16M10 4L5 9M10 4L15 9`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})})]})})]}):u?e.t(e.n,{...e.r(r),forbidden:d,lang:i}):null}function l(t,n){return e.h(c,t,n)}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
@@ -14,6 +14,7 @@ export interface AgentChatLabels {
14
14
  menu: string;
15
15
  thinking: string;
16
16
  searching: string;
17
+ usingTool: string;
17
18
  chatbot_error_default: string;
18
19
  chatbot_error_network: string;
19
20
  chatbot_error_invalid_request: string;
@@ -24,6 +25,7 @@ export interface AgentChatLabels {
24
25
  chatbot_error_agent_no_response: string;
25
26
  chatbot_error_agent_response_failed: string;
26
27
  }
28
+ /** English label set; every other language comes from the same table. */
27
29
  export declare const DEFAULT_CHAT_LABELS: AgentChatLabels;
28
30
  export interface AgentChatOptions extends BaseMountOptions, StepOptions {
29
31
  /** Id of the component leadbot this chat belongs to (dashboard → Settings → Components). */
@@ -1 +1 @@
1
- {"version":3,"file":"agentChat.d.ts","sourceRoot":"","sources":["../src/agentChat.tsx"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,YAAY,EASjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,gBAAgB,EAGrB,KAAK,WAAW,EAGhB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,6BAA6B,EAAE,MAAM,CAAC;IACtC,4BAA4B,EAAE,MAAM,CAAC;IACrC,6BAA6B,EAAE,MAAM,CAAC;IACtC,kCAAkC,EAAE,MAAM,CAAC;IAC3C,+BAA+B,EAAE,MAAM,CAAC;IACxC,+BAA+B,EAAE,MAAM,CAAC;IACxC,mCAAmC,EAAE,MAAM,CAAC;CAC5C;AAED,eAAO,MAAM,mBAAmB,EAAE,eAyBjC,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB,EAAE,WAAW;IACtE,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAwCD,wBAAgB,SAAS,CAAC,KAAK,EAAE,gBAAgB,uCA4ahD;AAED,wBAAgB,cAAc,CAC7B,EAAE,EAAE,WAAW,EACf,OAAO,EAAE,gBAAgB,GACvB,WAAW,CAAC,gBAAgB,CAAC,CAE/B"}
1
+ {"version":3,"file":"agentChat.d.ts","sourceRoot":"","sources":["../src/agentChat.tsx"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,YAAY,EAUjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,gBAAgB,EAGrB,KAAK,WAAW,EAGhB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACN,KAAK,WAAW,EAIhB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,6BAA6B,EAAE,MAAM,CAAC;IACtC,4BAA4B,EAAE,MAAM,CAAC;IACrC,6BAA6B,EAAE,MAAM,CAAC;IACtC,kCAAkC,EAAE,MAAM,CAAC;IAC3C,+BAA+B,EAAE,MAAM,CAAC;IACxC,+BAA+B,EAAE,MAAM,CAAC;IACxC,mCAAmC,EAAE,MAAM,CAAC;CAC5C;AAED,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,EAAE,eAAkC,CAAC;AAErE,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB,EAAE,WAAW;IACtE,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAwCD,wBAAgB,SAAS,CAAC,KAAK,EAAE,gBAAgB,uCAsdhD;AAED,wBAAgB,cAAc,CAC7B,EAAE,EAAE,WAAW,EACf,OAAO,EAAE,gBAAgB,GACvB,WAAW,CAAC,gBAAgB,CAAC,CAE/B"}
@@ -0,0 +1,85 @@
1
+ import { a as e, b as t, d as n, g as r, t as i, x as a } from "./jsxRuntime.module-DsRxbn3o.js";
2
+ import { getOrCreateVisitorId as o, getTracker as s, openWidget as c, trackClick as l } from "@leadbot/core";
3
+ //#region src/buttons.tsx
4
+ function u(e) {
5
+ return {
6
+ label: e.label,
7
+ action: e.next_step_uuid ? {
8
+ type: "open_widget",
9
+ stepUuid: e.next_step_uuid,
10
+ message: e.label
11
+ } : void 0
12
+ };
13
+ }
14
+ function d(e) {
15
+ if (e.step_type !== "button") return (e.options ?? []).map(u);
16
+ let { text: t, url: n, target: r, open_widget_step_uuid: i, open_widget_message: a } = e.attributes, { open_widget: o } = e.attributes, s;
17
+ return i || o ? s = {
18
+ type: "open_widget",
19
+ stepUuid: i ?? void 0,
20
+ message: a ?? void 0
21
+ } : n && (s = {
22
+ type: "url",
23
+ href: n,
24
+ target: r === "_blank" ? "_blank" : void 0
25
+ }), [{
26
+ label: t ?? e.label ?? "",
27
+ action: s
28
+ }];
29
+ }
30
+ function f(e) {
31
+ try {
32
+ let { protocol: t } = new URL(e, window.location.href);
33
+ return [
34
+ "http:",
35
+ "https:",
36
+ "tel:",
37
+ "mailto:"
38
+ ].includes(t);
39
+ } catch {
40
+ return !1;
41
+ }
42
+ }
43
+ function p(r) {
44
+ let u = e(r), p = r.eventLabel ?? u?.event_label ?? void 0, m = u ? d(u) : [], h = r.buttons ? r.buttons.map((e, t) => e.action ? e : {
45
+ ...e,
46
+ action: m[t]?.action
47
+ }) : m, g = JSON.stringify(h.map((e) => e.label));
48
+ n(() => {
49
+ let e = JSON.parse(g), t = e.filter((t, n) => e.indexOf(t) !== n);
50
+ t.length > 0 && console.warn(`[leadbot] duplicate button label(s) ${[...new Set(t)].map((e) => `"${e}"`).join(", ")} — labels identify buttons, so duplicates collide`);
51
+ }, [g]);
52
+ let _ = (e) => {
53
+ r.onSelect?.(e), r.id && l(a(r), {
54
+ stepUuid: r.id,
55
+ visitorId: o(),
56
+ ...t(r)
57
+ }), s().trackButtonClick({ event_label: p });
58
+ let n = e.action;
59
+ if (n) {
60
+ if (n.type === "open_widget") c({
61
+ stepUuid: n.stepUuid,
62
+ message: n.message
63
+ });
64
+ else if (n.type === "url") {
65
+ if (!f(n.href)) return;
66
+ n.target === "_blank" ? window.open(n.href, "_blank", "noopener,noreferrer") : window.location.href = n.href;
67
+ }
68
+ }
69
+ };
70
+ return h.length === 0 ? null : /* @__PURE__ */ i("div", {
71
+ className: "leadbot-buttons",
72
+ children: h.map((e) => /* @__PURE__ */ i("button", {
73
+ type: "button",
74
+ className: "leadbot-buttons-btn",
75
+ ref: (t) => r.onButtonEl?.(e.label, t),
76
+ onClick: () => _(e),
77
+ children: "children" in e ? e.children : e.label
78
+ }, e.label))
79
+ });
80
+ }
81
+ function m(e, t) {
82
+ return r(p, e, t);
83
+ }
84
+ //#endregion
85
+ export { m as n, p as t };
@@ -0,0 +1 @@
1
+ const e=require("./jsxRuntime.module-CT7yzySL.cjs");let t=require("@leadbot/core");function n(e){return{label:e.label,action:e.next_step_uuid?{type:`open_widget`,stepUuid:e.next_step_uuid,message:e.label}:void 0}}function r(e){if(e.step_type!==`button`)return(e.options??[]).map(n);let{text:t,url:r,target:i,open_widget_step_uuid:a,open_widget_message:o}=e.attributes,{open_widget:s}=e.attributes,c;return a||s?c={type:`open_widget`,stepUuid:a??void 0,message:o??void 0}:r&&(c={type:`url`,href:r,target:i===`_blank`?`_blank`:void 0}),[{label:t??e.label??``,action:c}]}function i(e){try{let{protocol:t}=new URL(e,window.location.href);return[`http:`,`https:`,`tel:`,`mailto:`].includes(t)}catch{return!1}}function a(n){let a=e.a(n),o=n.eventLabel??a?.event_label??void 0,s=a?r(a):[],c=n.buttons?n.buttons.map((e,t)=>e.action?e:{...e,action:s[t]?.action}):s,l=JSON.stringify(c.map(e=>e.label));e.d(()=>{let e=JSON.parse(l),t=e.filter((t,n)=>e.indexOf(t)!==n);t.length>0&&console.warn(`[leadbot] duplicate button label(s) ${[...new Set(t)].map(e=>`"${e}"`).join(`, `)} — labels identify buttons, so duplicates collide`)},[l]);let u=r=>{n.onSelect?.(r),n.id&&(0,t.trackClick)(e.b(n),{stepUuid:n.id,visitorId:(0,t.getOrCreateVisitorId)(),...e.y(n)}),(0,t.getTracker)().trackButtonClick({event_label:o});let a=r.action;if(a){if(a.type===`open_widget`)(0,t.openWidget)({stepUuid:a.stepUuid,message:a.message});else if(a.type===`url`){if(!i(a.href))return;a.target===`_blank`?window.open(a.href,`_blank`,`noopener,noreferrer`):window.location.href=a.href}}};return c.length===0?null:e.t(`div`,{className:`leadbot-buttons`,children:c.map(t=>e.t(`button`,{type:`button`,className:`leadbot-buttons-btn`,ref:e=>n.onButtonEl?.(t.label,e),onClick:()=>u(t),children:`children`in t?t.children:t.label},t.label))})}function o(t,n){return e.h(a,t,n)}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./jsxRuntime.module-CT7yzySL.cjs"),t=require("./buttons-rml8Kh8z.cjs");let n=require("@leadbot/core");exports.ComponentsButtons=t.t,exports.ROOT_CLASS=e.m,Object.defineProperty(exports,"buildAnalytics",{enumerable:!0,get:function(){return n.buildAnalytics}}),exports.init=e._,exports.loadFlow=e.v,exports.mountButtons=t.n,exports.useStep=e.a;
@@ -0,0 +1,3 @@
1
+ import { a as e, h as t, m as n, v as r, y as i } from "./jsxRuntime.module-DsRxbn3o.js";
2
+ import { n as a, t as o } from "./buttons-ecViBEJ9.js";
3
+ export { o as ComponentsButtons, n as ROOT_CLASS, t as buildAnalytics, r as init, i as loadFlow, a as mountButtons, e as useStep };
package/dist/chat.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./jsxRuntime.module-CT7yzySL.cjs"),t=require("./agentChat-C1wUvNcg.cjs");let n=require("@leadbot/core");exports.AgentChat=t.t,exports.DEFAULT_CHAT_LABELS=t.n,exports.ROOT_CLASS=e.m,Object.defineProperty(exports,"buildAnalytics",{enumerable:!0,get:function(){return n.buildAnalytics}}),exports.init=e._,exports.loadFlow=e.v,exports.mountAgentChat=t.r,exports.useStep=e.a;
package/dist/chat.js ADDED
@@ -0,0 +1,3 @@
1
+ import { a as e, h as t, m as n, v as r, y as i } from "./jsxRuntime.module-DsRxbn3o.js";
2
+ import { n as a, r as o, t as s } from "./agentChat-0mQZrzM9.js";
3
+ export { s as AgentChat, a as DEFAULT_CHAT_LABELS, n as ROOT_CLASS, t as buildAnalytics, r as init, i as loadFlow, o as mountAgentChat, e as useStep };
@@ -0,0 +1,5 @@
1
+ export { buildAnalytics, init, loadFlow, ROOT_CLASS } from "../mount";
2
+ export type { BaseMountOptions, LeadbotComponentsConfig, MountHandle, } from "../mount";
3
+ export { useStep } from "../useStep";
4
+ export type { PublishedStep, StepOptions } from "../useStep";
5
+ //# sourceMappingURL=_shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/entries/_shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtE,YAAY,EACX,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./_shared";
2
+ export * from "../buttons";
3
+ //# sourceMappingURL=buttons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../../src/entries/buttons.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./_shared";
2
+ export * from "../agentChat";
3
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/entries/chat.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./_shared";
2
+ export * from "../flow";
3
+ //# sourceMappingURL=flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/entries/flow.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./_shared";
2
+ export * from "../form";
3
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/entries/form.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./_shared";
2
+ export * from "../whatsapp";
3
+ //# sourceMappingURL=whatsapp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp.d.ts","sourceRoot":"","sources":["../../src/entries/whatsapp.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}