@picked/analytics 0.0.38 → 0.0.39-next.2

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 E=require("@picked/client"),v=require("effector"),r=require("../../../user-interaction-fdzRiqMQ.cjs");require("@snowplow/browser-tracker");function k(o){return o.isResolved}const l=({trackerOptions:o,enableDocumentListeners:x=!1})=>({name:"analytics",setup:s=>{if(!E.supportsWindow())return;const{organizationId:a,projectId:u}=s,d=()=>s.features.listStore.getState().flatMap(e=>{if(!k(e))return[];const{id:c,key:i,name:f}=e,{bucket:p}=e.getBucket();return[{name:f,key:i,feature:c,bucket:p}]}),S=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{id:e.experienceId,title:e.configStore.getState().name}}};r.createTracker({organizationId:a,projectId:u,...o});const m=t=>{const{experience:e}=t||{},c=d();return function(){return{organizationId:a,projectId:u,sessionId:s.session?.id,identifiers:s.session?.identifiers,isUser:s.session?.isUser,features:c,...e&&{experience:{id:e.experienceId,title:e.configStore.getState().name}}}}};if(x){const t=m();r.bindGlobalEventListeners(t)}s.experienceInstances.listStore.watch(t=>{t.forEach(e=>{const c=e.target;if(c){const i=m({experience:e});r.bindUserInteractionListeners(i,c.shadowRoot)}})});function n(t){return v.attach({source:{fields:s.fields.listStore,responses:s.responses.listStore},effect:async({fields:e,responses:c},i)=>{const f=d(),p={organizationId:a,projectId:u,sessionId:s.session?.id,experience:S(i),step:"step"in i?i.step:void 0,form:"form"in i?i.form:void 0,exception:"exception"in i?i.exception.reason?.[0]:void 0,fields:e,responses:c,features:f,isUser:s.session?.isUser,identifiers:s.session?.identifiers};return t(p)}})}v.split({source:s.eventBus,match:t=>t.type,cases:{load:n(r.trackAppLoadEvent),initialize:n(r.trackAppInitializeEvent),experience_initialize:n(r.trackExperienceLoadEvent),experience_open:n(r.trackAppOpenEvent),experience_close:n(r.trackAppCloseEvent),field_validation_error:n(r.trackFieldValidationErrorEvent),step_enter:n(r.trackStepEnterEvent),step_submit:n(r.trackStepSubmitEvent),step_submit_success:n(r.trackStepSubmitSuccessEvent),form_submit:n(r.trackFormSubmitEvent),form_submit_success:n(r.trackFormSubmitSuccessEvent),form_submit_error:n(r.trackFormSubmitErrorEvent),feature_decide:n(r.trackFeatureDecideEvent)}})}});exports.analyticsPlugin=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@picked/client"),v=require("effector"),e=require("../../../user-interaction-fdzRiqMQ.cjs");require("@snowplow/browser-tracker");function l(c){return c.isResolved}const k=({trackerOptions:c,enableDocumentListeners:E=!1})=>({name:"analytics",setup:n=>{if(!S.supportsWindow())return;const{organizationId:a,projectId:u}=n,d=()=>n.features.listStore.getState().flatMap(t=>{if(!l(t))return[];const{id:o,key:i,name:p}=t,{bucket:f}=t.getBucket();return[{name:p,key:i,feature:o,bucket:f}]}),x=r=>{if("experience"in r&&r.experience){const{experience:t}=r;return{id:t.experienceId,title:t.configStore.getState().name}}};e.createTracker({organizationId:a,projectId:u,...c});const m=r=>{const{experience:t}=r||{},o=d();return function(){return{organizationId:a,projectId:u,sessionId:n.session?.id,identifiers:n.session?.identifiers,isUser:n.session?.isUser,features:o,...t&&{experience:{id:t.experienceId,title:t.configStore.getState().name}}}}};if(E){const r=m();e.bindGlobalEventListeners(r)}n.experienceInstances.listStore.watch(r=>{r.forEach(t=>{const o=t.target;if(o){const i=m({experience:t});e.bindUserInteractionListeners(i,o.shadowRoot)}})});function s(r){return v.attach({source:{fields:n.fields.listStore,responses:n.responses.listStore},effect:async({fields:t,responses:o},i)=>{const p=d(),f={organizationId:a,projectId:u,sessionId:n.session?.id,experience:x(i),step:"step"in i?i.step:void 0,form:"form"in i?i.form:void 0,exception:"exception"in i?i.exception.reason?.[0]:void 0,fields:t,responses:o,features:p,isUser:n.session?.isUser,identifiers:n.session?.identifiers};return r(f)}})}v.split({source:n.eventBus,match:r=>r.type,cases:{load:s(e.trackAppLoadEvent),initialize:s(e.trackAppInitializeEvent),experience_initialize:s(e.trackExperienceLoadEvent),experience_open:s(e.trackAppOpenEvent),experience_close:s(e.trackAppCloseEvent),field_validation_error:s(e.trackFieldValidationErrorEvent),step_enter:s(e.trackStepEnterEvent),step_submit:s(e.trackStepSubmitEvent),step_submit_success:s(e.trackStepSubmitSuccessEvent),form_submit:s(e.trackFormSubmitEvent),form_submit_success:s(e.trackFormSubmitSuccessEvent),form_submit_error:s(e.trackFormSubmitErrorEvent),feature_decide:s(e.trackFeatureDecideEvent)}})}});exports.analyticsPlugin=k;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { c as i, f as p, a as u, b as d, d as E, e as m, g as x, h as f, i as e, j as Q, k as D, l as k, m as T } from "../user-interaction-pf7gJ4J4.js";
2
- import { p as Ft, o as Ot, n as Rt, t as Mt, q as Wt, r as qt, s as Bt, E as Gt, D as Jt, u as Ut, v as Ht, z as Kt, B as Qt, A as Xt, C as Zt, w as lt, x as yt, y as te } from "../user-interaction-pf7gJ4J4.js";
1
+ import { c as i, f as p, a as u, b as d, d as E, e as m, g as x, h as f, i as e, j as Q, k as D, l as k, m as T } from "../user-interaction-kygP7IXa.js";
2
+ import { n as Ft, o as Ot, p as Rt, t as Mt, q as Wt, r as qt, s as Bt, u as Gt, v as Jt, w as Ut, x as Ht, y as Kt, z as Qt, A as Xt, B as Zt, C as lt, D as yt, E as te } from "../user-interaction-kygP7IXa.js";
3
3
  const L = "step_complete";
4
4
  function X(t, o) {
5
5
  const a = p(t), c = u(t), s = d(t), r = E(t, !0), n = m(t), _ = x(t);
@@ -1,39 +1,32 @@
1
- import { supportsWindow as v } from "@picked/client";
1
+ import { supportsWindow as x } from "@picked/client";
2
2
  import { split as E, attach as S } from "effector";
3
- import { n as k, p as b, o as _, v as g, B as l, C as I, A as F, y as A, x as C, w as L, z as h, t as z, s as U, u as w, q as B, r as R } from "../../../user-interaction-pf7gJ4J4.js";
3
+ import { p as k, n as b, o as _, x as l, z as g, B as F, A as I, E as A, D as C, C as L, y as h, t as z, s as U, w, q as B, r as R } from "../../../user-interaction-kygP7IXa.js";
4
4
  import "@snowplow/browser-tracker";
5
- function G(o) {
5
+ function D(o) {
6
6
  return o.isResolved;
7
7
  }
8
- const M = ({
8
+ const y = ({
9
9
  trackerOptions: o,
10
10
  enableDocumentListeners: d = !1
11
11
  }) => ({
12
12
  name: "analytics",
13
13
  setup: (r) => {
14
- if (!v())
14
+ if (!x())
15
15
  return;
16
16
  const { organizationId: c, projectId: a } = r, f = () => r.features.listStore.getState().flatMap((e) => {
17
- if (!G(e)) return [];
18
- const { id: i, key: n, name: u } = e, { bucket: p } = e.getBucket();
17
+ if (!D(e)) return [];
18
+ const { id: n, key: i, name: p } = e, { bucket: u } = e.getBucket();
19
19
  return [
20
20
  {
21
- name: u,
22
- key: n,
23
- feature: i,
24
- bucket: p
21
+ name: p,
22
+ key: i,
23
+ feature: n,
24
+ bucket: u
25
25
  }
26
26
  ];
27
- }), x = (t) => {
27
+ }), v = (t) => {
28
28
  if ("experience" in t && t.experience) {
29
29
  const { experience: e } = t;
30
- return {
31
- id: e.id,
32
- title: e.configStore.getState().name
33
- };
34
- }
35
- if ("experienceInstance" in t && t.experienceInstance) {
36
- const { experienceInstance: e } = t;
37
30
  return {
38
31
  id: e.experienceId,
39
32
  title: e.configStore.getState().name
@@ -46,7 +39,7 @@ const M = ({
46
39
  ...o
47
40
  });
48
41
  const m = (t) => {
49
- const { experience: e } = t || {}, i = f();
42
+ const { experience: e } = t || {}, n = f();
50
43
  return function() {
51
44
  return {
52
45
  organizationId: c,
@@ -54,7 +47,7 @@ const M = ({
54
47
  sessionId: r.session?.id,
55
48
  identifiers: r.session?.identifiers,
56
49
  isUser: r.session?.isUser,
57
- features: i,
50
+ features: n,
58
51
  ...e && {
59
52
  experience: {
60
53
  id: e.experienceId,
@@ -70,33 +63,33 @@ const M = ({
70
63
  }
71
64
  r.experienceInstances.listStore.watch((t) => {
72
65
  t.forEach((e) => {
73
- const i = e.target;
74
- if (i) {
75
- const n = m({ experience: e });
76
- _(n, i.shadowRoot);
66
+ const n = e.target;
67
+ if (n) {
68
+ const i = m({ experience: e });
69
+ _(i, n.shadowRoot);
77
70
  }
78
71
  });
79
72
  });
80
73
  function s(t) {
81
74
  return S({
82
75
  source: { fields: r.fields.listStore, responses: r.responses.listStore },
83
- effect: async ({ fields: e, responses: i }, n) => {
84
- const u = f(), p = {
76
+ effect: async ({ fields: e, responses: n }, i) => {
77
+ const p = f(), u = {
85
78
  organizationId: c,
86
79
  projectId: a,
87
80
  sessionId: r.session?.id,
88
- experience: x(n),
89
- step: "step" in n ? n.step : void 0,
90
- form: "form" in n ? n.form : void 0,
91
- exception: "exception" in n ? n.exception.reason?.[0] : void 0,
81
+ experience: v(i),
82
+ step: "step" in i ? i.step : void 0,
83
+ form: "form" in i ? i.form : void 0,
84
+ exception: "exception" in i ? i.exception.reason?.[0] : void 0,
92
85
  // todo: support multiple exceptions
93
86
  fields: e,
94
- responses: i,
95
- features: u,
87
+ responses: n,
88
+ features: p,
96
89
  isUser: r.session?.isUser,
97
90
  identifiers: r.session?.identifiers
98
91
  };
99
- return t(p);
92
+ return t(u);
100
93
  }
101
94
  });
102
95
  }
@@ -113,14 +106,14 @@ const M = ({
113
106
  step_enter: s(L),
114
107
  step_submit: s(C),
115
108
  step_submit_success: s(A),
116
- form_submit: s(F),
117
- form_submit_success: s(I),
118
- form_submit_error: s(l),
119
- feature_decide: s(g)
109
+ form_submit: s(I),
110
+ form_submit_success: s(F),
111
+ form_submit_error: s(g),
112
+ feature_decide: s(l)
120
113
  }
121
114
  });
122
115
  }
123
116
  });
124
117
  export {
125
- M as analyticsPlugin
118
+ y as analyticsPlugin
126
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/analytics/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,MAAM,EAEP,MAAM,gBAAgB,CAAA;AAsBvB,OAAO,KAAK,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEzE,UAAU,sBAAsB;IAC9B,cAAc,EAAE,oBAAoB,CAAA;IACpC,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAMD,eAAO,MAAM,eAAe,GAAI,8CAG7B,sBAAsB,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAoJ1E,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/analytics/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,MAAM,EAEP,MAAM,gBAAgB,CAAA;AAsBvB,OAAO,KAAK,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEzE,UAAU,sBAAsB;IAC9B,cAAc,EAAE,oBAAoB,CAAA;IACpC,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAMD,eAAO,MAAM,eAAe,GAAI,8CAG7B,sBAAsB,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CA4I1E,CAAA"}
@@ -1208,10 +1208,10 @@ function rs(t) {
1208
1208
  }
1209
1209
  export {
1210
1210
  ss as A,
1211
- os as B,
1212
- as as C,
1213
- Ce as D,
1214
- L as E,
1211
+ as as B,
1212
+ Zn as C,
1213
+ ts as D,
1214
+ es as E,
1215
1215
  f as a,
1216
1216
  x as b,
1217
1217
  p as c,
@@ -1225,17 +1225,17 @@ export {
1225
1225
  Ut as k,
1226
1226
  Gt as l,
1227
1227
  Kt as m,
1228
- Un as n,
1228
+ rs as n,
1229
1229
  is as o,
1230
- rs as p,
1230
+ Un as p,
1231
1231
  Kn as q,
1232
1232
  Mn as r,
1233
1233
  Xn as s,
1234
1234
  Gn as t,
1235
- Jn as u,
1236
- Qn as v,
1237
- Zn as w,
1238
- ts as x,
1239
- es as y,
1240
- ns as z
1235
+ L as u,
1236
+ Ce as v,
1237
+ Jn as w,
1238
+ Qn as x,
1239
+ ns as y,
1240
+ os as z
1241
1241
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/analytics",
3
3
  "description": "Picked Analytics",
4
- "version": "0.0.38",
4
+ "version": "0.0.39-next.2",
5
5
  "dependencies": {
6
6
  "@snowplow/browser-plugin-button-click-tracking": "^4.6.5",
7
7
  "@snowplow/browser-plugin-error-tracking": "^4.6.5",
@@ -48,7 +48,7 @@
48
48
  "main": "./dist/cjs/index.js",
49
49
  "module": "./dist/esm/index.js",
50
50
  "peerDependencies": {
51
- "@picked/client": "0.0.38",
51
+ "@picked/client": "0.0.39-next.2",
52
52
  "effector": "^23.3.0"
53
53
  },
54
54
  "private": false,