@picked/hotjar 0.0.35 → 0.0.36-next.1

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-BAyhnwk-.cjs");exports.hotjarPlugin=e.hotjarPlugin;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../plugin-BWR_ipa5.cjs");exports.hotjarPlugin=e.hotjarPlugin;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../plugin-BAyhnwk-.cjs");exports.hotjarPlugin=e.hotjarPlugin;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../plugin-BWR_ipa5.cjs");exports.hotjarPlugin=e.hotjarPlugin;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { h as a } from "../plugin-B-kx9hgz.js";
1
+ import { h as a } from "../plugin-8YCruaTQ.js";
2
2
  export {
3
3
  a as hotjarPlugin
4
4
  };
@@ -1,4 +1,4 @@
1
- import { h as a } from "../../../plugin-B-kx9hgz.js";
1
+ import { h as a } from "../../../plugin-8YCruaTQ.js";
2
2
  export {
3
3
  a as hotjarPlugin
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import i from "@hotjar/browser";
2
- import { supportsWindow as x } from "@picked/client";
3
- import { createEffect as l, sample as f } from "effector";
4
- const I = [
2
+ import { supportsWindow as j } from "@picked/client";
3
+ import { createEffect as p, sample as h } from "effector";
4
+ const x = [
5
5
  "step_enter",
6
6
  "step_complete",
7
7
  "step_submit",
@@ -9,21 +9,21 @@ const I = [
9
9
  "experience_complete",
10
10
  "experience_initialize",
11
11
  "session"
12
- ], w = ({
12
+ ], R = ({
13
13
  siteId: u,
14
- snippetVersion: d = 6,
15
- trackedEvents: m = I,
16
- getUserAttributes: n,
17
- autoStartRecording: y = !0,
18
- recordingStartEvent: g = "hotjar_start"
14
+ snippetVersion: l = 6,
15
+ trackedEvents: f = x,
16
+ getUserAttributes: d,
17
+ autoStartRecording: g = !0,
18
+ recordingStartEvent: m = "hotjar_start"
19
19
  }) => {
20
- let o = !1, a = !1;
21
- const c = {
20
+ let r = !1, n = !1;
21
+ const o = {
22
22
  events: [],
23
23
  isProcessing: !1,
24
24
  isWaiting: !1,
25
25
  push(t) {
26
- c.events.push(t), Promise.resolve().then(() => this.processQueue());
26
+ o.events.push(t), Promise.resolve().then(() => this.processQueue());
27
27
  },
28
28
  processQueue() {
29
29
  if (!this.isProcessing) {
@@ -51,35 +51,34 @@ const I = [
51
51
  i.isReady() && (clearInterval(t), this.isWaiting = !1, this.processQueue());
52
52
  }, 100);
53
53
  }
54
- }, p = (t) => {
55
- c.push(t);
54
+ }, a = (t) => {
55
+ o.push(t);
56
56
  };
57
57
  return {
58
58
  name: "hotjar",
59
59
  setup: (t) => {
60
- if (!x())
60
+ if (!j())
61
61
  return;
62
- const v = new Set(m), _ = l((e) => {
63
- if (!o) {
64
- o = !0;
62
+ const y = new Set(f), v = p((e) => {
63
+ if (!r) {
64
+ r = !0;
65
65
  try {
66
- i.init(u, d);
66
+ i.init(u, l);
67
67
  } catch {
68
68
  }
69
69
  }
70
- p(() => {
71
- var s;
70
+ a(() => {
72
71
  try {
73
- y && e.type === "experience_initialize" && !a && (i.event(g), a = !0);
74
- const r = [e.type], h = "experience" in e && e.experience.configStore.getState().name;
75
- h && (r.push(h), "step" in e && ((s = e.step) != null && s.label) && r.push(e.step.label)), i.event(r.join(" > "));
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(" > "));
76
75
  } catch {
77
76
  }
78
77
  });
79
- }), j = l((e) => {
80
- e.type === "session" && "id" in e && p(() => {
78
+ }), _ = p((e) => {
79
+ e.type === "session" && "id" in e && a(() => {
81
80
  try {
82
- const s = (n == null ? void 0 : n()) ?? {};
81
+ const s = d?.() ?? {};
83
82
  i.identify(e.id, {
84
83
  organisationId: t.organizationId,
85
84
  projectId: t.projectId,
@@ -89,18 +88,18 @@ const I = [
89
88
  }
90
89
  });
91
90
  });
92
- f({
91
+ h({
93
92
  clock: t.eventBus,
94
93
  filter: ({ type: e }) => e === "session",
95
- target: j
96
- }), f({
97
- clock: t.eventBus,
98
- filter: (e) => v.has(e.type),
99
94
  target: _
95
+ }), h({
96
+ clock: t.eventBus,
97
+ filter: (e) => y.has(e.type),
98
+ target: v
100
99
  });
101
100
  }
102
101
  };
103
102
  };
104
103
  export {
105
- w as h
104
+ R as h
106
105
  };
@@ -0,0 +1 @@
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;
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.35",
4
+ "version": "0.0.36-next.1",
5
5
  "dependencies": {
6
6
  "@hotjar/browser": "^1.0.9"
7
7
  },
@@ -12,14 +12,14 @@
12
12
  "@repo/typescript-config": "workspace:*",
13
13
  "@rollup/plugin-replace": "^6.0.2",
14
14
  "@types/node": "^22",
15
- "@vitest/coverage-v8": "^3.2.4",
15
+ "@vitest/coverage-v8": "^4.0.17",
16
16
  "effector": "^23.3.0",
17
17
  "jsdom": "^26.1.0",
18
18
  "tsup": "^8.5.0",
19
19
  "tsx": "^4.20.3",
20
- "vite": "^6.4.1",
20
+ "vite": "^7.3.1",
21
21
  "vite-plugin-dts": "^4.5.4",
22
- "vitest": "^3.2.4"
22
+ "vitest": "^4.0.17"
23
23
  },
24
24
  "exports": {
25
25
  ".": {
@@ -41,7 +41,7 @@
41
41
  "main": "./dist/cjs/index.js",
42
42
  "module": "./dist/esm/index.js",
43
43
  "peerDependencies": {
44
- "@picked/client": "0.0.35",
44
+ "@picked/client": "0.0.36-next.1",
45
45
  "effector": "^23.3.0"
46
46
  },
47
47
  "private": false,
@@ -1 +0,0 @@
1
- "use strict";const i=require("@hotjar/browser"),m=require("@picked/client"),n=require("effector"),E=["step_enter","step_complete","step_submit","field_validation_error","experience_complete","experience_initialize","session"],I=({siteId:h,snippetVersion:f=6,trackedEvents:d=E,getUserAttributes:r,autoStartRecording:g=!0,recordingStartEvent:y="hotjar_start"})=>{let a=!1,c=!1;const l={events:[],isProcessing:!1,isWaiting:!1,push(t){l.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)}},p=t=>{l.push(t)};return{name:"hotjar",setup:t=>{if(!m.supportsWindow())return;const v=new Set(d),_=n.createEffect(e=>{if(!a){a=!0;try{i.init(h,f)}catch{}}p(()=>{var s;try{g&&e.type==="experience_initialize"&&!c&&(i.event(y),c=!0);const o=[e.type],u="experience"in e&&e.experience.configStore.getState().name;u&&(o.push(u),"step"in e&&((s=e.step)!=null&&s.label)&&o.push(e.step.label)),i.event(o.join(" > "))}catch{}})}),j=n.createEffect(e=>{e.type==="session"&&"id"in e&&p(()=>{try{const s=(r==null?void 0:r())??{};i.identify(e.id,{organisationId:t.organizationId,projectId:t.projectId,...s})}catch{}})});n.sample({clock:t.eventBus,filter:({type:e})=>e==="session",target:j}),n.sample({clock:t.eventBus,filter:e=>v.has(e.type),target:_})}}};exports.hotjarPlugin=I;