@tekibo/feedpulse-sdk 0.6.1 → 0.7.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/dist/nuxt.mjs CHANGED
@@ -1,98 +1,507 @@
1
- import { inject as B, defineComponent as _, ref as g, onMounted as z, onBeforeUnmount as D, createBlock as P, openBlock as l, Teleport as M, createElementBlock as u, createCommentVNode as y, createElementVNode as n, createTextVNode as b, withDirectives as C, vModelCheckbox as A, toDisplayString as $, provide as T, Fragment as h, renderSlot as L, normalizeStyle as E, renderList as V, vModelText as R } from "vue";
2
- import { CookieManager as F, FeedPulseTracker as U } from "./index.mjs";
3
- const S = /* @__PURE__ */ Symbol("feedpulse");
4
- function j() {
5
- return B(S, null);
1
+ import { inject as O, defineComponent as E, ref as f, computed as B, watch as U, createElementBlock as b, openBlock as l, createElementVNode as t, createCommentVNode as w, Fragment as _, renderList as L, normalizeStyle as P, toDisplayString as D, withDirectives as R, vModelText as q, onMounted as F, onBeforeUnmount as M, createBlock as N, createTextVNode as I, createStaticVNode as W, Teleport as J, vModelCheckbox as j, provide as K, renderSlot as G } from "vue";
2
+ import { CookieManager as Y, FeedPulseTracker as Q } from "./index.mjs";
3
+ import { S as X } from "./struggle-detector-BqTHgw95.mjs";
4
+ const H = /* @__PURE__ */ Symbol("feedpulse");
5
+ function Z() {
6
+ return O(H, null);
6
7
  }
7
- const N = {
8
+ const ee = { style: {
9
+ width: "360px",
10
+ height: "520px",
11
+ background: "#111827",
12
+ color: "#e5e7eb",
13
+ borderRadius: "16px",
14
+ border: "1px solid #374151",
15
+ boxShadow: "0 20px 40px rgba(0,0,0,0.35)",
16
+ display: "flex",
17
+ flexDirection: "column",
18
+ overflow: "hidden",
19
+ animation: "fp-panel-open 300ms ease-out"
20
+ } }, te = { style: {
21
+ display: "flex",
22
+ justifyContent: "space-between",
23
+ alignItems: "center",
24
+ padding: "12px 14px",
25
+ borderBottom: "1px solid #374151",
26
+ background: "#0f172a"
27
+ } }, oe = { style: { flex: 1, overflowY: "auto", padding: "12px", display: "grid", gap: "10px" } }, ne = {
28
+ key: 0,
29
+ style: { display: "flex", gap: "8px" }
30
+ }, ae = ["onClick"], ie = ["onClick"], se = {
31
+ key: 0,
32
+ style: { display: "flex", alignItems: "center", gap: "5px", padding: "4px 0" }
33
+ }, le = {
34
+ key: 1,
35
+ style: {
36
+ border: "1px solid #f59e0b",
37
+ background: "#451a03",
38
+ color: "#fde68a",
39
+ borderRadius: "10px",
40
+ padding: "10px",
41
+ fontSize: "12px"
42
+ }
43
+ }, re = { style: { display: "flex", gap: "8px" } }, de = ["disabled"], ue = ["disabled"], pe = ["href"], ce = /* @__PURE__ */ E({
44
+ __name: "BotPanel",
45
+ props: {
46
+ botSessionId: {},
47
+ config: {},
48
+ unavailable: { type: Boolean }
49
+ },
50
+ emits: ["close", "helpful", "escalated"],
51
+ setup(r, { emit: x }) {
52
+ const s = r, o = x, a = f({}), e = f([]), n = f(""), d = f(!1), g = f(!1), m = B(() => n.value.trim().length > 0 && !d.value && !s.unavailable && !g.value);
53
+ function v() {
54
+ return e.value.map((i) => ({
55
+ role: i.role,
56
+ content: i.content
57
+ }));
58
+ }
59
+ async function y(i) {
60
+ if (i.preventDefault(), !m.value)
61
+ return;
62
+ const u = n.value.trim();
63
+ n.value = "", e.value.push({
64
+ id: `user-${Date.now()}`,
65
+ role: "user",
66
+ content: u
67
+ });
68
+ const p = `assistant-${Date.now()}`;
69
+ e.value.push({
70
+ id: p,
71
+ role: "assistant",
72
+ content: ""
73
+ }), d.value = !0, g.value = !1;
74
+ try {
75
+ const S = await fetch("/api/bot/chat-proxy", {
76
+ method: "POST",
77
+ headers: { "content-type": "application/json" },
78
+ body: JSON.stringify({
79
+ botSessionId: s.botSessionId,
80
+ config: s.config,
81
+ messages: v()
82
+ })
83
+ });
84
+ if (S.status === 402) {
85
+ g.value = !0;
86
+ const k = e.value.find((z) => z.id === p);
87
+ k && (k.content = "Service temporarily unavailable.");
88
+ return;
89
+ }
90
+ if (!S.ok)
91
+ throw new Error("Chat request failed");
92
+ const $ = S.body?.getReader();
93
+ if (!$)
94
+ throw new Error("Missing stream");
95
+ const h = new TextDecoder();
96
+ let c = !1;
97
+ for (; !c; ) {
98
+ const k = await $.read();
99
+ if (c = k.done, k.value) {
100
+ const z = h.decode(k.value, { stream: !c }), A = e.value.find((V) => V.id === p);
101
+ A && (A.content += z);
102
+ }
103
+ }
104
+ } catch {
105
+ const S = e.value.find(($) => $.id === p);
106
+ S && !S.content && (S.content = "Sorry, I couldn't process that. Please try again.");
107
+ } finally {
108
+ d.value = !1;
109
+ }
110
+ }
111
+ function T(i, u) {
112
+ a.value[i] = u, o("helpful", u);
113
+ }
114
+ function C() {
115
+ o("escalated");
116
+ }
117
+ return U(() => s.botSessionId, () => {
118
+ a.value = {}, e.value = [], n.value = "", g.value = !1;
119
+ }), (i, u) => (l(), b("div", ee, [
120
+ t("div", te, [
121
+ u[2] || (u[2] = t("div", { style: { display: "grid", gap: "2px" } }, [
122
+ t("strong", { style: { fontSize: "14px", color: "#fff" } }, "Pulse Bot"),
123
+ t("span", { style: { fontSize: "11px", color: "#94a3b8" } }, "Powered by FeedPulse AI")
124
+ ], -1)),
125
+ t("button", {
126
+ style: {
127
+ border: "none",
128
+ background: "transparent",
129
+ color: "#cbd5e1",
130
+ cursor: "pointer",
131
+ fontSize: "18px",
132
+ lineHeight: "1"
133
+ },
134
+ onClick: u[0] || (u[0] = (p) => o("close"))
135
+ }, " × ")
136
+ ]),
137
+ t("div", oe, [
138
+ (l(!0), b(_, null, L(e.value, (p) => (l(), b("div", {
139
+ key: p.id,
140
+ style: P({
141
+ display: "grid",
142
+ justifyItems: p.role === "user" ? "end" : "start",
143
+ gap: "6px"
144
+ })
145
+ }, [
146
+ t("div", {
147
+ style: P({
148
+ maxWidth: "85%",
149
+ padding: "9px 11px",
150
+ borderRadius: p.role === "user" ? "14px 14px 2px 14px" : "14px 14px 14px 2px",
151
+ background: p.role === "user" ? "#4f46e5" : "#1f2937",
152
+ color: "#fff",
153
+ fontSize: "13px",
154
+ lineHeight: "1.4",
155
+ whiteSpace: "pre-wrap"
156
+ })
157
+ }, D(p.content), 5),
158
+ p.role === "assistant" ? (l(), b("div", ne, [
159
+ t("button", {
160
+ style: P({
161
+ border: "1px solid #334155",
162
+ background: a.value[p.id] === !0 ? "#16a34a" : "#0f172a",
163
+ color: "#e2e8f0",
164
+ borderRadius: "8px",
165
+ fontSize: "12px",
166
+ padding: "4px 8px",
167
+ cursor: "pointer"
168
+ }),
169
+ onClick: (S) => T(p.id, !0)
170
+ }, " 👍 ", 12, ae),
171
+ t("button", {
172
+ style: P({
173
+ border: "1px solid #334155",
174
+ background: a.value[p.id] === !1 ? "#dc2626" : "#0f172a",
175
+ color: "#e2e8f0",
176
+ borderRadius: "8px",
177
+ fontSize: "12px",
178
+ padding: "4px 8px",
179
+ cursor: "pointer"
180
+ }),
181
+ onClick: (S) => T(p.id, !1)
182
+ }, " 👎 ", 12, ie)
183
+ ])) : w("", !0)
184
+ ], 4))), 128)),
185
+ d.value ? (l(), b("div", se, [...u[3] || (u[3] = [
186
+ t("span", { style: { width: "8px", height: "8px", borderRadius: "999px", background: "#94a3b8", animation: "fp-dot 1s infinite 0ms" } }, null, -1),
187
+ t("span", { style: { width: "8px", height: "8px", borderRadius: "999px", background: "#94a3b8", animation: "fp-dot 1s infinite 160ms" } }, null, -1),
188
+ t("span", { style: { width: "8px", height: "8px", borderRadius: "999px", background: "#94a3b8", animation: "fp-dot 1s infinite 320ms" } }, null, -1)
189
+ ])])) : w("", !0),
190
+ r.unavailable || g.value ? (l(), b("div", le, " Service temporarily unavailable. ")) : w("", !0)
191
+ ]),
192
+ t("form", {
193
+ style: { padding: "10px", borderTop: "1px solid #374151", display: "grid", gap: "8px" },
194
+ onSubmit: y
195
+ }, [
196
+ t("div", re, [
197
+ R(t("input", {
198
+ "onUpdate:modelValue": u[1] || (u[1] = (p) => n.value = p),
199
+ disabled: d.value || r.unavailable,
200
+ style: {
201
+ flex: 1,
202
+ borderRadius: "10px",
203
+ border: "1px solid #475569",
204
+ background: "#0f172a",
205
+ color: "#fff",
206
+ fontSize: "13px",
207
+ padding: "8px 10px",
208
+ outline: "none"
209
+ },
210
+ placeholder: "Ask a question..."
211
+ }, null, 8, de), [
212
+ [q, n.value]
213
+ ]),
214
+ t("button", {
215
+ type: "submit",
216
+ disabled: !m.value,
217
+ style: P({
218
+ border: "none",
219
+ borderRadius: "10px",
220
+ background: m.value ? "#6366f1" : "#334155",
221
+ color: "#fff",
222
+ fontWeight: "600",
223
+ fontSize: "12px",
224
+ padding: "0 14px",
225
+ cursor: m.value ? "pointer" : "not-allowed"
226
+ })
227
+ }, " Send ", 12, ue)
228
+ ]),
229
+ r.config.escalateTo ? (l(), b("a", {
230
+ key: 0,
231
+ href: r.config.escalateTo.url,
232
+ style: { color: "#c4b5fd", fontSize: "12px", textDecoration: "none" },
233
+ onClick: C
234
+ }, D(r.config.escalateTo.label), 9, pe)) : w("", !0)
235
+ ], 32)
236
+ ]));
237
+ }
238
+ }), $e = /* @__PURE__ */ E({
239
+ __name: "FeedPulseBot",
240
+ props: {
241
+ faq: {},
242
+ pageContext: {},
243
+ systemPrompt: {},
244
+ canNavigate: { type: Boolean },
245
+ canHelpForms: { type: Boolean },
246
+ escalateTo: {},
247
+ initialMessage: { default: "👋 Need help?" },
248
+ position: { default: "bottom-right" }
249
+ },
250
+ setup(r) {
251
+ const x = r, s = new Y(), o = f(!1), a = f(!1), e = f(!1), n = f(!1), d = f(""), g = f(null), m = f(!1);
252
+ let v = null, y = null;
253
+ const T = B(() => ({
254
+ faq: x.faq || [],
255
+ pageContext: x.pageContext || "",
256
+ systemPrompt: x.systemPrompt || "",
257
+ canNavigate: x.canNavigate ?? !1,
258
+ canHelpForms: x.canHelpForms ?? !1,
259
+ escalateTo: x.escalateTo
260
+ })), C = B(() => ({
261
+ position: "fixed",
262
+ bottom: "24px",
263
+ zIndex: "10000",
264
+ ...x.position === "bottom-left" ? { left: "24px" } : { right: "24px" }
265
+ }));
266
+ function i() {
267
+ if (typeof document > "u" || document.getElementById("fp-bot-animations"))
268
+ return;
269
+ const h = document.createElement("style");
270
+ h.id = "fp-bot-animations", h.textContent = `
271
+ @keyframes fp-bubble-in {
272
+ 0% { opacity: 0; transform: scale(0.8) translateY(6px); }
273
+ 100% { opacity: 1; transform: scale(1) translateY(0); }
274
+ }
275
+ @keyframes fp-bounce {
276
+ 0% { transform: translateY(0); }
277
+ 50% { transform: translateY(-8px); }
278
+ 100% { transform: translateY(0); }
279
+ }
280
+ @keyframes fp-panel-open {
281
+ 0% { opacity: 0; transform: translateY(40px); }
282
+ 100% { opacity: 1; transform: translateY(0); }
283
+ }
284
+ @keyframes fp-dot {
285
+ 0% { opacity: 0.2; transform: translateY(0); }
286
+ 50% { opacity: 1; transform: translateY(-3px); }
287
+ 100% { opacity: 0.2; transform: translateY(0); }
288
+ }
289
+ `, document.head.appendChild(h);
290
+ }
291
+ async function u(h, c) {
292
+ const k = s.getAllData(!0);
293
+ try {
294
+ const z = await fetch("/api/bot/session-proxy", {
295
+ method: "POST",
296
+ headers: { "content-type": "application/json" },
297
+ body: JSON.stringify({
298
+ page: window.location.pathname,
299
+ triggerScore: h,
300
+ triggerReasons: c,
301
+ sessionId: k.sessionId,
302
+ visitorId: k.userId,
303
+ device: navigator.userAgent
304
+ })
305
+ });
306
+ if (!z.ok) {
307
+ z.status === 402 && (n.value = !0);
308
+ return;
309
+ }
310
+ const A = await z.json().catch(() => null);
311
+ A?.botSessionId && (d.value = A.botSessionId);
312
+ } catch {
313
+ }
314
+ }
315
+ function p(h, c) {
316
+ a.value = !0, o.value = !0, n.value = !1, g.value = null, m.value = !1, u(h, c), y && clearTimeout(y), y = setTimeout(() => {
317
+ o.value = !1;
318
+ }, 8e3);
319
+ }
320
+ function S() {
321
+ e.value = !0, o.value = !1;
322
+ }
323
+ async function $() {
324
+ if (e.value = !1, !!d.value)
325
+ try {
326
+ await fetch("/api/bot/session-end-proxy", {
327
+ method: "POST",
328
+ headers: { "content-type": "application/json" },
329
+ body: JSON.stringify({
330
+ botSessionId: d.value,
331
+ wasHelpful: g.value,
332
+ escalated: m.value
333
+ })
334
+ });
335
+ } catch {
336
+ }
337
+ }
338
+ return F(() => {
339
+ i(), v = new X({
340
+ onTrigger: (h, c) => {
341
+ p(h, c);
342
+ }
343
+ }), v.start();
344
+ }), M(() => {
345
+ v?.stop(), y && clearTimeout(y);
346
+ }), (h, c) => (l(), b("div", {
347
+ style: P(C.value)
348
+ }, [
349
+ o.value && !e.value ? (l(), b("div", {
350
+ key: 0,
351
+ style: P({
352
+ position: "absolute",
353
+ bottom: "62px",
354
+ right: r.position === "bottom-right" ? "0" : "auto",
355
+ left: r.position === "bottom-left" ? "0" : "auto",
356
+ background: "#fff",
357
+ border: "2px solid #6366f1",
358
+ color: "#1f2937",
359
+ borderRadius: "12px 12px 0 12px",
360
+ padding: "10px 12px",
361
+ maxWidth: "240px",
362
+ fontSize: "13px",
363
+ boxShadow: "0 10px 22px rgba(0,0,0,0.16)",
364
+ animation: "fp-bubble-in 300ms ease-out"
365
+ })
366
+ }, [
367
+ I(D(r.initialMessage) + " ", 1),
368
+ c[2] || (c[2] = t("span", { style: {
369
+ position: "absolute",
370
+ right: "10px",
371
+ bottom: "-12px",
372
+ width: "0",
373
+ height: "0",
374
+ borderLeft: "10px solid transparent",
375
+ borderTop: "12px solid #6366f1"
376
+ } }, null, -1)),
377
+ c[3] || (c[3] = t("span", { style: {
378
+ position: "absolute",
379
+ right: "11px",
380
+ bottom: "-9px",
381
+ width: "0",
382
+ height: "0",
383
+ borderLeft: "9px solid transparent",
384
+ borderTop: "11px solid #fff"
385
+ } }, null, -1))
386
+ ], 4)) : w("", !0),
387
+ a.value && !e.value ? (l(), b("button", {
388
+ key: 1,
389
+ style: {
390
+ width: "48px",
391
+ height: "48px",
392
+ borderRadius: "999px",
393
+ border: "none",
394
+ background: "#6366f1",
395
+ boxShadow: "0 12px 26px rgba(79,70,229,0.45)",
396
+ cursor: "pointer",
397
+ display: "grid",
398
+ placeItems: "center",
399
+ animation: "fp-bounce 600ms ease-out"
400
+ },
401
+ onClick: S
402
+ }, [...c[4] || (c[4] = [
403
+ W('<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><rect x="3" y="8" width="18" height="13" rx="2"></rect><path d="M12 8V5"></path><circle cx="12" cy="4" r="1"></circle><circle cx="8" cy="13" r="1.5" fill="white" stroke="none"></circle><circle cx="16" cy="13" r="1.5" fill="white" stroke="none"></circle><path d="M9 17h6" stroke-linecap="round"></path></svg>', 1)
404
+ ])])) : w("", !0),
405
+ e.value && d.value ? (l(), N(ce, {
406
+ key: 2,
407
+ "bot-session-id": d.value,
408
+ config: T.value,
409
+ unavailable: n.value,
410
+ onClose: $,
411
+ onHelpful: c[0] || (c[0] = (k) => g.value = k),
412
+ onEscalated: c[1] || (c[1] = (k) => m.value = !0)
413
+ }, null, 8, ["bot-session-id", "config", "unavailable"])) : w("", !0)
414
+ ], 4));
415
+ }
416
+ }), fe = {
8
417
  key: 0,
9
418
  style: { position: "fixed", bottom: "0", left: "0", right: "0", "z-index": "99999", background: "#1a1a1a", color: "#fff", padding: "20px 24px", "border-top": "1px solid #333", "font-family": "sans-serif" }
10
- }, q = { style: { "max-width": "900px", margin: "0 auto" } }, W = {
419
+ }, xe = { style: { "max-width": "900px", margin: "0 auto" } }, be = {
11
420
  key: 0,
12
421
  style: { "margin-bottom": "12px", "font-size": "13px" }
13
- }, H = { style: { display: "flex", "align-items": "center", gap: "8px", "margin-bottom": "6px" } }, K = { style: { display: "flex", "align-items": "center", gap: "8px" } }, O = { style: { display: "flex", gap: "8px", "flex-wrap": "wrap", "align-items": "center" } }, Y = /* @__PURE__ */ _({
422
+ }, ye = { style: { display: "flex", "align-items": "center", gap: "8px", "margin-bottom": "6px" } }, ge = { style: { display: "flex", "align-items": "center", gap: "8px" } }, ve = { style: { display: "flex", gap: "8px", "flex-wrap": "wrap", "align-items": "center" } }, me = /* @__PURE__ */ E({
14
423
  __name: "consent-banner",
15
424
  emits: ["consent"],
16
- setup(r, { emit: d }) {
17
- const o = d, t = new F(), i = g(!1), e = g(!1), a = g(!1), p = g(!1);
18
- function v() {
19
- i.value = !0, e.value = !0;
425
+ setup(r, { emit: x }) {
426
+ const s = x, o = new Y(), a = f(!1), e = f(!1), n = f(!1), d = f(!1);
427
+ function g() {
428
+ a.value = !0, e.value = !0;
20
429
  }
21
- z(() => {
22
- const x = t.getConsent();
23
- i.value = !x || t.isConsentExpired(), x && (a.value = x.analytics, p.value = x.marketing), typeof window < "u" && (window.addEventListener("feedpulse:open-consent", v), window.addEventListener("feedpulse:withdraw-consent", w));
430
+ F(() => {
431
+ const C = o.getConsent();
432
+ a.value = !C || o.isConsentExpired(), C && (n.value = C.analytics, d.value = C.marketing), typeof window < "u" && (window.addEventListener("feedpulse:open-consent", g), window.addEventListener("feedpulse:withdraw-consent", T));
24
433
  });
25
434
  function m() {
26
- t.setConsent({ analytics: !0, marketing: !0, version: "1.0" }), o("consent", { analytics: !0, marketing: !0, action: "accept_all" }), i.value = !1;
435
+ o.setConsent({ analytics: !0, marketing: !0, version: "1.0" }), s("consent", { analytics: !0, marketing: !0, action: "accept_all" }), a.value = !1;
27
436
  }
28
- function c() {
29
- t.setConsent({ analytics: !1, marketing: !1, version: "1.0" }), t.clearAnalyticsCookies(), o("consent", { analytics: !1, marketing: !1, action: "reject_all" }), i.value = !1;
437
+ function v() {
438
+ o.setConsent({ analytics: !1, marketing: !1, version: "1.0" }), o.clearAnalyticsCookies(), s("consent", { analytics: !1, marketing: !1, action: "reject_all" }), a.value = !1;
30
439
  }
31
- function f() {
32
- t.setConsent({ analytics: a.value, marketing: p.value, version: "1.0" }), a.value || t.clearAnalyticsCookies(), o("consent", { analytics: a.value, marketing: p.value, action: "custom" }), i.value = !1;
440
+ function y() {
441
+ o.setConsent({ analytics: n.value, marketing: d.value, version: "1.0" }), n.value || o.clearAnalyticsCookies(), s("consent", { analytics: n.value, marketing: d.value, action: "custom" }), a.value = !1;
33
442
  }
34
- function w() {
35
- t.setConsent({ analytics: !1, marketing: !1, version: "1.0" }), t.clearAnalyticsCookies(), a.value = !1, p.value = !1, o("consent", { analytics: !1, marketing: !1, action: "withdraw" }), i.value = !0;
443
+ function T() {
444
+ o.setConsent({ analytics: !1, marketing: !1, version: "1.0" }), o.clearAnalyticsCookies(), n.value = !1, d.value = !1, s("consent", { analytics: !1, marketing: !1, action: "withdraw" }), a.value = !0;
36
445
  }
37
- return D(() => {
38
- typeof window < "u" && (window.removeEventListener("feedpulse:open-consent", v), window.removeEventListener("feedpulse:withdraw-consent", w));
39
- }), (x, s) => (l(), P(M, { to: "body" }, [
40
- i.value ? (l(), u("div", N, [
41
- n("div", q, [
42
- s[6] || (s[6] = n("p", { style: { margin: "0 0 12px", "font-size": "14px", "line-height": "1.5" } }, [
43
- b(" We use cookies to improve reliability and understand usage. "),
44
- n("a", {
446
+ return M(() => {
447
+ typeof window < "u" && (window.removeEventListener("feedpulse:open-consent", g), window.removeEventListener("feedpulse:withdraw-consent", T));
448
+ }), (C, i) => (l(), N(J, { to: "body" }, [
449
+ a.value ? (l(), b("div", fe, [
450
+ t("div", xe, [
451
+ i[6] || (i[6] = t("p", { style: { margin: "0 0 12px", "font-size": "14px", "line-height": "1.5" } }, [
452
+ I(" We use cookies to improve reliability and understand usage. "),
453
+ t("a", {
45
454
  href: "/privacy",
46
455
  style: { color: "#818cf8" }
47
456
  }, "Privacy Policy")
48
457
  ], -1)),
49
- e.value ? (l(), u("div", W, [
50
- s[5] || (s[5] = n("label", { style: { display: "flex", "align-items": "center", gap: "8px", "margin-bottom": "6px", opacity: "0.75" } }, [
51
- n("input", {
458
+ e.value ? (l(), b("div", be, [
459
+ i[5] || (i[5] = t("label", { style: { display: "flex", "align-items": "center", gap: "8px", "margin-bottom": "6px", opacity: "0.75" } }, [
460
+ t("input", {
52
461
  type: "checkbox",
53
462
  checked: "",
54
463
  disabled: ""
55
464
  }),
56
- b(" Necessary (always on) ")
465
+ I(" Necessary (always on) ")
57
466
  ], -1)),
58
- n("label", H, [
59
- C(n("input", {
60
- "onUpdate:modelValue": s[0] || (s[0] = (k) => a.value = k),
467
+ t("label", ye, [
468
+ R(t("input", {
469
+ "onUpdate:modelValue": i[0] || (i[0] = (u) => n.value = u),
61
470
  type: "checkbox"
62
471
  }, null, 512), [
63
- [A, a.value]
472
+ [j, n.value]
64
473
  ]),
65
- s[3] || (s[3] = b(" Analytics ", -1))
474
+ i[3] || (i[3] = I(" Analytics ", -1))
66
475
  ]),
67
- n("label", K, [
68
- C(n("input", {
69
- "onUpdate:modelValue": s[1] || (s[1] = (k) => p.value = k),
476
+ t("label", ge, [
477
+ R(t("input", {
478
+ "onUpdate:modelValue": i[1] || (i[1] = (u) => d.value = u),
70
479
  type: "checkbox"
71
480
  }, null, 512), [
72
- [A, p.value]
481
+ [j, d.value]
73
482
  ]),
74
- s[4] || (s[4] = b(" Marketing ", -1))
483
+ i[4] || (i[4] = I(" Marketing ", -1))
75
484
  ])
76
- ])) : y("", !0),
77
- n("div", O, [
78
- n("button", {
485
+ ])) : w("", !0),
486
+ t("div", ve, [
487
+ t("button", {
79
488
  style: { width: "130px", padding: "9px 12px", background: "#4f46e5", color: "#fff", border: "1px solid #4f46e5", "border-radius": "6px", "font-size": "13px", "font-weight": "600", cursor: "pointer" },
80
489
  onClick: m
81
490
  }, " Accept All "),
82
- n("button", {
491
+ t("button", {
83
492
  style: { width: "130px", padding: "9px 12px", background: "transparent", color: "#fff", border: "1px solid #555", "border-radius": "6px", "font-size": "13px", "font-weight": "600", cursor: "pointer" },
84
- onClick: c
493
+ onClick: v
85
494
  }, " Reject All "),
86
- n("button", {
495
+ t("button", {
87
496
  style: { padding: "9px 16px", background: "transparent", color: "#aaa", border: "1px solid #333", "border-radius": "6px", "font-size": "13px", cursor: "pointer" },
88
- onClick: s[2] || (s[2] = (k) => e.value ? f() : e.value = !0)
89
- }, $(e.value ? "Save Preferences" : "Customize"), 1)
497
+ onClick: i[2] || (i[2] = (u) => e.value ? y() : e.value = !0)
498
+ }, D(e.value ? "Save Preferences" : "Customize"), 1)
90
499
  ])
91
500
  ])
92
- ])) : y("", !0)
501
+ ])) : w("", !0)
93
502
  ]));
94
503
  }
95
- }), te = /* @__PURE__ */ _({
504
+ }), Ae = /* @__PURE__ */ E({
96
505
  __name: "FeedPulseProvider",
97
506
  props: {
98
507
  proxyEndpoint: { default: "/api/fp-proxy" },
@@ -100,43 +509,43 @@ const N = {
100
509
  consentRequired: { type: Boolean, default: !0 }
101
510
  },
102
511
  setup(r) {
103
- const d = r, o = new F(), t = new U({
104
- proxyEndpoint: d.proxyEndpoint,
105
- debug: d.debug
512
+ const x = r, s = new Y(), o = new Q({
513
+ proxyEndpoint: x.proxyEndpoint,
514
+ debug: x.debug
106
515
  });
107
- T(S, t);
108
- function i(e) {
109
- const a = o.setConsent({
516
+ K(H, o);
517
+ function a(e) {
518
+ const n = s.setConsent({
110
519
  analytics: e.analytics,
111
520
  marketing: e.marketing,
112
521
  version: "1.0"
113
522
  });
114
- e.analytics || o.clearAnalyticsCookies(), t.updateCookieData(o.getAllData(e.analytics)), t.track("consent", "__consent__", {
523
+ e.analytics || s.clearAnalyticsCookies(), o.updateCookieData(s.getAllData(e.analytics)), o.track("consent", "__consent__", {
115
524
  analytics: e.analytics,
116
525
  marketing: e.marketing,
117
526
  action: e.action,
118
527
  userAgent: navigator.userAgent,
119
- version: a.version
528
+ version: n.version
120
529
  });
121
530
  }
122
- return z(() => {
123
- const e = o.getConsent();
124
- d.consentRequired === !1 ? (o.setConsent({ analytics: !0, marketing: !0, version: "1.0" }), t.updateCookieData(o.getAllData(!0))) : e && !o.isConsentExpired() ? t.updateCookieData(o.getAllData(e.analytics)) : t.updateCookieData(o.getAllData(!1)), t.init();
125
- }), D(() => t.destroy()), (e, a) => (l(), u(h, null, [
126
- L(e.$slots, "default"),
127
- r.consentRequired !== !1 ? (l(), P(Y, {
531
+ return F(() => {
532
+ const e = s.getConsent();
533
+ x.consentRequired === !1 ? (s.setConsent({ analytics: !0, marketing: !0, version: "1.0" }), o.updateCookieData(s.getAllData(!0))) : e && !s.isConsentExpired() ? o.updateCookieData(s.getAllData(e.analytics)) : o.updateCookieData(s.getAllData(!1)), o.init();
534
+ }), M(() => o.destroy()), (e, n) => (l(), b(_, null, [
535
+ G(e.$slots, "default"),
536
+ r.consentRequired !== !1 ? (l(), N(me, {
128
537
  key: 0,
129
- onConsent: i
130
- })) : y("", !0)
538
+ onConsent: a
539
+ })) : w("", !0)
131
540
  ], 64));
132
541
  }
133
- }), G = {
542
+ }), he = {
134
543
  key: 1,
135
544
  style: { background: "#fff", border: "1px solid #e5e7eb", "border-radius": "12px", padding: "16px", width: "280px", "box-shadow": "0 10px 25px rgba(0,0,0,0.15)" }
136
- }, I = { style: { margin: "0 0 12px", "font-weight": "600", color: "#111" } }, J = { style: { display: "flex", gap: "6px", "margin-bottom": "12px" } }, Q = ["onClick"], X = {
545
+ }, ke = { style: { margin: "0 0 12px", "font-weight": "600", color: "#111" } }, we = { style: { display: "flex", gap: "6px", "margin-bottom": "12px" } }, Se = ["onClick"], Ce = {
137
546
  key: 1,
138
547
  style: { "text-align": "center", padding: "16px", color: "#111" }
139
- }, ne = /* @__PURE__ */ _({
548
+ }, Ie = /* @__PURE__ */ E({
140
549
  __name: "FeedPulseWidget",
141
550
  props: {
142
551
  id: {},
@@ -144,57 +553,58 @@ const N = {
144
553
  position: { default: "bottom-right" }
145
554
  },
146
555
  setup(r) {
147
- const d = r, o = j(), t = g(d.position === "inline"), i = g(null), e = g(""), a = g(!1);
148
- function p(m) {
149
- i.value = m;
556
+ const x = r, s = Z(), o = f(x.position === "inline"), a = f(null), e = f(""), n = f(!1);
557
+ function d(m) {
558
+ a.value = m;
150
559
  }
151
- function v() {
152
- !i.value && !e.value.trim() || (o?.trackFeedback(d.id ?? null, i.value, e.value || null), a.value = !0, setTimeout(() => {
153
- t.value = d.position === "inline", a.value = !1, i.value = null, e.value = "";
560
+ function g() {
561
+ !a.value && !e.value.trim() || (s?.trackFeedback(x.id ?? null, a.value, e.value || null), n.value = !0, setTimeout(() => {
562
+ o.value = x.position === "inline", n.value = !1, a.value = null, e.value = "";
154
563
  }, 2e3));
155
564
  }
156
- return (m, c) => (l(), u("div", {
565
+ return (m, v) => (l(), b("div", {
157
566
  class: "feedpulse-widget",
158
- style: E(r.position !== "inline" ? `position:fixed; ${r.position === "bottom-right" ? "right:24px" : "left:24px"}; bottom:24px; z-index:9999;` : "")
567
+ style: P(r.position !== "inline" ? `position:fixed; ${r.position === "bottom-right" ? "right:24px" : "left:24px"}; bottom:24px; z-index:9999;` : "")
159
568
  }, [
160
- r.position !== "inline" ? (l(), u("button", {
569
+ r.position !== "inline" ? (l(), b("button", {
161
570
  key: 0,
162
571
  style: { background: "#6366f1", color: "#fff", border: "none", "border-radius": "50%", width: "48px", height: "48px", "font-size": "20px", cursor: "pointer" },
163
- onClick: c[0] || (c[0] = (f) => t.value = !t.value)
164
- }, " 💬 ")) : y("", !0),
165
- t.value ? (l(), u("div", G, [
166
- a.value ? (l(), u("div", X, [...c[2] || (c[2] = [
167
- n("p", { style: { "font-size": "28px", margin: "0" } }, " 🎉 ", -1),
168
- n("p", { style: { margin: "8px 0 0", "font-weight": "600" } }, " Thanks for your feedback! ", -1)
169
- ])])) : (l(), u(h, { key: 0 }, [
170
- n("p", I, $(r.placeholder ?? "How was your experience?"), 1),
171
- n("div", J, [
172
- (l(), u(h, null, V(5, (f) => n("button", {
173
- key: f,
174
- style: E({ background: "none", border: "none", cursor: "pointer", fontSize: "24px", opacity: i.value !== null && f <= i.value ? 1 : 0.3 }),
175
- onClick: (w) => p(f)
176
- }, " ⭐ ", 12, Q)), 64))
572
+ onClick: v[0] || (v[0] = (y) => o.value = !o.value)
573
+ }, " 💬 ")) : w("", !0),
574
+ o.value ? (l(), b("div", he, [
575
+ n.value ? (l(), b("div", Ce, [...v[2] || (v[2] = [
576
+ t("p", { style: { "font-size": "28px", margin: "0" } }, " 🎉 ", -1),
577
+ t("p", { style: { margin: "8px 0 0", "font-weight": "600" } }, " Thanks for your feedback! ", -1)
578
+ ])])) : (l(), b(_, { key: 0 }, [
579
+ t("p", ke, D(r.placeholder ?? "How was your experience?"), 1),
580
+ t("div", we, [
581
+ (l(), b(_, null, L(5, (y) => t("button", {
582
+ key: y,
583
+ style: P({ background: "none", border: "none", cursor: "pointer", fontSize: "24px", opacity: a.value !== null && y <= a.value ? 1 : 0.3 }),
584
+ onClick: (T) => d(y)
585
+ }, " ⭐ ", 12, Se)), 64))
177
586
  ]),
178
- C(n("textarea", {
179
- "onUpdate:modelValue": c[1] || (c[1] = (f) => e.value = f),
587
+ R(t("textarea", {
588
+ "onUpdate:modelValue": v[1] || (v[1] = (y) => e.value = y),
180
589
  placeholder: "Tell us more (optional)...",
181
590
  rows: "3",
182
591
  style: { width: "100%", padding: "8px", border: "1px solid #d1d5db", "border-radius": "8px", resize: "none", "font-size": "14px" }
183
592
  }, null, 512), [
184
- [R, e.value]
593
+ [q, e.value]
185
594
  ]),
186
- n("button", {
595
+ t("button", {
187
596
  style: { "margin-top": "10px", width: "100%", background: "#6366f1", color: "#fff", border: "none", "border-radius": "8px", padding: "10px", "font-weight": "600", cursor: "pointer" },
188
- onClick: v
597
+ onClick: g
189
598
  }, " Submit Feedback ")
190
599
  ], 64))
191
- ])) : y("", !0)
600
+ ])) : w("", !0)
192
601
  ], 4));
193
602
  }
194
603
  });
195
604
  export {
196
- Y as ConsentBanner,
197
- te as FeedPulseProvider,
198
- ne as FeedPulseWidget,
199
- j as useFeedPulse
605
+ me as ConsentBanner,
606
+ $e as FeedPulseBot,
607
+ Ae as FeedPulseProvider,
608
+ Ie as FeedPulseWidget,
609
+ Z as useFeedPulse
200
610
  };