@tekibo/feedpulse-sdk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +223 -69
- package/dist/nuxt.js +1 -1
- package/dist/nuxt.mjs +160 -46
- package/dist/react.js +2 -2
- package/dist/react.mjs +235 -160
- package/package.json +5 -1
package/dist/react.mjs
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FeedPulseTracker as
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
var u = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
9
|
-
function
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
for (var
|
|
14
|
-
|
|
15
|
-
} else
|
|
16
|
-
return
|
|
1
|
+
import ie, { useState as h, useEffect as N, useCallback as J, createContext as le, useRef as M, useContext as ce } from "react";
|
|
2
|
+
import { CookieManager as B, FeedPulseTracker as ue } from "./index.mjs";
|
|
3
|
+
var j = { exports: {} }, _ = {};
|
|
4
|
+
var $;
|
|
5
|
+
function de() {
|
|
6
|
+
if ($) return _;
|
|
7
|
+
$ = 1;
|
|
8
|
+
var u = /* @__PURE__ */ Symbol.for("react.transitional.element"), k = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
9
|
+
function a(m, i, s) {
|
|
10
|
+
var p = null;
|
|
11
|
+
if (s !== void 0 && (p = "" + s), i.key !== void 0 && (p = "" + i.key), "key" in i) {
|
|
12
|
+
s = {};
|
|
13
|
+
for (var g in i)
|
|
14
|
+
g !== "key" && (s[g] = i[g]);
|
|
15
|
+
} else s = i;
|
|
16
|
+
return i = s.ref, {
|
|
17
17
|
$$typeof: u,
|
|
18
|
-
type:
|
|
19
|
-
key:
|
|
20
|
-
ref:
|
|
21
|
-
props:
|
|
18
|
+
type: m,
|
|
19
|
+
key: p,
|
|
20
|
+
ref: i !== void 0 ? i : null,
|
|
21
|
+
props: s
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return _.Fragment = k, _.jsx = a, _.jsxs = a, _;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
26
|
+
var R = {};
|
|
27
|
+
var L;
|
|
28
|
+
function fe() {
|
|
29
|
+
return L || (L = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
30
|
function u(e) {
|
|
31
31
|
if (e == null) return null;
|
|
32
32
|
if (typeof e == "function")
|
|
33
|
-
return e.$$typeof ===
|
|
33
|
+
return e.$$typeof === oe ? null : e.displayName || e.name || null;
|
|
34
34
|
if (typeof e == "string") return e;
|
|
35
35
|
switch (e) {
|
|
36
|
-
case
|
|
36
|
+
case T:
|
|
37
37
|
return "Fragment";
|
|
38
|
-
case
|
|
38
|
+
case H:
|
|
39
39
|
return "Profiler";
|
|
40
|
-
case
|
|
40
|
+
case X:
|
|
41
41
|
return "StrictMode";
|
|
42
|
-
case
|
|
42
|
+
case ee:
|
|
43
43
|
return "Suspense";
|
|
44
|
-
case
|
|
44
|
+
case re:
|
|
45
45
|
return "SuspenseList";
|
|
46
|
-
case
|
|
46
|
+
case ne:
|
|
47
47
|
return "Activity";
|
|
48
48
|
}
|
|
49
49
|
if (typeof e == "object")
|
|
50
50
|
switch (typeof e.tag == "number" && console.error(
|
|
51
51
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
52
|
), e.$$typeof) {
|
|
53
|
-
case U:
|
|
54
|
-
return "Portal";
|
|
55
53
|
case G:
|
|
54
|
+
return "Portal";
|
|
55
|
+
case Q:
|
|
56
56
|
return e.displayName || "Context";
|
|
57
|
-
case
|
|
57
|
+
case Z:
|
|
58
58
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
59
|
-
case
|
|
59
|
+
case K:
|
|
60
60
|
var r = e.render;
|
|
61
61
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
62
|
-
case
|
|
62
|
+
case te:
|
|
63
63
|
return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
|
|
64
|
-
case
|
|
64
|
+
case S:
|
|
65
65
|
r = e._payload, e = e._init;
|
|
66
66
|
try {
|
|
67
67
|
return u(e(r));
|
|
@@ -70,29 +70,29 @@ function ue() {
|
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function k(e) {
|
|
74
74
|
return "" + e;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function a(e) {
|
|
77
77
|
try {
|
|
78
|
-
|
|
78
|
+
k(e);
|
|
79
79
|
var r = !1;
|
|
80
80
|
} catch {
|
|
81
81
|
r = !0;
|
|
82
82
|
}
|
|
83
83
|
if (r) {
|
|
84
84
|
r = console;
|
|
85
|
-
var
|
|
86
|
-
return
|
|
85
|
+
var o = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
86
|
+
return o.call(
|
|
87
87
|
r,
|
|
88
88
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
-
|
|
90
|
-
),
|
|
89
|
+
l
|
|
90
|
+
), k(e);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
if (e ===
|
|
95
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
93
|
+
function m(e) {
|
|
94
|
+
if (e === T) return "<>";
|
|
95
|
+
if (typeof e == "object" && e !== null && e.$$typeof === S)
|
|
96
96
|
return "<...>";
|
|
97
97
|
try {
|
|
98
98
|
var r = u(e);
|
|
@@ -101,49 +101,49 @@ function ue() {
|
|
|
101
101
|
return "<...>";
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
var e =
|
|
104
|
+
function i() {
|
|
105
|
+
var e = A.A;
|
|
106
106
|
return e === null ? null : e.getOwner();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function s() {
|
|
109
109
|
return Error("react-stack-top-frame");
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (
|
|
111
|
+
function p(e) {
|
|
112
|
+
if (D.call(e, "key")) {
|
|
113
113
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
114
114
|
if (r && r.isReactWarning) return !1;
|
|
115
115
|
}
|
|
116
116
|
return e.key !== void 0;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
function
|
|
118
|
+
function g(e, r) {
|
|
119
|
+
function o() {
|
|
120
120
|
F || (F = !0, console.error(
|
|
121
121
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
122
122
|
r
|
|
123
123
|
));
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
get:
|
|
125
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
126
|
+
get: o,
|
|
127
127
|
configurable: !0
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function x() {
|
|
131
131
|
var e = u(this.type);
|
|
132
|
-
return
|
|
132
|
+
return I[e] || (I[e] = !0, console.error(
|
|
133
133
|
"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."
|
|
134
134
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
var
|
|
136
|
+
function y(e, r, o, l, w, P) {
|
|
137
|
+
var c = o.ref;
|
|
138
138
|
return e = {
|
|
139
|
-
$$typeof:
|
|
139
|
+
$$typeof: v,
|
|
140
140
|
type: e,
|
|
141
141
|
key: r,
|
|
142
|
-
props:
|
|
143
|
-
_owner:
|
|
144
|
-
}, (
|
|
142
|
+
props: o,
|
|
143
|
+
_owner: l
|
|
144
|
+
}, (c !== void 0 ? c : null) !== null ? Object.defineProperty(e, "ref", {
|
|
145
145
|
enumerable: !1,
|
|
146
|
-
get:
|
|
146
|
+
get: x
|
|
147
147
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
148
148
|
configurable: !1,
|
|
149
149
|
enumerable: !1,
|
|
@@ -158,164 +158,238 @@ function ue() {
|
|
|
158
158
|
configurable: !1,
|
|
159
159
|
enumerable: !1,
|
|
160
160
|
writable: !0,
|
|
161
|
-
value:
|
|
161
|
+
value: w
|
|
162
162
|
}), Object.defineProperty(e, "_debugTask", {
|
|
163
163
|
configurable: !1,
|
|
164
164
|
enumerable: !1,
|
|
165
165
|
writable: !0,
|
|
166
|
-
value:
|
|
166
|
+
value: P
|
|
167
167
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
for (
|
|
175
|
-
|
|
176
|
-
Object.freeze && Object.freeze(
|
|
169
|
+
function n(e, r, o, l, w, P) {
|
|
170
|
+
var c = r.children;
|
|
171
|
+
if (c !== void 0)
|
|
172
|
+
if (l)
|
|
173
|
+
if (ae(c)) {
|
|
174
|
+
for (l = 0; l < c.length; l++)
|
|
175
|
+
d(c[l]);
|
|
176
|
+
Object.freeze && Object.freeze(c);
|
|
177
177
|
} else
|
|
178
178
|
console.error(
|
|
179
179
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
180
|
);
|
|
181
|
-
else
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
var E = Object.keys(r).filter(function(
|
|
185
|
-
return
|
|
181
|
+
else d(c);
|
|
182
|
+
if (D.call(r, "key")) {
|
|
183
|
+
c = u(e);
|
|
184
|
+
var E = Object.keys(r).filter(function(se) {
|
|
185
|
+
return se !== "key";
|
|
186
186
|
});
|
|
187
|
-
|
|
187
|
+
l = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", Y[c + l] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
188
|
`A props object containing a "key" prop is being spread into JSX:
|
|
189
189
|
let props = %s;
|
|
190
190
|
<%s {...props} />
|
|
191
191
|
React keys must be passed directly to JSX without using spread:
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s key={someKey} {...props} />`,
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
l,
|
|
195
|
+
c,
|
|
196
196
|
E,
|
|
197
|
-
|
|
198
|
-
),
|
|
197
|
+
c
|
|
198
|
+
), Y[c + l] = !0);
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
for (var
|
|
203
|
-
|
|
204
|
-
} else
|
|
205
|
-
return
|
|
206
|
-
|
|
200
|
+
if (c = null, o !== void 0 && (a(o), c = "" + o), p(r) && (a(r.key), c = "" + r.key), "key" in r) {
|
|
201
|
+
o = {};
|
|
202
|
+
for (var O in r)
|
|
203
|
+
O !== "key" && (o[O] = r[O]);
|
|
204
|
+
} else o = r;
|
|
205
|
+
return c && g(
|
|
206
|
+
o,
|
|
207
207
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
208
|
-
),
|
|
208
|
+
), y(
|
|
209
209
|
e,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
c,
|
|
211
|
+
o,
|
|
212
|
+
i(),
|
|
213
|
+
w,
|
|
214
|
+
P
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
217
|
+
function d(e) {
|
|
218
|
+
b(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === S && (e._payload.status === "fulfilled" ? b(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
220
|
+
function b(e) {
|
|
221
|
+
return typeof e == "object" && e !== null && e.$$typeof === v;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var f = ie, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), G = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), X = /* @__PURE__ */ Symbol.for("react.strict_mode"), H = /* @__PURE__ */ Symbol.for("react.profiler"), Z = /* @__PURE__ */ Symbol.for("react.consumer"), Q = /* @__PURE__ */ Symbol.for("react.context"), K = /* @__PURE__ */ Symbol.for("react.forward_ref"), ee = /* @__PURE__ */ Symbol.for("react.suspense"), re = /* @__PURE__ */ Symbol.for("react.suspense_list"), te = /* @__PURE__ */ Symbol.for("react.memo"), S = /* @__PURE__ */ Symbol.for("react.lazy"), ne = /* @__PURE__ */ Symbol.for("react.activity"), oe = /* @__PURE__ */ Symbol.for("react.client.reference"), A = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, ae = Array.isArray, C = console.createTask ? console.createTask : function() {
|
|
224
224
|
return null;
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
f = {
|
|
227
227
|
react_stack_bottom_frame: function(e) {
|
|
228
228
|
return e();
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
var F,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
)(),
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
return
|
|
231
|
+
var F, I = {}, z = f.react_stack_bottom_frame.bind(
|
|
232
|
+
f,
|
|
233
|
+
s
|
|
234
|
+
)(), W = C(m(s)), Y = {};
|
|
235
|
+
R.Fragment = T, R.jsx = function(e, r, o) {
|
|
236
|
+
var l = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
237
|
+
return n(
|
|
238
238
|
e,
|
|
239
239
|
r,
|
|
240
|
-
|
|
240
|
+
o,
|
|
241
241
|
!1,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
l ? Error("react-stack-top-frame") : z,
|
|
243
|
+
l ? C(m(e)) : W
|
|
244
244
|
);
|
|
245
|
-
},
|
|
246
|
-
var
|
|
247
|
-
return
|
|
245
|
+
}, R.jsxs = function(e, r, o) {
|
|
246
|
+
var l = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
247
|
+
return n(
|
|
248
248
|
e,
|
|
249
249
|
r,
|
|
250
|
-
|
|
250
|
+
o,
|
|
251
251
|
!0,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
l ? Error("react-stack-top-frame") : z,
|
|
253
|
+
l ? C(m(e)) : W
|
|
254
254
|
);
|
|
255
255
|
};
|
|
256
|
-
})()),
|
|
256
|
+
})()), R;
|
|
257
257
|
}
|
|
258
|
-
var
|
|
259
|
-
function
|
|
260
|
-
return
|
|
258
|
+
var U;
|
|
259
|
+
function pe() {
|
|
260
|
+
return U || (U = 1, process.env.NODE_ENV === "production" ? j.exports = de() : j.exports = fe()), j.exports;
|
|
261
|
+
}
|
|
262
|
+
var t = pe();
|
|
263
|
+
const V = new B();
|
|
264
|
+
function me({ onConsent: u }) {
|
|
265
|
+
const [k, a] = h(!1), [m, i] = h(!1), [s, p] = h(!1), [g, x] = h(!1);
|
|
266
|
+
N(() => {
|
|
267
|
+
const f = V.getConsent();
|
|
268
|
+
a(!f || V.isConsentExpired()), f && (p(f.analytics), x(f.marketing));
|
|
269
|
+
}, []);
|
|
270
|
+
const y = () => {
|
|
271
|
+
u({ analytics: !0, marketing: !0, action: "accept_all" }), a(!1);
|
|
272
|
+
}, n = () => {
|
|
273
|
+
u({ analytics: !1, marketing: !1, action: "reject_all" }), a(!1);
|
|
274
|
+
}, d = () => {
|
|
275
|
+
u({ analytics: s, marketing: g, action: "custom" }), a(!1);
|
|
276
|
+
}, b = J(() => {
|
|
277
|
+
u({ analytics: !1, marketing: !1, action: "withdraw" }), p(!1), x(!1), a(!0);
|
|
278
|
+
}, [u]);
|
|
279
|
+
return N(() => {
|
|
280
|
+
const f = () => {
|
|
281
|
+
a(!0), i(!0);
|
|
282
|
+
};
|
|
283
|
+
return window.addEventListener("feedpulse:open-consent", f), window.addEventListener("feedpulse:withdraw-consent", b), () => {
|
|
284
|
+
window.removeEventListener("feedpulse:open-consent", f), window.removeEventListener("feedpulse:withdraw-consent", b);
|
|
285
|
+
};
|
|
286
|
+
}, [b]), 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
|
+
/* @__PURE__ */ t.jsxs("p", { style: { margin: "0 0 12px", fontSize: 14, lineHeight: 1.5 }, children: [
|
|
288
|
+
"We use cookies to improve reliability and understand usage.",
|
|
289
|
+
" ",
|
|
290
|
+
/* @__PURE__ */ t.jsx("a", { href: "/privacy", style: { color: "#818cf8" }, children: "Privacy Policy" })
|
|
291
|
+
] }),
|
|
292
|
+
m && /* @__PURE__ */ t.jsxs("div", { style: { marginBottom: 12, fontSize: 13 }, children: [
|
|
293
|
+
/* @__PURE__ */ t.jsxs("label", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 6, opacity: 0.75 }, children: [
|
|
294
|
+
/* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: !0, disabled: !0 }),
|
|
295
|
+
"Necessary (always on)"
|
|
296
|
+
] }),
|
|
297
|
+
/* @__PURE__ */ t.jsxs("label", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 6 }, children: [
|
|
298
|
+
/* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: s, onChange: (f) => p(f.target.checked) }),
|
|
299
|
+
"Analytics"
|
|
300
|
+
] }),
|
|
301
|
+
/* @__PURE__ */ t.jsxs("label", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
302
|
+
/* @__PURE__ */ t.jsx("input", { type: "checkbox", checked: g, onChange: (f) => x(f.target.checked) }),
|
|
303
|
+
"Marketing"
|
|
304
|
+
] })
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8, flexWrap: "wrap", alignItems: "center" }, children: [
|
|
307
|
+
/* @__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: y, children: "Accept All" }),
|
|
308
|
+
/* @__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: n, children: "Reject All" }),
|
|
309
|
+
/* @__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: () => m ? d() : i(!0), children: m ? "Save Preferences" : "Customize" })
|
|
310
|
+
] })
|
|
311
|
+
] }) }) : null;
|
|
261
312
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
function be({
|
|
313
|
+
const q = le({ tracker: null });
|
|
314
|
+
function ke({
|
|
265
315
|
apiKey: u,
|
|
266
|
-
endpoint:
|
|
267
|
-
debug:
|
|
268
|
-
|
|
316
|
+
endpoint: k,
|
|
317
|
+
debug: a,
|
|
318
|
+
consentRequired: m = !0,
|
|
319
|
+
children: i
|
|
269
320
|
}) {
|
|
270
|
-
const
|
|
271
|
-
|
|
321
|
+
const s = M(null), p = M(new B()), [g, x] = h(null), y = J((n) => {
|
|
322
|
+
const d = p.current, b = d.setConsent({
|
|
323
|
+
analytics: n.analytics,
|
|
324
|
+
marketing: n.marketing,
|
|
325
|
+
version: "1.0"
|
|
326
|
+
});
|
|
327
|
+
n.analytics || d.clearAnalyticsCookies(), s.current?.updateCookieData(d.getAllData(n.analytics)), s.current?.track("consent", "__consent__", {
|
|
328
|
+
analytics: n.analytics,
|
|
329
|
+
marketing: n.marketing,
|
|
330
|
+
action: n.action,
|
|
331
|
+
userAgent: navigator.userAgent,
|
|
332
|
+
version: b.version
|
|
333
|
+
});
|
|
334
|
+
}, []);
|
|
335
|
+
return N(() => {
|
|
336
|
+
const n = new ue({ apiKey: u, endpoint: k, debug: a });
|
|
337
|
+
s.current = n, x(n);
|
|
338
|
+
const d = p.current, b = d.getConsent();
|
|
339
|
+
return m ? b && !d.isConsentExpired() ? n.updateCookieData(d.getAllData(b.analytics)) : n.updateCookieData(d.getAllData(!1)) : (d.setConsent({ analytics: !0, marketing: !0, version: "1.0" }), n.updateCookieData(d.getAllData(!0))), n.init(), () => {
|
|
340
|
+
n.destroy(), s.current = null, x(null);
|
|
341
|
+
};
|
|
342
|
+
}, [u, k, a, m]), /* @__PURE__ */ t.jsxs(q.Provider, { value: { tracker: g }, children: [
|
|
343
|
+
i,
|
|
344
|
+
m && /* @__PURE__ */ t.jsx(me, { onConsent: y })
|
|
345
|
+
] });
|
|
272
346
|
}
|
|
273
|
-
function
|
|
274
|
-
return
|
|
347
|
+
function ge() {
|
|
348
|
+
return ce(q);
|
|
275
349
|
}
|
|
276
|
-
function
|
|
277
|
-
const { tracker:
|
|
278
|
-
!
|
|
279
|
-
|
|
350
|
+
function he({ id: u, placeholder: k, position: a = "bottom-right" }) {
|
|
351
|
+
const { tracker: m } = ge(), [i, s] = h(a === "inline"), [p, g] = h(null), [x, y] = h(""), [n, d] = h(!1), b = () => {
|
|
352
|
+
!p && !x.trim() || (m?.trackFeedback(u ?? null, p, x || null), d(!0), setTimeout(() => {
|
|
353
|
+
s(a === "inline"), d(!1), g(null), y("");
|
|
280
354
|
}, 2e3));
|
|
281
|
-
},
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
-
|
|
355
|
+
}, f = a !== "inline" ? { position: "fixed", bottom: 24, [a === "bottom-right" ? "right" : "left"]: 24, zIndex: 9999 } : {};
|
|
356
|
+
return /* @__PURE__ */ t.jsxs("div", { style: f, children: [
|
|
357
|
+
a !== "inline" && /* @__PURE__ */ t.jsx(
|
|
284
358
|
"button",
|
|
285
359
|
{
|
|
286
|
-
onClick: () =>
|
|
360
|
+
onClick: () => s(!i),
|
|
287
361
|
style: { background: "#6366f1", color: "#fff", border: "none", borderRadius: "50%", width: 48, height: 48, fontSize: 20, cursor: "pointer" },
|
|
288
362
|
children: "💬"
|
|
289
363
|
}
|
|
290
364
|
),
|
|
291
|
-
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
] }) : /* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
365
|
+
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: n ? /* @__PURE__ */ t.jsxs("div", { style: { textAlign: "center", padding: 16 }, children: [
|
|
366
|
+
/* @__PURE__ */ t.jsx("p", { style: { fontSize: 28, margin: 0 }, children: "🎉" }),
|
|
367
|
+
/* @__PURE__ */ t.jsx("p", { style: { margin: "8px 0 0", fontWeight: 600 }, children: "Thanks for your feedback!" })
|
|
368
|
+
] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
369
|
+
/* @__PURE__ */ t.jsx("p", { style: { margin: "0 0 12px", fontWeight: 600 }, children: k ?? "How was your experience?" }),
|
|
370
|
+
/* @__PURE__ */ t.jsx("div", { style: { display: "flex", gap: 6, marginBottom: 12 }, children: [1, 2, 3, 4, 5].map((v) => /* @__PURE__ */ t.jsx(
|
|
297
371
|
"button",
|
|
298
372
|
{
|
|
299
|
-
onClick: () =>
|
|
300
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity:
|
|
373
|
+
onClick: () => g(v),
|
|
374
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity: p !== null && v <= p ? 1 : 0.3 },
|
|
301
375
|
children: "⭐"
|
|
302
376
|
},
|
|
303
|
-
|
|
377
|
+
v
|
|
304
378
|
)) }),
|
|
305
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ t.jsx(
|
|
306
380
|
"textarea",
|
|
307
381
|
{
|
|
308
|
-
value:
|
|
309
|
-
onChange: (
|
|
382
|
+
value: x,
|
|
383
|
+
onChange: (v) => y(v.target.value),
|
|
310
384
|
placeholder: "Tell us more (optional)...",
|
|
311
385
|
rows: 3,
|
|
312
386
|
style: { width: "100%", padding: 8, border: "1px solid #d1d5db", borderRadius: 8, resize: "none", fontSize: 14 }
|
|
313
387
|
}
|
|
314
388
|
),
|
|
315
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ t.jsx(
|
|
316
390
|
"button",
|
|
317
391
|
{
|
|
318
|
-
onClick:
|
|
392
|
+
onClick: b,
|
|
319
393
|
style: { marginTop: 10, width: "100%", background: "#6366f1", color: "#fff", border: "none", borderRadius: 8, padding: 10, fontWeight: 600, cursor: "pointer" },
|
|
320
394
|
children: "Submit Feedback"
|
|
321
395
|
}
|
|
@@ -324,7 +398,8 @@ function pe({ id: u, placeholder: f, position: s = "bottom-right" }) {
|
|
|
324
398
|
] });
|
|
325
399
|
}
|
|
326
400
|
export {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
401
|
+
me as ConsentBanner,
|
|
402
|
+
ke as FeedPulseProvider,
|
|
403
|
+
he as FeedPulseWidget,
|
|
404
|
+
ge as useFeedPulse
|
|
330
405
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekibo/feedpulse-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Embeddable analytics and feedback SDK for FeedPulse",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -38,7 +38,11 @@
|
|
|
38
38
|
"optional": true
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"js-cookie": "^3.0.5"
|
|
43
|
+
},
|
|
41
44
|
"devDependencies": {
|
|
45
|
+
"@types/js-cookie": "^3.0.6",
|
|
42
46
|
"@vitejs/plugin-react": "^4.7.0",
|
|
43
47
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
44
48
|
"react": "^19.1.1",
|