@tekibo/feedpulse-sdk 0.7.1 → 0.7.3
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/bin/feedpulse-bot-build.mjs +121 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +171 -93
- package/dist/nuxt.js +2 -2
- package/dist/nuxt.mjs +336 -283
- package/dist/react.js +3 -3
- package/dist/react.mjs +315 -275
- package/dist/server.js +1 -0
- package/dist/server.mjs +18 -0
- package/package.json +11 -2
- package/templates/nuxt-bot-proxy.ts +39 -2
- package/templates/nuxt-config-id-route.ts +15 -0
package/dist/react.mjs
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CookieManager as
|
|
3
|
-
import { S as
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
function a(h,
|
|
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) {
|
|
11
11
|
var b = null;
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
for (var x in
|
|
15
|
-
x !== "key" && (
|
|
16
|
-
} else
|
|
17
|
-
return
|
|
18
|
-
$$typeof:
|
|
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,
|
|
19
19
|
type: h,
|
|
20
20
|
key: b,
|
|
21
|
-
ref:
|
|
22
|
-
props:
|
|
21
|
+
ref: i !== void 0 ? i : null,
|
|
22
|
+
props: l
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return G.Fragment = k, G.jsx = a, G.jsxs = a, G;
|
|
26
26
|
}
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
return
|
|
31
|
-
function
|
|
27
|
+
var H = {};
|
|
28
|
+
var ue;
|
|
29
|
+
function Se() {
|
|
30
|
+
return ue || (ue = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
31
|
+
function s(e) {
|
|
32
32
|
if (e == null) return null;
|
|
33
33
|
if (typeof e == "function")
|
|
34
|
-
return e.$$typeof ===
|
|
34
|
+
return e.$$typeof === Y ? null : e.displayName || e.name || null;
|
|
35
35
|
if (typeof e == "string") return e;
|
|
36
36
|
switch (e) {
|
|
37
|
-
case
|
|
37
|
+
case T:
|
|
38
38
|
return "Fragment";
|
|
39
|
-
case
|
|
39
|
+
case oe:
|
|
40
40
|
return "Profiler";
|
|
41
|
-
case
|
|
41
|
+
case ne:
|
|
42
42
|
return "StrictMode";
|
|
43
|
-
case
|
|
43
|
+
case se:
|
|
44
44
|
return "Suspense";
|
|
45
|
-
case
|
|
45
|
+
case ae:
|
|
46
46
|
return "SuspenseList";
|
|
47
|
-
case
|
|
47
|
+
case Q:
|
|
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
|
|
54
|
+
case re:
|
|
55
55
|
return "Portal";
|
|
56
|
-
case $:
|
|
57
|
-
return e.displayName || "Context";
|
|
58
56
|
case Z:
|
|
57
|
+
return e.displayName || "Context";
|
|
58
|
+
case L:
|
|
59
59
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
60
|
-
case
|
|
60
|
+
case A:
|
|
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 :
|
|
65
|
-
case
|
|
63
|
+
case $:
|
|
64
|
+
return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo";
|
|
65
|
+
case B:
|
|
66
66
|
r = e._payload, e = e._init;
|
|
67
67
|
try {
|
|
68
|
-
return
|
|
68
|
+
return s(e(r));
|
|
69
69
|
} catch {
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function k(e) {
|
|
75
75
|
return "" + e;
|
|
76
76
|
}
|
|
77
77
|
function a(e) {
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
k(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,
|
|
86
|
+
var n = r.error, u = 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
|
-
|
|
91
|
-
),
|
|
90
|
+
u
|
|
91
|
+
), k(e);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
function h(e) {
|
|
95
|
-
if (e ===
|
|
96
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
95
|
+
if (e === T) return "<>";
|
|
96
|
+
if (typeof e == "object" && e !== null && e.$$typeof === B)
|
|
97
97
|
return "<...>";
|
|
98
98
|
try {
|
|
99
|
-
var r =
|
|
99
|
+
var r = s(e);
|
|
100
100
|
return r ? "<" + r + ">" : "<...>";
|
|
101
101
|
} catch {
|
|
102
102
|
return "<...>";
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
var e =
|
|
105
|
+
function i() {
|
|
106
|
+
var e = C.A;
|
|
107
107
|
return e === null ? null : e.getOwner();
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function l() {
|
|
110
110
|
return Error("react-stack-top-frame");
|
|
111
111
|
}
|
|
112
112
|
function b(e) {
|
|
113
|
-
if (
|
|
113
|
+
if (J.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 be() {
|
|
|
128
128
|
configurable: !0
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
var e =
|
|
133
|
-
return
|
|
131
|
+
function g() {
|
|
132
|
+
var e = s(this.type);
|
|
133
|
+
return O[e] || (O[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
|
|
138
|
-
var
|
|
137
|
+
function o(e, r, n, u, D, W) {
|
|
138
|
+
var f = n.ref;
|
|
139
139
|
return e = {
|
|
140
|
-
$$typeof:
|
|
140
|
+
$$typeof: j,
|
|
141
141
|
type: e,
|
|
142
142
|
key: r,
|
|
143
143
|
props: n,
|
|
144
|
-
_owner:
|
|
145
|
-
}, (
|
|
144
|
+
_owner: u
|
|
145
|
+
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
|
|
146
146
|
enumerable: !1,
|
|
147
|
-
get:
|
|
147
|
+
get: g
|
|
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 be() {
|
|
|
159
159
|
configurable: !1,
|
|
160
160
|
enumerable: !1,
|
|
161
161
|
writable: !0,
|
|
162
|
-
value:
|
|
162
|
+
value: D
|
|
163
163
|
}), Object.defineProperty(e, "_debugTask", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
166
166
|
writable: !0,
|
|
167
|
-
value:
|
|
167
|
+
value: W
|
|
168
168
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
var
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
if (
|
|
175
|
-
for (
|
|
176
|
-
|
|
177
|
-
Object.freeze && Object.freeze(
|
|
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);
|
|
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
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
var
|
|
186
|
-
return
|
|
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";
|
|
187
187
|
});
|
|
188
|
-
|
|
188
|
+
u = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", I[f + u] || (E = 0 < E.length ? "{" + E.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,
|
|
195
196
|
f,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
), P[l + f] = !0);
|
|
197
|
+
E,
|
|
198
|
+
f
|
|
199
|
+
), I[f + u] = !0);
|
|
200
200
|
}
|
|
201
|
-
if (
|
|
201
|
+
if (f = null, n !== void 0 && (a(n), f = "" + n), b(r) && (a(r.key), f = "" + r.key), "key" in r) {
|
|
202
202
|
n = {};
|
|
203
|
-
for (var
|
|
204
|
-
|
|
203
|
+
for (var M in r)
|
|
204
|
+
M !== "key" && (n[M] = r[M]);
|
|
205
205
|
} else n = r;
|
|
206
|
-
return
|
|
206
|
+
return f && x(
|
|
207
207
|
n,
|
|
208
208
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
209
|
-
),
|
|
209
|
+
), o(
|
|
210
210
|
e,
|
|
211
|
-
|
|
211
|
+
f,
|
|
212
212
|
n,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
i(),
|
|
214
|
+
D,
|
|
215
|
+
W
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
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));
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
221
|
+
function w(e) {
|
|
222
|
+
return typeof e == "object" && e !== null && e.$$typeof === j;
|
|
223
223
|
}
|
|
224
|
-
var
|
|
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() {
|
|
225
225
|
return null;
|
|
226
226
|
};
|
|
227
|
-
|
|
227
|
+
p = {
|
|
228
228
|
react_stack_bottom_frame: function(e) {
|
|
229
229
|
return e();
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
|
-
var U,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
)(),
|
|
236
|
-
|
|
237
|
-
var
|
|
238
|
-
return
|
|
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(
|
|
239
239
|
e,
|
|
240
240
|
r,
|
|
241
241
|
n,
|
|
242
242
|
!1,
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
u ? Error("react-stack-top-frame") : V,
|
|
244
|
+
u ? S(h(e)) : R
|
|
245
245
|
);
|
|
246
|
-
},
|
|
247
|
-
var
|
|
248
|
-
return
|
|
246
|
+
}, H.jsxs = function(e, r, n) {
|
|
247
|
+
var u = 1e4 > C.recentlyCreatedOwnerStacks++;
|
|
248
|
+
return d(
|
|
249
249
|
e,
|
|
250
250
|
r,
|
|
251
251
|
n,
|
|
252
252
|
!0,
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
u ? Error("react-stack-top-frame") : V,
|
|
254
|
+
u ? S(h(e)) : R
|
|
255
255
|
);
|
|
256
256
|
};
|
|
257
|
-
})()),
|
|
257
|
+
})()), H;
|
|
258
258
|
}
|
|
259
|
-
var
|
|
260
|
-
function
|
|
261
|
-
return
|
|
259
|
+
var fe;
|
|
260
|
+
function Re() {
|
|
261
|
+
return fe || (fe = 1, process.env.NODE_ENV === "production" ? ee.exports = je() : ee.exports = Se()), ee.exports;
|
|
262
262
|
}
|
|
263
|
-
var t =
|
|
264
|
-
const
|
|
265
|
-
function
|
|
266
|
-
const [
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
a(!
|
|
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));
|
|
270
270
|
}, []);
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
}, [
|
|
280
|
-
return
|
|
281
|
-
const
|
|
282
|
-
a(!0),
|
|
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);
|
|
283
283
|
};
|
|
284
|
-
return window.addEventListener("feedpulse:open-consent",
|
|
285
|
-
window.removeEventListener("feedpulse:open-consent",
|
|
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);
|
|
286
286
|
};
|
|
287
|
-
}, [
|
|
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: [
|
|
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 he({ onConsent: o }) {
|
|
|
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:
|
|
299
|
+
/* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: l, onChange: (p) => b(p.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: (
|
|
303
|
+
/* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: x, onChange: (p) => g(p.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:
|
|
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:
|
|
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 ?
|
|
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" })
|
|
311
311
|
] })
|
|
312
312
|
] }) }) : null;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function _e() {
|
|
315
315
|
if (typeof document > "u" || document.getElementById("fp-bot-animations"))
|
|
316
316
|
return;
|
|
317
|
-
const
|
|
318
|
-
|
|
317
|
+
const s = document.createElement("style");
|
|
318
|
+
s.id = "fp-bot-animations", s.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,126 +334,148 @@ function me() {
|
|
|
334
334
|
50% { opacity: 1; transform: translateY(-3px); }
|
|
335
335
|
100% { opacity: 0.2; transform: translateY(0); }
|
|
336
336
|
}
|
|
337
|
-
`, document.head.appendChild(
|
|
337
|
+
`, document.head.appendChild(s);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
faq:
|
|
341
|
-
pageContext:
|
|
342
|
-
systemPrompt: a
|
|
343
|
-
canNavigate: h
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
|
348
353
|
}) {
|
|
349
|
-
const
|
|
350
|
-
() =>
|
|
351
|
-
|
|
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]
|
|
352
368
|
);
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
onTrigger: async (
|
|
357
|
-
|
|
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);
|
|
358
374
|
try {
|
|
359
|
-
const
|
|
375
|
+
const K = p.current.getAllData(!0), N = await fetch("/api/bot/session-proxy", {
|
|
360
376
|
method: "POST",
|
|
361
377
|
headers: { "content-type": "application/json" },
|
|
362
378
|
body: JSON.stringify({
|
|
363
379
|
page: window.location.pathname,
|
|
364
|
-
triggerScore:
|
|
365
|
-
triggerReasons:
|
|
366
|
-
sessionId:
|
|
367
|
-
visitorId:
|
|
380
|
+
triggerScore: F,
|
|
381
|
+
triggerReasons: q,
|
|
382
|
+
sessionId: K.sessionId,
|
|
383
|
+
visitorId: K.userId,
|
|
368
384
|
device: navigator.userAgent
|
|
369
385
|
})
|
|
370
386
|
});
|
|
371
|
-
if (
|
|
372
|
-
|
|
387
|
+
if (N.status === 402) {
|
|
388
|
+
C(!0);
|
|
373
389
|
return;
|
|
374
390
|
}
|
|
375
|
-
const
|
|
376
|
-
|
|
391
|
+
const v = await N.json().catch(() => null);
|
|
392
|
+
v?.botSessionId && se(v.botSessionId);
|
|
377
393
|
} catch {
|
|
378
394
|
}
|
|
379
395
|
}
|
|
380
396
|
});
|
|
381
|
-
return
|
|
382
|
-
|
|
397
|
+
return y.start(), () => {
|
|
398
|
+
y.stop(), n.current && clearTimeout(n.current);
|
|
383
399
|
};
|
|
384
400
|
}, []);
|
|
385
|
-
const
|
|
401
|
+
const f = {
|
|
386
402
|
position: "fixed",
|
|
387
403
|
bottom: 24,
|
|
388
404
|
zIndex: 1e4,
|
|
389
|
-
...
|
|
390
|
-
},
|
|
391
|
-
if (
|
|
405
|
+
...d === "bottom-left" ? { left: 24 } : { right: 24 }
|
|
406
|
+
}, E = (y) => {
|
|
407
|
+
if (y.preventDefault(), !S.trim() || Y || O || !A)
|
|
392
408
|
return;
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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 () => {
|
|
397
416
|
try {
|
|
398
|
-
const
|
|
417
|
+
const v = await fetch("/api/bot/chat-proxy", {
|
|
399
418
|
method: "POST",
|
|
400
419
|
headers: { "content-type": "application/json" },
|
|
401
420
|
body: JSON.stringify({
|
|
402
421
|
botSessionId: A,
|
|
403
|
-
config:
|
|
404
|
-
|
|
422
|
+
config: JSON.parse(JSON.stringify(W)),
|
|
423
|
+
configId: w,
|
|
424
|
+
page: u,
|
|
425
|
+
messages: q
|
|
405
426
|
})
|
|
406
427
|
});
|
|
407
|
-
if (
|
|
408
|
-
|
|
428
|
+
if (v.status === 402) {
|
|
429
|
+
C(!0), P((le) => le.map((z) => z.id === N ? { ...z, content: "Service temporarily unavailable." } : z));
|
|
409
430
|
return;
|
|
410
431
|
}
|
|
411
|
-
if (!
|
|
432
|
+
if (!v.ok)
|
|
412
433
|
throw new Error("chat failed");
|
|
413
|
-
const
|
|
414
|
-
|
|
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
|
-
}
|
|
434
|
+
const _ = await v.json();
|
|
435
|
+
P((le) => le.map((z) => z.id === N ? { ...z, content: _.text || "" } : z)), _.action && I(_.action);
|
|
425
436
|
} catch {
|
|
426
|
-
|
|
437
|
+
P((v) => v.map((_) => _.id === N && !_.content ? { ..._, content: "Sorry, I couldn't process that. Please try again." } : _));
|
|
427
438
|
} finally {
|
|
428
|
-
|
|
439
|
+
V(!1);
|
|
429
440
|
}
|
|
430
441
|
})();
|
|
431
|
-
},
|
|
432
|
-
if (
|
|
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) {
|
|
433
455
|
try {
|
|
434
456
|
await fetch("/api/bot/session-end-proxy", {
|
|
435
457
|
method: "POST",
|
|
436
458
|
headers: { "content-type": "application/json" },
|
|
437
459
|
body: JSON.stringify({
|
|
438
460
|
botSessionId: A,
|
|
439
|
-
wasHelpful:
|
|
440
|
-
escalated:
|
|
461
|
+
wasHelpful: ae,
|
|
462
|
+
escalated: B
|
|
441
463
|
})
|
|
442
464
|
});
|
|
443
465
|
} catch {
|
|
444
466
|
}
|
|
445
|
-
|
|
467
|
+
P([]), I(null), r(null);
|
|
446
468
|
}
|
|
447
469
|
};
|
|
448
|
-
return /* @__PURE__ */ t.jsxs("div", { style:
|
|
449
|
-
|
|
470
|
+
return /* @__PURE__ */ t.jsxs("div", { style: f, children: [
|
|
471
|
+
re && !L && /* @__PURE__ */ t.jsx(
|
|
450
472
|
"div",
|
|
451
473
|
{
|
|
452
474
|
style: {
|
|
453
475
|
position: "absolute",
|
|
454
476
|
bottom: 62,
|
|
455
|
-
right:
|
|
456
|
-
left:
|
|
477
|
+
right: d === "bottom-right" ? 0 : void 0,
|
|
478
|
+
left: d === "bottom-left" ? 0 : void 0,
|
|
457
479
|
background: "#fff",
|
|
458
480
|
border: "2px solid #6366f1",
|
|
459
481
|
color: "#1f2937",
|
|
@@ -464,10 +486,10 @@ function we({
|
|
|
464
486
|
boxShadow: "0 10px 22px rgba(0,0,0,0.16)",
|
|
465
487
|
animation: "fp-bubble-in 300ms ease-out"
|
|
466
488
|
},
|
|
467
|
-
children:
|
|
489
|
+
children: W.initialMessage || o
|
|
468
490
|
}
|
|
469
491
|
),
|
|
470
|
-
|
|
492
|
+
ne && !L && /* @__PURE__ */ t.jsx(
|
|
471
493
|
"button",
|
|
472
494
|
{
|
|
473
495
|
style: {
|
|
@@ -483,7 +505,7 @@ function we({
|
|
|
483
505
|
animation: "fp-bounce 600ms ease-out"
|
|
484
506
|
},
|
|
485
507
|
onClick: () => {
|
|
486
|
-
|
|
508
|
+
Z(!0), T(!1);
|
|
487
509
|
},
|
|
488
510
|
children: /* @__PURE__ */ t.jsxs("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "2", children: [
|
|
489
511
|
/* @__PURE__ */ t.jsx("rect", { x: "3", y: "8", width: "18", height: "13", rx: "2" }),
|
|
@@ -495,7 +517,7 @@ function we({
|
|
|
495
517
|
] })
|
|
496
518
|
}
|
|
497
519
|
),
|
|
498
|
-
|
|
520
|
+
L && !!A && /* @__PURE__ */ t.jsxs(
|
|
499
521
|
"div",
|
|
500
522
|
{
|
|
501
523
|
style: {
|
|
@@ -517,128 +539,146 @@ function we({
|
|
|
517
539
|
/* @__PURE__ */ t.jsx("strong", { style: { fontSize: 14, color: "#fff" }, children: "Pulse Bot" }),
|
|
518
540
|
/* @__PURE__ */ t.jsx("span", { style: { fontSize: 11, color: "#94a3b8" }, children: "Powered by FeedPulse AI" })
|
|
519
541
|
] }),
|
|
520
|
-
/* @__PURE__ */ t.jsx("button", { style: { border: "none", background: "transparent", color: "#cbd5e1", cursor: "pointer", fontSize: 18 }, onClick:
|
|
542
|
+
/* @__PURE__ */ t.jsx("button", { style: { border: "none", background: "transparent", color: "#cbd5e1", cursor: "pointer", fontSize: 18 }, onClick: ie, children: "×" })
|
|
521
543
|
] }),
|
|
522
544
|
/* @__PURE__ */ t.jsxs("div", { style: { flex: 1, overflowY: "auto", padding: 12, display: "grid", gap: 10 }, children: [
|
|
523
|
-
|
|
545
|
+
J.map((y) => /* @__PURE__ */ t.jsxs("div", { style: { display: "grid", justifyItems: y.role === "user" ? "end" : "start", gap: 6 }, children: [
|
|
524
546
|
/* @__PURE__ */ t.jsx(
|
|
525
547
|
"div",
|
|
526
548
|
{
|
|
527
549
|
style: {
|
|
528
550
|
maxWidth: "85%",
|
|
529
551
|
padding: "9px 11px",
|
|
530
|
-
borderRadius:
|
|
531
|
-
background:
|
|
552
|
+
borderRadius: y.role === "user" ? "14px 14px 2px 14px" : "14px 14px 14px 2px",
|
|
553
|
+
background: y.role === "user" ? "#4f46e5" : "#1f2937",
|
|
532
554
|
color: "#fff",
|
|
533
555
|
fontSize: 13,
|
|
534
556
|
whiteSpace: "pre-wrap"
|
|
535
557
|
},
|
|
536
|
-
children:
|
|
558
|
+
children: y.content
|
|
537
559
|
}
|
|
538
560
|
),
|
|
539
|
-
|
|
540
|
-
/* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () =>
|
|
541
|
-
/* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () =>
|
|
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: "👎" })
|
|
542
564
|
] })
|
|
543
|
-
] },
|
|
544
|
-
|
|
565
|
+
] }, y.id)),
|
|
566
|
+
O && /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 5 }, children: [
|
|
545
567
|
/* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: 999, background: "#94a3b8", animation: "fp-dot 1s infinite 0ms" } }),
|
|
546
568
|
/* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: 999, background: "#94a3b8", animation: "fp-dot 1s infinite 160ms" } }),
|
|
547
569
|
/* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: 999, background: "#94a3b8", animation: "fp-dot 1s infinite 320ms" } })
|
|
548
570
|
] }),
|
|
549
|
-
|
|
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 })
|
|
550
590
|
] }),
|
|
551
|
-
/* @__PURE__ */ t.jsxs("form", { style: { padding: 10, borderTop: "1px solid #374151", display: "grid", gap: 8 }, onSubmit:
|
|
591
|
+
/* @__PURE__ */ t.jsxs("form", { style: { padding: 10, borderTop: "1px solid #374151", display: "grid", gap: 8 }, onSubmit: E, children: [
|
|
552
592
|
/* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
553
593
|
/* @__PURE__ */ t.jsx(
|
|
554
594
|
"input",
|
|
555
595
|
{
|
|
556
|
-
value:
|
|
557
|
-
disabled:
|
|
558
|
-
onChange: (
|
|
596
|
+
value: S,
|
|
597
|
+
disabled: O || Y,
|
|
598
|
+
onChange: (y) => U(y.target.value),
|
|
559
599
|
style: { flex: 1, borderRadius: 10, border: "1px solid #475569", background: "#0f172a", color: "#fff", fontSize: 13, padding: "8px 10px", outline: "none" },
|
|
560
600
|
placeholder: "Ask a question..."
|
|
561
601
|
}
|
|
562
602
|
),
|
|
563
|
-
/* @__PURE__ */ t.jsx("button", { type: "submit", disabled: !
|
|
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" })
|
|
564
604
|
] }),
|
|
565
|
-
|
|
605
|
+
g && /* @__PURE__ */ t.jsx("a", { href: g.url, style: { color: "#c4b5fd", fontSize: 12, textDecoration: "none" }, onClick: () => Q(!0), children: g.label })
|
|
566
606
|
] })
|
|
567
607
|
]
|
|
568
608
|
}
|
|
569
609
|
)
|
|
570
610
|
] });
|
|
571
611
|
}
|
|
572
|
-
const
|
|
573
|
-
function
|
|
574
|
-
proxyEndpoint:
|
|
575
|
-
debug:
|
|
612
|
+
const xe = me({ tracker: null });
|
|
613
|
+
function Ie({
|
|
614
|
+
proxyEndpoint: s = "/api/fp-proxy",
|
|
615
|
+
debug: k,
|
|
576
616
|
consentRequired: a = !0,
|
|
577
617
|
children: h
|
|
578
618
|
}) {
|
|
579
|
-
const
|
|
580
|
-
const
|
|
581
|
-
analytics:
|
|
582
|
-
marketing:
|
|
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,
|
|
583
623
|
version: "1.0"
|
|
584
624
|
});
|
|
585
|
-
|
|
586
|
-
analytics:
|
|
587
|
-
marketing:
|
|
588
|
-
action:
|
|
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,
|
|
589
629
|
userAgent: navigator.userAgent,
|
|
590
|
-
version:
|
|
630
|
+
version: m.version
|
|
591
631
|
});
|
|
592
632
|
}, []);
|
|
593
|
-
return
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
return a ?
|
|
598
|
-
|
|
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);
|
|
599
639
|
};
|
|
600
|
-
}, [
|
|
640
|
+
}, [s, k, a]), /* @__PURE__ */ t.jsxs(xe.Provider, { value: { tracker: b }, children: [
|
|
601
641
|
h,
|
|
602
|
-
a && /* @__PURE__ */ t.jsx(
|
|
642
|
+
a && /* @__PURE__ */ t.jsx(Ee, { onConsent: g })
|
|
603
643
|
] });
|
|
604
644
|
}
|
|
605
|
-
function
|
|
606
|
-
return
|
|
645
|
+
function Te() {
|
|
646
|
+
return ye(xe);
|
|
607
647
|
}
|
|
608
|
-
function
|
|
609
|
-
const { tracker: h } =
|
|
610
|
-
!b && !
|
|
611
|
-
|
|
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("");
|
|
612
652
|
}, 2e3));
|
|
613
|
-
},
|
|
614
|
-
return /* @__PURE__ */ t.jsxs("div", { style:
|
|
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: [
|
|
615
655
|
a !== "inline" && /* @__PURE__ */ t.jsx(
|
|
616
656
|
"button",
|
|
617
657
|
{
|
|
618
|
-
onClick: () =>
|
|
658
|
+
onClick: () => l(!i),
|
|
619
659
|
style: { background: "#6366f1", color: "#fff", border: "none", borderRadius: "50%", width: 48, height: 48, fontSize: 20, cursor: "pointer" },
|
|
620
660
|
children: "💬"
|
|
621
661
|
}
|
|
622
662
|
),
|
|
623
|
-
|
|
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: [
|
|
624
664
|
/* @__PURE__ */ t.jsx("p", { style: { fontSize: 28, margin: 0 }, children: "🎉" }),
|
|
625
665
|
/* @__PURE__ */ t.jsx("p", { style: { margin: "8px 0 0", fontWeight: 600 }, children: "Thanks for your feedback!" })
|
|
626
666
|
] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
627
|
-
/* @__PURE__ */ t.jsx("p", { style: { margin: "0 0 12px", fontWeight: 600 }, children:
|
|
628
|
-
/* @__PURE__ */ t.jsx("div", { style: { display: "flex", gap: 6, marginBottom: 12 }, children: [1, 2, 3, 4, 5].map((
|
|
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(
|
|
629
669
|
"button",
|
|
630
670
|
{
|
|
631
|
-
onClick: () => x(
|
|
632
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity: b !== null &&
|
|
671
|
+
onClick: () => x(j),
|
|
672
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity: b !== null && j <= b ? 1 : 0.3 },
|
|
633
673
|
children: "⭐"
|
|
634
674
|
},
|
|
635
|
-
|
|
675
|
+
j
|
|
636
676
|
)) }),
|
|
637
677
|
/* @__PURE__ */ t.jsx(
|
|
638
678
|
"textarea",
|
|
639
679
|
{
|
|
640
|
-
value:
|
|
641
|
-
onChange: (
|
|
680
|
+
value: g,
|
|
681
|
+
onChange: (j) => o(j.target.value),
|
|
642
682
|
placeholder: "Tell us more (optional)...",
|
|
643
683
|
rows: 3,
|
|
644
684
|
style: { width: "100%", padding: 8, border: "1px solid #d1d5db", borderRadius: 8, resize: "none", fontSize: 14 }
|
|
@@ -647,7 +687,7 @@ function Re({ id: o, placeholder: g, position: a = "bottom-right" }) {
|
|
|
647
687
|
/* @__PURE__ */ t.jsx(
|
|
648
688
|
"button",
|
|
649
689
|
{
|
|
650
|
-
onClick:
|
|
690
|
+
onClick: w,
|
|
651
691
|
style: { marginTop: 10, width: "100%", background: "#6366f1", color: "#fff", border: "none", borderRadius: 8, padding: 10, fontWeight: 600, cursor: "pointer" },
|
|
652
692
|
children: "Submit Feedback"
|
|
653
693
|
}
|
|
@@ -656,9 +696,9 @@ function Re({ id: o, placeholder: g, position: a = "bottom-right" }) {
|
|
|
656
696
|
] });
|
|
657
697
|
}
|
|
658
698
|
export {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
699
|
+
Ee as ConsentBanner,
|
|
700
|
+
Oe as FeedPulseBot,
|
|
701
|
+
Ie as FeedPulseProvider,
|
|
702
|
+
Ne as FeedPulseWidget,
|
|
703
|
+
Te as useFeedPulse
|
|
664
704
|
};
|