@walkeros/web-destination-plausible 3.3.1 → 3.4.0

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.
@@ -19,7 +19,7 @@ interface Env extends DestinationWeb.Env {
19
19
  };
20
20
  }
21
21
 
22
- declare const init: Env | undefined;
22
+ declare const init$1: Env | undefined;
23
23
  declare const push: Env;
24
24
  /**
25
25
  * Simulation tracking paths
@@ -27,20 +27,26 @@ declare const push: Env;
27
27
  */
28
28
  declare const simulation: string[];
29
29
 
30
- declare const env_init: typeof init;
31
30
  declare const env_push: typeof push;
32
31
  declare const env_simulation: typeof simulation;
33
32
  declare namespace env {
34
- export { env_init as init, env_push as push, env_simulation as simulation };
33
+ export { init$1 as init, env_push as push, env_simulation as simulation };
35
34
  }
36
35
 
36
+ /**
37
+ * Destination bootstrap.
38
+ * Given the canonical settings, init loads the Plausible script tag
39
+ * with the configured domain and installs the global `plausible` queue.
40
+ */
41
+ declare const init: Flow.StepExample;
37
42
  declare const purchase: Flow.StepExample;
38
43
  declare const customEvent: Flow.StepExample;
39
44
 
40
45
  declare const step_customEvent: typeof customEvent;
46
+ declare const step_init: typeof init;
41
47
  declare const step_purchase: typeof purchase;
42
48
  declare namespace step {
43
- export { step_customEvent as customEvent, step_purchase as purchase };
49
+ export { step_customEvent as customEvent, step_init as init, step_purchase as purchase };
44
50
  }
45
51
 
46
52
  export { env, step };
@@ -19,7 +19,7 @@ interface Env extends DestinationWeb.Env {
19
19
  };
20
20
  }
21
21
 
22
- declare const init: Env | undefined;
22
+ declare const init$1: Env | undefined;
23
23
  declare const push: Env;
24
24
  /**
25
25
  * Simulation tracking paths
@@ -27,20 +27,26 @@ declare const push: Env;
27
27
  */
28
28
  declare const simulation: string[];
29
29
 
30
- declare const env_init: typeof init;
31
30
  declare const env_push: typeof push;
32
31
  declare const env_simulation: typeof simulation;
33
32
  declare namespace env {
34
- export { env_init as init, env_push as push, env_simulation as simulation };
33
+ export { init$1 as init, env_push as push, env_simulation as simulation };
35
34
  }
36
35
 
36
+ /**
37
+ * Destination bootstrap.
38
+ * Given the canonical settings, init loads the Plausible script tag
39
+ * with the configured domain and installs the global `plausible` queue.
40
+ */
41
+ declare const init: Flow.StepExample;
37
42
  declare const purchase: Flow.StepExample;
38
43
  declare const customEvent: Flow.StepExample;
39
44
 
40
45
  declare const step_customEvent: typeof customEvent;
46
+ declare const step_init: typeof init;
41
47
  declare const step_purchase: typeof purchase;
42
48
  declare namespace step {
43
- export { step_customEvent as customEvent, step_purchase as purchase };
49
+ export { step_customEvent as customEvent, step_init as init, step_purchase as purchase };
44
50
  }
45
51
 
46
52
  export { env, step };
@@ -82,6 +82,7 @@ var simulation = [
82
82
  var step_exports = {};
83
83
  __export(step_exports, {
84
84
  customEvent: () => customEvent,
85
+ init: () => init2,
85
86
  purchase: () => purchase
86
87
  });
87
88
 
@@ -92,9 +93,9 @@ var c = {};
92
93
  for (var o in n) e(t, o, { get: n[o], enumerable: true });
93
94
  })(c, { Level: () => u });
94
95
  var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(u || {});
95
- var F = { merge: true, shallow: true, extend: true };
96
+ var W = { merge: true, shallow: true, extend: true };
96
97
  function L(e2, t = {}, n = {}) {
97
- n = { ...F, ...n };
98
+ n = { ...W, ...n };
98
99
  const o = Object.entries(t).reduce((t2, [o2, r]) => {
99
100
  const i = e2[o2];
100
101
  return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
@@ -103,7 +104,7 @@ function L(e2, t = {}, n = {}) {
103
104
  }
104
105
  function fe(e2 = {}) {
105
106
  var _a;
106
- const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.3.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
107
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.4.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
107
108
  if (e2.name) {
108
109
  const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
109
110
  t2 && n2 && (r.entity = t2, r.action = n2);
@@ -116,6 +117,23 @@ function le(e2 = "entity action", t = {}) {
116
117
  }
117
118
 
118
119
  // src/examples/step.ts
120
+ var init2 = {
121
+ in: {
122
+ loadScript: true,
123
+ settings: {
124
+ domain: "example.com"
125
+ }
126
+ },
127
+ out: [
128
+ [
129
+ "script.appendChild",
130
+ {
131
+ src: "https://plausible.io/js/script.manual.js",
132
+ domain: "example.com"
133
+ }
134
+ ]
135
+ ]
136
+ };
119
137
  var purchase = {
120
138
  in: le("order complete", { timestamp: 1700000200 }),
121
139
  mapping: {
@@ -132,13 +150,16 @@ var purchase = {
132
150
  }
133
151
  },
134
152
  out: [
135
- "purchase",
136
- {
137
- revenue: {
138
- currency: "EUR",
139
- amount: 555
153
+ [
154
+ "plausible",
155
+ "purchase",
156
+ {
157
+ revenue: {
158
+ currency: "EUR",
159
+ amount: 555
160
+ }
140
161
  }
141
- }
162
+ ]
142
163
  ]
143
164
  };
144
165
  var customEvent = {
@@ -153,16 +174,19 @@ var customEvent = {
153
174
  }
154
175
  },
155
176
  out: [
156
- "Custom Event",
157
- {
158
- props: {
159
- string: "foo",
160
- number: 1,
161
- boolean: true,
162
- array: [0, "text", false]
163
- },
164
- revenue: 1
165
- }
177
+ [
178
+ "plausible",
179
+ "Custom Event",
180
+ {
181
+ props: {
182
+ string: "foo",
183
+ number: 1,
184
+ boolean: true,
185
+ array: [0, "text", false]
186
+ },
187
+ revenue: 1
188
+ }
189
+ ]
166
190
  ]
167
191
  };
168
192
  // Annotate the CommonJS export names for ESM import in node:
@@ -61,6 +61,7 @@ var simulation = [
61
61
  var step_exports = {};
62
62
  __export(step_exports, {
63
63
  customEvent: () => customEvent,
64
+ init: () => init2,
64
65
  purchase: () => purchase
65
66
  });
66
67
 
@@ -71,9 +72,9 @@ var c = {};
71
72
  for (var o in n) e(t, o, { get: n[o], enumerable: true });
72
73
  })(c, { Level: () => u });
73
74
  var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(u || {});
74
- var F = { merge: true, shallow: true, extend: true };
75
+ var W = { merge: true, shallow: true, extend: true };
75
76
  function L(e2, t = {}, n = {}) {
76
- n = { ...F, ...n };
77
+ n = { ...W, ...n };
77
78
  const o = Object.entries(t).reduce((t2, [o2, r]) => {
78
79
  const i = e2[o2];
79
80
  return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
@@ -82,7 +83,7 @@ function L(e2, t = {}, n = {}) {
82
83
  }
83
84
  function fe(e2 = {}) {
84
85
  var _a;
85
- const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.3.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
86
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.4.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
86
87
  if (e2.name) {
87
88
  const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
88
89
  t2 && n2 && (r.entity = t2, r.action = n2);
@@ -95,6 +96,23 @@ function le(e2 = "entity action", t = {}) {
95
96
  }
96
97
 
97
98
  // src/examples/step.ts
99
+ var init2 = {
100
+ in: {
101
+ loadScript: true,
102
+ settings: {
103
+ domain: "example.com"
104
+ }
105
+ },
106
+ out: [
107
+ [
108
+ "script.appendChild",
109
+ {
110
+ src: "https://plausible.io/js/script.manual.js",
111
+ domain: "example.com"
112
+ }
113
+ ]
114
+ ]
115
+ };
98
116
  var purchase = {
99
117
  in: le("order complete", { timestamp: 1700000200 }),
100
118
  mapping: {
@@ -111,13 +129,16 @@ var purchase = {
111
129
  }
112
130
  },
113
131
  out: [
114
- "purchase",
115
- {
116
- revenue: {
117
- currency: "EUR",
118
- amount: 555
132
+ [
133
+ "plausible",
134
+ "purchase",
135
+ {
136
+ revenue: {
137
+ currency: "EUR",
138
+ amount: 555
139
+ }
119
140
  }
120
- }
141
+ ]
121
142
  ]
122
143
  };
123
144
  var customEvent = {
@@ -132,16 +153,19 @@ var customEvent = {
132
153
  }
133
154
  },
134
155
  out: [
135
- "Custom Event",
136
- {
137
- props: {
138
- string: "foo",
139
- number: 1,
140
- boolean: true,
141
- array: [0, "text", false]
142
- },
143
- revenue: 1
144
- }
156
+ [
157
+ "plausible",
158
+ "Custom Event",
159
+ {
160
+ props: {
161
+ string: "foo",
162
+ number: 1,
163
+ boolean: true,
164
+ array: [0, "text", false]
165
+ },
166
+ revenue: 1
167
+ }
168
+ ]
145
169
  ]
146
170
  };
147
171
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/web-destination-plausible",
4
- "version": "3.3.1",
4
+ "version": "3.4.0",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "web"
@@ -129,7 +129,7 @@
129
129
  "group": "gr0up",
130
130
  "count": 1,
131
131
  "version": {
132
- "source": "3.3.1",
132
+ "source": "3.4.0",
133
133
  "tagging": 1
134
134
  },
135
135
  "source": {
@@ -148,20 +148,40 @@
148
148
  }
149
149
  },
150
150
  "out": [
151
- "Custom Event",
152
- {
153
- "props": {
154
- "string": "foo",
155
- "number": 1,
156
- "boolean": true,
157
- "array": [
158
- 0,
159
- "text",
160
- false
161
- ]
162
- },
163
- "revenue": 1
151
+ [
152
+ "plausible",
153
+ "Custom Event",
154
+ {
155
+ "props": {
156
+ "string": "foo",
157
+ "number": 1,
158
+ "boolean": true,
159
+ "array": [
160
+ 0,
161
+ "text",
162
+ false
163
+ ]
164
+ },
165
+ "revenue": 1
166
+ }
167
+ ]
168
+ ]
169
+ },
170
+ "init": {
171
+ "in": {
172
+ "loadScript": true,
173
+ "settings": {
174
+ "domain": "example.com"
164
175
  }
176
+ },
177
+ "out": [
178
+ [
179
+ "script.appendChild",
180
+ {
181
+ "src": "https://plausible.io/js/script.manual.js",
182
+ "domain": "example.com"
183
+ }
184
+ ]
165
185
  ]
166
186
  },
167
187
  "purchase": {
@@ -251,7 +271,7 @@
251
271
  "group": "gr0up",
252
272
  "count": 1,
253
273
  "version": {
254
- "source": "3.3.1",
274
+ "source": "3.4.0",
255
275
  "tagging": 1
256
276
  },
257
277
  "source": {
@@ -276,13 +296,16 @@
276
296
  }
277
297
  },
278
298
  "out": [
279
- "purchase",
280
- {
281
- "revenue": {
282
- "currency": "EUR",
283
- "amount": 555
299
+ [
300
+ "plausible",
301
+ "purchase",
302
+ {
303
+ "revenue": {
304
+ "currency": "EUR",
305
+ "amount": 555
306
+ }
284
307
  }
285
- }
308
+ ]
286
309
  ]
287
310
  }
288
311
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-destination-plausible",
3
3
  "description": "Plausible web destination for walkerOS",
4
- "version": "3.3.1",
4
+ "version": "3.4.0",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -37,10 +37,10 @@
37
37
  "update": "npx npm-check-updates -u && npm update"
38
38
  },
39
39
  "dependencies": {
40
- "@walkeros/web-core": "3.3.1"
40
+ "@walkeros/web-core": "3.4.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@walkeros/collector": "3.3.1"
43
+ "@walkeros/collector": "3.4.0"
44
44
  },
45
45
  "repository": {
46
46
  "url": "git+https://github.com/elbwalker/walkerOS.git",