@aglyn/aglyn 1.0.0-beta.219 → 1.0.0-beta.221

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.
Files changed (188) hide show
  1. package/package.json +12 -12
  2. package/src/lib/app-utils/actions.d.ts +1 -59
  3. package/src/lib/app-utils/actions.js +7 -72
  4. package/src/lib/app-utils/actions.js.map +1 -1
  5. package/src/lib/app-utils/consent-groups.d.ts +1 -1
  6. package/src/lib/app-utils/consent-groups.js.map +1 -1
  7. package/src/lib/app-utils/console-routes.d.ts +0 -36
  8. package/src/lib/app-utils/console-routes.js +2 -37
  9. package/src/lib/app-utils/console-routes.js.map +1 -1
  10. package/src/lib/app-utils/contacts.d.ts +1 -1
  11. package/src/lib/app-utils/contacts.js.map +1 -1
  12. package/src/lib/app-utils/container-membership.d.ts +93 -0
  13. package/src/lib/app-utils/container-membership.js +165 -0
  14. package/src/lib/app-utils/container-membership.js.map +1 -0
  15. package/src/lib/app-utils/crm-task-reminders.d.ts +23 -6
  16. package/src/lib/app-utils/crm-task-reminders.js +32 -11
  17. package/src/lib/app-utils/crm-task-reminders.js.map +1 -1
  18. package/src/lib/app-utils/crm.d.ts +24 -4
  19. package/src/lib/app-utils/crm.js +23 -0
  20. package/src/lib/app-utils/crm.js.map +1 -1
  21. package/src/lib/app-utils/csv-upload.d.ts +1 -1
  22. package/src/lib/app-utils/csv-upload.js +1 -1
  23. package/src/lib/app-utils/csv-upload.js.map +1 -1
  24. package/src/lib/app-utils/{dataset-csv.d.ts → csv.d.ts} +10 -43
  25. package/src/lib/app-utils/{dataset-csv.js → csv.js} +10 -81
  26. package/src/lib/app-utils/csv.js.map +1 -0
  27. package/src/lib/app-utils/datasets.d.ts +0 -19
  28. package/src/lib/app-utils/datasets.js +0 -13
  29. package/src/lib/app-utils/datasets.js.map +1 -1
  30. package/src/lib/app-utils/docs-help.generated.d.ts +4 -4
  31. package/src/lib/app-utils/docs-help.generated.js +5 -0
  32. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  33. package/src/lib/app-utils/docs-index.generated.js +71 -36
  34. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  35. package/src/lib/app-utils/dynamic-list-rule.js +3 -3
  36. package/src/lib/app-utils/dynamic-list-rule.js.map +1 -1
  37. package/src/lib/app-utils/email-text.d.ts +80 -0
  38. package/src/lib/app-utils/email-text.js +189 -0
  39. package/src/lib/app-utils/email-text.js.map +1 -0
  40. package/src/lib/app-utils/{list-assignment-policy.d.ts → enrollment-basis.d.ts} +4 -0
  41. package/src/lib/app-utils/{list-assignment-policy.js → enrollment-basis.js} +5 -1
  42. package/src/lib/app-utils/enrollment-basis.js.map +1 -0
  43. package/src/lib/app-utils/expand-repeatables.js +4 -4
  44. package/src/lib/app-utils/expand-repeatables.js.map +1 -1
  45. package/src/lib/app-utils/forms.js +2 -2
  46. package/src/lib/app-utils/forms.js.map +1 -1
  47. package/src/lib/app-utils/health-report.d.ts +2 -3
  48. package/src/lib/app-utils/health-report.js +30 -6
  49. package/src/lib/app-utils/health-report.js.map +1 -1
  50. package/src/lib/app-utils/inbound-mail-domain.d.ts +27 -0
  51. package/src/lib/app-utils/inbound-mail-domain.js +31 -0
  52. package/src/lib/app-utils/inbound-mail-domain.js.map +1 -0
  53. package/src/lib/app-utils/leaving-notice.d.ts +96 -0
  54. package/src/lib/app-utils/leaving-notice.js +157 -0
  55. package/src/lib/app-utils/leaving-notice.js.map +1 -0
  56. package/src/lib/app-utils/lockdown.d.ts +11 -0
  57. package/src/lib/app-utils/lockdown.js +33 -3
  58. package/src/lib/app-utils/lockdown.js.map +1 -1
  59. package/src/lib/app-utils/member-email-aliases.d.ts +25 -0
  60. package/src/lib/app-utils/member-email-aliases.js +29 -0
  61. package/src/lib/app-utils/member-email-aliases.js.map +1 -1
  62. package/src/lib/app-utils/notifications.d.ts +69 -0
  63. package/src/lib/app-utils/notifications.js +119 -0
  64. package/src/lib/app-utils/notifications.js.map +1 -1
  65. package/src/lib/app-utils/operator-alerts.d.ts +15 -1
  66. package/src/lib/app-utils/operator-alerts.js +64 -10
  67. package/src/lib/app-utils/operator-alerts.js.map +1 -1
  68. package/src/lib/app-utils/plan-entitlements.d.ts +164 -178
  69. package/src/lib/app-utils/plan-entitlements.js +200 -224
  70. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  71. package/src/lib/app-utils/platform-marketing-consent.d.ts +56 -2
  72. package/src/lib/app-utils/platform-marketing-consent.js +6 -5
  73. package/src/lib/app-utils/platform-marketing-consent.js.map +1 -1
  74. package/src/lib/app-utils/plugin-starter-templates.generated.d.ts +12 -0
  75. package/src/lib/app-utils/plugin-starter-templates.generated.js +711 -0
  76. package/src/lib/app-utils/plugin-starter-templates.generated.js.map +1 -0
  77. package/src/lib/app-utils/repeat-query.d.ts +56 -0
  78. package/src/lib/app-utils/{dataset-query.js → repeat-query.js} +16 -16
  79. package/src/lib/app-utils/repeat-query.js.map +1 -0
  80. package/src/lib/app-utils/screen-link-context-value.d.ts +7 -0
  81. package/src/lib/app-utils/screen-link-context-value.js.map +1 -1
  82. package/src/lib/app-utils/screen-link-context.js +14 -2
  83. package/src/lib/app-utils/screen-link-context.js.map +1 -1
  84. package/src/lib/app-utils/screen-route.d.ts +3 -0
  85. package/src/lib/app-utils/screen-route.js +6 -1
  86. package/src/lib/app-utils/screen-route.js.map +1 -1
  87. package/src/lib/app-utils/server.d.ts +7 -9
  88. package/src/lib/app-utils/server.js +18 -26
  89. package/src/lib/app-utils/server.js.map +1 -1
  90. package/src/lib/app-utils/starter-template-nodes.d.ts +137 -0
  91. package/src/lib/app-utils/starter-template-nodes.js +129 -0
  92. package/src/lib/app-utils/starter-template-nodes.js.map +1 -0
  93. package/src/lib/app-utils/starter-templates.d.ts +11 -34
  94. package/src/lib/app-utils/starter-templates.js +19 -230
  95. package/src/lib/app-utils/starter-templates.js.map +1 -1
  96. package/src/lib/app-utils/{email-topics.d.ts → subscription-topics.d.ts} +64 -48
  97. package/src/lib/app-utils/{email-topics.js → subscription-topics.js} +39 -109
  98. package/src/lib/app-utils/subscription-topics.js.map +1 -0
  99. package/src/lib/app-utils/usage-budget.d.ts +73 -188
  100. package/src/lib/app-utils/usage-budget.js +58 -194
  101. package/src/lib/app-utils/usage-budget.js.map +1 -1
  102. package/src/lib/app-utils/utm-attribution.d.ts +1 -1
  103. package/src/lib/app-utils/utm-attribution.js +1 -1
  104. package/src/lib/app-utils/utm-attribution.js.map +1 -1
  105. package/src/lib/app-utils/{campaign-touch.d.ts → utm-touch.d.ts} +21 -13
  106. package/src/lib/app-utils/{campaign-touch.js → utm-touch.js} +30 -22
  107. package/src/lib/app-utils/utm-touch.js.map +1 -0
  108. package/src/lib/app-utils/variables.d.ts +9 -9
  109. package/src/lib/app-utils/variables.js.map +1 -1
  110. package/src/lib/app-utils/visitor-record-ceiling.d.ts +32 -0
  111. package/src/lib/app-utils/visitor-record-ceiling.js +39 -0
  112. package/src/lib/app-utils/visitor-record-ceiling.js.map +1 -1
  113. package/src/lib/foundation/definitions/org-billing.types.d.ts +2 -2
  114. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  115. package/src/lib/plugin-manager/feature-plugins.d.ts +80 -79
  116. package/src/lib/plugin-manager/feature-plugins.js +22 -35
  117. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  118. package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +18 -1
  119. package/src/lib/plugin-manager/first-party-plugins.generated.js +62 -2
  120. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  121. package/src/lib/plugin-manager/index.d.ts +0 -1
  122. package/src/lib/plugin-manager/index.js +0 -1
  123. package/src/lib/plugin-manager/index.js.map +1 -1
  124. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +9 -4
  125. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
  126. package/src/lib/plugin-manager/plugin-containers.d.ts +68 -0
  127. package/src/lib/plugin-manager/plugin-containers.generated.d.ts +10 -0
  128. package/src/lib/plugin-manager/plugin-containers.generated.js +20 -0
  129. package/src/lib/plugin-manager/plugin-containers.generated.js.map +1 -0
  130. package/src/lib/plugin-manager/plugin-containers.js +27 -0
  131. package/src/lib/plugin-manager/plugin-containers.js.map +1 -0
  132. package/src/lib/plugin-manager/plugin-entitlements.d.ts +8 -0
  133. package/src/lib/plugin-manager/plugin-entitlements.js.map +1 -1
  134. package/src/lib/plugin-manager/plugin-membership-detach.js +1 -1
  135. package/src/lib/plugin-manager/plugin-membership-detach.js.map +1 -1
  136. package/src/lib/plugin-manager/plugin-record-email-state.d.ts +69 -0
  137. package/src/lib/plugin-manager/plugin-record-email-state.js +32 -0
  138. package/src/lib/plugin-manager/plugin-record-email-state.js.map +1 -1
  139. package/src/lib/plugin-manager/plugin-record-lists.d.ts +115 -0
  140. package/src/lib/plugin-manager/plugin-record-lists.js +75 -0
  141. package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -0
  142. package/src/lib/plugin-manager/plugin-record-timeline.d.ts +42 -8
  143. package/src/lib/plugin-manager/plugin-record-timeline.js.map +1 -1
  144. package/src/lib/plugin-manager/plugin-server-steps.d.ts +170 -0
  145. package/src/lib/plugin-manager/plugin-server-steps.js +116 -0
  146. package/src/lib/plugin-manager/plugin-server-steps.js.map +1 -0
  147. package/src/lib/plugin-manager/plugin-site-beacons.d.ts +71 -0
  148. package/src/lib/plugin-manager/plugin-site-beacons.js +54 -0
  149. package/src/lib/plugin-manager/plugin-site-beacons.js.map +1 -0
  150. package/src/lib/plugin-manager/plugin-subscription-topics.generated.d.ts +11 -0
  151. package/src/lib/plugin-manager/plugin-subscription-topics.generated.js +41 -0
  152. package/src/lib/plugin-manager/plugin-subscription-topics.generated.js.map +1 -0
  153. package/src/lib/plugin-manager/plugin-usage-axes.d.ts +212 -0
  154. package/src/lib/plugin-manager/plugin-usage-axes.js +82 -3
  155. package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
  156. package/src/lib/plugin-manager/plugin-usage-meters.d.ts +108 -0
  157. package/src/lib/plugin-manager/plugin-usage-meters.js +105 -0
  158. package/src/lib/plugin-manager/plugin-usage-meters.js.map +1 -0
  159. package/src/lib/plugin-manager/usage-alert-contributors.d.ts +76 -6
  160. package/src/lib/plugin-manager/usage-alert-contributors.js +23 -10
  161. package/src/lib/plugin-manager/usage-alert-contributors.js.map +1 -1
  162. package/src/lib/app-utils/assist-credits.d.ts +0 -482
  163. package/src/lib/app-utils/assist-credits.js +0 -510
  164. package/src/lib/app-utils/assist-credits.js.map +0 -1
  165. package/src/lib/app-utils/campaign-membership.d.ts +0 -121
  166. package/src/lib/app-utils/campaign-membership.js +0 -189
  167. package/src/lib/app-utils/campaign-membership.js.map +0 -1
  168. package/src/lib/app-utils/campaign-touch.js.map +0 -1
  169. package/src/lib/app-utils/console-record-links.d.ts +0 -84
  170. package/src/lib/app-utils/console-record-links.js +0 -76
  171. package/src/lib/app-utils/console-record-links.js.map +0 -1
  172. package/src/lib/app-utils/crm-booking.d.ts +0 -75
  173. package/src/lib/app-utils/crm-booking.js +0 -133
  174. package/src/lib/app-utils/crm-booking.js.map +0 -1
  175. package/src/lib/app-utils/crm-inbound.d.ts +0 -245
  176. package/src/lib/app-utils/crm-inbound.js +0 -407
  177. package/src/lib/app-utils/crm-inbound.js.map +0 -1
  178. package/src/lib/app-utils/crm-reports.d.ts +0 -479
  179. package/src/lib/app-utils/crm-reports.js +0 -680
  180. package/src/lib/app-utils/crm-reports.js.map +0 -1
  181. package/src/lib/app-utils/dataset-csv.js.map +0 -1
  182. package/src/lib/app-utils/dataset-query.d.ts +0 -57
  183. package/src/lib/app-utils/dataset-query.js.map +0 -1
  184. package/src/lib/app-utils/email-topics.js.map +0 -1
  185. package/src/lib/app-utils/list-assignment-policy.js.map +0 -1
  186. package/src/lib/plugin-manager/plugin-metered-lines.d.ts +0 -97
  187. package/src/lib/plugin-manager/plugin-metered-lines.js +0 -123
  188. package/src/lib/plugin-manager/plugin-metered-lines.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/starter-templates.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Leaf imports only, deliberately (AGL-687). This module is imported from\n// BOTH graphs — the console's client gallery renders virtual starters from\n// it, the console's seed route materializes them, and the AI plugin's server\n// shows them to a model — and neither barrel works in both: the full\n// `@aglyn/aglyn` barrel breaks the RSC/server-route graph, while the server\n// entry drags `node:fs` into the client bundle. The canvas constants are a\n// leaf with no imports of their own, and `screen-route` imports only a TYPE\n// from foundation, so both are safe on either side.\nimport { CANVAS_ROOT_ELEMENT_ID } from '../foundation/constants/canvas'\nimport { normalizeScreenSlug, SCREEN_ROOT_PATH } from './screen-route'\n\n/**\n * First-party starter definitions (AGL-78/79), SEED INPUT (AGL-687).\n *\n * These used to be rendered straight into the gallery and instantiated from\n * code, which made a starter a second kind of template: no version history,\n * no placeholders, no editor, changeable only by shipping a release. Now\n * they are seeded into each host's own template library as ordinary\n * `hosts/{hostId}/templates` documents (see the console's\n * `utils/server/seed-starter-templates.ts` for why copy-on-use rather than a\n * global read-only collection), and nothing reads this file at render time.\n *\n * They are also the page examples the AI plugin's template generator shows a\n * model (AGL-2909), which is why they live in the core package rather than\n * beside the console gallery that renders them.\n *\n * Node ids stay template-local (unique within each screen's version doc);\n * `createPageFromTemplate` re-keys screen and version ids at instantiation.\n *\n * PERSISTED IDENTIFIERS: `StarterTemplate.id`, `StarterTemplateScreen.key`\n * and every node id below appear in stored documents (seeded template doc\n * ids are derived from the first two). They must never be renamed.\n */\nexport interface StarterTemplateScreen {\n /**\n * Stable, starter-local key. Part of the seeded document id, so it is a\n * persisted identifier — never rename one.\n */\n key: string\n displayName: string\n description?: string\n /**\n * Routing-map slug. `SCREEN_ROOT_PATH` (`'/'`) asks for the site root — the\n * home page — and anything else is a single path segment.\n *\n * It used to be `''` that meant home, which no normalizer agreed with: both\n * the apply path and the seed below read an empty string as \"no address\n * authored\" and derived one from the display name, so the shop starters'\n * home page was published at `/home` and the site 404'd at its own URL\n * (AGL-1575).\n */\n slug: string\n seo?: { title?: string; description?: string }\n /** Flat node map including the canvas root. */\n nodes: Record<string, any>\n}\n\nexport interface StarterTemplate {\n id: string\n displayName: string\n description: string\n category: string\n screens: StarterTemplateScreen[]\n}\n\n/** A materialized starter template document, keyed by its deterministic id. */\nexport interface StarterTemplateDoc {\n id: string\n /** Which starter this page belongs to — lets one starter be selected. */\n starterId: string\n data: Record<string, unknown>\n}\n\n/**\n * Deterministic document id for a seeded starter screen (AGL-687).\n *\n * Derived from the starter id and the screen key — never randomly generated\n * — so re-running the seed addresses the same documents instead of stacking\n * duplicate copies of every starter on every run.\n */\nexport function starterTemplateDocId(\n starterId: string,\n screenKey: string,\n): string {\n return `starter-${starterId}-${screenKey}`\n}\n\n/**\n * Expands one starter into the template documents it seeds as.\n *\n * One page template per screen, matching what a marketplace install of a\n * multi-screen site template already produces (AGL-669) — the alternative,\n * a bespoke multi-page template shape, would be a third lifecycle on top of\n * the two this issue exists to merge. The bundle's name/description/order\n * ride `source` so the gallery can still present the starter as one card.\n */\nexport function buildStarterTemplateDocs(\n starter: StarterTemplate,\n): StarterTemplateDoc[] {\n return starter.screens.map((screen, index) => {\n // Normalized on the way into the document so the persisted address is in\n // the routing-map format the tenant matches against — in particular the\n // root, which the previous `screen.slug ? …` guard dropped entirely when\n // home was spelled `''` (AGL-1575). A slug that sanitizes away carries no\n // field, and the apply path derives one from the display name.\n const slug = normalizeScreenSlug(screen.slug)\n return {\n id: starterTemplateDocId(starter.id, screen.key),\n starterId: starter.id,\n data: {\n kind: 'page',\n displayName: screen.displayName,\n // Only the screen's own description, never the starter blurb: a\n // template's `description` is carried onto the page it creates, and a\n // screen description is the live site's meta-description fallback.\n // The bundle blurb lives on `source.starterDescription` instead.\n ...(screen.description ? { description: screen.description } : {}),\n category: starter.category,\n ...(slug ? { slug } : {}),\n ...(screen.seo ? { seo: screen.seo } : {}),\n nodes: screen.nodes,\n source: {\n type: 'starter',\n starterId: starter.id,\n starterName: starter.displayName,\n starterDescription: starter.description,\n starterOrder: index,\n },\n },\n }\n })\n}\n\n/** Every document a starter COULD materialize as, in bundle order. */\nexport function buildAllStarterTemplateDocs(): StarterTemplateDoc[] {\n return STARTER_TEMPLATES.flatMap(buildStarterTemplateDocs)\n}\n\ntype NodeSpec = {\n id: string\n componentId: string\n /** Bundle owning the component; defaults to 'mui' (AGL-300). */\n pluginId?: string\n props?: Record<string, unknown>\n /**\n * Node-level styles — a SIBLING of props, never `props.sx` (AGL-1346).\n *\n * Both records render (`Leaf` composes `(sx, props.sx, node.sx)`, later\n * wins), but the Styles panel edits `node.sx`. A starter that seeded its\n * styling into `props.sx` handed the author a document full of values\n * the panel could show but no click could change or clear.\n */\n sx?: Record<string, unknown>\n children?: NodeSpec[]\n}\n\n/** Builds the flat, persisted node map from a nested spec. */\nfunction buildNodes(children: NodeSpec[]): Record<string, any> {\n const map: Record<string, any> = {\n [CANVAS_ROOT_ELEMENT_ID]: {\n $id: CANVAS_ROOT_ELEMENT_ID,\n componentId: 'div',\n nodes: children.map((child) => child.id),\n },\n }\n const walk = (spec: NodeSpec, parentId: string) => {\n map[spec.id] = {\n $id: spec.id,\n componentId: spec.componentId,\n pluginId: spec.pluginId ?? 'mui',\n parentId,\n props: spec.props ?? {},\n ...(spec.sx ? { sx: spec.sx } : {}),\n nodes: (spec.children ?? []).map((child) => child.id),\n }\n for (const child of spec.children ?? []) walk(child, spec.id)\n }\n for (const child of children) walk(child, CANVAS_ROOT_ELEMENT_ID)\n return map\n}\n\nconst text = (\n id: string,\n variant: string,\n children: string,\n extra?: Record<string, unknown>,\n): NodeSpec => ({\n id,\n componentId: 'muiTypography',\n props: { variant, children, ...extra },\n})\n\n/**\n * The stock widths a starter band may be (AGL-1932, AGL-1298).\n *\n * Three cases, and only three, because the standard has three. There is no\n * pixel case: `1328` is a CONTENT width, not a breakpoint, and the ban on\n * bespoke numbers is the half of AGL-1298 these templates used to violate\n * four times over.\n */\ntype SectionWidth = 'md' | 'lg' | 'xl'\n\n/**\n * One page band: a `Container` at a stock width, carrying the band's own\n * vertical rhythm (AGL-1932).\n *\n * The layout standard (AGL-1298): every section is a Container. Full-bleed is\n * the Container's own full-width attribute, never the absence of a Container,\n * and anything else is one of three stock widths. A template that seeds no\n * Container hands every customer a site that starts outside the standard.\n *\n * How the three widths are chosen here, stated so the next audit does not\n * have to guess:\n *\n * - `xl` — a marketing band: hero, feature row, product grid, gallery. The\n * default width, and what an unremarkable page should be.\n * - `lg` — the deliberate middle case: wide but text-led and interactive.\n * Cart and account are the honest instances, not decoration.\n * - `md` — long-form prose and narrow form columns, on READING grounds: at\n * `xl` a paragraph runs 110–120 characters a line. This is the case the\n * `Prose Container` preset exists for.\n *\n * Horizontal padding is the Container's own gutters, so bands no longer carry\n * horizontal padding at all. Only the vertical rhythm rides here, which is\n * rhythm rather than width.\n *\n * Written as the two longhands rather than MUI's `py` (AGL-2207/2208): the\n * Styles panel's Padding control is named for the four sides, so a band\n * seeded with `py` handed the customer a document whose padding the panel\n * showed as empty and no click could clear.\n */\nconst section = (\n id: string,\n maxWidth: SectionWidth,\n verticalPadding: number,\n children: NodeSpec[],\n): NodeSpec => ({\n id,\n componentId: 'muiContainer',\n props: { maxWidth },\n sx: { paddingTop: verticalPadding, paddingBottom: verticalPadding },\n children,\n})\n\nconst heroSection = (prefix: string, headline: string, tagline: string) =>\n // The Container is a NEW node (`…heroSection`); `…hero` keeps its id and\n // stays the Stack. Node ids here are persisted identifiers, so bands are\n // wrapped rather than re-pointed.\n section(`${prefix}heroSection`, 'xl', 10, [\n {\n id: `${prefix}hero`,\n componentId: 'muiStack',\n props: { spacing: 2 },\n sx: { alignItems: 'center' },\n children: [\n text(`${prefix}heroTitle`, 'h2', headline, { align: 'center' }),\n text(`${prefix}heroSub`, 'h6', tagline, { align: 'center' }),\n {\n id: `${prefix}heroCta`,\n componentId: 'muiButton',\n props: {\n variant: 'contained',\n size: 'large',\n children: 'Get in touch',\n },\n },\n ],\n },\n ])\n\nconst featureColumn = (id: string, title: string, body: string): NodeSpec => ({\n id,\n componentId: 'muiStack',\n props: { spacing: 1 },\n // `flex: 1` is a column's share of its row, not a width cap — it survives\n // the sweep deliberately. Only `maxWidth` in raw pixels was the violation.\n sx: {\n flex: 1,\n paddingTop: 2,\n paddingRight: 2,\n paddingBottom: 2,\n paddingLeft: 2,\n },\n children: [text(`${id}T`, 'h5', title), text(`${id}B`, 'body1', body)],\n})\n\nconst contactForm = (prefix: string): NodeSpec => ({\n id: `${prefix}form`,\n componentId: 'form',\n props: {\n formName: 'Contact',\n submitLabel: 'Send message',\n successMessage: 'Thanks — we will get back to you soon.',\n },\n children: [\n {\n id: `${prefix}fName`,\n componentId: 'formField',\n props: { fieldName: 'name', label: 'Name', required: true },\n },\n {\n id: `${prefix}fEmail`,\n componentId: 'formField',\n props: {\n fieldName: 'email',\n label: 'Email',\n fieldType: 'email',\n required: true,\n },\n },\n {\n id: `${prefix}fMessage`,\n componentId: 'formField',\n props: {\n fieldName: 'message',\n label: 'Message',\n fieldType: 'textarea',\n required: true,\n },\n },\n ],\n})\n\n\nconst commerceBlock = (\n id: string,\n componentId: string,\n props?: Record<string, unknown>,\n): NodeSpec => ({ id, componentId, pluginId: 'commerce', props })\n\n/** Shared screens for the shop starters (AGL-300). */\nfunction shopScreens(prefix: string, digital: boolean): StarterTemplateScreen[] {\n return [\n {\n key: 'home',\n displayName: 'Home',\n // The site root, spelled the way the routing map spells it. `''` here\n // read as \"no address\" everywhere downstream and put the shop's home\n // page at `/home` (AGL-1575).\n slug: SCREEN_ROOT_PATH,\n seo: {\n title: digital ? 'Digital shop' : 'Shop',\n description: 'Browse our products.',\n },\n nodes: buildNodes([\n heroSection(\n `${prefix}h_`,\n digital ? 'Downloads that level you up' : 'Gear you can trust',\n digital\n ? 'Instant delivery. Lifetime updates.'\n : 'Quality parts, shipped fast.',\n ),\n section(`${prefix}h_gridSection`, 'xl', 6, [\n commerceBlock(`${prefix}h_grid`, 'product-grid', {\n source: 'all',\n sort: 'newest',\n columns: 3,\n maxItems: 6,\n }),\n ]),\n // A newsletter capture is a short text-led band, not a gallery.\n section(`${prefix}h_newsSection`, 'md', 6, [\n commerceBlock(`${prefix}h_news`, 'newsletter-signup', {\n heading: 'Get updates and offers',\n }),\n ]),\n ]),\n },\n {\n key: 'shop',\n displayName: 'Shop',\n slug: 'shop',\n seo: { title: 'All products' },\n nodes: buildNodes([\n section(`${prefix}s_section`, 'xl', 6, [\n text(`${prefix}s_title`, 'h3', 'All products'),\n commerceBlock(`${prefix}s_grid`, 'product-grid', {\n source: 'all',\n columns: 4,\n showFilters: true,\n }),\n ]),\n ]),\n },\n {\n key: 'product',\n displayName: 'Product page',\n slug: 'product',\n seo: { title: 'Product' },\n nodes: buildNodes([\n section(`${prefix}p_section`, 'xl', 6, [\n commerceBlock(`${prefix}p_detail`, 'product-detail', {}),\n ]),\n ]),\n },\n {\n key: 'cart',\n displayName: 'Cart',\n slug: 'cart',\n seo: { title: 'Your cart' },\n // LG, the deliberate middle case: a cart is a wide table but it is read\n // line by line, so a full XL band spreads it further than the eye\n // tracks. Same for the account screen below.\n nodes: buildNodes([\n section(`${prefix}c_section`, 'lg', 6, [\n text(`${prefix}c_title`, 'h3', 'Your cart'),\n commerceBlock(`${prefix}c_cart`, 'cart', {\n variant: 'inline',\n showCoupon: true,\n }),\n ]),\n ]),\n },\n {\n key: 'account',\n displayName: 'Account',\n slug: 'account',\n seo: { title: 'Your account' },\n nodes: buildNodes([\n section(`${prefix}a_section`, 'lg', 6, [\n commerceBlock(`${prefix}a_account`, 'customer-account', {\n signedOutHeading: 'Your account',\n }),\n ]),\n ]),\n },\n ]\n}\n\n/**\n * The home page every new site is born with (AGL-3408).\n *\n * A site used to be created with an empty routing map, so the address the\n * create dialog calls live answered with the tenant's 404 until somebody\n * built and published a page. `claimHostForOrg` now writes this screen, its\n * first version and its `/` route in the same transaction that creates the\n * host, which makes \"a site with no home page\" a state no new site starts in.\n *\n * It is PUBLIC from the first request, so the copy speaks to a visitor, never\n * to the owner — no \"edit this in the besigner\". The site's name is written in\n * as text, not bound: there is no page-content token for it, and a heading\n * that followed a rename is not worth one.\n *\n * Deliberately not a starter: it is not offered in the gallery, and applying a\n * starter may take the root back from it (see `defaultHomeScreenId`).\n *\n * PERSISTED IDENTIFIERS: every node id below is stored on every new site.\n */\nexport function buildDefaultHomeScreen(siteName: string): StarterTemplateScreen {\n const name = siteName.trim() || 'Welcome'\n return {\n key: 'home',\n displayName: 'Home',\n slug: SCREEN_ROOT_PATH,\n nodes: buildNodes([\n section('dh_heroSection', 'md', 12, [\n {\n id: 'dh_hero',\n componentId: 'muiStack',\n props: { spacing: 2 },\n sx: { alignItems: 'center' },\n children: [\n text('dh_heroTitle', 'h2', name, { align: 'center' }),\n text(\n 'dh_heroSub',\n 'h6',\n 'Welcome — our new website is on its way.',\n { align: 'center', color: 'text.secondary' },\n ),\n ],\n },\n ]),\n ]),\n }\n}\n\nexport const STARTER_TEMPLATES: StarterTemplate[] = [\n {\n id: 'landing',\n displayName: 'Landing Page',\n description:\n 'One-page launch site: hero, three selling points, and a contact form.',\n category: 'Marketing',\n screens: [\n {\n key: 'landing',\n displayName: 'Landing',\n slug: 'landing',\n seo: {\n title: 'Welcome',\n description: 'Everything you need to know, on one page.',\n },\n nodes: buildNodes([\n heroSection(\n 'l_',\n 'A headline that sells your idea',\n 'One clear sentence about the value you deliver.',\n ),\n section('l_featuresSection', 'xl', 6, [\n {\n id: 'l_features',\n componentId: 'muiStack',\n props: { direction: 'row', spacing: 2 },\n children: [\n featureColumn(\n 'l_f1',\n 'Fast',\n 'Explain the first reason customers pick you.',\n ),\n featureColumn(\n 'l_f2',\n 'Simple',\n 'Explain the second reason customers pick you.',\n ),\n featureColumn(\n 'l_f3',\n 'Reliable',\n 'Explain the third reason customers pick you.',\n ),\n ],\n },\n ]),\n // Was `maxWidth: 560`. A band, not an inner measure: it sat at the\n // top level carrying the section's own gutters and rhythm, so the\n // pixel value was capping the BAND. MD is the stock width for a\n // narrow, form-led column.\n section('l_contactSection', 'md', 6, [\n {\n id: 'l_contact',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('l_contactTitle', 'h4', 'Get in touch'),\n contactForm('l_'),\n ],\n },\n ]),\n ]),\n },\n ],\n },\n {\n id: 'business',\n displayName: 'Business',\n description:\n 'Company site: home with services, an about page, and a contact page.',\n category: 'Business',\n screens: [\n {\n key: 'home',\n displayName: 'Business Home',\n slug: 'home',\n seo: { title: 'Home' },\n nodes: buildNodes([\n heroSection(\n 'b_',\n 'Your business, done right',\n 'Tell visitors what you do and who you do it for.',\n ),\n section('b_servicesSection', 'xl', 6, [\n {\n id: 'b_services',\n componentId: 'muiStack',\n props: { direction: 'row', spacing: 2 },\n children: [\n featureColumn('b_s1', 'Service one', 'Describe this service.'),\n featureColumn('b_s2', 'Service two', 'Describe this service.'),\n featureColumn(\n 'b_s3',\n 'Service three',\n 'Describe this service.',\n ),\n ],\n },\n ]),\n ]),\n },\n {\n key: 'about-us',\n displayName: 'About Us',\n slug: 'about-us',\n seo: { title: 'About us' },\n nodes: buildNodes([\n // Was `maxWidth: 720` — the one unambiguous PROSE band in the set,\n // and the case the Prose Container preset exists for. MD (900px)\n // lands near the 65–75 characters a line that reads comfortably.\n section('a_wrapSection', 'md', 8, [\n {\n id: 'a_wrap',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('a_title', 'h3', 'About us'),\n text(\n 'a_body',\n 'body1',\n 'Share your story: how you started, what you believe, and ' +\n 'why customers trust you.',\n ),\n ],\n },\n ]),\n ]),\n },\n {\n key: 'contact-us',\n displayName: 'Contact Us',\n slug: 'contact-us',\n seo: { title: 'Contact' },\n nodes: buildNodes([\n // Was `maxWidth: 560`. Same reading as the landing page's contact\n // band: text plus a form column, so MD.\n section('c_wrapSection', 'md', 8, [\n {\n id: 'c_wrap',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('c_title', 'h3', 'Contact us'),\n text(\n 'c_body',\n 'body1',\n 'Questions or quotes — send a message and we reply within ' +\n 'one business day.',\n ),\n contactForm('c_'),\n ],\n },\n ]),\n ]),\n },\n ],\n },\n {\n id: 'portfolio',\n displayName: 'Portfolio',\n description: 'Personal portfolio: intro, work grid, and contact form.',\n category: 'Personal',\n screens: [\n {\n key: 'portfolio',\n displayName: 'Portfolio',\n slug: 'portfolio',\n seo: { title: 'Portfolio' },\n nodes: buildNodes([\n heroSection(\n 'p_',\n 'Hi, I make things',\n 'Designer / developer / photographer — introduce yourself here.',\n ),\n section('p_gridSection', 'xl', 6, [\n {\n id: 'p_grid',\n componentId: 'muiStack',\n props: { direction: 'row', spacing: 2 },\n children: [\n {\n id: 'p_img1',\n componentId: 'image',\n // `height` is an image's own intrinsic sizing prop, not a\n // band cap — out of scope for the container standard.\n props: { alt: 'Project one', height: '220px' },\n },\n {\n id: 'p_img2',\n componentId: 'image',\n props: { alt: 'Project two', height: '220px' },\n },\n {\n id: 'p_img3',\n componentId: 'image',\n props: { alt: 'Project three', height: '220px' },\n },\n ],\n },\n ]),\n // Was `maxWidth: 560`, the third of the three contact bands.\n section('p_contactSection', 'md', 6, [\n {\n id: 'p_contact',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('p_contactTitle', 'h4', 'Work with me'),\n contactForm('p_'),\n ],\n },\n ]),\n ]),\n },\n ],\n },\n {\n id: 'physical-shop',\n displayName: 'Shop (physical products)',\n description:\n 'Storefront starter: home with featured products, filterable shop, ' +\n 'product page, cart, and customer accounts. After applying, set the ' +\n 'Product page as the product template in Store settings.',\n category: 'Commerce',\n screens: shopScreens('ps_', false),\n },\n {\n id: 'digital-shop',\n displayName: 'Shop (digital products)',\n description:\n 'Digital storefront starter: downloads-focused home, shop, product ' +\n 'page, cart, and accounts with a newsletter capture. Set the Product ' +\n 'page as the product template in Store settings after applying.',\n category: 'Commerce',\n screens: shopScreens('ds_', true),\n },\n]\n"],"names":["CANVAS_ROOT_ELEMENT_ID","normalizeScreenSlug","SCREEN_ROOT_PATH","starterTemplateDocId","starterId","screenKey","buildStarterTemplateDocs","starter","screens","map","screen","index","slug","id","key","data","kind","displayName","description","category","seo","nodes","source","type","starterName","starterDescription","starterOrder","buildAllStarterTemplateDocs","STARTER_TEMPLATES","flatMap","buildNodes","children","$id","componentId","child","walk","spec","parentId","pluginId","props","sx","text","variant","extra","section","maxWidth","verticalPadding","paddingTop","paddingBottom","heroSection","prefix","headline","tagline","spacing","alignItems","align","size","featureColumn","title","body","flex","paddingRight","paddingLeft","contactForm","formName","submitLabel","successMessage","fieldName","label","required","fieldType","commerceBlock","shopScreens","digital","sort","columns","maxItems","heading","showFilters","showCoupon","signedOutHeading","buildDefaultHomeScreen","siteName","name","trim","color","direction","alt","height"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,qEAAqE;AACrE,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,oDAAoD;AACpD,SAASA,sBAAsB,QAAQ,oCAAgC;AACvE,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,oBAAgB;AAgEtE;;;;;;CAMC,GACD,OAAO,SAASC,qBACdC,SAAiB,EACjBC,SAAiB;IAEjB,OAAO,CAAC,QAAQ,EAAED,UAAU,CAAC,EAAEC,WAAW;AAC5C;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASC,yBACdC,OAAwB;IAExB,OAAOA,QAAQC,OAAO,CAACC,GAAG,CAAC,CAACC,QAAQC;QAClC,yEAAyE;QACzE,wEAAw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JoB,aAAa;4BACbM,OAAO;gCAAEc,SAAS;4BAAE;4BACpBtB,UAAU;gCACRU,KAAK,kBAAkB,MAAM;gCAC7BsB,YAAY;6BACb;wBACH;qBACD;iBACF;YACH;SACD;IACH;IACA;QACElD,IAAI;QACJI,aAAa;QACbC,aACE,uEACA,wEACA;QACFC,UAAU;QACVX,SAASgE,YAAY,OAAO;IAC9B;IACA;QACE3D,IAAI;QACJI,aAAa;QACbC,aACE,uEACA,yEACA;QACFC,UAAU;QACVX,SAASgE,YAAY,OAAO;IAC9B;CACD,CAAA"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/starter-templates.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Leaf imports only, deliberately (AGL-687). This module is imported from\n// BOTH graphs — the console's client gallery renders virtual starters from\n// it, the console's seed route materializes them, and the AI plugin's server\n// shows them to a model — and neither barrel works in both: the full\n// `@aglyn/aglyn` barrel breaks the RSC/server-route graph, while the server\n// entry drags `node:fs` into the client bundle. The starter kit imports only\n// the canvas constants, a leaf with no imports of their own; the compiled\n// plugin starters are data behind a type-only import; and `screen-route`\n// imports only a TYPE from foundation — so all three are safe on either side.\nimport { PLUGIN_STARTER_TEMPLATES } from './plugin-starter-templates.generated'\nimport { normalizeScreenSlug, SCREEN_ROOT_PATH } from './screen-route'\nimport {\n buildStarterNodes as buildNodes,\n starterHeroSection as heroSection,\n starterSection as section,\n starterText as text,\n type StarterNodeSpec as NodeSpec,\n type StarterTemplate,\n type StarterTemplateScreen,\n} from './starter-template-nodes'\n\nexport type {\n StarterNodeSpec,\n StarterSectionWidth,\n StarterTemplate,\n StarterTemplateScreen,\n} from './starter-template-nodes'\nexport {\n buildStarterNodes,\n starterHeroSection,\n starterSection,\n starterText,\n} from './starter-template-nodes'\n\n/**\n * First-party starter definitions (AGL-78/79), SEED INPUT (AGL-687).\n *\n * These used to be rendered straight into the gallery and instantiated from\n * code, which made a starter a second kind of template: no version history,\n * no placeholders, no editor, changeable only by shipping a release. Now\n * they are seeded into each host's own template library as ordinary\n * `hosts/{hostId}/templates` documents (see the console's\n * `utils/server/seed-starter-templates.ts` for why copy-on-use rather than a\n * global read-only collection), and nothing reads this file at render time.\n *\n * They are also the page examples the AI plugin's template generator shows a\n * model (AGL-2909), which is why they live in the core package rather than\n * beside the console gallery that renders them.\n *\n * Node ids stay template-local (unique within each screen's version doc);\n * `createPageFromTemplate` re-keys screen and version ids at instantiation.\n *\n * PERSISTED IDENTIFIERS: `StarterTemplate.id`, `StarterTemplateScreen.key`\n * and every node id below appear in stored documents (seeded template doc\n * ids are derived from the first two). They must never be renamed.\n */\nexport interface StarterTemplateDoc {\n id: string\n /** Which starter this page belongs to — lets one starter be selected. */\n starterId: string\n data: Record<string, unknown>\n}\n\n/**\n * Deterministic document id for a seeded starter screen (AGL-687).\n *\n * Derived from the starter id and the screen key — never randomly generated\n * — so re-running the seed addresses the same documents instead of stacking\n * duplicate copies of every starter on every run.\n */\nexport function starterTemplateDocId(\n starterId: string,\n screenKey: string,\n): string {\n return `starter-${starterId}-${screenKey}`\n}\n\n/**\n * Expands one starter into the template documents it seeds as.\n *\n * One page template per screen, matching what a marketplace install of a\n * multi-screen site template already produces (AGL-669) — the alternative,\n * a bespoke multi-page template shape, would be a third lifecycle on top of\n * the two this issue exists to merge. The bundle's name/description/order\n * ride `source` so the gallery can still present the starter as one card.\n */\nexport function buildStarterTemplateDocs(\n starter: StarterTemplate,\n): StarterTemplateDoc[] {\n return starter.screens.map((screen, index) => {\n // Normalized on the way into the document so the persisted address is in\n // the routing-map format the tenant matches against — in particular the\n // root, which the previous `screen.slug ? …` guard dropped entirely when\n // home was spelled `''` (AGL-1575). A slug that sanitizes away carries no\n // field, and the apply path derives one from the display name.\n const slug = normalizeScreenSlug(screen.slug)\n return {\n id: starterTemplateDocId(starter.id, screen.key),\n starterId: starter.id,\n data: {\n kind: 'page',\n displayName: screen.displayName,\n // Only the screen's own description, never the starter blurb: a\n // template's `description` is carried onto the page it creates, and a\n // screen description is the live site's meta-description fallback.\n // The bundle blurb lives on `source.starterDescription` instead.\n ...(screen.description ? { description: screen.description } : {}),\n category: starter.category,\n ...(slug ? { slug } : {}),\n ...(screen.seo ? { seo: screen.seo } : {}),\n nodes: screen.nodes,\n source: {\n type: 'starter',\n starterId: starter.id,\n starterName: starter.displayName,\n starterDescription: starter.description,\n starterOrder: index,\n },\n },\n }\n })\n}\n\n/** Every document a starter COULD materialize as, in bundle order. */\nexport function buildAllStarterTemplateDocs(): StarterTemplateDoc[] {\n return STARTER_TEMPLATES.flatMap(buildStarterTemplateDocs)\n}\n\nconst featureColumn = (id: string, title: string, body: string): NodeSpec => ({\n id,\n componentId: 'muiStack',\n props: { spacing: 1 },\n // `flex: 1` is a column's share of its row, not a width cap — it survives\n // the sweep deliberately. Only `maxWidth` in raw pixels was the violation.\n sx: {\n flex: 1,\n paddingTop: 2,\n paddingRight: 2,\n paddingBottom: 2,\n paddingLeft: 2,\n },\n children: [text(`${id}T`, 'h5', title), text(`${id}B`, 'body1', body)],\n})\n\nconst contactForm = (prefix: string): NodeSpec => ({\n id: `${prefix}form`,\n componentId: 'form',\n props: {\n formName: 'Contact',\n submitLabel: 'Send message',\n successMessage: 'Thanks — we will get back to you soon.',\n },\n children: [\n {\n id: `${prefix}fName`,\n componentId: 'formField',\n props: { fieldName: 'name', label: 'Name', required: true },\n },\n {\n id: `${prefix}fEmail`,\n componentId: 'formField',\n props: {\n fieldName: 'email',\n label: 'Email',\n fieldType: 'email',\n required: true,\n },\n },\n {\n id: `${prefix}fMessage`,\n componentId: 'formField',\n props: {\n fieldName: 'message',\n label: 'Message',\n fieldType: 'textarea',\n required: true,\n },\n },\n ],\n})\n\n\n/**\n * The home page every new site is born with (AGL-3408).\n *\n * A site used to be created with an empty routing map, so the address the\n * create dialog calls live answered with the tenant's 404 until somebody\n * built and published a page. `claimHostForOrg` now writes this screen, its\n * first version and its `/` route in the same transaction that creates the\n * host, which makes \"a site with no home page\" a state no new site starts in.\n *\n * It is PUBLIC from the first request, so the copy speaks to a visitor, never\n * to the owner — no \"edit this in the besigner\". The site's name is written in\n * as text, not bound: there is no page-content token for it, and a heading\n * that followed a rename is not worth one.\n *\n * Deliberately not a starter: it is not offered in the gallery, and applying a\n * starter may take the root back from it (see `defaultHomeScreenId`).\n *\n * PERSISTED IDENTIFIERS: every node id below is stored on every new site.\n */\nexport function buildDefaultHomeScreen(siteName: string): StarterTemplateScreen {\n const name = siteName.trim() || 'Welcome'\n return {\n key: 'home',\n displayName: 'Home',\n slug: SCREEN_ROOT_PATH,\n nodes: buildNodes([\n section('dh_heroSection', 'md', 12, [\n {\n id: 'dh_hero',\n componentId: 'muiStack',\n props: { spacing: 2 },\n sx: { alignItems: 'center' },\n children: [\n text('dh_heroTitle', 'h2', name, { align: 'center' }),\n text(\n 'dh_heroSub',\n 'h6',\n 'Welcome — our new website is on its way.',\n { align: 'center', color: 'text.secondary' },\n ),\n ],\n },\n ]),\n ]),\n }\n}\n\n/** The platform's own starters, which name no plugin's elements. */\nconst PLATFORM_STARTER_TEMPLATES: StarterTemplate[] = [\n {\n id: 'landing',\n displayName: 'Landing Page',\n description:\n 'One-page launch site: hero, three selling points, and a contact form.',\n category: 'Marketing',\n screens: [\n {\n key: 'landing',\n displayName: 'Landing',\n slug: 'landing',\n seo: {\n title: 'Welcome',\n description: 'Everything you need to know, on one page.',\n },\n nodes: buildNodes([\n heroSection(\n 'l_',\n 'A headline that sells your idea',\n 'One clear sentence about the value you deliver.',\n ),\n section('l_featuresSection', 'xl', 6, [\n {\n id: 'l_features',\n componentId: 'muiStack',\n props: { direction: 'row', spacing: 2 },\n children: [\n featureColumn(\n 'l_f1',\n 'Fast',\n 'Explain the first reason customers pick you.',\n ),\n featureColumn(\n 'l_f2',\n 'Simple',\n 'Explain the second reason customers pick you.',\n ),\n featureColumn(\n 'l_f3',\n 'Reliable',\n 'Explain the third reason customers pick you.',\n ),\n ],\n },\n ]),\n // Was `maxWidth: 560`. A band, not an inner measure: it sat at the\n // top level carrying the section's own gutters and rhythm, so the\n // pixel value was capping the BAND. MD is the stock width for a\n // narrow, form-led column.\n section('l_contactSection', 'md', 6, [\n {\n id: 'l_contact',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('l_contactTitle', 'h4', 'Get in touch'),\n contactForm('l_'),\n ],\n },\n ]),\n ]),\n },\n ],\n },\n {\n id: 'business',\n displayName: 'Business',\n description:\n 'Company site: home with services, an about page, and a contact page.',\n category: 'Business',\n screens: [\n {\n key: 'home',\n displayName: 'Business Home',\n slug: 'home',\n seo: { title: 'Home' },\n nodes: buildNodes([\n heroSection(\n 'b_',\n 'Your business, done right',\n 'Tell visitors what you do and who you do it for.',\n ),\n section('b_servicesSection', 'xl', 6, [\n {\n id: 'b_services',\n componentId: 'muiStack',\n props: { direction: 'row', spacing: 2 },\n children: [\n featureColumn('b_s1', 'Service one', 'Describe this service.'),\n featureColumn('b_s2', 'Service two', 'Describe this service.'),\n featureColumn(\n 'b_s3',\n 'Service three',\n 'Describe this service.',\n ),\n ],\n },\n ]),\n ]),\n },\n {\n key: 'about-us',\n displayName: 'About Us',\n slug: 'about-us',\n seo: { title: 'About us' },\n nodes: buildNodes([\n // Was `maxWidth: 720` — the one unambiguous PROSE band in the set,\n // and the case the Prose Container preset exists for. MD (900px)\n // lands near the 65–75 characters a line that reads comfortably.\n section('a_wrapSection', 'md', 8, [\n {\n id: 'a_wrap',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('a_title', 'h3', 'About us'),\n text(\n 'a_body',\n 'body1',\n 'Share your story: how you started, what you believe, and ' +\n 'why customers trust you.',\n ),\n ],\n },\n ]),\n ]),\n },\n {\n key: 'contact-us',\n displayName: 'Contact Us',\n slug: 'contact-us',\n seo: { title: 'Contact' },\n nodes: buildNodes([\n // Was `maxWidth: 560`. Same reading as the landing page's contact\n // band: text plus a form column, so MD.\n section('c_wrapSection', 'md', 8, [\n {\n id: 'c_wrap',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('c_title', 'h3', 'Contact us'),\n text(\n 'c_body',\n 'body1',\n 'Questions or quotes — send a message and we reply within ' +\n 'one business day.',\n ),\n contactForm('c_'),\n ],\n },\n ]),\n ]),\n },\n ],\n },\n {\n id: 'portfolio',\n displayName: 'Portfolio',\n description: 'Personal portfolio: intro, work grid, and contact form.',\n category: 'Personal',\n screens: [\n {\n key: 'portfolio',\n displayName: 'Portfolio',\n slug: 'portfolio',\n seo: { title: 'Portfolio' },\n nodes: buildNodes([\n heroSection(\n 'p_',\n 'Hi, I make things',\n 'Designer / developer / photographer — introduce yourself here.',\n ),\n section('p_gridSection', 'xl', 6, [\n {\n id: 'p_grid',\n componentId: 'muiStack',\n props: { direction: 'row', spacing: 2 },\n children: [\n {\n id: 'p_img1',\n componentId: 'image',\n // `height` is an image's own intrinsic sizing prop, not a\n // band cap — out of scope for the container standard.\n props: { alt: 'Project one', height: '220px' },\n },\n {\n id: 'p_img2',\n componentId: 'image',\n props: { alt: 'Project two', height: '220px' },\n },\n {\n id: 'p_img3',\n componentId: 'image',\n props: { alt: 'Project three', height: '220px' },\n },\n ],\n },\n ]),\n // Was `maxWidth: 560`, the third of the three contact bands.\n section('p_contactSection', 'md', 6, [\n {\n id: 'p_contact',\n componentId: 'muiStack',\n props: { spacing: 2 },\n children: [\n text('p_contactTitle', 'h4', 'Work with me'),\n contactForm('p_'),\n ],\n },\n ]),\n ]),\n },\n ],\n },\n]\n\n/**\n * Every starter in this build, in gallery order: the platform's own, then\n * each plugin's in config order (AGL-3080). A plugin whose elements a starter\n * is built around — a storefront's product grid and cart — declares it under\n * `starterTemplates` in plugins.config.json, and the manifest generator\n * compiles what it returns, so the gallery, the seed route and a model\n * shown examples all read one list without loading any plugin.\n */\nexport const STARTER_TEMPLATES: StarterTemplate[] = [\n ...PLATFORM_STARTER_TEMPLATES,\n ...PLUGIN_STARTER_TEMPLATES,\n]\n"],"names":["PLUGIN_STARTER_TEMPLATES","normalizeScreenSlug","SCREEN_ROOT_PATH","buildStarterNodes","buildNodes","starterHeroSection","heroSection","starterSection","section","starterText","text","starterTemplateDocId","starterId","screenKey","buildStarterTemplateDocs","starter","screens","map","screen","index","slug","id","key","data","kind","displayName","description","category","seo","nodes","source","type","starterName","starterDescription","starterOrder","buildAllStarterTemplateDocs","STARTER_TEMPLATES","flatMap","featureColumn","title","body","componentId","props","spacing","sx","flex","paddingTop","paddingRight","paddingBottom","paddingLeft","children","contactForm","prefix","formName","submitLabel","successMessage","fieldName","label","required","fieldType","buildDefaultHomeScreen","siteName","name","trim","alignItems","align","color","PLATFORM_STARTER_TEMPLATES","direction","alt","height"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,qEAAqE;AACrE,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,yEAAyE;AACzE,8EAA8E;AAC9E,SAASA,wBAAwB,QAAQ,0CAAsC;AAC/E,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,oBAAgB;AACtE,SACEC,qBAAqBC,UAAU,EAC/BC,sBAAsBC,WAAW,EACjCC,kBAAkBC,OAAO,EACzBC,eAAeC,IAAI,QAId,8BAA0B;AAQjC,SACEP,iBAAiB,EACjBE,kBAAkB,EAClBE,cAAc,EACdE,WAAW,QACN,8BAA0B;AA+BjC;;;;;;CAMC,GACD,OAAO,SAASE,qBACdC,SAAiB,EACjBC,SAAiB;IAEjB,OAAO,CAAC,QAAQ,EAAED,UAAU,CAAC,EAAEC,WA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,MAAM,GAAG;wBACnC;4BACEa,IAAI;4BACJoB,aAAa;4BACbC,OAAO;gCAAEC,SAAS;4BAAE;4BACpBO,UAAU;gCACRxC,KAAK,kBAAkB,MAAM;gCAC7ByC,YAAY;6BACb;wBACH;qBACD;iBACF;YACH;SACD;IACH;CACD;AAED;;;;;;;CAOC,GACD,OAAO,MAAMf,oBAAuC;OAC/C+B;OACAnE;CACJ,CAAA"}
@@ -15,12 +15,21 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  /**
18
- * EMAIL TOPICS — the streams a recipient can leave one at a time.
18
+ * SUBSCRIPTION TOPICS — the streams a recipient can leave one at a time.
19
+ *
20
+ * The mail rail's per-stream consent: every marketing-purpose message names
21
+ * the stream it belongs to, its unsubscribe link carries that stream, and the
22
+ * send path refuses a recipient who left it. That obligation is owed on every
23
+ * such message whichever plugin sends it — a campaign, a newsletter, a
24
+ * restock alert, an automation, the operator's own product updates — so the
25
+ * state and the policy are the platform's. What a plugin brings is the
26
+ * STREAMS it sends under, which it declares (`plugins.config.json` →
27
+ * `subscriptionTopics`, compiled into {@link DECLARED_SUBSCRIPTION_TOPICS}).
19
28
  *
20
29
  * ## The gap this closes
21
30
  *
22
31
  * `docs/specs/email-competitive-gaps.md` §1f records the only row in that
23
- * table where every competitor has something and we have nothing: "Preference
32
+ * table where every competitor has something and we had nothing: "Preference
24
33
  * center / subscription topics — unsubscribe is all-or-nothing per site".
25
34
  * A recipient who wanted the newsletter but not the sales mail had exactly one
26
35
  * lever, and pulling it took the newsletter too. The lever people reach for
@@ -29,12 +38,11 @@
29
38
  *
30
39
  * ## Scope: definitions are ORG-shared, opt-outs are PER-SITE
31
40
  *
32
- * The topic CATALOG lives at `orgs/{orgId}/emailTopics`, which is where
33
- * `lists` live (AGL-254) and for the same reason: a topic is authored
34
- * editorial content — a name and a sentence of description — that an agency
35
- * writes once and points several sites at. Following `lists` also means the
36
- * console surface that manages topics inherits a scoping question that has
37
- * already been answered, rather than inventing a second answer.
41
+ * The topic CATALOG an org authors — renaming, re-describing, archiving a
42
+ * built-in stream, adding its own — is stored by the plugin that manages it,
43
+ * under the organization, where lists live and for the same reason: a topic is
44
+ * authored editorial content that an agency writes once and points several
45
+ * sites at.
38
46
  *
39
47
  * A recipient's OPT-OUT is per site, at `hosts/{hostId}/topicOptOuts`. It sits
40
48
  * beside `hosts/{hostId}/suppressions`, which is per site, and it answers the
@@ -45,19 +53,18 @@
45
53
  * the unauthenticated preference page honest — the signed link names a host
46
54
  * and nothing else, so a per-site read is exactly what the link authorizes.
47
55
  *
48
- * ## Why the defaults are code and not seeded documents
56
+ * ## Why the built-ins are declared and not seeded documents
49
57
  *
50
- * Every tenant that exists today has an empty `emailTopics` collection. A
51
- * seeding migration would have to run against every org, would leave any org
58
+ * A seeding migration would have to run against every org, would leave any org
52
59
  * created while it was mid-flight with none, and — like every backfill — is a
53
- * thing that gets written and then not run. So {@link DEFAULT_EMAIL_TOPICS} is
54
- * the floor of the catalog rather than its initial contents: it is present for
55
- * every org from the moment this ships, with no write anywhere, and a stored
56
- * document at the same id renames, re-describes or archives one. The catalog a
57
- * reader sees is {@link mergeEmailTopics} of the two.
60
+ * thing that gets written and then not run. So the declared streams are the
61
+ * floor of the catalog rather than its initial contents: present for every
62
+ * org from the moment a plugin declares one, with no write anywhere, and a
63
+ * stored document at the same id renames, re-describes or archives one. The
64
+ * catalog a reader sees is {@link mergeSubscriptionTopics} of the two.
58
65
  */
59
66
  /** One subscribable stream. */
60
- export interface EmailTopic {
67
+ export interface SubscriptionTopic {
61
68
  /**
62
69
  * The stored id. Rides in the unsubscribe link's `tid` and is covered by
63
70
  * its signature, so it is treated as persisted — rename the {@link name},
@@ -157,7 +164,7 @@ export declare const DOUBLE_OPT_IN_EXPIRY_MS: number;
157
164
  * stored on a topic is a real answer and not an absence, which is what lets a
158
165
  * merchant confirm everything except their order-related stream.
159
166
  */
160
- export declare function topicRequiresDoubleOptIn(topic: Pick<EmailTopic, 'doubleOptIn'> | null | undefined, siteDefault?: boolean): boolean;
167
+ export declare function topicRequiresDoubleOptIn(topic: Pick<SubscriptionTopic, 'doubleOptIn'> | null | undefined, siteDefault?: boolean): boolean;
161
168
  /** What one person's record says about one stream on one site. */
162
169
  export type TopicSubscriptionState =
163
170
  /** They may be mailed about this. */
@@ -210,37 +217,46 @@ export declare function readTopicSubscriptionState(entry: TopicSubscriptionEntry
210
217
  * and collapsing them is how an expiry comes to admit somebody.
211
218
  */
212
219
  export declare function doubleOptInExpired(pendingAtMs: number | null | undefined, nowMs: number): boolean;
213
- /** `orgs/{orgId}/emailTopics` — the catalog, org-shared like `lists`. */
214
- export declare const EMAIL_TOPICS_COLLECTION = "emailTopics";
215
220
  /** `hosts/{hostId}/topicOptOuts/{emailKey}` — one document per recipient. */
216
221
  export declare const TOPIC_OPT_OUTS_SUBCOLLECTION = "topicOptOuts";
217
- /** Sales, discounts, seasonal campaigns — and the cart a shopper left. */
218
- export declare const EMAIL_TOPIC_MARKETING = "marketing";
219
- /** Regular news and stories, including a site's posts to its members. */
220
- export declare const EMAIL_TOPIC_NEWSLETTER = "newsletter";
221
- /** New products, restocks, and changes to what a site offers. */
222
- export declare const EMAIL_TOPIC_PRODUCT_UPDATES = "product-updates";
223
- /** One person here writing to another about working together. */
224
- export declare const EMAIL_TOPIC_SALES = "sales";
222
+ /** One stream a plugin declares, as compiled from `plugins.config.json`. */
223
+ export interface DeclaredSubscriptionTopic {
224
+ /** The plugin that sends under it. */
225
+ pluginId: string;
226
+ /**
227
+ * A wire value: a Firestore path component and a colon-joined component of
228
+ * the unsubscribe link's signed subject. Changing one orphans every opt-out
229
+ * already recorded against it.
230
+ */
231
+ id: string;
232
+ name: string;
233
+ description: string;
234
+ /** Its place on the preference page. */
235
+ order: number;
236
+ /** The stream a message belongs to when it names none. */
237
+ default?: true;
238
+ }
225
239
  /**
226
- * The catalog every org has before anyone opens the console.
227
- *
228
- * Four, not twelve. A preference page whose value is "leave one stream without
229
- * leaving all of them" stops working the moment the list is long enough that
230
- * reading it is a chore, and a merchant who needs a fifth can add one. The ids
231
- * are the generic names an unsubscribing recipient can recognize without
232
- * knowing anything about the sender's internal vocabulary.
240
+ * The catalog every org has before anyone opens the console: the streams the
241
+ * plugins declare, in preference-page order.
242
+ *
243
+ * A handful, not a dozen. A preference page whose value is "leave one stream
244
+ * without leaving all of them" stops working the moment the list is long
245
+ * enough that reading it is a chore, and a merchant who needs another can add
246
+ * one. The ids are the generic names an unsubscribing recipient can recognize
247
+ * without knowing anything about the sender's internal vocabulary.
233
248
  */
234
- export declare const DEFAULT_EMAIL_TOPICS: readonly EmailTopic[];
249
+ export declare const DECLARED_SUBSCRIPTION_TOPICS: readonly SubscriptionTopic[];
235
250
  /**
236
- * The topic a campaign carries when its author picked none.
251
+ * The stream a message belongs to when its author picked none: the one a
252
+ * plugin declares `default`, or `''` when none does.
237
253
  *
238
- * Every campaign resolves to SOME topic, because a campaign with no topic
239
- * would mint an unsubscribe link the preference page cannot place — it could
240
- * offer the catalog but not say which entry this message was, which is the one
241
- * thing the recipient came to the page knowing.
254
+ * Every campaign resolves to SOME topic while one is declared, because a
255
+ * campaign with no topic would mint an unsubscribe link the preference page
256
+ * cannot place — it could offer the catalog but not say which entry this
257
+ * message was, which is the one thing the recipient came to the page knowing.
242
258
  */
243
- export declare const DEFAULT_CAMPAIGN_TOPIC_ID = "marketing";
259
+ export declare const DEFAULT_SUBSCRIPTION_TOPIC_ID: string;
244
260
  /**
245
261
  * WHICH STREAM AN AUTOMATED EMAIL BELONGS TO — the one answer, named once.
246
262
  *
@@ -259,7 +275,7 @@ export declare const DEFAULT_CAMPAIGN_TOPIC_ID = "marketing";
259
275
  * which is not "the default topic", and must not be signed into a
260
276
  * link as one.
261
277
  */
262
- export declare function flowEmailTopicId(topicId: string | null | undefined, scope?: 'scheduled' | 'immediate'): string;
278
+ export declare function flowSubscriptionTopicId(topicId: string | null | undefined, scope?: 'scheduled' | 'immediate'): string;
263
279
  /**
264
280
  * Whether `value` may be a topic id.
265
281
  *
@@ -270,9 +286,9 @@ export declare function flowEmailTopicId(topicId: string | null | undefined, sco
270
286
  * parameter tuples. See `signatureMatches` in the email plugin's
271
287
  * `unsubscribe-link.ts` for what that ambiguity would buy.
272
288
  */
273
- export declare function isEmailTopicId(value: unknown): value is string;
289
+ export declare function isSubscriptionTopicId(value: unknown): value is string;
274
290
  /** Coerces one stored document into a topic, or `null` if it is not one. */
275
- export declare function normalizeEmailTopic(id: unknown, data: Record<string, unknown> | null | undefined): EmailTopic | null;
291
+ export declare function normalizeSubscriptionTopic(id: unknown, data: Record<string, unknown> | null | undefined): SubscriptionTopic | null;
276
292
  /**
277
293
  * The catalog a reader sees: the built-in floor, overlaid by whatever the org
278
294
  * has stored, plus the org's own topics.
@@ -286,7 +302,7 @@ export declare function normalizeEmailTopic(id: unknown, data: Record<string, un
286
302
  * alphabetically after, so the preference page's checkbox order is stable
287
303
  * across renders and across sites.
288
304
  */
289
- export declare function mergeEmailTopics(stored: readonly EmailTopic[] | null | undefined): EmailTopic[];
305
+ export declare function mergeSubscriptionTopics(stored: readonly SubscriptionTopic[] | null | undefined): SubscriptionTopic[];
290
306
  /**
291
307
  * The catalog minus retired topics — what a composer's picker and a
292
308
  * preference page's checkboxes offer.
@@ -296,7 +312,7 @@ export declare function mergeEmailTopics(stored: readonly EmailTopic[] | null |
296
312
  * belongs to that topic, and re-pointing it at something else would attribute
297
313
  * the unsubscribes to the wrong stream.
298
314
  */
299
- export declare function activeEmailTopics(topics: readonly EmailTopic[]): EmailTopic[];
315
+ export declare function activeSubscriptionTopics(topics: readonly SubscriptionTopic[]): SubscriptionTopic[];
300
316
  /**
301
317
  * The topic a campaign belongs to, given what it stored and what the org
302
318
  * offers.
@@ -307,4 +323,4 @@ export declare function activeEmailTopics(topics: readonly EmailTopic[]): EmailT
307
323
  * page that names A topic, not on one that says the message came from
308
324
  * nowhere.
309
325
  */
310
- export declare function resolveCampaignTopic(topicId: string | null | undefined, topics: readonly EmailTopic[]): EmailTopic;
326
+ export declare function resolveSubscriptionTopic(topicId: string | null | undefined, topics: readonly SubscriptionTopic[]): SubscriptionTopic;
@@ -1,3 +1,6 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ var _ref;
3
+ var _PLUGIN_SUBSCRIPTION_TOPICS_DECLARED_find;
1
4
  /**
2
5
  * @license
3
6
  * Copyright 2026 Aglyn LLC
@@ -13,48 +16,7 @@
13
16
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
17
  * See the License for the specific language governing permissions and
15
18
  * limitations under the License.
16
- */ /**
17
- * EMAIL TOPICS — the streams a recipient can leave one at a time.
18
- *
19
- * ## The gap this closes
20
- *
21
- * `docs/specs/email-competitive-gaps.md` §1f records the only row in that
22
- * table where every competitor has something and we have nothing: "Preference
23
- * center / subscription topics — unsubscribe is all-or-nothing per site".
24
- * A recipient who wanted the newsletter but not the sales mail had exactly one
25
- * lever, and pulling it took the newsletter too. The lever people reach for
26
- * when the only unsubscribe is total is "report spam", which is a complaint,
27
- * which is the sending domain's problem and therefore every tenant's.
28
- *
29
- * ## Scope: definitions are ORG-shared, opt-outs are PER-SITE
30
- *
31
- * The topic CATALOG lives at `orgs/{orgId}/emailTopics`, which is where
32
- * `lists` live (AGL-254) and for the same reason: a topic is authored
33
- * editorial content — a name and a sentence of description — that an agency
34
- * writes once and points several sites at. Following `lists` also means the
35
- * console surface that manages topics inherits a scoping question that has
36
- * already been answered, rather than inventing a second answer.
37
- *
38
- * A recipient's OPT-OUT is per site, at `hosts/{hostId}/topicOptOuts`. It sits
39
- * beside `hosts/{hostId}/suppressions`, which is per site, and it answers the
40
- * same shape of question one notch finer: the suppression says "nothing from
41
- * this site", the opt-out says "not this stream from this site". Two facts
42
- * about one person that live at different scopes would make "may I mail this
43
- * person about product updates" a question with two answers. It also keeps
44
- * the unauthenticated preference page honest — the signed link names a host
45
- * and nothing else, so a per-site read is exactly what the link authorizes.
46
- *
47
- * ## Why the defaults are code and not seeded documents
48
- *
49
- * Every tenant that exists today has an empty `emailTopics` collection. A
50
- * seeding migration would have to run against every org, would leave any org
51
- * created while it was mid-flight with none, and — like every backfill — is a
52
- * thing that gets written and then not run. So {@link DEFAULT_EMAIL_TOPICS} is
53
- * the floor of the catalog rather than its initial contents: it is present for
54
- * every org from the moment this ships, with no write anywhere, and a stored
55
- * document at the same id renames, re-describes or archives one. The catalog a
56
- * reader sees is {@link mergeEmailTopics} of the two.
57
- */ /** One subscribable stream. */ import { _ as _extends } from "@swc/helpers/_/_extends";
19
+ */ import { PLUGIN_SUBSCRIPTION_TOPICS_DECLARED } from "../plugin-manager/plugin-subscription-topics.generated.js";
58
20
  /**
59
21
  * DOUBLE OPT-IN — per topic, defaulting per site.
60
22
  *
@@ -167,62 +129,30 @@
167
129
  if (!Number.isFinite(at) || at <= 0) return true;
168
130
  return nowMs - at > DOUBLE_OPT_IN_EXPIRY_MS;
169
131
  }
170
- /** `orgs/{orgId}/emailTopics` — the catalog, org-shared like `lists`. */ export const EMAIL_TOPICS_COLLECTION = 'emailTopics';
171
132
  /** `hosts/{hostId}/topicOptOuts/{emailKey}` — one document per recipient. */ export const TOPIC_OPT_OUTS_SUBCOLLECTION = 'topicOptOuts';
172
- /*==========================================
173
- * THE BUILT-IN STREAM IDS.
174
- *
175
- * Named rather than written as literals wherever a send declares which stream
176
- * it belongs to, because a mistyped id does not fail loudly. It names a
177
- * stream nobody has opted out of, so `filterTopicSendable` finds no opt-out
178
- * and the send goes to everybody — the control silently doing nothing, which
179
- * is the failure mode a topic filter is least able to reveal.
180
- *
181
- * The value is also a Firestore path component and a colon-joined component
182
- * of the unsubscribe link's signed subject, so it is a wire format: changing
183
- * one of these strings orphans every opt-out already recorded against it.
184
- *=========================================*/ /** Sales, discounts, seasonal campaigns — and the cart a shopper left. */ export const EMAIL_TOPIC_MARKETING = 'marketing';
185
- /** Regular news and stories, including a site's posts to its members. */ export const EMAIL_TOPIC_NEWSLETTER = 'newsletter';
186
- /** New products, restocks, and changes to what a site offers. */ export const EMAIL_TOPIC_PRODUCT_UPDATES = 'product-updates';
187
- /** One person here writing to another about working together. */ export const EMAIL_TOPIC_SALES = 'sales';
188
133
  /**
189
- * The catalog every org has before anyone opens the console.
190
- *
191
- * Four, not twelve. A preference page whose value is "leave one stream without
192
- * leaving all of them" stops working the moment the list is long enough that
193
- * reading it is a chore, and a merchant who needs a fifth can add one. The ids
194
- * are the generic names an unsubscribing recipient can recognize without
195
- * knowing anything about the sender's internal vocabulary.
196
- */ export const DEFAULT_EMAIL_TOPICS = [
197
- {
198
- id: EMAIL_TOPIC_MARKETING,
199
- name: 'Promotions and offers',
200
- description: 'Sales, discounts and seasonal campaigns.'
201
- },
202
- {
203
- id: EMAIL_TOPIC_NEWSLETTER,
204
- name: 'Newsletter',
205
- description: 'Regular news and stories from us.'
206
- },
207
- {
208
- id: EMAIL_TOPIC_PRODUCT_UPDATES,
209
- name: 'Product updates',
210
- description: 'New products, restocks and changes to what we offer.'
211
- },
212
- {
213
- id: EMAIL_TOPIC_SALES,
214
- name: 'Sales outreach',
215
- description: 'Messages from a person here about working together.'
216
- }
217
- ];
134
+ * The catalog every org has before anyone opens the console: the streams the
135
+ * plugins declare, in preference-page order.
136
+ *
137
+ * A handful, not a dozen. A preference page whose value is "leave one stream
138
+ * without leaving all of them" stops working the moment the list is long
139
+ * enough that reading it is a chore, and a merchant who needs another can add
140
+ * one. The ids are the generic names an unsubscribing recipient can recognize
141
+ * without knowing anything about the sender's internal vocabulary.
142
+ */ export const DECLARED_SUBSCRIPTION_TOPICS = PLUGIN_SUBSCRIPTION_TOPICS_DECLARED.map(({ id, name, description })=>({
143
+ id,
144
+ name,
145
+ description
146
+ }));
218
147
  /**
219
- * The topic a campaign carries when its author picked none.
220
- *
221
- * Every campaign resolves to SOME topic, because a campaign with no topic
222
- * would mint an unsubscribe link the preference page cannot place — it could
223
- * offer the catalog but not say which entry this message was, which is the one
224
- * thing the recipient came to the page knowing.
225
- */ export const DEFAULT_CAMPAIGN_TOPIC_ID = EMAIL_TOPIC_MARKETING;
148
+ * The stream a message belongs to when its author picked none: the one a
149
+ * plugin declares `default`, or `''` when none does.
150
+ *
151
+ * Every campaign resolves to SOME topic while one is declared, because a
152
+ * campaign with no topic would mint an unsubscribe link the preference page
153
+ * cannot place — it could offer the catalog but not say which entry this
154
+ * message was, which is the one thing the recipient came to the page knowing.
155
+ */ export const DEFAULT_SUBSCRIPTION_TOPIC_ID = (_ref = (_PLUGIN_SUBSCRIPTION_TOPICS_DECLARED_find = PLUGIN_SUBSCRIPTION_TOPICS_DECLARED.find((topic)=>topic.default)) == null ? void 0 : _PLUGIN_SUBSCRIPTION_TOPICS_DECLARED_find.id) != null ? _ref : '';
226
156
  /**
227
157
  * WHICH STREAM AN AUTOMATED EMAIL BELONGS TO — the one answer, named once.
228
158
  *
@@ -240,9 +170,9 @@
240
170
  * @returns the topic id, or `''` for a message that belongs to no stream —
241
171
  * which is not "the default topic", and must not be signed into a
242
172
  * link as one.
243
- */ export function flowEmailTopicId(topicId, scope) {
173
+ */ export function flowSubscriptionTopicId(topicId, scope) {
244
174
  const named = String(topicId != null ? topicId : '').trim();
245
- return scope === 'immediate' ? named : named || DEFAULT_CAMPAIGN_TOPIC_ID;
175
+ return scope === 'immediate' ? named : named || DEFAULT_SUBSCRIPTION_TOPIC_ID;
246
176
  }
247
177
  /**
248
178
  * Whether `value` may be a topic id.
@@ -253,12 +183,12 @@
253
183
  * so a colon inside it would let one signed subject be read as two different
254
184
  * parameter tuples. See `signatureMatches` in the email plugin's
255
185
  * `unsubscribe-link.ts` for what that ambiguity would buy.
256
- */ export function isEmailTopicId(value) {
186
+ */ export function isSubscriptionTopicId(value) {
257
187
  return typeof value === 'string' && value.length > 0 && value.length <= 120 && !value.includes('/') && !value.includes(':') && value !== '.' && value !== '..' && !/^__.*__$/.test(value);
258
188
  }
259
- /** Coerces one stored document into a topic, or `null` if it is not one. */ export function normalizeEmailTopic(id, data) {
189
+ /** Coerces one stored document into a topic, or `null` if it is not one. */ export function normalizeSubscriptionTopic(id, data) {
260
190
  var _ref, _ref1;
261
- if (!isEmailTopicId(id)) return null;
191
+ if (!isSubscriptionTopicId(id)) return null;
262
192
  const name = String((_ref = data == null ? void 0 : data['name']) != null ? _ref : '').trim();
263
193
  return _extends({
264
194
  id,
@@ -285,18 +215,18 @@
285
215
  * Sorted with the built-ins first in their declared order and custom topics
286
216
  * alphabetically after, so the preference page's checkbox order is stable
287
217
  * across renders and across sites.
288
- */ export function mergeEmailTopics(stored) {
218
+ */ export function mergeSubscriptionTopics(stored) {
289
219
  const overrides = new Map();
290
220
  for (const topic of stored != null ? stored : []){
291
- if (isEmailTopicId(topic == null ? void 0 : topic.id)) overrides.set(topic.id, topic);
221
+ if (isSubscriptionTopicId(topic == null ? void 0 : topic.id)) overrides.set(topic.id, topic);
292
222
  }
293
- const builtIn = DEFAULT_EMAIL_TOPICS.map((topic)=>{
223
+ const builtIn = DECLARED_SUBSCRIPTION_TOPICS.map((topic)=>{
294
224
  var _overrides_get;
295
225
  return (_overrides_get = overrides.get(topic.id)) != null ? _overrides_get : topic;
296
226
  });
297
227
  const custom = [
298
228
  ...overrides.values()
299
- ].filter((topic)=>!DEFAULT_EMAIL_TOPICS.some((it)=>it.id === topic.id)).sort((a, b)=>a.name.localeCompare(b.name));
229
+ ].filter((topic)=>!DECLARED_SUBSCRIPTION_TOPICS.some((it)=>it.id === topic.id)).sort((a, b)=>a.name.localeCompare(b.name));
300
230
  return [
301
231
  ...builtIn,
302
232
  ...custom
@@ -310,7 +240,7 @@
310
240
  * campaign whose topic was archived between scheduling and sending still
311
241
  * belongs to that topic, and re-pointing it at something else would attribute
312
242
  * the unsubscribes to the wrong stream.
313
- */ export function activeEmailTopics(topics) {
243
+ */ export function activeSubscriptionTopics(topics) {
314
244
  return topics.filter((topic)=>!topic.archived);
315
245
  }
316
246
  /**
@@ -322,15 +252,15 @@
322
252
  * unsubscribe links are in inboxes right now. They must land on a preference
323
253
  * page that names A topic, not on one that says the message came from
324
254
  * nowhere.
325
- */ export function resolveCampaignTopic(topicId, topics) {
255
+ */ export function resolveSubscriptionTopic(topicId, topics) {
326
256
  var _ref, _topics_find;
327
257
  const found = topicId ? topics.find((topic)=>topic.id === topicId) : undefined;
328
258
  if (found) return found;
329
- return (_ref = (_topics_find = topics.find((topic)=>topic.id === DEFAULT_CAMPAIGN_TOPIC_ID)) != null ? _topics_find : topics[0]) != null ? _ref : {
330
- id: DEFAULT_CAMPAIGN_TOPIC_ID,
259
+ return (_ref = (_topics_find = topics.find((topic)=>topic.id === DEFAULT_SUBSCRIPTION_TOPIC_ID)) != null ? _topics_find : topics[0]) != null ? _ref : {
260
+ id: DEFAULT_SUBSCRIPTION_TOPIC_ID,
331
261
  name: 'Email',
332
262
  description: ''
333
263
  };
334
264
  }
335
265
 
336
- //# sourceMappingURL=email-topics.js.map
266
+ //# sourceMappingURL=subscription-topics.js.map