@justai/core 0.4.1 → 0.5.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/package.json +1 -1
- package/src/index.js +41 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The framework-free heart of the persona shell \u2014 the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
package/src/index.js
CHANGED
|
@@ -100,12 +100,25 @@ export function measurementIdFor(host) {
|
|
|
100
100
|
* never closes. The stub is also assigned BEFORE the guard returns, so a silenced host still has a
|
|
101
101
|
* callable `gtag` and that same script cannot throw there either.
|
|
102
102
|
*
|
|
103
|
-
* CONSENT DEFAULTS, twice
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
103
|
+
* CONSENT DEFAULTS, twice — REVISED 2026-07-25 with the founder, and the revision IS the doctrine:
|
|
104
|
+
* MEASUREMENT follows one rule everywhere (granted by default, EEA asks first), PROFILING is refused
|
|
105
|
+
* everywhere forever. Globally: analytics_storage + ad_storage + ad_user_data granted — counting the
|
|
106
|
+
* visit, and telling an ad its click worked; the dialog's question covers both, in the visitor's
|
|
107
|
+
* language. ad_personalization is DENIED with no path anywhere, which is what keeps "never who"
|
|
108
|
+
* true. The EEA + UK + CH region list denies everything until the dialog's answer — where consent is
|
|
109
|
+
* owed we ask first; where it is not, measurement is simply on (the founder's explicit instruction).
|
|
110
|
+
*
|
|
111
|
+
* STORED CHOICES ARE VERSIONED: "granted+ads" replays the full grant, a legacy "granted" replays
|
|
112
|
+
* analytics ONLY — a visitor who said yes to the narrower question is never silently upgraded to the
|
|
113
|
+
* wider one. "denied" denies the measurement trio.
|
|
114
|
+
*
|
|
115
|
+
* LEGAL POSTURE, noted with the founder: one sentence carries two purposes (counting + ad
|
|
116
|
+
* measurement), both stated plainly — defensible at today's traffic; when traffic grows, granular
|
|
117
|
+
* consent (two separate switches) should be revisited. ad_personalization staying dead is the
|
|
118
|
+
* strongest card in that file.
|
|
119
|
+
*
|
|
120
|
+
* The region list has a sibling: the timezone list in the consent dialog's script. Change one and
|
|
121
|
+
* the other must change, or a visitor is denied by region while never being offered the dialog.
|
|
109
122
|
*
|
|
110
123
|
* `page_title` IS PINNED at load. Only one persona mutates `document.title` today — time shows a live
|
|
111
124
|
* clock — and without this its analytics reports "13:32 · Amsterdam" as the page name. It costs every
|
|
@@ -128,9 +141,12 @@ var __g=${JSON.stringify(gaId)};
|
|
|
128
141
|
window.dataLayer=window.dataLayer||[];
|
|
129
142
|
window.gtag=window.gtag||function(){window.dataLayer.push(arguments)};
|
|
130
143
|
gtag("js",new Date());
|
|
131
|
-
gtag("consent","default",{ad_storage:"
|
|
144
|
+
gtag("consent","default",{ad_storage:"granted",ad_user_data:"granted",ad_personalization:"denied",analytics_storage:"granted"});
|
|
132
145
|
gtag("consent","default",{region:["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE","IS","LI","NO","GB","CH"],ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied"});
|
|
133
|
-
try{var __c=localStorage.getItem("consent");
|
|
146
|
+
try{var __c=localStorage.getItem("consent");
|
|
147
|
+
if(__c==="granted+ads")gtag("consent","update",{analytics_storage:"granted",ad_storage:"granted",ad_user_data:"granted"});
|
|
148
|
+
else if(__c==="granted")gtag("consent","update",{analytics_storage:"granted"});
|
|
149
|
+
else if(__c==="denied")gtag("consent","update",{analytics_storage:"denied",ad_storage:"denied",ad_user_data:"denied"})}catch(e){}
|
|
134
150
|
gtag("config",__g,{cookie_expires:60*60*24*60,page_title:document.title,allow_google_signals:false,allow_ad_personalization_signals:false});
|
|
135
151
|
addEventListener("load",function(){(window.requestIdleCallback||function(f){setTimeout(f,1200)})(function(){var s=document.createElement("script");s.async=true;s.src="https://www.googletagmanager.com/gtag/js?id="+__g;document.head.appendChild(s)})});
|
|
136
152
|
}})();`;
|
|
@@ -162,79 +178,79 @@ addEventListener("load",function(){(window.requestIdleCallback||function(f){setT
|
|
|
162
178
|
*/
|
|
163
179
|
export const CONSENT_COPY = {
|
|
164
180
|
"ar": {
|
|
165
|
-
"consentText": "أودّ أن أعرف
|
|
181
|
+
"consentText": "أودّ أن أعرف أنّ أحدًا زارني — بشكل مجهول، دون معرفة من هو أبدًا. هل لي أن أحسب زيارتك — وإن كان إعلانٌ قد أوصلك إلى هنا، أن أخبره أنه نجح؟",
|
|
166
182
|
"consentAllow": "احسبني ❤️",
|
|
167
183
|
"consentDecline": "أبقِني خفيًّا",
|
|
168
184
|
"consentChoice": "خيار الخصوصية"
|
|
169
185
|
},
|
|
170
186
|
"de": {
|
|
171
|
-
"consentText": "Ich wüsste gern, dass jemand da war — anonym, nie wer. Darf ich deinen Besuch zählen?",
|
|
187
|
+
"consentText": "Ich wüsste gern, dass jemand da war — anonym, nie wer. Darf ich deinen Besuch zählen — und falls dich eine Anzeige hergebracht hat, ihr sagen, dass sie gewirkt hat?",
|
|
172
188
|
"consentAllow": "Zähl mich mit ❤️",
|
|
173
189
|
"consentDecline": "Unsichtbar bleiben",
|
|
174
190
|
"consentChoice": "Privatsphäre-Wahl"
|
|
175
191
|
},
|
|
176
192
|
"en": {
|
|
177
|
-
"consentText": "I'd love to know someone was here — anonymously, never who. May I count your visit?",
|
|
193
|
+
"consentText": "I'd love to know someone was here — anonymously, never who. May I count your visit, and if an ad brought you here, let it know it worked?",
|
|
178
194
|
"consentAllow": "Count me in ❤️",
|
|
179
195
|
"consentDecline": "Stay invisible",
|
|
180
196
|
"consentChoice": "privacy choice"
|
|
181
197
|
},
|
|
182
198
|
"es": {
|
|
183
|
-
"consentText": "Me encantaría saber que alguien
|
|
199
|
+
"consentText": "Me encantaría saber que alguien estuvo aquí — de forma anónima, nunca quién. ¿Puedo contar tu visita y, si un anuncio te trajo hasta aquí, decirle que funcionó?",
|
|
184
200
|
"consentAllow": "Cuenta conmigo ❤️",
|
|
185
201
|
"consentDecline": "Seguir invisible",
|
|
186
202
|
"consentChoice": "elección de privacidad"
|
|
187
203
|
},
|
|
188
204
|
"fr": {
|
|
189
|
-
"consentText": "J'aimerais savoir que quelqu'un est passé — anonymement, jamais qui. Puis-je compter ta visite ?",
|
|
205
|
+
"consentText": "J'aimerais savoir que quelqu'un est passé — anonymement, jamais qui. Puis-je compter ta visite — et si une publicité t'a amené ici, lui dire qu'elle a fonctionné ?",
|
|
190
206
|
"consentAllow": "Compte ma visite ❤️",
|
|
191
207
|
"consentDecline": "Rester invisible",
|
|
192
208
|
"consentChoice": "choix de confidentialité"
|
|
193
209
|
},
|
|
194
210
|
"hi": {
|
|
195
|
-
"consentText": "मुझे
|
|
211
|
+
"consentText": "मुझे यह जानना अच्छा लगेगा कि कोई आया था — गुमनाम तौर पर, कभी नहीं कि कौन। क्या मैं आपकी विज़िट गिन सकता हूँ — और अगर कोई विज्ञापन आपको यहाँ लाया, तो उसे बता दूँ कि उसने काम किया?",
|
|
196
212
|
"consentAllow": "मुझे गिनो ❤️",
|
|
197
213
|
"consentDecline": "अदृश्य रहूँ",
|
|
198
214
|
"consentChoice": "गोपनीयता विकल्प"
|
|
199
215
|
},
|
|
200
216
|
"it": {
|
|
201
|
-
"consentText": "Mi piacerebbe sapere che qualcuno è passato — in
|
|
217
|
+
"consentText": "Mi piacerebbe sapere che qualcuno è passato — in forma anonima, mai chi. Posso contare la tua visita — e, se ti ha portato qui una pubblicità, dirle che ha funzionato?",
|
|
202
218
|
"consentAllow": "Contami ❤️",
|
|
203
219
|
"consentDecline": "Resta invisibile",
|
|
204
220
|
"consentChoice": "scelta privacy"
|
|
205
221
|
},
|
|
206
222
|
"ja": {
|
|
207
|
-
"consentText": "誰かが来てくれたことだけ知りたいのです —
|
|
223
|
+
"consentText": "誰かが来てくれたことだけ知りたいのです — 匿名で、誰かは決して分かりません。訪問を数えてもいいですか?広告がきっかけで来てくれたなら、役に立ったと広告に伝えてもいいですか?",
|
|
208
224
|
"consentAllow": "数えていいよ ❤️",
|
|
209
225
|
"consentDecline": "見えないままで",
|
|
210
226
|
"consentChoice": "プライバシー設定"
|
|
211
227
|
},
|
|
212
228
|
"nl": {
|
|
213
|
-
"consentText": "Ik zou graag weten dat er iemand
|
|
229
|
+
"consentText": "Ik zou graag weten dat er iemand was — anoniem, nooit wie. Mag ik je bezoek meetellen — en als een advertentie je hierheen bracht, laten weten dat die werkte?",
|
|
214
230
|
"consentAllow": "Tel me mee ❤️",
|
|
215
231
|
"consentDecline": "Onzichtbaar blijven",
|
|
216
232
|
"consentChoice": "privacykeuze"
|
|
217
233
|
},
|
|
218
234
|
"pt": {
|
|
219
|
-
"consentText": "Adoraria saber que alguém
|
|
235
|
+
"consentText": "Adoraria saber que alguém esteve aqui — anonimamente, nunca quem. Posso contar sua visita — e, se um anúncio trouxe você até aqui, dizer a ele que funcionou?",
|
|
220
236
|
"consentAllow": "Conta comigo ❤️",
|
|
221
237
|
"consentDecline": "Ficar invisível",
|
|
222
238
|
"consentChoice": "escolha de privacidade"
|
|
223
239
|
},
|
|
224
240
|
"ru": {
|
|
225
|
-
"consentText": "Мне бы хотелось знать, что кто-то заходил — анонимно, и никогда кто именно. Можно посчитать твой
|
|
241
|
+
"consentText": "Мне бы хотелось знать, что кто-то заходил — анонимно, и никогда кто именно. Можно посчитать твой визит — и, если тебя привела реклама, дать ей знать, что она сработала?",
|
|
226
242
|
"consentAllow": "Посчитай меня ❤️",
|
|
227
243
|
"consentDecline": "Остаться невидимым",
|
|
228
244
|
"consentChoice": "выбор приватности"
|
|
229
245
|
},
|
|
230
246
|
"tr": {
|
|
231
|
-
"consentText": "Birinin uğradığını bilmek isterim — anonim olarak, asla kim olduğunu değil. Ziyaretini sayabilir miyim?",
|
|
247
|
+
"consentText": "Birinin uğradığını bilmek isterim — anonim olarak, asla kim olduğunu değil. Ziyaretini sayabilir miyim — ve seni buraya bir reklam getirdiyse, ona işe yaradığını söyleyebilir miyim?",
|
|
232
248
|
"consentAllow": "Beni say ❤️",
|
|
233
249
|
"consentDecline": "Görünmez kalayım",
|
|
234
250
|
"consentChoice": "gizlilik tercihi"
|
|
235
251
|
},
|
|
236
252
|
"zh": {
|
|
237
|
-
"consentText": "我只想知道有人来过 —
|
|
253
|
+
"consentText": "我只想知道有人来过 — 完全匿名,永远不知道是谁。可以把你的访问算上吗——如果是广告把你带来的,也让它知道它起了作用?",
|
|
238
254
|
"consentAllow": "算上我 ❤️",
|
|
239
255
|
"consentDecline": "保持隐身",
|
|
240
256
|
"consentChoice": "隐私选择"
|
|
@@ -290,8 +306,10 @@ var el=document.getElementById("consent");if(!el||!el.showModal)return;
|
|
|
290
306
|
var open=function(){if(!el.open){el.returnValue="";el.showModal();var p=el.querySelector(".preferred");if(p)p.focus()}};
|
|
291
307
|
el.addEventListener("close",function(){
|
|
292
308
|
var rv=el.returnValue;
|
|
293
|
-
var v=rv==="confirm"?"granted":rv==="denied"?"denied":null;
|
|
294
|
-
if(v){
|
|
309
|
+
var v=rv==="confirm"?"granted+ads":rv==="denied"?"denied":null;
|
|
310
|
+
if(v){var g=v==="denied"?"denied":"granted";
|
|
311
|
+
gtag("consent","update",{analytics_storage:g,ad_storage:g,ad_user_data:g});
|
|
312
|
+
try{localStorage.setItem("consent",v)}catch(_){}}
|
|
295
313
|
else{try{sessionStorage.setItem("consent-later","1")}catch(_){}}
|
|
296
314
|
});
|
|
297
315
|
var doors=document.querySelectorAll("[data-consent-open]");
|