@walkeros/web-source-browser 4.1.0-next-1778668930820 → 4.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,341 @@
1
+ # @walkeros/web-source-browser
2
+
3
+ ## 4.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fd6076e: Walker commands `destination`, `hook`, and `on` now take a single
8
+ Init object: `elb('walker destination', { code, config })`,
9
+ `elb('walker hook', { name, fn })`, `elb('walker on', { type, rules })`. The
10
+ previous positional forms and the `{ push }` shorthand are removed; the
11
+ `options` argument is gone from `collector.command`, `addDestination`, and
12
+ `commonHandleCommand`.
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [e155ff8]
17
+ - Updated dependencies [e800974]
18
+ - Updated dependencies [e155ff8]
19
+ - Updated dependencies [1a8f2d7]
20
+ - Updated dependencies [1a8f2d7]
21
+ - Updated dependencies [b276173]
22
+ - Updated dependencies [dd9f5ad]
23
+ - Updated dependencies [c60ef35]
24
+ - Updated dependencies [adeebea]
25
+ - Updated dependencies [13aaeaa]
26
+ - Updated dependencies [e800974]
27
+ - Updated dependencies [adeebea]
28
+ - Updated dependencies [6cdc362]
29
+ - Updated dependencies [e800974]
30
+ - Updated dependencies [e800974]
31
+ - Updated dependencies [058f7ed]
32
+ - Updated dependencies [28a8ac2]
33
+ - Updated dependencies [fd6076e]
34
+ - @walkeros/core@4.1.0
35
+ - @walkeros/collector@4.1.0
36
+ - @walkeros/web-core@4.1.0
37
+
38
+ ## 4.0.2
39
+
40
+ ### Patch Changes
41
+
42
+ - @walkeros/collector@4.0.2
43
+ - @walkeros/web-core@4.0.2
44
+
45
+ ## 4.0.1
46
+
47
+ ### Patch Changes
48
+
49
+ - 1524275: Source lifecycle redesign: factory + eager `init` + collector-gated
50
+ `on()`
51
+
52
+ Source factories must now be side-effect-free. The collector calls
53
+ `Instance.init()` on each source eagerly after all factories register.
54
+ `require` no longer gates code execution. It gates `on(type)` delivery (events
55
+ queue in `Instance.queueOn` until the source is started, then replay).
56
+ `collector.pending.sources` has been removed; per-source state lives on
57
+ `Source.Instance` (`queueOn`) and `Source.Config` (`init`, `require`).
58
+
59
+ Migration: any source factory with side effects (queue draining, walker
60
+ command emission, listener attachment) should move those into the returned
61
+ Instance's optional `init` method. Tests asserting on
62
+ `collector.pending.sources` should read `collector.sources[id]` and inspect
63
+ `config.init` / `config.require` instead.
64
+
65
+ Fixes the elbLayer queue replay clobbering fresh consent/user state,
66
+ late-activated sources missing `walker run`, and inter-source require chains
67
+ racing when a non-required source's init fired a state-mutating walker command
68
+ before later require-gated sources had been registered.
69
+
70
+ - Updated dependencies [cb265eb]
71
+ - Updated dependencies [1524275]
72
+ - @walkeros/collector@4.0.1
73
+ - @walkeros/web-core@4.0.1
74
+
75
+ ## 4.0.0
76
+
77
+ ### Major Changes
78
+
79
+ - 93ea9c4: Event model v4: breaking changes to the `Event`, `Source`, and
80
+ `Entity` shapes.
81
+ - `event.id` is now a W3C span_id (16 lowercase hex chars), generated by the
82
+ collector. Reference: W3C Trace Context (W3C Recommendation, January 2020).
83
+ - `event.version`, `event.group`, `event.count` are removed.
84
+ - `source.type` is now the source kind (e.g. `browser`, `gtag`, `mcp`, `cli`).
85
+ New `source.platform` holds the runtime (`web` | `server` | `app` | ...).
86
+ - `source.id` and `source.previous_id` are removed.
87
+ - Browser source now sets `source.url` and `source.referrer`.
88
+ - MCP source sets `source.tool` per emission. CLI source sets
89
+ `source.command`.
90
+ - `Entity.nested` and `Entity.context` are now optional. Root `event.nested`
91
+ and `event.context` remain required.
92
+ - Each source self-registers via TypeScript module augmentation of `SourceMap`
93
+ in `@walkeros/core`.
94
+ - App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
95
+ part of this release. Telemetry from v4 CLI/MCP will not validate against
96
+ the existing app schema until that follow-up ships.
97
+ - `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
98
+ configs using `skip: true` in mapping rules must rename to `silent: true`.
99
+ Hard cut: no legacy alias, the field is gone.
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [93ea9c4]
104
+ - Updated dependencies [8e06b1f]
105
+ - Updated dependencies [1ef33d9]
106
+ - @walkeros/collector@4.0.0
107
+ - @walkeros/web-core@4.0.0
108
+
109
+ ## 3.4.2
110
+
111
+ ### Patch Changes
112
+
113
+ - @walkeros/collector@3.4.2
114
+ - @walkeros/web-core@3.4.2
115
+
116
+ ## 3.4.1
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies [75aa26b]
121
+ - Updated dependencies [caea905]
122
+ - @walkeros/collector@3.4.1
123
+ - @walkeros/web-core@3.4.1
124
+
125
+ ## 3.4.0
126
+
127
+ ### Minor Changes
128
+
129
+ - 724f97e: Migrate every step example in every walkerOS package to the
130
+ standardized `[callable, ...args][]` shape introduced in `@walkeros/core`.
131
+ Every step example's `out` is now an array of effect tuples whose first
132
+ element is the callable's public SDK name (`'gtag'`, `'analytics.track'`,
133
+ `'fbq'`, `'dataLayer.push'`, `'sendServer'`, `'fetch'`, `'trackClient.track'`,
134
+ `'amplitude.track'`, `'fs.writeFile'`, `'producer.send'`, `'client.xadd'`,
135
+ `'client.send'`, `'dataset.table.insert'`, etc.). Source examples use `'elb'`
136
+ as the callable; transformer examples use the reserved `'return'` keyword;
137
+ store examples use store-operation callables (`'get'`, `'set'`). Tests capture
138
+ real calls on each component's spy and assert against `example.out` directly —
139
+ the hardcoded `PACKAGE_CALLS` registry in the app is no longer consulted
140
+ (emptied; plan #3 removes it structurally).
141
+
142
+ ### Patch Changes
143
+
144
+ - @walkeros/collector@3.4.0
145
+ - @walkeros/web-core@3.4.0
146
+
147
+ ## 3.3.1
148
+
149
+ ### Patch Changes
150
+
151
+ - Updated dependencies [b10144a]
152
+ - Updated dependencies [206185a]
153
+ - Updated dependencies [50e5d09]
154
+ - Updated dependencies [32ff626]
155
+ - @walkeros/collector@3.3.1
156
+ - @walkeros/web-core@3.3.1
157
+
158
+ ## 3.3.0
159
+
160
+ ### Patch Changes
161
+
162
+ - Updated dependencies [08c365a]
163
+ - Updated dependencies [08c365a]
164
+ - @walkeros/collector@3.3.0
165
+ - @walkeros/web-core@3.3.0
166
+
167
+ ## 3.2.0
168
+
169
+ ### Patch Changes
170
+
171
+ - Updated dependencies [eb865e1]
172
+ - Updated dependencies [c0a53f9]
173
+ - Updated dependencies [8cdc0bb]
174
+ - Updated dependencies [f007c9f]
175
+ - Updated dependencies [bf2dc5b]
176
+ - Updated dependencies [da0b640]
177
+ - Updated dependencies [a5d25bc]
178
+ - Updated dependencies [9a99298]
179
+ - Updated dependencies [884527d]
180
+ - @walkeros/collector@3.2.0
181
+ - @walkeros/web-core@3.2.0
182
+
183
+ ## 3.1.1
184
+
185
+ ### Patch Changes
186
+
187
+ - @walkeros/collector@3.1.1
188
+ - @walkeros/web-core@3.1.1
189
+
190
+ ## 3.1.0
191
+
192
+ ### Minor Changes
193
+
194
+ - a9149e4: Add createTrigger to browser source examples following unified
195
+ Trigger.CreateFn interface. Step examples migrated to HTML content format with
196
+ trigger metadata. Collector simulate.ts updated with dual-path support for
197
+ createTrigger and legacy triggers.
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [a9149e4]
202
+ - Updated dependencies [ff58828]
203
+ - Updated dependencies [df990d4]
204
+ - @walkeros/collector@3.1.0
205
+ - @walkeros/web-core@3.1.0
206
+
207
+ ## 3.0.2
208
+
209
+ ### Patch Changes
210
+
211
+ - @walkeros/collector@3.0.2
212
+ - @walkeros/web-core@3.0.2
213
+
214
+ ## 3.0.1
215
+
216
+ ### Patch Changes
217
+
218
+ - @walkeros/collector@3.0.1
219
+ - @walkeros/web-core@3.0.1
220
+
221
+ ## 3.0.0
222
+
223
+ ### Patch Changes
224
+
225
+ - a30095c: Fix Shadow DOM support: use composedPath for event targets, recurse
226
+ into open shadow roots for element discovery and property collection
227
+ - 499e27a: Add sideEffects declarations to all packages for bundler tree-shaking
228
+ support.
229
+ - Updated dependencies [499e27a]
230
+ - Updated dependencies [499e27a]
231
+ - Updated dependencies [a2aa491]
232
+ - Updated dependencies [b6c8fa8]
233
+ - @walkeros/collector@3.0.0
234
+ - @walkeros/web-core@3.0.0
235
+
236
+ ## 2.1.1
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies [fab477d]
241
+ - @walkeros/collector@2.1.1
242
+ - @walkeros/web-core@2.1.1
243
+
244
+ ## 2.1.0
245
+
246
+ ### Minor Changes
247
+
248
+ - 97df0b2: Step examples: upgrade all packages to blueprint pattern with inline
249
+ mapping, no intermediate variables, no `all` export
250
+
251
+ ### Patch Changes
252
+
253
+ - 60f0a1c: Add setup functions and renderer metadata for source simulation
254
+ - Updated dependencies [2bbe8c8]
255
+ - Updated dependencies [3eb6416]
256
+ - Updated dependencies [02a7958]
257
+ - Updated dependencies [026c412]
258
+ - @walkeros/collector@2.1.0
259
+ - @walkeros/web-core@2.1.0
260
+
261
+ ## 2.0.1
262
+
263
+ ## 1.1.4
264
+
265
+ ### Patch Changes
266
+
267
+ - e7914fb: Update internal dependencies to use >= ranges
268
+ - Updated dependencies [32bfc92]
269
+ - @walkeros/collector@2.0.0
270
+ - @walkeros/web-core@2.0.0
271
+
272
+ ## 1.1.3
273
+
274
+ ### Patch Changes
275
+
276
+ - Updated dependencies [a4cc1ea]
277
+ - Updated dependencies [9599e60]
278
+ - Updated dependencies [e9c9faa]
279
+ - @walkeros/collector@1.2.0
280
+ - @walkeros/web-core@1.0.5
281
+
282
+ ## 1.1.2
283
+
284
+ ### Patch Changes
285
+
286
+ - Updated dependencies [7ad6cfb]
287
+ - @walkeros/collector@1.1.2
288
+ - @walkeros/web-core@1.0.4
289
+
290
+ ## 1.1.1
291
+
292
+ ### Patch Changes
293
+
294
+ - @walkeros/collector@1.1.1
295
+ - @walkeros/web-core@1.0.3
296
+
297
+ ## 1.1.0
298
+
299
+ ### Minor Changes
300
+
301
+ - a38d791: Session detection extracted to standalone sourceSession
302
+ - New `sourceSession` for composable session management
303
+ - Browser source no longer includes session by default
304
+ - To restore previous behavior, add sourceSession alongside browser source:
305
+
306
+ ```typescript
307
+ sources: {
308
+ browser: sourceBrowser,
309
+ session: { code: sourceSession, config: { storage: true } }
310
+ }
311
+ ```
312
+
313
+ ### Patch Changes
314
+
315
+ - Updated dependencies [f39d9fb]
316
+ - Updated dependencies [888bbdf]
317
+ - @walkeros/collector@1.1.0
318
+ - @walkeros/web-core@1.0.2
319
+
320
+ ## 1.0.1
321
+
322
+ ### Patch Changes
323
+
324
+ - Updated dependencies [b65b773]
325
+ - @walkeros/collector@1.0.1
326
+ - @walkeros/web-core@1.0.1
327
+
328
+ ## 1.0.0
329
+
330
+ ### Major Changes
331
+
332
+ - 67c9e1d: Hello World! walkerOS v1.0.0
333
+
334
+ Open-source event data collection. Collect event data for digital analytics in
335
+ a unified and privacy-centric way.
336
+
337
+ ### Patch Changes
338
+
339
+ - Updated dependencies [67c9e1d]
340
+ - @walkeros/collector@1.0.0
341
+ - @walkeros/web-core@1.0.0
package/README.md CHANGED
@@ -4,131 +4,42 @@
4
4
  </a>
5
5
  </p>
6
6
 
7
- # Browser DOM Source for walkerOS
7
+ # @walkeros/web-source-browser
8
8
 
9
- [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/sources/browser)
10
- &bull; [NPM Package](https://www.npmjs.com/package/@walkeros/web-source-browser)
11
-
12
- The Browser Source is walkerOS's primary web tracking solution that you can use
13
- to capture user interactions directly from the browsers DOM.
14
-
15
- ## Quick Start
16
-
17
- ```bash
18
- npm install @walkeros/web-source-browser
19
- ```
20
-
21
- ```typescript
22
- import { sourceBrowser } from '@walkeros/web-source-browser';
23
- await startFlow({ sources: { browser: { code: sourceBrowser } } });
24
- ```
9
+ Captures user interactions directly from the DOM using `data-elb-*` attributes,
10
+ with automatic pageviews, an enhanced `elb` function, and a built-in trigger
11
+ system.
25
12
 
26
- ## What It Does
27
-
28
- The Browser Source transforms your website into a comprehensive tracking
29
- environment by:
30
-
31
- - **Data attribute reading**: Extracts custom tracking data from HTML `data-elb`
32
- attributes
33
- - **Session management**: Detects and handles user sessions automatically
13
+ [Documentation](https://www.walkeros.io/docs/sources/web/browser) &bull;
14
+ [NPM Package](https://www.npmjs.com/package/@walkeros/web-source-browser) &bull;
15
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/sources/browser)
34
16
 
35
17
  ## Installation
36
18
 
37
- ### With npm
38
-
39
- Install the source via npm:
40
-
41
19
  ```bash
42
20
  npm install @walkeros/web-source-browser
43
21
  ```
44
22
 
45
- Setup in your project:
46
-
47
- ```javascript
48
- import { startFlow } from '@walkeros/collector';
49
- import { sourceBrowser } from '@walkeros/web-source-browser';
50
-
51
- const { collector } = await startFlow({
52
- sources: {
53
- browser: {
54
- code: sourceBrowser,
55
- config: {
56
- settings: {
57
- pageview: true,
58
- session: true,
59
- elb: 'elb', // Browser source will set window.elb automatically
60
- },
61
- },
62
- },
63
- },
64
- });
23
+ ## Quick start
24
+
25
+ ```json
26
+ {
27
+ "version": 4,
28
+ "flows": {
29
+ "default": {
30
+ "config": { "platform": "web" },
31
+ "sources": {
32
+ "browser": { "package": "@walkeros/web-source-browser", "config": {} }
33
+ }
34
+ }
35
+ }
36
+ }
65
37
  ```
66
38
 
67
- ### With a script tag
68
-
69
- Load the source via dynamic import:
70
-
71
- ```html
72
- <script>
73
- // Load the collector and source
74
- const { startFlow } = await import(
75
- 'https://cdn.jsdelivr.net/npm/@walkeros/collector/dist/index.mjs'
76
- );
77
- const { sourceBrowser } = await import(
78
- 'https://cdn.jsdelivr.net/npm/@walkeros/web-source-browser/dist/index.mjs'
79
- );
80
-
81
- const { collector, elb } = await startFlow({
82
- sources: {
83
- browser: {
84
- code: sourceBrowser,
85
- config: {
86
- settings: {
87
- prefix: 'data-elb',
88
- pageview: true,
89
- session: true,
90
- },
91
- },
92
- },
93
- },
94
- });
95
- </script>
96
- ```
97
-
98
- ## Configuration reference
99
-
100
- | Name | Type | Description | Required | Example |
101
- | ---------- | -------------------------------- | ------------------------------------------------ | -------- | -------------------------------- |
102
- | `prefix` | `string` | Prefix for data attributes used in DOM tracking | No | `'data-elb'` |
103
- | `scope` | `Element \| Document` | DOM scope for event tracking (default: document) | No | `document.querySelector("#app")` |
104
- | `pageview` | `boolean` | Enable automatic pageview tracking | No | `true` |
105
- | `session` | `boolean` | Enable session tracking and management | No | `true` |
106
- | `elb` | `string` | Custom name for the global elb function | No | `'elb'` |
107
- | `name` | `string` | Custom name for the browser source instance | No | `'mySource'` |
108
- | `elbLayer` | `boolean \| string \| Elb.Layer` | Enable elbLayer for async command queuing | No | `true` |
109
-
110
- ### elb
39
+ ## Documentation
111
40
 
112
- > **Two Different elb Functions**
113
- >
114
- > The collector provides **two different elb functions**:
115
- >
116
- > 1. **Collector elb** (`elb` from `startFlow`): Basic event tracking that
117
- > works with all sources and destinations
118
- > 2. **Browser Source elb** (`collector.sources.browser.elb`): Enhanced
119
- > function with browser-specific features
120
- >
121
- > **Browser Source elb adds:**
122
- >
123
- > - **DOM Commands**: `walker init` for asynchronous loading of DOM elements
124
- > - **Flexible Arguments**: Support for multiple argument patterns
125
- > - **elbLayer Integration**: Automatic processing of queued commands
126
- > - **Element parameters**: Support for element parameters in DOM commands
127
- >
128
- > Access the enhanced elb via `collector.sources.browser.elb`.
129
- >
130
- > See [Commands](https://www.walkeros.io/docs/sources/web/browser/commands) for
131
- > full browser source API documentation.
41
+ Full configuration, mapping, and examples live in the docs:
42
+ **https://www.walkeros.io/docs/sources/web/browser**
132
43
 
133
44
  ## Contribute
134
45
 
@@ -139,4 +50,4 @@ Feel free to contribute by submitting an
139
50
 
140
51
  ## License
141
52
 
142
- This project is licensed under the MIT License.
53
+ MIT