@tekibo/feedpulse-sdk 0.7.3 → 0.8.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 (38) hide show
  1. package/README.md +83 -83
  2. package/dist/core/cookies.d.ts +37 -0
  3. package/dist/core/struggle-detector.d.ts +33 -0
  4. package/dist/core/tracker.d.ts +38 -0
  5. package/dist/core/types.d.ts +59 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.js +1 -1
  8. package/dist/index.mjs +127 -176
  9. package/dist/nuxt/BotPanel.vue.d.ts +17 -0
  10. package/dist/nuxt/FeedPulseBot.vue.d.ts +24 -0
  11. package/dist/nuxt/FeedPulseProvider.vue.d.ts +21 -0
  12. package/dist/nuxt/FeedPulseWidget.vue.d.ts +10 -0
  13. package/dist/nuxt/composables.d.ts +4 -0
  14. package/dist/nuxt/consent-banner.vue.d.ts +16 -0
  15. package/dist/nuxt/index.d.ts +5 -0
  16. package/dist/nuxt.d.ts +2 -0
  17. package/dist/nuxt.js +2 -2
  18. package/dist/nuxt.mjs +283 -336
  19. package/dist/react/FeedPulseBot.d.ts +21 -0
  20. package/dist/react/FeedPulseProvider.d.ts +13 -0
  21. package/dist/react/FeedPulseWidget.d.ts +8 -0
  22. package/dist/react/consent-banner.d.ts +11 -0
  23. package/dist/react/hooks.d.ts +1 -0
  24. package/dist/react/index.d.ts +4 -0
  25. package/dist/react.d.ts +2 -0
  26. package/dist/react.js +3 -3
  27. package/dist/react.mjs +275 -315
  28. package/dist/struggle-detector-CT3YShuG.js +1 -0
  29. package/dist/{struggle-detector-BqTHgw95.mjs → struggle-detector-Cwe3PD9s.mjs} +40 -25
  30. package/package.json +4 -11
  31. package/templates/nextjs-proxy.ts +36 -36
  32. package/templates/nuxt-bot-proxy.ts +60 -93
  33. package/templates/nuxt-proxy.ts +44 -44
  34. package/bin/feedpulse-bot-build.mjs +0 -121
  35. package/dist/server.js +0 -1
  36. package/dist/server.mjs +0 -18
  37. package/dist/struggle-detector-DV52qDLp.js +0 -1
  38. package/templates/nuxt-config-id-route.ts +0 -15
package/dist/react.mjs CHANGED
@@ -1,116 +1,116 @@
1
- import ge, { useState as c, useEffect as te, useCallback as be, useRef as X, useMemo as he, createContext as me, useContext as ye } from "react";
2
- import { CookieManager as ce, CursorActor as ke, FeedPulseTracker as ve } from "./index.mjs";
3
- import { S as we } from "./struggle-detector-BqTHgw95.mjs";
4
- var ee = { exports: {} }, G = {};
5
- var de;
6
- function je() {
7
- if (de) return G;
8
- de = 1;
9
- var s = /* @__PURE__ */ Symbol.for("react.transitional.element"), k = /* @__PURE__ */ Symbol.for("react.fragment");
10
- function a(h, i, l) {
1
+ import ie, { useState as p, useEffect as G, useCallback as oe, useRef as H, useMemo as le, createContext as ce, useContext as de } from "react";
2
+ import { CookieManager as K, FeedPulseTracker as ue } from "./index.mjs";
3
+ import { S as fe } from "./struggle-detector-Cwe3PD9s.mjs";
4
+ var q = { exports: {} }, W = {};
5
+ var ee;
6
+ function pe() {
7
+ if (ee) return W;
8
+ ee = 1;
9
+ var o = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.fragment");
10
+ function a(h, s, i) {
11
11
  var b = null;
12
- if (l !== void 0 && (b = "" + l), i.key !== void 0 && (b = "" + i.key), "key" in i) {
13
- l = {};
14
- for (var x in i)
15
- x !== "key" && (l[x] = i[x]);
16
- } else l = i;
17
- return i = l.ref, {
18
- $$typeof: s,
12
+ if (i !== void 0 && (b = "" + i), s.key !== void 0 && (b = "" + s.key), "key" in s) {
13
+ i = {};
14
+ for (var x in s)
15
+ x !== "key" && (i[x] = s[x]);
16
+ } else i = s;
17
+ return s = i.ref, {
18
+ $$typeof: o,
19
19
  type: h,
20
20
  key: b,
21
- ref: i !== void 0 ? i : null,
22
- props: l
21
+ ref: s !== void 0 ? s : null,
22
+ props: i
23
23
  };
24
24
  }
25
- return G.Fragment = k, G.jsx = a, G.jsxs = a, G;
25
+ return W.Fragment = g, W.jsx = a, W.jsxs = a, W;
26
26
  }
27
- var H = {};
28
- var ue;
29
- function Se() {
30
- return ue || (ue = 1, process.env.NODE_ENV !== "production" && (function() {
31
- function s(e) {
27
+ var L = {};
28
+ var te;
29
+ function be() {
30
+ return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
31
+ function o(e) {
32
32
  if (e == null) return null;
33
33
  if (typeof e == "function")
34
- return e.$$typeof === Y ? null : e.displayName || e.name || null;
34
+ return e.$$typeof === I ? null : e.displayName || e.name || null;
35
35
  if (typeof e == "string") return e;
36
36
  switch (e) {
37
- case T:
37
+ case D:
38
38
  return "Fragment";
39
- case oe:
39
+ case Y:
40
40
  return "Profiler";
41
- case ne:
41
+ case X:
42
42
  return "StrictMode";
43
- case se:
43
+ case M:
44
44
  return "Suspense";
45
- case ae:
45
+ case B:
46
46
  return "SuspenseList";
47
- case Q:
47
+ case J:
48
48
  return "Activity";
49
49
  }
50
50
  if (typeof e == "object")
51
51
  switch (typeof e.tag == "number" && console.error(
52
52
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
53
53
  ), e.$$typeof) {
54
- case re:
54
+ case A:
55
55
  return "Portal";
56
- case Z:
56
+ case $:
57
57
  return e.displayName || "Context";
58
- case L:
58
+ case Z:
59
59
  return (e._context.displayName || "Context") + ".Consumer";
60
- case A:
60
+ case O:
61
61
  var r = e.render;
62
62
  return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
63
- case $:
64
- return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo";
65
- case B:
63
+ case C:
64
+ return r = e.displayName || null, r !== null ? r : o(e.type) || "Memo";
65
+ case R:
66
66
  r = e._payload, e = e._init;
67
67
  try {
68
- return s(e(r));
68
+ return o(e(r));
69
69
  } catch {
70
70
  }
71
71
  }
72
72
  return null;
73
73
  }
74
- function k(e) {
74
+ function g(e) {
75
75
  return "" + e;
76
76
  }
77
77
  function a(e) {
78
78
  try {
79
- k(e);
79
+ g(e);
80
80
  var r = !1;
81
81
  } catch {
82
82
  r = !0;
83
83
  }
84
84
  if (r) {
85
85
  r = console;
86
- var n = r.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
+ var n = r.error, f = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
87
87
  return n.call(
88
88
  r,
89
89
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
90
- u
91
- ), k(e);
90
+ f
91
+ ), g(e);
92
92
  }
93
93
  }
94
94
  function h(e) {
95
- if (e === T) return "<>";
96
- if (typeof e == "object" && e !== null && e.$$typeof === B)
95
+ if (e === D) return "<>";
96
+ if (typeof e == "object" && e !== null && e.$$typeof === R)
97
97
  return "<...>";
98
98
  try {
99
- var r = s(e);
99
+ var r = o(e);
100
100
  return r ? "<" + r + ">" : "<...>";
101
101
  } catch {
102
102
  return "<...>";
103
103
  }
104
104
  }
105
- function i() {
106
- var e = C.A;
105
+ function s() {
106
+ var e = N.A;
107
107
  return e === null ? null : e.getOwner();
108
108
  }
109
- function l() {
109
+ function i() {
110
110
  return Error("react-stack-top-frame");
111
111
  }
112
112
  function b(e) {
113
- if (J.call(e, "key")) {
113
+ if (S.call(e, "key")) {
114
114
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
115
115
  if (r && r.isReactWarning) return !1;
116
116
  }
@@ -128,23 +128,23 @@ function Se() {
128
128
  configurable: !0
129
129
  });
130
130
  }
131
- function g() {
132
- var e = s(this.type);
133
- return O[e] || (O[e] = !0, console.error(
131
+ function k() {
132
+ var e = o(this.type);
133
+ return V[e] || (V[e] = !0, console.error(
134
134
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
135
135
  )), e = this.props.ref, e !== void 0 ? e : null;
136
136
  }
137
- function o(e, r, n, u, D, W) {
138
- var f = n.ref;
137
+ function c(e, r, n, f, E, v) {
138
+ var l = n.ref;
139
139
  return e = {
140
- $$typeof: j,
140
+ $$typeof: w,
141
141
  type: e,
142
142
  key: r,
143
143
  props: n,
144
- _owner: u
145
- }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
144
+ _owner: f
145
+ }, (l !== void 0 ? l : null) !== null ? Object.defineProperty(e, "ref", {
146
146
  enumerable: !1,
147
- get: g
147
+ get: k
148
148
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
149
149
  configurable: !1,
150
150
  enumerable: !1,
@@ -159,132 +159,132 @@ function Se() {
159
159
  configurable: !1,
160
160
  enumerable: !1,
161
161
  writable: !0,
162
- value: D
162
+ value: E
163
163
  }), Object.defineProperty(e, "_debugTask", {
164
164
  configurable: !1,
165
165
  enumerable: !1,
166
166
  writable: !0,
167
- value: W
167
+ value: v
168
168
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
169
169
  }
170
- function d(e, r, n, u, D, W) {
171
- var f = r.children;
172
- if (f !== void 0)
173
- if (u)
174
- if (P(f)) {
175
- for (u = 0; u < f.length; u++)
176
- m(f[u]);
177
- Object.freeze && Object.freeze(f);
170
+ function u(e, r, n, f, E, v) {
171
+ var l = r.children;
172
+ if (l !== void 0)
173
+ if (f)
174
+ if (Q(l)) {
175
+ for (f = 0; f < l.length; f++)
176
+ y(l[f]);
177
+ Object.freeze && Object.freeze(l);
178
178
  } else
179
179
  console.error(
180
180
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
181
181
  );
182
- else m(f);
183
- if (J.call(r, "key")) {
184
- f = s(e);
185
- var E = Object.keys(r).filter(function(ie) {
186
- return ie !== "key";
182
+ else y(l);
183
+ if (S.call(r, "key")) {
184
+ l = o(e);
185
+ var _ = Object.keys(r).filter(function(se) {
186
+ return se !== "key";
187
187
  });
188
- u = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", I[f + u] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
188
+ f = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", P[l + f] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
189
189
  `A props object containing a "key" prop is being spread into JSX:
190
190
  let props = %s;
191
191
  <%s {...props} />
192
192
  React keys must be passed directly to JSX without using spread:
193
193
  let props = %s;
194
194
  <%s key={someKey} {...props} />`,
195
- u,
196
195
  f,
197
- E,
198
- f
199
- ), I[f + u] = !0);
196
+ l,
197
+ _,
198
+ l
199
+ ), P[l + f] = !0);
200
200
  }
201
- if (f = null, n !== void 0 && (a(n), f = "" + n), b(r) && (a(r.key), f = "" + r.key), "key" in r) {
201
+ if (l = null, n !== void 0 && (a(n), l = "" + n), b(r) && (a(r.key), l = "" + r.key), "key" in r) {
202
202
  n = {};
203
- for (var M in r)
204
- M !== "key" && (n[M] = r[M]);
203
+ for (var T in r)
204
+ T !== "key" && (n[T] = r[T]);
205
205
  } else n = r;
206
- return f && x(
206
+ return l && x(
207
207
  n,
208
208
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
209
- ), o(
209
+ ), c(
210
210
  e,
211
- f,
211
+ l,
212
212
  n,
213
- i(),
214
- D,
215
- W
213
+ s(),
214
+ E,
215
+ v
216
216
  );
217
217
  }
218
- function m(e) {
219
- w(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === B && (e._payload.status === "fulfilled" ? w(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
+ function y(e) {
219
+ j(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === R && (e._payload.status === "fulfilled" ? j(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
220
220
  }
221
- function w(e) {
222
- return typeof e == "object" && e !== null && e.$$typeof === j;
221
+ function j(e) {
222
+ return typeof e == "object" && e !== null && e.$$typeof === w;
223
223
  }
224
- var p = ge, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), re = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), ne = /* @__PURE__ */ Symbol.for("react.strict_mode"), oe = /* @__PURE__ */ Symbol.for("react.profiler"), L = /* @__PURE__ */ Symbol.for("react.consumer"), Z = /* @__PURE__ */ Symbol.for("react.context"), A = /* @__PURE__ */ Symbol.for("react.forward_ref"), se = /* @__PURE__ */ Symbol.for("react.suspense"), ae = /* @__PURE__ */ Symbol.for("react.suspense_list"), $ = /* @__PURE__ */ Symbol.for("react.memo"), B = /* @__PURE__ */ Symbol.for("react.lazy"), Q = /* @__PURE__ */ Symbol.for("react.activity"), Y = /* @__PURE__ */ Symbol.for("react.client.reference"), C = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, P = Array.isArray, S = console.createTask ? console.createTask : function() {
224
+ var d = ie, w = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), D = /* @__PURE__ */ Symbol.for("react.fragment"), X = /* @__PURE__ */ Symbol.for("react.strict_mode"), Y = /* @__PURE__ */ Symbol.for("react.profiler"), Z = /* @__PURE__ */ Symbol.for("react.consumer"), $ = /* @__PURE__ */ Symbol.for("react.context"), O = /* @__PURE__ */ Symbol.for("react.forward_ref"), M = /* @__PURE__ */ Symbol.for("react.suspense"), B = /* @__PURE__ */ Symbol.for("react.suspense_list"), C = /* @__PURE__ */ Symbol.for("react.memo"), R = /* @__PURE__ */ Symbol.for("react.lazy"), J = /* @__PURE__ */ Symbol.for("react.activity"), I = /* @__PURE__ */ Symbol.for("react.client.reference"), N = d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, S = Object.prototype.hasOwnProperty, Q = Array.isArray, F = console.createTask ? console.createTask : function() {
225
225
  return null;
226
226
  };
227
- p = {
227
+ d = {
228
228
  react_stack_bottom_frame: function(e) {
229
229
  return e();
230
230
  }
231
231
  };
232
- var U, O = {}, V = p.react_stack_bottom_frame.bind(
233
- p,
234
- l
235
- )(), R = S(h(l)), I = {};
236
- H.Fragment = T, H.jsx = function(e, r, n) {
237
- var u = 1e4 > C.recentlyCreatedOwnerStacks++;
238
- return d(
232
+ var U, V = {}, m = d.react_stack_bottom_frame.bind(
233
+ d,
234
+ i
235
+ )(), z = F(h(i)), P = {};
236
+ L.Fragment = D, L.jsx = function(e, r, n) {
237
+ var f = 1e4 > N.recentlyCreatedOwnerStacks++;
238
+ return u(
239
239
  e,
240
240
  r,
241
241
  n,
242
242
  !1,
243
- u ? Error("react-stack-top-frame") : V,
244
- u ? S(h(e)) : R
243
+ f ? Error("react-stack-top-frame") : m,
244
+ f ? F(h(e)) : z
245
245
  );
246
- }, H.jsxs = function(e, r, n) {
247
- var u = 1e4 > C.recentlyCreatedOwnerStacks++;
248
- return d(
246
+ }, L.jsxs = function(e, r, n) {
247
+ var f = 1e4 > N.recentlyCreatedOwnerStacks++;
248
+ return u(
249
249
  e,
250
250
  r,
251
251
  n,
252
252
  !0,
253
- u ? Error("react-stack-top-frame") : V,
254
- u ? S(h(e)) : R
253
+ f ? Error("react-stack-top-frame") : m,
254
+ f ? F(h(e)) : z
255
255
  );
256
256
  };
257
- })()), H;
257
+ })()), L;
258
258
  }
259
- var fe;
260
- function Re() {
261
- return fe || (fe = 1, process.env.NODE_ENV === "production" ? ee.exports = je() : ee.exports = Se()), ee.exports;
259
+ var re;
260
+ function xe() {
261
+ return re || (re = 1, process.env.NODE_ENV === "production" ? q.exports = pe() : q.exports = be()), q.exports;
262
262
  }
263
- var t = Re();
264
- const pe = new ce();
265
- function Ee({ onConsent: s }) {
266
- const [k, a] = c(!1), [h, i] = c(!1), [l, b] = c(!1), [x, g] = c(!1);
267
- te(() => {
268
- const p = pe.getConsent();
269
- a(!p || pe.isConsentExpired()), p && (b(p.analytics), g(p.marketing));
263
+ var t = xe();
264
+ const ne = new K();
265
+ function he({ onConsent: o }) {
266
+ const [g, a] = p(!1), [h, s] = p(!1), [i, b] = p(!1), [x, k] = p(!1);
267
+ G(() => {
268
+ const d = ne.getConsent();
269
+ a(!d || ne.isConsentExpired()), d && (b(d.analytics), k(d.marketing));
270
270
  }, []);
271
- const o = () => {
272
- s({ analytics: !0, marketing: !0, action: "accept_all" }), a(!1);
273
- }, d = () => {
274
- s({ analytics: !1, marketing: !1, action: "reject_all" }), a(!1);
275
- }, m = () => {
276
- s({ analytics: l, marketing: x, action: "custom" }), a(!1);
277
- }, w = be(() => {
278
- s({ analytics: !1, marketing: !1, action: "withdraw" }), b(!1), g(!1), a(!0);
279
- }, [s]);
280
- return te(() => {
281
- const p = () => {
282
- a(!0), i(!0);
271
+ const c = () => {
272
+ o({ analytics: !0, marketing: !0, action: "accept_all" }), a(!1);
273
+ }, u = () => {
274
+ o({ analytics: !1, marketing: !1, action: "reject_all" }), a(!1);
275
+ }, y = () => {
276
+ o({ analytics: i, marketing: x, action: "custom" }), a(!1);
277
+ }, j = oe(() => {
278
+ o({ analytics: !1, marketing: !1, action: "withdraw" }), b(!1), k(!1), a(!0);
279
+ }, [o]);
280
+ return G(() => {
281
+ const d = () => {
282
+ a(!0), s(!0);
283
283
  };
284
- return window.addEventListener("feedpulse:open-consent", p), window.addEventListener("feedpulse:withdraw-consent", w), () => {
285
- window.removeEventListener("feedpulse:open-consent", p), window.removeEventListener("feedpulse:withdraw-consent", w);
284
+ return window.addEventListener("feedpulse:open-consent", d), window.addEventListener("feedpulse:withdraw-consent", j), () => {
285
+ window.removeEventListener("feedpulse:open-consent", d), window.removeEventListener("feedpulse:withdraw-consent", j);
286
286
  };
287
- }, [w]), k ? /* @__PURE__ */ t.jsx("div", { style: { position: "fixed", bottom: 0, left: 0, right: 0, zIndex: 99999, background: "#1a1a1a", color: "#fff", padding: "20px 24px", borderTop: "1px solid #333", fontFamily: "sans-serif" }, children: /* @__PURE__ */ t.jsxs("div", { style: { maxWidth: 900, margin: "0 auto" }, children: [
287
+ }, [j]), g ? /* @__PURE__ */ t.jsx("div", { style: { position: "fixed", bottom: 0, left: 0, right: 0, zIndex: 99999, background: "#1a1a1a", color: "#fff", padding: "20px 24px", borderTop: "1px solid #333", fontFamily: "sans-serif" }, children: /* @__PURE__ */ t.jsxs("div", { style: { maxWidth: 900, margin: "0 auto" }, children: [
288
288
  /* @__PURE__ */ t.jsxs("p", { style: { margin: "0 0 12px", fontSize: 14, lineHeight: 1.5 }, children: [
289
289
  "We use cookies to improve reliability and understand usage.",
290
290
  " ",
@@ -296,26 +296,26 @@ function Ee({ onConsent: s }) {
296
296
  "Necessary (always on)"
297
297
  ] }),
298
298
  /* @__PURE__ */ t.jsxs("label", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 6 }, children: [
299
- /* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: l, onChange: (p) => b(p.target.checked) }),
299
+ /* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: i, onChange: (d) => b(d.target.checked) }),
300
300
  "Analytics"
301
301
  ] }),
302
302
  /* @__PURE__ */ t.jsxs("label", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
303
- /* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: x, onChange: (p) => g(p.target.checked) }),
303
+ /* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: x, onChange: (d) => k(d.target.checked) }),
304
304
  "Marketing"
305
305
  ] })
306
306
  ] }),
307
307
  /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8, flexWrap: "wrap", alignItems: "center" }, children: [
308
- /* @__PURE__ */ t.jsx("button", { type: "button", style: { width: 130, padding: "9px 12px", background: "#4f46e5", color: "#fff", border: "1px solid #4f46e5", borderRadius: 6, fontSize: 13, fontWeight: 600, cursor: "pointer" }, onClick: o, children: "Accept All" }),
309
- /* @__PURE__ */ t.jsx("button", { type: "button", style: { width: 130, padding: "9px 12px", background: "transparent", color: "#fff", border: "1px solid #555", borderRadius: 6, fontSize: 13, fontWeight: 600, cursor: "pointer" }, onClick: d, children: "Reject All" }),
310
- /* @__PURE__ */ t.jsx("button", { type: "button", style: { padding: "9px 16px", background: "transparent", color: "#aaa", border: "1px solid #333", borderRadius: 6, fontSize: 13, cursor: "pointer" }, onClick: () => h ? m() : i(!0), children: h ? "Save Preferences" : "Customize" })
308
+ /* @__PURE__ */ t.jsx("button", { type: "button", style: { width: 130, padding: "9px 12px", background: "#4f46e5", color: "#fff", border: "1px solid #4f46e5", borderRadius: 6, fontSize: 13, fontWeight: 600, cursor: "pointer" }, onClick: c, children: "Accept All" }),
309
+ /* @__PURE__ */ t.jsx("button", { type: "button", style: { width: 130, padding: "9px 12px", background: "transparent", color: "#fff", border: "1px solid #555", borderRadius: 6, fontSize: 13, fontWeight: 600, cursor: "pointer" }, onClick: u, children: "Reject All" }),
310
+ /* @__PURE__ */ t.jsx("button", { type: "button", style: { padding: "9px 16px", background: "transparent", color: "#aaa", border: "1px solid #333", borderRadius: 6, fontSize: 13, cursor: "pointer" }, onClick: () => h ? y() : s(!0), children: h ? "Save Preferences" : "Customize" })
311
311
  ] })
312
312
  ] }) }) : null;
313
313
  }
314
- function _e() {
314
+ function me() {
315
315
  if (typeof document > "u" || document.getElementById("fp-bot-animations"))
316
316
  return;
317
- const s = document.createElement("style");
318
- s.id = "fp-bot-animations", s.textContent = `
317
+ const o = document.createElement("style");
318
+ o.id = "fp-bot-animations", o.textContent = `
319
319
  @keyframes fp-bubble-in {
320
320
  0% { opacity: 0; transform: scale(0.8) translateY(6px); }
321
321
  100% { opacity: 1; transform: scale(1) translateY(0); }
@@ -334,148 +334,126 @@ function _e() {
334
334
  50% { opacity: 1; transform: translateY(-3px); }
335
335
  100% { opacity: 0.2; transform: translateY(0); }
336
336
  }
337
- `, document.head.appendChild(s);
337
+ `, document.head.appendChild(o);
338
338
  }
339
- function Oe({
340
- faq: s,
341
- pageContext: k,
342
- systemPrompt: a,
343
- canNavigate: h,
344
- navigableElements: i,
345
- canHelpForms: l,
346
- formGuide: b,
347
- features: x,
348
- escalateTo: g,
349
- initialMessage: o = "👋 Need help?",
350
- position: d = "bottom-right",
351
- config: m,
352
- configId: w
339
+ function we({
340
+ faq: o = [],
341
+ pageContext: g = "",
342
+ systemPrompt: a = "",
343
+ canNavigate: h = !1,
344
+ canHelpForms: s = !1,
345
+ escalateTo: i,
346
+ initialMessage: b = "👋 Need help?",
347
+ position: x = "bottom-right"
353
348
  }) {
354
- const p = X(new ce()), j = X(new ke()), [re, T] = c(!1), [ne, oe] = c(!1), [L, Z] = c(!1), [A, se] = c(""), [ae, $] = c(null), [B, Q] = c(!1), [Y, C] = c(!1), [J, P] = c([]), [S, U] = c(""), [O, V] = c(!1), [R, I] = c(null), [e, r] = c(null), n = X(null), [u, D] = c(""), W = he(
355
- () => m ?? {
356
- pageContext: k,
357
- systemPrompt: a,
358
- faq: s,
359
- canNavigate: h,
360
- navigableElements: i,
361
- canHelpForms: l,
362
- formGuide: b,
363
- features: x,
364
- escalateTo: g,
365
- initialMessage: o
366
- },
367
- [l, h, m, g, s, x, b, o, i, k, a]
349
+ const k = H(new K()), [c, u] = p(!1), [y, j] = p(!1), [d, w] = p(!1), [A, D] = p(""), [X, Y] = p(null), [Z, $] = p(!1), [O, M] = p(!1), [B, C] = p([]), [R, J] = p(""), [I, N] = p(!1), S = H(null), Q = le(
350
+ () => ({ faq: o, pageContext: g, systemPrompt: a, canNavigate: h, canHelpForms: s, escalateTo: i }),
351
+ [o, g, a, h, s, i]
368
352
  );
369
- te(() => {
370
- _e(), D(window.location.pathname);
371
- const y = new we({
372
- onTrigger: async (F, q) => {
373
- oe(!0), T(!0), $(null), Q(!1), C(!1), n.current && clearTimeout(n.current), n.current = setTimeout(() => T(!1), 8e3);
353
+ G(() => {
354
+ me();
355
+ const m = new fe({
356
+ onTrigger: async (z, P) => {
357
+ j(!0), u(!0), Y(null), $(!1), M(!1), S.current && clearTimeout(S.current), S.current = setTimeout(() => u(!1), 8e3);
374
358
  try {
375
- const K = p.current.getAllData(!0), N = await fetch("/api/bot/session-proxy", {
359
+ const e = k.current.getAllData(!0), r = await fetch("/api/bot/session-proxy", {
376
360
  method: "POST",
377
361
  headers: { "content-type": "application/json" },
378
362
  body: JSON.stringify({
379
363
  page: window.location.pathname,
380
- triggerScore: F,
381
- triggerReasons: q,
382
- sessionId: K.sessionId,
383
- visitorId: K.userId,
364
+ triggerScore: z,
365
+ triggerReasons: P,
366
+ sessionId: e.sessionId,
367
+ visitorId: e.userId,
384
368
  device: navigator.userAgent
385
369
  })
386
370
  });
387
- if (N.status === 402) {
388
- C(!0);
371
+ if (r.status === 402) {
372
+ M(!0);
389
373
  return;
390
374
  }
391
- const v = await N.json().catch(() => null);
392
- v?.botSessionId && se(v.botSessionId);
375
+ const n = await r.json().catch(() => null);
376
+ n?.botSessionId && D(n.botSessionId);
393
377
  } catch {
394
378
  }
395
379
  }
396
380
  });
397
- return y.start(), () => {
398
- y.stop(), n.current && clearTimeout(n.current);
381
+ return m.start(), () => {
382
+ m.stop(), S.current && clearTimeout(S.current);
399
383
  };
400
384
  }, []);
401
- const f = {
385
+ const F = {
402
386
  position: "fixed",
403
387
  bottom: 24,
404
388
  zIndex: 1e4,
405
- ...d === "bottom-left" ? { left: 24 } : { right: 24 }
406
- }, E = (y) => {
407
- if (y.preventDefault(), !S.trim() || Y || O || !A)
389
+ ...x === "bottom-left" ? { left: 24 } : { right: 24 }
390
+ }, U = (m) => {
391
+ if (m.preventDefault(), !R.trim() || O || I || !A)
408
392
  return;
409
- const F = S.trim(), q = [
410
- ...J.map((v) => ({ role: v.role, content: v.content })),
411
- { role: "user", content: F }
412
- ];
413
- U("");
414
- const K = { id: `user-${Date.now()}`, role: "user", content: F }, N = `assistant-${Date.now()}`;
415
- P((v) => [...v, K, { id: N, role: "assistant", content: "" }]), V(!0), (async () => {
393
+ const z = R.trim();
394
+ J("");
395
+ const P = { id: `user-${Date.now()}`, role: "user", content: z }, e = `assistant-${Date.now()}`;
396
+ C((r) => [...r, P, { id: e, role: "assistant", content: "" }]), N(!0), (async () => {
416
397
  try {
417
- const v = await fetch("/api/bot/chat-proxy", {
398
+ const r = await fetch("/api/bot/chat-proxy", {
418
399
  method: "POST",
419
400
  headers: { "content-type": "application/json" },
420
401
  body: JSON.stringify({
421
402
  botSessionId: A,
422
- config: JSON.parse(JSON.stringify(W)),
423
- configId: w,
424
- page: u,
425
- messages: q
403
+ config: Q,
404
+ messages: [...B, P].map((v) => ({ role: v.role, content: v.content }))
426
405
  })
427
406
  });
428
- if (v.status === 402) {
429
- C(!0), P((le) => le.map((z) => z.id === N ? { ...z, content: "Service temporarily unavailable." } : z));
407
+ if (r.status === 402) {
408
+ M(!0), C((v) => v.map((l) => l.id === e ? { ...l, content: "Service temporarily unavailable." } : l));
430
409
  return;
431
410
  }
432
- if (!v.ok)
411
+ if (!r.ok)
433
412
  throw new Error("chat failed");
434
- const _ = await v.json();
435
- P((le) => le.map((z) => z.id === N ? { ...z, content: _.text || "" } : z)), _.action && I(_.action);
413
+ const n = r.body?.getReader();
414
+ if (!n)
415
+ throw new Error("no body");
416
+ const f = new TextDecoder();
417
+ let E = !1;
418
+ for (; !E; ) {
419
+ const v = await n.read();
420
+ if (E = v.done, v.value) {
421
+ const l = f.decode(v.value, { stream: !E });
422
+ C((_) => _.map((T) => T.id === e ? { ...T, content: T.content + l } : T));
423
+ }
424
+ }
436
425
  } catch {
437
- P((v) => v.map((_) => _.id === N && !_.content ? { ..._, content: "Sorry, I couldn't process that. Please try again." } : _));
426
+ C((r) => r.map((n) => n.id === e && !n.content ? { ...n, content: "Sorry, I couldn't process that. Please try again." } : n));
438
427
  } finally {
439
- V(!1);
428
+ N(!1);
440
429
  }
441
430
  })();
442
- }, M = async (y) => {
443
- if (!R)
444
- return;
445
- if (!y) {
446
- I(null), r("No problem! Let me know if you need anything else.");
447
- return;
448
- }
449
- const F = R;
450
- I(null);
451
- const q = await j.current.perform(F);
452
- r(q.message), window.setTimeout(() => r(null), 3e3);
453
- }, ie = async () => {
454
- if (Z(!1), !!A) {
431
+ }, V = async () => {
432
+ if (w(!1), !!A) {
455
433
  try {
456
434
  await fetch("/api/bot/session-end-proxy", {
457
435
  method: "POST",
458
436
  headers: { "content-type": "application/json" },
459
437
  body: JSON.stringify({
460
438
  botSessionId: A,
461
- wasHelpful: ae,
462
- escalated: B
439
+ wasHelpful: X,
440
+ escalated: Z
463
441
  })
464
442
  });
465
443
  } catch {
466
444
  }
467
- P([]), I(null), r(null);
445
+ C([]);
468
446
  }
469
447
  };
470
- return /* @__PURE__ */ t.jsxs("div", { style: f, children: [
471
- re && !L && /* @__PURE__ */ t.jsx(
448
+ return /* @__PURE__ */ t.jsxs("div", { style: F, children: [
449
+ c && !d && /* @__PURE__ */ t.jsx(
472
450
  "div",
473
451
  {
474
452
  style: {
475
453
  position: "absolute",
476
454
  bottom: 62,
477
- right: d === "bottom-right" ? 0 : void 0,
478
- left: d === "bottom-left" ? 0 : void 0,
455
+ right: x === "bottom-right" ? 0 : void 0,
456
+ left: x === "bottom-left" ? 0 : void 0,
479
457
  background: "#fff",
480
458
  border: "2px solid #6366f1",
481
459
  color: "#1f2937",
@@ -486,10 +464,10 @@ function Oe({
486
464
  boxShadow: "0 10px 22px rgba(0,0,0,0.16)",
487
465
  animation: "fp-bubble-in 300ms ease-out"
488
466
  },
489
- children: W.initialMessage || o
467
+ children: b
490
468
  }
491
469
  ),
492
- ne && !L && /* @__PURE__ */ t.jsx(
470
+ y && !d && /* @__PURE__ */ t.jsx(
493
471
  "button",
494
472
  {
495
473
  style: {
@@ -505,7 +483,7 @@ function Oe({
505
483
  animation: "fp-bounce 600ms ease-out"
506
484
  },
507
485
  onClick: () => {
508
- Z(!0), T(!1);
486
+ w(!0), u(!1);
509
487
  },
510
488
  children: /* @__PURE__ */ t.jsxs("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2", children: [
511
489
  /* @__PURE__ */ t.jsx("rect", { x: "3", y: "8", width: "18", height: "13", rx: "2" }),
@@ -517,7 +495,7 @@ function Oe({
517
495
  ] })
518
496
  }
519
497
  ),
520
- L && !!A && /* @__PURE__ */ t.jsxs(
498
+ d && !!A && /* @__PURE__ */ t.jsxs(
521
499
  "div",
522
500
  {
523
501
  style: {
@@ -539,146 +517,128 @@ function Oe({
539
517
  /* @__PURE__ */ t.jsx("strong", { style: { fontSize: 14, color: "#fff" }, children: "Pulse Bot" }),
540
518
  /* @__PURE__ */ t.jsx("span", { style: { fontSize: 11, color: "#94a3b8" }, children: "Powered by FeedPulse AI" })
541
519
  ] }),
542
- /* @__PURE__ */ t.jsx("button", { style: { border: "none", background: "transparent", color: "#cbd5e1", cursor: "pointer", fontSize: 18 }, onClick: ie, children: "×" })
520
+ /* @__PURE__ */ t.jsx("button", { style: { border: "none", background: "transparent", color: "#cbd5e1", cursor: "pointer", fontSize: 18 }, onClick: V, children: "×" })
543
521
  ] }),
544
522
  /* @__PURE__ */ t.jsxs("div", { style: { flex: 1, overflowY: "auto", padding: 12, display: "grid", gap: 10 }, children: [
545
- J.map((y) => /* @__PURE__ */ t.jsxs("div", { style: { display: "grid", justifyItems: y.role === "user" ? "end" : "start", gap: 6 }, children: [
523
+ B.map((m) => /* @__PURE__ */ t.jsxs("div", { style: { display: "grid", justifyItems: m.role === "user" ? "end" : "start", gap: 6 }, children: [
546
524
  /* @__PURE__ */ t.jsx(
547
525
  "div",
548
526
  {
549
527
  style: {
550
528
  maxWidth: "85%",
551
529
  padding: "9px 11px",
552
- borderRadius: y.role === "user" ? "14px 14px 2px 14px" : "14px 14px 14px 2px",
553
- background: y.role === "user" ? "#4f46e5" : "#1f2937",
530
+ borderRadius: m.role === "user" ? "14px 14px 2px 14px" : "14px 14px 14px 2px",
531
+ background: m.role === "user" ? "#4f46e5" : "#1f2937",
554
532
  color: "#fff",
555
533
  fontSize: 13,
556
534
  whiteSpace: "pre-wrap"
557
535
  },
558
- children: y.content
536
+ children: m.content
559
537
  }
560
538
  ),
561
- y.role === "assistant" && /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
562
- /* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () => $(!0), children: "👍" }),
563
- /* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () => $(!1), children: "👎" })
539
+ m.role === "assistant" && /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
540
+ /* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () => Y(!0), children: "👍" }),
541
+ /* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () => Y(!1), children: "👎" })
564
542
  ] })
565
- ] }, y.id)),
566
- O && /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 5 }, children: [
543
+ ] }, m.id)),
544
+ I && /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 5 }, children: [
567
545
  /* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: 999, background: "#94a3b8", animation: "fp-dot 1s infinite 0ms" } }),
568
546
  /* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: 999, background: "#94a3b8", animation: "fp-dot 1s infinite 160ms" } }),
569
547
  /* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: 999, background: "#94a3b8", animation: "fp-dot 1s infinite 320ms" } })
570
548
  ] }),
571
- Y && /* @__PURE__ */ t.jsx("div", { style: { border: "1px solid #f59e0b", background: "#451a03", color: "#fde68a", borderRadius: 10, padding: 10, fontSize: 12 }, children: "Service temporarily unavailable." }),
572
- R && /* @__PURE__ */ t.jsxs("div", { style: { margin: "8px 0", padding: 12, background: "#f0f0ff", border: "1px solid #c7d2fe", borderRadius: 10, fontSize: 13, color: "#111827" }, children: [
573
- /* @__PURE__ */ t.jsxs("p", { style: { margin: "0 0 8px", fontWeight: 600 }, children: [
574
- "Want me to ",
575
- R.type,
576
- ' "',
577
- R.label,
578
- '"?'
579
- ] }),
580
- /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
581
- /* @__PURE__ */ t.jsx("button", { style: { padding: "6px 16px", background: "#6366f1", color: "#fff", border: "none", borderRadius: 6, cursor: "pointer", fontSize: 12 }, onClick: () => {
582
- M(!0);
583
- }, children: "✓ Yes, do it" }),
584
- /* @__PURE__ */ t.jsx("button", { style: { padding: "6px 16px", background: "transparent", border: "1px solid #c7d2fe", borderRadius: 6, cursor: "pointer", fontSize: 12, color: "#111827" }, onClick: () => {
585
- M(!1);
586
- }, children: "No thanks" })
587
- ] })
588
- ] }),
589
- e && /* @__PURE__ */ t.jsx("div", { style: { margin: "0 0 8px", padding: 10, background: "#ecfdf5", border: "1px solid #6ee7b7", borderRadius: 8, fontSize: 13, color: "#065f46" }, children: e })
549
+ O && /* @__PURE__ */ t.jsx("div", { style: { border: "1px solid #f59e0b", background: "#451a03", color: "#fde68a", borderRadius: 10, padding: 10, fontSize: 12 }, children: "Service temporarily unavailable." })
590
550
  ] }),
591
- /* @__PURE__ */ t.jsxs("form", { style: { padding: 10, borderTop: "1px solid #374151", display: "grid", gap: 8 }, onSubmit: E, children: [
551
+ /* @__PURE__ */ t.jsxs("form", { style: { padding: 10, borderTop: "1px solid #374151", display: "grid", gap: 8 }, onSubmit: U, children: [
592
552
  /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
593
553
  /* @__PURE__ */ t.jsx(
594
554
  "input",
595
555
  {
596
- value: S,
597
- disabled: O || Y,
598
- onChange: (y) => U(y.target.value),
556
+ value: R,
557
+ disabled: I || O,
558
+ onChange: (m) => J(m.target.value),
599
559
  style: { flex: 1, borderRadius: 10, border: "1px solid #475569", background: "#0f172a", color: "#fff", fontSize: 13, padding: "8px 10px", outline: "none" },
600
560
  placeholder: "Ask a question..."
601
561
  }
602
562
  ),
603
- /* @__PURE__ */ t.jsx("button", { type: "submit", disabled: !S.trim() || O || Y, style: { border: "none", borderRadius: 10, background: "#6366f1", color: "#fff", fontWeight: 600, fontSize: 12, padding: "0 14px", cursor: "pointer" }, children: "Send" })
563
+ /* @__PURE__ */ t.jsx("button", { type: "submit", disabled: !R.trim() || I || O, style: { border: "none", borderRadius: 10, background: "#6366f1", color: "#fff", fontWeight: 600, fontSize: 12, padding: "0 14px", cursor: "pointer" }, children: "Send" })
604
564
  ] }),
605
- g && /* @__PURE__ */ t.jsx("a", { href: g.url, style: { color: "#c4b5fd", fontSize: 12, textDecoration: "none" }, onClick: () => Q(!0), children: g.label })
565
+ i && /* @__PURE__ */ t.jsx("a", { href: i.url, style: { color: "#c4b5fd", fontSize: 12, textDecoration: "none" }, onClick: () => $(!0), children: i.label })
606
566
  ] })
607
567
  ]
608
568
  }
609
569
  )
610
570
  ] });
611
571
  }
612
- const xe = me({ tracker: null });
613
- function Ie({
614
- proxyEndpoint: s = "/api/fp-proxy",
615
- debug: k,
572
+ const ae = ce({ tracker: null });
573
+ function je({
574
+ proxyEndpoint: o = "/api/fp-proxy",
575
+ debug: g,
616
576
  consentRequired: a = !0,
617
577
  children: h
618
578
  }) {
619
- const i = X(null), l = X(new ce()), [b, x] = c(null), g = be((o) => {
620
- const d = l.current, m = d.setConsent({
621
- analytics: o.analytics,
622
- marketing: o.marketing,
579
+ const s = H(null), i = H(new K()), [b, x] = p(null), k = oe((c) => {
580
+ const u = i.current, y = u.setConsent({
581
+ analytics: c.analytics,
582
+ marketing: c.marketing,
623
583
  version: "1.0"
624
584
  });
625
- o.analytics || d.clearAnalyticsCookies(), i.current?.updateCookieData(d.getAllData(o.analytics)), i.current?.track("consent", "__consent__", {
626
- analytics: o.analytics,
627
- marketing: o.marketing,
628
- action: o.action,
585
+ c.analytics || u.clearAnalyticsCookies(), s.current?.updateCookieData(u.getAllData(c.analytics)), s.current?.track("consent", "__consent__", {
586
+ analytics: c.analytics,
587
+ marketing: c.marketing,
588
+ action: c.action,
629
589
  userAgent: navigator.userAgent,
630
- version: m.version
590
+ version: y.version
631
591
  });
632
592
  }, []);
633
- return te(() => {
634
- const o = new ve({ proxyEndpoint: s, debug: k });
635
- i.current = o, x(o);
636
- const d = l.current, m = d.getConsent();
637
- return a ? m && !d.isConsentExpired() ? o.updateCookieData(d.getAllData(m.analytics)) : o.updateCookieData(d.getAllData(!1)) : (d.setConsent({ analytics: !0, marketing: !0, version: "1.0" }), o.updateCookieData(d.getAllData(!0))), o.init(), () => {
638
- o.destroy(), i.current = null, x(null);
593
+ return G(() => {
594
+ const c = new ue({ proxyEndpoint: o, debug: g });
595
+ s.current = c, x(c);
596
+ const u = i.current, y = u.getConsent();
597
+ return a ? y && !u.isConsentExpired() ? c.updateCookieData(u.getAllData(y.analytics)) : c.updateCookieData(u.getAllData(!1)) : (u.setConsent({ analytics: !0, marketing: !0, version: "1.0" }), c.updateCookieData(u.getAllData(!0))), c.init(), () => {
598
+ c.destroy(), s.current = null, x(null);
639
599
  };
640
- }, [s, k, a]), /* @__PURE__ */ t.jsxs(xe.Provider, { value: { tracker: b }, children: [
600
+ }, [o, g, a]), /* @__PURE__ */ t.jsxs(ae.Provider, { value: { tracker: b }, children: [
641
601
  h,
642
- a && /* @__PURE__ */ t.jsx(Ee, { onConsent: g })
602
+ a && /* @__PURE__ */ t.jsx(he, { onConsent: k })
643
603
  ] });
644
604
  }
645
- function Te() {
646
- return ye(xe);
605
+ function ge() {
606
+ return de(ae);
647
607
  }
648
- function Ne({ id: s, placeholder: k, position: a = "bottom-right" }) {
649
- const { tracker: h } = Te(), [i, l] = c(a === "inline"), [b, x] = c(null), [g, o] = c(""), [d, m] = c(!1), w = () => {
650
- !b && !g.trim() || (h?.trackFeedback(s ?? null, b, g || null), m(!0), setTimeout(() => {
651
- l(a === "inline"), m(!1), x(null), o("");
608
+ function Re({ id: o, placeholder: g, position: a = "bottom-right" }) {
609
+ const { tracker: h } = ge(), [s, i] = p(a === "inline"), [b, x] = p(null), [k, c] = p(""), [u, y] = p(!1), j = () => {
610
+ !b && !k.trim() || (h?.trackFeedback(o ?? null, b, k || null), y(!0), setTimeout(() => {
611
+ i(a === "inline"), y(!1), x(null), c("");
652
612
  }, 2e3));
653
- }, p = a !== "inline" ? { position: "fixed", bottom: 24, [a === "bottom-right" ? "right" : "left"]: 24, zIndex: 9999 } : {};
654
- return /* @__PURE__ */ t.jsxs("div", { style: p, children: [
613
+ }, d = a !== "inline" ? { position: "fixed", bottom: 24, [a === "bottom-right" ? "right" : "left"]: 24, zIndex: 9999 } : {};
614
+ return /* @__PURE__ */ t.jsxs("div", { style: d, children: [
655
615
  a !== "inline" && /* @__PURE__ */ t.jsx(
656
616
  "button",
657
617
  {
658
- onClick: () => l(!i),
618
+ onClick: () => i(!s),
659
619
  style: { background: "#6366f1", color: "#fff", border: "none", borderRadius: "50%", width: 48, height: 48, fontSize: 20, cursor: "pointer" },
660
620
  children: "💬"
661
621
  }
662
622
  ),
663
- i && /* @__PURE__ */ t.jsx("div", { style: { background: "#fff", border: "1px solid #e5e7eb", borderRadius: 12, padding: 16, width: 280, boxShadow: "0 10px 25px rgba(0,0,0,0.15)" }, children: d ? /* @__PURE__ */ t.jsxs("div", { style: { textAlign: "center", padding: 16 }, children: [
623
+ s && /* @__PURE__ */ t.jsx("div", { style: { background: "#fff", border: "1px solid #e5e7eb", borderRadius: 12, padding: 16, width: 280, boxShadow: "0 10px 25px rgba(0,0,0,0.15)" }, children: u ? /* @__PURE__ */ t.jsxs("div", { style: { textAlign: "center", padding: 16 }, children: [
664
624
  /* @__PURE__ */ t.jsx("p", { style: { fontSize: 28, margin: 0 }, children: "🎉" }),
665
625
  /* @__PURE__ */ t.jsx("p", { style: { margin: "8px 0 0", fontWeight: 600 }, children: "Thanks for your feedback!" })
666
626
  ] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
667
- /* @__PURE__ */ t.jsx("p", { style: { margin: "0 0 12px", fontWeight: 600 }, children: k ?? "How was your experience?" }),
668
- /* @__PURE__ */ t.jsx("div", { style: { display: "flex", gap: 6, marginBottom: 12 }, children: [1, 2, 3, 4, 5].map((j) => /* @__PURE__ */ t.jsx(
627
+ /* @__PURE__ */ t.jsx("p", { style: { margin: "0 0 12px", fontWeight: 600 }, children: g ?? "How was your experience?" }),
628
+ /* @__PURE__ */ t.jsx("div", { style: { display: "flex", gap: 6, marginBottom: 12 }, children: [1, 2, 3, 4, 5].map((w) => /* @__PURE__ */ t.jsx(
669
629
  "button",
670
630
  {
671
- onClick: () => x(j),
672
- style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity: b !== null && j <= b ? 1 : 0.3 },
631
+ onClick: () => x(w),
632
+ style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity: b !== null && w <= b ? 1 : 0.3 },
673
633
  children: "⭐"
674
634
  },
675
- j
635
+ w
676
636
  )) }),
677
637
  /* @__PURE__ */ t.jsx(
678
638
  "textarea",
679
639
  {
680
- value: g,
681
- onChange: (j) => o(j.target.value),
640
+ value: k,
641
+ onChange: (w) => c(w.target.value),
682
642
  placeholder: "Tell us more (optional)...",
683
643
  rows: 3,
684
644
  style: { width: "100%", padding: 8, border: "1px solid #d1d5db", borderRadius: 8, resize: "none", fontSize: 14 }
@@ -687,7 +647,7 @@ function Ne({ id: s, placeholder: k, position: a = "bottom-right" }) {
687
647
  /* @__PURE__ */ t.jsx(
688
648
  "button",
689
649
  {
690
- onClick: w,
650
+ onClick: j,
691
651
  style: { marginTop: 10, width: "100%", background: "#6366f1", color: "#fff", border: "none", borderRadius: 8, padding: 10, fontWeight: 600, cursor: "pointer" },
692
652
  children: "Submit Feedback"
693
653
  }
@@ -696,9 +656,9 @@ function Ne({ id: s, placeholder: k, position: a = "bottom-right" }) {
696
656
  ] });
697
657
  }
698
658
  export {
699
- Ee as ConsentBanner,
700
- Oe as FeedPulseBot,
701
- Ie as FeedPulseProvider,
702
- Ne as FeedPulseWidget,
703
- Te as useFeedPulse
659
+ he as ConsentBanner,
660
+ we as FeedPulseBot,
661
+ je as FeedPulseProvider,
662
+ Re as FeedPulseWidget,
663
+ ge as useFeedPulse
704
664
  };