@picked/analytics 0.0.39-next.1 → 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
|
|
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;
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
import { supportsWindow as
|
|
1
|
+
import { supportsWindow as x } from "@picked/client";
|
|
2
2
|
import { split as E, attach as S } from "effector";
|
|
3
|
-
import { p as k, n as b, o as _, x as
|
|
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
5
|
function D(o) {
|
|
6
6
|
return o.isResolved;
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const y = ({
|
|
9
9
|
trackerOptions: o,
|
|
10
10
|
enableDocumentListeners: d = !1
|
|
11
11
|
}) => ({
|
|
12
12
|
name: "analytics",
|
|
13
13
|
setup: (r) => {
|
|
14
|
-
if (!
|
|
14
|
+
if (!x())
|
|
15
15
|
return;
|
|
16
16
|
const { organizationId: c, projectId: a } = r, f = () => r.features.listStore.getState().flatMap((e) => {
|
|
17
17
|
if (!D(e)) return [];
|
|
18
|
-
const { id:
|
|
18
|
+
const { id: n, key: i, name: p } = e, { bucket: u } = e.getBucket();
|
|
19
19
|
return [
|
|
20
20
|
{
|
|
21
|
-
name:
|
|
22
|
-
key:
|
|
23
|
-
feature:
|
|
24
|
-
bucket:
|
|
21
|
+
name: p,
|
|
22
|
+
key: i,
|
|
23
|
+
feature: n,
|
|
24
|
+
bucket: u
|
|
25
25
|
}
|
|
26
26
|
];
|
|
27
|
-
}),
|
|
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 || {},
|
|
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:
|
|
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
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
_(
|
|
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:
|
|
84
|
-
const
|
|
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:
|
|
89
|
-
step: "step" in
|
|
90
|
-
form: "form" in
|
|
91
|
-
exception: "exception" in
|
|
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:
|
|
95
|
-
features:
|
|
87
|
+
responses: n,
|
|
88
|
+
features: p,
|
|
96
89
|
isUser: r.session?.isUser,
|
|
97
90
|
identifiers: r.session?.identifiers
|
|
98
91
|
};
|
|
99
|
-
return t(
|
|
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(
|
|
117
|
-
form_submit_success: s(
|
|
118
|
-
form_submit_error: s(
|
|
119
|
-
feature_decide: s(
|
|
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
|
-
|
|
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;
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/analytics",
|
|
3
3
|
"description": "Picked Analytics",
|
|
4
|
-
"version": "0.0.39-next.
|
|
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.39-next.
|
|
51
|
+
"@picked/client": "0.0.39-next.2",
|
|
52
52
|
"effector": "^23.3.0"
|
|
53
53
|
},
|
|
54
54
|
"private": false,
|