@justai/core 0.36.0 → 0.38.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/dist/analytics.d.ts +0 -17
- package/dist/analytics.js +41 -11
- package/dist/scroll.d.ts +12 -0
- package/dist/scroll.js +6 -2
- package/package.json +2 -2
package/dist/analytics.d.ts
CHANGED
|
@@ -4,23 +4,6 @@
|
|
|
4
4
|
* Part of the framework-free heart of the persona shell. See `./index.js` for what this package is
|
|
5
5
|
* and why its behaviour lives one level below @justai/cuts.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* queries: which measurement id does this host use · wrong GA4 stream · a persona reports into the
|
|
9
|
-
* wrong property · G-13L3BP6XCW vs G-K2J4FQTQ8L · how does feed pick its analytics tag
|
|
10
|
-
*
|
|
11
|
-
* THE ECOSYSTEM'S STREAM LAYOUT, declared once.
|
|
12
|
-
*
|
|
13
|
-
* One GA4 property, two web streams: `G-13L3BP6XCW` for app.zone and its personas, `G-K2J4FQTQ8L`
|
|
14
|
-
* for justai.pro and its own sub-domains. A page reports into whichever stream ITS CODE loads, so
|
|
15
|
-
* "app.zone versus justai.pro" is a fact about our code rather than a rule the platform enforces —
|
|
16
|
-
* put a persona on the wrong one and nothing errors, nothing is missing, the numbers simply land in
|
|
17
|
-
* the wrong column. That is why the mapping is a function here and not a constant copied per repo.
|
|
18
|
-
*
|
|
19
|
-
* A STATIC persona cannot call this — it has no host at build time — so @justai/cuts keeps its own
|
|
20
|
-
* default and `justai` passes the override. A SERVER-rendered surface (feed) knows the Host header
|
|
21
|
-
* and must use this. The two must agree; if a third stream ever appears, this is the one place it
|
|
22
|
-
* is added.
|
|
23
|
-
*/
|
|
24
7
|
export declare function measurementIdFor(host: string | null | undefined): string;
|
|
25
8
|
/**
|
|
26
9
|
* queries: analytics inline script · gtag block · consent defaults · why is dev traffic in GA4 ·
|
package/dist/analytics.js
CHANGED
|
@@ -6,24 +6,53 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* queries: which measurement id does this host use · wrong GA4 stream · a persona reports into the
|
|
9
|
-
* wrong property · G-13L3BP6XCW vs G-K2J4FQTQ8L ·
|
|
9
|
+
* wrong property · G-13L3BP6XCW vs G-K2J4FQTQ8L · pin.games analytics · a game reports into
|
|
10
|
+
* app.zone · how does feed pick its analytics tag · adding an apex to analytics ·
|
|
11
|
+
* measurementIdFor returns empty
|
|
10
12
|
*
|
|
11
|
-
* THE ECOSYSTEM'S STREAM LAYOUT
|
|
13
|
+
* THE ECOSYSTEM'S STREAM LAYOUT — A ROW PER HOUSEHOLD.
|
|
12
14
|
*
|
|
13
|
-
* One GA4 property,
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* One GA4 property, a web stream per apex. A page reports into whichever stream ITS CODE loads, so
|
|
16
|
+
* which household a persona belongs to is a fact about our code rather than a rule the platform
|
|
17
|
+
* enforces — put a persona on the wrong one and nothing errors, nothing is missing, the numbers
|
|
18
|
+
* simply land in the wrong column. That is why the mapping is a function here and not a constant
|
|
19
|
+
* copied per repo.
|
|
20
|
+
*
|
|
21
|
+
* IT WAS A TERNARY, AND THE TERNARY WAS ALREADY WRONG. The previous version read
|
|
22
|
+
* `justai.pro ? K2J4 : 13L3` — everything that was not justai.pro reported into APP.ZONE's stream,
|
|
23
|
+
* pin.games included, while the comment above it promised that a third stream would be added *here*.
|
|
24
|
+
* pin.games got its stream (`G-PPMLN9SYD2`), the promise was not kept, and the mistake stayed
|
|
25
|
+
* invisible because it only shows on a SERVER-rendered surface: a static game persona carries its id
|
|
26
|
+
* from the template and is correct, while `/feed/*` on the same host would have counted as app.zone.
|
|
27
|
+
* Found on 2026-08-24 while standing up a third apex — which is exactly the moment a two-branch shape
|
|
28
|
+
* stops being able to hold the truth.
|
|
29
|
+
*
|
|
30
|
+
* AN UNKNOWN APEX RETURNS THE EMPTY STRING, and `analyticsJs` then measures nothing. That is the
|
|
31
|
+
* whole difference between the old shape and this one: a household we have not been told about must
|
|
32
|
+
* produce NO data rather than SOMEBODY ELSE'S data. Silence is a gap you can see in a report; a wrong
|
|
33
|
+
* column is a number you will trust. When a new apex arrives its row goes here — and until its stream
|
|
34
|
+
* exists, its pages honestly count as nobody.
|
|
35
|
+
*
|
|
36
|
+
* `cityinmotion.nl` was that case for exactly one day. It was added to this table the moment its GA4
|
|
37
|
+
* data stream existed, and the ORDER is the point: the stream is created first, and the row follows.
|
|
38
|
+
* A row written in anticipation would name an id that measures into nothing, which looks identical to
|
|
39
|
+
* a row that works.
|
|
18
40
|
*
|
|
19
41
|
* A STATIC persona cannot call this — it has no host at build time — so @justai/cuts keeps its own
|
|
20
|
-
* default and `justai` passes the override
|
|
21
|
-
*
|
|
22
|
-
* is
|
|
42
|
+
* default and `justai` passes the override, while `templates/bin/new.mjs` writes the id at birth from
|
|
43
|
+
* its own apex table. A SERVER-rendered surface (feed) knows the Host header and must use this. All
|
|
44
|
+
* of them must agree, and this is the file that is right by construction.
|
|
23
45
|
*/
|
|
46
|
+
const STREAMS = {
|
|
47
|
+
"app.zone": "G-13L3BP6XCW",
|
|
48
|
+
"pin.games": "G-PPMLN9SYD2",
|
|
49
|
+
"justai.pro": "G-K2J4FQTQ8L",
|
|
50
|
+
"cityinmotion.nl": "G-JY34Z58S16",
|
|
51
|
+
};
|
|
24
52
|
export function measurementIdFor(host) {
|
|
25
53
|
const h = String(host || "").toLowerCase().split(":")[0];
|
|
26
|
-
|
|
54
|
+
const apex = Object.keys(STREAMS).find((a) => h === a || h.endsWith("." + a));
|
|
55
|
+
return apex ? STREAMS[apex] : "";
|
|
27
56
|
}
|
|
28
57
|
/**
|
|
29
58
|
* queries: analytics inline script · gtag block · consent defaults · why is dev traffic in GA4 ·
|
|
@@ -84,6 +113,7 @@ window.gtag=window.gtag||function(){(window.dataLayer=window.dataLayer||[]).push
|
|
|
84
113
|
var __h=location.hostname;
|
|
85
114
|
if(!(__h==="localhost"||__h==="127.0.0.1"||__h==="::1"||__h==="[::1]"||__h.indexOf("dev-")===0)){
|
|
86
115
|
var __g=${JSON.stringify(gaId)};
|
|
116
|
+
if(!__g)return;
|
|
87
117
|
window.dataLayer=window.dataLayer||[];
|
|
88
118
|
window.gtag=window.gtag||function(){window.dataLayer.push(arguments)};
|
|
89
119
|
gtag("js",new Date());
|
package/dist/scroll.d.ts
CHANGED
|
@@ -18,6 +18,18 @@ export interface PersonaScrollOptions {
|
|
|
18
18
|
titleFor?: (id: string) => string;
|
|
19
19
|
/** Whether this owns `body.ready`. Pass `false` on a page that renders asynchronously. */
|
|
20
20
|
reveal?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Which section a visit with no hash opens on. Defaults to `"kernel"`, which is right for every
|
|
23
|
+
* persona in the fleet: their kernel is the thing they do, and the profile above it is a header
|
|
24
|
+
* you scroll back to.
|
|
25
|
+
*
|
|
26
|
+
* app.zone is the exception this exists for. Its kernel is a catalogue of the OTHER personas, so
|
|
27
|
+
* landing there opens the house on a list of its rooms — the mark, the wordmark and the sentence
|
|
28
|
+
* that say what app.zone is scroll past before anyone reads them. Named rather than boolean so a
|
|
29
|
+
* persona can point at any of its own cuts; an id that is not on the page falls back to the
|
|
30
|
+
* kernel rather than landing nowhere.
|
|
31
|
+
*/
|
|
32
|
+
landOn?: string;
|
|
21
33
|
}
|
|
22
34
|
export declare function personaScroll(options?: PersonaScrollOptions): void;
|
|
23
35
|
export declare function personaScrollJs(options?: PersonaScrollOptions): string;
|
package/dist/scroll.js
CHANGED
|
@@ -222,8 +222,12 @@ export function personaScroll(options) {
|
|
|
222
222
|
const sentTo = (() => {
|
|
223
223
|
const t = cuts.find((c) => "#" + c[0].id === location.hash);
|
|
224
224
|
// A section hash is honoured on load and refresh; anything else — including #kernel and no hash
|
|
225
|
-
// at all — lands on the kernel.
|
|
226
|
-
|
|
225
|
+
// at all — lands on `landOn`, which is the kernel unless a persona says otherwise.
|
|
226
|
+
//
|
|
227
|
+
// The fallback chain is deliberate: an unknown id must not land the page nowhere. `el()` returns
|
|
228
|
+
// null for an id the page does not carry, and every caller downstream of this reads `sentTo` as
|
|
229
|
+
// a section that exists.
|
|
230
|
+
return t ? t[0] : (o.landOn ? el(o.landOn) : null) ?? kernel;
|
|
227
231
|
})();
|
|
228
232
|
const land = () => {
|
|
229
233
|
// presentation mode owns the viewport — a page presenting itself does not scroll out from under
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "The framework-free heart of the persona shell
|
|
3
|
+
"version": "0.38.0",
|
|
4
|
+
"description": "The framework-free heart of the persona shell — 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": {
|
|
7
7
|
"type": "git",
|