@blakfy/cookie 2.1.1 → 2.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/CHANGELOG.md +194 -120
- package/README.md +594 -480
- package/SECURITY.md +54 -0
- package/dist/cookie-defaults.js +1 -2
- package/dist/cookie-defaults.min.js +1 -2
- package/dist/cookie.d.ts +171 -0
- package/dist/cookie.js +2863 -2376
- package/dist/cookie.js.map +4 -4
- package/dist/cookie.min.js +2 -3
- package/{ARCHITECTURE.md → docs/architecture.md} +187 -186
- package/{COMPLIANCE.md → docs/compliance.md} +199 -191
- package/{MIGRATION.md → docs/migration.md} +172 -156
- package/docs/release.md +176 -0
- package/{TCF-CERTIFICATION.md → docs/tcf-certification.md} +115 -106
- package/package.json +145 -61
- package/status.json +30 -30
|
@@ -1,191 +1,199 @@
|
|
|
1
|
-
# Blakfy Cookie — Compliance Reference
|
|
2
|
-
|
|
3
|
-
> Hangi yasa/motor/standart için ne yapıyoruz, hangi modül karşılıyor.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Compliance Matrisi
|
|
8
|
-
|
|
9
|
-
| Yasa / Standart
|
|
10
|
-
|
|
11
|
-
| **GDPR**
|
|
12
|
-
| **ePrivacy Directive**
|
|
13
|
-
| **KVKK**
|
|
14
|
-
| **CCPA / CPRA**
|
|
15
|
-
| **LGPD**
|
|
16
|
-
| **Google Consent Mode v2**
|
|
17
|
-
| **Microsoft UET Consent Mode**
|
|
18
|
-
| **Yandex Metrica Consent**
|
|
19
|
-
| **IAB TCF v2.2**
|
|
20
|
-
| **GPC** (Global Privacy Control) | Tarayıcı standardı, CA yasal
|
|
21
|
-
| **DNT** (Do Not Track)
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 2. Google Consent Mode v2
|
|
26
|
-
|
|
27
|
-
**Sinyal:**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- `
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
`
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
1
|
+
# Blakfy Cookie — Compliance Reference
|
|
2
|
+
|
|
3
|
+
> Hangi yasa/motor/standart için ne yapıyoruz, hangi modül karşılıyor.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Compliance Matrisi
|
|
8
|
+
|
|
9
|
+
| Yasa / Standart | Yetki Alanı | Modül | Durum (v2.0.0) |
|
|
10
|
+
| -------------------------------- | ------------------------------ | -------------------------------------------------- | ------------------------- |
|
|
11
|
+
| **GDPR** | AB | core + ui (eşit prominence butonlar, pre-tick yok) | ✅ |
|
|
12
|
+
| **ePrivacy Directive** | AB | core (consent öncesi cookie konmaz) | ✅ |
|
|
13
|
+
| **KVKK** | Türkiye | core/audit.js (Md.12 kanıt yükümlülüğü) | ✅ |
|
|
14
|
+
| **CCPA / CPRA** | Kaliforniya, ABD | compliance/ccpa.js | ✅ |
|
|
15
|
+
| **LGPD** | Brezilya | i18n/translations/pt.js + jurisdiction | ⚠️ (v2.1) |
|
|
16
|
+
| **Google Consent Mode v2** | Google ekosistemi | compliance/google-cmv2.js | ✅ |
|
|
17
|
+
| **Microsoft UET Consent Mode** | Bing Ads + Clarity | compliance/microsoft-uet.js | ✅ |
|
|
18
|
+
| **Yandex Metrica Consent** | Yandex ekosistemi | compliance/yandex-metrica.js | ✅ |
|
|
19
|
+
| **IAB TCF v2.2** | AB AdTech (AdSense/Ad Manager) | compliance/tcf-v2.js | ✅ kod + ⏳ sertifikasyon |
|
|
20
|
+
| **GPC** (Global Privacy Control) | Tarayıcı standardı, CA yasal | compliance/gpc.js | ✅ |
|
|
21
|
+
| **DNT** (Do Not Track) | Tarayıcı standardı | compliance/dnt.js | ✅ |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Google Consent Mode v2
|
|
26
|
+
|
|
27
|
+
**Sinyal:**
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
gtag("consent", "update", {
|
|
31
|
+
ad_storage: marketing ? "granted" : "denied",
|
|
32
|
+
ad_user_data: marketing ? "granted" : "denied",
|
|
33
|
+
ad_personalization: marketing ? "granted" : "denied",
|
|
34
|
+
analytics_storage: analytics ? "granted" : "denied",
|
|
35
|
+
functionality_storage: functional ? "granted" : "denied",
|
|
36
|
+
personalization_storage: functional ? "granted" : "denied",
|
|
37
|
+
security_storage: "granted",
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Bootstrap (cookie-defaults.min.js):**
|
|
42
|
+
|
|
43
|
+
- Tüm sinyaller default `denied`
|
|
44
|
+
- `wait_for_update: 500` ile GTM/GA4 cevap bekler
|
|
45
|
+
- `gtag` global fonksiyonu yoksa stub kurulur
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 3. Microsoft UET Consent Mode
|
|
50
|
+
|
|
51
|
+
**Sinyal:**
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
window.uetq = window.uetq || [];
|
|
55
|
+
window.uetq.push("consent", "update", {
|
|
56
|
+
ad_storage: marketing ? "granted" : "denied",
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Bing Ads (UET tag) ve Microsoft Clarity bunu okur. v2.0.0 itibariyle Clarity zaten bu sinyali destekliyor.
|
|
61
|
+
|
|
62
|
+
**Bootstrap:** `uetq` push queue stub kurulur, default `denied`.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 4. Yandex Metrica Consent
|
|
67
|
+
|
|
68
|
+
Yandex'in Google gibi standart bir consent API'si yok. Yaklaşımımız:
|
|
69
|
+
|
|
70
|
+
- Onay yokken Metrica script'leri **engellenir** (gating layer).
|
|
71
|
+
- Onay verilince `ym(counterId, 'init', {...})` çağrılır.
|
|
72
|
+
- **Webvisor (session replay)** ekstra kategori — `marketing` değil, ayrı `recording` kategorisi olarak işaretlenir (KVKK/GDPR yorum farkı).
|
|
73
|
+
- Cookie temizliği: `_ym_*`, `_ym_uid`, `_ym_d`, `_ym_isad`, `yabs-frequency`, `yandexuid`.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 5. IAB TCF v2.2
|
|
78
|
+
|
|
79
|
+
**Teknik kapsam (v2.0.0 ile gelen kod):**
|
|
80
|
+
|
|
81
|
+
- `window.__tcfapi(command, version, callback, parameter)` global fonksiyonu (IAB standardı)
|
|
82
|
+
- TC string encoding (Base64URL, vendor segments dahil)
|
|
83
|
+
- Global Vendor List (GVL) fetch — `vendor-list.consensu.org/v3/vendor-list.json`
|
|
84
|
+
- `getTCData`, `addEventListener`, `removeEventListener` komutları
|
|
85
|
+
- `data-blakfy-cmp-id="0"` → preview/test mode
|
|
86
|
+
|
|
87
|
+
**Sertifikasyon süreci (kullanıcı tarafı):**
|
|
88
|
+
|
|
89
|
+
1. https://iabeurope.eu/cmp-list/ üzerinden başvuru
|
|
90
|
+
2. Audit (kod + UI + DSAR/data subject request akışı incelenir)
|
|
91
|
+
3. Annual fee (~€2.000)
|
|
92
|
+
4. CMP ID atanır → `data-blakfy-cmp-id="123"` ile yazılır
|
|
93
|
+
5. Onay öncesi widget "preview mode"da çalışır, onay sonrası prod
|
|
94
|
+
|
|
95
|
+
⏱ Süreç 2-3 ay. Detay: [tcf-certification.md](./tcf-certification.md)
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 6. CCPA / CPRA
|
|
100
|
+
|
|
101
|
+
**Kapsam:** Kaliforniya sakinleri için.
|
|
102
|
+
|
|
103
|
+
**Tetiklenme:** `src/geo/jurisdiction.js` ABD/CA tespit ederse:
|
|
104
|
+
|
|
105
|
+
- Banner "Reddet" yerine **"Do Not Sell or Share My Personal Information"** olarak değiştirilir.
|
|
106
|
+
- Footer'a kalıcı `<a class="blakfy-ccpa-link">` eklenir (yasal zorunluluk).
|
|
107
|
+
- `Sec-GPC: 1` header otomatik opt-out say.
|
|
108
|
+
- USP string `1YYY` formatında set edilir (versiyon, opt-out, sale, third-party).
|
|
109
|
+
|
|
110
|
+
**API:**
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
BlakfyCookie.ccpa.optOut();
|
|
114
|
+
BlakfyCookie.ccpa.isOptedOut();
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 7. GPC (Global Privacy Control)
|
|
120
|
+
|
|
121
|
+
`navigator.globalPrivacyControl === true` ise:
|
|
122
|
+
|
|
123
|
+
- `marketing` ve `analytics` kategorileri **otomatik denied** (kullanıcı açık onay vermediyse)
|
|
124
|
+
- CCPA jurisdiction'da yasal olarak zorunlu opt-out
|
|
125
|
+
- GDPR jurisdiction'da rehberlik niteliğinde, biz default'ta saygı gösteriyoruz
|
|
126
|
+
|
|
127
|
+
Override: `data-blakfy-gpc="ignore"` ile kapatılabilir (önerilmez).
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 8. DNT (Do Not Track)
|
|
132
|
+
|
|
133
|
+
`navigator.doNotTrack === "1"` ise:
|
|
134
|
+
|
|
135
|
+
- Default'ta **sadece UI'da işaret** (kullanıcı görsün, "GPC veya DNT etkin" yazısı)
|
|
136
|
+
- `data-blakfy-dnt="auto-deny"` ile auto-deny opsiyonel
|
|
137
|
+
|
|
138
|
+
DNT eski/zayıf bir standart, GPC tercih edilir.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 9. Jurisdiction Tespiti
|
|
143
|
+
|
|
144
|
+
`src/geo/jurisdiction.js` 3 strateji dener:
|
|
145
|
+
|
|
146
|
+
1. **Cloudflare** `CF-IPCountry` header (server-rendered sites)
|
|
147
|
+
2. **Server endpoint** `data-blakfy-geo-endpoint="/api/geo"` (opt-in)
|
|
148
|
+
3. **Client-side fallback:** `Intl.DateTimeFormat().resolvedOptions().timeZone` → kaba bölge tahmini
|
|
149
|
+
|
|
150
|
+
Sonuç: `"GDPR"` | `"CCPA"` | `"LGPD"` | `"default"`
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 10. Audit Log (KVKK Md.12 + GDPR Art.7(1))
|
|
155
|
+
|
|
156
|
+
Her consent değişikliği `data-blakfy-audit-endpoint`'e POST edilir:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"id": "uuid-v4-anonim-id",
|
|
161
|
+
"timestamp": "2026-04-30T12:00:00Z",
|
|
162
|
+
"action": "accept_all" | "reject_all" | "save_preferences",
|
|
163
|
+
"state": { ... },
|
|
164
|
+
"jurisdiction": "GDPR",
|
|
165
|
+
"userAgent": "...",
|
|
166
|
+
"url": "...",
|
|
167
|
+
"policyVersion": "1.0",
|
|
168
|
+
"blakfy": "2.0.0",
|
|
169
|
+
"tcString": "...",
|
|
170
|
+
"uspString": "..."
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Anonim ID:** `crypto.randomUUID()` — fingerprint **değil** (v1'deki `makeHash()` kaldırıldı).
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 11. Kategori → Yasal Temel Eşlemesi
|
|
179
|
+
|
|
180
|
+
| Kategori | GDPR Yasal Temel | KVKK | CCPA |
|
|
181
|
+
| ---------------------- | ---------------------------------- | ----------------- | --------------------- |
|
|
182
|
+
| `essential` | Art. 6(1)(b) — sözleşme/zorunluluk | Md.5(2)(c) | exempt |
|
|
183
|
+
| `analytics` | Art. 6(1)(a) — açık rıza | Md.5(1) | optable |
|
|
184
|
+
| `marketing` | Art. 6(1)(a) — açık rıza | Md.5(1) | optable + GPC saygısı |
|
|
185
|
+
| `functional` | Art. 6(1)(a) — açık rıza | Md.5(1) | optable |
|
|
186
|
+
| `recording` (Webvisor) | Art. 6(1)(a) — ek granular onay | Md.5(1) açık rıza | optable |
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 12. Test Kapsamı
|
|
191
|
+
|
|
192
|
+
`tests/compliance/` altında her modül için ayrı test:
|
|
193
|
+
|
|
194
|
+
- `google-cmv2.test.js` — gtag stub kurulumu, update sinyalleri
|
|
195
|
+
- `microsoft-uet.test.js` — uetq queue, consent push
|
|
196
|
+
- `yandex-metrica.test.js` — cookie engelleme, Webvisor ayrı kategori
|
|
197
|
+
- `tcf-v2.test.js` — `__tcfapi` komut yüzeyi, TC string format
|
|
198
|
+
- `ccpa.test.js` — USP string, DNT/GPC saygısı
|
|
199
|
+
- `gpc.test.js` — auto-deny davranışı
|