@fifthbell/brokaw 0.1.63 → 0.1.65
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/README.md +35 -0
- package/dist/components/live-program/LiveProgram.d.ts +1 -1
- package/dist/components/live-program/LiveProgram.js +56 -48
- package/dist/components/live-program/hooks/useSSE.d.ts +4 -2
- package/dist/components/live-program/hooks/useSSE.js +12 -4
- package/dist/components/live-program/program-contract.d.ts +50 -0
- package/dist/components/live-program/program-contract.js +140 -0
- package/dist/live-program/main.d.ts +8 -0
- package/dist/live-program/main.js +5 -1
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGD_jZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGFPjZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGGHiZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGGHjZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGIbkZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGL_kZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGMjkZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGOHjZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/LDIcapOFNxEwR-Bd1O9uYNmnUQomAgE25imKSbHhROjLsZBWTSrQGOHkZtU.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-2fRUAw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-6_RUAw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-DPNUAw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-NfNUAw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-a_NUAw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7c8R496.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7dbR496.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7diR496.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7e8QI96.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7eOQI96.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs13FvgUE.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs169vgUE.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs18NvgUE.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs1_FvgUE.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs1xZogUE.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs1y9ogUE.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/j8_16_LD37rqfuwxyIuaZhE6cRXOLtm2gfTGgQ.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-BYipBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-IYmpBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-PYqpBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/j8_46_LD37rqfuwxyIuaZhE6cRXOLtm2gfT-WYupBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oYiRNDM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oZ8RNDM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oZ8RdDM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oZORNDM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oabQ9DM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05oaiQ9DM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05ob8Q9DM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05ob8RNDM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizMREVItHgc8qDIbSTKq4XkRiUawTk7f45UM9y05obVQ9DM.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduh8MKUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhHMWUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhLsSUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhLsWUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhcMWUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhh8KUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhrsKUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhrsWUBw.ttf +0 -0
- package/dist/live-program-page/fifthbell/fonts/jizOREVItHgc8qDIbSTKq4XkRg8T88bjFuXOnduhycKUBw.ttf +0 -0
- package/dist/live-program-page/index.html +2 -5
- package/dist/live-program-page/live-program-manifest.json +408 -0
- package/dist/live-program-page/live-program.v0.1.65.css +3 -0
- package/dist/live-program-page/live-program.v0.1.65.js +76 -0
- package/dist/program-template-manifest.d.ts +22 -0
- package/dist/program-template-manifest.js +49 -0
- package/dist/renderer.browser.js +5 -1
- package/dist/renderer.core.js +2 -0
- package/dist/renderer.d.ts +3 -0
- package/dist/renderer.js +1 -0
- package/dist/renderer.node.js +11 -4
- package/dist/rum.d.ts +18 -0
- package/dist/rum.js +113 -0
- package/dist/types/canonical-article.d.ts +9 -1
- package/dist/types/canonical-article.js +4 -1
- package/package.json +2 -2
- package/src/styles/compiled.css +1 -1
- package/src/templates/layouts/standalone-page.hbs +5 -0
- package/src/templates/partials/components/standalone-main.hbs +28 -0
- package/src/templates/partials/shell/doc-start-404.hbs +1 -14
- package/src/templates/partials/shell/doc-start-standard.hbs +1 -14
- package/dist/live-program-page/live-program.css +0 -3
- package/dist/live-program-page/live-program.js +0 -76
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const PROGRAM_TEMPLATE_KIND = "alcantara.program-template";
|
|
2
|
+
export declare const PROGRAM_TEMPLATE_CONTRACT_VERSION = 1;
|
|
3
|
+
export declare const liveProgramTemplateContract: {
|
|
4
|
+
readonly kind: "alcantara.program-template";
|
|
5
|
+
readonly contractVersion: 1;
|
|
6
|
+
readonly id: "fifthbell.live-program";
|
|
7
|
+
readonly name: "Fifthbell Live Program";
|
|
8
|
+
readonly entrypoint: "index.html";
|
|
9
|
+
readonly capabilities: readonly ["audio.mixing", "audio.playback", "media.groups", "program.reload", "scene.activation", "scene.configuration", "scene.staging", "stinger.transitions"];
|
|
10
|
+
readonly control: {
|
|
11
|
+
readonly protocol: "alcantara.program.v1";
|
|
12
|
+
readonly transport: "server-sent-events";
|
|
13
|
+
readonly snapshotPath: "state";
|
|
14
|
+
readonly eventsPath: "events";
|
|
15
|
+
readonly runtimeParameters: {
|
|
16
|
+
readonly programId: "programId";
|
|
17
|
+
readonly apiBaseUrl: "apiBaseUrl";
|
|
18
|
+
};
|
|
19
|
+
readonly signals: readonly ["audio_bus_update", "broadcast_settings_update", "heartbeat", "instant_play", "instant_stop_all", "program_media_groups_changed", "program_reload", "program_scenes_changed", "program_state_snapshot", "program_stingers_changed", "scene_change", "scene_cleared", "scene_instant_state", "scene_instant_stop", "scene_instant_take", "scene_staged", "scene_update", "song_off_air"];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type ProgramTemplateContract = typeof liveProgramTemplateContract;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export const PROGRAM_TEMPLATE_KIND = "alcantara.program-template";
|
|
2
|
+
export const PROGRAM_TEMPLATE_CONTRACT_VERSION = 1;
|
|
3
|
+
export const liveProgramTemplateContract = {
|
|
4
|
+
kind: PROGRAM_TEMPLATE_KIND,
|
|
5
|
+
contractVersion: PROGRAM_TEMPLATE_CONTRACT_VERSION,
|
|
6
|
+
id: "fifthbell.live-program",
|
|
7
|
+
name: "Fifthbell Live Program",
|
|
8
|
+
entrypoint: "index.html",
|
|
9
|
+
capabilities: [
|
|
10
|
+
"audio.mixing",
|
|
11
|
+
"audio.playback",
|
|
12
|
+
"media.groups",
|
|
13
|
+
"program.reload",
|
|
14
|
+
"scene.activation",
|
|
15
|
+
"scene.configuration",
|
|
16
|
+
"scene.staging",
|
|
17
|
+
"stinger.transitions",
|
|
18
|
+
],
|
|
19
|
+
control: {
|
|
20
|
+
protocol: "alcantara.program.v1",
|
|
21
|
+
transport: "server-sent-events",
|
|
22
|
+
snapshotPath: "state",
|
|
23
|
+
eventsPath: "events",
|
|
24
|
+
runtimeParameters: {
|
|
25
|
+
programId: "programId",
|
|
26
|
+
apiBaseUrl: "apiBaseUrl",
|
|
27
|
+
},
|
|
28
|
+
signals: [
|
|
29
|
+
"audio_bus_update",
|
|
30
|
+
"broadcast_settings_update",
|
|
31
|
+
"heartbeat",
|
|
32
|
+
"instant_play",
|
|
33
|
+
"instant_stop_all",
|
|
34
|
+
"program_media_groups_changed",
|
|
35
|
+
"program_reload",
|
|
36
|
+
"program_scenes_changed",
|
|
37
|
+
"program_state_snapshot",
|
|
38
|
+
"program_stingers_changed",
|
|
39
|
+
"scene_change",
|
|
40
|
+
"scene_cleared",
|
|
41
|
+
"scene_instant_state",
|
|
42
|
+
"scene_instant_stop",
|
|
43
|
+
"scene_instant_take",
|
|
44
|
+
"scene_staged",
|
|
45
|
+
"scene_update",
|
|
46
|
+
"song_off_air",
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
};
|
package/dist/renderer.browser.js
CHANGED
|
@@ -6,6 +6,7 @@ import notFoundLayoutHbs from './templates/layouts/404.hbs?raw';
|
|
|
6
6
|
import liveStoryLayoutHbs from './templates/layouts/live-story.hbs?raw';
|
|
7
7
|
import linkInBioLayoutHbs from './templates/layouts/link-in-bio.hbs?raw';
|
|
8
8
|
import mediaPageLayoutHbs from './templates/layouts/media-page.hbs?raw';
|
|
9
|
+
import standalonePageLayoutHbs from './templates/layouts/standalone-page.hbs?raw';
|
|
9
10
|
import headerMainHbs from './templates/partials/headers/header-main.hbs?raw';
|
|
10
11
|
import headerMinimalHbs from './templates/partials/headers/header-minimal.hbs?raw';
|
|
11
12
|
import footerFullHbs from './templates/partials/footers/footer-full.hbs?raw';
|
|
@@ -29,6 +30,7 @@ import blockInstagramHbs from './templates/partials/blocks/instagram.hbs?raw';
|
|
|
29
30
|
import blockTikTokHbs from './templates/partials/blocks/tiktok.hbs?raw';
|
|
30
31
|
import blockPullQuoteHbs from './templates/partials/blocks/pull-quote.hbs?raw';
|
|
31
32
|
import componentArticleMainHbs from './templates/partials/components/article-main.hbs?raw';
|
|
33
|
+
import standaloneMainHbs from './templates/partials/components/standalone-main.hbs?raw';
|
|
32
34
|
import componentBreakingNewsHbs from './templates/partials/components/breaking-news.hbs?raw';
|
|
33
35
|
import componentBreakingNewsLiveUpdatesColumnHbs from './templates/partials/components/breaking-news/live-updates-column.hbs?raw';
|
|
34
36
|
import componentSnackHbs from './templates/partials/components/snack.hbs?raw';
|
|
@@ -68,7 +70,8 @@ const assets = {
|
|
|
68
70
|
'404': notFoundLayoutHbs,
|
|
69
71
|
'live-story': liveStoryLayoutHbs,
|
|
70
72
|
'link-in-bio': linkInBioLayoutHbs,
|
|
71
|
-
'media-page': mediaPageLayoutHbs
|
|
73
|
+
'media-page': mediaPageLayoutHbs,
|
|
74
|
+
'standalone-page': standalonePageLayoutHbs
|
|
72
75
|
},
|
|
73
76
|
partials: {
|
|
74
77
|
'headers/header-main': headerMainHbs,
|
|
@@ -94,6 +97,7 @@ const assets = {
|
|
|
94
97
|
'blocks/tiktok': blockTikTokHbs,
|
|
95
98
|
'blocks/pull-quote': blockPullQuoteHbs,
|
|
96
99
|
'components/article-main': componentArticleMainHbs,
|
|
100
|
+
'components/standalone-main': standaloneMainHbs,
|
|
97
101
|
'components/breaking-news': componentBreakingNewsHbs,
|
|
98
102
|
'components/breaking-news/live-updates-column': componentBreakingNewsLiveUpdatesColumnHbs,
|
|
99
103
|
'components/snack': componentSnackHbs,
|
package/dist/renderer.core.js
CHANGED
|
@@ -2,6 +2,7 @@ import Handlebars from 'handlebars';
|
|
|
2
2
|
import { canonicalArticleSchema } from './types/canonical-article.js';
|
|
3
3
|
import { distributeHomepageArticles } from './homepage-distributor.js';
|
|
4
4
|
import { buildSofascoreAttackMomentumUrl, buildSofascoreMatchUrl } from './utils/sofascore.js';
|
|
5
|
+
import { renderRumLoader } from './rum.js';
|
|
5
6
|
let initialized = false;
|
|
6
7
|
const layoutCache = new Map();
|
|
7
8
|
let runtimeStyles = '';
|
|
@@ -230,6 +231,7 @@ function registerHelpers() {
|
|
|
230
231
|
return 'null';
|
|
231
232
|
return JSON.stringify(value);
|
|
232
233
|
});
|
|
234
|
+
Handlebars.registerHelper('rumLoader', renderRumLoader);
|
|
233
235
|
Handlebars.registerHelper('resolveHeadTitle', (doc) => {
|
|
234
236
|
if (!doc || typeof doc !== 'object')
|
|
235
237
|
return 'fifthbell';
|
package/dist/renderer.d.ts
CHANGED
|
@@ -3,4 +3,7 @@ export type { LiveProgramFileEntry, FontFileEntry } from './renderer.node.js';
|
|
|
3
3
|
export { buildInstagramImageHtml, registerInstagramImageHelpers, type InstagramImageTemplateParams } from './instagram-image-template.js';
|
|
4
4
|
export { outletConfig } from './outlet-config.js';
|
|
5
5
|
export { version } from './version.js';
|
|
6
|
+
export { PROGRAM_TEMPLATE_CONTRACT_VERSION, PROGRAM_TEMPLATE_KIND, liveProgramTemplateContract } from './program-template-manifest.js';
|
|
7
|
+
export type { ProgramTemplateContract } from './program-template-manifest.js';
|
|
6
8
|
export type { CanonicalDocument } from './types/canonical-article.js';
|
|
9
|
+
export type { RumConfig } from './types/canonical-article.js';
|
package/dist/renderer.js
CHANGED
|
@@ -2,3 +2,4 @@ export { render, liveProgramPageHtml, liveProgramPageAsset, liveProgramPageFiles
|
|
|
2
2
|
export { buildInstagramImageHtml, registerInstagramImageHelpers } from './instagram-image-template.js';
|
|
3
3
|
export { outletConfig } from './outlet-config.js';
|
|
4
4
|
export { version } from './version.js';
|
|
5
|
+
export { PROGRAM_TEMPLATE_CONTRACT_VERSION, PROGRAM_TEMPLATE_KIND, liveProgramTemplateContract } from './program-template-manifest.js';
|
package/dist/renderer.node.js
CHANGED
|
@@ -10,7 +10,8 @@ const layoutFiles = {
|
|
|
10
10
|
'404': '404.hbs',
|
|
11
11
|
'live-story': 'live-story.hbs',
|
|
12
12
|
'link-in-bio': 'link-in-bio.hbs',
|
|
13
|
-
'media-page': 'media-page.hbs'
|
|
13
|
+
'media-page': 'media-page.hbs',
|
|
14
|
+
'standalone-page': 'standalone-page.hbs'
|
|
14
15
|
};
|
|
15
16
|
function getPaths() {
|
|
16
17
|
const currentFile = fileURLToPath(import.meta.url);
|
|
@@ -126,13 +127,19 @@ export function liveProgramPageAsset(filename) {
|
|
|
126
127
|
}
|
|
127
128
|
const CONTENT_TYPE_MAP = {
|
|
128
129
|
'.html': 'text/html; charset=utf-8',
|
|
129
|
-
'.js': 'application/javascript',
|
|
130
|
-
'.css': 'text/css',
|
|
130
|
+
'.js': 'application/javascript; charset=utf-8',
|
|
131
|
+
'.css': 'text/css; charset=utf-8',
|
|
132
|
+
'.json': 'application/json; charset=utf-8',
|
|
131
133
|
'.jpg': 'image/jpeg',
|
|
132
134
|
'.jpeg': 'image/jpeg',
|
|
133
135
|
'.png': 'image/png',
|
|
134
136
|
'.ogg': 'audio/ogg',
|
|
135
137
|
'.mp3': 'audio/mpeg',
|
|
138
|
+
'.ttf': 'font/ttf',
|
|
139
|
+
'.woff': 'font/woff',
|
|
140
|
+
'.woff2': 'font/woff2',
|
|
141
|
+
'.svg': 'image/svg+xml',
|
|
142
|
+
'.webp': 'image/webp',
|
|
136
143
|
};
|
|
137
144
|
function contentTypeForFile(filename) {
|
|
138
145
|
const ext = path.extname(filename).toLowerCase();
|
|
@@ -145,7 +152,7 @@ export function liveProgramPageFiles() {
|
|
|
145
152
|
}
|
|
146
153
|
const entries = [];
|
|
147
154
|
function walk(dir, prefix) {
|
|
148
|
-
const items = fs.readdirSync(dir, { withFileTypes: true });
|
|
155
|
+
const items = fs.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name));
|
|
149
156
|
for (const item of items) {
|
|
150
157
|
const fullPath = path.join(dir, item.name);
|
|
151
158
|
const relativeKey = prefix ? `${prefix}/${item.name}` : item.name;
|
package/dist/rum.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const rumConfigSchema: z.ZodObject<{
|
|
3
|
+
appMonitorId: z.ZodString;
|
|
4
|
+
applicationVersion: z.ZodString;
|
|
5
|
+
region: z.ZodString;
|
|
6
|
+
identityPoolId: z.ZodString;
|
|
7
|
+
guestRoleArn: z.ZodString;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type RumConfig = z.infer<typeof rumConfigSchema>;
|
|
10
|
+
type RumPageType = 'article-page' | 'homepage' | 'category-page' | 'search-page' | '404' | 'live-story' | 'link-in-bio' | 'media-page';
|
|
11
|
+
type ContentLanguage = 'en' | 'es' | 'it';
|
|
12
|
+
/**
|
|
13
|
+
* Produces the tenant-neutral loader shared by every public page shell.
|
|
14
|
+
* Configuration values are public deployment identifiers supplied by the
|
|
15
|
+
* renderer caller; no tenant-specific values are embedded in Brokaw.
|
|
16
|
+
*/
|
|
17
|
+
export declare function renderRumLoader(config: RumConfig, pageType: RumPageType, language: ContentLanguage): string;
|
|
18
|
+
export {};
|
package/dist/rum.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const awsRegion = z.string().regex(/^[a-z]{2}(?:-gov)?-[a-z]+-\d$/);
|
|
3
|
+
const uuid = z.string().uuid();
|
|
4
|
+
export const rumConfigSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
appMonitorId: uuid,
|
|
7
|
+
applicationVersion: z.string().regex(/^[A-Za-z0-9._:/-]{1,200}$/),
|
|
8
|
+
region: awsRegion,
|
|
9
|
+
identityPoolId: z.string().regex(/^[a-z]{2}(?:-gov)?-[a-z]+-\d:[0-9a-fA-F-]{36}$/),
|
|
10
|
+
guestRoleArn: z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(/^arn:(?:aws|aws-us-gov|aws-cn):iam::\d{12}:role\/[A-Za-z0-9+=,.@_\/-]{1,512}$/)
|
|
13
|
+
})
|
|
14
|
+
.strict()
|
|
15
|
+
.superRefine((config, context) => {
|
|
16
|
+
if (!config.identityPoolId.startsWith(`${config.region}:`)) {
|
|
17
|
+
context.addIssue({
|
|
18
|
+
code: 'custom',
|
|
19
|
+
path: ['identityPoolId'],
|
|
20
|
+
message: 'identityPoolId region must match region'
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const jsonForInlineScript = (value) => JSON.stringify(value)
|
|
25
|
+
.replace(/</g, '\\u003c')
|
|
26
|
+
.replace(/>/g, '\\u003e')
|
|
27
|
+
.replace(/&/g, '\\u0026')
|
|
28
|
+
.replace(/\u2028/g, '\\u2028')
|
|
29
|
+
.replace(/\u2029/g, '\\u2029');
|
|
30
|
+
/**
|
|
31
|
+
* Produces the tenant-neutral loader shared by every public page shell.
|
|
32
|
+
* Configuration values are public deployment identifiers supplied by the
|
|
33
|
+
* renderer caller; no tenant-specific values are embedded in Brokaw.
|
|
34
|
+
*/
|
|
35
|
+
export function renderRumLoader(config, pageType, language) {
|
|
36
|
+
const parsed = rumConfigSchema.parse(config);
|
|
37
|
+
const endpoint = `https://dataplane.rum.${parsed.region}.amazonaws.com`;
|
|
38
|
+
return `<script data-brokaw-rum-loader>
|
|
39
|
+
(function () {
|
|
40
|
+
try {
|
|
41
|
+
function containsSensitiveErrorData(event) {
|
|
42
|
+
var reason = event && event.reason;
|
|
43
|
+
var error = event && event.error;
|
|
44
|
+
var candidate = [
|
|
45
|
+
event && event.message,
|
|
46
|
+
event && event.filename,
|
|
47
|
+
typeof reason === 'string' ? reason : reason && reason.message,
|
|
48
|
+
error && error.message
|
|
49
|
+
].filter(Boolean).join(' ');
|
|
50
|
+
return candidate.length > 256 || /(?:https?:\\/\\/|[?#]|authorization|bearer|credential|password|passcode|api[_-]?key|access[_-]?token|refresh[_-]?token|<[^>]+>|[{}][^{}]{8,}[{}])/i.test(candidate);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
(function (namespace, appMonitorId, applicationVersion, region, source, clientConfig, client, script) {
|
|
54
|
+
client = window.AwsRumClient = {
|
|
55
|
+
q: [],
|
|
56
|
+
n: namespace,
|
|
57
|
+
i: appMonitorId,
|
|
58
|
+
v: applicationVersion,
|
|
59
|
+
r: region,
|
|
60
|
+
c: clientConfig
|
|
61
|
+
};
|
|
62
|
+
window[namespace] = function (command, payload) {
|
|
63
|
+
client.q.push({ c: command, p: payload });
|
|
64
|
+
};
|
|
65
|
+
script = document.createElement('script');
|
|
66
|
+
script.async = true;
|
|
67
|
+
script.crossOrigin = 'anonymous';
|
|
68
|
+
script.src = source;
|
|
69
|
+
script.onerror = function () {
|
|
70
|
+
client.q = [];
|
|
71
|
+
window[namespace] = function () {};
|
|
72
|
+
};
|
|
73
|
+
document.head.appendChild(script);
|
|
74
|
+
})(
|
|
75
|
+
'cwr',
|
|
76
|
+
${jsonForInlineScript(parsed.appMonitorId)},
|
|
77
|
+
${jsonForInlineScript(parsed.applicationVersion)},
|
|
78
|
+
${jsonForInlineScript(parsed.region)},
|
|
79
|
+
'https://client.rum.us-east-1.amazonaws.com/3.0.0/cwr.js',
|
|
80
|
+
{
|
|
81
|
+
identityPoolId: ${jsonForInlineScript(parsed.identityPoolId)},
|
|
82
|
+
guestRoleArn: ${jsonForInlineScript(parsed.guestRoleArn)},
|
|
83
|
+
sessionSampleRate: 1,
|
|
84
|
+
endpoint: ${jsonForInlineScript(endpoint)},
|
|
85
|
+
telemetries: [
|
|
86
|
+
['errors', { stackTraceLength: 0, ignore: containsSensitiveErrorData }],
|
|
87
|
+
['performance', {
|
|
88
|
+
ignore: function (entry) { return entry && entry.entryType === 'resource'; },
|
|
89
|
+
recordAllTypes: [],
|
|
90
|
+
sampleTypes: []
|
|
91
|
+
}]
|
|
92
|
+
],
|
|
93
|
+
allowCookies: false,
|
|
94
|
+
enableXRay: false,
|
|
95
|
+
recordResourceUrl: false,
|
|
96
|
+
pageIdFormat: 'PATH',
|
|
97
|
+
disableAutoPageView: true
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
window.cwr('recordPageView', {
|
|
102
|
+
pageId: window.location.pathname,
|
|
103
|
+
pageAttributes: {
|
|
104
|
+
page_type: ${jsonForInlineScript(pageType)},
|
|
105
|
+
content_language: ${jsonForInlineScript(language)}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} catch (_rumError) {
|
|
109
|
+
// Monitoring is optional and must never block rendering or navigation.
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
112
|
+
</script>`;
|
|
113
|
+
}
|
|
@@ -34,6 +34,7 @@ export declare const canonicalArticleSchema: z.ZodObject<{
|
|
|
34
34
|
"live-story": "live-story";
|
|
35
35
|
"link-in-bio": "link-in-bio";
|
|
36
36
|
"media-page": "media-page";
|
|
37
|
+
"standalone-page": "standalone-page";
|
|
37
38
|
}>;
|
|
38
39
|
canonicalUrl: z.ZodString;
|
|
39
40
|
contentVersion: z.ZodString;
|
|
@@ -51,6 +52,13 @@ export declare const canonicalArticleSchema: z.ZodObject<{
|
|
|
51
52
|
es: "es";
|
|
52
53
|
it: "it";
|
|
53
54
|
}>;
|
|
55
|
+
rumConfig: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
appMonitorId: z.ZodString;
|
|
57
|
+
applicationVersion: z.ZodString;
|
|
58
|
+
region: z.ZodString;
|
|
59
|
+
identityPoolId: z.ZodString;
|
|
60
|
+
guestRoleArn: z.ZodString;
|
|
61
|
+
}, z.core.$strict>>;
|
|
54
62
|
sofascore_id: z.ZodOptional<z.ZodNumber>;
|
|
55
63
|
originalArticleId: z.ZodOptional<z.ZodString>;
|
|
56
64
|
updatedVersion: z.ZodOptional<z.ZodObject<{
|
|
@@ -251,4 +259,4 @@ export declare const canonicalArticleSchema: z.ZodObject<{
|
|
|
251
259
|
export type SelfReference = z.infer<typeof articleReferenceSchema>;
|
|
252
260
|
export type CanonicalArticle = z.infer<typeof canonicalArticleSchema>;
|
|
253
261
|
export type CanonicalDocument = CanonicalArticle;
|
|
254
|
-
export {};
|
|
262
|
+
export type { RumConfig } from '../rum.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { rumConfigSchema } from '../rum.js';
|
|
2
3
|
const isoDateTime = z.string().datetime();
|
|
3
4
|
const authorSchema = z.object({
|
|
4
5
|
name: z.string(),
|
|
@@ -131,7 +132,8 @@ export const canonicalArticleSchema = z
|
|
|
131
132
|
'404',
|
|
132
133
|
'live-story',
|
|
133
134
|
'link-in-bio',
|
|
134
|
-
'media-page'
|
|
135
|
+
'media-page',
|
|
136
|
+
'standalone-page'
|
|
135
137
|
]),
|
|
136
138
|
canonicalUrl: z.string(),
|
|
137
139
|
contentVersion: isoDateTime,
|
|
@@ -142,6 +144,7 @@ export const canonicalArticleSchema = z
|
|
|
142
144
|
dek: z.string().optional(),
|
|
143
145
|
excerpt: z.string().optional(),
|
|
144
146
|
language: z.enum(['en', 'es', 'it']),
|
|
147
|
+
rumConfig: rumConfigSchema.optional(),
|
|
145
148
|
sofascore_id: z.number().int().positive().optional(),
|
|
146
149
|
originalArticleId: z.string().optional(),
|
|
147
150
|
updatedVersion: updatedVersionSchema.optional(),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fifthbell/brokaw",
|
|
3
3
|
"description": "Server-side Handlebars renderer and templates for fifthbell pages.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.65",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "fifthbell",
|
|
7
7
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"clean": "node -e \"require('node:fs').rmSync('dist',{ recursive: true, force: true })\"",
|
|
46
46
|
"build:css": "tailwindcss -i src/styles/global.css -o src/styles/compiled.css --minify",
|
|
47
47
|
"build:live-program": "vite build --config vite.config.live-program.ts",
|
|
48
|
-
"build": "npm run clean && npm run build:css && npm run build:live-program && tsc -p tsconfig.build.json && node -e \"require('node:fs').cpSync('src/styles/fonts','dist/fonts',{recursive:true})\"",
|
|
48
|
+
"build": "npm run clean && npm run build:css && npm run build:live-program && tsc -p tsconfig.build.json && node -e \"require('node:fs').cpSync('src/styles/fonts','dist/fonts',{recursive:true})\" && node scripts/verify-live-program.mjs",
|
|
49
49
|
"storybook": "npm run build:css && storybook dev -p 6006",
|
|
50
50
|
"build-storybook": "npm run build:css && storybook build",
|
|
51
51
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|