@picked/analytics 0.0.84-next.2 → 0.0.84-next.4

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,4 +1,4 @@
1
- import { B as e, G as t, J as n, K as r, R as i, U as a, V as o, W as s, Y as c, _ as l, g as u, h as d, i as f, n as p, q as m, r as h, t as g, v as _ } from "../../../src-Bg5baSBO.js";
1
+ import { B as e, G as t, J as n, K as r, R as i, U as a, V as o, W as s, Y as c, _ as l, g as u, h as d, i as f, n as p, q as m, r as h, t as g, v as _ } from "../../../src-DWcHBa-b.js";
2
2
  import { supportsWindow as v } from "@picked/client";
3
3
  import { attach as y, combine as b, split as x } from "effector";
4
4
  //#region src/plugins/analytics/plugin.ts
@@ -23,16 +23,16 @@ var C = (e) => e.flatMap((e) => {
23
23
  let t = [], n = [];
24
24
  for (let r of e) f(r) ? t.push(r) : n.push(r);
25
25
  return n.length > 0 && console.warn(`[@picked/analytics] Ignoring unknown interaction event names: ${n.join(", ")}. Valid names are: ${h.join(", ")}.`), t;
26
- }, D = ({ trackerOptions: f, enableDocumentListeners: h = !1, enableInteractionListeners: S = !1 }) => {
27
- let D = E(S);
26
+ }, D = ({ trackerOptions: f, enableDocumentListeners: h = !1, enableInteractionListeners: S = !1, documentInteractions: D }) => {
27
+ let O = E(S);
28
28
  return {
29
29
  name: "analytics",
30
30
  setup: (S) => {
31
31
  if (!v()) return;
32
- let { projectId: E } = S, O = S.session.store.map((e) => e.id), k = S.session.store.map((e) => e.isUser, { skipVoid: !1 }), A = S.session.store.map((e) => e.identifiers ?? {}), j = b({
33
- sessionId: O,
34
- sessionIdentifiers: A,
35
- sessionIsUser: k,
32
+ let { projectId: E } = S, k = S.session.store.map((e) => e.id), A = S.session.store.map((e) => e.isUser, { skipVoid: !1 }), j = S.session.store.map((e) => e.identifiers ?? {}), M = b({
33
+ sessionId: k,
34
+ sessionIdentifiers: j,
35
+ sessionIsUser: A,
36
36
  features: S.features.listStore
37
37
  }, (e) => ({
38
38
  projectId: E,
@@ -40,11 +40,11 @@ var C = (e) => e.flatMap((e) => {
40
40
  identifiers: e.sessionIdentifiers,
41
41
  isUser: e.sessionIsUser,
42
42
  features: C(e.features)
43
- })), M = (e, t) => ({
43
+ })), N = (e, t) => ({
44
44
  ...e,
45
45
  ...t && { experience: w(t) }
46
- }), N = (e) => {
47
- let t = j.map((t) => M(t, e)), n;
46
+ }), P = (e) => {
47
+ let t = M.map((t) => N(t, e)), n;
48
48
  return {
49
49
  read: () => {
50
50
  if (n === void 0) throw Error("[@picked/analytics] subscribeContext: store did not initialize synchronously");
@@ -58,35 +58,35 @@ var C = (e) => e.flatMap((e) => {
58
58
  if (c({
59
59
  projectId: E,
60
60
  ...f
61
- }), h) {
62
- let { read: e } = N();
63
- g(e);
61
+ }), h || D) {
62
+ let { read: e } = P();
63
+ h && g(e), D?.setup(S, e);
64
64
  }
65
- let P = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), I = (e) => {
65
+ let F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), L = (e) => {
66
66
  let t = e.target;
67
67
  if (!t?.shadowRoot) return !1;
68
- let { read: n, unsubscribe: r } = N(e);
69
- return p(n, t.shadowRoot, D), P.set(e, r), !0;
68
+ let { read: n, unsubscribe: r } = P(e);
69
+ return p(n, t.shadowRoot, O), F.set(e, r), !0;
70
70
  };
71
71
  S.experienceInstances.listStore.watch((e) => {
72
72
  let t = new Set(e);
73
- for (let [e, n] of P) t.has(e) || (n(), P.delete(e));
74
73
  for (let [e, n] of F) t.has(e) || (n(), F.delete(e));
74
+ for (let [e, n] of I) t.has(e) || (n(), I.delete(e));
75
75
  for (let t of e) {
76
- if (!t.target || P.has(t) || F.has(t) || I(t)) continue;
76
+ if (!t.target || F.has(t) || I.has(t) || L(t)) continue;
77
77
  let e = t.mountFx.done.watch(() => {
78
- e(), F.delete(t), I(t);
78
+ e(), I.delete(t), L(t);
79
79
  });
80
- F.set(t, e);
80
+ I.set(t, e);
81
81
  }
82
82
  });
83
- let L = (e) => y({
83
+ let R = (e) => y({
84
84
  source: {
85
85
  fields: S.fields.listStore,
86
86
  responses: S.responses.listStore,
87
- sessionId: O,
88
- sessionIdentifiers: A,
89
- sessionIsUser: k,
87
+ sessionId: k,
88
+ sessionIdentifiers: j,
89
+ sessionIsUser: A,
90
90
  features: S.features.listStore
91
91
  },
92
92
  effect: async ({ fields: t, responses: n, sessionId: r, sessionIdentifiers: i, sessionIsUser: a, features: o }, s) => e({
@@ -107,19 +107,19 @@ var C = (e) => e.flatMap((e) => {
107
107
  source: S.eventBus,
108
108
  match: (e) => e.type,
109
109
  cases: {
110
- load: L(r),
111
- initialize: L(m),
112
- experience_initialize: L(s),
113
- experience_open: L(t),
114
- experience_close: L(n),
115
- field_validation_error: L(_),
116
- step_enter: L(o),
117
- step_submit: L(e),
118
- step_submit_success: L(i),
119
- form_submit: L(l),
120
- form_submit_success: L(d),
121
- form_submit_error: L(u),
122
- feature_decide: L(a)
110
+ load: R(r),
111
+ initialize: R(m),
112
+ experience_initialize: R(s),
113
+ experience_open: R(t),
114
+ experience_close: R(n),
115
+ field_validation_error: R(_),
116
+ step_enter: R(o),
117
+ step_submit: R(e),
118
+ step_submit_success: R(i),
119
+ form_submit: R(l),
120
+ form_submit_success: R(d),
121
+ form_submit_error: R(u),
122
+ feature_decide: R(a)
123
123
  }
124
124
  });
125
125
  }