@luwiostack/cookie-consent 0.0.0-stage → 0.2.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 +415 -2
- package/dist/index.cjs +569 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +118 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +118 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +558 -0
- package/dist/index.mjs.map +1 -0
- package/dist/machine-names-DAJioLt5.mjs +102 -0
- package/dist/machine-names-DAJioLt5.mjs.map +1 -0
- package/dist/machine-names-DCujHBVM.cjs +137 -0
- package/dist/machine-names-DCujHBVM.cjs.map +1 -0
- package/dist/react.cjs +124 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +109 -0
- package/dist/react.d.cts.map +1 -0
- package/dist/react.d.mts +109 -0
- package/dist/react.d.mts.map +1 -0
- package/dist/react.mjs +120 -0
- package/dist/react.mjs.map +1 -0
- package/dist/types-ByyibBUg.d.cts +272 -0
- package/dist/types-ByyibBUg.d.cts.map +1 -0
- package/dist/types-ByyibBUg.d.mts +272 -0
- package/dist/types-ByyibBUg.d.mts.map +1 -0
- package/dist/used-vendors-C8uSNIkd.cjs +14 -0
- package/dist/used-vendors-C8uSNIkd.cjs.map +1 -0
- package/dist/used-vendors-Dxk4PZtY.mjs +9 -0
- package/dist/used-vendors-Dxk4PZtY.mjs.map +1 -0
- package/dist/vendors.cjs +619 -0
- package/dist/vendors.cjs.map +1 -0
- package/dist/vendors.d.cts +171 -0
- package/dist/vendors.d.cts.map +1 -0
- package/dist/vendors.d.mts +171 -0
- package/dist/vendors.d.mts.map +1 -0
- package/dist/vendors.mjs +606 -0
- package/dist/vendors.mjs.map +1 -0
- package/package.json +89 -3
package/dist/vendors.cjs
ADDED
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_machine_names = require("./machine-names-DCujHBVM.cjs");
|
|
3
|
+
//#region src/vendors/define-vendor.ts
|
|
4
|
+
/**
|
|
5
|
+
* Define a reusable vendor preset — how every preset in `@luwiostack/cookie-consent/vendors` is built, and
|
|
6
|
+
* the way to package your own (an in-house widget you use across apps). Cookie names are inferred as
|
|
7
|
+
* literals, so the preset's `cookies` option only accepts names it declares.
|
|
8
|
+
*
|
|
9
|
+
* Translation keys follow the package catalogs: `t(vendor.machine_name)` is the vendor's name and
|
|
10
|
+
* `t(cookie.machine_name)` a cookie's purpose (the vendor's machine name plus the cookie name).
|
|
11
|
+
*
|
|
12
|
+
* @throws {ConsentError} when two cookie names come out as the same machine name.
|
|
13
|
+
*/
|
|
14
|
+
function defineVendor(definition) {
|
|
15
|
+
const { id, privacy_policy_url, transfers } = definition;
|
|
16
|
+
const { machine_name, cookies, transfers: presented } = require_machine_names.toConsentVendor(definition);
|
|
17
|
+
const preset = (options = {}) => {
|
|
18
|
+
let picked = cookies;
|
|
19
|
+
if (options.cookies) {
|
|
20
|
+
const known = new Set(cookies.map((c) => c.name));
|
|
21
|
+
for (const name of options.cookies) if (!known.has(name)) throw new require_machine_names.ConsentError(`Vendor "${id}" has no cookie "${name}" — use \`extra\` to add one.`);
|
|
22
|
+
const wanted = new Set(options.cookies);
|
|
23
|
+
picked = cookies.filter((c) => wanted.has(c.name));
|
|
24
|
+
}
|
|
25
|
+
for (const cookie of options.extra ?? []) {
|
|
26
|
+
const name = cookie?.name;
|
|
27
|
+
if (typeof cookie !== "object" || cookie === null || typeof name !== "string" || name === "") throw new require_machine_names.ConsentError(`Vendor "${id}": every extra cookie needs a non-empty name.`);
|
|
28
|
+
}
|
|
29
|
+
return require_machine_names.toConsentVendor({
|
|
30
|
+
id,
|
|
31
|
+
...privacy_policy_url ? { privacy_policy_url } : {},
|
|
32
|
+
...transfers !== void 0 ? { transfers } : {},
|
|
33
|
+
cookies: [...picked, ...options.extra ?? []]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return Object.assign(preset, {
|
|
37
|
+
id,
|
|
38
|
+
machine_name,
|
|
39
|
+
cookies,
|
|
40
|
+
...presented !== void 0 ? { transfers: presented } : {}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/vendors/google-transfers.ts
|
|
45
|
+
const GOOGLE_TRANSFERS = [
|
|
46
|
+
{
|
|
47
|
+
country: "CL",
|
|
48
|
+
safeguards: ["scc"]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
country: "GB",
|
|
52
|
+
safeguards: ["adequacy"]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
country: "JP",
|
|
56
|
+
safeguards: ["adequacy"]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
country: "MY",
|
|
60
|
+
safeguards: ["scc"]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
country: "SG",
|
|
64
|
+
safeguards: ["scc"]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
country: "TW",
|
|
68
|
+
safeguards: ["scc"]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
country: "US",
|
|
72
|
+
safeguards: ["dpf", "scc"]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
country: "UY",
|
|
76
|
+
safeguards: ["adequacy"]
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/vendors/time.ts
|
|
81
|
+
const MINUTE = 6e4;
|
|
82
|
+
const DAY = 24 * (60 * MINUTE);
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/vendors/google-ads.ts
|
|
85
|
+
const googleAds = /* @__PURE__ */ defineVendor({
|
|
86
|
+
id: "google_ads",
|
|
87
|
+
privacy_policy_url: "https://policies.google.com/privacy",
|
|
88
|
+
transfers: GOOGLE_TRANSFERS,
|
|
89
|
+
cookies: [
|
|
90
|
+
{
|
|
91
|
+
name: "_gcl_au",
|
|
92
|
+
category: "marketing",
|
|
93
|
+
max_age: 90 * DAY
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "_gcl_aw",
|
|
97
|
+
category: "marketing",
|
|
98
|
+
max_age: 90 * DAY
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "_gcl_dc",
|
|
102
|
+
category: "marketing",
|
|
103
|
+
max_age: 90 * DAY
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "_gac_*",
|
|
107
|
+
category: "marketing",
|
|
108
|
+
max_age: 90 * DAY
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "IDE",
|
|
112
|
+
category: "marketing",
|
|
113
|
+
max_age: 390 * DAY,
|
|
114
|
+
domain: ".doubleclick.net"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "test_cookie",
|
|
118
|
+
category: "marketing",
|
|
119
|
+
max_age: 15 * MINUTE,
|
|
120
|
+
domain: ".doubleclick.net"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "ar_debug",
|
|
124
|
+
category: "marketing",
|
|
125
|
+
max_age: 90 * DAY,
|
|
126
|
+
domain: ".doubleclick.net"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/vendors/google-analytics.ts
|
|
132
|
+
const googleAnalytics = /* @__PURE__ */ defineVendor({
|
|
133
|
+
id: "google_analytics",
|
|
134
|
+
privacy_policy_url: "https://policies.google.com/privacy",
|
|
135
|
+
transfers: GOOGLE_TRANSFERS,
|
|
136
|
+
cookies: [{
|
|
137
|
+
name: "_ga",
|
|
138
|
+
category: "statistics",
|
|
139
|
+
max_age: 730 * DAY
|
|
140
|
+
}, {
|
|
141
|
+
name: "_ga_*",
|
|
142
|
+
category: "statistics",
|
|
143
|
+
max_age: 730 * DAY
|
|
144
|
+
}]
|
|
145
|
+
});
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/vendors/google-maps.ts
|
|
148
|
+
const googleMaps = /* @__PURE__ */ defineVendor({
|
|
149
|
+
id: "google_maps",
|
|
150
|
+
privacy_policy_url: "https://policies.google.com/privacy",
|
|
151
|
+
transfers: GOOGLE_TRANSFERS,
|
|
152
|
+
cookies: [
|
|
153
|
+
{
|
|
154
|
+
name: "NID",
|
|
155
|
+
category: "marketing",
|
|
156
|
+
max_age: 180 * DAY,
|
|
157
|
+
domain: ".google.com"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "AEC",
|
|
161
|
+
category: "necessary",
|
|
162
|
+
max_age: 180 * DAY,
|
|
163
|
+
domain: ".google.com"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "SOCS",
|
|
167
|
+
category: "necessary",
|
|
168
|
+
max_age: 390 * DAY,
|
|
169
|
+
domain: ".google.com"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/vendors/google-recaptcha.ts
|
|
175
|
+
const googleRecaptcha = /* @__PURE__ */ defineVendor({
|
|
176
|
+
id: "google_recaptcha",
|
|
177
|
+
privacy_policy_url: "https://policies.google.com/privacy",
|
|
178
|
+
transfers: GOOGLE_TRANSFERS,
|
|
179
|
+
cookies: [{
|
|
180
|
+
name: "_GRECAPTCHA",
|
|
181
|
+
category: "necessary",
|
|
182
|
+
max_age: 180 * DAY,
|
|
183
|
+
domain: "www.google.com"
|
|
184
|
+
}]
|
|
185
|
+
});
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/vendors/hotjar.ts
|
|
188
|
+
const hotjar = /* @__PURE__ */ defineVendor({
|
|
189
|
+
id: "hotjar",
|
|
190
|
+
privacy_policy_url: "https://www.hotjar.com/legal/policies/privacy/",
|
|
191
|
+
transfers: [{
|
|
192
|
+
country: "GB",
|
|
193
|
+
safeguards: ["scc"]
|
|
194
|
+
}],
|
|
195
|
+
cookies: [
|
|
196
|
+
{
|
|
197
|
+
name: "_hjSessionUser_*",
|
|
198
|
+
category: "statistics",
|
|
199
|
+
max_age: 365 * DAY
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "_hjSession_*",
|
|
203
|
+
category: "statistics",
|
|
204
|
+
max_age: 30 * MINUTE
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "_hjHasCachedUserAttributes",
|
|
208
|
+
category: "statistics",
|
|
209
|
+
max_age: "session"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "_hjUserAttributesHash",
|
|
213
|
+
category: "statistics",
|
|
214
|
+
max_age: 2 * MINUTE
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "_hjUserAttributes",
|
|
218
|
+
category: "statistics",
|
|
219
|
+
type: "local_storage",
|
|
220
|
+
max_age: "persistent"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: "hjViewportId",
|
|
224
|
+
category: "statistics",
|
|
225
|
+
type: "session_storage",
|
|
226
|
+
max_age: "session"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: "hjActiveViewportIds",
|
|
230
|
+
category: "statistics",
|
|
231
|
+
type: "local_storage",
|
|
232
|
+
max_age: "session"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "_hjDonePolls",
|
|
236
|
+
category: "statistics",
|
|
237
|
+
max_age: 365 * DAY
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
});
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/vendors/linkedin-insight.ts
|
|
243
|
+
const linkedinInsight = /* @__PURE__ */ defineVendor({
|
|
244
|
+
id: "linkedin_insight",
|
|
245
|
+
privacy_policy_url: "https://www.linkedin.com/legal/privacy-policy",
|
|
246
|
+
transfers: [{
|
|
247
|
+
country: "US",
|
|
248
|
+
safeguards: ["dpf", "scc"]
|
|
249
|
+
}],
|
|
250
|
+
cookies: [
|
|
251
|
+
{
|
|
252
|
+
name: "li_fat_id",
|
|
253
|
+
category: "marketing",
|
|
254
|
+
max_age: 30 * DAY
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "ln_or",
|
|
258
|
+
category: "marketing",
|
|
259
|
+
max_age: DAY
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: "bcookie",
|
|
263
|
+
category: "marketing",
|
|
264
|
+
max_age: 365 * DAY,
|
|
265
|
+
domain: ".linkedin.com"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "lidc",
|
|
269
|
+
category: "marketing",
|
|
270
|
+
max_age: DAY,
|
|
271
|
+
domain: ".linkedin.com"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: "li_sugr",
|
|
275
|
+
category: "marketing",
|
|
276
|
+
max_age: 90 * DAY,
|
|
277
|
+
domain: ".linkedin.com"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "UserMatchHistory",
|
|
281
|
+
category: "marketing",
|
|
282
|
+
max_age: 30 * DAY,
|
|
283
|
+
domain: ".linkedin.com"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "AnalyticsSyncHistory",
|
|
287
|
+
category: "marketing",
|
|
288
|
+
max_age: 30 * DAY,
|
|
289
|
+
domain: ".linkedin.com"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "li_gc",
|
|
293
|
+
category: "necessary",
|
|
294
|
+
max_age: 180 * DAY,
|
|
295
|
+
domain: ".linkedin.com"
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
});
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/vendors/meta-pixel.ts
|
|
301
|
+
const metaPixel = /* @__PURE__ */ defineVendor({
|
|
302
|
+
id: "meta_pixel",
|
|
303
|
+
privacy_policy_url: "https://www.facebook.com/privacy/policy/",
|
|
304
|
+
transfers: [
|
|
305
|
+
{
|
|
306
|
+
country: "AR",
|
|
307
|
+
safeguards: ["adequacy"]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
country: "CA",
|
|
311
|
+
safeguards: ["adequacy"]
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
country: "CH",
|
|
315
|
+
safeguards: ["adequacy"]
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
country: "GB",
|
|
319
|
+
safeguards: ["adequacy"]
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
country: "IL",
|
|
323
|
+
safeguards: ["adequacy"]
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
country: "NZ",
|
|
327
|
+
safeguards: ["adequacy"]
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
country: "US",
|
|
331
|
+
safeguards: ["dpf"]
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
cookies: [
|
|
335
|
+
{
|
|
336
|
+
name: "_fbp",
|
|
337
|
+
category: "marketing",
|
|
338
|
+
max_age: 90 * DAY
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "_fbc",
|
|
342
|
+
category: "marketing",
|
|
343
|
+
max_age: 90 * DAY
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: "fr",
|
|
347
|
+
category: "marketing",
|
|
348
|
+
max_age: 90 * DAY,
|
|
349
|
+
domain: ".facebook.com"
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
});
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/vendors/tiktok-pixel.ts
|
|
355
|
+
const tiktokPixel = /* @__PURE__ */ defineVendor({
|
|
356
|
+
id: "tiktok_pixel",
|
|
357
|
+
privacy_policy_url: "https://www.tiktok.com/legal/page/eea/privacy-policy/en",
|
|
358
|
+
transfers: [
|
|
359
|
+
{
|
|
360
|
+
country: "AU",
|
|
361
|
+
safeguards: ["scc"]
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
country: "BR",
|
|
365
|
+
safeguards: ["scc"]
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
country: "CA",
|
|
369
|
+
safeguards: ["adequacy"]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
country: "CN",
|
|
373
|
+
safeguards: ["scc"]
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
country: "GB",
|
|
377
|
+
safeguards: ["adequacy"]
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
country: "IL",
|
|
381
|
+
safeguards: ["adequacy"]
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
country: "JP",
|
|
385
|
+
safeguards: ["adequacy"]
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
country: "KR",
|
|
389
|
+
safeguards: ["adequacy"]
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
country: "MY",
|
|
393
|
+
safeguards: ["scc"]
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
country: "PH",
|
|
397
|
+
safeguards: ["scc"]
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
country: "SG",
|
|
401
|
+
safeguards: ["scc"]
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
country: "US",
|
|
405
|
+
safeguards: ["scc"]
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
cookies: [
|
|
409
|
+
{
|
|
410
|
+
name: "_ttp",
|
|
411
|
+
category: "marketing",
|
|
412
|
+
max_age: 390 * DAY
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
name: "ttcsid*",
|
|
416
|
+
category: "marketing",
|
|
417
|
+
max_age: 390 * DAY
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: "ttclid",
|
|
421
|
+
category: "marketing",
|
|
422
|
+
max_age: 390 * DAY
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: "_pangle",
|
|
426
|
+
category: "marketing",
|
|
427
|
+
max_age: 390 * DAY,
|
|
428
|
+
domain: "analytics.pangle-ads.com"
|
|
429
|
+
}
|
|
430
|
+
]
|
|
431
|
+
});
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/vendors/vimeo.ts
|
|
434
|
+
const vimeo = /* @__PURE__ */ defineVendor({
|
|
435
|
+
id: "vimeo",
|
|
436
|
+
privacy_policy_url: "https://vimeo.com/privacy",
|
|
437
|
+
transfers: [{
|
|
438
|
+
country: "US",
|
|
439
|
+
safeguards: ["dpf", "scc"]
|
|
440
|
+
}],
|
|
441
|
+
cookies: [
|
|
442
|
+
{
|
|
443
|
+
name: "vuid",
|
|
444
|
+
category: "statistics",
|
|
445
|
+
max_age: 730 * DAY,
|
|
446
|
+
domain: ".vimeo.com"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: "player",
|
|
450
|
+
category: "preferences",
|
|
451
|
+
max_age: 365 * DAY,
|
|
452
|
+
domain: ".vimeo.com"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: "player_clearance",
|
|
456
|
+
category: "necessary",
|
|
457
|
+
max_age: 7 * DAY,
|
|
458
|
+
domain: ".vimeo.com"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
name: "__cf_bm",
|
|
462
|
+
category: "necessary",
|
|
463
|
+
max_age: 30 * MINUTE,
|
|
464
|
+
domain: ".vimeo.com"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
name: "_cfuvid",
|
|
468
|
+
category: "necessary",
|
|
469
|
+
max_age: "session",
|
|
470
|
+
domain: ".vimeo.com"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "cf_clearance",
|
|
474
|
+
category: "necessary",
|
|
475
|
+
max_age: 365 * DAY,
|
|
476
|
+
domain: ".vimeo.com"
|
|
477
|
+
}
|
|
478
|
+
]
|
|
479
|
+
});
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/vendors/youtube.ts
|
|
482
|
+
const youtube = /* @__PURE__ */ defineVendor({
|
|
483
|
+
id: "youtube",
|
|
484
|
+
privacy_policy_url: "https://policies.google.com/privacy",
|
|
485
|
+
transfers: GOOGLE_TRANSFERS,
|
|
486
|
+
cookies: [
|
|
487
|
+
{
|
|
488
|
+
name: "YSC",
|
|
489
|
+
category: "marketing",
|
|
490
|
+
max_age: "session",
|
|
491
|
+
domain: ".youtube.com"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: "__Secure-YNID",
|
|
495
|
+
category: "marketing",
|
|
496
|
+
max_age: 180 * DAY,
|
|
497
|
+
domain: ".youtube.com"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: "VISITOR_INFO1_LIVE",
|
|
501
|
+
category: "marketing",
|
|
502
|
+
max_age: 180 * DAY,
|
|
503
|
+
domain: ".youtube.com"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: "__Secure-YENID",
|
|
507
|
+
category: "marketing",
|
|
508
|
+
max_age: 390 * DAY,
|
|
509
|
+
domain: ".youtube.com"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: "__Secure-ROLLOUT_TOKEN",
|
|
513
|
+
category: "marketing",
|
|
514
|
+
max_age: 180 * DAY,
|
|
515
|
+
domain: ".youtube.com"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "PREF",
|
|
519
|
+
category: "preferences",
|
|
520
|
+
max_age: 240 * DAY,
|
|
521
|
+
domain: ".youtube.com"
|
|
522
|
+
}
|
|
523
|
+
]
|
|
524
|
+
});
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/vendors/presets.ts
|
|
527
|
+
/**
|
|
528
|
+
* Every preset by its id — for when the set of vendors is decided at runtime (a backend that turns
|
|
529
|
+
* integrations on and off sends `"google_analytics"`, not code). Importing this map bundles every
|
|
530
|
+
* preset; import the named presets instead when your vendors are fixed in code.
|
|
531
|
+
*/
|
|
532
|
+
const vendorPresets = {
|
|
533
|
+
google_analytics: googleAnalytics,
|
|
534
|
+
hotjar,
|
|
535
|
+
google_ads: googleAds,
|
|
536
|
+
meta_pixel: metaPixel,
|
|
537
|
+
linkedin_insight: linkedinInsight,
|
|
538
|
+
tiktok_pixel: tiktokPixel,
|
|
539
|
+
youtube,
|
|
540
|
+
vimeo,
|
|
541
|
+
google_maps: googleMaps,
|
|
542
|
+
google_recaptcha: googleRecaptcha
|
|
543
|
+
};
|
|
544
|
+
//#endregion
|
|
545
|
+
//#region src/vendors/from-data.ts
|
|
546
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
547
|
+
function presetFor(id, where) {
|
|
548
|
+
if (typeof id === "string" && Object.hasOwn(vendorPresets, id)) return vendorPresets[id];
|
|
549
|
+
throw new require_machine_names.ConsentError(`${where}: unknown vendor preset "${String(id)}".`);
|
|
550
|
+
}
|
|
551
|
+
function vendorFromData(raw, where) {
|
|
552
|
+
if (typeof raw === "string") return presetFor(raw, where)();
|
|
553
|
+
if (!isObject(raw)) throw new require_machine_names.ConsentError(`${where}: must be a preset id or an object.`);
|
|
554
|
+
if ("preset" in raw) {
|
|
555
|
+
const preset = presetFor(raw.preset, where);
|
|
556
|
+
if (raw.cookies !== void 0 && !Array.isArray(raw.cookies)) throw new require_machine_names.ConsentError(`${where} ("${raw.preset}"): cookies must be an array of names.`);
|
|
557
|
+
if (raw.extra !== void 0 && !Array.isArray(raw.extra)) throw new require_machine_names.ConsentError(`${where} ("${raw.preset}"): extra must be an array of cookies.`);
|
|
558
|
+
return preset({
|
|
559
|
+
cookies: raw.cookies,
|
|
560
|
+
extra: raw.extra
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
return raw;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Turn backend data into `createConsent` options: per category, preset ids and references become
|
|
567
|
+
* full vendor declarations (from `vendorPresets`); full declarations pass through. Pass the app's
|
|
568
|
+
* own strictly necessary vendors as `necessary`, then spread the result and add what else only the
|
|
569
|
+
* app knows:
|
|
570
|
+
*
|
|
571
|
+
* ```ts
|
|
572
|
+
* const consent = createConsent({
|
|
573
|
+
* ...consentConfigFromData(config.consent, { necessary: [mySite] }),
|
|
574
|
+
* onChange,
|
|
575
|
+
* })
|
|
576
|
+
* ```
|
|
577
|
+
*
|
|
578
|
+
* Checks the shape as it goes — the data comes over the wire — and `createConsent` then validates
|
|
579
|
+
* the rest (a vendor without cookies of its category, cookie names, lifetimes).
|
|
580
|
+
*
|
|
581
|
+
* @throws {ConsentError} for a malformed shape, an unknown category or preset, a cookie a preset
|
|
582
|
+
* doesn't declare, or — when the app passes `necessary` — a `necessary` category in the data.
|
|
583
|
+
*/
|
|
584
|
+
function consentConfigFromData(data, options = {}) {
|
|
585
|
+
if (!isObject(data)) throw new require_machine_names.ConsentError("Consent config data must be an object.");
|
|
586
|
+
if (!isObject(data.categories)) throw new require_machine_names.ConsentError("Consent config data needs a \"categories\" object.");
|
|
587
|
+
const categories = {};
|
|
588
|
+
if (options.necessary !== void 0) {
|
|
589
|
+
if (Object.hasOwn(data.categories, "necessary")) throw new require_machine_names.ConsentError(`Consent config data may not list "${require_machine_names.REQUIRED_CATEGORY}": the app declares its strictly necessary vendors itself.`);
|
|
590
|
+
if (!Array.isArray(options.necessary)) throw new require_machine_names.ConsentError(`The app's "${require_machine_names.REQUIRED_CATEGORY}" vendors must be an array.`);
|
|
591
|
+
categories[require_machine_names.REQUIRED_CATEGORY] = options.necessary;
|
|
592
|
+
}
|
|
593
|
+
for (const [id, list] of Object.entries(data.categories)) {
|
|
594
|
+
if (!require_machine_names.isConsentCategoryId(id)) throw new require_machine_names.ConsentError(`Unknown consent category "${id}".`);
|
|
595
|
+
if (!Array.isArray(list)) throw new require_machine_names.ConsentError(`Category "${id}": vendors must be an array.`);
|
|
596
|
+
categories[id] = list.map((raw, index) => vendorFromData(raw, `Category "${id}", vendor #${index + 1}`));
|
|
597
|
+
}
|
|
598
|
+
return {
|
|
599
|
+
categories,
|
|
600
|
+
...data.policy_version !== void 0 ? { policyVersion: data.policy_version } : {},
|
|
601
|
+
...data.max_age !== void 0 ? { maxAge: data.max_age } : {}
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
//#endregion
|
|
605
|
+
exports.consentConfigFromData = consentConfigFromData;
|
|
606
|
+
exports.defineVendor = defineVendor;
|
|
607
|
+
exports.googleAds = googleAds;
|
|
608
|
+
exports.googleAnalytics = googleAnalytics;
|
|
609
|
+
exports.googleMaps = googleMaps;
|
|
610
|
+
exports.googleRecaptcha = googleRecaptcha;
|
|
611
|
+
exports.hotjar = hotjar;
|
|
612
|
+
exports.linkedinInsight = linkedinInsight;
|
|
613
|
+
exports.metaPixel = metaPixel;
|
|
614
|
+
exports.tiktokPixel = tiktokPixel;
|
|
615
|
+
exports.vendorPresets = vendorPresets;
|
|
616
|
+
exports.vimeo = vimeo;
|
|
617
|
+
exports.youtube = youtube;
|
|
618
|
+
|
|
619
|
+
//# sourceMappingURL=vendors.cjs.map
|