@flamingo-stack/openframe-frontend-core 0.0.644-2208.6338.1 → 0.0.644
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/chat-protocol/index.cjs +2 -2
- package/dist/chat-protocol/index.cjs.map +1 -1
- package/dist/chat-protocol/index.js +2 -2
- package/dist/chat-protocol/index.js.map +1 -1
- package/dist/chat-protocol/source-metadata.d.ts +14 -7
- package/dist/chat-protocol/source-metadata.d.ts.map +1 -1
- package/dist/{chunk-NUM4HHBK.js → chunk-27RD5XTP.js} +3 -3
- package/dist/{chunk-EHL24T5A.js → chunk-3DGRXC74.js} +3 -3
- package/dist/{chunk-HGLTNB3J.cjs → chunk-3UBT2OIX.cjs} +20 -20
- package/dist/{chunk-HGLTNB3J.cjs.map → chunk-3UBT2OIX.cjs.map} +1 -1
- package/dist/{chunk-7NVFN4ZL.js → chunk-4WVWRFGP.js} +6 -6
- package/dist/{chunk-S3DZK5TT.cjs → chunk-65EVGKFV.cjs} +7 -7
- package/dist/{chunk-S3DZK5TT.cjs.map → chunk-65EVGKFV.cjs.map} +1 -1
- package/dist/{chunk-LT4SBH5F.js → chunk-7Q5XXPCB.js} +6 -6
- package/dist/{chunk-I5X3AEXW.cjs → chunk-7R2DIGG4.cjs} +2 -6
- package/dist/chunk-7R2DIGG4.cjs.map +1 -0
- package/dist/{chunk-3IIO432P.js → chunk-B3Z3RJRW.js} +2 -2
- package/dist/{chunk-X5NEQSGO.cjs → chunk-B5IFXCRF.cjs} +22 -22
- package/dist/{chunk-X5NEQSGO.cjs.map → chunk-B5IFXCRF.cjs.map} +1 -1
- package/dist/{chunk-AEOKRT2V.cjs → chunk-C5Y5T6GC.cjs} +15 -15
- package/dist/{chunk-AEOKRT2V.cjs.map → chunk-C5Y5T6GC.cjs.map} +1 -1
- package/dist/{chunk-U3VUTYJO.cjs → chunk-CBXZSTAG.cjs} +152 -152
- package/dist/{chunk-U3VUTYJO.cjs.map → chunk-CBXZSTAG.cjs.map} +1 -1
- package/dist/{chunk-ZJQMZMZD.cjs → chunk-DCCY54LU.cjs} +6 -6
- package/dist/{chunk-ZJQMZMZD.cjs.map → chunk-DCCY54LU.cjs.map} +1 -1
- package/dist/{chunk-IR2WBWIH.cjs → chunk-FAD5WURS.cjs} +81 -81
- package/dist/{chunk-IR2WBWIH.cjs.map → chunk-FAD5WURS.cjs.map} +1 -1
- package/dist/{chunk-NHQBAAKW.js → chunk-FOSIR4QF.js} +2 -6
- package/dist/chunk-FOSIR4QF.js.map +1 -0
- package/dist/{chunk-OT2ZEKLJ.js → chunk-HOGOQA2X.js} +2 -2
- package/dist/{chunk-P22QC266.js → chunk-HPWLIYRL.js} +3 -3
- package/dist/{chunk-X7OGQRZR.js → chunk-I57XLISO.js} +4 -4
- package/dist/{chunk-X7OGQRZR.js.map → chunk-I57XLISO.js.map} +1 -1
- package/dist/{chunk-SHSD7KJ4.cjs → chunk-IIXB5REN.cjs} +3 -3
- package/dist/{chunk-SHSD7KJ4.cjs.map → chunk-IIXB5REN.cjs.map} +1 -1
- package/dist/{chunk-OTZB66SU.js → chunk-IXD6SHQ6.js} +4 -4
- package/dist/{chunk-J227IYWA.cjs → chunk-LZYPSDFE.cjs} +59 -59
- package/dist/{chunk-J227IYWA.cjs.map → chunk-LZYPSDFE.cjs.map} +1 -1
- package/dist/{chunk-5NY3FAOW.cjs → chunk-MCQAOIUK.cjs} +28 -28
- package/dist/{chunk-5NY3FAOW.cjs.map → chunk-MCQAOIUK.cjs.map} +1 -1
- package/dist/{chunk-ISUFPQ6K.js → chunk-MRIOYSXH.js} +3 -3
- package/dist/{chunk-4PASSDJ6.cjs → chunk-OMSUWB6A.cjs} +29 -29
- package/dist/{chunk-4PASSDJ6.cjs.map → chunk-OMSUWB6A.cjs.map} +1 -1
- package/dist/{chunk-VADHSV6U.cjs → chunk-OVXYX47B.cjs} +10 -10
- package/dist/{chunk-VADHSV6U.cjs.map → chunk-OVXYX47B.cjs.map} +1 -1
- package/dist/{chunk-VXPPAEVX.js → chunk-PFV4DAX5.js} +4 -4
- package/dist/{chunk-JIV55LTZ.cjs → chunk-RB6L5EGM.cjs} +203 -203
- package/dist/{chunk-JIV55LTZ.cjs.map → chunk-RB6L5EGM.cjs.map} +1 -1
- package/dist/{chunk-EUI2MDXC.cjs → chunk-RFFF2EYD.cjs} +11 -11
- package/dist/{chunk-EUI2MDXC.cjs.map → chunk-RFFF2EYD.cjs.map} +1 -1
- package/dist/{chunk-SKTE6T47.js → chunk-RNMGKAS6.js} +7 -7
- package/dist/{chunk-NTN4ZLAV.cjs → chunk-RWURXICE.cjs} +32 -32
- package/dist/{chunk-NTN4ZLAV.cjs.map → chunk-RWURXICE.cjs.map} +1 -1
- package/dist/{chunk-PB3X3AAY.js → chunk-S2KMNFFN.js} +3 -3
- package/dist/{chunk-YNVZ5VJJ.js → chunk-SKABQX44.js} +3 -3
- package/dist/{chunk-5K67KZH7.cjs → chunk-TGUA3C4U.cjs} +5 -5
- package/dist/{chunk-5K67KZH7.cjs.map → chunk-TGUA3C4U.cjs.map} +1 -1
- package/dist/{chunk-52Y2AHM6.js → chunk-TTVOBWAH.js} +3 -3
- package/dist/{chunk-7ZMKUISO.js → chunk-UEXIMEVU.js} +5 -5
- package/dist/{chunk-MLIVKPZI.cjs → chunk-UKV52KAP.cjs} +33 -33
- package/dist/{chunk-MLIVKPZI.cjs.map → chunk-UKV52KAP.cjs.map} +1 -1
- package/dist/{chunk-HMNGAQJ6.js → chunk-VE52MSYC.js} +5 -5
- package/dist/components/case-studies/index.cjs +16 -16
- package/dist/components/case-studies/index.js +4 -4
- package/dist/components/chat/index.cjs +3 -3
- package/dist/components/chat/index.js +2 -2
- package/dist/components/chat/types/entities/program-types.d.ts +2 -23
- package/dist/components/chat/types/entities/program-types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/contact/index.js +4 -4
- package/dist/components/docs/index.cjs +8 -8
- package/dist/components/docs/index.js +7 -7
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/embeds/index.js +4 -4
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/index.cjs +4 -4
- package/dist/components/features/index.js +3 -3
- package/dist/components/help-center-pages/index.cjs +24 -24
- package/dist/components/help-center-pages/index.js +15 -15
- package/dist/components/index.cjs +53 -53
- package/dist/components/index.js +15 -15
- package/dist/components/meeting-scheduler/index.cjs +40 -40
- package/dist/components/meeting-scheduler/index.js +3 -3
- package/dist/components/navigation/index.cjs +7 -7
- package/dist/components/navigation/index.js +6 -6
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +8 -8
- package/dist/components/tickets/index.js +7 -7
- package/dist/components/ui/index.cjs +4 -4
- package/dist/components/ui/index.js +3 -3
- package/dist/index.cjs +9 -9
- package/dist/index.js +7 -7
- package/dist/utils/format.d.ts +10 -17
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +1 -5
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +1 -5
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/program-instant.d.ts +9 -35
- package/dist/utils/program-instant.d.ts.map +1 -1
- package/dist/utils/url-safety.d.ts +5 -6
- package/dist/utils/url-safety.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/chat-protocol/__tests__/source-metadata.test.ts +34 -48
- package/src/chat-protocol/source-metadata.ts +18 -12
- package/src/components/chat/types/entities/program-types.ts +2 -23
- package/src/utils/__tests__/format-program-dates.test.ts +2 -34
- package/src/utils/__tests__/program-instant.test.ts +1 -46
- package/src/utils/format.ts +12 -23
- package/src/utils/program-instant.ts +13 -44
- package/src/utils/url-safety.ts +5 -6
- package/dist/chunk-I5X3AEXW.cjs.map +0 -1
- package/dist/chunk-NHQBAAKW.js.map +0 -1
- /package/dist/{chunk-NUM4HHBK.js.map → chunk-27RD5XTP.js.map} +0 -0
- /package/dist/{chunk-EHL24T5A.js.map → chunk-3DGRXC74.js.map} +0 -0
- /package/dist/{chunk-7NVFN4ZL.js.map → chunk-4WVWRFGP.js.map} +0 -0
- /package/dist/{chunk-LT4SBH5F.js.map → chunk-7Q5XXPCB.js.map} +0 -0
- /package/dist/{chunk-3IIO432P.js.map → chunk-B3Z3RJRW.js.map} +0 -0
- /package/dist/{chunk-OT2ZEKLJ.js.map → chunk-HOGOQA2X.js.map} +0 -0
- /package/dist/{chunk-P22QC266.js.map → chunk-HPWLIYRL.js.map} +0 -0
- /package/dist/{chunk-OTZB66SU.js.map → chunk-IXD6SHQ6.js.map} +0 -0
- /package/dist/{chunk-ISUFPQ6K.js.map → chunk-MRIOYSXH.js.map} +0 -0
- /package/dist/{chunk-VXPPAEVX.js.map → chunk-PFV4DAX5.js.map} +0 -0
- /package/dist/{chunk-SKTE6T47.js.map → chunk-RNMGKAS6.js.map} +0 -0
- /package/dist/{chunk-PB3X3AAY.js.map → chunk-S2KMNFFN.js.map} +0 -0
- /package/dist/{chunk-YNVZ5VJJ.js.map → chunk-SKABQX44.js.map} +0 -0
- /package/dist/{chunk-52Y2AHM6.js.map → chunk-TTVOBWAH.js.map} +0 -0
- /package/dist/{chunk-7ZMKUISO.js.map → chunk-UEXIMEVU.js.map} +0 -0
- /package/dist/{chunk-HMNGAQJ6.js.map → chunk-VE52MSYC.js.map} +0 -0
|
@@ -21,34 +21,16 @@
|
|
|
21
21
|
*
|
|
22
22
|
* THE RULE:
|
|
23
23
|
*
|
|
24
|
-
* - `item.date` IS the instant to render. The host resolves it once
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* - `item.date` IS the instant to render. The host resolves it once and hands
|
|
25
|
+
* the same value to the card, the model's context and the API wire.
|
|
26
|
+
* Preferring `start_at` looks like it buys intra-card coherence — it does, by
|
|
27
|
+
* disagreeing with everything else.
|
|
28
28
|
* - `start_at` / `end_at` remain the source for DURATION, which is elapsed time
|
|
29
29
|
* rather than a display date.
|
|
30
|
-
* - A DISPLAY OVERRIDE is a chosen date, not a moment. An admin backdating in a
|
|
31
|
-
* `datetime-local` control gets `00:00`, so "show this as March 19" is stored
|
|
32
|
-
* at UTC midnight; rendering that in a west-of-UTC zone shows March 18 at
|
|
33
|
-
* 8 PM — a day early, at a time nobody chose. Such a value renders UTC-pinned
|
|
34
|
-
* with no clock and WITHOUT A ZONE LABEL.
|
|
35
30
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* through `toISOString()`, so it is always a full instant — an earlier
|
|
39
|
-
* attempt keyed on precision and could therefore never fire.
|
|
31
|
+
* `timezone` here is "the zone this value renders in and may be labelled with".
|
|
32
|
+
* A row that declares none keeps the UTC pin (the React #418 fix).
|
|
40
33
|
*
|
|
41
|
-
* THE ZONE IS NULLED RATHER THAN FLAGGED, deliberately. `timezone` here is "the
|
|
42
|
-
* zone this value renders in and may be labelled with", so a day-valued row
|
|
43
|
-
* carries none and a consumer CANNOT print `America/New_York` under a clock the
|
|
44
|
-
* rule just suppressed. Three surfaces had to remember that gate; two forgot,
|
|
45
|
-
* and one of them rendered a bare IANA string under an empty heading. A rule
|
|
46
|
-
* enforced by the shape of the data cannot be forgotten by the next call site.
|
|
47
|
-
*
|
|
48
|
-
* There is deliberately NO escape hatch back to the un-nulled zone. One was
|
|
49
|
-
* added ("for the rare consumer that needs it as data") and no consumer ever
|
|
50
|
-
* wanted it — an un-nulled copy hanging off the resolved value is just the
|
|
51
|
-
* mistake again, one property away.
|
|
52
34
|
*/
|
|
53
35
|
/** Read a string field off an item type that does not declare it. */
|
|
54
36
|
export declare const programStr: (value: unknown) => string | null;
|
|
@@ -57,12 +39,8 @@ export interface ProgramInstant {
|
|
|
57
39
|
* to `utcDate`. */
|
|
58
40
|
instant: string | null;
|
|
59
41
|
/** The zone this value RENDERS IN and may be LABELLED with. Null when the row
|
|
60
|
-
* declares none
|
|
61
|
-
* on why this is nulled rather than flagged. */
|
|
42
|
+
* declares none. */
|
|
62
43
|
timezone: string | null;
|
|
63
|
-
/** True when an admin display override supplied the value: render the day
|
|
64
|
-
* UTC-pinned, with no clock. */
|
|
65
|
-
dateOnly: boolean;
|
|
66
44
|
/** The row's canonical date string, used when there is no zone to render in.
|
|
67
45
|
* Kept on the resolved value so the UTC fallback is not re-derived (and
|
|
68
46
|
* re-formatted differently) at each call site. */
|
|
@@ -72,16 +50,13 @@ export interface ProgramInstant {
|
|
|
72
50
|
* The columns this rule reads. Declared structurally rather than as a
|
|
73
51
|
* `Record<string, unknown>` so a caller holding a real `BaseProgramItem` can
|
|
74
52
|
* pass it straight in: while the parameter was a bare record, every one of the
|
|
75
|
-
* four call sites wrote `as unknown as Record<string, unknown
|
|
76
|
-
* every call site is how a producer that forgets to set the flag goes
|
|
77
|
-
* unnoticed by the compiler.
|
|
53
|
+
* four call sites wrote `as unknown as Record<string, unknown>`.
|
|
78
54
|
*/
|
|
79
55
|
export interface ProgramDateFields {
|
|
80
56
|
date?: unknown;
|
|
81
57
|
start_at?: unknown;
|
|
82
58
|
end_at?: unknown;
|
|
83
59
|
timezone?: unknown;
|
|
84
|
-
date_is_display_override?: unknown;
|
|
85
60
|
}
|
|
86
61
|
/** Resolve what a program item should render. */
|
|
87
62
|
export declare function programDateInstant(item: ProgramDateFields): ProgramInstant;
|
|
@@ -93,8 +68,7 @@ export declare function programDateInstant(item: ProgramDateFields): ProgramInst
|
|
|
93
68
|
* columns in four different shapes (`programStr`, raw reads, `?? null`, and an
|
|
94
69
|
* `in`-guarded cast), which is the same defect one field-pair down from the one
|
|
95
70
|
* this module exists to fix. They are read off the row, never off the resolved
|
|
96
|
-
* instant, because elapsed time is not a display date
|
|
97
|
-
* day shown, and a webinar still runs for 45 minutes.
|
|
71
|
+
* instant, because elapsed time is not a display date.
|
|
98
72
|
*/
|
|
99
73
|
export declare function webinarTiming(item: ProgramDateFields): {
|
|
100
74
|
startAt: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program-instant.d.ts","sourceRoot":"","sources":["../../src/utils/program-instant.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"program-instant.d.ts","sourceRoot":"","sources":["../../src/utils/program-instant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,qEAAqE;AACrE,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,IAA2D,CAAC;AAEjH,MAAM,WAAW,cAAc;IAC7B;wBACoB;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;yBACqB;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;uDAEmD;IACnD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,iDAAiD;AACjD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,cAAc,CAY1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG;IACtD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAIA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,iBAAiB,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACrD,GAAG,EAAE;IACH,IAAI,EAAE,CAAC,EAAE,EAAE,cAAc,KAAK,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,WAAW,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,MAAM,CAAC;CACrG,GACA;IAAE,EAAE,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAc/D;AAED;;kBAEkB;AAClB,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,GAAG,SAAS,KAAK,MAAM,CAAC;IAClE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;IAC7C,WAAW,EAAE,CACX,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,KAC5E,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,oBAAoB,EAAE,IAAI,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO;eAMxF,cAAc;wBA7BP,MAAM,GAAG,IAAI,KAAK,MAAM;sBA+BxB,cAAc,KAAK;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;EAGxF"}
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
* have no business in an href" had two copies once, and a security predicate
|
|
6
6
|
* kept in sync by a comment drifts.
|
|
7
7
|
*
|
|
8
|
-
* `isSameOriginPath`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* decoder accepts absolute https only.
|
|
8
|
+
* `isSameOriginPath` answers "does this path stay on our origin" for the
|
|
9
|
+
* render-time `safeHref` — the ONE gate every chat href passes. The wire decoder
|
|
10
|
+
* does not judge links at all: it carries them, because resolving a link is a
|
|
11
|
+
* client decision (only the rendering page knows where it is embedded), and a
|
|
12
|
+
* second, stricter gate there only dropped links it could not resolve itself.
|
|
14
13
|
*
|
|
15
14
|
* Pure and dependency-free, so the server-safe `chat-protocol` leaf and the
|
|
16
15
|
* client-side card utils can both import it directly.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-safety.d.ts","sourceRoot":"","sources":["../../src/utils/url-safety.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"url-safety.d.ts","sourceRoot":"","sources":["../../src/utils/url-safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;sBAEsB;AACtB,eAAO,MAAM,gBAAgB,QAAyD,CAAC;AAKvF;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAM3D"}
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { describe, expect, it } from 'vitest';
|
|
10
|
+
import { safeHref } from '../../components/chat/utils/compact-card-classes';
|
|
10
11
|
import { decodeNatsChunk } from '../nats-decoder';
|
|
11
12
|
import { mergeSourceMetadata, sourceMetadataEvent, youtubeVideoId } from '../source-metadata';
|
|
12
13
|
|
|
@@ -110,18 +111,11 @@ describe('sourceMetadataEvent', () => {
|
|
|
110
111
|
expect(event?.sources?.[0].name).toBe('First');
|
|
111
112
|
});
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// A root-relative href is NOT a same-origin link for this payload: its
|
|
121
|
-
// consumer (the dashboard) has no hub origin, so `/onboarding-guides/x` would
|
|
122
|
-
// resolve against the dashboard's own domain and 404. The producer absolutises;
|
|
123
|
-
// anything relative that still arrives is dropped rather than rendered broken.
|
|
124
|
-
it('drops a root-relative external URL instead of rendering a broken link', () => {
|
|
114
|
+
// Links are CARRIED, not judged here: resolving a link is a client decision
|
|
115
|
+
// (only the rendering page knows where it is embedded), and safety is enforced
|
|
116
|
+
// once, at render, by `safeHref`. This decoder used to drop what it could not
|
|
117
|
+
// resolve on its own, which is what left chips with a name and no destination.
|
|
118
|
+
it('carries a root-relative external URL for the client to resolve', () => {
|
|
125
119
|
const event = sourceMetadataEvent({
|
|
126
120
|
sources: [
|
|
127
121
|
{
|
|
@@ -130,15 +124,15 @@ describe('sourceMetadataEvent', () => {
|
|
|
130
124
|
path: 'onboarding-guides/x',
|
|
131
125
|
documentType: 'onboarding_guide',
|
|
132
126
|
externalUrl: '/onboarding-guides/x',
|
|
127
|
+
targetPlatform: 'openframe',
|
|
133
128
|
},
|
|
134
129
|
],
|
|
135
130
|
});
|
|
136
|
-
|
|
137
|
-
expect(event?.sources?.[0].
|
|
138
|
-
expect(event?.sources?.[0]).not.toHaveProperty('externalUrl');
|
|
131
|
+
expect(event?.sources?.[0].externalUrl).toBe('/onboarding-guides/x');
|
|
132
|
+
expect(event?.sources?.[0].targetPlatform).toBe('openframe');
|
|
139
133
|
});
|
|
140
134
|
|
|
141
|
-
it('
|
|
135
|
+
it('carries a root-relative external URL on a grouped item', () => {
|
|
142
136
|
const event = sourceMetadataEvent({
|
|
143
137
|
sources: [
|
|
144
138
|
{
|
|
@@ -148,32 +142,18 @@ describe('sourceMetadataEvent', () => {
|
|
|
148
142
|
},
|
|
149
143
|
],
|
|
150
144
|
});
|
|
151
|
-
expect(event?.sources?.[0].items?.[0]).
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it('keeps an absolute https external URL, which is what the producer emits', () => {
|
|
155
|
-
const event = sourceMetadataEvent({
|
|
156
|
-
sources: [{ index: 1, name: 'Guide', externalUrl: 'https://hub.example/onboarding-guides/x' }],
|
|
157
|
-
});
|
|
158
|
-
expect(event?.sources?.[0].externalUrl).toBe('https://hub.example/onboarding-guides/x');
|
|
145
|
+
expect(event?.sources?.[0].items?.[0].externalUrl).toBe('/onboarding-guides/a');
|
|
159
146
|
});
|
|
160
147
|
|
|
161
|
-
it('
|
|
162
|
-
const event = sourceMetadataEvent({
|
|
163
|
-
sources: [{ index: 1, name: 'Doc', path: 'docs/x', documentType: 'markdown', externalUrl: '//evil.test/x' }],
|
|
164
|
-
});
|
|
165
|
-
expect(event?.sources?.[0]).not.toHaveProperty('externalUrl');
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('drops an href carrying control or zero-width characters', () => {
|
|
148
|
+
it('carries absolute http and https links alike', () => {
|
|
169
149
|
const event = sourceMetadataEvent({
|
|
170
150
|
sources: [
|
|
171
|
-
{ index: 1, name: 'A', externalUrl: '/
|
|
172
|
-
{ index: 2, name: 'B', externalUrl: '
|
|
151
|
+
{ index: 1, name: 'A', externalUrl: 'https://hub.example/x' },
|
|
152
|
+
{ index: 2, name: 'B', externalUrl: 'http://legacy.example/y' },
|
|
173
153
|
],
|
|
174
154
|
});
|
|
175
|
-
expect(event?.sources?.[0]).
|
|
176
|
-
expect(event?.sources?.[1]).
|
|
155
|
+
expect(event?.sources?.[0].externalUrl).toBe('https://hub.example/x');
|
|
156
|
+
expect(event?.sources?.[1].externalUrl).toBe('http://legacy.example/y');
|
|
177
157
|
});
|
|
178
158
|
|
|
179
159
|
it('preserves an explicit null targetPlatform, which means "no destination"', () => {
|
|
@@ -302,23 +282,29 @@ describe('mergeSourceMetadata', () => {
|
|
|
302
282
|
});
|
|
303
283
|
|
|
304
284
|
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
285
|
+
* Hostile hrefs. The decoder carries them like any other string; the safety
|
|
286
|
+
* decision is made once, at render, where `safeHref` resolves the candidate and
|
|
287
|
+
* rejects anything that is not a same-origin path or an allowed scheme. Pinned
|
|
288
|
+
* here end to end so removing the decoder's second gate cannot quietly let one
|
|
289
|
+
* reach an anchor.
|
|
309
290
|
*/
|
|
310
|
-
describe('
|
|
311
|
-
const
|
|
291
|
+
describe('hostile hrefs are neutralised at the render gate', () => {
|
|
292
|
+
const hostile = [
|
|
312
293
|
'/\\evil.test/x',
|
|
313
294
|
'/\\\\evil.test/x',
|
|
314
295
|
'//evil.test/x',
|
|
315
296
|
'/\\/evil.test/x',
|
|
316
|
-
'
|
|
297
|
+
'javascript:alert(1)',
|
|
298
|
+
'data:text/html,<script>alert(1)</script>',
|
|
299
|
+
'/docs/\u200bx',
|
|
317
300
|
];
|
|
318
|
-
it.each(
|
|
319
|
-
const event = sourceMetadataEvent({
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
301
|
+
it.each(hostile)('%j never becomes an href', href => {
|
|
302
|
+
const event = sourceMetadataEvent({ sources: [{ index: 1, name: 'Doc', externalUrl: href }] });
|
|
303
|
+
expect(safeHref(event?.sources?.[0].externalUrl ?? null)).toBeNull();
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it('a genuine relative link survives the gate for the client to resolve', () => {
|
|
307
|
+
const event = sourceMetadataEvent({ sources: [{ index: 1, name: 'Doc', externalUrl: '/onboarding-guides/x' }] });
|
|
308
|
+
expect(safeHref(event?.sources?.[0].externalUrl ?? null)).toBe('/onboarding-guides/x');
|
|
323
309
|
});
|
|
324
310
|
});
|
|
@@ -12,13 +12,20 @@
|
|
|
12
12
|
* so a malformed row means an upstream contract slip, and rendering a chip with
|
|
13
13
|
* a blank title or an unsafe href is worse than rendering nothing.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* LINKS are carried, not judged. A source's `externalUrl` is passed through as
|
|
16
|
+
* the producer sent it — a root-relative path included — because resolving a
|
|
17
|
+
* link is a CLIENT decision: only the page rendering the chip knows where it is
|
|
18
|
+
* embedded. The chat runtime resolves a relative href against the embedder's
|
|
19
|
+
* `defaultContentOrigin` in embed mode and keeps it relative in host mode
|
|
20
|
+
* (`resolveHrefForRuntime`), and every chip href passes the ONE safety gate,
|
|
21
|
+
* `safeHref`, at render (`buildSourceRowCta`). This decoder used to be a second,
|
|
22
|
+
* STRICTER gate that dropped what it could not resolve on its own — every
|
|
23
|
+
* relative link, and any `http:` one — leaving chips with a name and no
|
|
24
|
+
* destination. That is how broken links were made; it is not how they were
|
|
25
|
+
* prevented.
|
|
26
|
+
*
|
|
27
|
+
* MEDIA urls (`<video src>`, posters) are still required to be absolute https:
|
|
28
|
+
* they have no render-time gate and no navigation runtime to resolve them.
|
|
22
29
|
*
|
|
23
30
|
* Server-safe: no React, no browser APIs beyond `URL`.
|
|
24
31
|
*/
|
|
@@ -53,9 +60,8 @@ function nullableText(value: unknown): string | null | undefined {
|
|
|
53
60
|
return value === null ? null : text(value);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
|
-
/** An absolute https URL, or nothing
|
|
57
|
-
*
|
|
58
|
-
* link" for this payload's consumer. Used for links and media alike. */
|
|
63
|
+
/** An absolute https URL, or nothing — for MEDIA sources only (see the module
|
|
64
|
+
* note). Links are carried as text and judged once, at render. */
|
|
59
65
|
function httpsUrl(value: unknown): string | undefined {
|
|
60
66
|
const candidate = text(value);
|
|
61
67
|
if (!candidate || UNSAFE_URL_CHARS.test(candidate)) return undefined;
|
|
@@ -99,7 +105,7 @@ function sourceItems(value: unknown): NonNullable<ChatSource['items']> | undefin
|
|
|
99
105
|
// A grouped row without these three has nothing to render OR navigate with.
|
|
100
106
|
if (!id || !documentType || !name) return [];
|
|
101
107
|
|
|
102
|
-
const externalUrl =
|
|
108
|
+
const externalUrl = text(item.externalUrl);
|
|
103
109
|
const targetPlatform = nullableText(item.targetPlatform);
|
|
104
110
|
const path = nullableText(item.path);
|
|
105
111
|
return [
|
|
@@ -143,7 +149,7 @@ function sources(value: unknown): ChatSource[] {
|
|
|
143
149
|
|
|
144
150
|
const path = text(candidate.path);
|
|
145
151
|
const documentType = text(candidate.documentType);
|
|
146
|
-
const externalUrl =
|
|
152
|
+
const externalUrl = text(candidate.externalUrl);
|
|
147
153
|
const targetPlatform = nullableText(candidate.targetPlatform);
|
|
148
154
|
const id = text(candidate.id);
|
|
149
155
|
const sourceRepo = text(candidate.sourceRepo);
|
|
@@ -13,13 +13,8 @@
|
|
|
13
13
|
* Lifted from `lib/types/program-types.ts` in the hub.
|
|
14
14
|
*
|
|
15
15
|
* The pure row→item transform helpers that used to live here are GONE. They
|
|
16
|
-
* had no caller in this package or in the host app
|
|
17
|
-
*
|
|
18
|
-
* `programDateInstant` exists to own — without setting the
|
|
19
|
-
* `date_is_display_override` flag it needs, so an overridden webinar built
|
|
20
|
-
* through it rendered with the clock and zone label the rule suppresses
|
|
21
|
-
* everywhere else. A dead PUBLIC export that contradicts the rule is worse
|
|
22
|
-
* than no export. The host app keeps its own transforms, which resolve.
|
|
16
|
+
* had no caller in this package or in the host app. The host app keeps its
|
|
17
|
+
* own transforms, which resolve the date.
|
|
23
18
|
*/
|
|
24
19
|
|
|
25
20
|
import type { ReactNode } from 'react';
|
|
@@ -172,22 +167,6 @@ export interface BaseProgramItem {
|
|
|
172
167
|
description: string | null;
|
|
173
168
|
cover_url: string | null; // Primary image
|
|
174
169
|
date: string; // ISO date string - maps to: start_at, published_at
|
|
175
|
-
/**
|
|
176
|
-
* True when an admin DISPLAY OVERRIDE supplied `date`, rather than the row's
|
|
177
|
-
* own schedule — the flag `programDateInstant` reads to decide that this
|
|
178
|
-
* value is a chosen DAY, rendered UTC-pinned with no clock and no zone.
|
|
179
|
-
*
|
|
180
|
-
* Declared HERE, on the type `ProgramCard` actually consumes, because while
|
|
181
|
-
* it lived only in the host app's copy of this interface every consumer had
|
|
182
|
-
* to cast past the type to read it — so the compiler could not tell anyone
|
|
183
|
-
* when a producer forgot to set it.
|
|
184
|
-
*
|
|
185
|
-
* NOT the same as "is it a calendar date": the override column is
|
|
186
|
-
* `timestamptz` and the host normalizes through `toISOString()`, so an
|
|
187
|
-
* override always arrives as a full instant. An earlier attempt keyed off
|
|
188
|
-
* value precision and could therefore never fire.
|
|
189
|
-
*/
|
|
190
|
-
date_is_display_override?: boolean;
|
|
191
170
|
/** The event's IANA zone, when the row declares one. Read through
|
|
192
171
|
* `programDateInstant`, never directly — see that module on why. */
|
|
193
172
|
timezone?: string | null;
|
|
@@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest';
|
|
|
3
3
|
import {
|
|
4
4
|
formatDateWithTimezone,
|
|
5
5
|
formatDurationFromRange,
|
|
6
|
-
formatProgramDate,
|
|
7
6
|
formatTimeWithTimezone,
|
|
8
7
|
formatWebinarTimeMeta,
|
|
9
8
|
} from '../format';
|
|
@@ -100,8 +99,8 @@ describe('formatDateWithTimezone / formatTimeWithTimezone agree on the zone', ()
|
|
|
100
99
|
/**
|
|
101
100
|
* The webinar time+duration composition. These exact three lines existed in
|
|
102
101
|
* three surfaces and drifted twice — once so the page read the raw `start_at`
|
|
103
|
-
* while the card read the resolved instant, once so
|
|
104
|
-
*
|
|
102
|
+
* while the card read the resolved instant, once so the zone label differed.
|
|
103
|
+
* The rule now lives here, so it is tested here.
|
|
105
104
|
*/
|
|
106
105
|
describe('formatWebinarTimeMeta', () => {
|
|
107
106
|
const RANGE = { startAt: '2026-03-20T01:18:00Z', endAt: '2026-03-20T02:18:00Z' };
|
|
@@ -120,12 +119,6 @@ describe('formatWebinarTimeMeta', () => {
|
|
|
120
119
|
);
|
|
121
120
|
});
|
|
122
121
|
|
|
123
|
-
it('drops the CLOCK for a display override, keeping the duration', () => {
|
|
124
|
-
// A chosen display date has no time of day the admin meant.
|
|
125
|
-
const at = programDateInstant({ ...zonedRow, date: '2026-03-19T00:00:00Z', date_is_display_override: true });
|
|
126
|
-
expect(formatWebinarTimeMeta(at, RANGE)).toBe('1h');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
122
|
it('leaves no dangling separator when either side is missing', () => {
|
|
130
123
|
const at = programDateInstant(zonedRow);
|
|
131
124
|
expect(formatWebinarTimeMeta(at, { ...RANGE, endAt: null })).toBe('9:18 PM');
|
|
@@ -153,28 +146,3 @@ describe('formatWebinarTimeMeta', () => {
|
|
|
153
146
|
expect(formatWebinarTimeMeta(at, { ...RANGE, withZoneLabel: true })).toBe('1:18 AM UTC · 1h');
|
|
154
147
|
});
|
|
155
148
|
});
|
|
156
|
-
|
|
157
|
-
describe('a day-valued row leaves nothing for a consumer to mislabel', () => {
|
|
158
|
-
// The worst shape this rule can produce, and the one three surfaces rendered:
|
|
159
|
-
// an override supplies the day (so no clock), `end_at` is null (so no
|
|
160
|
-
// duration), and the composition is EMPTY — beside which two of the three
|
|
161
|
-
// surfaces still printed the row's bare IANA zone, captioning nothing.
|
|
162
|
-
//
|
|
163
|
-
// `end_at` being null is not hypothetical: the Livestorm ingest guard nulls
|
|
164
|
-
// it on an inverted range, which is exactly the corrupt-row case that guard
|
|
165
|
-
// was added for.
|
|
166
|
-
it('empty meta and no zone, so the slot renders nothing at all', () => {
|
|
167
|
-
const at = programDateInstant({
|
|
168
|
-
date: '2026-03-19T00:00:00.000Z',
|
|
169
|
-
start_at: '2026-03-20T01:18:00.000Z',
|
|
170
|
-
timezone: 'America/New_York',
|
|
171
|
-
date_is_display_override: true,
|
|
172
|
-
});
|
|
173
|
-
expect(at.timezone).toBeNull();
|
|
174
|
-
expect(formatWebinarTimeMeta(at, { startAt: '2026-03-20T01:18:00.000Z', endAt: null, withZoneLabel: true })).toBe(
|
|
175
|
-
'',
|
|
176
|
-
);
|
|
177
|
-
// ...while the DATE is still stated, and states the day the admin chose.
|
|
178
|
-
expect(formatProgramDate(at, 'weekday')).toBe('Thursday, March 19');
|
|
179
|
-
});
|
|
180
|
-
});
|
|
@@ -32,8 +32,7 @@ describe('programDateInstant', () => {
|
|
|
32
32
|
expect(formatTimeWithTimezone(r.instant, r.timezone)).toBe('9:18 PM');
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
it('prefers item.date,
|
|
36
|
-
// item.date is the host-resolved instant with the override already applied.
|
|
35
|
+
it('prefers item.date, the host-resolved instant', () => {
|
|
37
36
|
const r = programDateInstant({ ...zoned, date: '2026-02-09T15:00:00.000Z' });
|
|
38
37
|
expect(r.instant).toBe('2026-02-09T15:00:00.000Z');
|
|
39
38
|
});
|
|
@@ -50,31 +49,6 @@ describe('programDateInstant', () => {
|
|
|
50
49
|
expect(programDateInstant({ date: '2026-03-20T01:18:00.000Z' }).instant).toBeNull();
|
|
51
50
|
});
|
|
52
51
|
|
|
53
|
-
it('flags an admin display override — the shape a producer ACTUALLY emits', () => {
|
|
54
|
-
// This is what the DAL hands over: the override column is timestamptz and
|
|
55
|
-
// the route normalizes through toISOString(), so the value is a FULL
|
|
56
|
-
// INSTANT. An earlier version of this test hand-built a bare `YYYY-MM-DD`
|
|
57
|
-
// row that no producer can emit, which made it pass while the bug it named
|
|
58
|
-
// stayed live.
|
|
59
|
-
const r = programDateInstant({
|
|
60
|
-
date: '2026-03-19T00:00:00.000Z',
|
|
61
|
-
start_at: '2026-04-01T20:00:00.000Z',
|
|
62
|
-
timezone: 'America/New_York',
|
|
63
|
-
date_is_display_override: true,
|
|
64
|
-
});
|
|
65
|
-
expect(r.dateOnly).toBe(true);
|
|
66
|
-
// The resolved value carries NO ZONE, so a consumer cannot render or label
|
|
67
|
-
// one. Three surfaces had to remember that gate and two forgot; nulling it
|
|
68
|
-
// makes the mistake unrepresentable rather than merely documented.
|
|
69
|
-
expect(r.timezone).toBeNull();
|
|
70
|
-
// The admin who asked for March 19 sees March 19 — not March 18 at 8 PM,
|
|
71
|
-
// which is what a zoned render of UTC midnight gives.
|
|
72
|
-
expect(formatProgramDate(r)).toBe('Mar 19, 2026');
|
|
73
|
-
// ...and that is true precisely BECAUSE the zone was dropped: rendering the
|
|
74
|
-
// same value in the row's declared zone still lands on the 18th.
|
|
75
|
-
expect(formatDateWithTimezone(r.utcDate, 'America/New_York')).toBe('Mar 18, 2026');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
52
|
it('renders the same shape whether or not the row declares a zone', () => {
|
|
79
53
|
// The UTC fallback used to be a separate date-fns branch at each call site,
|
|
80
54
|
// and it emitted a DIFFERENT SHAPE ("Thursday 19 March" vs "Thursday,
|
|
@@ -85,10 +59,6 @@ describe('programDateInstant', () => {
|
|
|
85
59
|
expect(withZone).toBe('Thursday, March 19');
|
|
86
60
|
expect(withoutZone).toBe('Thursday, March 19');
|
|
87
61
|
});
|
|
88
|
-
|
|
89
|
-
it('treats a real timestamp as an instant', () => {
|
|
90
|
-
expect(programDateInstant(zoned).dateOnly).toBe(false);
|
|
91
|
-
});
|
|
92
62
|
});
|
|
93
63
|
|
|
94
64
|
/**
|
|
@@ -118,21 +88,6 @@ describe('programMetaLine', () => {
|
|
|
118
88
|
expect(line).toBe('Mar 19, 2026 · 9:18 PM EDT · 45m');
|
|
119
89
|
});
|
|
120
90
|
|
|
121
|
-
it('an overridden webinar: the chosen day, no clock, no zone', () => {
|
|
122
|
-
const { line } = programMetaLine(
|
|
123
|
-
{
|
|
124
|
-
date: '2026-01-05T00:00:00.000Z',
|
|
125
|
-
start_at: '2026-03-20T01:18:00.000Z',
|
|
126
|
-
end_at: '2026-03-20T02:03:00.000Z',
|
|
127
|
-
timezone: 'America/New_York',
|
|
128
|
-
date_is_display_override: true,
|
|
129
|
-
},
|
|
130
|
-
'webinar',
|
|
131
|
-
FMT,
|
|
132
|
-
);
|
|
133
|
-
expect(line).toBe('Jan 5, 2026 · 45m');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
91
|
it('a scheduled podcast does not present its stored duration as elapsed time', () => {
|
|
137
92
|
const row = { date: '2026-03-20T01:18:00.000Z', duration_seconds: 1800 };
|
|
138
93
|
expect(programMetaLine(row, 'podcast', FMT).typeMeta).not.toBeNull();
|
package/src/utils/format.ts
CHANGED
|
@@ -482,7 +482,7 @@ export function formatTimeWithTimezone(
|
|
|
482
482
|
* cannot name different moments.
|
|
483
483
|
*
|
|
484
484
|
* Every program surface used to write this branch itself:
|
|
485
|
-
* `zoned.instant
|
|
485
|
+
* `zoned.instant ? formatDateWithTimezone(...) :
|
|
486
486
|
* formatUtc(new Date(item.date), 'EEEE d MMMM')` — four copies, and they did
|
|
487
487
|
* not agree. Three stated the condition off the resolved instant and the
|
|
488
488
|
* fourth off a local timezone variable; worse, the two branches rendered
|
|
@@ -963,8 +963,8 @@ export function formatBioText(aboutHtml: string | null | undefined, fallback: st
|
|
|
963
963
|
*
|
|
964
964
|
* The third member of the set beside `formatProgramDate` (the day) and
|
|
965
965
|
* `formatWebinarTimeMeta` (time + duration), and it exists because the page
|
|
966
|
-
* header rebuilt it locally: an `instant ?? utcDate` fallback
|
|
967
|
-
*
|
|
966
|
+
* header rebuilt it locally: an `instant ?? utcDate` fallback and a
|
|
967
|
+
* zone-labelled render — the same things the meta
|
|
968
968
|
* helper owns, re-applied at the call site, which is exactly what that
|
|
969
969
|
* helper's docblock says goes wrong. The header also appended the RAW IANA
|
|
970
970
|
* name while the slot beneath it used the short name, so one component
|
|
@@ -977,10 +977,6 @@ export function formatProgramTimeRange(
|
|
|
977
977
|
at: ProgramInstant,
|
|
978
978
|
opts: { startAt?: string | null; endAt?: string | null; withZoneLabel?: boolean } = {},
|
|
979
979
|
): string {
|
|
980
|
-
// A chosen display day has no clock the admin meant. THE one statement of
|
|
981
|
-
// that rule for every clock this package renders — `formatWebinarTimeMeta`
|
|
982
|
-
// composes over this rather than repeating it.
|
|
983
|
-
if (at.dateOnly) return '';
|
|
984
980
|
// `instant` is null when the row declares no zone; `utcDate` is the canonical
|
|
985
981
|
// value then, and the formatter's own UTC pin renders it deterministically.
|
|
986
982
|
// Resolved ONCE — spelling this chain twice is how the previous version of
|
|
@@ -1011,22 +1007,15 @@ export function formatProgramTimeRange(
|
|
|
1011
1007
|
*
|
|
1012
1008
|
* Extracted because this exact three-line composition existed in the chat card
|
|
1013
1009
|
* and the public page header, and they DRIFTED: the card was corrected to read
|
|
1014
|
-
* the resolved display instant while the page still read the raw `start_at
|
|
1015
|
-
* an admin override printed two different clock times for one webinar. One
|
|
1016
|
-
* review round apart, on the same three lines.
|
|
1010
|
+
* the resolved display instant while the page still read the raw `start_at`.
|
|
1017
1011
|
*
|
|
1018
|
-
* The split is the point: the TIME comes from the resolved
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1012
|
+
* The split is the point: the TIME comes from the resolved `instant`, the
|
|
1013
|
+
* DURATION from `startAt`/`endAt`, because elapsed time is not a display date.
|
|
1014
|
+
* Both sides of the separator are gated, so neither a suppressed duration nor
|
|
1015
|
+
* an unrenderable time can leave one dangling.
|
|
1022
1016
|
*
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
* the same row. A chosen display date has no clock the admin meant, so the time
|
|
1026
|
-
* half is dropped and only the duration remains.
|
|
1027
|
-
*
|
|
1028
|
-
* It takes the RESOLVED `ProgramInstant`, exactly as `formatProgramDate` does,
|
|
1029
|
-
* for the same reason. While it took `instant` / `timezone` / `dateOnly` as
|
|
1017
|
+
* It takes the RESOLVED `ProgramInstant`, exactly as `formatProgramDate` does.
|
|
1018
|
+
* While it took `instant` / `timezone` as
|
|
1030
1019
|
* loose fields, all four callers re-projected them off the same resolved value
|
|
1031
1020
|
* and no two projections matched — so a zoneless webinar rendered "4:00 PM UTC"
|
|
1032
1021
|
* on the public card and "4:00 PM" on the chat card, which exist to mirror each
|
|
@@ -1038,8 +1027,8 @@ export function formatWebinarTimeMeta(
|
|
|
1038
1027
|
opts: { startAt: string | null; endAt: string | null; withZoneLabel?: boolean },
|
|
1039
1028
|
): string {
|
|
1040
1029
|
// The CLOCK is `formatProgramTimeRange`'s, not a second rendering of it: this
|
|
1041
|
-
// function restated the same
|
|
1042
|
-
//
|
|
1030
|
+
// function restated the same decisions (the instant fallback, the labelled
|
|
1031
|
+
// render) thirty lines below the sibling that
|
|
1043
1032
|
// owns them, and the two had already drifted apart on the fallback chain.
|
|
1044
1033
|
// Only the DURATION is this function's own contribution.
|
|
1045
1034
|
const duration = formatDurationFromRange(opts.startAt, opts.endAt);
|