@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.
- package/README.md +83 -83
- package/dist/core/cookies.d.ts +37 -0
- package/dist/core/struggle-detector.d.ts +33 -0
- package/dist/core/tracker.d.ts +38 -0
- package/dist/core/types.d.ts +59 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +127 -176
- package/dist/nuxt/BotPanel.vue.d.ts +17 -0
- package/dist/nuxt/FeedPulseBot.vue.d.ts +24 -0
- package/dist/nuxt/FeedPulseProvider.vue.d.ts +21 -0
- package/dist/nuxt/FeedPulseWidget.vue.d.ts +10 -0
- package/dist/nuxt/composables.d.ts +4 -0
- package/dist/nuxt/consent-banner.vue.d.ts +16 -0
- package/dist/nuxt/index.d.ts +5 -0
- package/dist/nuxt.d.ts +2 -0
- package/dist/nuxt.js +2 -2
- package/dist/nuxt.mjs +283 -336
- package/dist/react/FeedPulseBot.d.ts +21 -0
- package/dist/react/FeedPulseProvider.d.ts +13 -0
- package/dist/react/FeedPulseWidget.d.ts +8 -0
- package/dist/react/consent-banner.d.ts +11 -0
- package/dist/react/hooks.d.ts +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +3 -3
- package/dist/react.mjs +275 -315
- package/dist/struggle-detector-CT3YShuG.js +1 -0
- package/dist/{struggle-detector-BqTHgw95.mjs → struggle-detector-Cwe3PD9s.mjs} +40 -25
- package/package.json +4 -11
- package/templates/nextjs-proxy.ts +36 -36
- package/templates/nuxt-bot-proxy.ts +60 -93
- package/templates/nuxt-proxy.ts +44 -44
- package/bin/feedpulse-bot-build.mjs +0 -121
- package/dist/server.js +0 -1
- package/dist/server.mjs +0 -18
- package/dist/struggle-detector-DV52qDLp.js +0 -1
- package/templates/nuxt-config-id-route.ts +0 -15
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 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 (
|
|
13
|
-
|
|
14
|
-
for (var x in
|
|
15
|
-
x !== "key" && (
|
|
16
|
-
} else
|
|
17
|
-
return
|
|
18
|
-
$$typeof:
|
|
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:
|
|
22
|
-
props:
|
|
21
|
+
ref: s !== void 0 ? s : null,
|
|
22
|
+
props: i
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return W.Fragment = g, W.jsx = a, W.jsxs = a, W;
|
|
26
26
|
}
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
return
|
|
31
|
-
function
|
|
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 ===
|
|
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
|
|
37
|
+
case D:
|
|
38
38
|
return "Fragment";
|
|
39
|
-
case
|
|
39
|
+
case Y:
|
|
40
40
|
return "Profiler";
|
|
41
|
-
case
|
|
41
|
+
case X:
|
|
42
42
|
return "StrictMode";
|
|
43
|
-
case
|
|
43
|
+
case M:
|
|
44
44
|
return "Suspense";
|
|
45
|
-
case
|
|
45
|
+
case B:
|
|
46
46
|
return "SuspenseList";
|
|
47
|
-
case
|
|
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
|
|
54
|
+
case A:
|
|
55
55
|
return "Portal";
|
|
56
|
-
case
|
|
56
|
+
case $:
|
|
57
57
|
return e.displayName || "Context";
|
|
58
|
-
case
|
|
58
|
+
case Z:
|
|
59
59
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
60
|
-
case
|
|
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 :
|
|
65
|
-
case
|
|
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
|
|
68
|
+
return o(e(r));
|
|
69
69
|
} catch {
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function g(e) {
|
|
75
75
|
return "" + e;
|
|
76
76
|
}
|
|
77
77
|
function a(e) {
|
|
78
78
|
try {
|
|
79
|
-
|
|
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,
|
|
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
|
-
|
|
91
|
-
),
|
|
90
|
+
f
|
|
91
|
+
), g(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 === D) return "<>";
|
|
96
|
+
if (typeof e == "object" && e !== null && e.$$typeof === R)
|
|
97
97
|
return "<...>";
|
|
98
98
|
try {
|
|
99
|
-
var r =
|
|
99
|
+
var r = o(e);
|
|
100
100
|
return r ? "<" + r + ">" : "<...>";
|
|
101
101
|
} catch {
|
|
102
102
|
return "<...>";
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
var e =
|
|
105
|
+
function s() {
|
|
106
|
+
var e = N.A;
|
|
107
107
|
return e === null ? null : e.getOwner();
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function i() {
|
|
110
110
|
return Error("react-stack-top-frame");
|
|
111
111
|
}
|
|
112
112
|
function b(e) {
|
|
113
|
-
if (
|
|
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
|
|
132
|
-
var e =
|
|
133
|
-
return
|
|
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
|
|
138
|
-
var
|
|
137
|
+
function c(e, r, n, f, E, v) {
|
|
138
|
+
var l = n.ref;
|
|
139
139
|
return e = {
|
|
140
|
-
$$typeof:
|
|
140
|
+
$$typeof: w,
|
|
141
141
|
type: e,
|
|
142
142
|
key: r,
|
|
143
143
|
props: n,
|
|
144
|
-
_owner:
|
|
145
|
-
}, (
|
|
144
|
+
_owner: f
|
|
145
|
+
}, (l !== void 0 ? l : null) !== null ? Object.defineProperty(e, "ref", {
|
|
146
146
|
enumerable: !1,
|
|
147
|
-
get:
|
|
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:
|
|
162
|
+
value: E
|
|
163
163
|
}), Object.defineProperty(e, "_debugTask", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
166
166
|
writable: !0,
|
|
167
|
-
value:
|
|
167
|
+
value: v
|
|
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 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
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
var
|
|
186
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
l,
|
|
197
|
+
_,
|
|
198
|
+
l
|
|
199
|
+
), P[l + f] = !0);
|
|
200
200
|
}
|
|
201
|
-
if (
|
|
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
|
|
204
|
-
|
|
203
|
+
for (var T in r)
|
|
204
|
+
T !== "key" && (n[T] = r[T]);
|
|
205
205
|
} else n = r;
|
|
206
|
-
return
|
|
206
|
+
return l && x(
|
|
207
207
|
n,
|
|
208
208
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
209
|
-
),
|
|
209
|
+
), c(
|
|
210
210
|
e,
|
|
211
|
-
|
|
211
|
+
l,
|
|
212
212
|
n,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
s(),
|
|
214
|
+
E,
|
|
215
|
+
v
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
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
|
|
222
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
221
|
+
function j(e) {
|
|
222
|
+
return typeof e == "object" && e !== null && e.$$typeof === w;
|
|
223
223
|
}
|
|
224
|
-
var
|
|
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
|
-
|
|
227
|
+
d = {
|
|
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, 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
|
-
|
|
244
|
-
|
|
243
|
+
f ? Error("react-stack-top-frame") : m,
|
|
244
|
+
f ? F(h(e)) : z
|
|
245
245
|
);
|
|
246
|
-
},
|
|
247
|
-
var
|
|
248
|
-
return
|
|
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
|
-
|
|
254
|
-
|
|
253
|
+
f ? Error("react-stack-top-frame") : m,
|
|
254
|
+
f ? F(h(e)) : z
|
|
255
255
|
);
|
|
256
256
|
};
|
|
257
|
-
})()),
|
|
257
|
+
})()), L;
|
|
258
258
|
}
|
|
259
|
-
var
|
|
260
|
-
function
|
|
261
|
-
return
|
|
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 =
|
|
264
|
-
const
|
|
265
|
-
function
|
|
266
|
-
const [
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
a(!
|
|
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
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
}, [
|
|
280
|
-
return
|
|
281
|
-
const
|
|
282
|
-
a(!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",
|
|
285
|
-
window.removeEventListener("feedpulse:open-consent",
|
|
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
|
-
}, [
|
|
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:
|
|
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: (
|
|
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:
|
|
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: 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
|
|
314
|
+
function me() {
|
|
315
315
|
if (typeof document > "u" || document.getElementById("fp-bot-animations"))
|
|
316
316
|
return;
|
|
317
|
-
const
|
|
318
|
-
|
|
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(
|
|
337
|
+
`, document.head.appendChild(o);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
faq:
|
|
341
|
-
pageContext:
|
|
342
|
-
systemPrompt: a,
|
|
343
|
-
canNavigate: h,
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
|
355
|
-
() =>
|
|
356
|
-
|
|
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
|
-
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
onTrigger: async (
|
|
373
|
-
|
|
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
|
|
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:
|
|
381
|
-
triggerReasons:
|
|
382
|
-
sessionId:
|
|
383
|
-
visitorId:
|
|
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 (
|
|
388
|
-
|
|
371
|
+
if (r.status === 402) {
|
|
372
|
+
M(!0);
|
|
389
373
|
return;
|
|
390
374
|
}
|
|
391
|
-
const
|
|
392
|
-
|
|
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
|
|
398
|
-
|
|
381
|
+
return m.start(), () => {
|
|
382
|
+
m.stop(), S.current && clearTimeout(S.current);
|
|
399
383
|
};
|
|
400
384
|
}, []);
|
|
401
|
-
const
|
|
385
|
+
const F = {
|
|
402
386
|
position: "fixed",
|
|
403
387
|
bottom: 24,
|
|
404
388
|
zIndex: 1e4,
|
|
405
|
-
...
|
|
406
|
-
},
|
|
407
|
-
if (
|
|
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
|
|
410
|
-
|
|
411
|
-
|
|
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
|
|
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:
|
|
423
|
-
|
|
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 (
|
|
429
|
-
|
|
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 (!
|
|
411
|
+
if (!r.ok)
|
|
433
412
|
throw new Error("chat failed");
|
|
434
|
-
const
|
|
435
|
-
|
|
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
|
-
|
|
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
|
-
|
|
428
|
+
N(!1);
|
|
440
429
|
}
|
|
441
430
|
})();
|
|
442
|
-
},
|
|
443
|
-
if (!
|
|
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:
|
|
462
|
-
escalated:
|
|
439
|
+
wasHelpful: X,
|
|
440
|
+
escalated: Z
|
|
463
441
|
})
|
|
464
442
|
});
|
|
465
443
|
} catch {
|
|
466
444
|
}
|
|
467
|
-
|
|
445
|
+
C([]);
|
|
468
446
|
}
|
|
469
447
|
};
|
|
470
|
-
return /* @__PURE__ */ t.jsxs("div", { style:
|
|
471
|
-
|
|
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:
|
|
478
|
-
left:
|
|
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:
|
|
467
|
+
children: b
|
|
490
468
|
}
|
|
491
469
|
),
|
|
492
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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:
|
|
553
|
-
background:
|
|
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:
|
|
536
|
+
children: m.content
|
|
559
537
|
}
|
|
560
538
|
),
|
|
561
|
-
|
|
562
|
-
/* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () =>
|
|
563
|
-
/* @__PURE__ */ t.jsx("button", { style: { border: "1px solid #334155", background: "#0f172a", color: "#e2e8f0", borderRadius: 8, fontSize: 12, padding: "4px 8px", cursor: "pointer" }, onClick: () =>
|
|
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
|
-
] },
|
|
566
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
597
|
-
disabled:
|
|
598
|
-
onChange: (
|
|
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: !
|
|
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
|
-
|
|
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
|
|
613
|
-
function
|
|
614
|
-
proxyEndpoint:
|
|
615
|
-
debug:
|
|
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
|
|
620
|
-
const
|
|
621
|
-
analytics:
|
|
622
|
-
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
|
-
|
|
626
|
-
analytics:
|
|
627
|
-
marketing:
|
|
628
|
-
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:
|
|
590
|
+
version: y.version
|
|
631
591
|
});
|
|
632
592
|
}, []);
|
|
633
|
-
return
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
const
|
|
637
|
-
return a ?
|
|
638
|
-
|
|
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
|
-
}, [
|
|
600
|
+
}, [o, g, a]), /* @__PURE__ */ t.jsxs(ae.Provider, { value: { tracker: b }, children: [
|
|
641
601
|
h,
|
|
642
|
-
a && /* @__PURE__ */ t.jsx(
|
|
602
|
+
a && /* @__PURE__ */ t.jsx(he, { onConsent: k })
|
|
643
603
|
] });
|
|
644
604
|
}
|
|
645
|
-
function
|
|
646
|
-
return
|
|
605
|
+
function ge() {
|
|
606
|
+
return de(ae);
|
|
647
607
|
}
|
|
648
|
-
function
|
|
649
|
-
const { tracker: h } =
|
|
650
|
-
!b && !
|
|
651
|
-
|
|
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
|
-
},
|
|
654
|
-
return /* @__PURE__ */ t.jsxs("div", { style:
|
|
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: () =>
|
|
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
|
-
|
|
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:
|
|
668
|
-
/* @__PURE__ */ t.jsx("div", { style: { display: "flex", gap: 6, marginBottom: 12 }, children: [1, 2, 3, 4, 5].map((
|
|
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(
|
|
672
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity: b !== null &&
|
|
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
|
-
|
|
635
|
+
w
|
|
676
636
|
)) }),
|
|
677
637
|
/* @__PURE__ */ t.jsx(
|
|
678
638
|
"textarea",
|
|
679
639
|
{
|
|
680
|
-
value:
|
|
681
|
-
onChange: (
|
|
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:
|
|
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
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
659
|
+
he as ConsentBanner,
|
|
660
|
+
we as FeedPulseBot,
|
|
661
|
+
je as FeedPulseProvider,
|
|
662
|
+
Re as FeedPulseWidget,
|
|
663
|
+
ge as useFeedPulse
|
|
704
664
|
};
|