@walkeros/web-core 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +272 -0
  2. package/README.md +19 -253
  3. package/package.json +5 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,272 @@
1
+ # @walkeros/web-core
2
+
3
+ ## 4.1.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e155ff8]
8
+ - Updated dependencies [e800974]
9
+ - Updated dependencies [e155ff8]
10
+ - Updated dependencies [1a8f2d7]
11
+ - Updated dependencies [1a8f2d7]
12
+ - Updated dependencies [b276173]
13
+ - Updated dependencies [dd9f5ad]
14
+ - Updated dependencies [c60ef35]
15
+ - Updated dependencies [adeebea]
16
+ - Updated dependencies [13aaeaa]
17
+ - Updated dependencies [e800974]
18
+ - Updated dependencies [adeebea]
19
+ - Updated dependencies [e800974]
20
+ - Updated dependencies [e800974]
21
+ - Updated dependencies [058f7ed]
22
+ - Updated dependencies [28a8ac2]
23
+ - Updated dependencies [fd6076e]
24
+ - @walkeros/core@4.1.0
25
+
26
+ ## 4.0.2
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [a6a0ea7]
31
+ - @walkeros/core@4.0.2
32
+
33
+ ## 4.0.1
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [381dfe7]
38
+ - Updated dependencies [1524275]
39
+ - Updated dependencies [03d7055]
40
+ - @walkeros/core@4.0.1
41
+
42
+ ## 4.0.0
43
+
44
+ ### Major Changes
45
+
46
+ - 93ea9c4: Event model v4: breaking changes to the `Event`, `Source`, and
47
+ `Entity` shapes.
48
+ - `event.id` is now a W3C span_id (16 lowercase hex chars), generated by the
49
+ collector. Reference: W3C Trace Context (W3C Recommendation, January 2020).
50
+ - `event.version`, `event.group`, `event.count` are removed.
51
+ - `source.type` is now the source kind (e.g. `browser`, `gtag`, `mcp`, `cli`).
52
+ New `source.platform` holds the runtime (`web` | `server` | `app` | ...).
53
+ - `source.id` and `source.previous_id` are removed.
54
+ - Browser source now sets `source.url` and `source.referrer`.
55
+ - MCP source sets `source.tool` per emission. CLI source sets
56
+ `source.command`.
57
+ - `Entity.nested` and `Entity.context` are now optional. Root `event.nested`
58
+ and `event.context` remain required.
59
+ - Each source self-registers via TypeScript module augmentation of `SourceMap`
60
+ in `@walkeros/core`.
61
+ - App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
62
+ part of this release. Telemetry from v4 CLI/MCP will not validate against
63
+ the existing app schema until that follow-up ships.
64
+ - `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
65
+ configs using `skip: true` in mapping rules must rename to `silent: true`.
66
+ Hard cut: no legacy alias, the field is gone.
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [93ea9c4]
71
+ - Updated dependencies [465775c]
72
+ - Updated dependencies [942a7fe]
73
+ - Updated dependencies [cfc7469]
74
+ - Updated dependencies [8e06b1f]
75
+ - Updated dependencies [3d50dd6]
76
+ - Updated dependencies [1ef33d9]
77
+ - @walkeros/core@4.0.0
78
+
79
+ ## 3.4.2
80
+
81
+ ### Patch Changes
82
+
83
+ - @walkeros/core@3.4.2
84
+
85
+ ## 3.4.1
86
+
87
+ ### Patch Changes
88
+
89
+ - caea905: Wrap `localStorage`/`sessionStorage`/cookie operations in try/catch.
90
+ Storage access in private browsing (Safari), sandboxed iframes, or when quota
91
+ is exceeded throws `SecurityError`/`QuotaExceededError` — previously these
92
+ crashed the event pipeline at the call site. Reads now return empty, writes
93
+ return empty and do not persist, deletes are silently ignored.
94
+ - Updated dependencies [12adf24]
95
+ - Updated dependencies [75aa26b]
96
+ - @walkeros/core@3.4.1
97
+
98
+ ## 3.4.0
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [74940cc]
103
+ - Updated dependencies [525f5d9]
104
+ - @walkeros/core@3.4.0
105
+
106
+ ## 3.3.1
107
+
108
+ ### Patch Changes
109
+
110
+ - @walkeros/core@3.3.1
111
+
112
+ ## 3.3.0
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [2849acb]
117
+ - Updated dependencies [08c365a]
118
+ - Updated dependencies [08c365a]
119
+ - Updated dependencies [08c365a]
120
+ - Updated dependencies [08c365a]
121
+ - @walkeros/core@3.3.0
122
+
123
+ ## 3.2.0
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [eb865e1]
128
+ - Updated dependencies [c0a53f9]
129
+ - Updated dependencies [f007c9f]
130
+ - Updated dependencies [bf2dc5b]
131
+ - Updated dependencies [da0b640]
132
+ - @walkeros/core@3.2.0
133
+
134
+ ## 3.1.1
135
+
136
+ ### Patch Changes
137
+
138
+ - @walkeros/core@3.1.1
139
+
140
+ ## 3.1.0
141
+
142
+ ### Minor Changes
143
+
144
+ - ff58828: Add optional StorageEnv parameter to storageRead, storageWrite, and
145
+ storageDelete. Enables dependency injection of window/document for testing and
146
+ simulation. Fully backwards-compatible — existing callers are unchanged.
147
+
148
+ ### Patch Changes
149
+
150
+ - Updated dependencies [dfc6738]
151
+ - Updated dependencies [966342b]
152
+ - Updated dependencies [bee8ba7]
153
+ - Updated dependencies [966342b]
154
+ - Updated dependencies [df990d4]
155
+ - @walkeros/core@3.1.0
156
+
157
+ ## 3.0.2
158
+
159
+ ### Patch Changes
160
+
161
+ - @walkeros/core@3.0.2
162
+
163
+ ## 3.0.1
164
+
165
+ ### Patch Changes
166
+
167
+ - @walkeros/core@3.0.1
168
+
169
+ ## 3.0.0
170
+
171
+ ### Patch Changes
172
+
173
+ - 499e27a: Add sideEffects declarations to all packages for bundler tree-shaking
174
+ support.
175
+ - Updated dependencies [2b259b6]
176
+ - Updated dependencies [2614014]
177
+ - Updated dependencies [6ae0ee3]
178
+ - Updated dependencies [37299a9]
179
+ - Updated dependencies [499e27a]
180
+ - Updated dependencies [0e5eede]
181
+ - Updated dependencies [d11f574]
182
+ - Updated dependencies [d11f574]
183
+ - Updated dependencies [1fe337a]
184
+ - Updated dependencies [5cb84c1]
185
+ - Updated dependencies [23f218a]
186
+ - Updated dependencies [499e27a]
187
+ - Updated dependencies [c83d909]
188
+ - Updated dependencies [b6c8fa8]
189
+ - @walkeros/core@3.0.0
190
+
191
+ ## 2.1.1
192
+
193
+ ### Patch Changes
194
+
195
+ - Updated dependencies [fab477d]
196
+ - @walkeros/core@2.1.1
197
+
198
+ ## 2.1.0
199
+
200
+ ### Patch Changes
201
+
202
+ - Updated dependencies [7fc4cee]
203
+ - Updated dependencies [7fc4cee]
204
+ - Updated dependencies [cb2da05]
205
+ - Updated dependencies [2bbe8c8]
206
+ - Updated dependencies [3eb6416]
207
+ - Updated dependencies [02a7958]
208
+ - Updated dependencies [97df0b2]
209
+ - Updated dependencies [97df0b2]
210
+ - Updated dependencies [026c412]
211
+ - Updated dependencies [7d38d9d]
212
+ - @walkeros/core@2.1.0
213
+
214
+ ## 2.0.1
215
+
216
+ ## 2.0.0
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [7b2d750]
221
+ - @walkeros/core@1.4.0
222
+
223
+ ## 1.0.5
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [a4cc1ea]
228
+ - @walkeros/core@1.3.0
229
+
230
+ ## 1.0.4
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [7ad6cfb]
235
+ - @walkeros/core@1.2.2
236
+
237
+ ## 1.0.3
238
+
239
+ ### Patch Changes
240
+
241
+ - Updated dependencies [6256c12]
242
+ - @walkeros/core@1.2.1
243
+
244
+ ## 1.0.2
245
+
246
+ ### Patch Changes
247
+
248
+ - Updated dependencies [f39d9fb]
249
+ - Updated dependencies [888bbdf]
250
+ - @walkeros/core@1.2.0
251
+
252
+ ## 1.0.1
253
+
254
+ ### Patch Changes
255
+
256
+ - Updated dependencies [b65b773]
257
+ - Updated dependencies [20eca6e]
258
+ - @walkeros/core@1.1.0
259
+
260
+ ## 1.0.0
261
+
262
+ ### Major Changes
263
+
264
+ - 67c9e1d: Hello World! walkerOS v1.0.0
265
+
266
+ Open-source event data collection. Collect event data for digital analytics in
267
+ a unified and privacy-centric way.
268
+
269
+ ### Patch Changes
270
+
271
+ - Updated dependencies [67c9e1d]
272
+ - @walkeros/core@1.0.0
package/README.md CHANGED
@@ -4,273 +4,39 @@
4
4
  </a>
5
5
  </p>
6
6
 
7
- # Web Core Utilities for walkerOS
7
+ # @walkeros/web-core
8
8
 
9
- [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/core)
10
- &bull; [NPM Package](https://www.npmjs.com/package/@walkeros/web-core)
11
-
12
- Web core utilities are browser-specific functions designed for client-side
13
- walkerOS implementations. These utilities handle DOM interactions, browser
14
- information, storage, element visibility, and web-based communication.
9
+ Browser-specific utilities for client-side walkerOS implementations, covering
10
+ DOM interactions, browser information, storage, element visibility, web hashing,
11
+ and web-based communication.
15
12
 
16
- > **Note**: Session management has been moved to `@walkeros/web-source-session`.
17
- > See the [session source package](../sources/session/README.md) for session
18
- > tracking.
13
+ [Documentation](https://www.walkeros.io/docs) &bull;
14
+ [NPM Package](https://www.npmjs.com/package/@walkeros/web-core) &bull;
15
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/core)
19
16
 
20
17
  ## Installation
21
18
 
22
- Import web utilities from the `@walkeros/web-core` package:
23
-
24
- ```ts
25
- import { getAttribute, sendWeb, isVisible } from '@walkeros/web-core';
19
+ ```bash
20
+ npm install @walkeros/web-core
26
21
  ```
27
22
 
28
- ## Utilities
29
-
30
- ### DOM Utilities
23
+ ## Quick start
31
24
 
32
- #### getAttribute
33
-
34
- `getAttribute(element: Element, name: string): string` retrieves attribute
35
- values from DOM elements with enhanced handling.
25
+ ```ts
26
+ import { getAttribute, isVisible, sendWeb } from '@walkeros/web-core';
36
27
 
37
- ```js
38
28
  const element = document.querySelector('[data-elb="product"]');
39
- const entityType = getAttribute(element, 'data-elb'); // Returns 'product'
40
- ```
41
-
42
- #### Attribute Parsing
43
-
44
- ##### splitAttribute
45
-
46
- `splitAttribute(str: string, separator?: string): string[]` splits attribute
47
- strings using specified separators.
48
-
49
- ```js
50
- splitAttribute('id:123,name:shirt', ','); // Returns ['id:123', 'name:shirt']
51
- ```
52
-
53
- ##### splitKeyVal
54
-
55
- `splitKeyVal(str: string): [string, string]` splits key-value pairs from
56
- attribute strings.
57
-
58
- ```js
59
- splitKeyVal('id:123'); // Returns ['id', '123']
60
- ```
61
-
62
- ##### parseInlineConfig
63
-
64
- `parseInlineConfig(str: string): Record<string, unknown>` parses inline
65
- configuration strings from HTML attributes.
66
-
67
- ```js
68
- parseInlineConfig('{"tracking": true, "debug": false}');
69
- // Returns { tracking: true, debug: false }
70
- ```
71
-
72
- ### Browser Information
73
-
74
- #### getLanguage
75
-
76
- `getLanguage(navigatorRef: Navigator): string | undefined` extracts the user's
77
- preferred language.
78
-
79
- ```js
80
- getLanguage(navigator); // Returns 'en-US' or user's language
81
- ```
82
-
83
- #### getTimezone
84
-
85
- `getTimezone(): string | undefined` gets the user's timezone from the Intl API.
86
-
87
- ```js
88
- getTimezone(); // Returns 'America/New_York' or user's timezone
89
- ```
90
-
91
- #### getScreenSize
92
-
93
- `getScreenSize(windowRef: Window): string` returns the window's screen
94
- dimensions.
95
-
96
- ```js
97
- getScreenSize(window); // Returns '1920x1080' or current screen size
98
- ```
99
-
100
- ### Element Visibility
101
-
102
- #### isVisible
103
-
104
- `isVisible(element: HTMLElement): boolean` checks if an element is visible to
105
- the user.
106
-
107
- ```js
108
- const promoElement = document.getElementById('promotion');
109
- if (isVisible(promoElement)) {
110
- // Element is visible on screen
111
- }
112
- ```
113
-
114
- This function considers:
115
-
116
- - Element display and visibility styles
117
- - Element position within viewport
118
- - Parent element visibility
119
- - Intersection with the visible area
120
-
121
- ### Storage Management
122
-
123
- #### Storage Operations
124
-
125
- ##### storageRead
126
-
127
- `storageRead(key: string, storage?: StorageType): WalkerOS.PropertyType` reads
128
- data from browser storage with automatic type conversion.
129
-
130
- ```js
131
- // Default uses sessionStorage
132
- const userId = storageRead('walker_user_id');
29
+ const entity = getAttribute(element, 'data-elb');
133
30
 
134
- // Use localStorage
135
- const data = storageRead('data', 'local');
136
- ```
137
-
138
- ##### storageWrite
139
-
140
- `storageWrite(key: string, value: WalkerOS.PropertyType, maxAgeInMinutes?: number, storage?: StorageType, domain?: string): WalkerOS.PropertyType`
141
- writes data to storage with expiration and domain options.
142
-
143
- ```js
144
- // Store with 30-minute expiration
145
- storageWrite('user_preference', 'dark-mode', 30);
146
-
147
- // Store in localStorage
148
- storageWrite('temp_data', { id: 123 }, undefined, 'local');
149
-
150
- // Store with custom domain for cookies
151
- storageWrite('tracking_id', 'abc123', 1440, 'cookie', '.example.com');
152
- ```
153
-
154
- ##### storageDelete
155
-
156
- `storageDelete(key: string, storage?: StorageType)` removes data from storage.
157
-
158
- ```js
159
- storageDelete('expired_data');
160
- storageDelete('session_temp', 'local');
161
- ```
162
-
163
- ### Web Communication
164
-
165
- #### sendWeb
166
-
167
- `sendWeb<T>(url: string, data?: SendDataValue, options?: SendWebOptionsDynamic<T>): SendWebReturn<T>`
168
- sends data using various web transport methods.
169
-
170
- ```js
171
- // Default fetch transport
172
- await sendWeb('https://api.example.com/events', eventData);
173
-
174
- // Use specific transport
175
- await sendWeb(url, data, { transport: 'beacon' });
176
- await sendWeb(url, data, { transport: 'xhr' });
177
-
178
- // With custom headers
179
- await sendWeb(url, data, {
180
- headers: { Authorization: 'Bearer token' },
181
- method: 'PUT',
182
- });
183
- ```
184
-
185
- #### Transport-Specific Functions
186
-
187
- ##### sendWebAsFetch
188
-
189
- `sendWebAsFetch(url: string, data?: SendDataValue, options?: SendWebOptionsFetch): Promise<SendResponse>`
190
- uses the modern Fetch API with advanced options.
191
-
192
- ```js
193
- await sendWebAsFetch(url, data, {
194
- credentials: 'include',
195
- noCors: true,
196
- headers: { 'Content-Type': 'application/json' },
197
- });
198
- ```
199
-
200
- ##### sendWebAsBeacon
201
-
202
- `sendWebAsBeacon(url: string, data?: SendDataValue): SendResponse` uses the
203
- Beacon API for reliable data transmission, especially during page unload.
204
-
205
- ```js
206
- // Reliable sending during page unload
207
- window.addEventListener('beforeunload', () => {
208
- sendWebAsBeacon('/analytics/pageview', { duration: Date.now() - startTime });
209
- });
210
- ```
211
-
212
- ##### sendWebAsXhr
213
-
214
- `sendWebAsXhr(url: string, data?: SendDataValue, options?: SendWebOptions): SendResponse`
215
- uses XMLHttpRequest for synchronous communication.
216
-
217
- ```js
218
- // Synchronous request (blocks execution)
219
- const response = sendWebAsXhr(url, data, { method: 'POST' });
220
- ```
221
-
222
- ### Web Hashing
223
-
224
- #### getHashWeb
225
-
226
- `getHashWeb(str: string, length?: number): Promise<string>` generates SHA-256
227
- hashes using the Web Crypto API.
228
-
229
- ```js
230
- // Generate hash for fingerprinting
231
- const userFingerprint = await getHashWeb(
232
- navigator.userAgent + navigator.language + screen.width,
233
- 16,
234
- );
235
- // Returns shortened hash like '47e0bdd10f04ef13'
236
- ```
237
-
238
- ## Configuration Types
239
-
240
- ### SendWebOptions
241
-
242
- ```ts
243
- interface SendWebOptions {
244
- headers?: Record<string, string>;
245
- method?: string; // Default: 'POST'
246
- transport?: 'fetch' | 'beacon' | 'xhr'; // Default: 'fetch'
247
- }
248
-
249
- interface SendWebOptionsFetch extends SendWebOptions {
250
- credentials?: 'omit' | 'same-origin' | 'include';
251
- noCors?: boolean;
31
+ if (isVisible(element)) {
32
+ await sendWeb('https://api.example.com/events', { entity });
252
33
  }
253
34
  ```
254
35
 
255
- ### StorageType
256
-
257
- ```ts
258
- type StorageType = 'local' | 'session' | 'cookie';
259
- ```
260
-
261
- ## Usage Notes
262
-
263
- - **Consent Required**: Browser information functions may require user consent
264
- depending on privacy regulations
265
- - **Transport Selection**: Choose transport based on use case:
266
- - `fetch` - Modern, flexible, supports responses
267
- - `beacon` - Reliable during page unload, small payloads
268
- - `xhr` - Synchronous when needed, broader browser support
269
-
270
- ---
36
+ ## Documentation
271
37
 
272
- For platform-agnostic utilities, see
273
- [Core Utilities](https://www.walkeros.io/docs/core).
38
+ Full configuration, mapping, and examples live in the docs:
39
+ **https://www.walkeros.io/docs**
274
40
 
275
41
  ## Contribute
276
42
 
@@ -281,4 +47,4 @@ Feel free to contribute by submitting an
281
47
 
282
48
  ## License
283
49
 
284
- This project is licensed under the MIT License.
50
+ MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-core",
3
3
  "description": "Web-specific utilities for walkerOS",
4
- "version": "4.1.0-next-1778668930820",
4
+ "version": "4.1.0",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -14,7 +14,8 @@
14
14
  }
15
15
  },
16
16
  "files": [
17
- "dist/**"
17
+ "dist/**",
18
+ "CHANGELOG.md"
18
19
  ],
19
20
  "scripts": {
20
21
  "build": "tsup --silent",
@@ -26,7 +27,7 @@
26
27
  "update": "npx npm-check-updates -u && npm update"
27
28
  },
28
29
  "devDependencies": {
29
- "@walkeros/core": "4.1.0-next-1778668930820"
30
+ "@walkeros/core": "4.1.0"
30
31
  },
31
32
  "repository": {
32
33
  "url": "git+https://github.com/elbwalker/walkerOS.git",
@@ -50,6 +51,6 @@
50
51
  }
51
52
  ],
52
53
  "dependencies": {
53
- "@walkeros/core": "4.1.0-next-1778668930820"
54
+ "@walkeros/core": "4.1.0"
54
55
  }
55
56
  }