@walkeros/web-source-cmp-usercentrics 0.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/README.md +142 -0
- package/dist/dev.d.mts +121 -0
- package/dist/dev.d.ts +121 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/examples/index.d.mts +103 -0
- package/dist/examples/index.d.ts +103 -0
- package/dist/examples/index.js +178 -0
- package/dist/examples/index.mjs +138 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +206 -0
- package/dist/index.d.ts +206 -0
- package/dist/index.es5.js +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# @walkeros/web-source-cmp-usercentrics
|
|
2
|
+
|
|
3
|
+
Usercentrics consent management source for walkerOS.
|
|
4
|
+
|
|
5
|
+
This source listens to [Usercentrics](https://usercentrics.com/) CMP events and
|
|
6
|
+
translates consent states to walkerOS consent commands.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @walkeros/web-source-cmp-usercentrics
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { startFlow } from '@walkeros/collector';
|
|
18
|
+
import { sourceUsercentrics } from '@walkeros/web-source-cmp-usercentrics';
|
|
19
|
+
// import { destinationGtag } from '@walkeros/web-destination-gtag';
|
|
20
|
+
|
|
21
|
+
await startFlow({
|
|
22
|
+
sources: {
|
|
23
|
+
consent: {
|
|
24
|
+
code: sourceUsercentrics,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
destinations: {
|
|
28
|
+
gtag: {
|
|
29
|
+
code: destinationGtag,
|
|
30
|
+
config: {
|
|
31
|
+
consent: { marketing: true }, // Requires marketing consent
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
### Settings
|
|
41
|
+
|
|
42
|
+
| Setting | Type | Default | Description |
|
|
43
|
+
| -------------- | ------------------------ | ----------- | ------------------------------------------------------- |
|
|
44
|
+
| `eventName` | `string` | `'ucEvent'` | Window event name configured in Usercentrics admin |
|
|
45
|
+
| `categoryMap` | `Record<string, string>` | `{}` | Maps Usercentrics categories to walkerOS consent groups |
|
|
46
|
+
| `explicitOnly` | `boolean` | `true` | Only process explicit consent (user made a choice) |
|
|
47
|
+
|
|
48
|
+
### Usercentrics setup
|
|
49
|
+
|
|
50
|
+
Configure a **Window Event** in your Usercentrics admin: Implementation > Data
|
|
51
|
+
Layer & Events > Window Event Name (e.g., `ucEvent`).
|
|
52
|
+
|
|
53
|
+
Alternatively, set `eventName: 'UC_SDK_EVENT'` to use the built-in Browser SDK
|
|
54
|
+
event (no admin configuration required).
|
|
55
|
+
|
|
56
|
+
### Custom mapping example
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
await startFlow({
|
|
60
|
+
sources: {
|
|
61
|
+
consent: {
|
|
62
|
+
code: sourceUsercentrics,
|
|
63
|
+
config: {
|
|
64
|
+
settings: {
|
|
65
|
+
eventName: 'ucEvent',
|
|
66
|
+
categoryMap: {
|
|
67
|
+
essential: 'functional',
|
|
68
|
+
functional: 'functional',
|
|
69
|
+
marketing: 'marketing',
|
|
70
|
+
},
|
|
71
|
+
explicitOnly: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## How it works
|
|
80
|
+
|
|
81
|
+
1. **Event listener**: Registers a listener for the configured window event
|
|
82
|
+
(default: `ucEvent`).
|
|
83
|
+
|
|
84
|
+
2. **Group vs. service detection**: When the event fires, checks if `ucCategory`
|
|
85
|
+
values are all booleans:
|
|
86
|
+
- **Group-level**: Uses `ucCategory` as consent state (maps categories via
|
|
87
|
+
`categoryMap`)
|
|
88
|
+
- **Service-level**: Extracts individual service booleans from `event.detail`
|
|
89
|
+
(normalized to `lowercase_underscores`) and applies `categoryMap` to
|
|
90
|
+
boolean `ucCategory` entries
|
|
91
|
+
|
|
92
|
+
3. **Explicit filtering**: By default, only processes events where
|
|
93
|
+
`type === 'explicit'` (user actively made a choice). Set
|
|
94
|
+
`explicitOnly: false` to also process implicit/default consent.
|
|
95
|
+
|
|
96
|
+
4. **Consent command**: Calls `elb('walker consent', state)` with the mapped
|
|
97
|
+
consent state.
|
|
98
|
+
|
|
99
|
+
### Timing considerations
|
|
100
|
+
|
|
101
|
+
The source should be initialized before the Usercentrics script loads to avoid
|
|
102
|
+
missing the initial consent event. When using `explicitOnly: true` (default),
|
|
103
|
+
this is not a concern since the implicit init event is filtered anyway. For
|
|
104
|
+
`explicitOnly: false`, ensure the consent source has no `require` constraints so
|
|
105
|
+
it initializes immediately.
|
|
106
|
+
|
|
107
|
+
## Usercentrics event reference
|
|
108
|
+
|
|
109
|
+
The source listens for `CustomEvent` with this `detail` structure:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
{
|
|
113
|
+
event: 'consent_status',
|
|
114
|
+
type: 'explicit' | 'implicit',
|
|
115
|
+
action: 'onAcceptAllServices' | 'onDenyAllServices' | 'onUpdateServices',
|
|
116
|
+
ucCategory: { marketing: true, functional: false, ... },
|
|
117
|
+
'Google Analytics': true,
|
|
118
|
+
'Facebook Pixel': false,
|
|
119
|
+
...
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
- [Usercentrics Custom Events Documentation](https://support.usercentrics.com/hc/en-us/articles/17104002464668-How-can-I-create-a-custom-event)
|
|
124
|
+
|
|
125
|
+
## walkerOS.json
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{ "walkerOS": { "type": "source", "platform": "web" } }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Type definitions
|
|
132
|
+
|
|
133
|
+
See [src/types/index.ts](./src/types/index.ts) for TypeScript interfaces.
|
|
134
|
+
|
|
135
|
+
## Related
|
|
136
|
+
|
|
137
|
+
- [Consent management guide](https://www.walkeros.io/docs/guides/consent)
|
|
138
|
+
- [Usercentrics Documentation](https://www.walkeros.io/docs/sources/web/cmps/usercentrics)
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
MIT
|
package/dist/dev.d.mts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Usercentrics consent event detail structure.
|
|
5
|
+
*
|
|
6
|
+
* Fired as event.detail on the configured window event (e.g. 'ucEvent').
|
|
7
|
+
* Contains both category-level (ucCategory) and service-level consent.
|
|
8
|
+
*/
|
|
9
|
+
interface UsercentricsEventDetail {
|
|
10
|
+
/** Always 'consent_status' for consent events */
|
|
11
|
+
event: string;
|
|
12
|
+
/** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
|
|
15
|
+
action?: string;
|
|
16
|
+
/** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
|
|
17
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
18
|
+
/** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
|
|
19
|
+
[service: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface WindowEventMap {
|
|
23
|
+
ucEvent: CustomEvent<UsercentricsEventDetail>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Example Usercentrics consent event detail inputs.
|
|
29
|
+
*
|
|
30
|
+
* These represent real event.detail payloads from Usercentrics CMP.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Full consent - user accepted all categories (explicit)
|
|
34
|
+
*/
|
|
35
|
+
declare const fullConsent: UsercentricsEventDetail;
|
|
36
|
+
/**
|
|
37
|
+
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
|
+
*/
|
|
39
|
+
declare const partialConsent: UsercentricsEventDetail;
|
|
40
|
+
/**
|
|
41
|
+
* Minimal consent - user denied everything except essential (explicit)
|
|
42
|
+
*/
|
|
43
|
+
declare const minimalConsent: UsercentricsEventDetail;
|
|
44
|
+
/**
|
|
45
|
+
* Implicit consent - page load with default consent state
|
|
46
|
+
* (not an explicit user choice)
|
|
47
|
+
*/
|
|
48
|
+
declare const implicitConsent: UsercentricsEventDetail;
|
|
49
|
+
/**
|
|
50
|
+
* Explicit consent with uppercase type field (Usercentrics docs are
|
|
51
|
+
* inconsistent about casing - some show 'EXPLICIT', others 'explicit')
|
|
52
|
+
*/
|
|
53
|
+
declare const fullConsentUpperCase: UsercentricsEventDetail;
|
|
54
|
+
/**
|
|
55
|
+
* Service-level consent - ucCategory has mixed types (non-boolean values
|
|
56
|
+
* indicate individual service-level choice rather than group-level)
|
|
57
|
+
*/
|
|
58
|
+
declare const serviceLevelConsent: UsercentricsEventDetail;
|
|
59
|
+
/**
|
|
60
|
+
* Non-consent event (should be ignored)
|
|
61
|
+
*/
|
|
62
|
+
declare const nonConsentEvent: UsercentricsEventDetail;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Expected walkerOS consent outputs.
|
|
66
|
+
*
|
|
67
|
+
* These represent the consent state after parsing Usercentrics event details
|
|
68
|
+
* with no category mapping configured (pass-through).
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Full consent - all categories true (group-level)
|
|
72
|
+
*/
|
|
73
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
74
|
+
/**
|
|
75
|
+
* Partial consent - essential and functional true, marketing false
|
|
76
|
+
*/
|
|
77
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
78
|
+
/**
|
|
79
|
+
* Minimal consent - only essential true
|
|
80
|
+
*/
|
|
81
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
82
|
+
/**
|
|
83
|
+
* Full consent with custom category mapping applied
|
|
84
|
+
* (essential->functional, functional->functional, marketing->marketing)
|
|
85
|
+
*/
|
|
86
|
+
declare const fullConsentCustomMapped: WalkerOS.Consent;
|
|
87
|
+
/**
|
|
88
|
+
* Service-level consent - individual service booleans + boolean ucCategory entries
|
|
89
|
+
* (services normalized: lowercase, spaces to underscores)
|
|
90
|
+
* (ucCategory boolean entries mapped through categoryMap)
|
|
91
|
+
*/
|
|
92
|
+
declare const serviceLevelMapped: WalkerOS.Consent;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Create a properly typed elb/push function mock
|
|
96
|
+
*/
|
|
97
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
98
|
+
/**
|
|
99
|
+
* Simple no-op logger for demo purposes
|
|
100
|
+
*/
|
|
101
|
+
declare const noopLogger: Logger.Instance;
|
|
102
|
+
|
|
103
|
+
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
104
|
+
declare const index_fullConsent: typeof fullConsent;
|
|
105
|
+
declare const index_fullConsentCustomMapped: typeof fullConsentCustomMapped;
|
|
106
|
+
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
107
|
+
declare const index_fullConsentUpperCase: typeof fullConsentUpperCase;
|
|
108
|
+
declare const index_implicitConsent: typeof implicitConsent;
|
|
109
|
+
declare const index_minimalConsent: typeof minimalConsent;
|
|
110
|
+
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
111
|
+
declare const index_nonConsentEvent: typeof nonConsentEvent;
|
|
112
|
+
declare const index_noopLogger: typeof noopLogger;
|
|
113
|
+
declare const index_partialConsent: typeof partialConsent;
|
|
114
|
+
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
115
|
+
declare const index_serviceLevelConsent: typeof serviceLevelConsent;
|
|
116
|
+
declare const index_serviceLevelMapped: typeof serviceLevelMapped;
|
|
117
|
+
declare namespace index {
|
|
118
|
+
export { index_createMockElbFn as createMockElbFn, index_fullConsent as fullConsent, index_fullConsentCustomMapped as fullConsentCustomMapped, index_fullConsentMapped as fullConsentMapped, index_fullConsentUpperCase as fullConsentUpperCase, index_implicitConsent as implicitConsent, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_nonConsentEvent as nonConsentEvent, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped, index_serviceLevelConsent as serviceLevelConsent, index_serviceLevelMapped as serviceLevelMapped };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { index as examples };
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Usercentrics consent event detail structure.
|
|
5
|
+
*
|
|
6
|
+
* Fired as event.detail on the configured window event (e.g. 'ucEvent').
|
|
7
|
+
* Contains both category-level (ucCategory) and service-level consent.
|
|
8
|
+
*/
|
|
9
|
+
interface UsercentricsEventDetail {
|
|
10
|
+
/** Always 'consent_status' for consent events */
|
|
11
|
+
event: string;
|
|
12
|
+
/** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
|
|
15
|
+
action?: string;
|
|
16
|
+
/** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
|
|
17
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
18
|
+
/** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
|
|
19
|
+
[service: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface WindowEventMap {
|
|
23
|
+
ucEvent: CustomEvent<UsercentricsEventDetail>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Example Usercentrics consent event detail inputs.
|
|
29
|
+
*
|
|
30
|
+
* These represent real event.detail payloads from Usercentrics CMP.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Full consent - user accepted all categories (explicit)
|
|
34
|
+
*/
|
|
35
|
+
declare const fullConsent: UsercentricsEventDetail;
|
|
36
|
+
/**
|
|
37
|
+
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
|
+
*/
|
|
39
|
+
declare const partialConsent: UsercentricsEventDetail;
|
|
40
|
+
/**
|
|
41
|
+
* Minimal consent - user denied everything except essential (explicit)
|
|
42
|
+
*/
|
|
43
|
+
declare const minimalConsent: UsercentricsEventDetail;
|
|
44
|
+
/**
|
|
45
|
+
* Implicit consent - page load with default consent state
|
|
46
|
+
* (not an explicit user choice)
|
|
47
|
+
*/
|
|
48
|
+
declare const implicitConsent: UsercentricsEventDetail;
|
|
49
|
+
/**
|
|
50
|
+
* Explicit consent with uppercase type field (Usercentrics docs are
|
|
51
|
+
* inconsistent about casing - some show 'EXPLICIT', others 'explicit')
|
|
52
|
+
*/
|
|
53
|
+
declare const fullConsentUpperCase: UsercentricsEventDetail;
|
|
54
|
+
/**
|
|
55
|
+
* Service-level consent - ucCategory has mixed types (non-boolean values
|
|
56
|
+
* indicate individual service-level choice rather than group-level)
|
|
57
|
+
*/
|
|
58
|
+
declare const serviceLevelConsent: UsercentricsEventDetail;
|
|
59
|
+
/**
|
|
60
|
+
* Non-consent event (should be ignored)
|
|
61
|
+
*/
|
|
62
|
+
declare const nonConsentEvent: UsercentricsEventDetail;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Expected walkerOS consent outputs.
|
|
66
|
+
*
|
|
67
|
+
* These represent the consent state after parsing Usercentrics event details
|
|
68
|
+
* with no category mapping configured (pass-through).
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Full consent - all categories true (group-level)
|
|
72
|
+
*/
|
|
73
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
74
|
+
/**
|
|
75
|
+
* Partial consent - essential and functional true, marketing false
|
|
76
|
+
*/
|
|
77
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
78
|
+
/**
|
|
79
|
+
* Minimal consent - only essential true
|
|
80
|
+
*/
|
|
81
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
82
|
+
/**
|
|
83
|
+
* Full consent with custom category mapping applied
|
|
84
|
+
* (essential->functional, functional->functional, marketing->marketing)
|
|
85
|
+
*/
|
|
86
|
+
declare const fullConsentCustomMapped: WalkerOS.Consent;
|
|
87
|
+
/**
|
|
88
|
+
* Service-level consent - individual service booleans + boolean ucCategory entries
|
|
89
|
+
* (services normalized: lowercase, spaces to underscores)
|
|
90
|
+
* (ucCategory boolean entries mapped through categoryMap)
|
|
91
|
+
*/
|
|
92
|
+
declare const serviceLevelMapped: WalkerOS.Consent;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Create a properly typed elb/push function mock
|
|
96
|
+
*/
|
|
97
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
98
|
+
/**
|
|
99
|
+
* Simple no-op logger for demo purposes
|
|
100
|
+
*/
|
|
101
|
+
declare const noopLogger: Logger.Instance;
|
|
102
|
+
|
|
103
|
+
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
104
|
+
declare const index_fullConsent: typeof fullConsent;
|
|
105
|
+
declare const index_fullConsentCustomMapped: typeof fullConsentCustomMapped;
|
|
106
|
+
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
107
|
+
declare const index_fullConsentUpperCase: typeof fullConsentUpperCase;
|
|
108
|
+
declare const index_implicitConsent: typeof implicitConsent;
|
|
109
|
+
declare const index_minimalConsent: typeof minimalConsent;
|
|
110
|
+
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
111
|
+
declare const index_nonConsentEvent: typeof nonConsentEvent;
|
|
112
|
+
declare const index_noopLogger: typeof noopLogger;
|
|
113
|
+
declare const index_partialConsent: typeof partialConsent;
|
|
114
|
+
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
115
|
+
declare const index_serviceLevelConsent: typeof serviceLevelConsent;
|
|
116
|
+
declare const index_serviceLevelMapped: typeof serviceLevelMapped;
|
|
117
|
+
declare namespace index {
|
|
118
|
+
export { index_createMockElbFn as createMockElbFn, index_fullConsent as fullConsent, index_fullConsentCustomMapped as fullConsentCustomMapped, index_fullConsentMapped as fullConsentMapped, index_fullConsentUpperCase as fullConsentUpperCase, index_implicitConsent as implicitConsent, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_nonConsentEvent as nonConsentEvent, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped, index_serviceLevelConsent as serviceLevelConsent, index_serviceLevelMapped as serviceLevelMapped };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { index as examples };
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},s={};i(s,{examples:()=>l}),module.exports=(e=s,((e,i,s,l)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let r of o(i))a.call(e,r)||r===s||t(e,r,{get:()=>i[r],enumerable:!(l=n(i,r))||l.enumerable});return e})(t({},"__esModule",{value:!0}),e));var l={};i(l,{createMockElbFn:()=>_,fullConsent:()=>r,fullConsentCustomMapped:()=>k,fullConsentMapped:()=>f,fullConsentUpperCase:()=>u,implicitConsent:()=>g,minimalConsent:()=>p,minimalConsentMapped:()=>C,nonConsentEvent:()=>y,noopLogger:()=>b,partialConsent:()=>c,partialConsentMapped:()=>v,serviceLevelConsent:()=>m,serviceLevelMapped:()=>d});var r={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},c={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},p={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},g={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},u={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},m={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},y={event:"other_event",type:"explicit"},f={essential:!0,functional:!0,marketing:!0},v={essential:!0,functional:!0,marketing:!1},C={essential:!0,functional:!1,marketing:!1},k={functional:!0,marketing:!0},d={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},A=()=>{},_=()=>()=>Promise.resolve({ok:!0}),b={error:A,info:A,debug:A,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>b};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\n","export * from './inputs';\nexport * from './outputs';\nexport * from './env';\n","import type { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: true,\n};\n","import type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment configurations for Usercentrics source testing.\n */\n\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,kBAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,uBAAgD;AAAA,EAC3D,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAMO,IAAM,sBAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAAA,EAC1B,QAAQ;AACV;AAKO,IAAM,kBAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AACR;;;ACnGO,IAAM,oBAAsC;AAAA,EACjD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AACb;AAMO,IAAM,0BAA4C;AAAA,EACvD,YAAY;AAAA,EACZ,WAAW;AACb;AAOO,IAAM,qBAAuC;AAAA,EAClD,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,wBAAwB;AAAA,EACxB,QAAQ;AACV;;;ACjDA,IAAM,OAAO,MAAM;AAAC;AAKb,IAAM,kBAAkB,MAAc;AAC3C,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SAAO;AACT;AAKO,IAAM,aAA8B;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,YAA4B;AAClC,UAAM,OAAO,YAAY,WAAW,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3D;AAAA,EACA,OAAO,MAAM;AACf;","names":[]}
|
package/dist/dev.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(t,{createMockElbFn:()=>y,fullConsent:()=>n,fullConsentCustomMapped:()=>u,fullConsentMapped:()=>c,fullConsentUpperCase:()=>s,implicitConsent:()=>i,minimalConsent:()=>a,minimalConsentMapped:()=>p,nonConsentEvent:()=>r,noopLogger:()=>C,partialConsent:()=>o,partialConsentMapped:()=>g,serviceLevelConsent:()=>l,serviceLevelMapped:()=>m});var n={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},o={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},a={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},i={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},s={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},l={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},r={event:"other_event",type:"explicit"},c={essential:!0,functional:!0,marketing:!0},g={essential:!0,functional:!0,marketing:!1},p={essential:!0,functional:!1,marketing:!1},u={functional:!0,marketing:!0},m={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},v=()=>{},y=()=>()=>Promise.resolve({ok:!0}),C={error:v,info:v,debug:v,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>C};export{t as examples};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\n","import type { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: true,\n};\n","import type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment configurations for Usercentrics source testing.\n */\n\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,kBAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,uBAAgD;AAAA,EAC3D,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAMO,IAAM,sBAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAAA,EAC1B,QAAQ;AACV;AAKO,IAAM,kBAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AACR;;;ACnGO,IAAM,oBAAsC;AAAA,EACjD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AACb;AAMO,IAAM,0BAA4C;AAAA,EACvD,YAAY;AAAA,EACZ,WAAW;AACb;AAOO,IAAM,qBAAuC;AAAA,EAClD,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,wBAAwB;AAAA,EACxB,QAAQ;AACV;;;ACjDA,IAAM,OAAO,MAAM;AAAC;AAKb,IAAM,kBAAkB,MAAc;AAC3C,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SAAO;AACT;AAKO,IAAM,aAA8B;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,YAA4B;AAClC,UAAM,OAAO,YAAY,WAAW,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3D;AAAA,EACA,OAAO,MAAM;AACf;","names":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Usercentrics consent event detail structure.
|
|
5
|
+
*
|
|
6
|
+
* Fired as event.detail on the configured window event (e.g. 'ucEvent').
|
|
7
|
+
* Contains both category-level (ucCategory) and service-level consent.
|
|
8
|
+
*/
|
|
9
|
+
interface UsercentricsEventDetail {
|
|
10
|
+
/** Always 'consent_status' for consent events */
|
|
11
|
+
event: string;
|
|
12
|
+
/** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
|
|
15
|
+
action?: string;
|
|
16
|
+
/** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
|
|
17
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
18
|
+
/** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
|
|
19
|
+
[service: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface WindowEventMap {
|
|
23
|
+
ucEvent: CustomEvent<UsercentricsEventDetail>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Example Usercentrics consent event detail inputs.
|
|
29
|
+
*
|
|
30
|
+
* These represent real event.detail payloads from Usercentrics CMP.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Full consent - user accepted all categories (explicit)
|
|
34
|
+
*/
|
|
35
|
+
declare const fullConsent: UsercentricsEventDetail;
|
|
36
|
+
/**
|
|
37
|
+
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
|
+
*/
|
|
39
|
+
declare const partialConsent: UsercentricsEventDetail;
|
|
40
|
+
/**
|
|
41
|
+
* Minimal consent - user denied everything except essential (explicit)
|
|
42
|
+
*/
|
|
43
|
+
declare const minimalConsent: UsercentricsEventDetail;
|
|
44
|
+
/**
|
|
45
|
+
* Implicit consent - page load with default consent state
|
|
46
|
+
* (not an explicit user choice)
|
|
47
|
+
*/
|
|
48
|
+
declare const implicitConsent: UsercentricsEventDetail;
|
|
49
|
+
/**
|
|
50
|
+
* Explicit consent with uppercase type field (Usercentrics docs are
|
|
51
|
+
* inconsistent about casing - some show 'EXPLICIT', others 'explicit')
|
|
52
|
+
*/
|
|
53
|
+
declare const fullConsentUpperCase: UsercentricsEventDetail;
|
|
54
|
+
/**
|
|
55
|
+
* Service-level consent - ucCategory has mixed types (non-boolean values
|
|
56
|
+
* indicate individual service-level choice rather than group-level)
|
|
57
|
+
*/
|
|
58
|
+
declare const serviceLevelConsent: UsercentricsEventDetail;
|
|
59
|
+
/**
|
|
60
|
+
* Non-consent event (should be ignored)
|
|
61
|
+
*/
|
|
62
|
+
declare const nonConsentEvent: UsercentricsEventDetail;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Expected walkerOS consent outputs.
|
|
66
|
+
*
|
|
67
|
+
* These represent the consent state after parsing Usercentrics event details
|
|
68
|
+
* with no category mapping configured (pass-through).
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Full consent - all categories true (group-level)
|
|
72
|
+
*/
|
|
73
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
74
|
+
/**
|
|
75
|
+
* Partial consent - essential and functional true, marketing false
|
|
76
|
+
*/
|
|
77
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
78
|
+
/**
|
|
79
|
+
* Minimal consent - only essential true
|
|
80
|
+
*/
|
|
81
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
82
|
+
/**
|
|
83
|
+
* Full consent with custom category mapping applied
|
|
84
|
+
* (essential->functional, functional->functional, marketing->marketing)
|
|
85
|
+
*/
|
|
86
|
+
declare const fullConsentCustomMapped: WalkerOS.Consent;
|
|
87
|
+
/**
|
|
88
|
+
* Service-level consent - individual service booleans + boolean ucCategory entries
|
|
89
|
+
* (services normalized: lowercase, spaces to underscores)
|
|
90
|
+
* (ucCategory boolean entries mapped through categoryMap)
|
|
91
|
+
*/
|
|
92
|
+
declare const serviceLevelMapped: WalkerOS.Consent;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Create a properly typed elb/push function mock
|
|
96
|
+
*/
|
|
97
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
98
|
+
/**
|
|
99
|
+
* Simple no-op logger for demo purposes
|
|
100
|
+
*/
|
|
101
|
+
declare const noopLogger: Logger.Instance;
|
|
102
|
+
|
|
103
|
+
export { createMockElbFn, fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Usercentrics consent event detail structure.
|
|
5
|
+
*
|
|
6
|
+
* Fired as event.detail on the configured window event (e.g. 'ucEvent').
|
|
7
|
+
* Contains both category-level (ucCategory) and service-level consent.
|
|
8
|
+
*/
|
|
9
|
+
interface UsercentricsEventDetail {
|
|
10
|
+
/** Always 'consent_status' for consent events */
|
|
11
|
+
event: string;
|
|
12
|
+
/** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
|
|
15
|
+
action?: string;
|
|
16
|
+
/** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
|
|
17
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
18
|
+
/** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
|
|
19
|
+
[service: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface WindowEventMap {
|
|
23
|
+
ucEvent: CustomEvent<UsercentricsEventDetail>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Example Usercentrics consent event detail inputs.
|
|
29
|
+
*
|
|
30
|
+
* These represent real event.detail payloads from Usercentrics CMP.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Full consent - user accepted all categories (explicit)
|
|
34
|
+
*/
|
|
35
|
+
declare const fullConsent: UsercentricsEventDetail;
|
|
36
|
+
/**
|
|
37
|
+
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
|
+
*/
|
|
39
|
+
declare const partialConsent: UsercentricsEventDetail;
|
|
40
|
+
/**
|
|
41
|
+
* Minimal consent - user denied everything except essential (explicit)
|
|
42
|
+
*/
|
|
43
|
+
declare const minimalConsent: UsercentricsEventDetail;
|
|
44
|
+
/**
|
|
45
|
+
* Implicit consent - page load with default consent state
|
|
46
|
+
* (not an explicit user choice)
|
|
47
|
+
*/
|
|
48
|
+
declare const implicitConsent: UsercentricsEventDetail;
|
|
49
|
+
/**
|
|
50
|
+
* Explicit consent with uppercase type field (Usercentrics docs are
|
|
51
|
+
* inconsistent about casing - some show 'EXPLICIT', others 'explicit')
|
|
52
|
+
*/
|
|
53
|
+
declare const fullConsentUpperCase: UsercentricsEventDetail;
|
|
54
|
+
/**
|
|
55
|
+
* Service-level consent - ucCategory has mixed types (non-boolean values
|
|
56
|
+
* indicate individual service-level choice rather than group-level)
|
|
57
|
+
*/
|
|
58
|
+
declare const serviceLevelConsent: UsercentricsEventDetail;
|
|
59
|
+
/**
|
|
60
|
+
* Non-consent event (should be ignored)
|
|
61
|
+
*/
|
|
62
|
+
declare const nonConsentEvent: UsercentricsEventDetail;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Expected walkerOS consent outputs.
|
|
66
|
+
*
|
|
67
|
+
* These represent the consent state after parsing Usercentrics event details
|
|
68
|
+
* with no category mapping configured (pass-through).
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Full consent - all categories true (group-level)
|
|
72
|
+
*/
|
|
73
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
74
|
+
/**
|
|
75
|
+
* Partial consent - essential and functional true, marketing false
|
|
76
|
+
*/
|
|
77
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
78
|
+
/**
|
|
79
|
+
* Minimal consent - only essential true
|
|
80
|
+
*/
|
|
81
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
82
|
+
/**
|
|
83
|
+
* Full consent with custom category mapping applied
|
|
84
|
+
* (essential->functional, functional->functional, marketing->marketing)
|
|
85
|
+
*/
|
|
86
|
+
declare const fullConsentCustomMapped: WalkerOS.Consent;
|
|
87
|
+
/**
|
|
88
|
+
* Service-level consent - individual service booleans + boolean ucCategory entries
|
|
89
|
+
* (services normalized: lowercase, spaces to underscores)
|
|
90
|
+
* (ucCategory boolean entries mapped through categoryMap)
|
|
91
|
+
*/
|
|
92
|
+
declare const serviceLevelMapped: WalkerOS.Consent;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Create a properly typed elb/push function mock
|
|
96
|
+
*/
|
|
97
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
98
|
+
/**
|
|
99
|
+
* Simple no-op logger for demo purposes
|
|
100
|
+
*/
|
|
101
|
+
declare const noopLogger: Logger.Instance;
|
|
102
|
+
|
|
103
|
+
export { createMockElbFn, fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped };
|