@walkeros/walker.js 0.4.2 → 0.5.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 +16 -0
- package/README.md +18 -18
- package/dist/__tests__/setup.d.ts +3 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/__tests__/setup.js +163 -0
- package/dist/__tests__/setup.js.map +1 -0
- package/dist/destination.d.ts +3 -0
- package/dist/destination.d.ts.map +1 -0
- package/dist/destination.js +28 -0
- package/dist/destination.js.map +1 -0
- package/dist/dev.d.ts +3 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +4 -0
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es5.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schemas.d.ts +6 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +101 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/walker.js +1 -1
- package/dist/walkerjs.d.ts +2 -0
- package/dist/walkerjs.d.ts.map +1 -0
- package/dist/walkerjs.js +35 -0
- package/dist/walkerjs.js.map +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @walkeros/walker.js
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- just flow
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- Updated dependencies [22cd09c]
|
|
13
|
+
- @walkeros/web-source-browser@0.5.0
|
|
14
|
+
- @walkeros/collector@0.5.0
|
|
15
|
+
- @walkeros/core@0.5.0
|
|
16
|
+
- @walkeros/web-core@0.5.0
|
|
17
|
+
- @walkeros/web-source-datalayer@0.5.0
|
|
18
|
+
|
|
3
19
|
## 0.4.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -91,14 +91,14 @@ Walker.js supports multiple configuration approaches with different priorities:
|
|
|
91
91
|
|
|
92
92
|
### Settings
|
|
93
93
|
|
|
94
|
-
| Name | Type | Default | Description
|
|
95
|
-
| :---------- | :------------------ | :------------------------------------------------------------------- |
|
|
96
|
-
| `elb` | `string` | `"elb"` | Global function name for event tracking
|
|
97
|
-
| `name` | `string` | `"walkerjs"` | Global instance name
|
|
98
|
-
| `run` | `boolean` | `true` | Auto-initialize walker.js on load
|
|
99
|
-
| `browser` | `object \| boolean` | `{ run: true, session: true, scope: document.body, pageview: true }` | [Browser source configuration](https://www.
|
|
100
|
-
| `dataLayer` | `object \| boolean` | `false` | [DataLayer source configuration](https://www.
|
|
101
|
-
| `collector` | `object` | `{}` | [Collector configuration](https://www.
|
|
94
|
+
| Name | Type | Default | Description |
|
|
95
|
+
| :---------- | :------------------ | :------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| `elb` | `string` | `"elb"` | Global function name for event tracking |
|
|
97
|
+
| `name` | `string` | `"walkerjs"` | Global instance name |
|
|
98
|
+
| `run` | `boolean` | `true` | Auto-initialize walker.js on load |
|
|
99
|
+
| `browser` | `object \| boolean` | `{ run: true, session: true, scope: document.body, pageview: true }` | [Browser source configuration](https://www.walkeros.io/docs/sources/web/browser/) |
|
|
100
|
+
| `dataLayer` | `object \| boolean` | `false` | [DataLayer source configuration](https://www.walkeros.io/docs/sources/web/dataLayer) |
|
|
101
|
+
| `collector` | `object` | `{}` | [Collector configuration](https://www.walkeros.io/docs/collector/) including destinations and consent settings |
|
|
102
102
|
|
|
103
103
|
#### Browser Source Settings
|
|
104
104
|
|
|
@@ -119,10 +119,10 @@ Walker.js supports multiple configuration approaches with different priorities:
|
|
|
119
119
|
|
|
120
120
|
#### Collector Settings
|
|
121
121
|
|
|
122
|
-
| Name | Type | Default | Description
|
|
123
|
-
| :----------------------- | :------- | :--------------------- |
|
|
124
|
-
| `collector.consent` | `object` | `{ functional: true }` | Default consent state
|
|
125
|
-
| `collector.destinations` | `object` | `{}` | [Destination configurations](https://www.
|
|
122
|
+
| Name | Type | Default | Description |
|
|
123
|
+
| :----------------------- | :------- | :--------------------- | :---------------------------------------------------------------------- |
|
|
124
|
+
| `collector.consent` | `object` | `{ functional: true }` | Default consent state |
|
|
125
|
+
| `collector.destinations` | `object` | `{}` | [Destination configurations](https://www.walkeros.io/docs/destinations) |
|
|
126
126
|
|
|
127
127
|
### Full Configuration Object
|
|
128
128
|
|
|
@@ -212,7 +212,7 @@ Walker.js automatically tracks events based on HTML data attributes:
|
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
For detailed information on data attributes, see the
|
|
215
|
-
[Browser Source documentation](https://www.
|
|
215
|
+
[Browser Source documentation](https://www.walkeros.io/docs/sources/web/browser/tagging).
|
|
216
216
|
|
|
217
217
|
### Manual Event Tracking
|
|
218
218
|
|
|
@@ -324,7 +324,7 @@ window.elbConfig = {
|
|
|
324
324
|
```
|
|
325
325
|
|
|
326
326
|
For comprehensive destination options, see the
|
|
327
|
-
[Destinations documentation](https://www.
|
|
327
|
+
[Destinations documentation](https://www.walkeros.io/docs/destinations/).
|
|
328
328
|
|
|
329
329
|
## Troubleshooting
|
|
330
330
|
|
|
@@ -391,13 +391,13 @@ npm run preview # Serve examples on localhost:3333
|
|
|
391
391
|
|
|
392
392
|
## Related Documentation
|
|
393
393
|
|
|
394
|
-
- **[Browser Source](https://www.
|
|
394
|
+
- **[Browser Source](https://www.walkeros.io/docs/sources/web/browser/)** -
|
|
395
395
|
Detailed DOM tracking capabilities
|
|
396
|
-
- **[Collector](https://www.
|
|
396
|
+
- **[Collector](https://www.walkeros.io/docs/collector/)** - Event processing
|
|
397
397
|
and routing
|
|
398
|
-
- **[Destinations](https://www.
|
|
398
|
+
- **[Destinations](https://www.walkeros.io/docs/destinations/)** - Available
|
|
399
399
|
destination options
|
|
400
|
-
- **[DataLayer Source](https://www.
|
|
400
|
+
- **[DataLayer Source](https://www.walkeros.io/docs/sources/web/dataLayer/)** -
|
|
401
401
|
DataLayer integration details
|
|
402
402
|
|
|
403
403
|
Walker.js combines all these components into a single, easy-to-use package
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa,0BAAY,CAAC;AAyLhC,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Browser environment setup for walker.js tests
|
|
2
|
+
// Based on @walkeros/jest/web.setup.ts
|
|
3
|
+
const mockDataLayer = jest.fn();
|
|
4
|
+
global.beforeEach(() => {
|
|
5
|
+
jest.useFakeTimers();
|
|
6
|
+
// Mocks
|
|
7
|
+
jest.clearAllMocks();
|
|
8
|
+
jest.resetModules();
|
|
9
|
+
// Reset DOM with event listeners etc.
|
|
10
|
+
document.getElementsByTagName('html')[0].innerHTML = '';
|
|
11
|
+
document.body = document.body.cloneNode();
|
|
12
|
+
// elbLayer and dataLayer
|
|
13
|
+
const w = window;
|
|
14
|
+
w.elbLayer = undefined;
|
|
15
|
+
w.dataLayer = [];
|
|
16
|
+
w.dataLayer.push = mockDataLayer;
|
|
17
|
+
// Performance API - mock the method that was causing test failures
|
|
18
|
+
global.performance.getEntriesByType = jest
|
|
19
|
+
.fn()
|
|
20
|
+
.mockReturnValue([{ type: 'navigate' }]);
|
|
21
|
+
// Mock IntersectionObserver - required for sourceBrowser visibility tracking
|
|
22
|
+
global.IntersectionObserver = jest.fn().mockImplementation((callback) => ({
|
|
23
|
+
observe: jest.fn(),
|
|
24
|
+
unobserve: jest.fn(),
|
|
25
|
+
disconnect: jest.fn(),
|
|
26
|
+
}));
|
|
27
|
+
// Mock ResizeObserver - might be needed for responsive tracking
|
|
28
|
+
global.ResizeObserver = jest.fn().mockImplementation((callback) => ({
|
|
29
|
+
observe: jest.fn(),
|
|
30
|
+
unobserve: jest.fn(),
|
|
31
|
+
disconnect: jest.fn(),
|
|
32
|
+
}));
|
|
33
|
+
// Mock MutationObserver - needed for DOM change detection
|
|
34
|
+
global.MutationObserver = jest.fn().mockImplementation((callback) => ({
|
|
35
|
+
observe: jest.fn(),
|
|
36
|
+
disconnect: jest.fn(),
|
|
37
|
+
takeRecords: jest.fn(),
|
|
38
|
+
}));
|
|
39
|
+
// Other browser APIs that might be needed
|
|
40
|
+
Object.defineProperty(window, 'location', {
|
|
41
|
+
value: {
|
|
42
|
+
hostname: 'localhost',
|
|
43
|
+
pathname: '/',
|
|
44
|
+
search: '',
|
|
45
|
+
hash: '',
|
|
46
|
+
href: 'http://localhost:3000/',
|
|
47
|
+
origin: 'http://localhost:3000',
|
|
48
|
+
protocol: 'http:',
|
|
49
|
+
host: 'localhost:3000',
|
|
50
|
+
port: '3000',
|
|
51
|
+
},
|
|
52
|
+
writable: true,
|
|
53
|
+
});
|
|
54
|
+
// Mock document.currentScript for auto-init tests
|
|
55
|
+
Object.defineProperty(document, 'currentScript', {
|
|
56
|
+
value: null,
|
|
57
|
+
writable: true,
|
|
58
|
+
});
|
|
59
|
+
// Mock document properties
|
|
60
|
+
Object.defineProperty(document, 'title', {
|
|
61
|
+
value: 'Test Page',
|
|
62
|
+
writable: true,
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(document, 'referrer', {
|
|
65
|
+
value: '',
|
|
66
|
+
writable: true,
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(document, 'readyState', {
|
|
69
|
+
value: 'complete',
|
|
70
|
+
writable: true,
|
|
71
|
+
});
|
|
72
|
+
// Mock navigator
|
|
73
|
+
Object.defineProperty(window, 'navigator', {
|
|
74
|
+
value: {
|
|
75
|
+
userAgent: 'Mozilla/5.0 (Node.js jsdom test environment)',
|
|
76
|
+
language: 'en-US',
|
|
77
|
+
platform: 'linux',
|
|
78
|
+
},
|
|
79
|
+
writable: true,
|
|
80
|
+
});
|
|
81
|
+
// Mock screen
|
|
82
|
+
Object.defineProperty(window, 'screen', {
|
|
83
|
+
value: {
|
|
84
|
+
width: 1920,
|
|
85
|
+
height: 1080,
|
|
86
|
+
},
|
|
87
|
+
writable: true,
|
|
88
|
+
});
|
|
89
|
+
// Mock element positioning methods - required for visibility detection
|
|
90
|
+
Element.prototype.getBoundingClientRect = jest.fn(() => ({
|
|
91
|
+
x: 0,
|
|
92
|
+
y: 0,
|
|
93
|
+
width: 100,
|
|
94
|
+
height: 100,
|
|
95
|
+
top: 0,
|
|
96
|
+
left: 0,
|
|
97
|
+
bottom: 100,
|
|
98
|
+
right: 100,
|
|
99
|
+
toJSON: jest.fn(),
|
|
100
|
+
}));
|
|
101
|
+
// Mock element offset properties
|
|
102
|
+
Object.defineProperties(Element.prototype, {
|
|
103
|
+
offsetTop: { get: () => 0, configurable: true },
|
|
104
|
+
offsetLeft: { get: () => 0, configurable: true },
|
|
105
|
+
offsetWidth: { get: () => 100, configurable: true },
|
|
106
|
+
offsetHeight: { get: () => 100, configurable: true },
|
|
107
|
+
clientWidth: { get: () => 100, configurable: true },
|
|
108
|
+
clientHeight: { get: () => 100, configurable: true },
|
|
109
|
+
});
|
|
110
|
+
// Mock getComputedStyle - required for element styling calculations
|
|
111
|
+
global.getComputedStyle = jest.fn().mockImplementation(() => ({
|
|
112
|
+
getPropertyValue: jest.fn().mockReturnValue(''),
|
|
113
|
+
width: '100px',
|
|
114
|
+
height: '100px',
|
|
115
|
+
display: 'block',
|
|
116
|
+
visibility: 'visible',
|
|
117
|
+
}));
|
|
118
|
+
// Mock matchMedia - might be needed for responsive features
|
|
119
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
120
|
+
writable: true,
|
|
121
|
+
value: jest.fn().mockImplementation((query) => ({
|
|
122
|
+
matches: false,
|
|
123
|
+
media: query,
|
|
124
|
+
onchange: null,
|
|
125
|
+
addListener: jest.fn(),
|
|
126
|
+
removeListener: jest.fn(),
|
|
127
|
+
addEventListener: jest.fn(),
|
|
128
|
+
removeEventListener: jest.fn(),
|
|
129
|
+
dispatchEvent: jest.fn(),
|
|
130
|
+
})),
|
|
131
|
+
});
|
|
132
|
+
// Mock localStorage and sessionStorage - required for browser source
|
|
133
|
+
const mockStorage = {
|
|
134
|
+
getItem: jest.fn(),
|
|
135
|
+
setItem: jest.fn(),
|
|
136
|
+
removeItem: jest.fn(),
|
|
137
|
+
clear: jest.fn(),
|
|
138
|
+
key: jest.fn(),
|
|
139
|
+
length: 0,
|
|
140
|
+
};
|
|
141
|
+
Object.defineProperty(window, 'localStorage', {
|
|
142
|
+
value: mockStorage,
|
|
143
|
+
writable: true,
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(window, 'sessionStorage', {
|
|
146
|
+
value: mockStorage,
|
|
147
|
+
writable: true,
|
|
148
|
+
});
|
|
149
|
+
// Mock requestAnimationFrame and cancelAnimationFrame
|
|
150
|
+
global.requestAnimationFrame = jest.fn((cb) => setTimeout(cb, 0));
|
|
151
|
+
global.cancelAnimationFrame = jest.fn((id) => clearTimeout(id));
|
|
152
|
+
// Mock requestIdleCallback if it exists
|
|
153
|
+
if (typeof global.requestIdleCallback === 'undefined') {
|
|
154
|
+
global.requestIdleCallback = jest.fn((cb) => setTimeout(cb, 0));
|
|
155
|
+
global.cancelIdleCallback = jest.fn((id) => clearTimeout(id));
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
global.afterEach(() => {
|
|
159
|
+
jest.runOnlyPendingTimers();
|
|
160
|
+
jest.useRealTimers();
|
|
161
|
+
});
|
|
162
|
+
export { mockDataLayer };
|
|
163
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA,gDAAgD;A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,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,wBAAgB,oBAAoB,IAAI,WAAW,CAAC,QAAQ,CA6B3D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isObject } from '@walkeros/core';
|
|
2
|
+
export function dataLayerDestination() {
|
|
3
|
+
window.dataLayer = window.dataLayer || [];
|
|
4
|
+
const dataLayerPush = (event) => {
|
|
5
|
+
// Do not process events from dataLayer source
|
|
6
|
+
if (isObject(event) &&
|
|
7
|
+
isObject(event.source) &&
|
|
8
|
+
String(event.source.type).includes('dataLayer'))
|
|
9
|
+
return;
|
|
10
|
+
window.dataLayer.push(event);
|
|
11
|
+
};
|
|
12
|
+
const destination = {
|
|
13
|
+
type: 'dataLayer',
|
|
14
|
+
config: {},
|
|
15
|
+
push: (event, context) => {
|
|
16
|
+
dataLayerPush(context.data || event);
|
|
17
|
+
},
|
|
18
|
+
pushBatch: (batch) => {
|
|
19
|
+
dataLayerPush({
|
|
20
|
+
name: 'batch',
|
|
21
|
+
batched_event: batch.key,
|
|
22
|
+
events: batch.data.length ? batch.data : batch.events,
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return destination;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=destination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,EAAE;QACvC,8CAA8C;QAC9C,IACE,QAAQ,CAAC,KAAK,CAAC;YACf,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;YAE/C,OAAO;QAER,MAAM,CAAC,SAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC;IACF,MAAM,WAAW,GAAyB;QACxC,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACvB,aAAa,CAAC,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,aAAa,CAAC;gBACZ,IAAI,EAAE,OAAO;gBACb,aAAa,EAAE,KAAK,CAAC,GAAG;gBACxB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM;aACtD,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
package/dist/dev.js
ADDED
package/dist/dev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"2BAAyB,WAAW;sBAAxB,OAAO;AAEnB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIhD,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAGpC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAG/C,wBAAsB,cAAc,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4D3E;AAGD,eAAe,cAAc,CAAC"}
|