@picked/hotjar 0.0.50-next.3 → 0.0.50-next.4

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/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../plugin-BWR_ipa5.cjs");exports.hotjarPlugin=e.hotjarPlugin;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../hotjar-B3aOOfel.cjs`);exports.hotjarPlugin=e.t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../plugin-BWR_ipa5.cjs");exports.hotjarPlugin=e.hotjarPlugin;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../../hotjar-B3aOOfel.cjs`);exports.hotjarPlugin=e.t;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,2 @@
1
- import { h as a } from "../plugin-8YCruaTQ.js";
2
- export {
3
- a as hotjarPlugin
4
- };
1
+ import { t as e } from "../hotjar-CEyJMoTX.js";
2
+ export { e as hotjarPlugin };
@@ -1,4 +1,2 @@
1
- import { h as a } from "../../../plugin-8YCruaTQ.js";
2
- export {
3
- a as hotjarPlugin
4
- };
1
+ import { t as e } from "../../../hotjar-CEyJMoTX.js";
2
+ export { e as hotjarPlugin };
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@hotjar/browser`);c=s(c);let l=require(`@picked/client`),u=require(`effector`);var d=[`step_enter`,`step_complete`,`step_submit`,`field_validation_error`,`experience_complete`,`experience_initialize`,`session`],f=({siteId:e,snippetVersion:t=6,trackedEvents:n=d,getUserAttributes:r,autoStartRecording:i=!0,recordingStartEvent:a=`hotjar_start`})=>{let o=!1,s=!1,f={events:[],isProcessing:!1,isWaiting:!1,push(e){f.events.push(e),Promise.resolve().then(()=>this.processQueue())},processQueue(){if(!this.isProcessing){if(!c.default.isReady()){this.wait();return}this.isProcessing=!0;try{for(;this.events.length>0;){let e=this.events.shift();if(!e)break;e()}}finally{this.isProcessing=!1,this.events.length>0&&c.default.isReady()&&Promise.resolve().then(()=>this.processQueue())}}},wait(){if(this.isWaiting)return;this.isWaiting=!0;let e=setInterval(()=>{c.default.isReady()&&(clearInterval(e),this.isWaiting=!1,this.processQueue())},100)}},p=e=>{f.push(e)};return{name:`hotjar`,setup:d=>{if(!(0,l.supportsWindow)())return;let f=new Set(n),m=(0,u.createEffect)(n=>{if(!o){o=!0;try{c.default.init(e,t)}catch{}}p(()=>{try{i&&n.type===`experience_initialize`&&!s&&(c.default.event(a),s=!0);let e=[n.type],t=`experience`in n&&n.experience.configStore.getState().name;t&&(e.push(t),`step`in n&&n.step?.label&&e.push(n.step.label)),c.default.event(e.join(` > `))}catch{}})}),h=(0,u.createEffect)(e=>{e.type===`session`&&`id`in e&&p(()=>{try{let t=r?.()??{};c.default.identify(e.id,{organisationId:d.organizationId,projectId:d.projectId,...t})}catch{}})});(0,u.sample)({clock:d.eventBus,filter:({type:e})=>e===`session`,target:h}),(0,u.sample)({clock:d.eventBus,filter:e=>f.has(e.type),target:m})}}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
@@ -0,0 +1,92 @@
1
+ import e from "@hotjar/browser";
2
+ import { supportsWindow as t } from "@picked/client";
3
+ import { createEffect as n, sample as r } from "effector";
4
+ //#region src/plugins/hotjar/plugin.ts
5
+ var i = [
6
+ "step_enter",
7
+ "step_complete",
8
+ "step_submit",
9
+ "field_validation_error",
10
+ "experience_complete",
11
+ "experience_initialize",
12
+ "session"
13
+ ], a = ({ siteId: a, snippetVersion: o = 6, trackedEvents: s = i, getUserAttributes: c, autoStartRecording: l = !0, recordingStartEvent: u = "hotjar_start" }) => {
14
+ let d = !1, f = !1, p = {
15
+ events: [],
16
+ isProcessing: !1,
17
+ isWaiting: !1,
18
+ push(e) {
19
+ p.events.push(e), Promise.resolve().then(() => this.processQueue());
20
+ },
21
+ processQueue() {
22
+ if (!this.isProcessing) {
23
+ if (!e.isReady()) {
24
+ this.wait();
25
+ return;
26
+ }
27
+ this.isProcessing = !0;
28
+ try {
29
+ for (; this.events.length > 0;) {
30
+ let e = this.events.shift();
31
+ if (!e) break;
32
+ e();
33
+ }
34
+ } finally {
35
+ this.isProcessing = !1, this.events.length > 0 && e.isReady() && Promise.resolve().then(() => this.processQueue());
36
+ }
37
+ }
38
+ },
39
+ wait() {
40
+ if (this.isWaiting) return;
41
+ this.isWaiting = !0;
42
+ let t = setInterval(() => {
43
+ e.isReady() && (clearInterval(t), this.isWaiting = !1, this.processQueue());
44
+ }, 100);
45
+ }
46
+ }, m = (e) => {
47
+ p.push(e);
48
+ };
49
+ return {
50
+ name: "hotjar",
51
+ setup: (i) => {
52
+ if (!t()) return;
53
+ let p = new Set(s), h = n((t) => {
54
+ if (!d) {
55
+ d = !0;
56
+ try {
57
+ e.init(a, o);
58
+ } catch {}
59
+ }
60
+ m(() => {
61
+ try {
62
+ l && t.type === "experience_initialize" && !f && (e.event(u), f = !0);
63
+ let n = [t.type], r = "experience" in t && t.experience.configStore.getState().name;
64
+ r && (n.push(r), "step" in t && t.step?.label && n.push(t.step.label)), e.event(n.join(" > "));
65
+ } catch {}
66
+ });
67
+ }), g = n((t) => {
68
+ t.type === "session" && "id" in t && m(() => {
69
+ try {
70
+ let n = c?.() ?? {};
71
+ e.identify(t.id, {
72
+ organisationId: i.organizationId,
73
+ projectId: i.projectId,
74
+ ...n
75
+ });
76
+ } catch {}
77
+ });
78
+ });
79
+ r({
80
+ clock: i.eventBus,
81
+ filter: ({ type: e }) => e === "session",
82
+ target: g
83
+ }), r({
84
+ clock: i.eventBus,
85
+ filter: (e) => p.has(e.type),
86
+ target: h
87
+ });
88
+ }
89
+ };
90
+ };
91
+ //#endregion
92
+ export { a as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/hotjar",
3
3
  "description": "Picked Hotjar Plugin",
4
- "version": "0.0.50-next.3",
4
+ "version": "0.0.50-next.4",
5
5
  "dependencies": {
6
6
  "@hotjar/browser": "^1.0.9"
7
7
  },
@@ -13,15 +13,15 @@
13
13
  "@rollup/plugin-replace": "^6.0.2",
14
14
  "@size-limit/preset-small-lib": "^12.0.0",
15
15
  "@types/node": "^22",
16
- "@vitest/coverage-v8": "^4.0.17",
16
+ "@vitest/coverage-v8": "^4.1.0",
17
17
  "effector": "^23.3.0",
18
18
  "jsdom": "^26.1.0",
19
19
  "size-limit": "^12.0.0",
20
20
  "tsup": "^8.5.0",
21
21
  "tsx": "^4.20.3",
22
- "vite": "^7.3.1",
22
+ "vite": "^8.0.1",
23
23
  "vite-plugin-dts": "^4.5.4",
24
- "vitest": "^4.0.17"
24
+ "vitest": "^4.1.0"
25
25
  },
26
26
  "exports": {
27
27
  ".": {
@@ -51,7 +51,7 @@
51
51
  "main": "./dist/cjs/index.js",
52
52
  "module": "./dist/esm/index.js",
53
53
  "peerDependencies": {
54
- "@picked/client": "0.0.50-next.3",
54
+ "@picked/client": "0.0.50-next.4",
55
55
  "effector": "^23.3.0"
56
56
  },
57
57
  "private": false,
@@ -1,105 +0,0 @@
1
- import i from "@hotjar/browser";
2
- import { supportsWindow as j } from "@picked/client";
3
- import { createEffect as p, sample as h } from "effector";
4
- const x = [
5
- "step_enter",
6
- "step_complete",
7
- "step_submit",
8
- "field_validation_error",
9
- "experience_complete",
10
- "experience_initialize",
11
- "session"
12
- ], R = ({
13
- siteId: u,
14
- snippetVersion: l = 6,
15
- trackedEvents: f = x,
16
- getUserAttributes: d,
17
- autoStartRecording: g = !0,
18
- recordingStartEvent: m = "hotjar_start"
19
- }) => {
20
- let r = !1, n = !1;
21
- const o = {
22
- events: [],
23
- isProcessing: !1,
24
- isWaiting: !1,
25
- push(t) {
26
- o.events.push(t), Promise.resolve().then(() => this.processQueue());
27
- },
28
- processQueue() {
29
- if (!this.isProcessing) {
30
- if (!i.isReady()) {
31
- this.wait();
32
- return;
33
- }
34
- this.isProcessing = !0;
35
- try {
36
- for (; this.events.length > 0; ) {
37
- const t = this.events.shift();
38
- if (!t) break;
39
- t();
40
- }
41
- } finally {
42
- this.isProcessing = !1, this.events.length > 0 && i.isReady() && Promise.resolve().then(() => this.processQueue());
43
- }
44
- }
45
- },
46
- wait() {
47
- if (this.isWaiting)
48
- return;
49
- this.isWaiting = !0;
50
- const t = setInterval(() => {
51
- i.isReady() && (clearInterval(t), this.isWaiting = !1, this.processQueue());
52
- }, 100);
53
- }
54
- }, a = (t) => {
55
- o.push(t);
56
- };
57
- return {
58
- name: "hotjar",
59
- setup: (t) => {
60
- if (!j())
61
- return;
62
- const y = new Set(f), v = p((e) => {
63
- if (!r) {
64
- r = !0;
65
- try {
66
- i.init(u, l);
67
- } catch {
68
- }
69
- }
70
- a(() => {
71
- try {
72
- g && e.type === "experience_initialize" && !n && (i.event(m), n = !0);
73
- const s = [e.type], c = "experience" in e && e.experience.configStore.getState().name;
74
- c && (s.push(c), "step" in e && e.step?.label && s.push(e.step.label)), i.event(s.join(" > "));
75
- } catch {
76
- }
77
- });
78
- }), _ = p((e) => {
79
- e.type === "session" && "id" in e && a(() => {
80
- try {
81
- const s = d?.() ?? {};
82
- i.identify(e.id, {
83
- organisationId: t.organizationId,
84
- projectId: t.projectId,
85
- ...s
86
- });
87
- } catch {
88
- }
89
- });
90
- });
91
- h({
92
- clock: t.eventBus,
93
- filter: ({ type: e }) => e === "session",
94
- target: _
95
- }), h({
96
- clock: t.eventBus,
97
- filter: (e) => y.has(e.type),
98
- target: v
99
- });
100
- }
101
- };
102
- };
103
- export {
104
- R as h
105
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("@hotjar/browser"),j=require("@picked/client"),r=require("effector"),m=["step_enter","step_complete","step_submit","field_validation_error","experience_complete","experience_initialize","session"],E=({siteId:l,snippetVersion:p=6,trackedEvents:h=m,getUserAttributes:f,autoStartRecording:d=!0,recordingStartEvent:g="hotjar_start"})=>{let n=!1,o=!1;const a={events:[],isProcessing:!1,isWaiting:!1,push(t){a.events.push(t),Promise.resolve().then(()=>this.processQueue())},processQueue(){if(!this.isProcessing){if(!i.isReady()){this.wait();return}this.isProcessing=!0;try{for(;this.events.length>0;){const t=this.events.shift();if(!t)break;t()}}finally{this.isProcessing=!1,this.events.length>0&&i.isReady()&&Promise.resolve().then(()=>this.processQueue())}}},wait(){if(this.isWaiting)return;this.isWaiting=!0;const t=setInterval(()=>{i.isReady()&&(clearInterval(t),this.isWaiting=!1,this.processQueue())},100)}},c=t=>{a.push(t)};return{name:"hotjar",setup:t=>{if(!j.supportsWindow())return;const y=new Set(h),v=r.createEffect(e=>{if(!n){n=!0;try{i.init(l,p)}catch{}}c(()=>{try{d&&e.type==="experience_initialize"&&!o&&(i.event(g),o=!0);const s=[e.type],u="experience"in e&&e.experience.configStore.getState().name;u&&(s.push(u),"step"in e&&e.step?.label&&s.push(e.step.label)),i.event(s.join(" > "))}catch{}})}),_=r.createEffect(e=>{e.type==="session"&&"id"in e&&c(()=>{try{const s=f?.()??{};i.identify(e.id,{organisationId:t.organizationId,projectId:t.projectId,...s})}catch{}})});r.sample({clock:t.eventBus,filter:({type:e})=>e==="session",target:_}),r.sample({clock:t.eventBus,filter:e=>y.has(e.type),target:v})}}};exports.hotjarPlugin=E;