@justai/cuts 0.3.2 → 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 +6 -3
- package/src/Base.astro +24 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/cuts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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;
|
|
@@ -40,8 +43,11 @@ interface Props {
|
|
|
40
43
|
/** Defaults are the fleet majority, measured. Override when the persona genuinely differs. */
|
|
41
44
|
themeDark?: string;
|
|
42
45
|
themeLight?: string;
|
|
43
|
-
/** app.zone's property. justai.pro
|
|
44
|
-
|
|
46
|
+
/** app.zone's property by default. justai.pro passes its own. Pass `null` for a persona that runs
|
|
47
|
+
* NO analytics at all — the whole GA block and the consent banner are then not rendered. The
|
|
48
|
+
* privacy/terms sub-personas use this: the surface that proves it collects nothing by running
|
|
49
|
+
* nothing. */
|
|
50
|
+
gaId?: string | null;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
const {
|
|
@@ -68,15 +74,15 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
|
|
|
68
74
|
current hash onto the next locale's URL (LangPicker), which would PROPAGATE the raw token
|
|
69
75
|
into a new page and into history. Capturing first defeats both. Move this and sign-in breaks
|
|
70
76
|
silently — no error, the visitor simply lands back signed out. */}
|
|
71
|
-
<script is:inline
|
|
72
|
-
<script is:inline
|
|
77
|
+
<script is:inline set:html={AUTH_CAPTURE_JS} />
|
|
78
|
+
<script is:inline set:html={JS_CLASS_JS} />
|
|
73
79
|
{/* Reveal only after a page marks itself ready — gated behind .js so the page is always visible
|
|
74
80
|
if JS is off, and no scroll flash before we position at the Kernel. This style is a TRAP as
|
|
75
81
|
much as a feature, and the warning must stay beside it: ANY page using this layout without a
|
|
76
82
|
kernel script that sets body.ready stays invisible FOREVER. The 404 is the page that keeps
|
|
77
83
|
falling into this — it carries its own inline body.classList.add("ready") for exactly this
|
|
78
84
|
reason. Nothing errors; the page is simply never shown. */}
|
|
79
|
-
<style is:inline
|
|
85
|
+
<style is:inline set:html={REVEAL_CSS} />
|
|
80
86
|
{/* The locale list is INJECTED, never typed. It used to be a literal array here — a second
|
|
81
87
|
declaration beside src/i18n/index.ts, kept in agreement by hand, in the one place where
|
|
82
88
|
being wrong is invisible: a locale missing from this list simply never auto-routes, and
|
|
@@ -170,6 +176,13 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
|
|
|
170
176
|
has no access to component scope, so a bare `gaId` here would be undefined at runtime and
|
|
171
177
|
every persona would report to a property that does not exist — silently, with no failed
|
|
172
178
|
request and no console error, which is the only kind of analytics bug nobody finds. */}
|
|
179
|
+
{/* gaId can be null: a persona that measures NOTHING. Pass gaId={null} and the entire analytics
|
|
180
|
+
block below and the consent banner in the body are simply not rendered — no gtag, no cookie,
|
|
181
|
+
no request. The privacy/terms sub-personas run this way, and it is not an exception but their
|
|
182
|
+
character: the one surface that can prove it collects nothing by running nothing (doctrine 15).
|
|
183
|
+
The default stays app.zone's property, so every existing persona is unchanged — this costs the
|
|
184
|
+
ten that measure themselves exactly nothing. */}
|
|
185
|
+
{gaId && (
|
|
173
186
|
<script is:inline define:vars={{ gaId }}>
|
|
174
187
|
window.dataLayer = window.dataLayer || [];
|
|
175
188
|
function gtag() { dataLayer.push(arguments); }
|
|
@@ -196,11 +209,15 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
|
|
|
196
209
|
});
|
|
197
210
|
});
|
|
198
211
|
</script>
|
|
212
|
+
)}
|
|
199
213
|
</head>
|
|
200
214
|
<body>
|
|
201
215
|
<slot />
|
|
202
216
|
{/* Consent banner — shown only to European-timezone visitors with no stored choice. The
|
|
203
|
-
Consent Mode region default already denies analytics for the EEA/UK until "Allow".
|
|
217
|
+
Consent Mode region default already denies analytics for the EEA/UK until "Allow". Gated on
|
|
218
|
+
gaId with the analytics block above: a persona that runs no analytics has nothing to consent
|
|
219
|
+
to, so it renders no banner. */}
|
|
220
|
+
{gaId && (
|
|
204
221
|
<div id="cc" class="cc" role="dialog" aria-label={t.chromePrivacy}>
|
|
205
222
|
<div class="cc-card">
|
|
206
223
|
<p class="cc-text">{t.consentText}</p>
|
|
@@ -246,5 +263,6 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
|
|
|
246
263
|
} catch (_) {}
|
|
247
264
|
})();
|
|
248
265
|
</script>
|
|
266
|
+
)}
|
|
249
267
|
</body>
|
|
250
268
|
</html>
|