@digilogiclabs/platform-core 1.20.1 → 1.20.3

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.
@@ -270,6 +270,47 @@ interface BuildExportFilenameInput {
270
270
  */
271
271
  declare function buildExportFilename({ brand, tool, titleOrDate, ext, }: BuildExportFilenameInput): string;
272
272
 
273
+ /**
274
+ * @react-pdf/renderer is declared as an OPTIONAL peer dependency. Apps that
275
+ * import this subpath must install it themselves; bundlers will surface a
276
+ * clear "Cannot find module" error if it isn't present, which is the standard
277
+ * platform-core pattern for optional peers (`pg`, `ioredis`, `bullmq`, etc).
278
+ */
279
+ /**
280
+ * Vertical space (in PDF points) that a `<Page>` must reserve at the bottom
281
+ * to keep flowed body content from rendering under the `fixed` footer.
282
+ *
283
+ * react-pdf paginates flow content when it reaches `pageHeight - paddingBottom`;
284
+ * `fixed` elements like `<ExportFooterPdf>` are pinned at their flow anchor on
285
+ * every page but DO NOT push the pagination boundary. So if `paddingBottom` is
286
+ * smaller than the footer's natural height, the last lines of body content on
287
+ * each page render directly underneath the footer chrome.
288
+ *
289
+ * The `ExportFooterPdf` rendered by this module claims roughly 55-60pt at
290
+ * `maximum` prominence (44pt QR + 8pt paddingTop + 2pt borderTop + line-height
291
+ * descenders + small render-engine slack). 72pt = footer + ~12pt clearance,
292
+ * which is the minimum we recommend for any `<Page>` that mounts an
293
+ * `<ExportFooterPdf>` (or `<BrandedPdfPage>`).
294
+ *
295
+ * **Why two carves are applied inside `BrandedPdfPage`:** `paddingBottom` alone
296
+ * protects normal flow content from paginating into the footer band, but it
297
+ * does NOT protect against overflow rendering — children inside the body
298
+ * container that use `justifyContent: "space-around"` (or any non-paginating
299
+ * distribution) and exceed the container's height render PAST the container's
300
+ * bottom edge, into the footer's render band. To absorb this case,
301
+ * `BrandedPdfPage` ALSO sets `marginBottom: FOOTER_SAFE_AREA_PT` on the body
302
+ * `<View>`, carving an explicit safe-zone inside the flow area. The double
303
+ * carve is intentional and defensive — combined, they cover both the
304
+ * pagination boundary AND modest overflow from custom layouts.
305
+ *
306
+ * Consumers that build their own `<Page>` directly (rather than using
307
+ * `<BrandedPdfPage>`) should set `paddingBottom` to at least this value AND,
308
+ * if they nest body content inside a flex container with non-paginating
309
+ * `justifyContent`, also apply `marginBottom: FOOTER_SAFE_AREA_PT` to that
310
+ * container. Documents that only use plain flow content (`<Text>`, `<View>`
311
+ * stacks) need only the `paddingBottom`.
312
+ */
313
+ declare const FOOTER_SAFE_AREA_PT = 72;
273
314
  interface ExportHeaderPdfProps {
274
315
  /** Brand configuration. */
275
316
  brand: BrandConfig;
@@ -300,14 +341,33 @@ interface ExportFooterPdfProps {
300
341
  qrDataUrl?: string | null;
301
342
  /** Branding prominence. Defaults to `maximum`. */
302
343
  prominence?: ExportProminence;
344
+ /**
345
+ * Render with react-pdf's `fixed` prop so the footer appears on every page
346
+ * of a multi-page document. Defaults to `true` (the typical behavior).
347
+ *
348
+ * Set to `false` for documents whose body content cannot be reliably
349
+ * constrained above the footer's render band — e.g., a `flex: 1` layout
350
+ * with overflow children that paginate (large brackets, dense tables,
351
+ * etc.). With `fixed: false` the footer flows after the body and renders
352
+ * only on the LAST page; intermediate pages have no footer chrome but
353
+ * also no body-on-footer overlap. This is the architecturally correct
354
+ * trade-off for content where pagination is the rule, not the exception.
355
+ *
356
+ * For ordinary documents (rules sheets, score sheets, single-page
357
+ * profile cards) leave at the default `true`.
358
+ */
359
+ fixed?: boolean;
303
360
  }
304
361
  /**
305
- * Branded PDF document footer — `fixed` so it renders on every page.
362
+ * Branded PDF document footer — `fixed` so it renders on every page (default).
306
363
  *
307
364
  * Composition: brand mark + name (left), URL + date (center-right), QR (far right).
308
365
  * Tagline shown only at `maximum` prominence; QR shrinks at `refined`.
366
+ *
367
+ * Pass `fixed={false}` for layouts where body content can spill into the
368
+ * footer's render band on intermediate pages — see the prop JSDoc above.
309
369
  */
310
- declare function ExportFooterPdf({ brand, url, dateLabel, qrDataUrl, prominence, }: ExportFooterPdfProps): ReactElement;
370
+ declare function ExportFooterPdf({ brand, url, dateLabel, qrDataUrl, prominence, fixed, }: ExportFooterPdfProps): ReactElement;
311
371
  interface BrandedPdfPageProps {
312
372
  /** Brand configuration. */
313
373
  brand: BrandConfig;
@@ -363,4 +423,4 @@ interface BrandedPdfPageProps {
363
423
  */
364
424
  declare function BrandedPdfPage({ brand, title, toolLabel, subtitle, url, dateLabel, qrDataUrl, prominence, pageStyle, size, children, }: BrandedPdfPageProps): ReactElement;
365
425
 
366
- export { type BrandColors, type BrandConfig, BrandedPdfPage, type BrandedPdfPageProps, type BuildExportFilenameInput, type BuildExportUrlInput, type ExportFileExt, ExportFooterPdf, type ExportFooterPdfProps, ExportHeaderPdf, type ExportHeaderPdfProps, type ExportMedium, type ExportProminence, type ExportTier, type GenerateQrDataUrlOptions, type LogoMarkRenderProps, type LogoVariant, type PrintProfile, buildExportFilename, buildExportUrl, generateQrDataUrl, resolveProminence, tierToProminence };
426
+ export { type BrandColors, type BrandConfig, BrandedPdfPage, type BrandedPdfPageProps, type BuildExportFilenameInput, type BuildExportUrlInput, type ExportFileExt, ExportFooterPdf, type ExportFooterPdfProps, ExportHeaderPdf, type ExportHeaderPdfProps, type ExportMedium, type ExportProminence, type ExportTier, FOOTER_SAFE_AREA_PT, type GenerateQrDataUrlOptions, type LogoMarkRenderProps, type LogoVariant, type PrintProfile, buildExportFilename, buildExportUrl, generateQrDataUrl, resolveProminence, tierToProminence };
@@ -270,6 +270,47 @@ interface BuildExportFilenameInput {
270
270
  */
271
271
  declare function buildExportFilename({ brand, tool, titleOrDate, ext, }: BuildExportFilenameInput): string;
272
272
 
273
+ /**
274
+ * @react-pdf/renderer is declared as an OPTIONAL peer dependency. Apps that
275
+ * import this subpath must install it themselves; bundlers will surface a
276
+ * clear "Cannot find module" error if it isn't present, which is the standard
277
+ * platform-core pattern for optional peers (`pg`, `ioredis`, `bullmq`, etc).
278
+ */
279
+ /**
280
+ * Vertical space (in PDF points) that a `<Page>` must reserve at the bottom
281
+ * to keep flowed body content from rendering under the `fixed` footer.
282
+ *
283
+ * react-pdf paginates flow content when it reaches `pageHeight - paddingBottom`;
284
+ * `fixed` elements like `<ExportFooterPdf>` are pinned at their flow anchor on
285
+ * every page but DO NOT push the pagination boundary. So if `paddingBottom` is
286
+ * smaller than the footer's natural height, the last lines of body content on
287
+ * each page render directly underneath the footer chrome.
288
+ *
289
+ * The `ExportFooterPdf` rendered by this module claims roughly 55-60pt at
290
+ * `maximum` prominence (44pt QR + 8pt paddingTop + 2pt borderTop + line-height
291
+ * descenders + small render-engine slack). 72pt = footer + ~12pt clearance,
292
+ * which is the minimum we recommend for any `<Page>` that mounts an
293
+ * `<ExportFooterPdf>` (or `<BrandedPdfPage>`).
294
+ *
295
+ * **Why two carves are applied inside `BrandedPdfPage`:** `paddingBottom` alone
296
+ * protects normal flow content from paginating into the footer band, but it
297
+ * does NOT protect against overflow rendering — children inside the body
298
+ * container that use `justifyContent: "space-around"` (or any non-paginating
299
+ * distribution) and exceed the container's height render PAST the container's
300
+ * bottom edge, into the footer's render band. To absorb this case,
301
+ * `BrandedPdfPage` ALSO sets `marginBottom: FOOTER_SAFE_AREA_PT` on the body
302
+ * `<View>`, carving an explicit safe-zone inside the flow area. The double
303
+ * carve is intentional and defensive — combined, they cover both the
304
+ * pagination boundary AND modest overflow from custom layouts.
305
+ *
306
+ * Consumers that build their own `<Page>` directly (rather than using
307
+ * `<BrandedPdfPage>`) should set `paddingBottom` to at least this value AND,
308
+ * if they nest body content inside a flex container with non-paginating
309
+ * `justifyContent`, also apply `marginBottom: FOOTER_SAFE_AREA_PT` to that
310
+ * container. Documents that only use plain flow content (`<Text>`, `<View>`
311
+ * stacks) need only the `paddingBottom`.
312
+ */
313
+ declare const FOOTER_SAFE_AREA_PT = 72;
273
314
  interface ExportHeaderPdfProps {
274
315
  /** Brand configuration. */
275
316
  brand: BrandConfig;
@@ -300,14 +341,33 @@ interface ExportFooterPdfProps {
300
341
  qrDataUrl?: string | null;
301
342
  /** Branding prominence. Defaults to `maximum`. */
302
343
  prominence?: ExportProminence;
344
+ /**
345
+ * Render with react-pdf's `fixed` prop so the footer appears on every page
346
+ * of a multi-page document. Defaults to `true` (the typical behavior).
347
+ *
348
+ * Set to `false` for documents whose body content cannot be reliably
349
+ * constrained above the footer's render band — e.g., a `flex: 1` layout
350
+ * with overflow children that paginate (large brackets, dense tables,
351
+ * etc.). With `fixed: false` the footer flows after the body and renders
352
+ * only on the LAST page; intermediate pages have no footer chrome but
353
+ * also no body-on-footer overlap. This is the architecturally correct
354
+ * trade-off for content where pagination is the rule, not the exception.
355
+ *
356
+ * For ordinary documents (rules sheets, score sheets, single-page
357
+ * profile cards) leave at the default `true`.
358
+ */
359
+ fixed?: boolean;
303
360
  }
304
361
  /**
305
- * Branded PDF document footer — `fixed` so it renders on every page.
362
+ * Branded PDF document footer — `fixed` so it renders on every page (default).
306
363
  *
307
364
  * Composition: brand mark + name (left), URL + date (center-right), QR (far right).
308
365
  * Tagline shown only at `maximum` prominence; QR shrinks at `refined`.
366
+ *
367
+ * Pass `fixed={false}` for layouts where body content can spill into the
368
+ * footer's render band on intermediate pages — see the prop JSDoc above.
309
369
  */
310
- declare function ExportFooterPdf({ brand, url, dateLabel, qrDataUrl, prominence, }: ExportFooterPdfProps): ReactElement;
370
+ declare function ExportFooterPdf({ brand, url, dateLabel, qrDataUrl, prominence, fixed, }: ExportFooterPdfProps): ReactElement;
311
371
  interface BrandedPdfPageProps {
312
372
  /** Brand configuration. */
313
373
  brand: BrandConfig;
@@ -363,4 +423,4 @@ interface BrandedPdfPageProps {
363
423
  */
364
424
  declare function BrandedPdfPage({ brand, title, toolLabel, subtitle, url, dateLabel, qrDataUrl, prominence, pageStyle, size, children, }: BrandedPdfPageProps): ReactElement;
365
425
 
366
- export { type BrandColors, type BrandConfig, BrandedPdfPage, type BrandedPdfPageProps, type BuildExportFilenameInput, type BuildExportUrlInput, type ExportFileExt, ExportFooterPdf, type ExportFooterPdfProps, ExportHeaderPdf, type ExportHeaderPdfProps, type ExportMedium, type ExportProminence, type ExportTier, type GenerateQrDataUrlOptions, type LogoMarkRenderProps, type LogoVariant, type PrintProfile, buildExportFilename, buildExportUrl, generateQrDataUrl, resolveProminence, tierToProminence };
426
+ export { type BrandColors, type BrandConfig, BrandedPdfPage, type BrandedPdfPageProps, type BuildExportFilenameInput, type BuildExportUrlInput, type ExportFileExt, ExportFooterPdf, type ExportFooterPdfProps, ExportHeaderPdf, type ExportHeaderPdfProps, type ExportMedium, type ExportProminence, type ExportTier, FOOTER_SAFE_AREA_PT, type GenerateQrDataUrlOptions, type LogoMarkRenderProps, type LogoVariant, type PrintProfile, buildExportFilename, buildExportUrl, generateQrDataUrl, resolveProminence, tierToProminence };
@@ -33,6 +33,7 @@ __export(pdf_exports_exports, {
33
33
  BrandedPdfPage: () => BrandedPdfPage,
34
34
  ExportFooterPdf: () => ExportFooterPdf,
35
35
  ExportHeaderPdf: () => ExportHeaderPdf,
36
+ FOOTER_SAFE_AREA_PT: () => FOOTER_SAFE_AREA_PT,
36
37
  buildExportFilename: () => buildExportFilename,
37
38
  buildExportUrl: () => buildExportUrl,
38
39
  generateQrDataUrl: () => generateQrDataUrl,
@@ -109,6 +110,7 @@ function slugify(input) {
109
110
  // src/pdf-exports/pdf-chrome.tsx
110
111
  var import_renderer = require("@react-pdf/renderer");
111
112
  var import_jsx_runtime = require("react/jsx-runtime");
113
+ var FOOTER_SAFE_AREA_PT = 72;
112
114
  function makeChromeStyles(brand) {
113
115
  return import_renderer.StyleSheet.create({
114
116
  headerRow: {
@@ -195,8 +197,19 @@ function makeChromeStyles(brand) {
195
197
  width: 32,
196
198
  height: 32
197
199
  },
200
+ // `flex: 1` makes the body fill the page's available flow area between the
201
+ // header and the footer's flow anchor. `marginBottom: FOOTER_SAFE_AREA_PT`
202
+ // carves an explicit safe-zone INSIDE that flow area so overflow children
203
+ // (e.g., a flex column with `justifyContent: "space-around"` and content
204
+ // exceeding the container height) cannot render past the body's bottom
205
+ // edge into the footer's render band. Combined with the page-level
206
+ // `paddingBottom: FOOTER_SAFE_AREA_PT`, this is a 2x defensive carve that
207
+ // covers both normal-flow pagination (where `paddingBottom` is sufficient)
208
+ // and non-paginating distributions (where only `marginBottom` saves you).
209
+ // See the JSDoc on `FOOTER_SAFE_AREA_PT` above for the full rationale.
198
210
  pageBody: {
199
- flex: 1
211
+ flex: 1,
212
+ marginBottom: FOOTER_SAFE_AREA_PT
200
213
  }
201
214
  });
202
215
  }
@@ -228,7 +241,8 @@ function ExportFooterPdf({
228
241
  url,
229
242
  dateLabel,
230
243
  qrDataUrl,
231
- prominence = "maximum"
244
+ prominence = "maximum",
245
+ fixed = true
232
246
  }) {
233
247
  const styles = makeChromeStyles(brand);
234
248
  const isRefined = prominence === "refined";
@@ -236,7 +250,7 @@ function ExportFooterPdf({
236
250
  const markSize = isRefined ? 20 : 26;
237
251
  const showQr = Boolean(qrDataUrl);
238
252
  const Logo = brand.renderLogoMarkPdf;
239
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_renderer.View, { style: styles.footerRow, fixed: true, children: [
253
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_renderer.View, { style: styles.footerRow, fixed, children: [
240
254
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_renderer.View, { style: styles.footerLeft, children: [
241
255
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Logo, { size: markSize, variant: "original" }),
242
256
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_renderer.View, { children: [
@@ -272,7 +286,9 @@ function BrandedPdfPage({
272
286
  }) {
273
287
  const styles = makeChromeStyles(brand);
274
288
  const defaultPageStyle = {
275
- padding: 36,
289
+ paddingTop: 36,
290
+ paddingHorizontal: 36,
291
+ paddingBottom: FOOTER_SAFE_AREA_PT,
276
292
  fontFamily: "Helvetica",
277
293
  backgroundColor: brand.colors.surface ?? "#ffffff",
278
294
  fontSize: 10,
@@ -308,6 +324,7 @@ function BrandedPdfPage({
308
324
  BrandedPdfPage,
309
325
  ExportFooterPdf,
310
326
  ExportHeaderPdf,
327
+ FOOTER_SAFE_AREA_PT,
311
328
  buildExportFilename,
312
329
  buildExportUrl,
313
330
  generateQrDataUrl,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pdf-exports/index.ts","../../src/pdf-exports/prominence.ts","../../src/pdf-exports/qr.ts","../../src/pdf-exports/url-utils.ts","../../src/pdf-exports/pdf-chrome.tsx"],"sourcesContent":["/**\n * Shared PDF export primitives — branded chrome, tier-aware prominence, QR codes,\n * UTM-tagged URLs, and filename builders for branded export pipelines.\n *\n * Companion to `/email-templates`: same shape (types + layout + utilities), different\n * runtime (server-side react-pdf rendering).\n *\n * **Optional peer dependencies:**\n * - `@react-pdf/renderer` (^4.0.0) — required for chrome components\n * - `qrcode` (^1.5.0) — required for `generateQrDataUrl`\n *\n * **Brand-agnostic:** the package ships zero brand data. Apps supply a `BrandConfig`\n * with their own logo render functions, color palette, name, and domain.\n *\n * @example\n * ```ts\n * import {\n * BrandedPdfPage,\n * tierToProminence,\n * generateQrDataUrl,\n * buildExportUrl,\n * buildExportFilename,\n * type BrandConfig,\n * } from \"@digilogiclabs/platform-core/pdf-exports\";\n *\n * const ossBrand: BrandConfig = {\n * name: \"OpenSourceSports\",\n * domain: \"opensourcesports.io\",\n * tagline: \"Where Sports Are Defined\",\n * colors: { primary: \"#f16c25\", secondary: \"#1a4d52\", ink: \"#0c1f22\", muted: \"#3a5a5f\" },\n * renderLogoMark: (p) => <OssLogoMark {...p} />,\n * renderLogoMarkPdf: (p) => <OssLogoMarkPdf {...p} />,\n * };\n * ```\n */\n\n// Types\nexport type {\n BrandColors,\n BrandConfig,\n ExportProminence,\n ExportTier,\n LogoMarkRenderProps,\n LogoVariant,\n PrintProfile,\n} from \"./types\";\n\n// Tier mapping\nexport { tierToProminence, resolveProminence } from \"./prominence\";\n\n// QR code generator\nexport { generateQrDataUrl } from \"./qr\";\nexport type { GenerateQrDataUrlOptions } from \"./qr\";\n\n// URL + filename builders\nexport { buildExportUrl, buildExportFilename } from \"./url-utils\";\nexport type {\n BuildExportUrlInput,\n BuildExportFilenameInput,\n ExportMedium,\n ExportFileExt,\n} from \"./url-utils\";\n\n// PDF chrome components\nexport { ExportHeaderPdf, ExportFooterPdf, BrandedPdfPage } from \"./pdf-chrome\";\nexport type {\n ExportHeaderPdfProps,\n ExportFooterPdfProps,\n BrandedPdfPageProps,\n} from \"./pdf-chrome\";\n","import type { BrandConfig, ExportProminence, ExportTier } from \"./types\";\n\n/**\n * Default tier → prominence mapping.\n *\n * Patron and supporter tiers earn `refined` prominence (smaller branding chrome,\n * tagline hidden). All other tiers — including signed-in free users and anonymous\n * visitors — receive `maximum` prominence so OSS/app branding stays visible.\n *\n * Branding is **never removed**, only modulated in size and detail. Apps that need\n * a different vocabulary (e.g., \"plus\" / \"pro\") should supply\n * `BrandConfig.prominenceMap` instead of forking this function.\n *\n * @example\n * ```ts\n * tierToProminence(\"patron\"); // \"refined\"\n * tierToProminence(\"supporter\"); // \"refined\"\n * tierToProminence(\"free\"); // \"maximum\"\n * tierToProminence(null); // \"maximum\"\n * tierToProminence(\"plus\"); // \"maximum\" (unknown token falls back)\n * ```\n */\nexport function tierToProminence(tier: ExportTier): ExportProminence {\n if (tier === \"patron\") return \"refined\";\n if (tier === \"supporter\") return \"refined\";\n return \"maximum\";\n}\n\n/**\n * Resolve prominence for a brand — uses the brand's `prominenceMap` if supplied,\n * otherwise the default `tierToProminence` mapping.\n */\nexport function resolveProminence(\n brand: BrandConfig,\n tier: ExportTier,\n): ExportProminence {\n if (brand.prominenceMap) return brand.prominenceMap(tier);\n return tierToProminence(tier);\n}\n","/**\n * QR code generation for branded export footers.\n *\n * Uses the `qrcode` package (optional peer dependency). Calls return a base64\n * data URL ready to be embedded as an `<Image src={...}>` in react-pdf or as a\n * standard `<img>` in HTML preview routes.\n *\n * Failures (invalid URL, encoder errors) return `null` rather than throwing —\n * exports should degrade gracefully without a QR rather than failing the whole\n * PDF render.\n */\n\nexport interface GenerateQrDataUrlOptions {\n /** Output pixel size (square). Default: 320. */\n size?: number;\n /** Quiet-zone margin in modules. Default: 1. */\n margin?: number;\n /** Module (foreground) color. Default: \"#0c1f22\" (dark ink). */\n darkColor?: string;\n /** Background color. Default: \"#ffffff\". */\n lightColor?: string;\n /**\n * Error-correction level. Default: \"M\" (15% recovery — balances density vs durability\n * on printed sheets that may scuff or fold).\n */\n errorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\";\n}\n\n/**\n * Generate a QR code as a base64 PNG data URL.\n *\n * @param url - The URL to encode (typically a UTM-tagged link back to the live page).\n * @param options - Color, size, and error-correction overrides.\n * @returns Data URL string, or `null` on failure.\n *\n * @example\n * ```ts\n * const qrDataUrl = await generateQrDataUrl(\n * \"https://opensourcesports.io/rules/basketball?utm_source=export\",\n * { darkColor: brand.colors.ink },\n * );\n * if (qrDataUrl) {\n * // <Image src={qrDataUrl} style={...} />\n * }\n * ```\n */\nexport async function generateQrDataUrl(\n url: string,\n options?: GenerateQrDataUrlOptions,\n): Promise<string | null> {\n try {\n // Dynamic import keeps qrcode as an optional peer dep — only loaded if used.\n const qr = await import(\"qrcode\");\n const toDataURL = qr.default?.toDataURL ?? qr.toDataURL;\n return await toDataURL(url, {\n width: options?.size ?? 320,\n margin: options?.margin ?? 1,\n errorCorrectionLevel: options?.errorCorrectionLevel ?? \"M\",\n color: {\n dark: options?.darkColor ?? \"#0c1f22\",\n light: options?.lightColor ?? \"#ffffff\",\n },\n });\n } catch {\n return null;\n }\n}\n","import type { BrandConfig } from \"./types\";\n\n/**\n * Export medium — used in UTM tagging and filename suffixes.\n */\nexport type ExportMedium = \"pdf\" | \"png\" | \"ical\" | \"csv\" | \"tsv\";\n\n/**\n * File extension — distinct from medium because iCal uses `.ics` not `.ical`.\n */\nexport type ExportFileExt = \"pdf\" | \"png\" | \"ics\" | \"csv\" | \"tsv\";\n\nexport interface BuildExportUrlInput {\n /** Brand config — supplies the domain. */\n brand: BrandConfig;\n /**\n * Tool / template identifier (e.g., \"bracket-generator\", \"rules\", \"scoreboard\").\n * Becomes part of the URL path and `utm_tool`.\n */\n tool: string;\n /** Export medium for `utm_medium`. */\n medium: ExportMedium;\n /**\n * Optional share-link slug — when present, the URL points at `/s/<slug>` rather than\n * `/tools/<tool>` so QR scanners land on the actual shared artifact.\n */\n shareSlug?: string;\n /**\n * Optional URL path override. When supplied, replaces both `/s/<slug>` and\n * `/tools/<tool>` defaults. Useful for non-tool exports (e.g., `/rules/basketball`).\n */\n path?: string;\n /** Optional extra UTM/query params merged into the URL. */\n params?: Record<string, string>;\n}\n\n/**\n * Build a UTM-tagged URL for QR codes / footer links on branded exports.\n *\n * Every printed sheet that scans back to the live page becomes a measurable acquisition\n * channel — the UTM trio (`utm_source=export`, `utm_medium=<medium>`, `utm_tool=<tool>`)\n * lets analytics attribute traffic to specific export types.\n *\n * @example\n * ```ts\n * buildExportUrl({\n * brand: ossBrand,\n * tool: \"rules\",\n * medium: \"pdf\",\n * path: \"/rules/basketball\",\n * });\n * // → \"https://opensourcesports.io/rules/basketball?utm_source=export&utm_medium=pdf&utm_tool=rules\"\n * ```\n */\nexport function buildExportUrl({\n brand,\n tool,\n medium,\n shareSlug,\n path,\n params,\n}: BuildExportUrlInput): string {\n const resolvedPath = path\n ? path\n : shareSlug\n ? `/s/${shareSlug}`\n : `/tools/${tool}`;\n const base = `https://${brand.domain}${resolvedPath}`;\n const search = new URLSearchParams({\n utm_source: \"export\",\n utm_medium: medium,\n utm_tool: tool,\n ...params,\n });\n return `${base}?${search.toString()}`;\n}\n\nexport interface BuildExportFilenameInput {\n /** Brand config — supplies the filename prefix. */\n brand: BrandConfig;\n /** Tool / template identifier. */\n tool: string;\n /** Optional title or date suffix (slugified). */\n titleOrDate?: string;\n /** File extension. */\n ext: ExportFileExt;\n}\n\n/**\n * Build a filename of the form `{brand-slug}-{tool}[-{title-slug}].{ext}`.\n *\n * The brand slug is derived from `brand.name` (lowercased, hyphenated) so the filename\n * carries brand identity even when downloaded outside the app context.\n *\n * @example\n * ```ts\n * buildExportFilename({\n * brand: ossBrand,\n * tool: \"rules\",\n * titleOrDate: \"Basketball NBA\",\n * ext: \"pdf\",\n * });\n * // → \"opensourcesports-rules-basketball-nba.pdf\"\n * ```\n */\nexport function buildExportFilename({\n brand,\n tool,\n titleOrDate,\n ext,\n}: BuildExportFilenameInput): string {\n const brandSlug = slugify(brand.name);\n const titleSlug = slugify(titleOrDate);\n const middle = titleSlug ? `${tool}-${titleSlug}` : tool;\n return `${brandSlug}-${middle}.${ext}`;\n}\n\nfunction slugify(input: string | undefined): string {\n if (!input) return \"\";\n return input\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 60);\n}\n","import { Image, Page, StyleSheet, Text, View } from \"@react-pdf/renderer\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport type { BrandConfig, ExportProminence } from \"./types\";\n\n/**\n * @react-pdf/renderer is declared as an OPTIONAL peer dependency. Apps that\n * import this subpath must install it themselves; bundlers will surface a\n * clear \"Cannot find module\" error if it isn't present, which is the standard\n * platform-core pattern for optional peers (`pg`, `ioredis`, `bullmq`, etc).\n */\n\n/**\n * Build a brand-aware StyleSheet for header + footer chrome.\n *\n * Called once per render — react-pdf's StyleSheet.create is intentionally\n * lightweight and the perf cost is negligible relative to the actual document\n * render. Building per render means brand colors are honored without\n * module-level caching tricks.\n */\nfunction makeChromeStyles(brand: BrandConfig) {\n return StyleSheet.create({\n headerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderBottomWidth: 3,\n borderBottomColor: brand.colors.primary,\n paddingBottom: 10,\n marginBottom: 12,\n gap: 16,\n },\n headerLeft: { flexDirection: \"column\", flexGrow: 1, flexShrink: 1 },\n eyebrow: {\n fontSize: 9,\n letterSpacing: 1.5,\n color: brand.colors.muted,\n textTransform: \"uppercase\",\n fontFamily: \"Helvetica-Bold\",\n marginBottom: 2,\n },\n title: {\n fontSize: 22,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.ink,\n lineHeight: 1.15,\n },\n subtitle: {\n fontSize: 10,\n color: brand.colors.muted,\n marginTop: 3,\n },\n lockupRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: 8,\n },\n wordmark: {\n fontSize: 13,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n letterSpacing: -0.2,\n },\n footerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderTopWidth: 2,\n borderTopColor: brand.colors.primary,\n paddingTop: 8,\n marginTop: 10,\n gap: 16,\n },\n footerLeft: { flexDirection: \"row\", alignItems: \"center\", gap: 8 },\n footerMid: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n flexShrink: 1,\n },\n footerUrl: {\n fontSize: 9,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n footerDate: {\n fontSize: 8,\n color: brand.colors.muted,\n marginTop: 2,\n },\n footerTagline: {\n fontSize: 8,\n color: brand.colors.muted,\n },\n footerName: {\n fontSize: 11,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n qr: {\n width: 44,\n height: 44,\n },\n qrRefined: {\n width: 32,\n height: 32,\n },\n pageBody: {\n flex: 1,\n },\n });\n}\n\nexport interface ExportHeaderPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title (e.g., \"Basketball (NBA) — Official Rules\"). */\n title: string;\n /** Small uppercase eyebrow above the title (e.g., \"Rules Sheet\", \"Bracket Generator\"). */\n toolLabel: string;\n /** Optional supplemental line under the title. */\n subtitle?: string;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n}\n\n/**\n * Branded PDF document header — first-page only by default.\n *\n * Renders eyebrow + title + optional subtitle on the left, brand mark + wordmark on\n * the right, with a primary-color rule below.\n */\nexport function ExportHeaderPdf({\n brand,\n title,\n toolLabel,\n subtitle,\n prominence = \"maximum\",\n}: ExportHeaderPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const lockupSize = prominence === \"maximum\" ? 32 : 26;\n const titleSize = prominence === \"maximum\" ? 22 : 18;\n const Logo = brand.renderLogoMarkPdf;\n return (\n <View style={styles.headerRow} fixed={false}>\n <View style={styles.headerLeft}>\n <Text style={styles.eyebrow}>{toolLabel}</Text>\n <Text style={[styles.title, { fontSize: titleSize }]}>{title}</Text>\n {subtitle ? <Text style={styles.subtitle}>{subtitle}</Text> : null}\n </View>\n <View style={styles.lockupRow}>\n <Logo size={lockupSize} variant=\"original\" />\n <Text style={styles.wordmark}>{brand.name}</Text>\n </View>\n </View>\n );\n}\n\nexport interface ExportFooterPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Public URL displayed in footer (typically UTM-tagged via `buildExportUrl`). */\n url: string;\n /** Generation date label (e.g., \"Generated April 26, 2026\"). */\n dateLabel?: string;\n /** Pre-rendered QR data URL (from `generateQrDataUrl`). Pass `null` to omit. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n}\n\n/**\n * Branded PDF document footer — `fixed` so it renders on every page.\n *\n * Composition: brand mark + name (left), URL + date (center-right), QR (far right).\n * Tagline shown only at `maximum` prominence; QR shrinks at `refined`.\n */\nexport function ExportFooterPdf({\n brand,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n}: ExportFooterPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const isRefined = prominence === \"refined\";\n const showTagline = prominence === \"maximum\" && Boolean(brand.tagline);\n const markSize = isRefined ? 20 : 26;\n const showQr = Boolean(qrDataUrl);\n const Logo = brand.renderLogoMarkPdf;\n\n return (\n <View style={styles.footerRow} fixed>\n <View style={styles.footerLeft}>\n <Logo size={markSize} variant=\"original\" />\n <View>\n <Text style={styles.footerName}>{brand.name}</Text>\n {showTagline ? (\n <Text style={styles.footerTagline}>{brand.tagline}</Text>\n ) : null}\n </View>\n </View>\n <View style={styles.footerMid}>\n <Text style={styles.footerUrl}>{url}</Text>\n {dateLabel ? <Text style={styles.footerDate}>{dateLabel}</Text> : null}\n </View>\n {showQr && qrDataUrl ? (\n <Image\n src={qrDataUrl}\n style={isRefined ? styles.qrRefined : styles.qr}\n />\n ) : null}\n </View>\n );\n}\n\nexport interface BrandedPdfPageProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title shown in the header. */\n title: string;\n /** Eyebrow label above the title. */\n toolLabel: string;\n /** Optional subtitle under the title. */\n subtitle?: string;\n /** Footer URL (typically UTM-tagged). */\n url: string;\n /** Footer date label. */\n dateLabel?: string;\n /** Pre-rendered QR data URL. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n /**\n * Optional react-pdf Page-level style overrides (e.g., padding, fontFamily).\n * Merged onto the default page styles.\n */\n pageStyle?: Record<string, unknown>;\n /** Optional react-pdf page size. Defaults to \"LETTER\". */\n size?: \"LETTER\" | \"A4\" | \"LEGAL\" | \"TABLOID\";\n /** Document body — your selected sections, content, etc. */\n children: ReactNode;\n}\n\n/**\n * Full branded PDF page wrapper — composes header + body slot + sticky footer.\n *\n * The footer is `fixed` so it renders on every page automatically. The header is\n * first-page only; if you need a per-page compact strip on page 2+, use\n * `ExportHeaderPdf` with your own placement logic.\n *\n * @example\n * ```tsx\n * import { Document } from \"@react-pdf/renderer\";\n * import { BrandedPdfPage } from \"@digilogiclabs/platform-core/pdf-exports\";\n *\n * <Document>\n * <BrandedPdfPage\n * brand={ossBrand}\n * title=\"Basketball — Official Rules\"\n * toolLabel=\"Rules Sheet\"\n * url=\"https://opensourcesports.io/rules/basketball?utm_source=export\"\n * qrDataUrl={qrDataUrl}\n * prominence={tierToProminence(userTier)}\n * >\n * <RulesBody sections={selectedSections} />\n * </BrandedPdfPage>\n * </Document>\n * ```\n */\nexport function BrandedPdfPage({\n brand,\n title,\n toolLabel,\n subtitle,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n pageStyle,\n size = \"LETTER\",\n children,\n}: BrandedPdfPageProps): ReactElement {\n const styles = makeChromeStyles(brand);\n\n const defaultPageStyle = {\n padding: 36,\n fontFamily: \"Helvetica\",\n backgroundColor: brand.colors.surface ?? \"#ffffff\",\n fontSize: 10,\n color: brand.colors.ink,\n };\n const mergedPageStyle = { ...defaultPageStyle, ...pageStyle };\n\n return (\n <Page size={size} style={mergedPageStyle}>\n <ExportHeaderPdf\n brand={brand}\n title={title}\n toolLabel={toolLabel}\n subtitle={subtitle}\n prominence={prominence}\n />\n <View style={styles.pageBody}>{children}</View>\n <ExportFooterPdf\n brand={brand}\n url={url}\n dateLabel={dateLabel}\n qrDataUrl={qrDataUrl}\n prominence={prominence}\n />\n </Page>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,SAAS,iBAAiB,MAAoC;AACnE,MAAI,SAAS,SAAU,QAAO;AAC9B,MAAI,SAAS,YAAa,QAAO;AACjC,SAAO;AACT;AAMO,SAAS,kBACd,OACA,MACkB;AAClB,MAAI,MAAM,cAAe,QAAO,MAAM,cAAc,IAAI;AACxD,SAAO,iBAAiB,IAAI;AAC9B;;;ACQA,eAAsB,kBACpB,KACA,SACwB;AACxB,MAAI;AAEF,UAAM,KAAK,MAAM,OAAO,QAAQ;AAChC,UAAM,YAAY,GAAG,SAAS,aAAa,GAAG;AAC9C,WAAO,MAAM,UAAU,KAAK;AAAA,MAC1B,OAAO,SAAS,QAAQ;AAAA,MACxB,QAAQ,SAAS,UAAU;AAAA,MAC3B,sBAAsB,SAAS,wBAAwB;AAAA,MACvD,OAAO;AAAA,QACL,MAAM,SAAS,aAAa;AAAA,QAC5B,OAAO,SAAS,cAAc;AAAA,MAChC;AAAA,IACF,CAAC;AAAA,EACH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f-exports/index.ts","../../src/pdf-exports/prominence.ts","../../src/pdf-exports/qr.ts","../../src/pdf-exports/url-utils.ts","../../src/pdf-exports/pdf-chrome.tsx"],"sourcesContent":["/**\n * Shared PDF export primitives — branded chrome, tier-aware prominence, QR codes,\n * UTM-tagged URLs, and filename builders for branded export pipelines.\n *\n * Companion to `/email-templates`: same shape (types + layout + utilities), different\n * runtime (server-side react-pdf rendering).\n *\n * **Optional peer dependencies:**\n * - `@react-pdf/renderer` (^4.0.0) — required for chrome components\n * - `qrcode` (^1.5.0) — required for `generateQrDataUrl`\n *\n * **Brand-agnostic:** the package ships zero brand data. Apps supply a `BrandConfig`\n * with their own logo render functions, color palette, name, and domain.\n *\n * @example\n * ```ts\n * import {\n * BrandedPdfPage,\n * tierToProminence,\n * generateQrDataUrl,\n * buildExportUrl,\n * buildExportFilename,\n * type BrandConfig,\n * } from \"@digilogiclabs/platform-core/pdf-exports\";\n *\n * const ossBrand: BrandConfig = {\n * name: \"OpenSourceSports\",\n * domain: \"opensourcesports.io\",\n * tagline: \"Where Sports Are Defined\",\n * colors: { primary: \"#f16c25\", secondary: \"#1a4d52\", ink: \"#0c1f22\", muted: \"#3a5a5f\" },\n * renderLogoMark: (p) => <OssLogoMark {...p} />,\n * renderLogoMarkPdf: (p) => <OssLogoMarkPdf {...p} />,\n * };\n * ```\n */\n\n// Types\nexport type {\n BrandColors,\n BrandConfig,\n ExportProminence,\n ExportTier,\n LogoMarkRenderProps,\n LogoVariant,\n PrintProfile,\n} from \"./types\";\n\n// Tier mapping\nexport { tierToProminence, resolveProminence } from \"./prominence\";\n\n// QR code generator\nexport { generateQrDataUrl } from \"./qr\";\nexport type { GenerateQrDataUrlOptions } from \"./qr\";\n\n// URL + filename builders\nexport { buildExportUrl, buildExportFilename } from \"./url-utils\";\nexport type {\n BuildExportUrlInput,\n BuildExportFilenameInput,\n ExportMedium,\n ExportFileExt,\n} from \"./url-utils\";\n\n// PDF chrome components\nexport {\n ExportHeaderPdf,\n ExportFooterPdf,\n BrandedPdfPage,\n FOOTER_SAFE_AREA_PT,\n} from \"./pdf-chrome\";\nexport type {\n ExportHeaderPdfProps,\n ExportFooterPdfProps,\n BrandedPdfPageProps,\n} from \"./pdf-chrome\";\n","import type { BrandConfig, ExportProminence, ExportTier } from \"./types\";\n\n/**\n * Default tier → prominence mapping.\n *\n * Patron and supporter tiers earn `refined` prominence (smaller branding chrome,\n * tagline hidden). All other tiers — including signed-in free users and anonymous\n * visitors — receive `maximum` prominence so OSS/app branding stays visible.\n *\n * Branding is **never removed**, only modulated in size and detail. Apps that need\n * a different vocabulary (e.g., \"plus\" / \"pro\") should supply\n * `BrandConfig.prominenceMap` instead of forking this function.\n *\n * @example\n * ```ts\n * tierToProminence(\"patron\"); // \"refined\"\n * tierToProminence(\"supporter\"); // \"refined\"\n * tierToProminence(\"free\"); // \"maximum\"\n * tierToProminence(null); // \"maximum\"\n * tierToProminence(\"plus\"); // \"maximum\" (unknown token falls back)\n * ```\n */\nexport function tierToProminence(tier: ExportTier): ExportProminence {\n if (tier === \"patron\") return \"refined\";\n if (tier === \"supporter\") return \"refined\";\n return \"maximum\";\n}\n\n/**\n * Resolve prominence for a brand — uses the brand's `prominenceMap` if supplied,\n * otherwise the default `tierToProminence` mapping.\n */\nexport function resolveProminence(\n brand: BrandConfig,\n tier: ExportTier,\n): ExportProminence {\n if (brand.prominenceMap) return brand.prominenceMap(tier);\n return tierToProminence(tier);\n}\n","/**\n * QR code generation for branded export footers.\n *\n * Uses the `qrcode` package (optional peer dependency). Calls return a base64\n * data URL ready to be embedded as an `<Image src={...}>` in react-pdf or as a\n * standard `<img>` in HTML preview routes.\n *\n * Failures (invalid URL, encoder errors) return `null` rather than throwing —\n * exports should degrade gracefully without a QR rather than failing the whole\n * PDF render.\n */\n\nexport interface GenerateQrDataUrlOptions {\n /** Output pixel size (square). Default: 320. */\n size?: number;\n /** Quiet-zone margin in modules. Default: 1. */\n margin?: number;\n /** Module (foreground) color. Default: \"#0c1f22\" (dark ink). */\n darkColor?: string;\n /** Background color. Default: \"#ffffff\". */\n lightColor?: string;\n /**\n * Error-correction level. Default: \"M\" (15% recovery — balances density vs durability\n * on printed sheets that may scuff or fold).\n */\n errorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\";\n}\n\n/**\n * Generate a QR code as a base64 PNG data URL.\n *\n * @param url - The URL to encode (typically a UTM-tagged link back to the live page).\n * @param options - Color, size, and error-correction overrides.\n * @returns Data URL string, or `null` on failure.\n *\n * @example\n * ```ts\n * const qrDataUrl = await generateQrDataUrl(\n * \"https://opensourcesports.io/rules/basketball?utm_source=export\",\n * { darkColor: brand.colors.ink },\n * );\n * if (qrDataUrl) {\n * // <Image src={qrDataUrl} style={...} />\n * }\n * ```\n */\nexport async function generateQrDataUrl(\n url: string,\n options?: GenerateQrDataUrlOptions,\n): Promise<string | null> {\n try {\n // Dynamic import keeps qrcode as an optional peer dep — only loaded if used.\n const qr = await import(\"qrcode\");\n const toDataURL = qr.default?.toDataURL ?? qr.toDataURL;\n return await toDataURL(url, {\n width: options?.size ?? 320,\n margin: options?.margin ?? 1,\n errorCorrectionLevel: options?.errorCorrectionLevel ?? \"M\",\n color: {\n dark: options?.darkColor ?? \"#0c1f22\",\n light: options?.lightColor ?? \"#ffffff\",\n },\n });\n } catch {\n return null;\n }\n}\n","import type { BrandConfig } from \"./types\";\n\n/**\n * Export medium — used in UTM tagging and filename suffixes.\n */\nexport type ExportMedium = \"pdf\" | \"png\" | \"ical\" | \"csv\" | \"tsv\";\n\n/**\n * File extension — distinct from medium because iCal uses `.ics` not `.ical`.\n */\nexport type ExportFileExt = \"pdf\" | \"png\" | \"ics\" | \"csv\" | \"tsv\";\n\nexport interface BuildExportUrlInput {\n /** Brand config — supplies the domain. */\n brand: BrandConfig;\n /**\n * Tool / template identifier (e.g., \"bracket-generator\", \"rules\", \"scoreboard\").\n * Becomes part of the URL path and `utm_tool`.\n */\n tool: string;\n /** Export medium for `utm_medium`. */\n medium: ExportMedium;\n /**\n * Optional share-link slug — when present, the URL points at `/s/<slug>` rather than\n * `/tools/<tool>` so QR scanners land on the actual shared artifact.\n */\n shareSlug?: string;\n /**\n * Optional URL path override. When supplied, replaces both `/s/<slug>` and\n * `/tools/<tool>` defaults. Useful for non-tool exports (e.g., `/rules/basketball`).\n */\n path?: string;\n /** Optional extra UTM/query params merged into the URL. */\n params?: Record<string, string>;\n}\n\n/**\n * Build a UTM-tagged URL for QR codes / footer links on branded exports.\n *\n * Every printed sheet that scans back to the live page becomes a measurable acquisition\n * channel — the UTM trio (`utm_source=export`, `utm_medium=<medium>`, `utm_tool=<tool>`)\n * lets analytics attribute traffic to specific export types.\n *\n * @example\n * ```ts\n * buildExportUrl({\n * brand: ossBrand,\n * tool: \"rules\",\n * medium: \"pdf\",\n * path: \"/rules/basketball\",\n * });\n * // → \"https://opensourcesports.io/rules/basketball?utm_source=export&utm_medium=pdf&utm_tool=rules\"\n * ```\n */\nexport function buildExportUrl({\n brand,\n tool,\n medium,\n shareSlug,\n path,\n params,\n}: BuildExportUrlInput): string {\n const resolvedPath = path\n ? path\n : shareSlug\n ? `/s/${shareSlug}`\n : `/tools/${tool}`;\n const base = `https://${brand.domain}${resolvedPath}`;\n const search = new URLSearchParams({\n utm_source: \"export\",\n utm_medium: medium,\n utm_tool: tool,\n ...params,\n });\n return `${base}?${search.toString()}`;\n}\n\nexport interface BuildExportFilenameInput {\n /** Brand config — supplies the filename prefix. */\n brand: BrandConfig;\n /** Tool / template identifier. */\n tool: string;\n /** Optional title or date suffix (slugified). */\n titleOrDate?: string;\n /** File extension. */\n ext: ExportFileExt;\n}\n\n/**\n * Build a filename of the form `{brand-slug}-{tool}[-{title-slug}].{ext}`.\n *\n * The brand slug is derived from `brand.name` (lowercased, hyphenated) so the filename\n * carries brand identity even when downloaded outside the app context.\n *\n * @example\n * ```ts\n * buildExportFilename({\n * brand: ossBrand,\n * tool: \"rules\",\n * titleOrDate: \"Basketball NBA\",\n * ext: \"pdf\",\n * });\n * // → \"opensourcesports-rules-basketball-nba.pdf\"\n * ```\n */\nexport function buildExportFilename({\n brand,\n tool,\n titleOrDate,\n ext,\n}: BuildExportFilenameInput): string {\n const brandSlug = slugify(brand.name);\n const titleSlug = slugify(titleOrDate);\n const middle = titleSlug ? `${tool}-${titleSlug}` : tool;\n return `${brandSlug}-${middle}.${ext}`;\n}\n\nfunction slugify(input: string | undefined): string {\n if (!input) return \"\";\n return input\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 60);\n}\n","import { Image, Page, StyleSheet, Text, View } from \"@react-pdf/renderer\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport type { BrandConfig, ExportProminence } from \"./types\";\n\n/**\n * @react-pdf/renderer is declared as an OPTIONAL peer dependency. Apps that\n * import this subpath must install it themselves; bundlers will surface a\n * clear \"Cannot find module\" error if it isn't present, which is the standard\n * platform-core pattern for optional peers (`pg`, `ioredis`, `bullmq`, etc).\n */\n\n/**\n * Vertical space (in PDF points) that a `<Page>` must reserve at the bottom\n * to keep flowed body content from rendering under the `fixed` footer.\n *\n * react-pdf paginates flow content when it reaches `pageHeight - paddingBottom`;\n * `fixed` elements like `<ExportFooterPdf>` are pinned at their flow anchor on\n * every page but DO NOT push the pagination boundary. So if `paddingBottom` is\n * smaller than the footer's natural height, the last lines of body content on\n * each page render directly underneath the footer chrome.\n *\n * The `ExportFooterPdf` rendered by this module claims roughly 55-60pt at\n * `maximum` prominence (44pt QR + 8pt paddingTop + 2pt borderTop + line-height\n * descenders + small render-engine slack). 72pt = footer + ~12pt clearance,\n * which is the minimum we recommend for any `<Page>` that mounts an\n * `<ExportFooterPdf>` (or `<BrandedPdfPage>`).\n *\n * **Why two carves are applied inside `BrandedPdfPage`:** `paddingBottom` alone\n * protects normal flow content from paginating into the footer band, but it\n * does NOT protect against overflow rendering — children inside the body\n * container that use `justifyContent: \"space-around\"` (or any non-paginating\n * distribution) and exceed the container's height render PAST the container's\n * bottom edge, into the footer's render band. To absorb this case,\n * `BrandedPdfPage` ALSO sets `marginBottom: FOOTER_SAFE_AREA_PT` on the body\n * `<View>`, carving an explicit safe-zone inside the flow area. The double\n * carve is intentional and defensive — combined, they cover both the\n * pagination boundary AND modest overflow from custom layouts.\n *\n * Consumers that build their own `<Page>` directly (rather than using\n * `<BrandedPdfPage>`) should set `paddingBottom` to at least this value AND,\n * if they nest body content inside a flex container with non-paginating\n * `justifyContent`, also apply `marginBottom: FOOTER_SAFE_AREA_PT` to that\n * container. Documents that only use plain flow content (`<Text>`, `<View>`\n * stacks) need only the `paddingBottom`.\n */\nexport const FOOTER_SAFE_AREA_PT = 72;\n\n/**\n * Build a brand-aware StyleSheet for header + footer chrome.\n *\n * Called once per render — react-pdf's StyleSheet.create is intentionally\n * lightweight and the perf cost is negligible relative to the actual document\n * render. Building per render means brand colors are honored without\n * module-level caching tricks.\n */\nfunction makeChromeStyles(brand: BrandConfig) {\n return StyleSheet.create({\n headerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderBottomWidth: 3,\n borderBottomColor: brand.colors.primary,\n paddingBottom: 10,\n marginBottom: 12,\n gap: 16,\n },\n headerLeft: { flexDirection: \"column\", flexGrow: 1, flexShrink: 1 },\n eyebrow: {\n fontSize: 9,\n letterSpacing: 1.5,\n color: brand.colors.muted,\n textTransform: \"uppercase\",\n fontFamily: \"Helvetica-Bold\",\n marginBottom: 2,\n },\n title: {\n fontSize: 22,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.ink,\n lineHeight: 1.15,\n },\n subtitle: {\n fontSize: 10,\n color: brand.colors.muted,\n marginTop: 3,\n },\n lockupRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: 8,\n },\n wordmark: {\n fontSize: 13,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n letterSpacing: -0.2,\n },\n footerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderTopWidth: 2,\n borderTopColor: brand.colors.primary,\n paddingTop: 8,\n marginTop: 10,\n gap: 16,\n },\n footerLeft: { flexDirection: \"row\", alignItems: \"center\", gap: 8 },\n footerMid: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n flexShrink: 1,\n },\n footerUrl: {\n fontSize: 9,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n footerDate: {\n fontSize: 8,\n color: brand.colors.muted,\n marginTop: 2,\n },\n footerTagline: {\n fontSize: 8,\n color: brand.colors.muted,\n },\n footerName: {\n fontSize: 11,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n qr: {\n width: 44,\n height: 44,\n },\n qrRefined: {\n width: 32,\n height: 32,\n },\n // `flex: 1` makes the body fill the page's available flow area between the\n // header and the footer's flow anchor. `marginBottom: FOOTER_SAFE_AREA_PT`\n // carves an explicit safe-zone INSIDE that flow area so overflow children\n // (e.g., a flex column with `justifyContent: \"space-around\"` and content\n // exceeding the container height) cannot render past the body's bottom\n // edge into the footer's render band. Combined with the page-level\n // `paddingBottom: FOOTER_SAFE_AREA_PT`, this is a 2x defensive carve that\n // covers both normal-flow pagination (where `paddingBottom` is sufficient)\n // and non-paginating distributions (where only `marginBottom` saves you).\n // See the JSDoc on `FOOTER_SAFE_AREA_PT` above for the full rationale.\n pageBody: {\n flex: 1,\n marginBottom: FOOTER_SAFE_AREA_PT,\n },\n });\n}\n\nexport interface ExportHeaderPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title (e.g., \"Basketball (NBA) — Official Rules\"). */\n title: string;\n /** Small uppercase eyebrow above the title (e.g., \"Rules Sheet\", \"Bracket Generator\"). */\n toolLabel: string;\n /** Optional supplemental line under the title. */\n subtitle?: string;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n}\n\n/**\n * Branded PDF document header — first-page only by default.\n *\n * Renders eyebrow + title + optional subtitle on the left, brand mark + wordmark on\n * the right, with a primary-color rule below.\n */\nexport function ExportHeaderPdf({\n brand,\n title,\n toolLabel,\n subtitle,\n prominence = \"maximum\",\n}: ExportHeaderPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const lockupSize = prominence === \"maximum\" ? 32 : 26;\n const titleSize = prominence === \"maximum\" ? 22 : 18;\n const Logo = brand.renderLogoMarkPdf;\n return (\n <View style={styles.headerRow} fixed={false}>\n <View style={styles.headerLeft}>\n <Text style={styles.eyebrow}>{toolLabel}</Text>\n <Text style={[styles.title, { fontSize: titleSize }]}>{title}</Text>\n {subtitle ? <Text style={styles.subtitle}>{subtitle}</Text> : null}\n </View>\n <View style={styles.lockupRow}>\n <Logo size={lockupSize} variant=\"original\" />\n <Text style={styles.wordmark}>{brand.name}</Text>\n </View>\n </View>\n );\n}\n\nexport interface ExportFooterPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Public URL displayed in footer (typically UTM-tagged via `buildExportUrl`). */\n url: string;\n /** Generation date label (e.g., \"Generated April 26, 2026\"). */\n dateLabel?: string;\n /** Pre-rendered QR data URL (from `generateQrDataUrl`). Pass `null` to omit. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n /**\n * Render with react-pdf's `fixed` prop so the footer appears on every page\n * of a multi-page document. Defaults to `true` (the typical behavior).\n *\n * Set to `false` for documents whose body content cannot be reliably\n * constrained above the footer's render band — e.g., a `flex: 1` layout\n * with overflow children that paginate (large brackets, dense tables,\n * etc.). With `fixed: false` the footer flows after the body and renders\n * only on the LAST page; intermediate pages have no footer chrome but\n * also no body-on-footer overlap. This is the architecturally correct\n * trade-off for content where pagination is the rule, not the exception.\n *\n * For ordinary documents (rules sheets, score sheets, single-page\n * profile cards) leave at the default `true`.\n */\n fixed?: boolean;\n}\n\n/**\n * Branded PDF document footer — `fixed` so it renders on every page (default).\n *\n * Composition: brand mark + name (left), URL + date (center-right), QR (far right).\n * Tagline shown only at `maximum` prominence; QR shrinks at `refined`.\n *\n * Pass `fixed={false}` for layouts where body content can spill into the\n * footer's render band on intermediate pages — see the prop JSDoc above.\n */\nexport function ExportFooterPdf({\n brand,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n fixed = true,\n}: ExportFooterPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const isRefined = prominence === \"refined\";\n const showTagline = prominence === \"maximum\" && Boolean(brand.tagline);\n const markSize = isRefined ? 20 : 26;\n const showQr = Boolean(qrDataUrl);\n const Logo = brand.renderLogoMarkPdf;\n\n return (\n <View style={styles.footerRow} fixed={fixed}>\n <View style={styles.footerLeft}>\n <Logo size={markSize} variant=\"original\" />\n <View>\n <Text style={styles.footerName}>{brand.name}</Text>\n {showTagline ? (\n <Text style={styles.footerTagline}>{brand.tagline}</Text>\n ) : null}\n </View>\n </View>\n <View style={styles.footerMid}>\n <Text style={styles.footerUrl}>{url}</Text>\n {dateLabel ? <Text style={styles.footerDate}>{dateLabel}</Text> : null}\n </View>\n {showQr && qrDataUrl ? (\n <Image\n src={qrDataUrl}\n style={isRefined ? styles.qrRefined : styles.qr}\n />\n ) : null}\n </View>\n );\n}\n\nexport interface BrandedPdfPageProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title shown in the header. */\n title: string;\n /** Eyebrow label above the title. */\n toolLabel: string;\n /** Optional subtitle under the title. */\n subtitle?: string;\n /** Footer URL (typically UTM-tagged). */\n url: string;\n /** Footer date label. */\n dateLabel?: string;\n /** Pre-rendered QR data URL. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n /**\n * Optional react-pdf Page-level style overrides (e.g., padding, fontFamily).\n * Merged onto the default page styles.\n */\n pageStyle?: Record<string, unknown>;\n /** Optional react-pdf page size. Defaults to \"LETTER\". */\n size?: \"LETTER\" | \"A4\" | \"LEGAL\" | \"TABLOID\";\n /** Document body — your selected sections, content, etc. */\n children: ReactNode;\n}\n\n/**\n * Full branded PDF page wrapper — composes header + body slot + sticky footer.\n *\n * The footer is `fixed` so it renders on every page automatically. The header is\n * first-page only; if you need a per-page compact strip on page 2+, use\n * `ExportHeaderPdf` with your own placement logic.\n *\n * @example\n * ```tsx\n * import { Document } from \"@react-pdf/renderer\";\n * import { BrandedPdfPage } from \"@digilogiclabs/platform-core/pdf-exports\";\n *\n * <Document>\n * <BrandedPdfPage\n * brand={ossBrand}\n * title=\"Basketball — Official Rules\"\n * toolLabel=\"Rules Sheet\"\n * url=\"https://opensourcesports.io/rules/basketball?utm_source=export\"\n * qrDataUrl={qrDataUrl}\n * prominence={tierToProminence(userTier)}\n * >\n * <RulesBody sections={selectedSections} />\n * </BrandedPdfPage>\n * </Document>\n * ```\n */\nexport function BrandedPdfPage({\n brand,\n title,\n toolLabel,\n subtitle,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n pageStyle,\n size = \"LETTER\",\n children,\n}: BrandedPdfPageProps): ReactElement {\n const styles = makeChromeStyles(brand);\n\n // Padding is split rather than uniform so the bottom edge reserves room\n // for the `fixed` footer (see `FOOTER_SAFE_AREA_PT` for the rationale).\n // Consumers can still override individual values via `pageStyle`.\n const defaultPageStyle = {\n paddingTop: 36,\n paddingHorizontal: 36,\n paddingBottom: FOOTER_SAFE_AREA_PT,\n fontFamily: \"Helvetica\",\n backgroundColor: brand.colors.surface ?? \"#ffffff\",\n fontSize: 10,\n color: brand.colors.ink,\n };\n const mergedPageStyle = { ...defaultPageStyle, ...pageStyle };\n\n return (\n <Page size={size} style={mergedPageStyle}>\n <ExportHeaderPdf\n brand={brand}\n title={title}\n toolLabel={toolLabel}\n subtitle={subtitle}\n prominence={prominence}\n />\n <View style={styles.pageBody}>{children}</View>\n <ExportFooterPdf\n brand={brand}\n url={url}\n dateLabel={dateLabel}\n qrDataUrl={qrDataUrl}\n prominence={prominence}\n />\n </Page>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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;AAwDO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,OAAO;AAAA,EACP;AACF,GAAsC;AACpC,QAAM,SAAS,iBAAiB,KAAK;AAKrC,QAAM,mBAAmB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,iBAAiB,MAAM,OAAO,WAAW;AAAA,IACzC,UAAU;AAAA,IACV,OAAO,MAAM,OAAO;AAAA,EACtB;AACA,QAAM,kBAAkB,EAAE,GAAG,kBAAkB,GAAG,UAAU;AAE5D,SACE,6CAAC,wBAAK,MAAY,OAAO,iBACvB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,IACA,4CAAC,wBAAK,OAAO,OAAO,UAAW,UAAS;AAAA,IACxC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
@@ -66,6 +66,7 @@ function slugify(input) {
66
66
  // src/pdf-exports/pdf-chrome.tsx
67
67
  import { Image, Page, StyleSheet, Text, View } from "@react-pdf/renderer";
68
68
  import { jsx, jsxs } from "react/jsx-runtime";
69
+ var FOOTER_SAFE_AREA_PT = 72;
69
70
  function makeChromeStyles(brand) {
70
71
  return StyleSheet.create({
71
72
  headerRow: {
@@ -152,8 +153,19 @@ function makeChromeStyles(brand) {
152
153
  width: 32,
153
154
  height: 32
154
155
  },
156
+ // `flex: 1` makes the body fill the page's available flow area between the
157
+ // header and the footer's flow anchor. `marginBottom: FOOTER_SAFE_AREA_PT`
158
+ // carves an explicit safe-zone INSIDE that flow area so overflow children
159
+ // (e.g., a flex column with `justifyContent: "space-around"` and content
160
+ // exceeding the container height) cannot render past the body's bottom
161
+ // edge into the footer's render band. Combined with the page-level
162
+ // `paddingBottom: FOOTER_SAFE_AREA_PT`, this is a 2x defensive carve that
163
+ // covers both normal-flow pagination (where `paddingBottom` is sufficient)
164
+ // and non-paginating distributions (where only `marginBottom` saves you).
165
+ // See the JSDoc on `FOOTER_SAFE_AREA_PT` above for the full rationale.
155
166
  pageBody: {
156
- flex: 1
167
+ flex: 1,
168
+ marginBottom: FOOTER_SAFE_AREA_PT
157
169
  }
158
170
  });
159
171
  }
@@ -185,7 +197,8 @@ function ExportFooterPdf({
185
197
  url,
186
198
  dateLabel,
187
199
  qrDataUrl,
188
- prominence = "maximum"
200
+ prominence = "maximum",
201
+ fixed = true
189
202
  }) {
190
203
  const styles = makeChromeStyles(brand);
191
204
  const isRefined = prominence === "refined";
@@ -193,7 +206,7 @@ function ExportFooterPdf({
193
206
  const markSize = isRefined ? 20 : 26;
194
207
  const showQr = Boolean(qrDataUrl);
195
208
  const Logo = brand.renderLogoMarkPdf;
196
- return /* @__PURE__ */ jsxs(View, { style: styles.footerRow, fixed: true, children: [
209
+ return /* @__PURE__ */ jsxs(View, { style: styles.footerRow, fixed, children: [
197
210
  /* @__PURE__ */ jsxs(View, { style: styles.footerLeft, children: [
198
211
  /* @__PURE__ */ jsx(Logo, { size: markSize, variant: "original" }),
199
212
  /* @__PURE__ */ jsxs(View, { children: [
@@ -229,7 +242,9 @@ function BrandedPdfPage({
229
242
  }) {
230
243
  const styles = makeChromeStyles(brand);
231
244
  const defaultPageStyle = {
232
- padding: 36,
245
+ paddingTop: 36,
246
+ paddingHorizontal: 36,
247
+ paddingBottom: FOOTER_SAFE_AREA_PT,
233
248
  fontFamily: "Helvetica",
234
249
  backgroundColor: brand.colors.surface ?? "#ffffff",
235
250
  fontSize: 10,
@@ -264,6 +279,7 @@ export {
264
279
  BrandedPdfPage,
265
280
  ExportFooterPdf,
266
281
  ExportHeaderPdf,
282
+ FOOTER_SAFE_AREA_PT,
267
283
  buildExportFilename,
268
284
  buildExportUrl,
269
285
  generateQrDataUrl,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pdf-exports/prominence.ts","../../src/pdf-exports/qr.ts","../../src/pdf-exports/url-utils.ts","../../src/pdf-exports/pdf-chrome.tsx"],"sourcesContent":["import type { BrandConfig, ExportProminence, ExportTier } from \"./types\";\n\n/**\n * Default tier → prominence mapping.\n *\n * Patron and supporter tiers earn `refined` prominence (smaller branding chrome,\n * tagline hidden). All other tiers — including signed-in free users and anonymous\n * visitors — receive `maximum` prominence so OSS/app branding stays visible.\n *\n * Branding is **never removed**, only modulated in size and detail. Apps that need\n * a different vocabulary (e.g., \"plus\" / \"pro\") should supply\n * `BrandConfig.prominenceMap` instead of forking this function.\n *\n * @example\n * ```ts\n * tierToProminence(\"patron\"); // \"refined\"\n * tierToProminence(\"supporter\"); // \"refined\"\n * tierToProminence(\"free\"); // \"maximum\"\n * tierToProminence(null); // \"maximum\"\n * tierToProminence(\"plus\"); // \"maximum\" (unknown token falls back)\n * ```\n */\nexport function tierToProminence(tier: ExportTier): ExportProminence {\n if (tier === \"patron\") return \"refined\";\n if (tier === \"supporter\") return \"refined\";\n return \"maximum\";\n}\n\n/**\n * Resolve prominence for a brand — uses the brand's `prominenceMap` if supplied,\n * otherwise the default `tierToProminence` mapping.\n */\nexport function resolveProminence(\n brand: BrandConfig,\n tier: ExportTier,\n): ExportProminence {\n if (brand.prominenceMap) return brand.prominenceMap(tier);\n return tierToProminence(tier);\n}\n","/**\n * QR code generation for branded export footers.\n *\n * Uses the `qrcode` package (optional peer dependency). Calls return a base64\n * data URL ready to be embedded as an `<Image src={...}>` in react-pdf or as a\n * standard `<img>` in HTML preview routes.\n *\n * Failures (invalid URL, encoder errors) return `null` rather than throwing —\n * exports should degrade gracefully without a QR rather than failing the whole\n * PDF render.\n */\n\nexport interface GenerateQrDataUrlOptions {\n /** Output pixel size (square). Default: 320. */\n size?: number;\n /** Quiet-zone margin in modules. Default: 1. */\n margin?: number;\n /** Module (foreground) color. Default: \"#0c1f22\" (dark ink). */\n darkColor?: string;\n /** Background color. Default: \"#ffffff\". */\n lightColor?: string;\n /**\n * Error-correction level. Default: \"M\" (15% recovery — balances density vs durability\n * on printed sheets that may scuff or fold).\n */\n errorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\";\n}\n\n/**\n * Generate a QR code as a base64 PNG data URL.\n *\n * @param url - The URL to encode (typically a UTM-tagged link back to the live page).\n * @param options - Color, size, and error-correction overrides.\n * @returns Data URL string, or `null` on failure.\n *\n * @example\n * ```ts\n * const qrDataUrl = await generateQrDataUrl(\n * \"https://opensourcesports.io/rules/basketball?utm_source=export\",\n * { darkColor: brand.colors.ink },\n * );\n * if (qrDataUrl) {\n * // <Image src={qrDataUrl} style={...} />\n * }\n * ```\n */\nexport async function generateQrDataUrl(\n url: string,\n options?: GenerateQrDataUrlOptions,\n): Promise<string | null> {\n try {\n // Dynamic import keeps qrcode as an optional peer dep — only loaded if used.\n const qr = await import(\"qrcode\");\n const toDataURL = qr.default?.toDataURL ?? qr.toDataURL;\n return await toDataURL(url, {\n width: options?.size ?? 320,\n margin: options?.margin ?? 1,\n errorCorrectionLevel: options?.errorCorrectionLevel ?? \"M\",\n color: {\n dark: options?.darkColor ?? \"#0c1f22\",\n light: options?.lightColor ?? \"#ffffff\",\n },\n });\n } catch {\n return null;\n }\n}\n","import type { BrandConfig } from \"./types\";\n\n/**\n * Export medium — used in UTM tagging and filename suffixes.\n */\nexport type ExportMedium = \"pdf\" | \"png\" | \"ical\" | \"csv\" | \"tsv\";\n\n/**\n * File extension — distinct from medium because iCal uses `.ics` not `.ical`.\n */\nexport type ExportFileExt = \"pdf\" | \"png\" | \"ics\" | \"csv\" | \"tsv\";\n\nexport interface BuildExportUrlInput {\n /** Brand config — supplies the domain. */\n brand: BrandConfig;\n /**\n * Tool / template identifier (e.g., \"bracket-generator\", \"rules\", \"scoreboard\").\n * Becomes part of the URL path and `utm_tool`.\n */\n tool: string;\n /** Export medium for `utm_medium`. */\n medium: ExportMedium;\n /**\n * Optional share-link slug — when present, the URL points at `/s/<slug>` rather than\n * `/tools/<tool>` so QR scanners land on the actual shared artifact.\n */\n shareSlug?: string;\n /**\n * Optional URL path override. When supplied, replaces both `/s/<slug>` and\n * `/tools/<tool>` defaults. Useful for non-tool exports (e.g., `/rules/basketball`).\n */\n path?: string;\n /** Optional extra UTM/query params merged into the URL. */\n params?: Record<string, string>;\n}\n\n/**\n * Build a UTM-tagged URL for QR codes / footer links on branded exports.\n *\n * Every printed sheet that scans back to the live page becomes a measurable acquisition\n * channel — the UTM trio (`utm_source=export`, `utm_medium=<medium>`, `utm_tool=<tool>`)\n * lets analytics attribute traffic to specific export types.\n *\n * @example\n * ```ts\n * buildExportUrl({\n * brand: ossBrand,\n * tool: \"rules\",\n * medium: \"pdf\",\n * path: \"/rules/basketball\",\n * });\n * // → \"https://opensourcesports.io/rules/basketball?utm_source=export&utm_medium=pdf&utm_tool=rules\"\n * ```\n */\nexport function buildExportUrl({\n brand,\n tool,\n medium,\n shareSlug,\n path,\n params,\n}: BuildExportUrlInput): string {\n const resolvedPath = path\n ? path\n : shareSlug\n ? `/s/${shareSlug}`\n : `/tools/${tool}`;\n const base = `https://${brand.domain}${resolvedPath}`;\n const search = new URLSearchParams({\n utm_source: \"export\",\n utm_medium: medium,\n utm_tool: tool,\n ...params,\n });\n return `${base}?${search.toString()}`;\n}\n\nexport interface BuildExportFilenameInput {\n /** Brand config — supplies the filename prefix. */\n brand: BrandConfig;\n /** Tool / template identifier. */\n tool: string;\n /** Optional title or date suffix (slugified). */\n titleOrDate?: string;\n /** File extension. */\n ext: ExportFileExt;\n}\n\n/**\n * Build a filename of the form `{brand-slug}-{tool}[-{title-slug}].{ext}`.\n *\n * The brand slug is derived from `brand.name` (lowercased, hyphenated) so the filename\n * carries brand identity even when downloaded outside the app context.\n *\n * @example\n * ```ts\n * buildExportFilename({\n * brand: ossBrand,\n * tool: \"rules\",\n * titleOrDate: \"Basketball NBA\",\n * ext: \"pdf\",\n * });\n * // → \"opensourcesports-rules-basketball-nba.pdf\"\n * ```\n */\nexport function buildExportFilename({\n brand,\n tool,\n titleOrDate,\n ext,\n}: BuildExportFilenameInput): string {\n const brandSlug = slugify(brand.name);\n const titleSlug = slugify(titleOrDate);\n const middle = titleSlug ? `${tool}-${titleSlug}` : tool;\n return `${brandSlug}-${middle}.${ext}`;\n}\n\nfunction slugify(input: string | undefined): string {\n if (!input) return \"\";\n return input\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 60);\n}\n","import { Image, Page, StyleSheet, Text, View } from \"@react-pdf/renderer\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport type { BrandConfig, ExportProminence } from \"./types\";\n\n/**\n * @react-pdf/renderer is declared as an OPTIONAL peer dependency. Apps that\n * import this subpath must install it themselves; bundlers will surface a\n * clear \"Cannot find module\" error if it isn't present, which is the standard\n * platform-core pattern for optional peers (`pg`, `ioredis`, `bullmq`, etc).\n */\n\n/**\n * Build a brand-aware StyleSheet for header + footer chrome.\n *\n * Called once per render — react-pdf's StyleSheet.create is intentionally\n * lightweight and the perf cost is negligible relative to the actual document\n * render. Building per render means brand colors are honored without\n * module-level caching tricks.\n */\nfunction makeChromeStyles(brand: BrandConfig) {\n return StyleSheet.create({\n headerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderBottomWidth: 3,\n borderBottomColor: brand.colors.primary,\n paddingBottom: 10,\n marginBottom: 12,\n gap: 16,\n },\n headerLeft: { flexDirection: \"column\", flexGrow: 1, flexShrink: 1 },\n eyebrow: {\n fontSize: 9,\n letterSpacing: 1.5,\n color: brand.colors.muted,\n textTransform: \"uppercase\",\n fontFamily: \"Helvetica-Bold\",\n marginBottom: 2,\n },\n title: {\n fontSize: 22,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.ink,\n lineHeight: 1.15,\n },\n subtitle: {\n fontSize: 10,\n color: brand.colors.muted,\n marginTop: 3,\n },\n lockupRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: 8,\n },\n wordmark: {\n fontSize: 13,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n letterSpacing: -0.2,\n },\n footerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderTopWidth: 2,\n borderTopColor: brand.colors.primary,\n paddingTop: 8,\n marginTop: 10,\n gap: 16,\n },\n footerLeft: { flexDirection: \"row\", alignItems: \"center\", gap: 8 },\n footerMid: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n flexShrink: 1,\n },\n footerUrl: {\n fontSize: 9,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n footerDate: {\n fontSize: 8,\n color: brand.colors.muted,\n marginTop: 2,\n },\n footerTagline: {\n fontSize: 8,\n color: brand.colors.muted,\n },\n footerName: {\n fontSize: 11,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n qr: {\n width: 44,\n height: 44,\n },\n qrRefined: {\n width: 32,\n height: 32,\n },\n pageBody: {\n flex: 1,\n },\n });\n}\n\nexport interface ExportHeaderPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title (e.g., \"Basketball (NBA) — Official Rules\"). */\n title: string;\n /** Small uppercase eyebrow above the title (e.g., \"Rules Sheet\", \"Bracket Generator\"). */\n toolLabel: string;\n /** Optional supplemental line under the title. */\n subtitle?: string;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n}\n\n/**\n * Branded PDF document header — first-page only by default.\n *\n * Renders eyebrow + title + optional subtitle on the left, brand mark + wordmark on\n * the right, with a primary-color rule below.\n */\nexport function ExportHeaderPdf({\n brand,\n title,\n toolLabel,\n subtitle,\n prominence = \"maximum\",\n}: ExportHeaderPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const lockupSize = prominence === \"maximum\" ? 32 : 26;\n const titleSize = prominence === \"maximum\" ? 22 : 18;\n const Logo = brand.renderLogoMarkPdf;\n return (\n <View style={styles.headerRow} fixed={false}>\n <View style={styles.headerLeft}>\n <Text style={styles.eyebrow}>{toolLabel}</Text>\n <Text style={[styles.title, { fontSize: titleSize }]}>{title}</Text>\n {subtitle ? <Text style={styles.subtitle}>{subtitle}</Text> : null}\n </View>\n <View style={styles.lockupRow}>\n <Logo size={lockupSize} variant=\"original\" />\n <Text style={styles.wordmark}>{brand.name}</Text>\n </View>\n </View>\n );\n}\n\nexport interface ExportFooterPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Public URL displayed in footer (typically UTM-tagged via `buildExportUrl`). */\n url: string;\n /** Generation date label (e.g., \"Generated April 26, 2026\"). */\n dateLabel?: string;\n /** Pre-rendered QR data URL (from `generateQrDataUrl`). Pass `null` to omit. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n}\n\n/**\n * Branded PDF document footer — `fixed` so it renders on every page.\n *\n * Composition: brand mark + name (left), URL + date (center-right), QR (far right).\n * Tagline shown only at `maximum` prominence; QR shrinks at `refined`.\n */\nexport function ExportFooterPdf({\n brand,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n}: ExportFooterPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const isRefined = prominence === \"refined\";\n const showTagline = prominence === \"maximum\" && Boolean(brand.tagline);\n const markSize = isRefined ? 20 : 26;\n const showQr = Boolean(qrDataUrl);\n const Logo = brand.renderLogoMarkPdf;\n\n return (\n <View style={styles.footerRow} fixed>\n <View style={styles.footerLeft}>\n <Logo size={markSize} variant=\"original\" />\n <View>\n <Text style={styles.footerName}>{brand.name}</Text>\n {showTagline ? (\n <Text style={styles.footerTagline}>{brand.tagline}</Text>\n ) : null}\n </View>\n </View>\n <View style={styles.footerMid}>\n <Text style={styles.footerUrl}>{url}</Text>\n {dateLabel ? <Text style={styles.footerDate}>{dateLabel}</Text> : null}\n </View>\n {showQr && qrDataUrl ? (\n <Image\n src={qrDataUrl}\n style={isRefined ? styles.qrRefined : styles.qr}\n />\n ) : null}\n </View>\n );\n}\n\nexport interface BrandedPdfPageProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title shown in the header. */\n title: string;\n /** Eyebrow label above the title. */\n toolLabel: string;\n /** Optional subtitle under the title. */\n subtitle?: string;\n /** Footer URL (typically UTM-tagged). */\n url: string;\n /** Footer date label. */\n dateLabel?: string;\n /** Pre-rendered QR data URL. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n /**\n * Optional react-pdf Page-level style overrides (e.g., padding, fontFamily).\n * Merged onto the default page styles.\n */\n pageStyle?: Record<string, unknown>;\n /** Optional react-pdf page size. Defaults to \"LETTER\". */\n size?: \"LETTER\" | \"A4\" | \"LEGAL\" | \"TABLOID\";\n /** Document body — your selected sections, content, etc. */\n children: ReactNode;\n}\n\n/**\n * Full branded PDF page wrapper — composes header + body slot + sticky footer.\n *\n * The footer is `fixed` so it renders on every page automatically. The header is\n * first-page only; if you need a per-page compact strip on page 2+, use\n * `ExportHeaderPdf` with your own placement logic.\n *\n * @example\n * ```tsx\n * import { Document } from \"@react-pdf/renderer\";\n * import { BrandedPdfPage } from \"@digilogiclabs/platform-core/pdf-exports\";\n *\n * <Document>\n * <BrandedPdfPage\n * brand={ossBrand}\n * title=\"Basketball — Official Rules\"\n * toolLabel=\"Rules Sheet\"\n * url=\"https://opensourcesports.io/rules/basketball?utm_source=export\"\n * qrDataUrl={qrDataUrl}\n * prominence={tierToProminence(userTier)}\n * >\n * <RulesBody sections={selectedSections} />\n * </BrandedPdfPage>\n * </Document>\n * ```\n */\nexport function BrandedPdfPage({\n brand,\n title,\n toolLabel,\n subtitle,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n pageStyle,\n size = \"LETTER\",\n children,\n}: BrandedPdfPageProps): ReactElement {\n const styles = makeChromeStyles(brand);\n\n const defaultPageStyle = {\n padding: 36,\n fontFamily: \"Helvetica\",\n backgroundColor: brand.colors.surface ?? \"#ffffff\",\n fontSize: 10,\n color: brand.colors.ink,\n };\n const mergedPageStyle = { ...defaultPageStyle, ...pageStyle };\n\n return (\n <Page size={size} style={mergedPageStyle}>\n <ExportHeaderPdf\n brand={brand}\n title={title}\n toolLabel={toolLabel}\n subtitle={subtitle}\n prominence={prominence}\n />\n <View style={styles.pageBody}>{children}</View>\n <ExportFooterPdf\n brand={brand}\n url={url}\n dateLabel={dateLabel}\n qrDataUrl={qrDataUrl}\n prominence={prominence}\n />\n </Page>\n );\n}\n"],"mappings":";AAsBO,SAAS,iBAAiB,MAAoC;AACnE,MAAI,SAAS,SAAU,QAAO;AAC9B,MAAI,SAAS,YAAa,QAAO;AACjC,SAAO;AACT;AAMO,SAAS,kBACd,OACA,MACkB;AAClB,MAAI,MAAM,cAAe,QAAO,MAAM,cAAc,IAAI;AACxD,SAAO,iBAAiB,IAAI;AAC9B;;;ACQA,eAAsB,kBACpB,KACA,SACwB;AACxB,MAAI;AAEF,UAAM,KAAK,MAAM,OAAO,QAAQ;AAChC,UAAM,YAAY,GAAG,SAAS,aAAa,GAAG;AAC9C,WAAO,MAAM,UAAU,KAAK;AAAA,MAC1B,OAAO,SAAS,QAAQ;AAAA,MACxB,QAAQ,SAAS,UAAU;AAAA,MAC3B,sBAAsB,SAAS,wBAAwB;AAAA,MACvD,OAAO;AAAA,QACL,MAAM,SAAS,aAAa;AAAA,QAC5B,OAAO,SAAS,cAAc;AAAA,MAChC;AAAA,IACF,CAAC;AAAA,EACH,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;ACZO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAC9B,QAAM,eAAe,OACjB,OACA,YACE,MAAM,SAAS,KACf,UAAU,IAAI;AACpB,QAAM,OAAO,WAAW,MAAM,MAAM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O,OAAO,WAClB;AAAA,0BAAC,QAAK,OAAO,OAAO,WAAY,eAAI;AAAA,MACnC,YAAY,oBAAC,QAAK,OAAO,OAAO,YAAa,qBAAU,IAAU;AAAA,OACpE;AAAA,IACC,UAAU,YACT;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,OAAO,YAAY,OAAO,YAAY,OAAO;AAAA;AAAA,IAC/C,IACE;AAAA,KACN;AAEJ;AAwDO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,OAAO;AAAA,EACP;AACF,GAAsC;AACpC,QAAM,SAAS,iBAAiB,KAAK;AAErC,QAAM,mBAAmB;AAAA,IACvB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB,MAAM,OAAO,WAAW;AAAA,IACzC,UAAU;AAAA,IACV,OAAO,MAAM,OAAO;AAAA,EACtB;AACA,QAAM,kBAAkB,EAAE,GAAG,kBAAkB,GAAG,UAAU;AAE5D,SACE,qBAAC,QAAK,MAAY,OAAO,iBACvB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,QAAK,OAAO,OAAO,UAAW,UAAS;AAAA,IACxC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/pdf-exports/prominence.ts","../../src/pdf-exports/qr.ts","../../src/pdf-exports/url-utils.ts","../../src/pdf-exports/pdf-chrome.tsx"],"sourcesContent":["import type { BrandConfig, ExportProminence, ExportTier } from \"./types\";\n\n/**\n * Default tier → prominence mapping.\n *\n * Patron and supporter tiers earn `refined` prominence (smaller branding chrome,\n * tagline hidden). All other tiers — including signed-in free users and anonymous\n * visitors — receive `maximum` prominence so OSS/app branding stays visible.\n *\n * Branding is **never removed**, only modulated in size and detail. Apps that need\n * a different vocabulary (e.g., \"plus\" / \"pro\") should supply\n * `BrandConfig.prominenceMap` instead of forking this function.\n *\n * @example\n * ```ts\n * tierToProminence(\"patron\"); // \"refined\"\n * tierToProminence(\"supporter\"); // \"refined\"\n * tierToProminence(\"free\"); // \"maximum\"\n * tierToProminence(null); // \"maximum\"\n * tierToProminence(\"plus\"); // \"maximum\" (unknown token falls back)\n * ```\n */\nexport function tierToProminence(tier: ExportTier): ExportProminence {\n if (tier === \"patron\") return \"refined\";\n if (tier === \"supporter\") return \"refined\";\n return \"maximum\";\n}\n\n/**\n * Resolve prominence for a brand — uses the brand's `prominenceMap` if supplied,\n * otherwise the default `tierToProminence` mapping.\n */\nexport function resolveProminence(\n brand: BrandConfig,\n tier: ExportTier,\n): ExportProminence {\n if (brand.prominenceMap) return brand.prominenceMap(tier);\n return tierToProminence(tier);\n}\n","/**\n * QR code generation for branded export footers.\n *\n * Uses the `qrcode` package (optional peer dependency). Calls return a base64\n * data URL ready to be embedded as an `<Image src={...}>` in react-pdf or as a\n * standard `<img>` in HTML preview routes.\n *\n * Failures (invalid URL, encoder errors) return `null` rather than throwing —\n * exports should degrade gracefully without a QR rather than failing the whole\n * PDF render.\n */\n\nexport interface GenerateQrDataUrlOptions {\n /** Output pixel size (square). Default: 320. */\n size?: number;\n /** Quiet-zone margin in modules. Default: 1. */\n margin?: number;\n /** Module (foreground) color. Default: \"#0c1f22\" (dark ink). */\n darkColor?: string;\n /** Background color. Default: \"#ffffff\". */\n lightColor?: string;\n /**\n * Error-correction level. Default: \"M\" (15% recovery — balances density vs durability\n * on printed sheets that may scuff or fold).\n */\n errorCorrectionLevel?: \"L\" | \"M\" | \"Q\" | \"H\";\n}\n\n/**\n * Generate a QR code as a base64 PNG data URL.\n *\n * @param url - The URL to encode (typically a UTM-tagged link back to the live page).\n * @param options - Color, size, and error-correction overrides.\n * @returns Data URL string, or `null` on failure.\n *\n * @example\n * ```ts\n * const qrDataUrl = await generateQrDataUrl(\n * \"https://opensourcesports.io/rules/basketball?utm_source=export\",\n * { darkColor: brand.colors.ink },\n * );\n * if (qrDataUrl) {\n * // <Image src={qrDataUrl} style={...} />\n * }\n * ```\n */\nexport async function generateQrDataUrl(\n url: string,\n options?: GenerateQrDataUrlOptions,\n): Promise<string | null> {\n try {\n // Dynamic import keeps qrcode as an optional peer dep — only loaded if used.\n const qr = await import(\"qrcode\");\n const toDataURL = qr.default?.toDataURL ?? qr.toDataURL;\n return await toDataURL(url, {\n width: options?.size ?? 320,\n margin: options?.margin ?? 1,\n errorCorrectionLevel: options?.errorCorrectionLevel ?? \"M\",\n color: {\n dark: options?.darkColor ?? \"#0c1f22\",\n light: options?.lightColor ?? \"#ffffff\",\n },\n });\n } catch {\n return null;\n }\n}\n","import type { BrandConfig } from \"./types\";\n\n/**\n * Export medium — used in UTM tagging and filename suffixes.\n */\nexport type ExportMedium = \"pdf\" | \"png\" | \"ical\" | \"csv\" | \"tsv\";\n\n/**\n * File extension — distinct from medium because iCal uses `.ics` not `.ical`.\n */\nexport type ExportFileExt = \"pdf\" | \"png\" | \"ics\" | \"csv\" | \"tsv\";\n\nexport interface BuildExportUrlInput {\n /** Brand config — supplies the domain. */\n brand: BrandConfig;\n /**\n * Tool / template identifier (e.g., \"bracket-generator\", \"rules\", \"scoreboard\").\n * Becomes part of the URL path and `utm_tool`.\n */\n tool: string;\n /** Export medium for `utm_medium`. */\n medium: ExportMedium;\n /**\n * Optional share-link slug — when present, the URL points at `/s/<slug>` rather than\n * `/tools/<tool>` so QR scanners land on the actual shared artifact.\n */\n shareSlug?: string;\n /**\n * Optional URL path override. When supplied, replaces both `/s/<slug>` and\n * `/tools/<tool>` defaults. Useful for non-tool exports (e.g., `/rules/basketball`).\n */\n path?: string;\n /** Optional extra UTM/query params merged into the URL. */\n params?: Record<string, string>;\n}\n\n/**\n * Build a UTM-tagged URL for QR codes / footer links on branded exports.\n *\n * Every printed sheet that scans back to the live page becomes a measurable acquisition\n * channel — the UTM trio (`utm_source=export`, `utm_medium=<medium>`, `utm_tool=<tool>`)\n * lets analytics attribute traffic to specific export types.\n *\n * @example\n * ```ts\n * buildExportUrl({\n * brand: ossBrand,\n * tool: \"rules\",\n * medium: \"pdf\",\n * path: \"/rules/basketball\",\n * });\n * // → \"https://opensourcesports.io/rules/basketball?utm_source=export&utm_medium=pdf&utm_tool=rules\"\n * ```\n */\nexport function buildExportUrl({\n brand,\n tool,\n medium,\n shareSlug,\n path,\n params,\n}: BuildExportUrlInput): string {\n const resolvedPath = path\n ? path\n : shareSlug\n ? `/s/${shareSlug}`\n : `/tools/${tool}`;\n const base = `https://${brand.domain}${resolvedPath}`;\n const search = new URLSearchParams({\n utm_source: \"export\",\n utm_medium: medium,\n utm_tool: tool,\n ...params,\n });\n return `${base}?${search.toString()}`;\n}\n\nexport interface BuildExportFilenameInput {\n /** Brand config — supplies the filename prefix. */\n brand: BrandConfig;\n /** Tool / template identifier. */\n tool: string;\n /** Optional title or date suffix (slugified). */\n titleOrDate?: string;\n /** File extension. */\n ext: ExportFileExt;\n}\n\n/**\n * Build a filename of the form `{brand-slug}-{tool}[-{title-slug}].{ext}`.\n *\n * The brand slug is derived from `brand.name` (lowercased, hyphenated) so the filename\n * carries brand identity even when downloaded outside the app context.\n *\n * @example\n * ```ts\n * buildExportFilename({\n * brand: ossBrand,\n * tool: \"rules\",\n * titleOrDate: \"Basketball NBA\",\n * ext: \"pdf\",\n * });\n * // → \"opensourcesports-rules-basketball-nba.pdf\"\n * ```\n */\nexport function buildExportFilename({\n brand,\n tool,\n titleOrDate,\n ext,\n}: BuildExportFilenameInput): string {\n const brandSlug = slugify(brand.name);\n const titleSlug = slugify(titleOrDate);\n const middle = titleSlug ? `${tool}-${titleSlug}` : tool;\n return `${brandSlug}-${middle}.${ext}`;\n}\n\nfunction slugify(input: string | undefined): string {\n if (!input) return \"\";\n return input\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 60);\n}\n","import { Image, Page, StyleSheet, Text, View } from \"@react-pdf/renderer\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport type { BrandConfig, ExportProminence } from \"./types\";\n\n/**\n * @react-pdf/renderer is declared as an OPTIONAL peer dependency. Apps that\n * import this subpath must install it themselves; bundlers will surface a\n * clear \"Cannot find module\" error if it isn't present, which is the standard\n * platform-core pattern for optional peers (`pg`, `ioredis`, `bullmq`, etc).\n */\n\n/**\n * Vertical space (in PDF points) that a `<Page>` must reserve at the bottom\n * to keep flowed body content from rendering under the `fixed` footer.\n *\n * react-pdf paginates flow content when it reaches `pageHeight - paddingBottom`;\n * `fixed` elements like `<ExportFooterPdf>` are pinned at their flow anchor on\n * every page but DO NOT push the pagination boundary. So if `paddingBottom` is\n * smaller than the footer's natural height, the last lines of body content on\n * each page render directly underneath the footer chrome.\n *\n * The `ExportFooterPdf` rendered by this module claims roughly 55-60pt at\n * `maximum` prominence (44pt QR + 8pt paddingTop + 2pt borderTop + line-height\n * descenders + small render-engine slack). 72pt = footer + ~12pt clearance,\n * which is the minimum we recommend for any `<Page>` that mounts an\n * `<ExportFooterPdf>` (or `<BrandedPdfPage>`).\n *\n * **Why two carves are applied inside `BrandedPdfPage`:** `paddingBottom` alone\n * protects normal flow content from paginating into the footer band, but it\n * does NOT protect against overflow rendering — children inside the body\n * container that use `justifyContent: \"space-around\"` (or any non-paginating\n * distribution) and exceed the container's height render PAST the container's\n * bottom edge, into the footer's render band. To absorb this case,\n * `BrandedPdfPage` ALSO sets `marginBottom: FOOTER_SAFE_AREA_PT` on the body\n * `<View>`, carving an explicit safe-zone inside the flow area. The double\n * carve is intentional and defensive — combined, they cover both the\n * pagination boundary AND modest overflow from custom layouts.\n *\n * Consumers that build their own `<Page>` directly (rather than using\n * `<BrandedPdfPage>`) should set `paddingBottom` to at least this value AND,\n * if they nest body content inside a flex container with non-paginating\n * `justifyContent`, also apply `marginBottom: FOOTER_SAFE_AREA_PT` to that\n * container. Documents that only use plain flow content (`<Text>`, `<View>`\n * stacks) need only the `paddingBottom`.\n */\nexport const FOOTER_SAFE_AREA_PT = 72;\n\n/**\n * Build a brand-aware StyleSheet for header + footer chrome.\n *\n * Called once per render — react-pdf's StyleSheet.create is intentionally\n * lightweight and the perf cost is negligible relative to the actual document\n * render. Building per render means brand colors are honored without\n * module-level caching tricks.\n */\nfunction makeChromeStyles(brand: BrandConfig) {\n return StyleSheet.create({\n headerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderBottomWidth: 3,\n borderBottomColor: brand.colors.primary,\n paddingBottom: 10,\n marginBottom: 12,\n gap: 16,\n },\n headerLeft: { flexDirection: \"column\", flexGrow: 1, flexShrink: 1 },\n eyebrow: {\n fontSize: 9,\n letterSpacing: 1.5,\n color: brand.colors.muted,\n textTransform: \"uppercase\",\n fontFamily: \"Helvetica-Bold\",\n marginBottom: 2,\n },\n title: {\n fontSize: 22,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.ink,\n lineHeight: 1.15,\n },\n subtitle: {\n fontSize: 10,\n color: brand.colors.muted,\n marginTop: 3,\n },\n lockupRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: 8,\n },\n wordmark: {\n fontSize: 13,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n letterSpacing: -0.2,\n },\n footerRow: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n borderTopWidth: 2,\n borderTopColor: brand.colors.primary,\n paddingTop: 8,\n marginTop: 10,\n gap: 16,\n },\n footerLeft: { flexDirection: \"row\", alignItems: \"center\", gap: 8 },\n footerMid: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n flexShrink: 1,\n },\n footerUrl: {\n fontSize: 9,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n footerDate: {\n fontSize: 8,\n color: brand.colors.muted,\n marginTop: 2,\n },\n footerTagline: {\n fontSize: 8,\n color: brand.colors.muted,\n },\n footerName: {\n fontSize: 11,\n fontFamily: \"Helvetica-Bold\",\n color: brand.colors.secondary,\n },\n qr: {\n width: 44,\n height: 44,\n },\n qrRefined: {\n width: 32,\n height: 32,\n },\n // `flex: 1` makes the body fill the page's available flow area between the\n // header and the footer's flow anchor. `marginBottom: FOOTER_SAFE_AREA_PT`\n // carves an explicit safe-zone INSIDE that flow area so overflow children\n // (e.g., a flex column with `justifyContent: \"space-around\"` and content\n // exceeding the container height) cannot render past the body's bottom\n // edge into the footer's render band. Combined with the page-level\n // `paddingBottom: FOOTER_SAFE_AREA_PT`, this is a 2x defensive carve that\n // covers both normal-flow pagination (where `paddingBottom` is sufficient)\n // and non-paginating distributions (where only `marginBottom` saves you).\n // See the JSDoc on `FOOTER_SAFE_AREA_PT` above for the full rationale.\n pageBody: {\n flex: 1,\n marginBottom: FOOTER_SAFE_AREA_PT,\n },\n });\n}\n\nexport interface ExportHeaderPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title (e.g., \"Basketball (NBA) — Official Rules\"). */\n title: string;\n /** Small uppercase eyebrow above the title (e.g., \"Rules Sheet\", \"Bracket Generator\"). */\n toolLabel: string;\n /** Optional supplemental line under the title. */\n subtitle?: string;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n}\n\n/**\n * Branded PDF document header — first-page only by default.\n *\n * Renders eyebrow + title + optional subtitle on the left, brand mark + wordmark on\n * the right, with a primary-color rule below.\n */\nexport function ExportHeaderPdf({\n brand,\n title,\n toolLabel,\n subtitle,\n prominence = \"maximum\",\n}: ExportHeaderPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const lockupSize = prominence === \"maximum\" ? 32 : 26;\n const titleSize = prominence === \"maximum\" ? 22 : 18;\n const Logo = brand.renderLogoMarkPdf;\n return (\n <View style={styles.headerRow} fixed={false}>\n <View style={styles.headerLeft}>\n <Text style={styles.eyebrow}>{toolLabel}</Text>\n <Text style={[styles.title, { fontSize: titleSize }]}>{title}</Text>\n {subtitle ? <Text style={styles.subtitle}>{subtitle}</Text> : null}\n </View>\n <View style={styles.lockupRow}>\n <Logo size={lockupSize} variant=\"original\" />\n <Text style={styles.wordmark}>{brand.name}</Text>\n </View>\n </View>\n );\n}\n\nexport interface ExportFooterPdfProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Public URL displayed in footer (typically UTM-tagged via `buildExportUrl`). */\n url: string;\n /** Generation date label (e.g., \"Generated April 26, 2026\"). */\n dateLabel?: string;\n /** Pre-rendered QR data URL (from `generateQrDataUrl`). Pass `null` to omit. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n /**\n * Render with react-pdf's `fixed` prop so the footer appears on every page\n * of a multi-page document. Defaults to `true` (the typical behavior).\n *\n * Set to `false` for documents whose body content cannot be reliably\n * constrained above the footer's render band — e.g., a `flex: 1` layout\n * with overflow children that paginate (large brackets, dense tables,\n * etc.). With `fixed: false` the footer flows after the body and renders\n * only on the LAST page; intermediate pages have no footer chrome but\n * also no body-on-footer overlap. This is the architecturally correct\n * trade-off for content where pagination is the rule, not the exception.\n *\n * For ordinary documents (rules sheets, score sheets, single-page\n * profile cards) leave at the default `true`.\n */\n fixed?: boolean;\n}\n\n/**\n * Branded PDF document footer — `fixed` so it renders on every page (default).\n *\n * Composition: brand mark + name (left), URL + date (center-right), QR (far right).\n * Tagline shown only at `maximum` prominence; QR shrinks at `refined`.\n *\n * Pass `fixed={false}` for layouts where body content can spill into the\n * footer's render band on intermediate pages — see the prop JSDoc above.\n */\nexport function ExportFooterPdf({\n brand,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n fixed = true,\n}: ExportFooterPdfProps): ReactElement {\n const styles = makeChromeStyles(brand);\n const isRefined = prominence === \"refined\";\n const showTagline = prominence === \"maximum\" && Boolean(brand.tagline);\n const markSize = isRefined ? 20 : 26;\n const showQr = Boolean(qrDataUrl);\n const Logo = brand.renderLogoMarkPdf;\n\n return (\n <View style={styles.footerRow} fixed={fixed}>\n <View style={styles.footerLeft}>\n <Logo size={markSize} variant=\"original\" />\n <View>\n <Text style={styles.footerName}>{brand.name}</Text>\n {showTagline ? (\n <Text style={styles.footerTagline}>{brand.tagline}</Text>\n ) : null}\n </View>\n </View>\n <View style={styles.footerMid}>\n <Text style={styles.footerUrl}>{url}</Text>\n {dateLabel ? <Text style={styles.footerDate}>{dateLabel}</Text> : null}\n </View>\n {showQr && qrDataUrl ? (\n <Image\n src={qrDataUrl}\n style={isRefined ? styles.qrRefined : styles.qr}\n />\n ) : null}\n </View>\n );\n}\n\nexport interface BrandedPdfPageProps {\n /** Brand configuration. */\n brand: BrandConfig;\n /** Document title shown in the header. */\n title: string;\n /** Eyebrow label above the title. */\n toolLabel: string;\n /** Optional subtitle under the title. */\n subtitle?: string;\n /** Footer URL (typically UTM-tagged). */\n url: string;\n /** Footer date label. */\n dateLabel?: string;\n /** Pre-rendered QR data URL. */\n qrDataUrl?: string | null;\n /** Branding prominence. Defaults to `maximum`. */\n prominence?: ExportProminence;\n /**\n * Optional react-pdf Page-level style overrides (e.g., padding, fontFamily).\n * Merged onto the default page styles.\n */\n pageStyle?: Record<string, unknown>;\n /** Optional react-pdf page size. Defaults to \"LETTER\". */\n size?: \"LETTER\" | \"A4\" | \"LEGAL\" | \"TABLOID\";\n /** Document body — your selected sections, content, etc. */\n children: ReactNode;\n}\n\n/**\n * Full branded PDF page wrapper — composes header + body slot + sticky footer.\n *\n * The footer is `fixed` so it renders on every page automatically. The header is\n * first-page only; if you need a per-page compact strip on page 2+, use\n * `ExportHeaderPdf` with your own placement logic.\n *\n * @example\n * ```tsx\n * import { Document } from \"@react-pdf/renderer\";\n * import { BrandedPdfPage } from \"@digilogiclabs/platform-core/pdf-exports\";\n *\n * <Document>\n * <BrandedPdfPage\n * brand={ossBrand}\n * title=\"Basketball — Official Rules\"\n * toolLabel=\"Rules Sheet\"\n * url=\"https://opensourcesports.io/rules/basketball?utm_source=export\"\n * qrDataUrl={qrDataUrl}\n * prominence={tierToProminence(userTier)}\n * >\n * <RulesBody sections={selectedSections} />\n * </BrandedPdfPage>\n * </Document>\n * ```\n */\nexport function BrandedPdfPage({\n brand,\n title,\n toolLabel,\n subtitle,\n url,\n dateLabel,\n qrDataUrl,\n prominence = \"maximum\",\n pageStyle,\n size = \"LETTER\",\n children,\n}: BrandedPdfPageProps): ReactElement {\n const styles = makeChromeStyles(brand);\n\n // Padding is split rather than uniform so the bottom edge reserves room\n // for the `fixed` footer (see `FOOTER_SAFE_AREA_PT` for the rationale).\n // Consumers can still override individual values via `pageStyle`.\n const defaultPageStyle = {\n paddingTop: 36,\n paddingHorizontal: 36,\n paddingBottom: FOOTER_SAFE_AREA_PT,\n fontFamily: \"Helvetica\",\n backgroundColor: brand.colors.surface ?? \"#ffffff\",\n fontSize: 10,\n color: brand.colors.ink,\n };\n const mergedPageStyle = { ...defaultPageStyle, ...pageStyle };\n\n return (\n <Page size={size} style={mergedPageStyle}>\n <ExportHeaderPdf\n brand={brand}\n title={title}\n toolLabel={toolLabel}\n subtitle={subtitle}\n prominence={prominence}\n />\n <View style={styles.pageBody}>{children}</View>\n <ExportFooterPdf\n brand={brand}\n url={url}\n dateLabel={dateLabel}\n qrDataUrl={qrDataUrl}\n prominence={prominence}\n />\n </Page>\n );\n}\n"],"mappings":";AAsBO,SAAS,iBAAiB,MAAoC;AACnE,MAAI,SAAS,SAAU,QAAO;AAC9B,MAAI,SAAS,YAAa,QAAO;AACjC,SAAO;AACT;AAMO,SAAS,kBACd,OACA,MACkB;AAClB,MAAI,MAAM,cAAe,QAAO,MAAM,cAAc,IAAI;AACxD,SAAO,iBAAiB,IAAI;AAC9B;;;ACQA,eAAsB,kBACpB,KACA,SACwB;AACxB,MAAI;AAEF,UAAM,KAAK,MAAM,OAAO,QAAQ;AAChC,UAAM,YAAY,GAAG,SAAS,aAAa,GAA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O,MAAM,OAAO;AAAA,EACtB;AACA,QAAM,kBAAkB,EAAE,GAAG,kBAAkB,GAAG,UAAU;AAE5D,SACE,qBAAC,QAAK,MAAY,OAAO,iBACvB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,QAAK,OAAO,OAAO,UAAW,UAAS;AAAA,IACxC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digilogiclabs/platform-core",
3
- "version": "1.20.1",
3
+ "version": "1.20.3",
4
4
  "description": "Vendor-agnostic infrastructure abstraction layer for DLL Platform",
5
5
  "keywords": [
6
6
  "platform",