@justai/cuts 0.4.0 → 0.5.1
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 +6 -3
- package/src/Base.astro +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/cuts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A persona's named parts — the page shell that holds them, and the cuts themselves.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -16,10 +16,13 @@
|
|
|
16
16
|
"./Base.astro": "./src/Base.astro"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"@justai/ui": ">=0.2.0",
|
|
20
|
+
"astro": ">=5"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@justai/core": "^0.1.0"
|
|
24
27
|
}
|
|
25
28
|
}
|
package/src/Base.astro
CHANGED
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
* The dictionaries. Same reason, stronger: the machinery is shared, the CONTENT is the persona's.
|
|
27
27
|
*/
|
|
28
28
|
import { dir as dirOf } from "@justai/ui/locale";
|
|
29
|
+
// The load-bearing behaviour is framework-free and lives in @justai/core, so `feed` (Next) injects the
|
|
30
|
+
// SAME strings instead of hand-copying them. This binding just decides where they go in an Astro head.
|
|
31
|
+
import { AUTH_CAPTURE_JS, JS_CLASS_JS, REVEAL_CSS } from "@justai/core";
|
|
29
32
|
|
|
30
33
|
interface Props {
|
|
31
34
|
lang: string;
|
|
@@ -71,15 +74,15 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
|
|
|
71
74
|
current hash onto the next locale's URL (LangPicker), which would PROPAGATE the raw token
|
|
72
75
|
into a new page and into history. Capturing first defeats both. Move this and sign-in breaks
|
|
73
76
|
silently — no error, the visitor simply lands back signed out. */}
|
|
74
|
-
<script is:inline
|
|
75
|
-
<script is:inline
|
|
77
|
+
<script is:inline set:html={AUTH_CAPTURE_JS} />
|
|
78
|
+
<script is:inline set:html={JS_CLASS_JS} />
|
|
76
79
|
{/* Reveal only after a page marks itself ready — gated behind .js so the page is always visible
|
|
77
80
|
if JS is off, and no scroll flash before we position at the Kernel. This style is a TRAP as
|
|
78
81
|
much as a feature, and the warning must stay beside it: ANY page using this layout without a
|
|
79
82
|
kernel script that sets body.ready stays invisible FOREVER. The 404 is the page that keeps
|
|
80
83
|
falling into this — it carries its own inline body.classList.add("ready") for exactly this
|
|
81
84
|
reason. Nothing errors; the page is simply never shown. */}
|
|
82
|
-
<style is:inline
|
|
85
|
+
<style is:inline set:html={REVEAL_CSS} />
|
|
83
86
|
{/* The locale list is INJECTED, never typed. It used to be a literal array here — a second
|
|
84
87
|
declaration beside src/i18n/index.ts, kept in agreement by hand, in the one place where
|
|
85
88
|
being wrong is invisible: a locale missing from this list simply never auto-routes, and
|
|
@@ -182,7 +185,12 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
|
|
|
182
185
|
{gaId && (
|
|
183
186
|
<script is:inline define:vars={{ gaId }}>
|
|
184
187
|
window.dataLayer = window.dataLayer || [];
|
|
185
|
-
function gtag
|
|
188
|
+
// gtag is put on WINDOW, not declared as `function gtag`, and this is load-bearing: `define:vars`
|
|
189
|
+
// wraps this inline script in an IIFE to scope the injected `gaId`, so a `function gtag` here
|
|
190
|
+
// would be trapped in that IIFE — and the consent banner's own inline script (in the body) calls
|
|
191
|
+
// gtag, giving "gtag is not defined" the moment a European visitor clicks Allow/Decline (the
|
|
192
|
+
// choice is never applied, the banner never closes). Global on window, both scripts see it.
|
|
193
|
+
window.gtag = window.gtag || function () { window.dataLayer.push(arguments); };
|
|
186
194
|
gtag("js", new Date());
|
|
187
195
|
gtag("consent", "default", { ad_storage: "denied", ad_user_data: "denied", ad_personalization: "denied", analytics_storage: "granted" });
|
|
188
196
|
// EEA + UK + CH: deny analytics until the visitor consents (the banner below grants it).
|