@luwiostack/cookie-consent 0.1.0 → 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 +150 -27
- package/dist/index.cjs +106 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -52
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -52
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +76 -76
- package/dist/index.mjs.map +1 -1
- 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 +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/{types-BrxRJL4I.d.cts → types-ByyibBUg.d.cts} +90 -16
- package/dist/types-ByyibBUg.d.cts.map +1 -0
- package/dist/{types-BrxRJL4I.d.mts → types-ByyibBUg.d.mts} +90 -16
- package/dist/types-ByyibBUg.d.mts.map +1 -0
- package/dist/vendors.cjs +216 -46
- package/dist/vendors.cjs.map +1 -1
- package/dist/vendors.d.cts +20 -12
- package/dist/vendors.d.cts.map +1 -1
- package/dist/vendors.d.mts +20 -12
- package/dist/vendors.d.mts.map +1 -1
- package/dist/vendors.mjs +204 -34
- package/dist/vendors.mjs.map +1 -1
- package/package.json +3 -4
- package/dist/errors-BqpghFQf.cjs +0 -55
- package/dist/errors-BqpghFQf.cjs.map +0 -1
- package/dist/errors-D2ZIcEYK.mjs +0 -32
- package/dist/errors-D2ZIcEYK.mjs.map +0 -1
- package/dist/types-BrxRJL4I.d.cts.map +0 -1
- package/dist/types-BrxRJL4I.d.mts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-ByyibBUg.d.mts","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BAAsB;;EAEpC,UAAU,KAAK,sBAAsB;;EAErC"}
|
package/dist/vendors.cjs
CHANGED
|
@@ -1,36 +1,82 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_machine_names = require("./machine-names-DCujHBVM.cjs");
|
|
3
3
|
//#region src/vendors/define-vendor.ts
|
|
4
4
|
/**
|
|
5
5
|
* Define a reusable vendor preset — how every preset in `@luwiostack/cookie-consent/vendors` is built, and
|
|
6
6
|
* the way to package your own (an in-house widget you use across apps). Cookie names are inferred as
|
|
7
7
|
* literals, so the preset's `cookies` option only accepts names it declares.
|
|
8
8
|
*
|
|
9
|
-
* Translation keys follow the package catalogs: `t(vendor.
|
|
10
|
-
* `t(
|
|
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.
|
|
11
13
|
*/
|
|
12
14
|
function defineVendor(definition) {
|
|
13
|
-
const { id, privacy_policy_url,
|
|
15
|
+
const { id, privacy_policy_url, transfers } = definition;
|
|
16
|
+
const { machine_name, cookies, transfers: presented } = require_machine_names.toConsentVendor(definition);
|
|
14
17
|
const preset = (options = {}) => {
|
|
15
18
|
let picked = cookies;
|
|
16
19
|
if (options.cookies) {
|
|
17
20
|
const known = new Set(cookies.map((c) => c.name));
|
|
18
|
-
for (const name of options.cookies) if (!known.has(name)) throw new
|
|
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.`);
|
|
19
22
|
const wanted = new Set(options.cookies);
|
|
20
23
|
picked = cookies.filter((c) => wanted.has(c.name));
|
|
21
24
|
}
|
|
22
|
-
|
|
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({
|
|
23
30
|
id,
|
|
24
31
|
...privacy_policy_url ? { privacy_policy_url } : {},
|
|
32
|
+
...transfers !== void 0 ? { transfers } : {},
|
|
25
33
|
cookies: [...picked, ...options.extra ?? []]
|
|
26
|
-
};
|
|
34
|
+
});
|
|
27
35
|
};
|
|
28
36
|
return Object.assign(preset, {
|
|
29
37
|
id,
|
|
30
|
-
|
|
38
|
+
machine_name,
|
|
39
|
+
cookies,
|
|
40
|
+
...presented !== void 0 ? { transfers: presented } : {}
|
|
31
41
|
});
|
|
32
42
|
}
|
|
33
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
|
|
34
80
|
//#region src/vendors/time.ts
|
|
35
81
|
const MINUTE = 6e4;
|
|
36
82
|
const DAY = 24 * (60 * MINUTE);
|
|
@@ -39,6 +85,7 @@ const DAY = 24 * (60 * MINUTE);
|
|
|
39
85
|
const googleAds = /* @__PURE__ */ defineVendor({
|
|
40
86
|
id: "google_ads",
|
|
41
87
|
privacy_policy_url: "https://policies.google.com/privacy",
|
|
88
|
+
transfers: GOOGLE_TRANSFERS,
|
|
42
89
|
cookies: [
|
|
43
90
|
{
|
|
44
91
|
name: "_gcl_au",
|
|
@@ -63,17 +110,20 @@ const googleAds = /* @__PURE__ */ defineVendor({
|
|
|
63
110
|
{
|
|
64
111
|
name: "IDE",
|
|
65
112
|
category: "marketing",
|
|
66
|
-
max_age: 390 * DAY
|
|
113
|
+
max_age: 390 * DAY,
|
|
114
|
+
domain: ".doubleclick.net"
|
|
67
115
|
},
|
|
68
116
|
{
|
|
69
117
|
name: "test_cookie",
|
|
70
118
|
category: "marketing",
|
|
71
|
-
max_age: 15 * MINUTE
|
|
119
|
+
max_age: 15 * MINUTE,
|
|
120
|
+
domain: ".doubleclick.net"
|
|
72
121
|
},
|
|
73
122
|
{
|
|
74
123
|
name: "ar_debug",
|
|
75
124
|
category: "marketing",
|
|
76
|
-
max_age: 90 * DAY
|
|
125
|
+
max_age: 90 * DAY,
|
|
126
|
+
domain: ".doubleclick.net"
|
|
77
127
|
}
|
|
78
128
|
]
|
|
79
129
|
});
|
|
@@ -82,6 +132,7 @@ const googleAds = /* @__PURE__ */ defineVendor({
|
|
|
82
132
|
const googleAnalytics = /* @__PURE__ */ defineVendor({
|
|
83
133
|
id: "google_analytics",
|
|
84
134
|
privacy_policy_url: "https://policies.google.com/privacy",
|
|
135
|
+
transfers: GOOGLE_TRANSFERS,
|
|
85
136
|
cookies: [{
|
|
86
137
|
name: "_ga",
|
|
87
138
|
category: "statistics",
|
|
@@ -97,21 +148,25 @@ const googleAnalytics = /* @__PURE__ */ defineVendor({
|
|
|
97
148
|
const googleMaps = /* @__PURE__ */ defineVendor({
|
|
98
149
|
id: "google_maps",
|
|
99
150
|
privacy_policy_url: "https://policies.google.com/privacy",
|
|
151
|
+
transfers: GOOGLE_TRANSFERS,
|
|
100
152
|
cookies: [
|
|
101
153
|
{
|
|
102
154
|
name: "NID",
|
|
103
155
|
category: "marketing",
|
|
104
|
-
max_age: 180 * DAY
|
|
156
|
+
max_age: 180 * DAY,
|
|
157
|
+
domain: ".google.com"
|
|
105
158
|
},
|
|
106
159
|
{
|
|
107
160
|
name: "AEC",
|
|
108
161
|
category: "necessary",
|
|
109
|
-
max_age: 180 * DAY
|
|
162
|
+
max_age: 180 * DAY,
|
|
163
|
+
domain: ".google.com"
|
|
110
164
|
},
|
|
111
165
|
{
|
|
112
166
|
name: "SOCS",
|
|
113
167
|
category: "necessary",
|
|
114
|
-
max_age: 390 * DAY
|
|
168
|
+
max_age: 390 * DAY,
|
|
169
|
+
domain: ".google.com"
|
|
115
170
|
}
|
|
116
171
|
]
|
|
117
172
|
});
|
|
@@ -120,10 +175,12 @@ const googleMaps = /* @__PURE__ */ defineVendor({
|
|
|
120
175
|
const googleRecaptcha = /* @__PURE__ */ defineVendor({
|
|
121
176
|
id: "google_recaptcha",
|
|
122
177
|
privacy_policy_url: "https://policies.google.com/privacy",
|
|
178
|
+
transfers: GOOGLE_TRANSFERS,
|
|
123
179
|
cookies: [{
|
|
124
180
|
name: "_GRECAPTCHA",
|
|
125
181
|
category: "necessary",
|
|
126
|
-
max_age: 180 * DAY
|
|
182
|
+
max_age: 180 * DAY,
|
|
183
|
+
domain: "www.google.com"
|
|
127
184
|
}]
|
|
128
185
|
});
|
|
129
186
|
//#endregion
|
|
@@ -131,6 +188,10 @@ const googleRecaptcha = /* @__PURE__ */ defineVendor({
|
|
|
131
188
|
const hotjar = /* @__PURE__ */ defineVendor({
|
|
132
189
|
id: "hotjar",
|
|
133
190
|
privacy_policy_url: "https://www.hotjar.com/legal/policies/privacy/",
|
|
191
|
+
transfers: [{
|
|
192
|
+
country: "GB",
|
|
193
|
+
safeguards: ["scc"]
|
|
194
|
+
}],
|
|
134
195
|
cookies: [
|
|
135
196
|
{
|
|
136
197
|
name: "_hjSessionUser_*",
|
|
@@ -182,6 +243,10 @@ const hotjar = /* @__PURE__ */ defineVendor({
|
|
|
182
243
|
const linkedinInsight = /* @__PURE__ */ defineVendor({
|
|
183
244
|
id: "linkedin_insight",
|
|
184
245
|
privacy_policy_url: "https://www.linkedin.com/legal/privacy-policy",
|
|
246
|
+
transfers: [{
|
|
247
|
+
country: "US",
|
|
248
|
+
safeguards: ["dpf", "scc"]
|
|
249
|
+
}],
|
|
185
250
|
cookies: [
|
|
186
251
|
{
|
|
187
252
|
name: "li_fat_id",
|
|
@@ -196,32 +261,38 @@ const linkedinInsight = /* @__PURE__ */ defineVendor({
|
|
|
196
261
|
{
|
|
197
262
|
name: "bcookie",
|
|
198
263
|
category: "marketing",
|
|
199
|
-
max_age: 365 * DAY
|
|
264
|
+
max_age: 365 * DAY,
|
|
265
|
+
domain: ".linkedin.com"
|
|
200
266
|
},
|
|
201
267
|
{
|
|
202
268
|
name: "lidc",
|
|
203
269
|
category: "marketing",
|
|
204
|
-
max_age: DAY
|
|
270
|
+
max_age: DAY,
|
|
271
|
+
domain: ".linkedin.com"
|
|
205
272
|
},
|
|
206
273
|
{
|
|
207
274
|
name: "li_sugr",
|
|
208
275
|
category: "marketing",
|
|
209
|
-
max_age: 90 * DAY
|
|
276
|
+
max_age: 90 * DAY,
|
|
277
|
+
domain: ".linkedin.com"
|
|
210
278
|
},
|
|
211
279
|
{
|
|
212
280
|
name: "UserMatchHistory",
|
|
213
281
|
category: "marketing",
|
|
214
|
-
max_age: 30 * DAY
|
|
282
|
+
max_age: 30 * DAY,
|
|
283
|
+
domain: ".linkedin.com"
|
|
215
284
|
},
|
|
216
285
|
{
|
|
217
286
|
name: "AnalyticsSyncHistory",
|
|
218
287
|
category: "marketing",
|
|
219
|
-
max_age: 30 * DAY
|
|
288
|
+
max_age: 30 * DAY,
|
|
289
|
+
domain: ".linkedin.com"
|
|
220
290
|
},
|
|
221
291
|
{
|
|
222
292
|
name: "li_gc",
|
|
223
293
|
category: "necessary",
|
|
224
|
-
max_age: 180 * DAY
|
|
294
|
+
max_age: 180 * DAY,
|
|
295
|
+
domain: ".linkedin.com"
|
|
225
296
|
}
|
|
226
297
|
]
|
|
227
298
|
});
|
|
@@ -230,6 +301,36 @@ const linkedinInsight = /* @__PURE__ */ defineVendor({
|
|
|
230
301
|
const metaPixel = /* @__PURE__ */ defineVendor({
|
|
231
302
|
id: "meta_pixel",
|
|
232
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
|
+
],
|
|
233
334
|
cookies: [
|
|
234
335
|
{
|
|
235
336
|
name: "_fbp",
|
|
@@ -244,7 +345,8 @@ const metaPixel = /* @__PURE__ */ defineVendor({
|
|
|
244
345
|
{
|
|
245
346
|
name: "fr",
|
|
246
347
|
category: "marketing",
|
|
247
|
-
max_age: 90 * DAY
|
|
348
|
+
max_age: 90 * DAY,
|
|
349
|
+
domain: ".facebook.com"
|
|
248
350
|
}
|
|
249
351
|
]
|
|
250
352
|
});
|
|
@@ -253,6 +355,56 @@ const metaPixel = /* @__PURE__ */ defineVendor({
|
|
|
253
355
|
const tiktokPixel = /* @__PURE__ */ defineVendor({
|
|
254
356
|
id: "tiktok_pixel",
|
|
255
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
|
+
],
|
|
256
408
|
cookies: [
|
|
257
409
|
{
|
|
258
410
|
name: "_ttp",
|
|
@@ -272,7 +424,8 @@ const tiktokPixel = /* @__PURE__ */ defineVendor({
|
|
|
272
424
|
{
|
|
273
425
|
name: "_pangle",
|
|
274
426
|
category: "marketing",
|
|
275
|
-
max_age: 390 * DAY
|
|
427
|
+
max_age: 390 * DAY,
|
|
428
|
+
domain: "analytics.pangle-ads.com"
|
|
276
429
|
}
|
|
277
430
|
]
|
|
278
431
|
});
|
|
@@ -281,36 +434,46 @@ const tiktokPixel = /* @__PURE__ */ defineVendor({
|
|
|
281
434
|
const vimeo = /* @__PURE__ */ defineVendor({
|
|
282
435
|
id: "vimeo",
|
|
283
436
|
privacy_policy_url: "https://vimeo.com/privacy",
|
|
437
|
+
transfers: [{
|
|
438
|
+
country: "US",
|
|
439
|
+
safeguards: ["dpf", "scc"]
|
|
440
|
+
}],
|
|
284
441
|
cookies: [
|
|
285
442
|
{
|
|
286
443
|
name: "vuid",
|
|
287
444
|
category: "statistics",
|
|
288
|
-
max_age: 730 * DAY
|
|
445
|
+
max_age: 730 * DAY,
|
|
446
|
+
domain: ".vimeo.com"
|
|
289
447
|
},
|
|
290
448
|
{
|
|
291
449
|
name: "player",
|
|
292
450
|
category: "preferences",
|
|
293
|
-
max_age: 365 * DAY
|
|
451
|
+
max_age: 365 * DAY,
|
|
452
|
+
domain: ".vimeo.com"
|
|
294
453
|
},
|
|
295
454
|
{
|
|
296
455
|
name: "player_clearance",
|
|
297
456
|
category: "necessary",
|
|
298
|
-
max_age: 7 * DAY
|
|
457
|
+
max_age: 7 * DAY,
|
|
458
|
+
domain: ".vimeo.com"
|
|
299
459
|
},
|
|
300
460
|
{
|
|
301
461
|
name: "__cf_bm",
|
|
302
462
|
category: "necessary",
|
|
303
|
-
max_age: 30 * MINUTE
|
|
463
|
+
max_age: 30 * MINUTE,
|
|
464
|
+
domain: ".vimeo.com"
|
|
304
465
|
},
|
|
305
466
|
{
|
|
306
467
|
name: "_cfuvid",
|
|
307
468
|
category: "necessary",
|
|
308
|
-
max_age: "session"
|
|
469
|
+
max_age: "session",
|
|
470
|
+
domain: ".vimeo.com"
|
|
309
471
|
},
|
|
310
472
|
{
|
|
311
473
|
name: "cf_clearance",
|
|
312
474
|
category: "necessary",
|
|
313
|
-
max_age: 365 * DAY
|
|
475
|
+
max_age: 365 * DAY,
|
|
476
|
+
domain: ".vimeo.com"
|
|
314
477
|
}
|
|
315
478
|
]
|
|
316
479
|
});
|
|
@@ -319,36 +482,43 @@ const vimeo = /* @__PURE__ */ defineVendor({
|
|
|
319
482
|
const youtube = /* @__PURE__ */ defineVendor({
|
|
320
483
|
id: "youtube",
|
|
321
484
|
privacy_policy_url: "https://policies.google.com/privacy",
|
|
485
|
+
transfers: GOOGLE_TRANSFERS,
|
|
322
486
|
cookies: [
|
|
323
487
|
{
|
|
324
488
|
name: "YSC",
|
|
325
489
|
category: "marketing",
|
|
326
|
-
max_age: "session"
|
|
490
|
+
max_age: "session",
|
|
491
|
+
domain: ".youtube.com"
|
|
327
492
|
},
|
|
328
493
|
{
|
|
329
494
|
name: "__Secure-YNID",
|
|
330
495
|
category: "marketing",
|
|
331
|
-
max_age: 180 * DAY
|
|
496
|
+
max_age: 180 * DAY,
|
|
497
|
+
domain: ".youtube.com"
|
|
332
498
|
},
|
|
333
499
|
{
|
|
334
500
|
name: "VISITOR_INFO1_LIVE",
|
|
335
501
|
category: "marketing",
|
|
336
|
-
max_age: 180 * DAY
|
|
502
|
+
max_age: 180 * DAY,
|
|
503
|
+
domain: ".youtube.com"
|
|
337
504
|
},
|
|
338
505
|
{
|
|
339
506
|
name: "__Secure-YENID",
|
|
340
507
|
category: "marketing",
|
|
341
|
-
max_age: 390 * DAY
|
|
508
|
+
max_age: 390 * DAY,
|
|
509
|
+
domain: ".youtube.com"
|
|
342
510
|
},
|
|
343
511
|
{
|
|
344
512
|
name: "__Secure-ROLLOUT_TOKEN",
|
|
345
513
|
category: "marketing",
|
|
346
|
-
max_age: 180 * DAY
|
|
514
|
+
max_age: 180 * DAY,
|
|
515
|
+
domain: ".youtube.com"
|
|
347
516
|
},
|
|
348
517
|
{
|
|
349
518
|
name: "PREF",
|
|
350
519
|
category: "preferences",
|
|
351
|
-
max_age: 240 * DAY
|
|
520
|
+
max_age: 240 * DAY,
|
|
521
|
+
domain: ".youtube.com"
|
|
352
522
|
}
|
|
353
523
|
]
|
|
354
524
|
});
|
|
@@ -376,15 +546,15 @@ const vendorPresets = {
|
|
|
376
546
|
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
377
547
|
function presetFor(id, where) {
|
|
378
548
|
if (typeof id === "string" && Object.hasOwn(vendorPresets, id)) return vendorPresets[id];
|
|
379
|
-
throw new
|
|
549
|
+
throw new require_machine_names.ConsentError(`${where}: unknown vendor preset "${String(id)}".`);
|
|
380
550
|
}
|
|
381
551
|
function vendorFromData(raw, where) {
|
|
382
552
|
if (typeof raw === "string") return presetFor(raw, where)();
|
|
383
|
-
if (!isObject(raw)) throw new
|
|
553
|
+
if (!isObject(raw)) throw new require_machine_names.ConsentError(`${where}: must be a preset id or an object.`);
|
|
384
554
|
if ("preset" in raw) {
|
|
385
555
|
const preset = presetFor(raw.preset, where);
|
|
386
|
-
if (raw.cookies !== void 0 && !Array.isArray(raw.cookies)) throw new
|
|
387
|
-
if (raw.extra !== void 0 && !Array.isArray(raw.extra)) throw new
|
|
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.`);
|
|
388
558
|
return preset({
|
|
389
559
|
cookies: raw.cookies,
|
|
390
560
|
extra: raw.extra
|
|
@@ -412,17 +582,17 @@ function vendorFromData(raw, where) {
|
|
|
412
582
|
* doesn't declare, or — when the app passes `necessary` — a `necessary` category in the data.
|
|
413
583
|
*/
|
|
414
584
|
function consentConfigFromData(data, options = {}) {
|
|
415
|
-
if (!isObject(data)) throw new
|
|
416
|
-
if (!isObject(data.categories)) throw new
|
|
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.");
|
|
417
587
|
const categories = {};
|
|
418
588
|
if (options.necessary !== void 0) {
|
|
419
|
-
if (Object.hasOwn(data.categories, "necessary")) throw new
|
|
420
|
-
if (!Array.isArray(options.necessary)) throw new
|
|
421
|
-
categories[
|
|
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;
|
|
422
592
|
}
|
|
423
593
|
for (const [id, list] of Object.entries(data.categories)) {
|
|
424
|
-
if (!
|
|
425
|
-
if (!Array.isArray(list)) throw new
|
|
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.`);
|
|
426
596
|
categories[id] = list.map((raw, index) => vendorFromData(raw, `Category "${id}", vendor #${index + 1}`));
|
|
427
597
|
}
|
|
428
598
|
return {
|
package/dist/vendors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendors.cjs","names":["ConsentError","ConsentError","REQUIRED_CATEGORY","isConsentCategoryId"],"sources":["../src/vendors/define-vendor.ts","../src/vendors/time.ts","../src/vendors/google-ads.ts","../src/vendors/google-analytics.ts","../src/vendors/google-maps.ts","../src/vendors/google-recaptcha.ts","../src/vendors/hotjar.ts","../src/vendors/linkedin-insight.ts","../src/vendors/meta-pixel.ts","../src/vendors/tiktok-pixel.ts","../src/vendors/vimeo.ts","../src/vendors/youtube.ts","../src/vendors/presets.ts","../src/vendors/from-data.ts"],"sourcesContent":["import { ConsentError } from '../errors'\nimport type { ConsentCookie, ConsentVendor } from '../types'\n\nexport interface VendorPresetOptions<Name extends string = string> {\n /**\n * Only these of the preset's cookies — for when your integration doesn't set them all (e.g. no\n * Google Signals). Default: every cookie in the preset. An unknown name is a type error and throws.\n */\n cookies?: readonly Name[]\n /** Your own cookies on top, for anything this vendor sets in your setup that the preset lacks. */\n extra?: readonly ConsentCookie[]\n}\n\n/** A ready-made vendor: call it (optionally narrowing or extending its cookies) to get a `ConsentVendor`. */\nexport interface VendorPreset<Name extends string = string> {\n (options?: VendorPresetOptions<Name>): ConsentVendor\n /** The vendor id — also the translation key of its name. */\n readonly id: string\n /** Every cookie the preset declares. */\n readonly cookies: readonly ConsentCookie[]\n}\n\nexport interface VendorDefinition<C extends readonly ConsentCookie[]> {\n /** Stable key — also the translation key for the vendor's name, and the prefix of its cookies' keys. */\n id: string\n privacy_policy_url?: string\n cookies: C\n}\n\n/**\n * Define a reusable vendor preset — how every preset in `@luwiostack/cookie-consent/vendors` is built, and\n * the way to package your own (an in-house widget you use across apps). Cookie names are inferred as\n * literals, so the preset's `cookies` option only accepts names it declares.\n *\n * Translation keys follow the package catalogs: `t(vendor.id)` is the vendor's name and\n * `t(\\`${vendor.id}.${cookie.name}\\`)` a cookie's purpose.\n */\nexport function defineVendor<const C extends readonly ConsentCookie[]>(\n definition: VendorDefinition<C>,\n): VendorPreset<C[number]['name']> {\n const { id, privacy_policy_url, cookies } = definition\n const preset = (options: VendorPresetOptions<C[number]['name']> = {}): ConsentVendor => {\n let picked: readonly ConsentCookie[] = cookies\n if (options.cookies) {\n const known = new Set(cookies.map((c) => c.name))\n for (const name of options.cookies) {\n if (!known.has(name)) {\n throw new ConsentError(\n `Vendor \"${id}\" has no cookie \"${name}\" — use \\`extra\\` to add one.`,\n )\n }\n }\n const wanted = new Set<string>(options.cookies)\n picked = cookies.filter((c) => wanted.has(c.name))\n }\n return {\n id,\n ...(privacy_policy_url ? { privacy_policy_url } : {}),\n cookies: [...picked, ...(options.extra ?? [])],\n }\n }\n return Object.assign(preset, { id, cookies })\n}\n","// Lifetimes in the presets are milliseconds, like every duration in @luwiostack/cookie-consent.\nexport const MINUTE = 60 * 1000\nexport const HOUR = 60 * MINUTE\nexport const DAY = 24 * HOUR\n","import { defineVendor } from './define-vendor'\nimport { DAY, MINUTE } from './time'\n\n// Google Ads — the cookies a standard integration sets for visitors.\n// Sources:\n// https://business.safety.google/adscookies/\n// https://policies.google.com/technologies/cookies\n// Note: IDE is 13 months in the EEA, Switzerland and UK (24 months elsewhere). _gac_* is only set when Google\n// Analytics is linked to Google Ads.\nexport const googleAds = /* @__PURE__ */ defineVendor({\n id: 'google_ads',\n privacy_policy_url: 'https://policies.google.com/privacy',\n cookies: [\n { name: '_gcl_au', category: 'marketing', max_age: 90 * DAY },\n { name: '_gcl_aw', category: 'marketing', max_age: 90 * DAY },\n { name: '_gcl_dc', category: 'marketing', max_age: 90 * DAY },\n { name: '_gac_*', category: 'marketing', max_age: 90 * DAY },\n { name: 'IDE', category: 'marketing', max_age: 390 * DAY },\n { name: 'test_cookie', category: 'marketing', max_age: 15 * MINUTE },\n { name: 'ar_debug', category: 'marketing', max_age: 90 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// Google Analytics — the cookies a standard integration sets for visitors.\n// Sources:\n// https://support.google.com/analytics/answer/11397207\n// https://business.safety.google/adscookies/\n// https://policies.google.com/technologies/cookies\nexport const googleAnalytics = /* @__PURE__ */ defineVendor({\n id: 'google_analytics',\n privacy_policy_url: 'https://policies.google.com/privacy',\n cookies: [\n { name: '_ga', category: 'statistics', max_age: 730 * DAY },\n { name: '_ga_*', category: 'statistics', max_age: 730 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// Google Maps — the cookies a standard integration sets for visitors.\n// Sources:\n// https://policies.google.com/technologies/cookies\n// https://policies.google.com/technologies/cookies/embedded?hl=en\n// Note: Google publishes no list for Maps embeds; these are the general google.com cookies from \"How Google\n// uses cookies\". What's set depends on the visitor's existing Google cookies, sign-in and region.\nexport const googleMaps = /* @__PURE__ */ defineVendor({\n id: 'google_maps',\n privacy_policy_url: 'https://policies.google.com/privacy',\n cookies: [\n { name: 'NID', category: 'marketing', max_age: 180 * DAY },\n { name: 'AEC', category: 'necessary', max_age: 180 * DAY },\n { name: 'SOCS', category: 'necessary', max_age: 390 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// Google reCAPTCHA — the cookies a standard integration sets for visitors.\n// Sources:\n// https://developers.google.com/recaptcha/docs/faq\n// https://cookiedatabase.org/cookie/google-recaptcha/_grecaptcha/\n// Note: Google documents _GRECAPTCHA's name and purpose, not its lifetime — 6 months is from Cookiedatabase.org.\nexport const googleRecaptcha = /* @__PURE__ */ defineVendor({\n id: 'google_recaptcha',\n privacy_policy_url: 'https://policies.google.com/privacy',\n cookies: [{ name: '_GRECAPTCHA', category: 'necessary', max_age: 180 * DAY }],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY, MINUTE } from './time'\n\n// Hotjar — the cookies a standard integration sets for visitors.\n// Sources:\n// https://help.hotjar.com/hc/en-us/articles/36819973371409-Cookies-Set-by-the-Hotjar-Tracking-Code\n// Note: Short-lived test cookies and two survey cookies are left out.\nexport const hotjar = /* @__PURE__ */ defineVendor({\n id: 'hotjar',\n privacy_policy_url: 'https://www.hotjar.com/legal/policies/privacy/',\n cookies: [\n { name: '_hjSessionUser_*', category: 'statistics', max_age: 365 * DAY },\n { name: '_hjSession_*', category: 'statistics', max_age: 30 * MINUTE },\n { name: '_hjHasCachedUserAttributes', category: 'statistics', max_age: 'session' },\n { name: '_hjUserAttributesHash', category: 'statistics', max_age: 2 * MINUTE },\n {\n name: '_hjUserAttributes',\n category: 'statistics',\n type: 'local_storage',\n max_age: 'persistent',\n },\n { name: 'hjViewportId', category: 'statistics', type: 'session_storage', max_age: 'session' },\n {\n name: 'hjActiveViewportIds',\n category: 'statistics',\n type: 'local_storage',\n max_age: 'session',\n },\n { name: '_hjDonePolls', category: 'statistics', max_age: 365 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// LinkedIn Insight Tag — the cookies a standard integration sets for visitors.\n// Sources:\n// https://www.linkedin.com/legal/l/cookie-table\n// Note: The logged-in-only bscookie and _guid (LinkedIn's own Google Ads) are left out.\nexport const linkedinInsight = /* @__PURE__ */ defineVendor({\n id: 'linkedin_insight',\n privacy_policy_url: 'https://www.linkedin.com/legal/privacy-policy',\n cookies: [\n { name: 'li_fat_id', category: 'marketing', max_age: 30 * DAY },\n { name: 'ln_or', category: 'marketing', max_age: DAY },\n { name: 'bcookie', category: 'marketing', max_age: 365 * DAY },\n { name: 'lidc', category: 'marketing', max_age: DAY },\n { name: 'li_sugr', category: 'marketing', max_age: 90 * DAY },\n { name: 'UserMatchHistory', category: 'marketing', max_age: 30 * DAY },\n { name: 'AnalyticsSyncHistory', category: 'marketing', max_age: 30 * DAY },\n { name: 'li_gc', category: 'necessary', max_age: 180 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// Meta Pixel — the cookies a standard integration sets for visitors.\n// Sources:\n// https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc/\n// https://www.facebook.com/policies/cookies/\n// https://web.archive.org/web/20220522135037/https://www.facebook.com/policies/cookies\n// Note: Meta's current cookie policy names no cookies; the 90-day lifetimes of _fbp / fr come from earlier\n// versions of Meta's own policy, and _fbc's from Meta's Conversions API docs.\nexport const metaPixel = /* @__PURE__ */ defineVendor({\n id: 'meta_pixel',\n privacy_policy_url: 'https://www.facebook.com/privacy/policy/',\n cookies: [\n { name: '_fbp', category: 'marketing', max_age: 90 * DAY },\n { name: '_fbc', category: 'marketing', max_age: 90 * DAY },\n { name: 'fr', category: 'marketing', max_age: 90 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// TikTok Pixel — the cookies a standard integration sets for visitors.\n// Sources:\n// https://ads.tiktok.com/help/article/using-cookies-with-tiktok-pixel\n// Note: TikTok's lifetimes are 13 months from last use (rolling). ttcsid* covers ttcsid and ttcsid_<pixel code>.\nexport const tiktokPixel = /* @__PURE__ */ defineVendor({\n id: 'tiktok_pixel',\n privacy_policy_url: 'https://www.tiktok.com/legal/page/eea/privacy-policy/en',\n cookies: [\n { name: '_ttp', category: 'marketing', max_age: 390 * DAY },\n { name: 'ttcsid*', category: 'marketing', max_age: 390 * DAY },\n { name: 'ttclid', category: 'marketing', max_age: 390 * DAY },\n { name: '_pangle', category: 'marketing', max_age: 390 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY, MINUTE } from './time'\n\n// Vimeo — the cookies a standard integration sets for visitors.\n// Sources:\n// https://help.vimeo.com/hc/en-us/articles/26080940921361-Vimeo-Player-Cookies\n// https://vimeo.com/cookie_policy\n// Note: Feature-specific cookies (passwords, webinars, live chat) are left out; Cloudflare's __cf_bm / _cfuvid /\n// cf_clearance come from Vimeo's own player-cookie article.\nexport const vimeo = /* @__PURE__ */ defineVendor({\n id: 'vimeo',\n privacy_policy_url: 'https://vimeo.com/privacy',\n cookies: [\n { name: 'vuid', category: 'statistics', max_age: 730 * DAY },\n { name: 'player', category: 'preferences', max_age: 365 * DAY },\n { name: 'player_clearance', category: 'necessary', max_age: 7 * DAY },\n { name: '__cf_bm', category: 'necessary', max_age: 30 * MINUTE },\n { name: '_cfuvid', category: 'necessary', max_age: 'session' },\n { name: 'cf_clearance', category: 'necessary', max_age: 365 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// YouTube — the cookies a standard integration sets for visitors.\n// Sources:\n// https://policies.google.com/technologies/cookies\n// https://business.safety.google/adscookies/\n// https://support.google.com/youtube/answer/171780\n// https://cookiedatabase.org/\n// Note: Google is moving VISITOR_INFO1_LIVE to __Secure-YNID, so both are listed. youtube-nocookie.com still\n// uses storage, so treat it as needing consent too.\nexport const youtube = /* @__PURE__ */ defineVendor({\n id: 'youtube',\n privacy_policy_url: 'https://policies.google.com/privacy',\n cookies: [\n { name: 'YSC', category: 'marketing', max_age: 'session' },\n { name: '__Secure-YNID', category: 'marketing', max_age: 180 * DAY },\n { name: 'VISITOR_INFO1_LIVE', category: 'marketing', max_age: 180 * DAY },\n { name: '__Secure-YENID', category: 'marketing', max_age: 390 * DAY },\n { name: '__Secure-ROLLOUT_TOKEN', category: 'marketing', max_age: 180 * DAY },\n { name: 'PREF', category: 'preferences', max_age: 240 * DAY },\n ],\n})\n","import { googleAds } from './google-ads'\nimport { googleAnalytics } from './google-analytics'\nimport { googleMaps } from './google-maps'\nimport { googleRecaptcha } from './google-recaptcha'\nimport { hotjar } from './hotjar'\nimport { linkedinInsight } from './linkedin-insight'\nimport { metaPixel } from './meta-pixel'\nimport { tiktokPixel } from './tiktok-pixel'\nimport { vimeo } from './vimeo'\nimport { youtube } from './youtube'\n\n/**\n * Every preset by its id — for when the set of vendors is decided at runtime (a backend that turns\n * integrations on and off sends `\"google_analytics\"`, not code). Importing this map bundles every\n * preset; import the named presets instead when your vendors are fixed in code.\n */\nexport const vendorPresets = {\n google_analytics: googleAnalytics,\n hotjar,\n google_ads: googleAds,\n meta_pixel: metaPixel,\n linkedin_insight: linkedinInsight,\n tiktok_pixel: tiktokPixel,\n youtube,\n vimeo,\n google_maps: googleMaps,\n google_recaptcha: googleRecaptcha,\n} as const\n\n/** The id of a shipped preset — `'google_analytics'`, `'meta_pixel'`, … */\nexport type VendorPresetId = keyof typeof vendorPresets\n","import { type ConsentCategoryId, isConsentCategoryId, REQUIRED_CATEGORY } from '../categories'\nimport { ConsentError } from '../errors'\nimport type { ConsentCategoriesConfig, ConsentCookie, ConsentVendor } from '../types'\nimport { type VendorPresetId, vendorPresets } from './presets'\n\n/**\n * The serializable consent config — what a backend sends when it decides which integrations are on\n * (a back office where an admin enables Google Analytics, or the YouTube embed without tracking).\n * JSON only: per category, the vendors used in it — a preset id, a preset reference narrowed or\n * extended, or a full declaration when there's no preset. A vendor brings only its cookies of the\n * category it's listed under (plus its necessary ones). snake_case, like every dataset.\n *\n * ```json\n * {\n * \"policy_version\": 7,\n * \"categories\": {\n * \"statistics\": [\"google_analytics\"],\n * \"preferences\": [\"youtube\"],\n * \"marketing\": [\n * { \"preset\": \"google_ads\", \"cookies\": [\"_gcl_au\", \"IDE\"] },\n * { \"id\": \"acme_chat\", \"cookies\": [{ \"name\": \"acme_id\", \"category\": \"marketing\", \"max_age\": 31536000000 }] }\n * ]\n * }\n * }\n * ```\n */\nexport interface ConsentConfigData {\n /** Bump it whenever the set of vendors changes, so every visitor is asked again. Default `1`. */\n policy_version?: string | number\n /** How long a decision stays valid, in milliseconds. Default: 365 days. */\n max_age?: number\n /** Per category, the vendors used in it. */\n categories: Partial<Record<ConsentCategoryId, readonly ConsentVendorData[]>>\n}\n\n/** A vendor in the data: a preset id, a preset reference, or a full declaration of your own. */\nexport type ConsentVendorData = VendorPresetId | ConsentPresetVendorData | ConsentVendor\n\n/** A shipped preset by id, optionally narrowed (`cookies`) or extended (`extra`). */\nexport interface ConsentPresetVendorData {\n preset: VendorPresetId\n cookies?: readonly string[]\n extra?: readonly ConsentCookie[]\n}\n\n/** The part of `createConsent`'s config that data describes. */\nexport interface ConsentConfigFromData {\n categories: ConsentCategoriesConfig\n policyVersion?: string | number\n maxAge?: number\n}\n\n/** What only the app knows, merged into the data's config. */\nexport interface ConsentConfigFromDataOptions {\n /**\n * The app's own strictly necessary vendors (its session cookie, CSRF token, the consent record),\n * declared in code. Put under `necessary`, ahead of the data's categories. Once the app declares\n * them, the data may not list `necessary` itself: strictly necessary cookies are the app's to\n * declare, never the backend's.\n */\n necessary?: readonly ConsentVendor[]\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nfunction presetFor(id: unknown, where: string) {\n if (typeof id === 'string' && Object.hasOwn(vendorPresets, id)) {\n return vendorPresets[id as VendorPresetId] as (\n options?: Record<string, unknown>,\n ) => ConsentVendor\n }\n throw new ConsentError(`${where}: unknown vendor preset \"${String(id)}\".`)\n}\n\nfunction vendorFromData(raw: unknown, where: string): ConsentVendor {\n if (typeof raw === 'string') return presetFor(raw, where)()\n if (!isObject(raw)) throw new ConsentError(`${where}: must be a preset id or an object.`)\n if ('preset' in raw) {\n const preset = presetFor(raw.preset, where)\n if (raw.cookies !== undefined && !Array.isArray(raw.cookies)) {\n throw new ConsentError(`${where} (\"${raw.preset}\"): cookies must be an array of names.`)\n }\n if (raw.extra !== undefined && !Array.isArray(raw.extra)) {\n throw new ConsentError(`${where} (\"${raw.preset}\"): extra must be an array of cookies.`)\n }\n // The preset itself rejects a cookie name it doesn't declare.\n return preset({ cookies: raw.cookies, extra: raw.extra })\n }\n // A full declaration — createConsent validates its id, cookies, categories and lifetimes.\n return raw as unknown as ConsentVendor\n}\n\n/**\n * Turn backend data into `createConsent` options: per category, preset ids and references become\n * full vendor declarations (from `vendorPresets`); full declarations pass through. Pass the app's\n * own strictly necessary vendors as `necessary`, then spread the result and add what else only the\n * app knows:\n *\n * ```ts\n * const consent = createConsent({\n * ...consentConfigFromData(config.consent, { necessary: [mySite] }),\n * onChange,\n * })\n * ```\n *\n * Checks the shape as it goes — the data comes over the wire — and `createConsent` then validates\n * the rest (a vendor without cookies of its category, cookie names, lifetimes).\n *\n * @throws {ConsentError} for a malformed shape, an unknown category or preset, a cookie a preset\n * doesn't declare, or — when the app passes `necessary` — a `necessary` category in the data.\n */\nexport function consentConfigFromData(\n data: ConsentConfigData,\n options: ConsentConfigFromDataOptions = {},\n): ConsentConfigFromData {\n if (!isObject(data)) throw new ConsentError('Consent config data must be an object.')\n if (!isObject(data.categories)) {\n throw new ConsentError('Consent config data needs a \"categories\" object.')\n }\n const categories: Record<string, readonly ConsentVendor[]> = {}\n if (options.necessary !== undefined) {\n if (Object.hasOwn(data.categories, REQUIRED_CATEGORY)) {\n throw new ConsentError(\n `Consent config data may not list \"${REQUIRED_CATEGORY}\": the app declares its strictly necessary vendors itself.`,\n )\n }\n if (!Array.isArray(options.necessary)) {\n throw new ConsentError(`The app's \"${REQUIRED_CATEGORY}\" vendors must be an array.`)\n }\n categories[REQUIRED_CATEGORY] = options.necessary\n }\n for (const [id, list] of Object.entries(data.categories)) {\n if (!isConsentCategoryId(id)) throw new ConsentError(`Unknown consent category \"${id}\".`)\n if (!Array.isArray(list)) throw new ConsentError(`Category \"${id}\": vendors must be an array.`)\n categories[id] = list.map((raw: unknown, index) =>\n vendorFromData(raw, `Category \"${id}\", vendor #${index + 1}`),\n )\n }\n return {\n categories,\n ...(data.policy_version !== undefined ? { policyVersion: data.policy_version } : {}),\n ...(data.max_age !== undefined ? { maxAge: data.max_age } : {}),\n }\n}\n"],"mappings":";;;;;;;;;;;AAqCA,SAAgB,aACd,YACiC;CACjC,MAAM,EAAE,IAAI,oBAAoB,YAAY;CAC5C,MAAM,UAAU,UAAkD,CAAC,MAAqB;EACtF,IAAI,SAAmC;EACvC,IAAI,QAAQ,SAAS;GACnB,MAAM,QAAQ,IAAI,IAAI,QAAQ,KAAK,MAAM,EAAE,IAAI,CAAC;GAChD,KAAK,MAAM,QAAQ,QAAQ,SACzB,IAAI,CAAC,MAAM,IAAI,IAAI,GACjB,MAAM,IAAIA,eAAAA,aACR,WAAW,GAAG,mBAAmB,KAAK,8BACxC;GAGJ,MAAM,SAAS,IAAI,IAAY,QAAQ,OAAO;GAC9C,SAAS,QAAQ,QAAQ,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC;EACnD;EACA,OAAO;GACL;GACA,GAAI,qBAAqB,EAAE,mBAAmB,IAAI,CAAC;GACnD,SAAS,CAAC,GAAG,QAAQ,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c,KAAA,GAAW;EACnC,IAAI,OAAO,OAAO,KAAK,YAAA,WAA6B,GAClD,MAAM,IAAIA,eAAAA,aACR,qCAAqCC,eAAAA,kBAAkB,2DACzD;EAEF,IAAI,CAAC,MAAM,QAAQ,QAAQ,SAAS,GAClC,MAAM,IAAID,eAAAA,aAAa,cAAcC,eAAAA,kBAAkB,4BAA4B;EAErF,WAAWA,eAAAA,qBAAqB,QAAQ;CAC1C;CACA,KAAK,MAAM,CAAC,IAAI,SAAS,OAAO,QAAQ,KAAK,UAAU,GAAG;EACxD,IAAI,CAACC,eAAAA,oBAAoB,EAAE,GAAG,MAAM,IAAIF,eAAAA,aAAa,6BAA6B,GAAG,GAAG;EACxF,IAAI,CAAC,MAAM,QAAQ,IAAI,GAAG,MAAM,IAAIA,eAAAA,aAAa,aAAa,GAAG,6BAA6B;EAC9F,WAAW,MAAM,KAAK,KAAK,KAAc,UACvC,eAAe,KAAK,aAAa,GAAG,aAAa,QAAQ,GAAG,CAC9D;CACF;CACA,OAAO;EACL;EACA,GAAI,KAAK,mBAAmB,KAAA,IAAY,EAAE,eAAe,KAAK,eAAe,IAAI,CAAC;EAClF,GAAI,KAAK,YAAY,KAAA,IAAY,EAAE,QAAQ,KAAK,QAAQ,IAAI,CAAC;CAC/D;AACF"}
|
|
1
|
+
{"version":3,"file":"vendors.cjs","names":["toConsentVendor","ConsentError","ConsentError","REQUIRED_CATEGORY","isConsentCategoryId"],"sources":["../src/vendors/define-vendor.ts","../src/vendors/google-transfers.ts","../src/vendors/time.ts","../src/vendors/google-ads.ts","../src/vendors/google-analytics.ts","../src/vendors/google-maps.ts","../src/vendors/google-recaptcha.ts","../src/vendors/hotjar.ts","../src/vendors/linkedin-insight.ts","../src/vendors/meta-pixel.ts","../src/vendors/tiktok-pixel.ts","../src/vendors/vimeo.ts","../src/vendors/youtube.ts","../src/vendors/presets.ts","../src/vendors/from-data.ts"],"sourcesContent":["import { ConsentError } from '../errors'\nimport { toConsentVendor } from '../machine-names'\nimport type {\n ConsentCookie,\n ConsentCookieDeclaration,\n ConsentTransfer,\n ConsentTransferDeclaration,\n ConsentVendor,\n} from '../types'\n\nexport interface VendorPresetOptions<Name extends string = string> {\n /**\n * Only these of the preset's cookies — for when your integration doesn't set them all (e.g. no\n * Google Signals). Default: every cookie in the preset. An unknown name is a type error and throws.\n */\n cookies?: readonly Name[]\n /** Your own cookies on top, for anything this vendor sets in your setup that the preset lacks. */\n extra?: readonly ConsentCookieDeclaration[]\n}\n\n/** A ready-made vendor: call it (optionally narrowing or extending its cookies) to get a `ConsentVendor`. */\nexport interface VendorPreset<Name extends string = string> {\n (options?: VendorPresetOptions<Name>): ConsentVendor\n /** The vendor id. */\n readonly id: string\n /** The translation key of its name — its id as a machine name. */\n readonly machine_name: string\n /** Every cookie the preset declares, each with its translation keys. */\n readonly cookies: readonly ConsentCookie[]\n /** Its countries outside the EEA, with their translation keys. */\n readonly transfers?: readonly ConsentTransfer[]\n}\n\nexport interface VendorDefinition<C extends readonly ConsentCookieDeclaration[]> {\n /** Stable id; its machine name (the translation key of its name, and its cookies' prefix) derives from it. */\n id: string\n privacy_policy_url?: string\n /** Its countries outside the EEA; `[]` when the data stays in the EEA. */\n transfers?: readonly ConsentTransferDeclaration[]\n cookies: C\n}\n\n/**\n * Define a reusable vendor preset — how every preset in `@luwiostack/cookie-consent/vendors` is built, and\n * the way to package your own (an in-house widget you use across apps). Cookie names are inferred as\n * literals, so the preset's `cookies` option only accepts names it declares.\n *\n * Translation keys follow the package catalogs: `t(vendor.machine_name)` is the vendor's name and\n * `t(cookie.machine_name)` a cookie's purpose (the vendor's machine name plus the cookie name).\n *\n * @throws {ConsentError} when two cookie names come out as the same machine name.\n */\nexport function defineVendor<const C extends readonly ConsentCookieDeclaration[]>(\n definition: VendorDefinition<C>,\n): VendorPreset<C[number]['name']> {\n const { id, privacy_policy_url, transfers } = definition\n // Resolved once: the machine names, and a clash between two cookie names fails here.\n const { machine_name, cookies, transfers: presented } = toConsentVendor(definition)\n const preset = (options: VendorPresetOptions<C[number]['name']> = {}): ConsentVendor => {\n let picked: readonly ConsentCookie[] = cookies\n if (options.cookies) {\n const known = new Set(cookies.map((c) => c.name))\n for (const name of options.cookies) {\n if (!known.has(name)) {\n throw new ConsentError(\n `Vendor \"${id}\" has no cookie \"${name}\" — use \\`extra\\` to add one.`,\n )\n }\n }\n const wanted = new Set<string>(options.cookies)\n picked = cookies.filter((c) => wanted.has(c.name))\n }\n for (const cookie of (options.extra ?? []) as unknown[]) {\n const name = (cookie as { name?: unknown } | null)?.name\n if (\n typeof cookie !== 'object' ||\n cookie === null ||\n typeof name !== 'string' ||\n name === ''\n ) {\n throw new ConsentError(`Vendor \"${id}\": every extra cookie needs a non-empty name.`)\n }\n }\n return toConsentVendor({\n id,\n ...(privacy_policy_url ? { privacy_policy_url } : {}),\n ...(transfers !== undefined ? { transfers } : {}),\n cookies: [...picked, ...(options.extra ?? [])],\n })\n }\n return Object.assign(preset, {\n id,\n machine_name,\n cookies,\n ...(presented !== undefined ? { transfers: presented } : {}),\n })\n}\n","import type { ConsentTransferDeclaration } from '../types'\n\n// Google's transfers outside the EEA, shared by every Google preset: its data-center countries,\n// the US under Google LLC's DPF certification, the others under adequacy decisions or SCCs.\n// Sources:\n// https://policies.google.com/privacy/frameworks\n// https://datacenters.google/locations/\n// https://www.dataprivacyframework.gov/list (Google LLC: active)\n// https://business.safety.google/controllerterms/\nexport const GOOGLE_TRANSFERS: readonly ConsentTransferDeclaration[] = [\n { country: 'CL', safeguards: ['scc'] },\n { country: 'GB', safeguards: ['adequacy'] },\n { country: 'JP', safeguards: ['adequacy'] },\n { country: 'MY', safeguards: ['scc'] },\n { country: 'SG', safeguards: ['scc'] },\n { country: 'TW', safeguards: ['scc'] },\n { country: 'US', safeguards: ['dpf', 'scc'] },\n { country: 'UY', safeguards: ['adequacy'] },\n]\n","// Lifetimes in the presets are milliseconds, like every duration in @luwiostack/cookie-consent.\nexport const MINUTE = 60 * 1000\nexport const HOUR = 60 * MINUTE\nexport const DAY = 24 * HOUR\n","import { defineVendor } from './define-vendor'\nimport { GOOGLE_TRANSFERS } from './google-transfers'\nimport { DAY, MINUTE } from './time'\n\n// Google Ads — the cookies a standard integration sets for visitors.\n// Sources:\n// https://business.safety.google/adscookies/\n// https://policies.google.com/technologies/cookies\n// Note: IDE is 13 months in the EEA, Switzerland and UK (24 months elsewhere). _gac_* is only set when Google\n// Analytics is linked to Google Ads. Domains from adscookies: _gcl_* / _gac_* on the partner (site's) domain,\n// IDE / test_cookie on doubleclick.net; ar_debug is also set on googleadservices.com and google-analytics.com.\nexport const googleAds = /* @__PURE__ */ defineVendor({\n id: 'google_ads',\n privacy_policy_url: 'https://policies.google.com/privacy',\n transfers: GOOGLE_TRANSFERS,\n cookies: [\n { name: '_gcl_au', category: 'marketing', max_age: 90 * DAY },\n { name: '_gcl_aw', category: 'marketing', max_age: 90 * DAY },\n { name: '_gcl_dc', category: 'marketing', max_age: 90 * DAY },\n { name: '_gac_*', category: 'marketing', max_age: 90 * DAY },\n { name: 'IDE', category: 'marketing', max_age: 390 * DAY, domain: '.doubleclick.net' },\n {\n name: 'test_cookie',\n category: 'marketing',\n max_age: 15 * MINUTE,\n domain: '.doubleclick.net',\n },\n { name: 'ar_debug', category: 'marketing', max_age: 90 * DAY, domain: '.doubleclick.net' },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { GOOGLE_TRANSFERS } from './google-transfers'\nimport { DAY } from './time'\n\n// Google Analytics — the cookies a standard integration sets for visitors.\n// Sources:\n// https://support.google.com/analytics/answer/11397207\n// https://business.safety.google/adscookies/\n// https://policies.google.com/technologies/cookies\n// Note: both cookies are first-party.\nexport const googleAnalytics = /* @__PURE__ */ defineVendor({\n id: 'google_analytics',\n privacy_policy_url: 'https://policies.google.com/privacy',\n transfers: GOOGLE_TRANSFERS,\n cookies: [\n { name: '_ga', category: 'statistics', max_age: 730 * DAY },\n { name: '_ga_*', category: 'statistics', max_age: 730 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { GOOGLE_TRANSFERS } from './google-transfers'\nimport { DAY } from './time'\n\n// Google Maps — the cookies a standard integration sets for visitors.\n// Sources:\n// https://policies.google.com/technologies/cookies\n// https://policies.google.com/technologies/cookies/embedded?hl=en\n// https://business.safety.google/adscookies/ (NID on google.com)\n// Note: Google publishes no list for Maps embeds; these are the general google.com cookies from \"How Google\n// uses cookies\". What's set depends on the visitor's existing Google cookies, sign-in and region. AEC's\n// .google.com is observed in www.google.com's Set-Cookie; SOCS's is undocumented, taken as the same.\nexport const googleMaps = /* @__PURE__ */ defineVendor({\n id: 'google_maps',\n privacy_policy_url: 'https://policies.google.com/privacy',\n transfers: GOOGLE_TRANSFERS,\n cookies: [\n { name: 'NID', category: 'marketing', max_age: 180 * DAY, domain: '.google.com' },\n { name: 'AEC', category: 'necessary', max_age: 180 * DAY, domain: '.google.com' },\n { name: 'SOCS', category: 'necessary', max_age: 390 * DAY, domain: '.google.com' },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { GOOGLE_TRANSFERS } from './google-transfers'\nimport { DAY } from './time'\n\n// Google reCAPTCHA — the cookies a standard integration sets for visitors.\n// Sources:\n// https://developers.google.com/recaptcha/docs/faq\n// https://cookiedatabase.org/cookie/google-recaptcha/_grecaptcha/\n// Note: Google documents _GRECAPTCHA's name, purpose and www.google.com domain, not its lifetime; 6 months is\n// from Cookiedatabase.org and matches www.google.com/recaptcha's Set-Cookie.\nexport const googleRecaptcha = /* @__PURE__ */ defineVendor({\n id: 'google_recaptcha',\n privacy_policy_url: 'https://policies.google.com/privacy',\n transfers: GOOGLE_TRANSFERS,\n cookies: [\n { name: '_GRECAPTCHA', category: 'necessary', max_age: 180 * DAY, domain: 'www.google.com' },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY, MINUTE } from './time'\n\n// Hotjar — the cookies a standard integration sets for visitors.\n// Sources:\n// https://help.hotjar.com/hc/en-us/articles/36819973371409-Cookies-Set-by-the-Hotjar-Tracking-Code\n// https://help.hotjar.com/hc/en-us/articles/36820023091089 (hosted in AWS eu-west-1, Ireland)\n// https://contentsquare.com/privacy-center/subprocessors/\n// Note: Short-lived test cookies and two survey cookies are left out. All cookies are first-party. Tracking\n// data stays in the EEA; the UK support affiliate works under intercompany SCCs (US subprocessors serve only\n// User Tests and Interviews, not the tracking code).\nexport const hotjar = /* @__PURE__ */ defineVendor({\n id: 'hotjar',\n privacy_policy_url: 'https://www.hotjar.com/legal/policies/privacy/',\n transfers: [{ country: 'GB', safeguards: ['scc'] }],\n cookies: [\n { name: '_hjSessionUser_*', category: 'statistics', max_age: 365 * DAY },\n { name: '_hjSession_*', category: 'statistics', max_age: 30 * MINUTE },\n { name: '_hjHasCachedUserAttributes', category: 'statistics', max_age: 'session' },\n { name: '_hjUserAttributesHash', category: 'statistics', max_age: 2 * MINUTE },\n {\n name: '_hjUserAttributes',\n category: 'statistics',\n type: 'local_storage',\n max_age: 'persistent',\n },\n { name: 'hjViewportId', category: 'statistics', type: 'session_storage', max_age: 'session' },\n {\n name: 'hjActiveViewportIds',\n category: 'statistics',\n type: 'local_storage',\n max_age: 'session',\n },\n { name: '_hjDonePolls', category: 'statistics', max_age: 365 * DAY },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// LinkedIn Insight Tag — the cookies a standard integration sets for visitors.\n// Sources:\n// https://www.linkedin.com/legal/l/cookie-table\n// https://www.linkedin.com/legal/privacy-policy\n// https://www.dataprivacyframework.gov/list (LinkedIn Corporation: active)\n// Note: The logged-in-only bscookie and _guid (LinkedIn's own Google Ads) are left out. The cookie table lists\n// ln_or both on the first-party domain and on .linkedin.com; it's taken as first-party, like li_fat_id.\nexport const linkedinInsight = /* @__PURE__ */ defineVendor({\n id: 'linkedin_insight',\n privacy_policy_url: 'https://www.linkedin.com/legal/privacy-policy',\n transfers: [{ country: 'US', safeguards: ['dpf', 'scc'] }],\n cookies: [\n { name: 'li_fat_id', category: 'marketing', max_age: 30 * DAY },\n { name: 'ln_or', category: 'marketing', max_age: DAY },\n { name: 'bcookie', category: 'marketing', max_age: 365 * DAY, domain: '.linkedin.com' },\n { name: 'lidc', category: 'marketing', max_age: DAY, domain: '.linkedin.com' },\n { name: 'li_sugr', category: 'marketing', max_age: 90 * DAY, domain: '.linkedin.com' },\n {\n name: 'UserMatchHistory',\n category: 'marketing',\n max_age: 30 * DAY,\n domain: '.linkedin.com',\n },\n {\n name: 'AnalyticsSyncHistory',\n category: 'marketing',\n max_age: 30 * DAY,\n domain: '.linkedin.com',\n },\n { name: 'li_gc', category: 'necessary', max_age: 180 * DAY, domain: '.linkedin.com' },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// Meta Pixel — the cookies a standard integration sets for visitors.\n// Sources:\n// https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc/\n// https://www.facebook.com/policies/cookies/\n// https://web.archive.org/web/20220522135037/https://www.facebook.com/policies/cookies\n// https://privacycenter.instagram.com/policy/?subpage=9.subpage.3-HowDoWeSafeguard\n// https://www.dataprivacyframework.gov/list (Meta Platforms, Inc.: active)\n// Note: Meta's current cookie policy names no cookies; the 90-day lifetimes of _fbp / fr come from earlier\n// versions of Meta's own policy, and _fbc's from Meta's Conversions API docs. _fbp and _fbc are first-party\n// (fbevents.js writes them on the site's domain); fr's .facebook.com is undocumented, taken from the pixel\n// requests going to facebook.com. Transfers: the US under DPF, the adequacy countries Meta names; other\n// countries under SCCs are not named.\nexport const metaPixel = /* @__PURE__ */ defineVendor({\n id: 'meta_pixel',\n privacy_policy_url: 'https://www.facebook.com/privacy/policy/',\n transfers: [\n { country: 'AR', safeguards: ['adequacy'] },\n { country: 'CA', safeguards: ['adequacy'] },\n { country: 'CH', safeguards: ['adequacy'] },\n { country: 'GB', safeguards: ['adequacy'] },\n { country: 'IL', safeguards: ['adequacy'] },\n { country: 'NZ', safeguards: ['adequacy'] },\n { country: 'US', safeguards: ['dpf'] },\n ],\n cookies: [\n { name: '_fbp', category: 'marketing', max_age: 90 * DAY },\n { name: '_fbc', category: 'marketing', max_age: 90 * DAY },\n { name: 'fr', category: 'marketing', max_age: 90 * DAY, domain: '.facebook.com' },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY } from './time'\n\n// TikTok Pixel — the cookies a standard integration sets for visitors.\n// Sources:\n// https://ads.tiktok.com/help/article/using-cookies-with-tiktok-pixel\n// https://www.tiktok.com/legal/page/eea/transferee-countries/en\n// Note: TikTok's lifetimes are 13 months from last use (rolling). ttcsid* covers ttcsid and ttcsid_<pixel code>.\n// _ttp also has a third-party variant on .tiktok.com; the first-party one is declared. _pangle is read, not\n// set, by the pixel. Transfers: storage and group remote access, per TikTok's EEA transferee list; no TikTok\n// entity is DPF-certified.\nexport const tiktokPixel = /* @__PURE__ */ defineVendor({\n id: 'tiktok_pixel',\n privacy_policy_url: 'https://www.tiktok.com/legal/page/eea/privacy-policy/en',\n transfers: [\n { country: 'AU', safeguards: ['scc'] },\n { country: 'BR', safeguards: ['scc'] },\n { country: 'CA', safeguards: ['adequacy'] },\n { country: 'CN', safeguards: ['scc'] },\n { country: 'GB', safeguards: ['adequacy'] },\n { country: 'IL', safeguards: ['adequacy'] },\n { country: 'JP', safeguards: ['adequacy'] },\n { country: 'KR', safeguards: ['adequacy'] },\n { country: 'MY', safeguards: ['scc'] },\n { country: 'PH', safeguards: ['scc'] },\n { country: 'SG', safeguards: ['scc'] },\n { country: 'US', safeguards: ['scc'] },\n ],\n cookies: [\n { name: '_ttp', category: 'marketing', max_age: 390 * DAY },\n { name: 'ttcsid*', category: 'marketing', max_age: 390 * DAY },\n { name: 'ttclid', category: 'marketing', max_age: 390 * DAY },\n {\n name: '_pangle',\n category: 'marketing',\n max_age: 390 * DAY,\n domain: 'analytics.pangle-ads.com',\n },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { DAY, MINUTE } from './time'\n\n// Vimeo — the cookies a standard integration sets for visitors.\n// Sources:\n// https://help.vimeo.com/hc/en-us/articles/26080940921361-Vimeo-Player-Cookies\n// https://vimeo.com/cookie_policy\n// https://vimeo.com/legal/privacy/policy.md\n// https://www.dataprivacyframework.gov/list (Vimeo.com, Inc.: active)\n// Note: Feature-specific cookies (passwords, webinars, live chat) are left out; Cloudflare's __cf_bm / _cfuvid /\n// cf_clearance come from Vimeo's own player-cookie article. Vimeo documents no domains: the player's config\n// sets .vimeo.com (vuid, player) and __cf_bm is observed on vimeo.com; the rest are taken as .vimeo.com.\nexport const vimeo = /* @__PURE__ */ defineVendor({\n id: 'vimeo',\n privacy_policy_url: 'https://vimeo.com/privacy',\n transfers: [{ country: 'US', safeguards: ['dpf', 'scc'] }],\n cookies: [\n { name: 'vuid', category: 'statistics', max_age: 730 * DAY, domain: '.vimeo.com' },\n { name: 'player', category: 'preferences', max_age: 365 * DAY, domain: '.vimeo.com' },\n { name: 'player_clearance', category: 'necessary', max_age: 7 * DAY, domain: '.vimeo.com' },\n { name: '__cf_bm', category: 'necessary', max_age: 30 * MINUTE, domain: '.vimeo.com' },\n { name: '_cfuvid', category: 'necessary', max_age: 'session', domain: '.vimeo.com' },\n { name: 'cf_clearance', category: 'necessary', max_age: 365 * DAY, domain: '.vimeo.com' },\n ],\n})\n","import { defineVendor } from './define-vendor'\nimport { GOOGLE_TRANSFERS } from './google-transfers'\nimport { DAY } from './time'\n\n// YouTube — the cookies a standard integration sets for visitors.\n// Sources:\n// https://policies.google.com/technologies/cookies\n// https://business.safety.google/adscookies/\n// https://support.google.com/youtube/answer/171780\n// https://cookiedatabase.org/\n// Note: Google is moving VISITOR_INFO1_LIVE to __Secure-YNID, so both are listed. youtube-nocookie.com still\n// uses storage, so treat it as needing consent too. Domains: YSC / VISITOR_INFO1_LIVE from adscookies, the\n// rest observed in the embed's Set-Cookie or, for __Secure-YENID and PREF (undocumented), taken as the\n// embed's .youtube.com.\nexport const youtube = /* @__PURE__ */ defineVendor({\n id: 'youtube',\n privacy_policy_url: 'https://policies.google.com/privacy',\n transfers: GOOGLE_TRANSFERS,\n cookies: [\n { name: 'YSC', category: 'marketing', max_age: 'session', domain: '.youtube.com' },\n { name: '__Secure-YNID', category: 'marketing', max_age: 180 * DAY, domain: '.youtube.com' },\n {\n name: 'VISITOR_INFO1_LIVE',\n category: 'marketing',\n max_age: 180 * DAY,\n domain: '.youtube.com',\n },\n { name: '__Secure-YENID', category: 'marketing', max_age: 390 * DAY, domain: '.youtube.com' },\n {\n name: '__Secure-ROLLOUT_TOKEN',\n category: 'marketing',\n max_age: 180 * DAY,\n domain: '.youtube.com',\n },\n { name: 'PREF', category: 'preferences', max_age: 240 * DAY, domain: '.youtube.com' },\n ],\n})\n","import { googleAds } from './google-ads'\nimport { googleAnalytics } from './google-analytics'\nimport { googleMaps } from './google-maps'\nimport { googleRecaptcha } from './google-recaptcha'\nimport { hotjar } from './hotjar'\nimport { linkedinInsight } from './linkedin-insight'\nimport { metaPixel } from './meta-pixel'\nimport { tiktokPixel } from './tiktok-pixel'\nimport { vimeo } from './vimeo'\nimport { youtube } from './youtube'\n\n/**\n * Every preset by its id — for when the set of vendors is decided at runtime (a backend that turns\n * integrations on and off sends `\"google_analytics\"`, not code). Importing this map bundles every\n * preset; import the named presets instead when your vendors are fixed in code.\n */\nexport const vendorPresets = {\n google_analytics: googleAnalytics,\n hotjar,\n google_ads: googleAds,\n meta_pixel: metaPixel,\n linkedin_insight: linkedinInsight,\n tiktok_pixel: tiktokPixel,\n youtube,\n vimeo,\n google_maps: googleMaps,\n google_recaptcha: googleRecaptcha,\n} as const\n\n/** The id of a shipped preset — `'google_analytics'`, `'meta_pixel'`, … */\nexport type VendorPresetId = keyof typeof vendorPresets\n","import { type ConsentCategoryId, isConsentCategoryId, REQUIRED_CATEGORY } from '../categories'\nimport { ConsentError } from '../errors'\nimport type {\n ConsentCategoriesConfig,\n ConsentCookieDeclaration,\n ConsentVendorDeclaration,\n} from '../types'\nimport { type VendorPresetId, vendorPresets } from './presets'\n\n/**\n * The serializable consent config — what a backend sends when it decides which integrations are on\n * (a back office where an admin enables Google Analytics, or the YouTube embed without tracking).\n * JSON only: per category, the vendors used in it — a preset id, a preset reference narrowed or\n * extended, or a full declaration when there's no preset. A vendor brings only its cookies of the\n * category it's listed under (plus its necessary ones). snake_case, like every dataset.\n *\n * ```json\n * {\n * \"policy_version\": 7,\n * \"categories\": {\n * \"statistics\": [\"google_analytics\"],\n * \"preferences\": [\"youtube\"],\n * \"marketing\": [\n * { \"preset\": \"google_ads\", \"cookies\": [\"_gcl_au\", \"IDE\"] },\n * { \"id\": \"acme_chat\", \"cookies\": [{ \"name\": \"acme_id\", \"category\": \"marketing\", \"max_age\": 31536000000 }] }\n * ]\n * }\n * }\n * ```\n */\nexport interface ConsentConfigData {\n /** Bump it whenever the set of vendors changes, so every visitor is asked again. Default `1`. */\n policy_version?: string | number\n /** How long a decision stays valid, in milliseconds. Default: 365 days. */\n max_age?: number\n /** Per category, the vendors used in it. */\n categories: Partial<Record<ConsentCategoryId, readonly ConsentVendorData[]>>\n}\n\n/** A vendor in the data: a preset id, a preset reference, or a full declaration of your own. */\nexport type ConsentVendorData = VendorPresetId | ConsentPresetVendorData | ConsentVendorDeclaration\n\n/** A shipped preset by id, optionally narrowed (`cookies`) or extended (`extra`). */\nexport interface ConsentPresetVendorData {\n preset: VendorPresetId\n cookies?: readonly string[]\n extra?: readonly ConsentCookieDeclaration[]\n}\n\n/** The part of `createConsent`'s config that data describes. */\nexport interface ConsentConfigFromData {\n categories: ConsentCategoriesConfig\n policyVersion?: string | number\n maxAge?: number\n}\n\n/** What only the app knows, merged into the data's config. */\nexport interface ConsentConfigFromDataOptions {\n /**\n * The app's own strictly necessary vendors (its session cookie, CSRF token, the consent record),\n * declared in code. Put under `necessary`, ahead of the data's categories. Once the app declares\n * them, the data may not list `necessary` itself: strictly necessary cookies are the app's to\n * declare, never the backend's.\n */\n necessary?: readonly ConsentVendorDeclaration[]\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nfunction presetFor(id: unknown, where: string) {\n if (typeof id === 'string' && Object.hasOwn(vendorPresets, id)) {\n return vendorPresets[id as VendorPresetId] as (\n options?: Record<string, unknown>,\n ) => ConsentVendorDeclaration\n }\n throw new ConsentError(`${where}: unknown vendor preset \"${String(id)}\".`)\n}\n\nfunction vendorFromData(raw: unknown, where: string): ConsentVendorDeclaration {\n if (typeof raw === 'string') return presetFor(raw, where)()\n if (!isObject(raw)) throw new ConsentError(`${where}: must be a preset id or an object.`)\n if ('preset' in raw) {\n const preset = presetFor(raw.preset, where)\n if (raw.cookies !== undefined && !Array.isArray(raw.cookies)) {\n throw new ConsentError(`${where} (\"${raw.preset}\"): cookies must be an array of names.`)\n }\n if (raw.extra !== undefined && !Array.isArray(raw.extra)) {\n throw new ConsentError(`${where} (\"${raw.preset}\"): extra must be an array of cookies.`)\n }\n // The preset itself rejects a cookie name it doesn't declare.\n return preset({ cookies: raw.cookies, extra: raw.extra })\n }\n // A full declaration — createConsent validates its id, cookies, categories and lifetimes.\n return raw as unknown as ConsentVendorDeclaration\n}\n\n/**\n * Turn backend data into `createConsent` options: per category, preset ids and references become\n * full vendor declarations (from `vendorPresets`); full declarations pass through. Pass the app's\n * own strictly necessary vendors as `necessary`, then spread the result and add what else only the\n * app knows:\n *\n * ```ts\n * const consent = createConsent({\n * ...consentConfigFromData(config.consent, { necessary: [mySite] }),\n * onChange,\n * })\n * ```\n *\n * Checks the shape as it goes — the data comes over the wire — and `createConsent` then validates\n * the rest (a vendor without cookies of its category, cookie names, lifetimes).\n *\n * @throws {ConsentError} for a malformed shape, an unknown category or preset, a cookie a preset\n * doesn't declare, or — when the app passes `necessary` — a `necessary` category in the data.\n */\nexport function consentConfigFromData(\n data: ConsentConfigData,\n options: ConsentConfigFromDataOptions = {},\n): ConsentConfigFromData {\n if (!isObject(data)) throw new ConsentError('Consent config data must be an object.')\n if (!isObject(data.categories)) {\n throw new ConsentError('Consent config data needs a \"categories\" object.')\n }\n const categories: Record<string, readonly ConsentVendorDeclaration[]> = {}\n if (options.necessary !== undefined) {\n if (Object.hasOwn(data.categories, REQUIRED_CATEGORY)) {\n throw new ConsentError(\n `Consent config data may not list \"${REQUIRED_CATEGORY}\": the app declares its strictly necessary vendors itself.`,\n )\n }\n if (!Array.isArray(options.necessary)) {\n throw new ConsentError(`The app's \"${REQUIRED_CATEGORY}\" vendors must be an array.`)\n }\n categories[REQUIRED_CATEGORY] = options.necessary\n }\n for (const [id, list] of Object.entries(data.categories)) {\n if (!isConsentCategoryId(id)) throw new ConsentError(`Unknown consent category \"${id}\".`)\n if (!Array.isArray(list)) throw new ConsentError(`Category \"${id}\": vendors must be an array.`)\n categories[id] = list.map((raw: unknown, index) =>\n vendorFromData(raw, `Category \"${id}\", vendor #${index + 1}`),\n )\n }\n return {\n categories,\n ...(data.policy_version !== undefined ? { policyVersion: data.policy_version } : {}),\n ...(data.max_age !== undefined ? { maxAge: data.max_age } : {}),\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,SAAgB,aACd,YACiC;CACjC,MAAM,EAAE,IAAI,oBAAoB,cAAc;CAE9C,MAAM,EAAE,cAAc,SAAS,WAAW,cAAcA,sBAAAA,gBAAgB,UAAU;CAClF,MAAM,UAAU,UAAkD,CAAC,MAAqB;EACtF,IAAI,SAAmC;EACvC,IAAI,QAAQ,SAAS;GACnB,MAAM,QAAQ,IAAI,IAAI,QAAQ,KAAK,MAAM,EAAE,IAAI,CAAC;GAChD,KAAK,MAAM,QAAQ,QAAQ,SACzB,IAAI,CAAC,MAAM,IAAI,IAAI,GACjB,MAAM,IAAIC,sBAAAA,aACR,WAAW,GAAG,mBAAmB,KAAK,8BACxC;GAGJ,MAAM,SAAS,IAAI,IAAY,QAAQ,OAAO;GAC9C,SAAS,QAAQ,QAAQ,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC;EACnD;EACA,KAAK,MAAM,UAAW,QAAQ,SAAS,CAAC,GAAiB;GACvD,MAAM,OAAQ,QAAsC;GACpD,I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