@picked/analytics 0.0.9-next.1 → 0.0.10-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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("@picked/client"),g=require("effector"),n=require("../../../user-interaction-C2A-97sb.cjs");require("@snowplow/browser-tracker");function b(a){return a.isResolved}const k=({trackerOptions:a,enableDocumentListeners:v=!1})=>({name:"analytics",setup:s=>{if(!E.supportsWindow())return;const{organizationId:u,projectId:p}=s,S=()=>s.features.listStore.getState().flatMap(e=>{if(!b(e))return[];const{id:c,key:r,name:o}=e,{bucket:f}=e.getBucket();return[{name:o,key:r,feature:c,bucket:f}]}),l=t=>{if("experience"in t&&t.experience){const{experience:e}=t;return{id:e.id,type:e.configStore.getState().type,title:e.configStore.getState().name}}if("experienceInstance"in t&&t.experienceInstance){const{experienceInstance:e}=t;return{id:e.experienceId,type:e.configStore.getState().type,title:e.configStore.getState().name}}};n.createTracker({organizationId:u,projectId:p,...a});const m=t=>{const{experience:e}=t||{},c=S();return function(){var o;return{organizationId:u,projectId:p,sessionId:(o=s.session)==null?void 0:o.id,features:c,...e&&{experience:{id:e.experienceId,type:e.configStore.getState().type,title:e.configStore.getState().name}}}}};if(v){const t=m();n.bindGlobalEventListeners(t)}s.experienceInstances.listStore.watch(t=>{t.forEach(e=>{const c=e.target;if(c){const r=m({experience:e});n.bindUserInteractionListeners(r,c.shadowRoot)}})});function i(t){return g.attach({source:{fields:s.fields.listStore,responses:s.responses.listStore},effect:async({fields:e,responses:c},r)=>{var x,d;const o=S(),f={organizationId:u,projectId:p,sessionId:(x=s.session)==null?void 0:x.id,experience:l(r),step:"step"in r?r.step:void 0,form:"form"in r?r.form:void 0,exception:"exception"in r?(d=r.exception.reason)==null?void 0:d[0]:void 0,fields:e,responses:c,features:o};return t(f)}})}g.split({source:s.eventBus,match:t=>t.type,cases:{initialized:i(n.trackAppLoadEvent),experience_open:i(n.trackAppOpenEvent),experience_close:i(n.trackAppCloseEvent),field_validation_error:i(n.trackFieldValidationErrorEvent),experience_initialized:i(n.trackExperienceLoadEvent),step_enter:i(n.trackStepEnterEvent),step_submit:i(n.trackStepSubmitEvent),step_submit_success:i(n.trackStepSubmitSuccessEvent),form_submit:i(n.trackFormSubmitEvent),form_submit_success:i(n.trackFormSubmitSuccessEvent),form_submit_error:i(n.trackFormSubmitErrorEvent)}})}});exports.analyticsPlugin=k;
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { supportsWindow as
|
|
2
|
-
import { split as
|
|
3
|
-
import { m as
|
|
1
|
+
import { supportsWindow as g } from "@picked/client";
|
|
2
|
+
import { split as E, attach as k } from "effector";
|
|
3
|
+
import { m as b, o as l, n as _, v as I, w as F, u as C, z as L, y as h, x as A, r as w, s as y, t as z, q as R, p as B } from "../../../user-interaction-B2ZoDZL_.js";
|
|
4
4
|
import "@snowplow/browser-tracker";
|
|
5
|
-
function G(
|
|
6
|
-
return
|
|
5
|
+
function G(o) {
|
|
6
|
+
return o.isResolved;
|
|
7
7
|
}
|
|
8
8
|
const O = ({
|
|
9
|
-
trackerOptions:
|
|
10
|
-
|
|
11
|
-
enableDocumentListeners: x = !1
|
|
9
|
+
trackerOptions: o,
|
|
10
|
+
enableDocumentListeners: v = !1
|
|
12
11
|
}) => ({
|
|
13
12
|
name: "analytics",
|
|
14
13
|
setup: (s) => {
|
|
15
|
-
if (!
|
|
14
|
+
if (!g())
|
|
16
15
|
return;
|
|
17
|
-
const { organizationId:
|
|
16
|
+
const { organizationId: a, projectId: p } = s, f = () => s.features.listStore.getState().flatMap((e) => {
|
|
18
17
|
if (!G(e)) return [];
|
|
19
|
-
const { id: i, key: r, name:
|
|
18
|
+
const { id: i, key: r, name: c } = e, { bucket: u } = e.getBucket();
|
|
20
19
|
return [
|
|
21
20
|
{
|
|
22
|
-
name:
|
|
21
|
+
name: c,
|
|
23
22
|
key: r,
|
|
24
23
|
feature: i,
|
|
25
24
|
bucket: u
|
|
26
25
|
}
|
|
27
26
|
];
|
|
28
|
-
}),
|
|
27
|
+
}), d = (t) => {
|
|
29
28
|
if ("experience" in t && t.experience) {
|
|
30
29
|
const { experience: e } = t;
|
|
31
30
|
return {
|
|
@@ -43,18 +42,19 @@ const O = ({
|
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
|
-
|
|
47
|
-
organizationId:
|
|
48
|
-
projectId:
|
|
49
|
-
...
|
|
45
|
+
b({
|
|
46
|
+
organizationId: a,
|
|
47
|
+
projectId: p,
|
|
48
|
+
...o
|
|
50
49
|
});
|
|
51
|
-
const
|
|
52
|
-
const { experience: e } = t || {}, i =
|
|
50
|
+
const m = (t) => {
|
|
51
|
+
const { experience: e } = t || {}, i = f();
|
|
53
52
|
return function() {
|
|
53
|
+
var c;
|
|
54
54
|
return {
|
|
55
|
-
organizationId:
|
|
56
|
-
projectId:
|
|
57
|
-
sessionId:
|
|
55
|
+
organizationId: a,
|
|
56
|
+
projectId: p,
|
|
57
|
+
sessionId: (c = s.session) == null ? void 0 : c.id,
|
|
58
58
|
features: i,
|
|
59
59
|
...e && {
|
|
60
60
|
experience: {
|
|
@@ -66,57 +66,56 @@ const O = ({
|
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
if (
|
|
70
|
-
const t =
|
|
69
|
+
if (v) {
|
|
70
|
+
const t = m();
|
|
71
71
|
l(t);
|
|
72
72
|
}
|
|
73
73
|
s.experienceInstances.listStore.watch((t) => {
|
|
74
74
|
t.forEach((e) => {
|
|
75
75
|
const i = e.target;
|
|
76
76
|
if (i) {
|
|
77
|
-
const r =
|
|
77
|
+
const r = m({ experience: e });
|
|
78
78
|
_(r, i.shadowRoot);
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
function n(t) {
|
|
83
|
-
return
|
|
83
|
+
return k({
|
|
84
84
|
source: { fields: s.fields.listStore, responses: s.responses.listStore },
|
|
85
85
|
effect: async ({ fields: e, responses: i }, r) => {
|
|
86
|
-
var
|
|
87
|
-
const
|
|
88
|
-
organizationId:
|
|
89
|
-
projectId:
|
|
90
|
-
sessionId:
|
|
91
|
-
experience:
|
|
86
|
+
var S, x;
|
|
87
|
+
const c = f(), u = {
|
|
88
|
+
organizationId: a,
|
|
89
|
+
projectId: p,
|
|
90
|
+
sessionId: (S = s.session) == null ? void 0 : S.id,
|
|
91
|
+
experience: d(r),
|
|
92
92
|
step: "step" in r ? r.step : void 0,
|
|
93
93
|
form: "form" in r ? r.form : void 0,
|
|
94
|
-
exception: "exception" in r ? (
|
|
94
|
+
exception: "exception" in r ? (x = r.exception.reason) == null ? void 0 : x[0] : void 0,
|
|
95
95
|
// todo: support multiple exceptions
|
|
96
|
-
version: "version" in r ? r.version : void 0,
|
|
97
96
|
fields: e,
|
|
98
97
|
responses: i,
|
|
99
|
-
features:
|
|
98
|
+
features: c
|
|
100
99
|
};
|
|
101
100
|
return t(u);
|
|
102
101
|
}
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
|
-
|
|
104
|
+
E({
|
|
106
105
|
source: s.eventBus,
|
|
107
106
|
match: (t) => t.type,
|
|
108
107
|
cases: {
|
|
109
108
|
initialized: n(B),
|
|
110
|
-
experience_open: n(
|
|
111
|
-
experience_close: n(
|
|
112
|
-
field_validation_error: n(
|
|
109
|
+
experience_open: n(R),
|
|
110
|
+
experience_close: n(z),
|
|
111
|
+
field_validation_error: n(y),
|
|
113
112
|
experience_initialized: n(w),
|
|
114
113
|
step_enter: n(A),
|
|
115
114
|
step_submit: n(h),
|
|
116
115
|
step_submit_success: n(L),
|
|
117
116
|
form_submit: n(C),
|
|
118
|
-
form_submit_success: n(
|
|
119
|
-
form_submit_error: n(
|
|
117
|
+
form_submit_success: n(F),
|
|
118
|
+
form_submit_error: n(I)
|
|
120
119
|
}
|
|
121
120
|
});
|
|
122
121
|
}
|
|
@@ -2,10 +2,9 @@ import { Picked } from '@picked/client';
|
|
|
2
2
|
import { CreateTrackerOptions } from '../../types';
|
|
3
3
|
interface AnalyticsPluginOptions {
|
|
4
4
|
trackerOptions?: CreateTrackerOptions;
|
|
5
|
-
sessionId?: string;
|
|
6
5
|
enableDocumentListeners?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare const analyticsPlugin: ({ trackerOptions,
|
|
7
|
+
export declare const analyticsPlugin: ({ trackerOptions, enableDocumentListeners, }: AnalyticsPluginOptions) => {
|
|
9
8
|
name: string;
|
|
10
9
|
setup: (client: Picked) => void;
|
|
11
10
|
};
|
|
@@ -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;AAoBvB,OAAO,KAAK,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEzE,UAAU,sBAAsB;IAC9B,cAAc,CAAC,EAAE,oBAAoB,CAAA;IACrC,
|
|
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;AAoBvB,OAAO,KAAK,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEzE,UAAU,sBAAsB;IAC9B,cAAc,CAAC,EAAE,oBAAoB,CAAA;IACrC,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;CAiJ1E,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.
|
|
4
|
+
"version": "0.0.10-next.1",
|
|
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.
|
|
51
|
+
"@picked/client": "0.0.10-next.1",
|
|
52
52
|
"effector": "^23.3.0"
|
|
53
53
|
},
|
|
54
54
|
"private": false,
|