@tekibo/feedpulse-sdk 0.6.1 → 0.7.1

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