@picked/analytics 0.0.1-dev.1763526535807 → 0.0.1-dev.1763596411740
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 +1 -1
- package/dist/cjs/plugins/analytics/index.js +1 -1
- package/dist/esm/index.js +30 -30
- package/dist/esm/plugins/analytics/index.js +16 -16
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/index.d.ts.map +1 -1
- package/dist/types/utils.d.ts +0 -11
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/user-interaction-CcXZofFr.js +1152 -0
- package/dist/user-interaction-lI3cxLrp.cjs +1 -0
- package/package.json +3 -9
- package/dist/cjs/plugins/google-analytics/index.js +0 -1
- package/dist/esm/plugins/google-analytics/index.js +0 -117
- package/dist/types/plugins/google-analytics/index.d.ts +0 -2
- package/dist/types/plugins/google-analytics/index.d.ts.map +0 -1
- package/dist/types/plugins/google-analytics/plugin.d.ts +0 -60
- package/dist/types/plugins/google-analytics/plugin.d.ts.map +0 -1
- package/dist/user-interaction-C3RSb9bR.cjs +0 -1
- package/dist/user-interaction-DlOiROv8.js +0 -908
- package/dist/utils-CEuhEfLT.cjs +0 -1
- package/dist/utils-Dn5X4DCB.js +0 -271
package/dist/utils-CEuhEfLT.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const C=require("@snowplow/browser-tracker"),f=require("@picked/client");function d(t,n){return`iglu:dev.pckd/${t}/jsonschema/${n}`}function g(t,...n){}function c(t,...n){}function v(t,n,e={}){return{event:{schema:d("event","1-0-0"),data:{type:t,meta:e}},context:n.filter(r=>r!==void 0)}}function _(t,n,e){return{schema:d(t,n),data:e}}function D(t,n){return(e,r)=>{const o=n(e,r);C.trackSelfDescribingEvent(o)}}function y(t,n,e={passive:!0}){const r=new WeakMap;return(o,i)=>{let a=r.get(o);if(a||(a=new Set,r.set(o,a)),a.has(t))return;function m(x){const p=i();n({event:x,analyticsContext:p})}o.addEventListener(t,m,e),a.add(t)}}function L(t,n){const e=new Set;return r=>{if(e.has(t)||!f.supportsDocument())return;function o(i){const a=r();n({event:i,analyticsContext:a})}document.addEventListener(t,o,{passive:!0}),e.add(t)}}function b(t,n){const e=new Set;return r=>{if(e.has(t)||!f.supportsWindow())return;function o(i){const a=r();n({event:i,analyticsContext:a})}window.addEventListener(t,o,{passive:!0}),e.add(t)}}function h(t){var e;return{items:((e=t.features)==null?void 0:e.map(({feature:r,name:o,key:i,bucket:a})=>({ab_feature:r,ab_name:o,ab_key:i,ab_bucket:a})))||[]}}const s="unknown";function k(t){var r;const n=R(),e={id:t.sessionId||null};return n&&(e.gaid=n),(r=t.shopifySession)!=null&&r.clientId&&(e.shopify_client_id=t.shopifySession.clientId),e}function E(t){if(t.fields)return{items:t.fields.map(({id:n,type:e,label:r,options:o})=>({id:n,type:e,label:r,options:o}))}}function w(t){if(t.responses)return{items:t.responses.map(({fieldId:n,value:e})=>({field_id:n,values:Array.isArray(e)?e.map(r=>({value:r})):[{value:e}]}))}}function N(t,n=!1){const{step:e}=t;if(e)return{id:e.id,title:e.label};if(n)return c('"step" is required for this event',t),{id:s,title:s}}function S(t,n=!1){const{productList:e}=t;if(e){const r={};"title"in e&&e.title&&Object.assign(r,{title:e.title});const o="items"in e?e.items:e;return Object.assign(r,{items:o.map(i=>({item_id:i.itemId,item_name:i.itemName,affiliation:i.affiliation,coupon:i.coupon,currency:i.currency,creative_name:i.creativeName,creative_slot:i.creativeSlot,discount:u(i.discount),index:u(i.index),item_brand:i.itemBrand,item_category:i.itemCategory,item_category2:i.itemCategory2,item_category3:i.itemCategory3,item_category4:i.itemCategory4,item_category5:i.itemCategory5,item_list_id:i.itemListId,item_list_name:i.itemListName,item_variant:i.itemVariant,location_id:i.locationId,price:u(i.price),promotion_id:i.promotionId,promotion_name:i.promotionName,quantity:u(i.quantity),in_stock:i.inStock}))}),r}if(n)return c('"productList" is required for this event',t),{}}function F(t,n=!1){const{experience:e}=t;if(e)return{id:e.id,title:e.title};if(n)return c('"experience" is required for this event',t),{id:s,title:s}}function q(t,n=!1){const{exception:e}=t;if(e)return typeof e=="string"?{reason:e}:{reason:e.systemMessage};if(n)return c('"exception" is required for this event',t),{reason:s}}function B(t){const{form:n}=t;return n?{id:n.id,title:n.title}:(c('"form" is required for this event',t),{id:s,title:s})}function M(t){const{modal:n}=t;return n?{id:n.id,title:n.title}:(c('"modal" is required for this event',t),{id:s,title:s})}function W(t,n=300){let e;return function(...r){clearTimeout(e),e=setTimeout(()=>t.apply(this,r),n)}}function u(t){if(typeof t=="number")return t;if(typeof t!="string")return;const n=parseFloat(t);if(!isNaN(n))return n}function R(){if(!f.supportsDocument()||!f.supportsCookies())return null;const t="_ga=",n=document.cookie?document.cookie.split(";"):[];for(const e of n){const r=e.trim();if(r.startsWith(t)){const i=r.substring(t.length).split(".");if(i.length>2)return i.slice(2).join(".")}}}function l(t){return t.isResolved}const T=t=>t.flatMap(n=>{if(!l(n))return[];const{id:e,key:r,name:o}=n,{bucket:i}=n.getBucket();return[{name:o,key:r,feature:e,bucket:i}]});exports.createBindListener=y;exports.createContext=_;exports.createDocumentBindListener=L;exports.createEvent=v;exports.createTrackEvent=D;exports.createWindowBindListener=b;exports.debounce=W;exports.formatExceptionContextData=q;exports.formatExperienceContextData=F;exports.formatFeatureListContextData=h;exports.formatFieldListContextData=E;exports.formatFormContextData=B;exports.formatModalContextData=M;exports.formatProductListContextData=S;exports.formatResponseListContextData=w;exports.formatSessionContextData=k;exports.formatStepContextData=N;exports.getFeatureList=T;exports.isFeatureResolved=l;exports.log=g;
|
package/dist/utils-Dn5X4DCB.js
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { trackSelfDescribingEvent as p } from "@snowplow/browser-tracker";
|
|
2
|
-
import { supportsDocument as f, supportsWindow as v, supportsCookies as _ } from "@picked/client";
|
|
3
|
-
function d(t, i) {
|
|
4
|
-
return `iglu:dev.pckd/${t}/jsonschema/${i}`;
|
|
5
|
-
}
|
|
6
|
-
function b(t, ...i) {
|
|
7
|
-
}
|
|
8
|
-
function c(t, ...i) {
|
|
9
|
-
}
|
|
10
|
-
function k(t, i, e = {}) {
|
|
11
|
-
return {
|
|
12
|
-
event: {
|
|
13
|
-
schema: d("event", "1-0-0"),
|
|
14
|
-
data: {
|
|
15
|
-
type: t,
|
|
16
|
-
meta: e
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
context: i.filter(
|
|
20
|
-
(r) => r !== void 0
|
|
21
|
-
)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function L(t, i, e) {
|
|
25
|
-
return {
|
|
26
|
-
schema: d(t, i),
|
|
27
|
-
data: e
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function D(t, i) {
|
|
31
|
-
return (e, r) => {
|
|
32
|
-
const s = i(e, r);
|
|
33
|
-
p(s);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function w(t, i, e = { passive: !0 }) {
|
|
37
|
-
const r = /* @__PURE__ */ new WeakMap();
|
|
38
|
-
return (s, n) => {
|
|
39
|
-
let o = r.get(s);
|
|
40
|
-
if (o || (o = /* @__PURE__ */ new Set(), r.set(s, o)), o.has(t))
|
|
41
|
-
return;
|
|
42
|
-
function l(m) {
|
|
43
|
-
const g = n();
|
|
44
|
-
i({ event: m, analyticsContext: g });
|
|
45
|
-
}
|
|
46
|
-
s.addEventListener(t, l, e), o.add(t);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function E(t, i) {
|
|
50
|
-
const e = /* @__PURE__ */ new Set();
|
|
51
|
-
return (r) => {
|
|
52
|
-
if (e.has(t) || !f())
|
|
53
|
-
return;
|
|
54
|
-
function s(n) {
|
|
55
|
-
const o = r();
|
|
56
|
-
i({ event: n, analyticsContext: o });
|
|
57
|
-
}
|
|
58
|
-
document.addEventListener(t, s, { passive: !0 }), e.add(t);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function N(t, i) {
|
|
62
|
-
const e = /* @__PURE__ */ new Set();
|
|
63
|
-
return (r) => {
|
|
64
|
-
if (e.has(t) || !v())
|
|
65
|
-
return;
|
|
66
|
-
function s(n) {
|
|
67
|
-
const o = r();
|
|
68
|
-
i({ event: n, analyticsContext: o });
|
|
69
|
-
}
|
|
70
|
-
window.addEventListener(t, s, { passive: !0 }), e.add(t);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function S(t) {
|
|
74
|
-
var e;
|
|
75
|
-
return { items: ((e = t.features) == null ? void 0 : e.map(({ feature: r, name: s, key: n, bucket: o }) => ({
|
|
76
|
-
ab_feature: r,
|
|
77
|
-
ab_name: s,
|
|
78
|
-
ab_key: n,
|
|
79
|
-
ab_bucket: o
|
|
80
|
-
}))) || [] };
|
|
81
|
-
}
|
|
82
|
-
const a = "unknown";
|
|
83
|
-
function q(t) {
|
|
84
|
-
var r;
|
|
85
|
-
const i = x(), e = {
|
|
86
|
-
id: t.sessionId || null
|
|
87
|
-
};
|
|
88
|
-
return i && (e.gaid = i), (r = t.shopifySession) != null && r.clientId && (e.shopify_client_id = t.shopifySession.clientId), e;
|
|
89
|
-
}
|
|
90
|
-
function F(t) {
|
|
91
|
-
if (t.fields)
|
|
92
|
-
return {
|
|
93
|
-
items: t.fields.map(({ id: i, type: e, label: r, options: s }) => ({
|
|
94
|
-
id: i,
|
|
95
|
-
type: e,
|
|
96
|
-
label: r,
|
|
97
|
-
options: s
|
|
98
|
-
}))
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function j(t) {
|
|
102
|
-
if (t.responses)
|
|
103
|
-
return {
|
|
104
|
-
items: t.responses.map(
|
|
105
|
-
({ fieldId: i, value: e }) => ({
|
|
106
|
-
field_id: i,
|
|
107
|
-
values: Array.isArray(e) ? e.map((r) => ({ value: r })) : [{ value: e }]
|
|
108
|
-
})
|
|
109
|
-
)
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function B(t, i = !1) {
|
|
113
|
-
const { step: e } = t;
|
|
114
|
-
if (e)
|
|
115
|
-
return {
|
|
116
|
-
id: e.id,
|
|
117
|
-
title: e.label
|
|
118
|
-
};
|
|
119
|
-
if (i)
|
|
120
|
-
return c('"step" is required for this event', t), {
|
|
121
|
-
id: a,
|
|
122
|
-
title: a
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
function M(t, i = !1) {
|
|
126
|
-
const { productList: e } = t;
|
|
127
|
-
if (e) {
|
|
128
|
-
const r = {};
|
|
129
|
-
"title" in e && e.title && Object.assign(r, { title: e.title });
|
|
130
|
-
const s = "items" in e ? e.items : e;
|
|
131
|
-
return Object.assign(r, {
|
|
132
|
-
items: s.map((n) => ({
|
|
133
|
-
item_id: n.itemId,
|
|
134
|
-
item_name: n.itemName,
|
|
135
|
-
affiliation: n.affiliation,
|
|
136
|
-
coupon: n.coupon,
|
|
137
|
-
currency: n.currency,
|
|
138
|
-
creative_name: n.creativeName,
|
|
139
|
-
creative_slot: n.creativeSlot,
|
|
140
|
-
discount: u(n.discount),
|
|
141
|
-
index: u(n.index),
|
|
142
|
-
item_brand: n.itemBrand,
|
|
143
|
-
item_category: n.itemCategory,
|
|
144
|
-
item_category2: n.itemCategory2,
|
|
145
|
-
item_category3: n.itemCategory3,
|
|
146
|
-
item_category4: n.itemCategory4,
|
|
147
|
-
item_category5: n.itemCategory5,
|
|
148
|
-
item_list_id: n.itemListId,
|
|
149
|
-
item_list_name: n.itemListName,
|
|
150
|
-
item_variant: n.itemVariant,
|
|
151
|
-
location_id: n.locationId,
|
|
152
|
-
price: u(n.price),
|
|
153
|
-
promotion_id: n.promotionId,
|
|
154
|
-
promotion_name: n.promotionName,
|
|
155
|
-
quantity: u(n.quantity),
|
|
156
|
-
in_stock: n.inStock
|
|
157
|
-
}))
|
|
158
|
-
}), r;
|
|
159
|
-
}
|
|
160
|
-
if (i)
|
|
161
|
-
return c('"productList" is required for this event', t), {};
|
|
162
|
-
}
|
|
163
|
-
function W(t, i = !1) {
|
|
164
|
-
const { experience: e } = t;
|
|
165
|
-
if (e)
|
|
166
|
-
return {
|
|
167
|
-
id: e.id,
|
|
168
|
-
title: e.title
|
|
169
|
-
};
|
|
170
|
-
if (i)
|
|
171
|
-
return c('"experience" is required for this event', t), {
|
|
172
|
-
id: a,
|
|
173
|
-
title: a
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
function V(t, i = !1) {
|
|
177
|
-
const { exception: e } = t;
|
|
178
|
-
if (e)
|
|
179
|
-
return typeof e == "string" ? { reason: e } : {
|
|
180
|
-
reason: e.systemMessage
|
|
181
|
-
};
|
|
182
|
-
if (i)
|
|
183
|
-
return c('"exception" is required for this event', t), {
|
|
184
|
-
reason: a
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function A(t) {
|
|
188
|
-
const { form: i } = t;
|
|
189
|
-
return i ? {
|
|
190
|
-
id: i.id,
|
|
191
|
-
title: i.title
|
|
192
|
-
} : (c('"form" is required for this event', t), {
|
|
193
|
-
id: a,
|
|
194
|
-
title: a
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
function H(t) {
|
|
198
|
-
const { modal: i } = t;
|
|
199
|
-
return i ? {
|
|
200
|
-
id: i.id,
|
|
201
|
-
title: i.title
|
|
202
|
-
} : (c('"modal" is required for this event', t), {
|
|
203
|
-
id: a,
|
|
204
|
-
title: a
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
function O(t, i = 300) {
|
|
208
|
-
let e;
|
|
209
|
-
return function(...r) {
|
|
210
|
-
clearTimeout(e), e = setTimeout(() => t.apply(this, r), i);
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
function u(t) {
|
|
214
|
-
if (typeof t == "number")
|
|
215
|
-
return t;
|
|
216
|
-
if (typeof t != "string")
|
|
217
|
-
return;
|
|
218
|
-
const i = parseFloat(t);
|
|
219
|
-
if (!isNaN(i))
|
|
220
|
-
return i;
|
|
221
|
-
}
|
|
222
|
-
function x() {
|
|
223
|
-
if (!f() || !_())
|
|
224
|
-
return null;
|
|
225
|
-
const t = "_ga=", i = document.cookie ? document.cookie.split(";") : [];
|
|
226
|
-
for (const e of i) {
|
|
227
|
-
const r = e.trim();
|
|
228
|
-
if (r.startsWith(t)) {
|
|
229
|
-
const n = r.substring(t.length).split(".");
|
|
230
|
-
if (n.length > 2)
|
|
231
|
-
return n.slice(2).join(".");
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function y(t) {
|
|
236
|
-
return t.isResolved;
|
|
237
|
-
}
|
|
238
|
-
const R = (t) => t.flatMap((i) => {
|
|
239
|
-
if (!y(i)) return [];
|
|
240
|
-
const { id: e, key: r, name: s } = i, { bucket: n } = i.getBucket();
|
|
241
|
-
return [
|
|
242
|
-
{
|
|
243
|
-
name: s,
|
|
244
|
-
key: r,
|
|
245
|
-
feature: e,
|
|
246
|
-
bucket: n
|
|
247
|
-
}
|
|
248
|
-
];
|
|
249
|
-
});
|
|
250
|
-
export {
|
|
251
|
-
q as a,
|
|
252
|
-
M as b,
|
|
253
|
-
D as c,
|
|
254
|
-
W as d,
|
|
255
|
-
B as e,
|
|
256
|
-
S as f,
|
|
257
|
-
k as g,
|
|
258
|
-
L as h,
|
|
259
|
-
H as i,
|
|
260
|
-
j,
|
|
261
|
-
F as k,
|
|
262
|
-
V as l,
|
|
263
|
-
b as m,
|
|
264
|
-
A as n,
|
|
265
|
-
w as o,
|
|
266
|
-
O as p,
|
|
267
|
-
E as q,
|
|
268
|
-
N as r,
|
|
269
|
-
R as s,
|
|
270
|
-
y as t
|
|
271
|
-
};
|