@walkeros/web-source-cmp-cookiefirst 1.1.0-next-1771252576264
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 +107 -0
- package/dist/dev.d.mts +149 -0
- package/dist/dev.d.ts +149 -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 +125 -0
- package/dist/examples/index.d.ts +125 -0
- package/dist/examples/index.js +161 -0
- package/dist/examples/index.mjs +119 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +234 -0
- package/dist/index.d.ts +234 -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 +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @walkeros/web-source-cmp-cookiefirst
|
|
2
|
+
|
|
3
|
+
CookieFirst consent management source for walkerOS.
|
|
4
|
+
|
|
5
|
+
This source listens to [CookieFirst](https://cookiefirst.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-cookiefirst
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { startFlow } from '@walkeros/collector';
|
|
18
|
+
import { sourceCookieFirst } from '@walkeros/web-source-cmp-cookiefirst';
|
|
19
|
+
|
|
20
|
+
await startFlow({
|
|
21
|
+
sources: {
|
|
22
|
+
consent: {
|
|
23
|
+
code: sourceCookieFirst,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
destinations: {
|
|
27
|
+
gtag: {
|
|
28
|
+
code: destinationGtag,
|
|
29
|
+
config: {
|
|
30
|
+
consent: { analytics: true }, // Requires analytics consent
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
### Settings
|
|
40
|
+
|
|
41
|
+
| Setting | Type | Default | Description |
|
|
42
|
+
| -------------- | ------------------------ | --------------- | ------------------------------------------------------ |
|
|
43
|
+
| `categoryMap` | `Record<string, string>` | See below | Maps CookieFirst categories to walkerOS consent groups |
|
|
44
|
+
| `explicitOnly` | `boolean` | `true` | Only process explicit consent (user made a choice) |
|
|
45
|
+
| `globalName` | `string` | `'CookieFirst'` | Custom name for `window.CookieFirst` object |
|
|
46
|
+
|
|
47
|
+
### Default Category Mapping
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
{
|
|
51
|
+
necessary: 'functional',
|
|
52
|
+
functional: 'functional',
|
|
53
|
+
performance: 'analytics',
|
|
54
|
+
advertising: 'marketing',
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
When multiple CookieFirst categories map to the same walkerOS group (e.g., both
|
|
59
|
+
`necessary` and `functional` → `functional`), the source uses OR logic: if ANY
|
|
60
|
+
source category is `true`, the target group is `true`.
|
|
61
|
+
|
|
62
|
+
### Custom Mapping Example
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
await startFlow({
|
|
66
|
+
sources: {
|
|
67
|
+
consent: {
|
|
68
|
+
code: sourceCookieFirst,
|
|
69
|
+
config: {
|
|
70
|
+
settings: {
|
|
71
|
+
categoryMap: {
|
|
72
|
+
performance: 'statistics', // Use 'statistics' instead of 'analytics'
|
|
73
|
+
},
|
|
74
|
+
explicitOnly: true,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## How It Works
|
|
83
|
+
|
|
84
|
+
1. **Initialization**: When the source loads, it checks if CookieFirst is
|
|
85
|
+
already initialized and processes any existing consent state.
|
|
86
|
+
|
|
87
|
+
2. **cf_init Event**: Listens for the `cf_init` event fired when CookieFirst
|
|
88
|
+
banner initializes.
|
|
89
|
+
|
|
90
|
+
3. **cf_consent Event**: Listens for the `cf_consent` event fired when user
|
|
91
|
+
changes their consent preferences.
|
|
92
|
+
|
|
93
|
+
4. **Consent Mapping**: Translates CookieFirst categories to walkerOS consent
|
|
94
|
+
groups and calls `elb('walker consent', state)`.
|
|
95
|
+
|
|
96
|
+
## CookieFirst API Reference
|
|
97
|
+
|
|
98
|
+
- [CookieFirst Public API Documentation](https://support.cookiefirst.com/hc/en-us/articles/360011568738-Cookie-Banner-Public-API-documentation)
|
|
99
|
+
|
|
100
|
+
## Related
|
|
101
|
+
|
|
102
|
+
- [Consent management guide](https://www.walkeros.io/docs/guides/consent)
|
|
103
|
+
- [CookieFirst documentation](https://www.walkeros.io/docs/sources/web/cmps/cookiefirst)
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
package/dist/dev.d.mts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { WalkerOS, Elb, Logger, Source } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CookieFirst consent object structure
|
|
5
|
+
*/
|
|
6
|
+
interface CookieFirstConsent {
|
|
7
|
+
necessary?: boolean;
|
|
8
|
+
functional?: boolean;
|
|
9
|
+
performance?: boolean;
|
|
10
|
+
advertising?: boolean;
|
|
11
|
+
[category: string]: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CookieFirst global API interface
|
|
15
|
+
*/
|
|
16
|
+
interface CookieFirstAPI {
|
|
17
|
+
consent: CookieFirstConsent | null;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
interface Window {
|
|
21
|
+
CookieFirst?: CookieFirstAPI;
|
|
22
|
+
[key: string]: CookieFirstAPI | unknown;
|
|
23
|
+
}
|
|
24
|
+
interface WindowEventMap {
|
|
25
|
+
cf_init: Event;
|
|
26
|
+
cf_consent: CustomEvent<CookieFirstConsent>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Example CookieFirst consent inputs.
|
|
32
|
+
*
|
|
33
|
+
* These represent real consent states from CookieFirst CMP.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Full consent - user accepted all categories
|
|
37
|
+
*/
|
|
38
|
+
declare const fullConsent: CookieFirstConsent;
|
|
39
|
+
/**
|
|
40
|
+
* Partial consent - user accepted only necessary and functional
|
|
41
|
+
*/
|
|
42
|
+
declare const partialConsent: CookieFirstConsent;
|
|
43
|
+
/**
|
|
44
|
+
* Minimal consent - user accepted only necessary (required)
|
|
45
|
+
*/
|
|
46
|
+
declare const minimalConsent: CookieFirstConsent;
|
|
47
|
+
/**
|
|
48
|
+
* No consent - user hasn't made a choice yet
|
|
49
|
+
* CookieFirst returns null when no explicit choice has been made
|
|
50
|
+
*/
|
|
51
|
+
declare const noConsent: CookieFirstConsent | null;
|
|
52
|
+
/**
|
|
53
|
+
* Analytics only - user accepted performance tracking
|
|
54
|
+
*/
|
|
55
|
+
declare const analyticsOnlyConsent: CookieFirstConsent;
|
|
56
|
+
/**
|
|
57
|
+
* Marketing only - user accepted advertising
|
|
58
|
+
*/
|
|
59
|
+
declare const marketingOnlyConsent: CookieFirstConsent;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Expected walkerOS consent outputs.
|
|
63
|
+
*
|
|
64
|
+
* These represent the consent state after mapping CookieFirst categories
|
|
65
|
+
* to walkerOS consent groups using the default category map.
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Full consent mapped to walkerOS groups
|
|
69
|
+
* (necessary + functional → functional, performance → analytics, advertising → marketing)
|
|
70
|
+
*/
|
|
71
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
72
|
+
/**
|
|
73
|
+
* Partial consent mapped to walkerOS groups
|
|
74
|
+
*/
|
|
75
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
76
|
+
/**
|
|
77
|
+
* Minimal consent mapped to walkerOS groups
|
|
78
|
+
*/
|
|
79
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
80
|
+
/**
|
|
81
|
+
* Analytics only consent mapped to walkerOS groups
|
|
82
|
+
* Note: functional is true because necessary=true maps to functional
|
|
83
|
+
* (OR logic: if ANY source category is true, target group is true)
|
|
84
|
+
*/
|
|
85
|
+
declare const analyticsOnlyMapped: WalkerOS.Consent;
|
|
86
|
+
/**
|
|
87
|
+
* Marketing only consent mapped to walkerOS groups
|
|
88
|
+
* Note: functional is true because necessary=true maps to functional
|
|
89
|
+
* (OR logic: if ANY source category is true, target group is true)
|
|
90
|
+
*/
|
|
91
|
+
declare const marketingOnlyMapped: WalkerOS.Consent;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Create a properly typed elb/push function mock that returns a promise with PushResult
|
|
95
|
+
*/
|
|
96
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
97
|
+
/**
|
|
98
|
+
* Simple no-op logger for demo purposes
|
|
99
|
+
*/
|
|
100
|
+
declare const noopLogger: Logger.Instance;
|
|
101
|
+
/**
|
|
102
|
+
* Environment interface for CookieFirst source
|
|
103
|
+
*/
|
|
104
|
+
interface CookieFirstEnv extends Source.BaseEnv {
|
|
105
|
+
window?: typeof window;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a mock CookieFirst API object
|
|
109
|
+
*/
|
|
110
|
+
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent | null) => CookieFirstAPI;
|
|
111
|
+
/**
|
|
112
|
+
* Create a mock window object with CookieFirst
|
|
113
|
+
*/
|
|
114
|
+
declare const createMockWindow: (consent?: CookieFirstConsent | null) => Partial<Window> & {
|
|
115
|
+
CookieFirst: CookieFirstAPI;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Standard mock environment for testing CookieFirst source
|
|
119
|
+
*
|
|
120
|
+
* Use this for testing consent handling without requiring
|
|
121
|
+
* a real browser environment.
|
|
122
|
+
*/
|
|
123
|
+
declare const mockEnv: CookieFirstEnv;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* CookieFirst source examples for testing and documentation.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
declare const index_analyticsOnlyConsent: typeof analyticsOnlyConsent;
|
|
130
|
+
declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
131
|
+
declare const index_createMockCookieFirstAPI: typeof createMockCookieFirstAPI;
|
|
132
|
+
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
133
|
+
declare const index_createMockWindow: typeof createMockWindow;
|
|
134
|
+
declare const index_fullConsent: typeof fullConsent;
|
|
135
|
+
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
136
|
+
declare const index_marketingOnlyConsent: typeof marketingOnlyConsent;
|
|
137
|
+
declare const index_marketingOnlyMapped: typeof marketingOnlyMapped;
|
|
138
|
+
declare const index_minimalConsent: typeof minimalConsent;
|
|
139
|
+
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
140
|
+
declare const index_mockEnv: typeof mockEnv;
|
|
141
|
+
declare const index_noConsent: typeof noConsent;
|
|
142
|
+
declare const index_noopLogger: typeof noopLogger;
|
|
143
|
+
declare const index_partialConsent: typeof partialConsent;
|
|
144
|
+
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
145
|
+
declare namespace index {
|
|
146
|
+
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockCookieFirstAPI as createMockCookieFirstAPI, index_createMockElbFn as createMockElbFn, index_createMockWindow as createMockWindow, index_fullConsent as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_mockEnv as mockEnv, index_noConsent as noConsent, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export { index as examples };
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { WalkerOS, Elb, Logger, Source } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CookieFirst consent object structure
|
|
5
|
+
*/
|
|
6
|
+
interface CookieFirstConsent {
|
|
7
|
+
necessary?: boolean;
|
|
8
|
+
functional?: boolean;
|
|
9
|
+
performance?: boolean;
|
|
10
|
+
advertising?: boolean;
|
|
11
|
+
[category: string]: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CookieFirst global API interface
|
|
15
|
+
*/
|
|
16
|
+
interface CookieFirstAPI {
|
|
17
|
+
consent: CookieFirstConsent | null;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
interface Window {
|
|
21
|
+
CookieFirst?: CookieFirstAPI;
|
|
22
|
+
[key: string]: CookieFirstAPI | unknown;
|
|
23
|
+
}
|
|
24
|
+
interface WindowEventMap {
|
|
25
|
+
cf_init: Event;
|
|
26
|
+
cf_consent: CustomEvent<CookieFirstConsent>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Example CookieFirst consent inputs.
|
|
32
|
+
*
|
|
33
|
+
* These represent real consent states from CookieFirst CMP.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Full consent - user accepted all categories
|
|
37
|
+
*/
|
|
38
|
+
declare const fullConsent: CookieFirstConsent;
|
|
39
|
+
/**
|
|
40
|
+
* Partial consent - user accepted only necessary and functional
|
|
41
|
+
*/
|
|
42
|
+
declare const partialConsent: CookieFirstConsent;
|
|
43
|
+
/**
|
|
44
|
+
* Minimal consent - user accepted only necessary (required)
|
|
45
|
+
*/
|
|
46
|
+
declare const minimalConsent: CookieFirstConsent;
|
|
47
|
+
/**
|
|
48
|
+
* No consent - user hasn't made a choice yet
|
|
49
|
+
* CookieFirst returns null when no explicit choice has been made
|
|
50
|
+
*/
|
|
51
|
+
declare const noConsent: CookieFirstConsent | null;
|
|
52
|
+
/**
|
|
53
|
+
* Analytics only - user accepted performance tracking
|
|
54
|
+
*/
|
|
55
|
+
declare const analyticsOnlyConsent: CookieFirstConsent;
|
|
56
|
+
/**
|
|
57
|
+
* Marketing only - user accepted advertising
|
|
58
|
+
*/
|
|
59
|
+
declare const marketingOnlyConsent: CookieFirstConsent;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Expected walkerOS consent outputs.
|
|
63
|
+
*
|
|
64
|
+
* These represent the consent state after mapping CookieFirst categories
|
|
65
|
+
* to walkerOS consent groups using the default category map.
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Full consent mapped to walkerOS groups
|
|
69
|
+
* (necessary + functional → functional, performance → analytics, advertising → marketing)
|
|
70
|
+
*/
|
|
71
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
72
|
+
/**
|
|
73
|
+
* Partial consent mapped to walkerOS groups
|
|
74
|
+
*/
|
|
75
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
76
|
+
/**
|
|
77
|
+
* Minimal consent mapped to walkerOS groups
|
|
78
|
+
*/
|
|
79
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
80
|
+
/**
|
|
81
|
+
* Analytics only consent mapped to walkerOS groups
|
|
82
|
+
* Note: functional is true because necessary=true maps to functional
|
|
83
|
+
* (OR logic: if ANY source category is true, target group is true)
|
|
84
|
+
*/
|
|
85
|
+
declare const analyticsOnlyMapped: WalkerOS.Consent;
|
|
86
|
+
/**
|
|
87
|
+
* Marketing only consent mapped to walkerOS groups
|
|
88
|
+
* Note: functional is true because necessary=true maps to functional
|
|
89
|
+
* (OR logic: if ANY source category is true, target group is true)
|
|
90
|
+
*/
|
|
91
|
+
declare const marketingOnlyMapped: WalkerOS.Consent;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Create a properly typed elb/push function mock that returns a promise with PushResult
|
|
95
|
+
*/
|
|
96
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
97
|
+
/**
|
|
98
|
+
* Simple no-op logger for demo purposes
|
|
99
|
+
*/
|
|
100
|
+
declare const noopLogger: Logger.Instance;
|
|
101
|
+
/**
|
|
102
|
+
* Environment interface for CookieFirst source
|
|
103
|
+
*/
|
|
104
|
+
interface CookieFirstEnv extends Source.BaseEnv {
|
|
105
|
+
window?: typeof window;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a mock CookieFirst API object
|
|
109
|
+
*/
|
|
110
|
+
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent | null) => CookieFirstAPI;
|
|
111
|
+
/**
|
|
112
|
+
* Create a mock window object with CookieFirst
|
|
113
|
+
*/
|
|
114
|
+
declare const createMockWindow: (consent?: CookieFirstConsent | null) => Partial<Window> & {
|
|
115
|
+
CookieFirst: CookieFirstAPI;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Standard mock environment for testing CookieFirst source
|
|
119
|
+
*
|
|
120
|
+
* Use this for testing consent handling without requiring
|
|
121
|
+
* a real browser environment.
|
|
122
|
+
*/
|
|
123
|
+
declare const mockEnv: CookieFirstEnv;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* CookieFirst source examples for testing and documentation.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
declare const index_analyticsOnlyConsent: typeof analyticsOnlyConsent;
|
|
130
|
+
declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
131
|
+
declare const index_createMockCookieFirstAPI: typeof createMockCookieFirstAPI;
|
|
132
|
+
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
133
|
+
declare const index_createMockWindow: typeof createMockWindow;
|
|
134
|
+
declare const index_fullConsent: typeof fullConsent;
|
|
135
|
+
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
136
|
+
declare const index_marketingOnlyConsent: typeof marketingOnlyConsent;
|
|
137
|
+
declare const index_marketingOnlyMapped: typeof marketingOnlyMapped;
|
|
138
|
+
declare const index_minimalConsent: typeof minimalConsent;
|
|
139
|
+
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
140
|
+
declare const index_mockEnv: typeof mockEnv;
|
|
141
|
+
declare const index_noConsent: typeof noConsent;
|
|
142
|
+
declare const index_noopLogger: typeof noopLogger;
|
|
143
|
+
declare const index_partialConsent: typeof partialConsent;
|
|
144
|
+
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
145
|
+
declare namespace index {
|
|
146
|
+
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockCookieFirstAPI as createMockCookieFirstAPI, index_createMockElbFn as createMockElbFn, index_createMockWindow as createMockWindow, index_fullConsent as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_mockEnv as mockEnv, index_noConsent as noConsent, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export { index as examples };
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e,n=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},i={};o(i,{examples:()=>l}),module.exports=(e=i,((e,o,i,l)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let s of r(o))a.call(e,s)||s===i||n(e,s,{get:()=>o[s],enumerable:!(l=t(o,s))||l.enumerable});return e})(n({},"__esModule",{value:!0}),e));var l={};o(l,{analyticsOnlyConsent:()=>f,analyticsOnlyMapped:()=>v,createMockCookieFirstAPI:()=>w,createMockElbFn:()=>C,createMockWindow:()=>M,fullConsent:()=>s,fullConsentMapped:()=>g,marketingOnlyConsent:()=>m,marketingOnlyMapped:()=>k,minimalConsent:()=>p,minimalConsentMapped:()=>d,mockEnv:()=>P,noConsent:()=>u,noopLogger:()=>O,partialConsent:()=>c,partialConsentMapped:()=>y});var s={necessary:!0,functional:!0,performance:!0,advertising:!0},c={necessary:!0,functional:!0,performance:!1,advertising:!1},p={necessary:!0,functional:!1,performance:!1,advertising:!1},u=null,f={necessary:!0,functional:!1,performance:!0,advertising:!1},m={necessary:!0,functional:!1,performance:!1,advertising:!0},g={functional:!0,analytics:!0,marketing:!0},y={functional:!0,analytics:!1,marketing:!1},d={functional:!0,analytics:!1,marketing:!1},v={functional:!0,analytics:!0,marketing:!1},k={functional:!0,analytics:!1,marketing:!0},b=()=>{},C=()=>()=>Promise.resolve({ok:!0}),O={error:b,info:b,debug:b,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>O},w=(e=null)=>({consent:e}),M=(e=null)=>({CookieFirst:w(e),addEventListener:b,removeEventListener:b}),P={get push(){return C()},get command(){return C()},get elb(){return C()},get window(){return M()},logger:O};//# 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","/**\n * CookieFirst source examples for testing and documentation.\n */\n\nexport * from './inputs';\nexport * from './outputs';\nexport * from './env';\n","import type { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\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\n/**\n * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: 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;AAAA;AAAA;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAMO,IAAM,YAAuC;AAK7C,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;;;ACjDO,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;;;AC9CA,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;AAYO,IAAM,2BAA2B,CACtC,UAAqC,UACjB;AAAA,EACpB;AACF;AAKO,IAAM,mBAAmB,CAC9B,UAAqC,UACkB;AAAA,EACvD,aAAa,yBAAyB,OAAO;AAAA,EAC7C,kBAAkB;AAAA,EAClB,qBAAqB;AACvB;AAQO,IAAM,UAA0B;AAAA,EACrC,IAAI,OAAO;AACT,WAAO,gBAAgB;AAAA,EACzB;AAAA,EACA,IAAI,UAAU;AACZ,WAAO,gBAAgB;AAAA,EACzB;AAAA,EACA,IAAI,MAAM;AACR,WAAO,gBAAgB;AAAA,EACzB;AAAA,EACA,IAAI,SAAS;AACX,WAAO,iBAAiB;AAAA,EAC1B;AAAA,EACA,QAAQ;AACV;","names":[]}
|
package/dist/dev.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty,e={};((e,a)=>{for(var r in a)n(e,r,{get:a[r],enumerable:!0})})(e,{analyticsOnlyConsent:()=>i,analyticsOnlyMapped:()=>g,createMockCookieFirstAPI:()=>d,createMockElbFn:()=>f,createMockWindow:()=>k,fullConsent:()=>a,fullConsentMapped:()=>l,marketingOnlyConsent:()=>s,marketingOnlyMapped:()=>m,minimalConsent:()=>t,minimalConsentMapped:()=>p,mockEnv:()=>v,noConsent:()=>o,noopLogger:()=>y,partialConsent:()=>r,partialConsentMapped:()=>c});var a={necessary:!0,functional:!0,performance:!0,advertising:!0},r={necessary:!0,functional:!0,performance:!1,advertising:!1},t={necessary:!0,functional:!1,performance:!1,advertising:!1},o=null,i={necessary:!0,functional:!1,performance:!0,advertising:!1},s={necessary:!0,functional:!1,performance:!1,advertising:!0},l={functional:!0,analytics:!0,marketing:!0},c={functional:!0,analytics:!1,marketing:!1},p={functional:!0,analytics:!1,marketing:!1},g={functional:!0,analytics:!0,marketing:!1},m={functional:!0,analytics:!1,marketing:!0},u=()=>{},f=()=>()=>Promise.resolve({ok:!0}),y={error:u,info:u,debug:u,throw:n=>{throw"string"==typeof n?new Error(n):n},scope:()=>y},d=(n=null)=>({consent:n}),k=(n=null)=>({CookieFirst:d(n),addEventListener:u,removeEventListener:u}),v={get push(){return f()},get command(){return f()},get elb(){return f()},get window(){return k()},logger:y};export{e 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":["/**\n * CookieFirst source examples for testing and documentation.\n */\n\nexport * from './inputs';\nexport * from './outputs';\nexport * from './env';\n","import type { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\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\n/**\n * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAMO,IAAM,YAAuC;AAK7C,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;;;ACjDO,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;;;AC9CA,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;AAYO,IAAM,2BAA2B,CACtC,UAAqC,UACjB;AAAA,EACpB;AACF;AAKO,IAAM,mBAAmB,CAC9B,UAAqC,UACkB;AAAA,EACvD,aAAa,yBAAyB,OAAO;AAAA,EAC7C,kBAAkB;AAAA,EAClB,qBAAqB;AACvB;AAQO,IAAM,UAA0B;AAAA,EACrC,IAAI,OAAO;AACT,WAAO,gBAAgB;AAAA,EACzB;AAAA,EACA,IAAI,UAAU;AACZ,WAAO,gBAAgB;AAAA,EACzB;AAAA,EACA,IAAI,MAAM;AACR,WAAO,gBAAgB;AAAA,EACzB;AAAA,EACA,IAAI,SAAS;AACX,WAAO,iBAAiB;AAAA,EAC1B;AAAA,EACA,QAAQ;AACV;","names":[]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { WalkerOS, Elb, Logger, Source } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CookieFirst consent object structure
|
|
5
|
+
*/
|
|
6
|
+
interface CookieFirstConsent {
|
|
7
|
+
necessary?: boolean;
|
|
8
|
+
functional?: boolean;
|
|
9
|
+
performance?: boolean;
|
|
10
|
+
advertising?: boolean;
|
|
11
|
+
[category: string]: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CookieFirst global API interface
|
|
15
|
+
*/
|
|
16
|
+
interface CookieFirstAPI {
|
|
17
|
+
consent: CookieFirstConsent | null;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
interface Window {
|
|
21
|
+
CookieFirst?: CookieFirstAPI;
|
|
22
|
+
[key: string]: CookieFirstAPI | unknown;
|
|
23
|
+
}
|
|
24
|
+
interface WindowEventMap {
|
|
25
|
+
cf_init: Event;
|
|
26
|
+
cf_consent: CustomEvent<CookieFirstConsent>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Example CookieFirst consent inputs.
|
|
32
|
+
*
|
|
33
|
+
* These represent real consent states from CookieFirst CMP.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Full consent - user accepted all categories
|
|
37
|
+
*/
|
|
38
|
+
declare const fullConsent: CookieFirstConsent;
|
|
39
|
+
/**
|
|
40
|
+
* Partial consent - user accepted only necessary and functional
|
|
41
|
+
*/
|
|
42
|
+
declare const partialConsent: CookieFirstConsent;
|
|
43
|
+
/**
|
|
44
|
+
* Minimal consent - user accepted only necessary (required)
|
|
45
|
+
*/
|
|
46
|
+
declare const minimalConsent: CookieFirstConsent;
|
|
47
|
+
/**
|
|
48
|
+
* No consent - user hasn't made a choice yet
|
|
49
|
+
* CookieFirst returns null when no explicit choice has been made
|
|
50
|
+
*/
|
|
51
|
+
declare const noConsent: CookieFirstConsent | null;
|
|
52
|
+
/**
|
|
53
|
+
* Analytics only - user accepted performance tracking
|
|
54
|
+
*/
|
|
55
|
+
declare const analyticsOnlyConsent: CookieFirstConsent;
|
|
56
|
+
/**
|
|
57
|
+
* Marketing only - user accepted advertising
|
|
58
|
+
*/
|
|
59
|
+
declare const marketingOnlyConsent: CookieFirstConsent;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Expected walkerOS consent outputs.
|
|
63
|
+
*
|
|
64
|
+
* These represent the consent state after mapping CookieFirst categories
|
|
65
|
+
* to walkerOS consent groups using the default category map.
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Full consent mapped to walkerOS groups
|
|
69
|
+
* (necessary + functional → functional, performance → analytics, advertising → marketing)
|
|
70
|
+
*/
|
|
71
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
72
|
+
/**
|
|
73
|
+
* Partial consent mapped to walkerOS groups
|
|
74
|
+
*/
|
|
75
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
76
|
+
/**
|
|
77
|
+
* Minimal consent mapped to walkerOS groups
|
|
78
|
+
*/
|
|
79
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
80
|
+
/**
|
|
81
|
+
* Analytics only consent mapped to walkerOS groups
|
|
82
|
+
* Note: functional is true because necessary=true maps to functional
|
|
83
|
+
* (OR logic: if ANY source category is true, target group is true)
|
|
84
|
+
*/
|
|
85
|
+
declare const analyticsOnlyMapped: WalkerOS.Consent;
|
|
86
|
+
/**
|
|
87
|
+
* Marketing only consent mapped to walkerOS groups
|
|
88
|
+
* Note: functional is true because necessary=true maps to functional
|
|
89
|
+
* (OR logic: if ANY source category is true, target group is true)
|
|
90
|
+
*/
|
|
91
|
+
declare const marketingOnlyMapped: WalkerOS.Consent;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Create a properly typed elb/push function mock that returns a promise with PushResult
|
|
95
|
+
*/
|
|
96
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
97
|
+
/**
|
|
98
|
+
* Simple no-op logger for demo purposes
|
|
99
|
+
*/
|
|
100
|
+
declare const noopLogger: Logger.Instance;
|
|
101
|
+
/**
|
|
102
|
+
* Environment interface for CookieFirst source
|
|
103
|
+
*/
|
|
104
|
+
interface CookieFirstEnv extends Source.BaseEnv {
|
|
105
|
+
window?: typeof window;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a mock CookieFirst API object
|
|
109
|
+
*/
|
|
110
|
+
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent | null) => CookieFirstAPI;
|
|
111
|
+
/**
|
|
112
|
+
* Create a mock window object with CookieFirst
|
|
113
|
+
*/
|
|
114
|
+
declare const createMockWindow: (consent?: CookieFirstConsent | null) => Partial<Window> & {
|
|
115
|
+
CookieFirst: CookieFirstAPI;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Standard mock environment for testing CookieFirst source
|
|
119
|
+
*
|
|
120
|
+
* Use this for testing consent handling without requiring
|
|
121
|
+
* a real browser environment.
|
|
122
|
+
*/
|
|
123
|
+
declare const mockEnv: CookieFirstEnv;
|
|
124
|
+
|
|
125
|
+
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockCookieFirstAPI, createMockElbFn, createMockWindow, fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent, minimalConsentMapped, mockEnv, noConsent, noopLogger, partialConsent, partialConsentMapped };
|