@walkeros/web-source-cmp-cookiebot 0.0.0-stage → 4.9.0-next-1793116456867
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 +25 -0
- package/README.md +52 -2
- package/dist/dev.d.mts +184 -0
- package/dist/dev.d.ts +184 -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 +142 -0
- package/dist/examples/index.d.ts +142 -0
- package/dist/examples/index.js +246 -0
- package/dist/examples/index.mjs +214 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +163 -0
- package/dist/index.d.ts +163 -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/dist/walkerOS.json +407 -0
- package/package.json +76 -4
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { WalkerOS, Flow, Trigger } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
declare module '@walkeros/core' {
|
|
4
|
+
interface SourceMap {
|
|
5
|
+
cookiebot: {
|
|
6
|
+
type: 'cookiebot';
|
|
7
|
+
platform?: 'web';
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Cookiebot consent object (`window.Cookiebot.consent`).
|
|
13
|
+
*
|
|
14
|
+
* The four categories are booleans Cookiebot always sets. `method` is
|
|
15
|
+
* `'explicit'` when the visitor actively decided, `'implied'` when Cookiebot
|
|
16
|
+
* consented on its own (outside a region that requires consent, an implied
|
|
17
|
+
* banner, or an old consent of unknown method) and `null` without consent.
|
|
18
|
+
*/
|
|
19
|
+
interface CookiebotConsent {
|
|
20
|
+
necessary?: boolean;
|
|
21
|
+
preferences?: boolean;
|
|
22
|
+
statistics?: boolean;
|
|
23
|
+
marketing?: boolean;
|
|
24
|
+
method?: string | null;
|
|
25
|
+
stamp?: string;
|
|
26
|
+
[category: string]: boolean | string | null | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The subset of the Cookiebot SDK (`window.Cookiebot`) the source reads.
|
|
30
|
+
*/
|
|
31
|
+
interface CookiebotAPI {
|
|
32
|
+
consent: CookiebotConsent;
|
|
33
|
+
/** The visitor accepted at least one category. */
|
|
34
|
+
consented?: boolean;
|
|
35
|
+
/** The visitor declined. */
|
|
36
|
+
declined?: boolean;
|
|
37
|
+
/** The visitor answered the banner, or Cookiebot consented for them. */
|
|
38
|
+
hasResponse?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Example `window.Cookiebot` states.
|
|
43
|
+
*
|
|
44
|
+
* Shapes follow what Cookiebot's uc.js sets: the four category booleans are
|
|
45
|
+
* always present, `method` is 'explicit', 'implied' or null, and `stamp`
|
|
46
|
+
* identifies the stored consent.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Full consent - the visitor clicked "Allow all"
|
|
50
|
+
*/
|
|
51
|
+
declare const fullConsent: CookiebotAPI;
|
|
52
|
+
/**
|
|
53
|
+
* Partial consent - preferences and statistics allowed, marketing denied
|
|
54
|
+
*/
|
|
55
|
+
declare const partialConsent: CookiebotAPI;
|
|
56
|
+
/**
|
|
57
|
+
* Necessary only - the visitor clicked "Use necessary cookies only", or
|
|
58
|
+
* withdrew an earlier consent
|
|
59
|
+
*/
|
|
60
|
+
declare const necessaryOnly: CookiebotAPI;
|
|
61
|
+
/**
|
|
62
|
+
* Implied consent - Cookiebot consented on its own, for example for a visitor
|
|
63
|
+
* outside the regions where the site asks for consent
|
|
64
|
+
*/
|
|
65
|
+
declare const impliedConsent: CookiebotAPI;
|
|
66
|
+
/**
|
|
67
|
+
* No response - a first visit while the banner is still open
|
|
68
|
+
*/
|
|
69
|
+
declare const noResponse: CookiebotAPI;
|
|
70
|
+
/**
|
|
71
|
+
* Uppercase method - full consent with the method in a different casing
|
|
72
|
+
*/
|
|
73
|
+
declare const uppercaseMethod: CookiebotAPI;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Expected walkerOS consent states after mapping through the default
|
|
77
|
+
* categoryMap:
|
|
78
|
+
* - preferences -> functional
|
|
79
|
+
* - statistics -> analytics
|
|
80
|
+
* - marketing -> marketing
|
|
81
|
+
*
|
|
82
|
+
* `necessary` has no entry and keeps its own name. Denied groups carry an
|
|
83
|
+
* explicit false.
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* Full consent mapped to walkerOS groups
|
|
87
|
+
*/
|
|
88
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
89
|
+
/**
|
|
90
|
+
* Partial consent - marketing denied
|
|
91
|
+
*/
|
|
92
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
93
|
+
/**
|
|
94
|
+
* Necessary only - functional, analytics and marketing denied
|
|
95
|
+
*/
|
|
96
|
+
declare const necessaryOnlyMapped: WalkerOS.Consent;
|
|
97
|
+
/**
|
|
98
|
+
* Partial consent with statistics mapped to a custom `statistics` group
|
|
99
|
+
*/
|
|
100
|
+
declare const partialConsentCustomMapped: WalkerOS.Consent;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Step examples for the Cookiebot source.
|
|
104
|
+
*
|
|
105
|
+
* `in` is the `window.Cookiebot` state. `trigger.options.dispatch` picks the
|
|
106
|
+
* path the source reacts to:
|
|
107
|
+
* - 'init' (default): Cookiebot already holds the state when the source
|
|
108
|
+
* starts, so the static read at init emits it.
|
|
109
|
+
* - 'event': Cookiebot reports the state after the source started, firing
|
|
110
|
+
* CookiebotOnAccept (consented) or CookiebotOnDecline (declined).
|
|
111
|
+
*/
|
|
112
|
+
declare const allowAll: Flow.StepExample;
|
|
113
|
+
declare const necessaryOnlyChoice: Flow.StepExample;
|
|
114
|
+
declare const returningVisitor: Flow.StepExample;
|
|
115
|
+
declare const firstVisit: Flow.StepExample;
|
|
116
|
+
declare const impliedSkipped: Flow.StepExample;
|
|
117
|
+
declare const impliedAllowed: Flow.StepExample;
|
|
118
|
+
declare const categoryMapOverride: Flow.StepExample;
|
|
119
|
+
|
|
120
|
+
declare const step_allowAll: typeof allowAll;
|
|
121
|
+
declare const step_categoryMapOverride: typeof categoryMapOverride;
|
|
122
|
+
declare const step_firstVisit: typeof firstVisit;
|
|
123
|
+
declare const step_impliedAllowed: typeof impliedAllowed;
|
|
124
|
+
declare const step_impliedSkipped: typeof impliedSkipped;
|
|
125
|
+
declare const step_necessaryOnlyChoice: typeof necessaryOnlyChoice;
|
|
126
|
+
declare const step_returningVisitor: typeof returningVisitor;
|
|
127
|
+
declare namespace step {
|
|
128
|
+
export { step_allowAll as allowAll, step_categoryMapOverride as categoryMapOverride, step_firstVisit as firstVisit, step_impliedAllowed as impliedAllowed, step_impliedSkipped as impliedSkipped, step_necessaryOnlyChoice as necessaryOnlyChoice, step_returningVisitor as returningVisitor };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* `content` is the `window.Cookiebot` state. The `dispatch` option picks the
|
|
133
|
+
* path the source reacts to:
|
|
134
|
+
* - 'init' (default): Cookiebot holds the state before the source starts,
|
|
135
|
+
* so the static read at init publishes it.
|
|
136
|
+
* - 'event': Cookiebot reports the state after the source started and fires
|
|
137
|
+
* CookiebotOnAccept (consented) or CookiebotOnDecline (otherwise).
|
|
138
|
+
* Once the flow runs, every further trigger fires the event.
|
|
139
|
+
*/
|
|
140
|
+
declare const createTrigger: Trigger.CreateFn<unknown, void>;
|
|
141
|
+
|
|
142
|
+
export { createTrigger, fullConsent, fullConsentMapped, impliedConsent, necessaryOnly, necessaryOnlyMapped, noResponse, partialConsent, partialConsentCustomMapped, partialConsentMapped, step, uppercaseMethod };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { WalkerOS, Flow, Trigger } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
declare module '@walkeros/core' {
|
|
4
|
+
interface SourceMap {
|
|
5
|
+
cookiebot: {
|
|
6
|
+
type: 'cookiebot';
|
|
7
|
+
platform?: 'web';
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Cookiebot consent object (`window.Cookiebot.consent`).
|
|
13
|
+
*
|
|
14
|
+
* The four categories are booleans Cookiebot always sets. `method` is
|
|
15
|
+
* `'explicit'` when the visitor actively decided, `'implied'` when Cookiebot
|
|
16
|
+
* consented on its own (outside a region that requires consent, an implied
|
|
17
|
+
* banner, or an old consent of unknown method) and `null` without consent.
|
|
18
|
+
*/
|
|
19
|
+
interface CookiebotConsent {
|
|
20
|
+
necessary?: boolean;
|
|
21
|
+
preferences?: boolean;
|
|
22
|
+
statistics?: boolean;
|
|
23
|
+
marketing?: boolean;
|
|
24
|
+
method?: string | null;
|
|
25
|
+
stamp?: string;
|
|
26
|
+
[category: string]: boolean | string | null | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The subset of the Cookiebot SDK (`window.Cookiebot`) the source reads.
|
|
30
|
+
*/
|
|
31
|
+
interface CookiebotAPI {
|
|
32
|
+
consent: CookiebotConsent;
|
|
33
|
+
/** The visitor accepted at least one category. */
|
|
34
|
+
consented?: boolean;
|
|
35
|
+
/** The visitor declined. */
|
|
36
|
+
declined?: boolean;
|
|
37
|
+
/** The visitor answered the banner, or Cookiebot consented for them. */
|
|
38
|
+
hasResponse?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Example `window.Cookiebot` states.
|
|
43
|
+
*
|
|
44
|
+
* Shapes follow what Cookiebot's uc.js sets: the four category booleans are
|
|
45
|
+
* always present, `method` is 'explicit', 'implied' or null, and `stamp`
|
|
46
|
+
* identifies the stored consent.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Full consent - the visitor clicked "Allow all"
|
|
50
|
+
*/
|
|
51
|
+
declare const fullConsent: CookiebotAPI;
|
|
52
|
+
/**
|
|
53
|
+
* Partial consent - preferences and statistics allowed, marketing denied
|
|
54
|
+
*/
|
|
55
|
+
declare const partialConsent: CookiebotAPI;
|
|
56
|
+
/**
|
|
57
|
+
* Necessary only - the visitor clicked "Use necessary cookies only", or
|
|
58
|
+
* withdrew an earlier consent
|
|
59
|
+
*/
|
|
60
|
+
declare const necessaryOnly: CookiebotAPI;
|
|
61
|
+
/**
|
|
62
|
+
* Implied consent - Cookiebot consented on its own, for example for a visitor
|
|
63
|
+
* outside the regions where the site asks for consent
|
|
64
|
+
*/
|
|
65
|
+
declare const impliedConsent: CookiebotAPI;
|
|
66
|
+
/**
|
|
67
|
+
* No response - a first visit while the banner is still open
|
|
68
|
+
*/
|
|
69
|
+
declare const noResponse: CookiebotAPI;
|
|
70
|
+
/**
|
|
71
|
+
* Uppercase method - full consent with the method in a different casing
|
|
72
|
+
*/
|
|
73
|
+
declare const uppercaseMethod: CookiebotAPI;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Expected walkerOS consent states after mapping through the default
|
|
77
|
+
* categoryMap:
|
|
78
|
+
* - preferences -> functional
|
|
79
|
+
* - statistics -> analytics
|
|
80
|
+
* - marketing -> marketing
|
|
81
|
+
*
|
|
82
|
+
* `necessary` has no entry and keeps its own name. Denied groups carry an
|
|
83
|
+
* explicit false.
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* Full consent mapped to walkerOS groups
|
|
87
|
+
*/
|
|
88
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
89
|
+
/**
|
|
90
|
+
* Partial consent - marketing denied
|
|
91
|
+
*/
|
|
92
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
93
|
+
/**
|
|
94
|
+
* Necessary only - functional, analytics and marketing denied
|
|
95
|
+
*/
|
|
96
|
+
declare const necessaryOnlyMapped: WalkerOS.Consent;
|
|
97
|
+
/**
|
|
98
|
+
* Partial consent with statistics mapped to a custom `statistics` group
|
|
99
|
+
*/
|
|
100
|
+
declare const partialConsentCustomMapped: WalkerOS.Consent;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Step examples for the Cookiebot source.
|
|
104
|
+
*
|
|
105
|
+
* `in` is the `window.Cookiebot` state. `trigger.options.dispatch` picks the
|
|
106
|
+
* path the source reacts to:
|
|
107
|
+
* - 'init' (default): Cookiebot already holds the state when the source
|
|
108
|
+
* starts, so the static read at init emits it.
|
|
109
|
+
* - 'event': Cookiebot reports the state after the source started, firing
|
|
110
|
+
* CookiebotOnAccept (consented) or CookiebotOnDecline (declined).
|
|
111
|
+
*/
|
|
112
|
+
declare const allowAll: Flow.StepExample;
|
|
113
|
+
declare const necessaryOnlyChoice: Flow.StepExample;
|
|
114
|
+
declare const returningVisitor: Flow.StepExample;
|
|
115
|
+
declare const firstVisit: Flow.StepExample;
|
|
116
|
+
declare const impliedSkipped: Flow.StepExample;
|
|
117
|
+
declare const impliedAllowed: Flow.StepExample;
|
|
118
|
+
declare const categoryMapOverride: Flow.StepExample;
|
|
119
|
+
|
|
120
|
+
declare const step_allowAll: typeof allowAll;
|
|
121
|
+
declare const step_categoryMapOverride: typeof categoryMapOverride;
|
|
122
|
+
declare const step_firstVisit: typeof firstVisit;
|
|
123
|
+
declare const step_impliedAllowed: typeof impliedAllowed;
|
|
124
|
+
declare const step_impliedSkipped: typeof impliedSkipped;
|
|
125
|
+
declare const step_necessaryOnlyChoice: typeof necessaryOnlyChoice;
|
|
126
|
+
declare const step_returningVisitor: typeof returningVisitor;
|
|
127
|
+
declare namespace step {
|
|
128
|
+
export { step_allowAll as allowAll, step_categoryMapOverride as categoryMapOverride, step_firstVisit as firstVisit, step_impliedAllowed as impliedAllowed, step_impliedSkipped as impliedSkipped, step_necessaryOnlyChoice as necessaryOnlyChoice, step_returningVisitor as returningVisitor };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* `content` is the `window.Cookiebot` state. The `dispatch` option picks the
|
|
133
|
+
* path the source reacts to:
|
|
134
|
+
* - 'init' (default): Cookiebot holds the state before the source starts,
|
|
135
|
+
* so the static read at init publishes it.
|
|
136
|
+
* - 'event': Cookiebot reports the state after the source started and fires
|
|
137
|
+
* CookiebotOnAccept (consented) or CookiebotOnDecline (otherwise).
|
|
138
|
+
* Once the flow runs, every further trigger fires the event.
|
|
139
|
+
*/
|
|
140
|
+
declare const createTrigger: Trigger.CreateFn<unknown, void>;
|
|
141
|
+
|
|
142
|
+
export { createTrigger, fullConsent, fullConsentMapped, impliedConsent, necessaryOnly, necessaryOnlyMapped, noResponse, partialConsent, partialConsentCustomMapped, partialConsentMapped, step, uppercaseMethod };
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/examples/index.ts
|
|
21
|
+
var examples_exports = {};
|
|
22
|
+
__export(examples_exports, {
|
|
23
|
+
createTrigger: () => createTrigger,
|
|
24
|
+
fullConsent: () => fullConsent,
|
|
25
|
+
fullConsentMapped: () => fullConsentMapped,
|
|
26
|
+
impliedConsent: () => impliedConsent,
|
|
27
|
+
necessaryOnly: () => necessaryOnly,
|
|
28
|
+
necessaryOnlyMapped: () => necessaryOnlyMapped,
|
|
29
|
+
noResponse: () => noResponse,
|
|
30
|
+
partialConsent: () => partialConsent,
|
|
31
|
+
partialConsentCustomMapped: () => partialConsentCustomMapped,
|
|
32
|
+
partialConsentMapped: () => partialConsentMapped,
|
|
33
|
+
step: () => step_exports,
|
|
34
|
+
uppercaseMethod: () => uppercaseMethod
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(examples_exports);
|
|
37
|
+
|
|
38
|
+
// src/examples/inputs.ts
|
|
39
|
+
var fullConsent = {
|
|
40
|
+
consented: true,
|
|
41
|
+
declined: false,
|
|
42
|
+
hasResponse: true,
|
|
43
|
+
consent: {
|
|
44
|
+
stamp: "example-stamp-full",
|
|
45
|
+
necessary: true,
|
|
46
|
+
preferences: true,
|
|
47
|
+
statistics: true,
|
|
48
|
+
marketing: true,
|
|
49
|
+
method: "explicit"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var partialConsent = {
|
|
53
|
+
consented: true,
|
|
54
|
+
declined: false,
|
|
55
|
+
hasResponse: true,
|
|
56
|
+
consent: {
|
|
57
|
+
stamp: "example-stamp-partial",
|
|
58
|
+
necessary: true,
|
|
59
|
+
preferences: true,
|
|
60
|
+
statistics: true,
|
|
61
|
+
marketing: false,
|
|
62
|
+
method: "explicit"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var necessaryOnly = {
|
|
66
|
+
consented: false,
|
|
67
|
+
declined: true,
|
|
68
|
+
hasResponse: true,
|
|
69
|
+
consent: {
|
|
70
|
+
stamp: "example-stamp-necessary",
|
|
71
|
+
necessary: true,
|
|
72
|
+
preferences: false,
|
|
73
|
+
statistics: false,
|
|
74
|
+
marketing: false,
|
|
75
|
+
method: "explicit"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var impliedConsent = {
|
|
79
|
+
consented: true,
|
|
80
|
+
declined: false,
|
|
81
|
+
hasResponse: true,
|
|
82
|
+
consent: {
|
|
83
|
+
stamp: "-1",
|
|
84
|
+
necessary: true,
|
|
85
|
+
preferences: true,
|
|
86
|
+
statistics: true,
|
|
87
|
+
marketing: true,
|
|
88
|
+
method: "implied"
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var noResponse = {
|
|
92
|
+
consented: false,
|
|
93
|
+
declined: false,
|
|
94
|
+
hasResponse: false,
|
|
95
|
+
consent: {
|
|
96
|
+
stamp: "0",
|
|
97
|
+
necessary: true,
|
|
98
|
+
preferences: false,
|
|
99
|
+
statistics: false,
|
|
100
|
+
marketing: false,
|
|
101
|
+
method: null
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var uppercaseMethod = {
|
|
105
|
+
...fullConsent,
|
|
106
|
+
consent: { ...fullConsent.consent, method: "EXPLICIT" }
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/examples/outputs.ts
|
|
110
|
+
var fullConsentMapped = {
|
|
111
|
+
necessary: true,
|
|
112
|
+
functional: true,
|
|
113
|
+
analytics: true,
|
|
114
|
+
marketing: true
|
|
115
|
+
};
|
|
116
|
+
var partialConsentMapped = {
|
|
117
|
+
necessary: true,
|
|
118
|
+
functional: true,
|
|
119
|
+
analytics: true,
|
|
120
|
+
marketing: false
|
|
121
|
+
};
|
|
122
|
+
var necessaryOnlyMapped = {
|
|
123
|
+
necessary: true,
|
|
124
|
+
functional: false,
|
|
125
|
+
analytics: false,
|
|
126
|
+
marketing: false
|
|
127
|
+
};
|
|
128
|
+
var partialConsentCustomMapped = {
|
|
129
|
+
necessary: true,
|
|
130
|
+
functional: true,
|
|
131
|
+
statistics: true,
|
|
132
|
+
marketing: false
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// src/examples/step.ts
|
|
136
|
+
var step_exports = {};
|
|
137
|
+
__export(step_exports, {
|
|
138
|
+
allowAll: () => allowAll,
|
|
139
|
+
categoryMapOverride: () => categoryMapOverride,
|
|
140
|
+
firstVisit: () => firstVisit,
|
|
141
|
+
impliedAllowed: () => impliedAllowed,
|
|
142
|
+
impliedSkipped: () => impliedSkipped,
|
|
143
|
+
necessaryOnlyChoice: () => necessaryOnlyChoice,
|
|
144
|
+
returningVisitor: () => returningVisitor
|
|
145
|
+
});
|
|
146
|
+
var allowAll = {
|
|
147
|
+
title: "Allow all",
|
|
148
|
+
description: 'The visitor clicks "Allow all". Cookiebot fires CookiebotOnAccept and the source emits a walker consent command granting functional, analytics and marketing.',
|
|
149
|
+
trigger: { type: "consent", options: { dispatch: "event" } },
|
|
150
|
+
in: fullConsent,
|
|
151
|
+
out: [["elb", "walker consent", fullConsentMapped]]
|
|
152
|
+
};
|
|
153
|
+
var necessaryOnlyChoice = {
|
|
154
|
+
title: "Necessary only",
|
|
155
|
+
description: 'The visitor clicks "Use necessary cookies only". Cookiebot fires CookiebotOnDecline and the source emits functional, analytics and marketing as false.',
|
|
156
|
+
trigger: { type: "consent", options: { dispatch: "event" } },
|
|
157
|
+
in: necessaryOnly,
|
|
158
|
+
out: [["elb", "walker consent", necessaryOnlyMapped]]
|
|
159
|
+
};
|
|
160
|
+
var returningVisitor = {
|
|
161
|
+
title: "Returning visitor",
|
|
162
|
+
description: "Cookiebot already restored a stored choice when the source starts, so the static read at init publishes it at once.",
|
|
163
|
+
trigger: { type: "consent", options: { dispatch: "init" } },
|
|
164
|
+
in: partialConsent,
|
|
165
|
+
out: [["elb", "walker consent", partialConsentMapped]]
|
|
166
|
+
};
|
|
167
|
+
var firstVisit = {
|
|
168
|
+
title: "First visit",
|
|
169
|
+
description: "The banner is still open and Cookiebot holds no response, so the source emits no consent command until the visitor decides.",
|
|
170
|
+
trigger: { type: "consent", options: { dispatch: "init" } },
|
|
171
|
+
in: noResponse,
|
|
172
|
+
out: []
|
|
173
|
+
};
|
|
174
|
+
var impliedSkipped = {
|
|
175
|
+
title: "Implied consent (skipped)",
|
|
176
|
+
description: "Cookiebot consented on its own (consent.method implied), for example outside the regions where the site asks. The default explicitOnly publishes only an explicit decision, so no consent command is emitted, and a visitor Cookiebot never asks never sends one.",
|
|
177
|
+
trigger: { type: "consent", options: { dispatch: "init" } },
|
|
178
|
+
in: impliedConsent,
|
|
179
|
+
out: []
|
|
180
|
+
};
|
|
181
|
+
var impliedAllowed = {
|
|
182
|
+
title: "Implied consent (explicitOnly off)",
|
|
183
|
+
description: "With explicitOnly set to false the source follows the consent Cookiebot implied and grants every group.",
|
|
184
|
+
trigger: { type: "consent", options: { dispatch: "init" } },
|
|
185
|
+
in: impliedConsent,
|
|
186
|
+
mapping: { settings: { explicitOnly: false } },
|
|
187
|
+
out: [["elb", "walker consent", fullConsentMapped]]
|
|
188
|
+
};
|
|
189
|
+
var categoryMapOverride = {
|
|
190
|
+
title: "Category map override",
|
|
191
|
+
description: "A custom categoryMap reports Cookiebot statistics as a statistics group instead of analytics.",
|
|
192
|
+
trigger: { type: "consent", options: { dispatch: "init" } },
|
|
193
|
+
in: partialConsent,
|
|
194
|
+
mapping: { settings: { categoryMap: { statistics: "statistics" } } },
|
|
195
|
+
out: [["elb", "walker consent", partialConsentCustomMapped]]
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/examples/trigger.ts
|
|
199
|
+
var import_collector = require("@walkeros/collector");
|
|
200
|
+
var createTrigger = async (config) => {
|
|
201
|
+
let flow;
|
|
202
|
+
const trigger = (_type, opts) => async (content) => {
|
|
203
|
+
var _a;
|
|
204
|
+
if (!isCookiebotState(content))
|
|
205
|
+
throw new Error(
|
|
206
|
+
"Cookiebot trigger content is the window.Cookiebot state: { consent: { necessary, preferences, statistics, marketing, method } }"
|
|
207
|
+
);
|
|
208
|
+
const viaEvent = typeof opts === "object" && opts !== null && "dispatch" in opts && opts.dispatch === "event";
|
|
209
|
+
if (!flow && !viaEvent) Object.assign(window, { Cookiebot: content });
|
|
210
|
+
if (!flow) {
|
|
211
|
+
const result = await (0, import_collector.startFlow)({ ...config, run: (_a = config.run) != null ? _a : true });
|
|
212
|
+
flow = { collector: result.collector, elb: result.elb };
|
|
213
|
+
if (!viaEvent) return;
|
|
214
|
+
}
|
|
215
|
+
Object.assign(window, { Cookiebot: content });
|
|
216
|
+
window.dispatchEvent(
|
|
217
|
+
new Event(
|
|
218
|
+
content.consented ? "CookiebotOnAccept" : "CookiebotOnDecline"
|
|
219
|
+
)
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
return {
|
|
223
|
+
get flow() {
|
|
224
|
+
return flow;
|
|
225
|
+
},
|
|
226
|
+
trigger
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
function isCookiebotState(value) {
|
|
230
|
+
return typeof value === "object" && value !== null && "consent" in value && typeof value.consent === "object" && value.consent !== null;
|
|
231
|
+
}
|
|
232
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
233
|
+
0 && (module.exports = {
|
|
234
|
+
createTrigger,
|
|
235
|
+
fullConsent,
|
|
236
|
+
fullConsentMapped,
|
|
237
|
+
impliedConsent,
|
|
238
|
+
necessaryOnly,
|
|
239
|
+
necessaryOnlyMapped,
|
|
240
|
+
noResponse,
|
|
241
|
+
partialConsent,
|
|
242
|
+
partialConsentCustomMapped,
|
|
243
|
+
partialConsentMapped,
|
|
244
|
+
step,
|
|
245
|
+
uppercaseMethod
|
|
246
|
+
});
|