@picked/analytics 0.0.1-dev.1763525955938 → 0.0.1-dev.1763526535807

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@picked/client"),i=require("effector"),k=require("../../../utils-CEuhEfLT.cjs"),g="development";function x(t){if(!S.supportsWindow())return;const e=[];globalThis.dataLayer=globalThis.dataLayer??e,globalThis.dataLayer.push(t)}const m=()=>sessionStorage.getItem("cvly_env"),P=(t,e)=>t.filter(r=>!!(e==null?void 0:e.fieldIds.includes(r.fieldId))),b=t=>({id:t.experienceId,title:t.configStore.getState().name}),E=t=>{if("experience"in t&&t.experience){const{experience:e}=t;return{id:e.id,title:e.configStore.getState().name}}if("experienceInstance"in t&&t.experienceInstance){const{experienceInstance:e}=t;return b(e)}},h=i.createEvent(),D=({controlFeatureName:t})=>({name:"google-analytics-plugin",setup:e=>{if(!S.supportsWindow())return;const{organizationId:r,projectId:p}=e,L=i.attach({source:{responses:e.responses.listStore,features:e.features.listStore},effect:async({responses:c,features:u},n)=>{var o;const{type:s}=n,d=E(n),a=m(),v="step"in n?P(c,n.step):void 0,_={event:"picked_event",picked_action:s,picked_app:{organizationId:r,projectId:p},picked_feature_list:k.getFeatureList(u),picked_environment:g,picked_step:"step"in n?n.step:void 0,picked_form:"form"in n?n.form:void 0,picked_exception:"exception"in n?(o=n.exception.reason)==null?void 0:o[0]:void 0,picked_experience:d,picked_responses:v,picked_cvly_env:a,picked_value:"value"in n?n.value:void 0,picked_item:void 0};return x(_)}}),I=new Set(["experience_open","experience_close","experience_initialized","initialized","step_enter","step_submit","experience_interaction"]),l=i.createStore(!1),f=i.createEvent(),y=i.attach({source:{features:e.features.listStore,decision:l},effect:async({features:c,decision:u},n)=>{if(u)return null;const s=c.find(o=>o.id===t);if(!s||!k.isFeatureResolved(s))return null;f();const{bucket:d}=s.getBucket(),a=E(n),v=m();return x({event:"picked_event",picked_action:"picked_decision",picked_app:{organizationId:r,projectId:p},picked_feature_list:void 0,picked_environment:g,picked_value:d,picked_step:void 0,picked_form:void 0,picked_experience:a,picked_responses:void 0,picked_cvly_env:v})}});i.sample({clock:h,target:e.eventBus}),i.split({source:e.eventBus,match:{isPickedDecisionEvent:c=>c.type==="feature_decide",isInEventList:c=>I.has(c.type)},cases:{isPickedDecisionEvent:y,isInEventList:L}}),i.sample({clock:f,fn:()=>!0,target:l})}});exports.googleAnalyticsPlugin=D;exports.pushToDataLayerEvent=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@picked/client"),i=require("effector"),k=require("../../../utils-CEuhEfLT.cjs"),g="development";function x(t){if(!S.supportsWindow())return;const e=[];globalThis.dataLayer=globalThis.dataLayer??e,globalThis.dataLayer.push(t)}const m=()=>sessionStorage.getItem("cvly_env"),b=(t,e)=>t.filter(r=>!!(e==null?void 0:e.fieldIds.includes(r.fieldId))),P=t=>({id:t.experienceId,title:t.configStore.getState().name}),E=t=>{if("experience"in t&&t.experience){const{experience:e}=t;return{id:e.id,title:e.configStore.getState().name}}if("experienceInstance"in t&&t.experienceInstance){const{experienceInstance:e}=t;return P(e)}},h=i.createEvent(),D=({controlFeatureName:t="convincely-enabled"}={})=>({name:"google-analytics-plugin",setup:e=>{if(!S.supportsWindow())return;const{organizationId:r,projectId:p}=e,L=i.attach({source:{responses:e.responses.listStore,features:e.features.listStore},effect:async({responses:c,features:u},n)=>{var o;const{type:s}=n,d=E(n),a=m(),v="step"in n?b(c,n.step):void 0,_={event:"picked_event",picked_action:s,picked_app:{organizationId:r,projectId:p},picked_feature_list:k.getFeatureList(u),picked_environment:g,picked_step:"step"in n?n.step:void 0,picked_form:"form"in n?n.form:void 0,picked_exception:"exception"in n?(o=n.exception.reason)==null?void 0:o[0]:void 0,picked_experience:d,picked_responses:v,picked_cvly_env:a,picked_value:"value"in n?n.value:void 0,picked_item:void 0};return x(_)}}),I=new Set(["experience_open","experience_close","experience_initialized","initialized","step_enter","step_submit","experience_interaction"]),l=i.createStore(!1),f=i.createEvent(),y=i.attach({source:{features:e.features.listStore,decision:l},effect:async({features:c,decision:u},n)=>{if(u)return null;const s=c.find(o=>o.id===t);if(!s||!k.isFeatureResolved(s))return null;f();const{bucket:d}=s.getBucket(),a=E(n),v=m();return x({event:"picked_event",picked_action:"picked_decision",picked_app:{organizationId:r,projectId:p},picked_feature_list:void 0,picked_environment:g,picked_value:d,picked_step:void 0,picked_form:void 0,picked_experience:a,picked_responses:void 0,picked_cvly_env:v})}});i.sample({clock:h,target:e.eventBus}),i.split({source:e.eventBus,match:{isPickedDecisionEvent:c=>c.type==="feature_decide",isInEventList:c=>I.has(c.type)},cases:{isPickedDecisionEvent:y,isInEventList:L}}),i.sample({clock:f,fn:()=>!0,target:l})}});exports.googleAnalyticsPlugin=D;exports.pushToDataLayerEvent=h;
@@ -1,6 +1,6 @@
1
1
  import { supportsWindow as S } from "@picked/client";
2
- import { createEvent as h, attach as k, createStore as F, sample as l, split as P } from "effector";
3
- import { s as b, t as y } from "../../../utils-Dn5X4DCB.js";
2
+ import { createEvent as h, attach as k, createStore as D, sample as l, split as F } from "effector";
3
+ import { s as P, t as y } from "../../../utils-Dn5X4DCB.js";
4
4
  const g = "development";
5
5
  function m(t) {
6
6
  if (!S()) return;
@@ -23,8 +23,8 @@ const x = () => sessionStorage.getItem("cvly_env"), T = (t, e) => t.filter((s) =
23
23
  return z(e);
24
24
  }
25
25
  }, B = h(), A = ({
26
- controlFeatureName: t
27
- }) => ({
26
+ controlFeatureName: t = "convincely-enabled"
27
+ } = {}) => ({
28
28
  name: "google-analytics-plugin",
29
29
  setup: (e) => {
30
30
  if (!S())
@@ -40,7 +40,7 @@ const x = () => sessionStorage.getItem("cvly_env"), T = (t, e) => t.filter((s) =
40
40
  event: "picked_event",
41
41
  picked_action: c,
42
42
  picked_app: { organizationId: s, projectId: o },
43
- picked_feature_list: b(p),
43
+ picked_feature_list: P(p),
44
44
  picked_environment: g,
45
45
  picked_step: "step" in n ? n.step : void 0,
46
46
  picked_form: "form" in n ? n.form : void 0,
@@ -63,7 +63,7 @@ const x = () => sessionStorage.getItem("cvly_env"), T = (t, e) => t.filter((s) =
63
63
  "step_enter",
64
64
  "step_submit",
65
65
  "experience_interaction"
66
- ]), a = F(!1), f = h(), D = k({
66
+ ]), a = D(!1), f = h(), b = k({
67
67
  source: {
68
68
  features: e.features.listStore,
69
69
  decision: a
@@ -94,14 +94,14 @@ const x = () => sessionStorage.getItem("cvly_env"), T = (t, e) => t.filter((s) =
94
94
  l({
95
95
  clock: B,
96
96
  target: e.eventBus
97
- }), P({
97
+ }), F({
98
98
  source: e.eventBus,
99
99
  match: {
100
100
  isPickedDecisionEvent: (i) => i.type === "feature_decide",
101
101
  isInEventList: (i) => L.has(i.type)
102
102
  },
103
103
  cases: {
104
- isPickedDecisionEvent: D,
104
+ isPickedDecisionEvent: b,
105
105
  isInEventList: I
106
106
  }
107
107
  }), l({
@@ -50,8 +50,8 @@ interface DataLayerEvent {
50
50
  }
51
51
  export declare function dataLayerPush(event: DataLayerEvent | GenericDataLayerEvent): void;
52
52
  export declare const pushToDataLayerEvent: import('effector').EventCallable<EventBusPayload>;
53
- export declare const googleAnalyticsPlugin: ({ controlFeatureName, }: {
54
- controlFeatureName: string;
53
+ export declare const googleAnalyticsPlugin: ({ controlFeatureName, }?: {
54
+ controlFeatureName?: string;
55
55
  }) => {
56
56
  name: string;
57
57
  setup: (client: Picked) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/google-analytics/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,cAAc,EAEd,WAAW,EACX,MAAM,EACP,MAAM,gBAAgB,CAAA;AAKvB,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,qBAAqB,GACrB,iBAAiB,GACjB,wBAAwB,GACxB,gBAAgB,CAAA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M,CAAA;CACvB,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAqIvD,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/analytics",
3
3
  "description": "Picked Analytics",
4
- "version": "0.0.1-dev.1763525955938",
4
+ "version": "0.0.1-dev.1763526535807",
5
5
  "dependencies": {
6
6
  "@snowplow/browser-plugin-button-click-tracking": "^4.6.5",
7
7
  "@snowplow/browser-plugin-error-tracking": "^4.6.5",
@@ -53,7 +53,7 @@
53
53
  "main": "./dist/cjs/index.js",
54
54
  "module": "./dist/esm/index.js",
55
55
  "peerDependencies": {
56
- "@picked/client": "0.0.1-dev.1763525955938",
56
+ "@picked/client": "0.0.1-dev.1763526535807",
57
57
  "effector": "^23.3.0"
58
58
  },
59
59
  "private": false,