@tekibo/feedpulse-sdk 2.1.3 → 2.2.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 +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +40 -23
- package/dist/nuxt.js +1 -1
- package/dist/nuxt.mjs +30 -28
- package/dist/react.js +2 -2
- package/dist/react.mjs +93 -92
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ The SDK automatically tracks:
|
|
|
20
20
|
- `hover`: when users hover an element for more than 500ms
|
|
21
21
|
- `scroll_into_view`: when tagged elements enter viewport
|
|
22
22
|
- `feedback`: explicit rating/message submissions from widget or manual API
|
|
23
|
+
|
|
23
24
|
## Quick start (Nuxt)
|
|
24
25
|
|
|
25
26
|
Import from `@tekibo/feedpulse-sdk/nuxt` and wrap your app:
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class c{constructor(e){this.queue=[],this.flushInterval=null,this.observer=null,this.intersectionObserver=null,this.scrollFallbackListener=null,this.resizeFallbackListener=null,this.seenInView=new Set;const i="https://feed-pulse.vercel.app/api/ingest";this.config={apiKey:e.apiKey,endpoint:e.endpoint??i,batchInterval:e.batchInterval??5e3,debug:e.debug??!1},this.visitorId="",this.sessionId=""}init(){this.isBrowser()&&(this.visitorId=this.getOrCreateVisitorId(),this.sessionId=this.generateSessionId(),this.startFlushInterval(),this.attachGlobalListeners(),this.observeDOM())}attachGlobalListeners(){document.addEventListener("click",t=>{const s=t.target.closest("[data-fp-id]");s&&this.track("click",s.getAttribute("data-fp-id"),{x:t.clientX,y:t.clientY})},{passive:!0});let e=0,i=null;document.addEventListener("mouseover",t=>{const s=t.target.closest("[data-fp-id]");s&&(e=Date.now(),i=s.getAttribute("data-fp-id"))},{passive:!0}),document.addEventListener("mouseout",t=>{if(!t.target.closest("[data-fp-id]")||!i)return;const r=Date.now()-e;r>500&&this.track("hover",i,{hoverDuration:r}),i=null},{passive:!0})}observeDOM(){const e=s=>{this.seenInView.has(s)||(this.seenInView.add(s),this.track("scroll_into_view",s,{scrollDepth:Math.round(window.scrollY/Math.max(1,document.body.scrollHeight)*100)}))};this.intersectionObserver=new IntersectionObserver(s=>{for(const r of s){const n=r.target.dataset.fpId;!n||!r.isIntersecting||e(n)}},{threshold:.1});const i=()=>{document.querySelectorAll("[data-fp-id]").forEach(s=>{this.intersectionObserver?.observe(s)})},t=()=>{const s=window.innerHeight*.1,r=window.innerHeight*.9;document.querySelectorAll("[data-fp-id]").forEach(n=>{const o=n.dataset.fpId;if(!o||this.seenInView.has(o))return;const a=n.getBoundingClientRect();a.bottom>=s&&a.top<=r&&e(o)})};i(),t(),this.scrollFallbackListener=()=>t(),this.resizeFallbackListener=()=>t(),window.addEventListener("scroll",this.scrollFallbackListener,{passive:!0}),window.addEventListener("resize",this.resizeFallbackListener,{passive:!0}),this.observer=new MutationObserver(()=>i()),this.observer.observe(document.body,{childList:!0,subtree:!0})}track(e,i,t){this.isBrowser()&&this.queue.push({projectApiKey:this.config.apiKey,elementId:i,eventType:e,sessionId:this.sessionId,visitorId:this.visitorId,page:window.location.pathname,referrer:document.referrer,device:this.getDeviceType(),browser:this.getBrowser(),os:this.getOS(),metadata:t,timestamp:new Date().toISOString()})}trackFeedback(e,i,t){this.isBrowser()&&(!i&&!t||this.sendImmediate([{projectApiKey:this.config.apiKey,elementId:e??"__page__",eventType:"feedback",sessionId:this.sessionId,visitorId:this.visitorId,page:window.location.pathname,device:this.getDeviceType(),metadata:{rating:i,message:t},timestamp:new Date().toISOString()}]))}async flush(){if(this.queue.length===0)return;const e=[...this.queue];this.queue=[],await this.sendImmediate(e)}async sendImmediate(e){try{const i=await fetch(this.config.endpoint,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({events:e}),keepalive:!0});if(this.config.debug&&i.ok){const t=await i.json().catch(()=>null);t?.ingested!==void 0&&t?.pipeline&&globalThis.console.debug(`[FeedPulse] ${t.ingested} events via ${t.pipeline} pipeline`)}}catch{}}startFlushInterval(){this.flushInterval=setInterval(()=>this.flush(),this.config.batchInterval),window.addEventListener("beforeunload",()=>this.flush()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()})}getOrCreateVisitorId(){const e="__fp_vid",i=this.generateId();try{let t=localStorage.getItem(e);return t||(t=i,localStorage.setItem(e,t)),t}catch{return i}}generateId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}isBrowser(){return typeof window<"u"&&typeof document<"u"}generateSessionId(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}getDeviceType(){const e=navigator.userAgent;return/Mobi|Android/i.test(e)?"mobile":/Tablet|iPad/i.test(e)?"tablet":"desktop"}getBrowser(){const e=navigator.userAgent;return e.includes("Edg")?"Edge":e.includes("Chrome")?"Chrome":e.includes("Firefox")?"Firefox":e.includes("Safari")?"Safari":"Other"}getOS(){const e=navigator.userAgent;return e.includes("Windows")?"Windows":e.includes("Mac")?"macOS":e.includes("Linux")?"Linux":e.includes("Android")?"Android":/iPhone|iOS/.test(e)?"iOS":"Other"}destroy(){this.flushInterval&&clearInterval(this.flushInterval),this.scrollFallbackListener&&window.removeEventListener("scroll",this.scrollFallbackListener),this.resizeFallbackListener&&window.removeEventListener("resize",this.resizeFallbackListener),this.observer?.disconnect(),this.intersectionObserver?.disconnect(),this.flush()}}exports.FeedPulseTracker=c;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
class
|
|
1
|
+
class l {
|
|
2
2
|
constructor(e) {
|
|
3
|
-
this.queue = [], this.flushInterval = null, this.observer = null, this.intersectionObserver = null, this.seenInView = /* @__PURE__ */ new Set();
|
|
3
|
+
this.queue = [], this.flushInterval = null, this.observer = null, this.intersectionObserver = null, this.scrollFallbackListener = null, this.resizeFallbackListener = null, this.seenInView = /* @__PURE__ */ new Set();
|
|
4
4
|
const i = "https://feed-pulse.vercel.app/api/ingest";
|
|
5
5
|
this.config = {
|
|
6
6
|
apiKey: e.apiKey,
|
|
7
7
|
endpoint: e.endpoint ?? i,
|
|
8
|
-
batchInterval: e.batchInterval ?? 5e3
|
|
8
|
+
batchInterval: e.batchInterval ?? 5e3,
|
|
9
|
+
debug: e.debug ?? !1
|
|
9
10
|
}, this.visitorId = "", this.sessionId = "";
|
|
10
11
|
}
|
|
11
12
|
init() {
|
|
@@ -13,38 +14,50 @@ class o {
|
|
|
13
14
|
}
|
|
14
15
|
attachGlobalListeners() {
|
|
15
16
|
document.addEventListener("click", (t) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
17
|
+
const s = t.target.closest("[data-fp-id]");
|
|
18
|
+
s && this.track("click", s.getAttribute("data-fp-id"), {
|
|
18
19
|
x: t.clientX,
|
|
19
20
|
y: t.clientY
|
|
20
21
|
});
|
|
21
22
|
}, { passive: !0 });
|
|
22
23
|
let e = 0, i = null;
|
|
23
24
|
document.addEventListener("mouseover", (t) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
25
|
+
const s = t.target.closest("[data-fp-id]");
|
|
26
|
+
s && (e = Date.now(), i = s.getAttribute("data-fp-id"));
|
|
26
27
|
}, { passive: !0 }), document.addEventListener("mouseout", (t) => {
|
|
27
28
|
if (!t.target.closest("[data-fp-id]") || !i)
|
|
28
29
|
return;
|
|
29
|
-
const
|
|
30
|
-
|
|
30
|
+
const r = Date.now() - e;
|
|
31
|
+
r > 500 && this.track("hover", i, { hoverDuration: r }), i = null;
|
|
31
32
|
}, { passive: !0 });
|
|
32
33
|
}
|
|
33
34
|
observeDOM() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const e = (s) => {
|
|
36
|
+
this.seenInView.has(s) || (this.seenInView.add(s), this.track("scroll_into_view", s, {
|
|
37
|
+
scrollDepth: Math.round(window.scrollY / Math.max(1, document.body.scrollHeight) * 100)
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
this.intersectionObserver = new IntersectionObserver((s) => {
|
|
41
|
+
for (const r of s) {
|
|
42
|
+
const n = r.target.dataset.fpId;
|
|
43
|
+
!n || !r.isIntersecting || e(n);
|
|
40
44
|
}
|
|
41
|
-
}, { threshold: 0.
|
|
42
|
-
const
|
|
43
|
-
document.querySelectorAll("[data-fp-id]").forEach((
|
|
44
|
-
this.intersectionObserver?.observe(
|
|
45
|
+
}, { threshold: 0.1 });
|
|
46
|
+
const i = () => {
|
|
47
|
+
document.querySelectorAll("[data-fp-id]").forEach((s) => {
|
|
48
|
+
this.intersectionObserver?.observe(s);
|
|
49
|
+
});
|
|
50
|
+
}, t = () => {
|
|
51
|
+
const s = window.innerHeight * 0.1, r = window.innerHeight * 0.9;
|
|
52
|
+
document.querySelectorAll("[data-fp-id]").forEach((n) => {
|
|
53
|
+
const o = n.dataset.fpId;
|
|
54
|
+
if (!o || this.seenInView.has(o))
|
|
55
|
+
return;
|
|
56
|
+
const a = n.getBoundingClientRect();
|
|
57
|
+
a.bottom >= s && a.top <= r && e(o);
|
|
45
58
|
});
|
|
46
59
|
};
|
|
47
|
-
|
|
60
|
+
i(), t(), this.scrollFallbackListener = () => t(), this.resizeFallbackListener = () => t(), window.addEventListener("scroll", this.scrollFallbackListener, { passive: !0 }), window.addEventListener("resize", this.resizeFallbackListener, { passive: !0 }), this.observer = new MutationObserver(() => i()), this.observer.observe(document.body, { childList: !0, subtree: !0 });
|
|
48
61
|
}
|
|
49
62
|
track(e, i, t) {
|
|
50
63
|
this.isBrowser() && this.queue.push({
|
|
@@ -83,12 +96,16 @@ class o {
|
|
|
83
96
|
}
|
|
84
97
|
async sendImmediate(e) {
|
|
85
98
|
try {
|
|
86
|
-
await fetch(this.config.endpoint, {
|
|
99
|
+
const i = await fetch(this.config.endpoint, {
|
|
87
100
|
method: "POST",
|
|
88
101
|
headers: { "content-type": "application/json" },
|
|
89
102
|
body: JSON.stringify({ events: e }),
|
|
90
103
|
keepalive: !0
|
|
91
104
|
});
|
|
105
|
+
if (this.config.debug && i.ok) {
|
|
106
|
+
const t = await i.json().catch(() => null);
|
|
107
|
+
t?.ingested !== void 0 && t?.pipeline && globalThis.console.debug(`[FeedPulse] ${t.ingested} events via ${t.pipeline} pipeline`);
|
|
108
|
+
}
|
|
92
109
|
} catch {
|
|
93
110
|
}
|
|
94
111
|
}
|
|
@@ -128,9 +145,9 @@ class o {
|
|
|
128
145
|
return e.includes("Windows") ? "Windows" : e.includes("Mac") ? "macOS" : e.includes("Linux") ? "Linux" : e.includes("Android") ? "Android" : /iPhone|iOS/.test(e) ? "iOS" : "Other";
|
|
129
146
|
}
|
|
130
147
|
destroy() {
|
|
131
|
-
this.flushInterval && clearInterval(this.flushInterval), this.observer?.disconnect(), this.intersectionObserver?.disconnect(), this.flush();
|
|
148
|
+
this.flushInterval && clearInterval(this.flushInterval), this.scrollFallbackListener && window.removeEventListener("scroll", this.scrollFallbackListener), this.resizeFallbackListener && window.removeEventListener("resize", this.resizeFallbackListener), this.observer?.disconnect(), this.intersectionObserver?.disconnect(), this.flush();
|
|
132
149
|
}
|
|
133
150
|
}
|
|
134
151
|
export {
|
|
135
|
-
|
|
152
|
+
l as FeedPulseTracker
|
|
136
153
|
};
|
package/dist/nuxt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),g=require("./index.js"),c=Symbol("feedpulse");function p(){return e.inject(c,null)}const b=e.defineComponent({__name:"FeedPulseProvider",props:{apiKey:{},endpoint:{},debug:{type:Boolean}},setup(t){const o=t,d=new g.FeedPulseTracker({apiKey:o.apiKey,endpoint:o.endpoint,debug:o.debug});return e.provide(c,d),e.onMounted(()=>d.init()),e.onBeforeUnmount(()=>d.destroy()),(r,n)=>e.renderSlot(r.$slots,"default")}}),x={key:1,style:{background:"#fff",border:"1px solid #e5e7eb","border-radius":"12px",padding:"16px",width:"280px","box-shadow":"0 10px 25px rgba(0,0,0,0.15)"}},k={style:{margin:"0 0 12px","font-weight":"600",color:"#111"}},v={style:{display:"flex",gap:"6px","margin-bottom":"12px"}},y=["onClick"],h={key:1,style:{"text-align":"center",padding:"16px",color:"#111"}},E=e.defineComponent({__name:"FeedPulseWidget",props:{id:{},placeholder:{},position:{default:"bottom-right"}},setup(t){const o=t,d=p(),r=e.ref(o.position==="inline"),n=e.ref(null),s=e.ref(""),a=e.ref(!1);function m(u){n.value=u}function f(){!n.value&&!s.value.trim()||(d?.trackFeedback(o.id??null,n.value,s.value||null),a.value=!0,setTimeout(()=>{r.value=o.position==="inline",a.value=!1,n.value=null,s.value=""},2e3))}return(u,l)=>(e.openBlock(),e.createElementBlock("div",{class:"feedpulse-widget",style:e.normalizeStyle(t.position!=="inline"?`position:fixed; ${t.position==="bottom-right"?"right:24px":"left:24px"}; bottom:24px; z-index:9999;`:"")},[t.position!=="inline"?(e.openBlock(),e.createElementBlock("button",{key:0,style:{background:"#6366f1",color:"#fff",border:"none","border-radius":"50%",width:"48px",height:"48px","font-size":"20px",cursor:"pointer"},onClick:l[0]||(l[0]=i=>r.value=!r.value)}," 💬 ")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",x,[a.value?(e.openBlock(),e.createElementBlock("div",h,[...l[2]||(l[2]=[e.createElementVNode("p",{style:{"font-size":"28px",margin:"0"}}," 🎉 ",-1),e.createElementVNode("p",{style:{margin:"8px 0 0","font-weight":"600"}}," Thanks for your feedback! ",-1)])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("p",k,e.toDisplayString(t.placeholder??"How was your experience?"),1),e.createElementVNode("div",v,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,i=>e.createElementVNode("button",{key:i,style:e.normalizeStyle({background:"none",border:"none",cursor:"pointer",fontSize:"24px",opacity:n.value!==null&&i<=n.value?1:.3}),onClick:w=>m(i)}," ⭐ ",12,y)),64))]),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":l[1]||(l[1]=i=>s.value=i),placeholder:"Tell us more (optional)...",rows:"3",style:{width:"100%",padding:"8px",border:"1px solid #d1d5db","border-radius":"8px",resize:"none","font-size":"14px"}},null,512),[[e.vModelText,s.value]]),e.createElementVNode("button",{style:{"margin-top":"10px",width:"100%",background:"#6366f1",color:"#fff",border:"none","border-radius":"8px",padding:"10px","font-weight":"600",cursor:"pointer"},onClick:f}," Submit Feedback ")],64))])):e.createCommentVNode("",!0)],4))}});exports.FeedPulseProvider=b;exports.FeedPulseWidget=E;exports.useFeedPulse=p;
|
package/dist/nuxt.mjs
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import { inject as h, defineComponent as
|
|
1
|
+
import { inject as h, defineComponent as m, provide as w, onMounted as F, onBeforeUnmount as P, renderSlot as _, ref as p, createElementBlock as s, openBlock as d, normalizeStyle as x, createCommentVNode as b, Fragment as g, createElementVNode as n, withDirectives as z, toDisplayString as S, renderList as C, vModelText as E } from "vue";
|
|
2
2
|
import { FeedPulseTracker as T } from "./index.mjs";
|
|
3
3
|
const v = /* @__PURE__ */ Symbol("feedpulse");
|
|
4
4
|
function $() {
|
|
5
5
|
return h(v, null);
|
|
6
6
|
}
|
|
7
|
-
const W = /* @__PURE__ */
|
|
7
|
+
const W = /* @__PURE__ */ m({
|
|
8
8
|
__name: "FeedPulseProvider",
|
|
9
9
|
props: {
|
|
10
10
|
apiKey: {},
|
|
11
|
-
endpoint: {}
|
|
11
|
+
endpoint: {},
|
|
12
|
+
debug: { type: Boolean }
|
|
12
13
|
},
|
|
13
14
|
setup(e) {
|
|
14
|
-
const
|
|
15
|
-
apiKey:
|
|
16
|
-
endpoint:
|
|
15
|
+
const t = e, u = new T({
|
|
16
|
+
apiKey: t.apiKey,
|
|
17
|
+
endpoint: t.endpoint,
|
|
18
|
+
debug: t.debug
|
|
17
19
|
});
|
|
18
|
-
return w(v,
|
|
20
|
+
return w(v, u), F(() => u.init()), P(() => u.destroy()), (i, o) => _(i.$slots, "default");
|
|
19
21
|
}
|
|
20
|
-
}),
|
|
22
|
+
}), B = {
|
|
21
23
|
key: 1,
|
|
22
24
|
style: { background: "#fff", border: "1px solid #e5e7eb", "border-radius": "12px", padding: "16px", width: "280px", "box-shadow": "0 10px 25px rgba(0,0,0,0.15)" }
|
|
23
|
-
},
|
|
25
|
+
}, K = { style: { margin: "0 0 12px", "font-weight": "600", color: "#111" } }, D = { style: { display: "flex", gap: "6px", "margin-bottom": "12px" } }, U = ["onClick"], V = {
|
|
24
26
|
key: 1,
|
|
25
27
|
style: { "text-align": "center", padding: "16px", color: "#111" }
|
|
26
|
-
}, j = /* @__PURE__ */
|
|
28
|
+
}, j = /* @__PURE__ */ m({
|
|
27
29
|
__name: "FeedPulseWidget",
|
|
28
30
|
props: {
|
|
29
31
|
id: {},
|
|
@@ -31,13 +33,13 @@ const W = /* @__PURE__ */ g({
|
|
|
31
33
|
position: { default: "bottom-right" }
|
|
32
34
|
},
|
|
33
35
|
setup(e) {
|
|
34
|
-
const
|
|
36
|
+
const t = e, u = $(), i = p(t.position === "inline"), o = p(null), a = p(""), c = p(!1);
|
|
35
37
|
function y(f) {
|
|
36
|
-
|
|
38
|
+
o.value = f;
|
|
37
39
|
}
|
|
38
40
|
function k() {
|
|
39
|
-
!
|
|
40
|
-
i.value =
|
|
41
|
+
!o.value && !a.value.trim() || (u?.trackFeedback(t.id ?? null, o.value, a.value || null), c.value = !0, setTimeout(() => {
|
|
42
|
+
i.value = t.position === "inline", c.value = !1, o.value = null, a.value = "";
|
|
41
43
|
}, 2e3));
|
|
42
44
|
}
|
|
43
45
|
return (f, r) => (d(), s("div", {
|
|
@@ -48,34 +50,34 @@ const W = /* @__PURE__ */ g({
|
|
|
48
50
|
key: 0,
|
|
49
51
|
style: { background: "#6366f1", color: "#fff", border: "none", "border-radius": "50%", width: "48px", height: "48px", "font-size": "20px", cursor: "pointer" },
|
|
50
52
|
onClick: r[0] || (r[0] = (l) => i.value = !i.value)
|
|
51
|
-
}, " 💬 ")) :
|
|
52
|
-
i.value ? (d(), s("div",
|
|
53
|
+
}, " 💬 ")) : b("", !0),
|
|
54
|
+
i.value ? (d(), s("div", B, [
|
|
53
55
|
c.value ? (d(), s("div", V, [...r[2] || (r[2] = [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
])])) : (d(), s(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(d(), s(
|
|
56
|
+
n("p", { style: { "font-size": "28px", margin: "0" } }, " 🎉 ", -1),
|
|
57
|
+
n("p", { style: { margin: "8px 0 0", "font-weight": "600" } }, " Thanks for your feedback! ", -1)
|
|
58
|
+
])])) : (d(), s(g, { key: 0 }, [
|
|
59
|
+
n("p", K, S(e.placeholder ?? "How was your experience?"), 1),
|
|
60
|
+
n("div", D, [
|
|
61
|
+
(d(), s(g, null, C(5, (l) => n("button", {
|
|
60
62
|
key: l,
|
|
61
|
-
style: x({ background: "none", border: "none", cursor: "pointer", fontSize: "24px", opacity:
|
|
63
|
+
style: x({ background: "none", border: "none", cursor: "pointer", fontSize: "24px", opacity: o.value !== null && l <= o.value ? 1 : 0.3 }),
|
|
62
64
|
onClick: (L) => y(l)
|
|
63
65
|
}, " ⭐ ", 12, U)), 64))
|
|
64
66
|
]),
|
|
65
|
-
z(
|
|
66
|
-
"onUpdate:modelValue": r[1] || (r[1] = (l) =>
|
|
67
|
+
z(n("textarea", {
|
|
68
|
+
"onUpdate:modelValue": r[1] || (r[1] = (l) => a.value = l),
|
|
67
69
|
placeholder: "Tell us more (optional)...",
|
|
68
70
|
rows: "3",
|
|
69
71
|
style: { width: "100%", padding: "8px", border: "1px solid #d1d5db", "border-radius": "8px", resize: "none", "font-size": "14px" }
|
|
70
72
|
}, null, 512), [
|
|
71
|
-
[E,
|
|
73
|
+
[E, a.value]
|
|
72
74
|
]),
|
|
73
|
-
|
|
75
|
+
n("button", {
|
|
74
76
|
style: { "margin-top": "10px", width: "100%", background: "#6366f1", color: "#fff", border: "none", "border-radius": "8px", padding: "10px", "font-weight": "600", cursor: "pointer" },
|
|
75
77
|
onClick: k
|
|
76
78
|
}, " Submit Feedback ")
|
|
77
79
|
], 64))
|
|
78
|
-
])) :
|
|
80
|
+
])) : b("", !0)
|
|
79
81
|
], 4));
|
|
80
82
|
}
|
|
81
83
|
});
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),ne=require("./index.js");var S={exports:{}},g={};var z;function oe(){if(z)return g;z=1;var i=Symbol.for("react.transitional.element"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),ne=require("./index.js");var S={exports:{}},g={};var z;function oe(){if(z)return g;z=1;var i=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function s(d,n,u){var c=null;if(u!==void 0&&(c=""+u),n.key!==void 0&&(c=""+n.key),"key"in n){u={};for(var b in n)b!=="key"&&(u[b]=n[b])}else u=n;return n=u.ref,{$$typeof:i,type:d,key:c,ref:n!==void 0?n:null,props:u}}return g.Fragment=f,g.jsx=s,g.jsxs=s,g}var x={};var D;function ae(){return D||(D=1,process.env.NODE_ENV!=="production"&&(function(){function i(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case P:return"Fragment";case V:return"Profiler";case J:return"StrictMode";case H:return"Suspense";case Z:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case U:return"Portal";case X:return e.displayName||"Context";case G:return(e._context.displayName||"Context")+".Consumer";case B:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return r=e.displayName||null,r!==null?r:i(e.type)||"Memo";case j:r=e._payload,e=e._init;try{return i(e(r))}catch{}}return null}function f(e){return""+e}function s(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),f(e)}}function d(e){if(e===P)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var r=i(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function n(){var e=w.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function c(e){if(N.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function t(){F||(F=!0,console.error("%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)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function R(){var e=i(this.type);return Y[e]||(Y[e]=!0,console.error("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.")),e=this.props.ref,e!==void 0?e:null}function T(e,r,t,o,y,A){var a=t.ref;return e={$$typeof:p,type:e,key:r,props:t,_owner:o},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:R}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:y}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function k(e,r,t,o,y,A){var a=r.children;if(a!==void 0)if(o)if(re(a)){for(o=0;o<a.length;o++)v(a[o]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(a);if(N.call(r,"key")){a=i(e);var _=Object.keys(r).filter(function(te){return te!=="key"});o=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",W[a+o]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,o,a,_,a),W[a+o]=!0)}if(a=null,t!==void 0&&(s(t),a=""+t),c(r)&&(s(r.key),a=""+r.key),"key"in r){t={};for(var C in r)C!=="key"&&(t[C]=r[C])}else t=r;return a&&b(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),T(e,a,t,n(),y,A)}function v(e){h(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===j&&(e._payload.status==="fulfilled"?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function h(e){return typeof e=="object"&&e!==null&&e.$$typeof===p}var E=m,p=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),J=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),X=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),ee=Symbol.for("react.client.reference"),w=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,re=Array.isArray,O=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(e){return e()}};var F,Y={},I=E.react_stack_bottom_frame.bind(E,u)(),$=O(d(u)),W={};x.Fragment=P,x.jsx=function(e,r,t){var o=1e4>w.recentlyCreatedOwnerStacks++;return k(e,r,t,!1,o?Error("react-stack-top-frame"):I,o?O(d(e)):$)},x.jsxs=function(e,r,t){var o=1e4>w.recentlyCreatedOwnerStacks++;return k(e,r,t,!0,o?Error("react-stack-top-frame"):I,o?O(d(e)):$)}})()),x}var M;function se(){return M||(M=1,process.env.NODE_ENV==="production"?S.exports=oe():S.exports=ae()),S.exports}var l=se();const L=m.createContext({tracker:null});function le({apiKey:i,endpoint:f,debug:s,children:d}){const n=m.useRef(null);return m.useEffect(()=>(n.current=new ne.FeedPulseTracker({apiKey:i,endpoint:f,debug:s}),n.current.init(),()=>n.current?.destroy()),[i,f,s]),l.jsx(L.Provider,{value:{tracker:n.current},children:d})}function q(){return m.useContext(L)}function ue({id:i,placeholder:f,position:s="bottom-right"}){const{tracker:d}=q(),[n,u]=m.useState(s==="inline"),[c,b]=m.useState(null),[R,T]=m.useState(""),[k,v]=m.useState(!1),h=()=>{!c&&!R.trim()||(d?.trackFeedback(i??null,c,R||null),v(!0),setTimeout(()=>{u(s==="inline"),v(!1),b(null),T("")},2e3))},E=s!=="inline"?{position:"fixed",bottom:24,[s==="bottom-right"?"right":"left"]:24,zIndex:9999}:{};return l.jsxs("div",{style:E,children:[s!=="inline"&&l.jsx("button",{onClick:()=>u(!n),style:{background:"#6366f1",color:"#fff",border:"none",borderRadius:"50%",width:48,height:48,fontSize:20,cursor:"pointer"},children:"💬"}),n&&l.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:k?l.jsxs("div",{style:{textAlign:"center",padding:16},children:[l.jsx("p",{style:{fontSize:28,margin:0},children:"🎉"}),l.jsx("p",{style:{margin:"8px 0 0",fontWeight:600},children:"Thanks for your feedback!"})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{margin:"0 0 12px",fontWeight:600},children:f??"How was your experience?"}),l.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:[1,2,3,4,5].map(p=>l.jsx("button",{onClick:()=>b(p),style:{background:"none",border:"none",cursor:"pointer",fontSize:24,opacity:c!==null&&p<=c?1:.3},children:"⭐"},p))}),l.jsx("textarea",{value:R,onChange:p=>T(p.target.value),placeholder:"Tell us more (optional)...",rows:3,style:{width:"100%",padding:8,border:"1px solid #d1d5db",borderRadius:8,resize:"none",fontSize:14}}),l.jsx("button",{onClick:h,style:{marginTop:10,width:"100%",background:"#6366f1",color:"#fff",border:"none",borderRadius:8,padding:10,fontWeight:600,cursor:"pointer"},children:"Submit Feedback"})]})})]})}exports.FeedPulseProvider=le;exports.FeedPulseWidget=ue;exports.useFeedPulse=q;
|
package/dist/react.mjs
CHANGED
|
@@ -2,32 +2,32 @@ import te, { createContext as ne, useRef as oe, useEffect as ae, useContext as s
|
|
|
2
2
|
import { FeedPulseTracker as le } from "./index.mjs";
|
|
3
3
|
var S = { exports: {} }, v = {};
|
|
4
4
|
var z;
|
|
5
|
-
function
|
|
5
|
+
function ie() {
|
|
6
6
|
if (z) return v;
|
|
7
7
|
z = 1;
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
for (var m in
|
|
14
|
-
m !== "key" && (
|
|
15
|
-
} else
|
|
16
|
-
return
|
|
17
|
-
$$typeof:
|
|
18
|
-
type:
|
|
19
|
-
key:
|
|
20
|
-
ref:
|
|
21
|
-
props:
|
|
8
|
+
var u = /* @__PURE__ */ Symbol.for("react.transitional.element"), f = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
9
|
+
function s(d, n, i) {
|
|
10
|
+
var c = null;
|
|
11
|
+
if (i !== void 0 && (c = "" + i), n.key !== void 0 && (c = "" + n.key), "key" in n) {
|
|
12
|
+
i = {};
|
|
13
|
+
for (var m in n)
|
|
14
|
+
m !== "key" && (i[m] = n[m]);
|
|
15
|
+
} else i = n;
|
|
16
|
+
return n = i.ref, {
|
|
17
|
+
$$typeof: u,
|
|
18
|
+
type: d,
|
|
19
|
+
key: c,
|
|
20
|
+
ref: n !== void 0 ? n : null,
|
|
21
|
+
props: i
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
return v.Fragment =
|
|
24
|
+
return v.Fragment = f, v.jsx = s, v.jsxs = s, v;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var x = {};
|
|
27
27
|
var D;
|
|
28
|
-
function
|
|
28
|
+
function ue() {
|
|
29
29
|
return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
|
-
function
|
|
30
|
+
function u(e) {
|
|
31
31
|
if (e == null) return null;
|
|
32
32
|
if (typeof e == "function")
|
|
33
33
|
return e.$$typeof === K ? null : e.displayName || e.name || null;
|
|
@@ -60,55 +60,55 @@ function ie() {
|
|
|
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
62
|
case Z:
|
|
63
|
-
return r = e.displayName || null, r !== null ? r :
|
|
63
|
+
return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
|
|
64
64
|
case w:
|
|
65
65
|
r = e._payload, e = e._init;
|
|
66
66
|
try {
|
|
67
|
-
return
|
|
67
|
+
return u(e(r));
|
|
68
68
|
} catch {
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function f(e) {
|
|
74
74
|
return "" + e;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function s(e) {
|
|
77
77
|
try {
|
|
78
|
-
|
|
78
|
+
f(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 t = r.error,
|
|
85
|
+
var t = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
86
86
|
return t.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
|
+
o
|
|
90
|
+
), f(e);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function d(e) {
|
|
94
94
|
if (e === j) return "<>";
|
|
95
95
|
if (typeof e == "object" && e !== null && e.$$typeof === w)
|
|
96
96
|
return "<...>";
|
|
97
97
|
try {
|
|
98
|
-
var r =
|
|
98
|
+
var r = u(e);
|
|
99
99
|
return r ? "<" + r + ">" : "<...>";
|
|
100
100
|
} catch {
|
|
101
101
|
return "<...>";
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function n() {
|
|
105
105
|
var e = P.A;
|
|
106
106
|
return e === null ? null : e.getOwner();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function i() {
|
|
109
109
|
return Error("react-stack-top-frame");
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function c(e) {
|
|
112
112
|
if (N.call(e, "key")) {
|
|
113
113
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
114
114
|
if (r && r.isReactWarning) return !1;
|
|
@@ -128,20 +128,20 @@ function ie() {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
function _() {
|
|
131
|
-
var e =
|
|
131
|
+
var e = u(this.type);
|
|
132
132
|
return Y[e] || (Y[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 g(e, r, t, o, h, A) {
|
|
137
|
+
var a = t.ref;
|
|
138
138
|
return e = {
|
|
139
139
|
$$typeof: b,
|
|
140
140
|
type: e,
|
|
141
141
|
key: r,
|
|
142
142
|
props: t,
|
|
143
|
-
_owner:
|
|
144
|
-
}, (
|
|
143
|
+
_owner: o
|
|
144
|
+
}, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
|
|
145
145
|
enumerable: !1,
|
|
146
146
|
get: _
|
|
147
147
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
@@ -166,50 +166,50 @@ function ie() {
|
|
|
166
166
|
value: A
|
|
167
167
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
168
168
|
}
|
|
169
|
-
function k(e, r, t,
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
if (ee(
|
|
174
|
-
for (
|
|
175
|
-
R(o
|
|
176
|
-
Object.freeze && Object.freeze(
|
|
169
|
+
function k(e, r, t, o, h, A) {
|
|
170
|
+
var a = r.children;
|
|
171
|
+
if (a !== void 0)
|
|
172
|
+
if (o)
|
|
173
|
+
if (ee(a)) {
|
|
174
|
+
for (o = 0; o < a.length; o++)
|
|
175
|
+
R(a[o]);
|
|
176
|
+
Object.freeze && Object.freeze(a);
|
|
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 R(
|
|
181
|
+
else R(a);
|
|
182
182
|
if (N.call(r, "key")) {
|
|
183
|
-
|
|
183
|
+
a = u(e);
|
|
184
184
|
var E = Object.keys(r).filter(function(re) {
|
|
185
185
|
return re !== "key";
|
|
186
186
|
});
|
|
187
|
-
|
|
187
|
+
o = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", W[a + o] || (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
|
-
n,
|
|
195
194
|
o,
|
|
195
|
+
a,
|
|
196
196
|
E,
|
|
197
|
-
|
|
198
|
-
), W[
|
|
197
|
+
a
|
|
198
|
+
), W[a + o] = !0);
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
200
|
+
if (a = null, t !== void 0 && (s(t), a = "" + t), c(r) && (s(r.key), a = "" + r.key), "key" in r) {
|
|
201
201
|
t = {};
|
|
202
202
|
for (var C in r)
|
|
203
203
|
C !== "key" && (t[C] = r[C]);
|
|
204
204
|
} else t = r;
|
|
205
|
-
return
|
|
205
|
+
return a && m(
|
|
206
206
|
t,
|
|
207
207
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
208
|
-
),
|
|
208
|
+
), g(
|
|
209
209
|
e,
|
|
210
|
-
|
|
210
|
+
a,
|
|
211
211
|
t,
|
|
212
|
-
|
|
212
|
+
n(),
|
|
213
213
|
h,
|
|
214
214
|
A
|
|
215
215
|
);
|
|
@@ -230,88 +230,89 @@ React keys must be passed directly to JSX without using spread:
|
|
|
230
230
|
};
|
|
231
231
|
var F, Y = {}, I = p.react_stack_bottom_frame.bind(
|
|
232
232
|
p,
|
|
233
|
-
|
|
234
|
-
)(), $ = O(
|
|
235
|
-
|
|
236
|
-
var
|
|
233
|
+
i
|
|
234
|
+
)(), $ = O(d(i)), W = {};
|
|
235
|
+
x.Fragment = j, x.jsx = function(e, r, t) {
|
|
236
|
+
var o = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
237
237
|
return k(
|
|
238
238
|
e,
|
|
239
239
|
r,
|
|
240
240
|
t,
|
|
241
241
|
!1,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
o ? Error("react-stack-top-frame") : I,
|
|
243
|
+
o ? O(d(e)) : $
|
|
244
244
|
);
|
|
245
|
-
},
|
|
246
|
-
var
|
|
245
|
+
}, x.jsxs = function(e, r, t) {
|
|
246
|
+
var o = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
247
247
|
return k(
|
|
248
248
|
e,
|
|
249
249
|
r,
|
|
250
250
|
t,
|
|
251
251
|
!0,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
o ? Error("react-stack-top-frame") : I,
|
|
253
|
+
o ? O(d(e)) : $
|
|
254
254
|
);
|
|
255
255
|
};
|
|
256
|
-
})()),
|
|
256
|
+
})()), x;
|
|
257
257
|
}
|
|
258
258
|
var M;
|
|
259
259
|
function ce() {
|
|
260
|
-
return M || (M = 1, process.env.NODE_ENV === "production" ? S.exports =
|
|
260
|
+
return M || (M = 1, process.env.NODE_ENV === "production" ? S.exports = ie() : S.exports = ue()), S.exports;
|
|
261
261
|
}
|
|
262
|
-
var
|
|
262
|
+
var l = ce();
|
|
263
263
|
const L = ne({ tracker: null });
|
|
264
264
|
function be({
|
|
265
|
-
apiKey:
|
|
266
|
-
endpoint:
|
|
267
|
-
|
|
265
|
+
apiKey: u,
|
|
266
|
+
endpoint: f,
|
|
267
|
+
debug: s,
|
|
268
|
+
children: d
|
|
268
269
|
}) {
|
|
269
|
-
const
|
|
270
|
-
return ae(() => (
|
|
270
|
+
const n = oe(null);
|
|
271
|
+
return ae(() => (n.current = new le({ apiKey: u, endpoint: f, debug: s }), n.current.init(), () => n.current?.destroy()), [u, f, s]), /* @__PURE__ */ l.jsx(L.Provider, { value: { tracker: n.current }, children: d });
|
|
271
272
|
}
|
|
272
273
|
function fe() {
|
|
273
274
|
return se(L);
|
|
274
275
|
}
|
|
275
|
-
function pe({ id:
|
|
276
|
-
const { tracker:
|
|
277
|
-
!
|
|
278
|
-
|
|
276
|
+
function pe({ id: u, placeholder: f, position: s = "bottom-right" }) {
|
|
277
|
+
const { tracker: d } = fe(), [n, i] = y(s === "inline"), [c, m] = y(null), [_, g] = y(""), [k, R] = y(!1), T = () => {
|
|
278
|
+
!c && !_.trim() || (d?.trackFeedback(u ?? null, c, _ || null), R(!0), setTimeout(() => {
|
|
279
|
+
i(s === "inline"), R(!1), m(null), g("");
|
|
279
280
|
}, 2e3));
|
|
280
|
-
}, p =
|
|
281
|
-
return /* @__PURE__ */
|
|
282
|
-
|
|
281
|
+
}, p = s !== "inline" ? { position: "fixed", bottom: 24, [s === "bottom-right" ? "right" : "left"]: 24, zIndex: 9999 } : {};
|
|
282
|
+
return /* @__PURE__ */ l.jsxs("div", { style: p, children: [
|
|
283
|
+
s !== "inline" && /* @__PURE__ */ l.jsx(
|
|
283
284
|
"button",
|
|
284
285
|
{
|
|
285
|
-
onClick: () =>
|
|
286
|
+
onClick: () => i(!n),
|
|
286
287
|
style: { background: "#6366f1", color: "#fff", border: "none", borderRadius: "50%", width: 48, height: 48, fontSize: 20, cursor: "pointer" },
|
|
287
288
|
children: "💬"
|
|
288
289
|
}
|
|
289
290
|
),
|
|
290
|
-
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
] }) : /* @__PURE__ */
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
291
|
+
n && /* @__PURE__ */ l.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: k ? /* @__PURE__ */ l.jsxs("div", { style: { textAlign: "center", padding: 16 }, children: [
|
|
292
|
+
/* @__PURE__ */ l.jsx("p", { style: { fontSize: 28, margin: 0 }, children: "🎉" }),
|
|
293
|
+
/* @__PURE__ */ l.jsx("p", { style: { margin: "8px 0 0", fontWeight: 600 }, children: "Thanks for your feedback!" })
|
|
294
|
+
] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
295
|
+
/* @__PURE__ */ l.jsx("p", { style: { margin: "0 0 12px", fontWeight: 600 }, children: f ?? "How was your experience?" }),
|
|
296
|
+
/* @__PURE__ */ l.jsx("div", { style: { display: "flex", gap: 6, marginBottom: 12 }, children: [1, 2, 3, 4, 5].map((b) => /* @__PURE__ */ l.jsx(
|
|
296
297
|
"button",
|
|
297
298
|
{
|
|
298
299
|
onClick: () => m(b),
|
|
299
|
-
style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity:
|
|
300
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: 24, opacity: c !== null && b <= c ? 1 : 0.3 },
|
|
300
301
|
children: "⭐"
|
|
301
302
|
},
|
|
302
303
|
b
|
|
303
304
|
)) }),
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ l.jsx(
|
|
305
306
|
"textarea",
|
|
306
307
|
{
|
|
307
308
|
value: _,
|
|
308
|
-
onChange: (b) =>
|
|
309
|
+
onChange: (b) => g(b.target.value),
|
|
309
310
|
placeholder: "Tell us more (optional)...",
|
|
310
311
|
rows: 3,
|
|
311
312
|
style: { width: "100%", padding: 8, border: "1px solid #d1d5db", borderRadius: 8, resize: "none", fontSize: 14 }
|
|
312
313
|
}
|
|
313
314
|
),
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ l.jsx(
|
|
315
316
|
"button",
|
|
316
317
|
{
|
|
317
318
|
onClick: T,
|
package/package.json
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekibo/feedpulse-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Embeddable analytics and feedback SDK for FeedPulse",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/index.mjs",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
5
|
"exports": {
|
|
12
6
|
".": {
|
|
13
7
|
"import": "./dist/index.mjs",
|
|
@@ -22,6 +16,16 @@
|
|
|
22
16
|
"require": "./dist/react.js"
|
|
23
17
|
}
|
|
24
18
|
},
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"module": "./dist/index.mjs",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "vite build",
|
|
27
|
+
"dev": "vite build --watch"
|
|
28
|
+
},
|
|
25
29
|
"peerDependencies": {
|
|
26
30
|
"react": ">=18.0.0",
|
|
27
31
|
"vue": ">=3.0.0"
|
|
@@ -34,10 +38,6 @@
|
|
|
34
38
|
"optional": true
|
|
35
39
|
}
|
|
36
40
|
},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "vite build",
|
|
39
|
-
"dev": "vite build --watch"
|
|
40
|
-
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@vitejs/plugin-react": "^4.7.0",
|
|
43
43
|
"@vitejs/plugin-vue": "^6.0.1",
|