@aglyn/plugins-marketing 1.0.0-beta.143

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 (183) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +56 -0
  4. package/src/index.d.ts +19 -0
  5. package/src/index.js +20 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/components/announcement-bar-card.component.d.ts +20 -0
  8. package/src/lib/components/announcement-bar-card.component.js +292 -0
  9. package/src/lib/components/announcement-bar-card.component.js.map +1 -0
  10. package/src/lib/components/campaign-composer.d.ts +84 -0
  11. package/src/lib/components/campaign-composer.js +1643 -0
  12. package/src/lib/components/campaign-composer.js.map +1 -0
  13. package/src/lib/components/campaign-conversions-card.d.ts +22 -0
  14. package/src/lib/components/campaign-conversions-card.js +642 -0
  15. package/src/lib/components/campaign-conversions-card.js.map +1 -0
  16. package/src/lib/components/campaign-detail-card.d.ts +55 -0
  17. package/src/lib/components/campaign-detail-card.js +771 -0
  18. package/src/lib/components/campaign-detail-card.js.map +1 -0
  19. package/src/lib/components/campaign-edit-drawer.d.ts +60 -0
  20. package/src/lib/components/campaign-edit-drawer.js +252 -0
  21. package/src/lib/components/campaign-edit-drawer.js.map +1 -0
  22. package/src/lib/components/campaign-email-zones.d.ts +111 -0
  23. package/src/lib/components/campaign-email-zones.js +54 -0
  24. package/src/lib/components/campaign-email-zones.js.map +1 -0
  25. package/src/lib/components/campaign-glance-card.component.d.ts +18 -0
  26. package/src/lib/components/campaign-glance-card.component.js +151 -0
  27. package/src/lib/components/campaign-glance-card.component.js.map +1 -0
  28. package/src/lib/components/campaign-members-section.d.ts +87 -0
  29. package/src/lib/components/campaign-members-section.js +499 -0
  30. package/src/lib/components/campaign-members-section.js.map +1 -0
  31. package/src/lib/components/campaign-reach-sections.d.ts +137 -0
  32. package/src/lib/components/campaign-reach-sections.js +694 -0
  33. package/src/lib/components/campaign-reach-sections.js.map +1 -0
  34. package/src/lib/components/campaign-report-card.d.ts +91 -0
  35. package/src/lib/components/campaign-report-card.js +667 -0
  36. package/src/lib/components/campaign-report-card.js.map +1 -0
  37. package/src/lib/components/campaign-test-send-drawer.d.ts +45 -0
  38. package/src/lib/components/campaign-test-send-drawer.js +238 -0
  39. package/src/lib/components/campaign-test-send-drawer.js.map +1 -0
  40. package/src/lib/components/campaigns-card.d.ts +31 -0
  41. package/src/lib/components/campaigns-card.js +667 -0
  42. package/src/lib/components/campaigns-card.js.map +1 -0
  43. package/src/lib/components/conversion-attribution.component.d.ts +62 -0
  44. package/src/lib/components/conversion-attribution.component.js +127 -0
  45. package/src/lib/components/conversion-attribution.component.js.map +1 -0
  46. package/src/lib/components/email-compose-card.d.ts +12 -0
  47. package/src/lib/components/email-compose-card.js +157 -0
  48. package/src/lib/components/email-compose-card.js.map +1 -0
  49. package/src/lib/components/email-detail.d.ts +40 -0
  50. package/src/lib/components/email-detail.js +1180 -0
  51. package/src/lib/components/email-detail.js.map +1 -0
  52. package/src/lib/components/email-edit-drawer.d.ts +54 -0
  53. package/src/lib/components/email-edit-drawer.js +172 -0
  54. package/src/lib/components/email-edit-drawer.js.map +1 -0
  55. package/src/lib/components/email-messages-widget.d.ts +22 -0
  56. package/src/lib/components/email-messages-widget.js +49 -0
  57. package/src/lib/components/email-messages-widget.js.map +1 -0
  58. package/src/lib/components/email-recipients-card.d.ts +50 -0
  59. package/src/lib/components/email-recipients-card.js +338 -0
  60. package/src/lib/components/email-recipients-card.js.map +1 -0
  61. package/src/lib/components/emails-list-card.d.ts +36 -0
  62. package/src/lib/components/emails-list-card.js +544 -0
  63. package/src/lib/components/emails-list-card.js.map +1 -0
  64. package/src/lib/components/experiment-zones.d.ts +78 -0
  65. package/src/lib/components/experiment-zones.js +65 -0
  66. package/src/lib/components/experiment-zones.js.map +1 -0
  67. package/src/lib/components/host-experiments-card.component.d.ts +17 -0
  68. package/src/lib/components/host-experiments-card.component.js +887 -0
  69. package/src/lib/components/host-experiments-card.component.js.map +1 -0
  70. package/src/lib/components/host-marketing-summary-card.component.d.ts +15 -0
  71. package/src/lib/components/host-marketing-summary-card.component.js +161 -0
  72. package/src/lib/components/host-marketing-summary-card.component.js.map +1 -0
  73. package/src/lib/components/host-overlays-card.component.d.ts +19 -0
  74. package/src/lib/components/host-overlays-card.component.js +783 -0
  75. package/src/lib/components/host-overlays-card.component.js.map +1 -0
  76. package/src/lib/components/marketing-console-page.d.ts +28 -0
  77. package/src/lib/components/marketing-console-page.js +166 -0
  78. package/src/lib/components/marketing-console-page.js.map +1 -0
  79. package/src/lib/components/marketing-console-sections.d.ts +34 -0
  80. package/src/lib/components/marketing-console-sections.js +77 -0
  81. package/src/lib/components/marketing-console-sections.js.map +1 -0
  82. package/src/lib/components/overlay-stats-row.component.d.ts +15 -0
  83. package/src/lib/components/overlay-stats-row.component.js +78 -0
  84. package/src/lib/components/overlay-stats-row.component.js.map +1 -0
  85. package/src/lib/components/popup-card.component.d.ts +18 -0
  86. package/src/lib/components/popup-card.component.js +462 -0
  87. package/src/lib/components/popup-card.component.js.map +1 -0
  88. package/src/lib/components/record-attribution-widget.d.ts +35 -0
  89. package/src/lib/components/record-attribution-widget.js +33 -0
  90. package/src/lib/components/record-attribution-widget.js.map +1 -0
  91. package/src/lib/components/site-runtime.d.ts +9 -0
  92. package/src/lib/components/site-runtime.js +1081 -0
  93. package/src/lib/components/site-runtime.js.map +1 -0
  94. package/src/lib/components/use-campaign-send-api.d.ts +35 -0
  95. package/src/lib/components/use-campaign-send-api.js +99 -0
  96. package/src/lib/components/use-campaign-send-api.js.map +1 -0
  97. package/src/lib/components/use-campaign-topic-options.d.ts +20 -0
  98. package/src/lib/components/use-campaign-topic-options.js +44 -0
  99. package/src/lib/components/use-campaign-topic-options.js.map +1 -0
  100. package/src/lib/components/use-emails-hub-path.d.ts +39 -0
  101. package/src/lib/components/use-emails-hub-path.js +70 -0
  102. package/src/lib/components/use-emails-hub-path.js.map +1 -0
  103. package/src/lib/components/use-marketing-hub-path.d.ts +21 -0
  104. package/src/lib/components/use-marketing-hub-path.js +50 -0
  105. package/src/lib/components/use-marketing-hub-path.js.map +1 -0
  106. package/src/lib/components/use-overlay-copy-editor.d.ts +79 -0
  107. package/src/lib/components/use-overlay-copy-editor.js +110 -0
  108. package/src/lib/components/use-overlay-copy-editor.js.map +1 -0
  109. package/src/lib/constants/bundle-common.d.ts +8 -0
  110. package/src/lib/constants/bundle-common.js +9 -0
  111. package/src/lib/constants/bundle-common.js.map +1 -0
  112. package/src/lib/model/campaign-membership-figures.d.ts +109 -0
  113. package/src/lib/model/campaign-membership-figures.js +113 -0
  114. package/src/lib/model/campaign-membership-figures.js.map +1 -0
  115. package/src/lib/model/compile-client-automations.d.ts +65 -0
  116. package/src/lib/model/compile-client-automations.js +95 -0
  117. package/src/lib/model/compile-client-automations.js.map +1 -0
  118. package/src/lib/model/experiments.d.ts +130 -0
  119. package/src/lib/model/experiments.js +186 -0
  120. package/src/lib/model/experiments.js.map +1 -0
  121. package/src/lib/model/index.d.ts +26 -0
  122. package/src/lib/model/index.js +26 -0
  123. package/src/lib/model/index.js.map +1 -0
  124. package/src/lib/model/marketing-record-routes.d.ts +6 -0
  125. package/src/lib/model/marketing-record-routes.js +46 -0
  126. package/src/lib/model/marketing-record-routes.js.map +1 -0
  127. package/src/lib/model/overlay-copy.d.ts +62 -0
  128. package/src/lib/model/overlay-copy.js +78 -0
  129. package/src/lib/model/overlay-copy.js.map +1 -0
  130. package/src/lib/model/overlays.d.ts +113 -0
  131. package/src/lib/model/overlays.js +93 -0
  132. package/src/lib/model/overlays.js.map +1 -0
  133. package/src/lib/model/site-contract.d.ts +100 -0
  134. package/src/lib/model/site-contract.js +23 -0
  135. package/src/lib/model/site-contract.js.map +1 -0
  136. package/src/lib/plugin.d.ts +27 -0
  137. package/src/lib/plugin.js +168 -0
  138. package/src/lib/plugin.js.map +1 -0
  139. package/src/lib/preview-props.d.ts +31 -0
  140. package/src/lib/preview-props.js +54 -0
  141. package/src/lib/preview-props.js.map +1 -0
  142. package/src/lib/server/campaign-manage.d.ts +62 -0
  143. package/src/lib/server/campaign-manage.js +829 -0
  144. package/src/lib/server/campaign-manage.js.map +1 -0
  145. package/src/lib/server/campaign-process-scheduled.d.ts +26 -0
  146. package/src/lib/server/campaign-process-scheduled.js +198 -0
  147. package/src/lib/server/campaign-process-scheduled.js.map +1 -0
  148. package/src/lib/server/campaign-recipients.d.ts +55 -0
  149. package/src/lib/server/campaign-recipients.js +219 -0
  150. package/src/lib/server/campaign-recipients.js.map +1 -0
  151. package/src/lib/server/campaign-send.d.ts +487 -0
  152. package/src/lib/server/campaign-send.js +3157 -0
  153. package/src/lib/server/campaign-send.js.map +1 -0
  154. package/src/lib/server/email-campaign-reach.d.ts +174 -0
  155. package/src/lib/server/email-campaign-reach.js +254 -0
  156. package/src/lib/server/email-campaign-reach.js.map +1 -0
  157. package/src/lib/server/email-events.d.ts +27 -0
  158. package/src/lib/server/email-events.js +714 -0
  159. package/src/lib/server/email-events.js.map +1 -0
  160. package/src/lib/server/get-client-automations.d.ts +60 -0
  161. package/src/lib/server/get-client-automations.js +87 -0
  162. package/src/lib/server/get-client-automations.js.map +1 -0
  163. package/src/lib/server/get-overlays.d.ts +28 -0
  164. package/src/lib/server/get-overlays.js +65 -0
  165. package/src/lib/server/get-overlays.js.map +1 -0
  166. package/src/lib/server/get-screen-experiments.d.ts +42 -0
  167. package/src/lib/server/get-screen-experiments.js +82 -0
  168. package/src/lib/server/get-screen-experiments.js.map +1 -0
  169. package/src/lib/server/lists-materialize.d.ts +18 -0
  170. package/src/lib/server/lists-materialize.js +130 -0
  171. package/src/lib/server/lists-materialize.js.map +1 -0
  172. package/src/lib/server/marketing-figures.d.ts +37 -0
  173. package/src/lib/server/marketing-figures.js +248 -0
  174. package/src/lib/server/marketing-figures.js.map +1 -0
  175. package/src/lib/server/site-page-enricher.d.ts +26 -0
  176. package/src/lib/server/site-page-enricher.js +210 -0
  177. package/src/lib/server/site-page-enricher.js.map +1 -0
  178. package/src/lib/server.d.ts +20 -0
  179. package/src/lib/server.js +152 -0
  180. package/src/lib/server.js.map +1 -0
  181. package/src/lib/site.d.ts +22 -0
  182. package/src/lib/site.js +48 -0
  183. package/src/lib/site.js.map +1 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { collection, getDocs, limit, query } from "firebase/firestore";
17
+ import { compileClientAutomations } from "./model/index.js";
18
+ /**
19
+ * The marketing site-runtime's client-side page-props for the besigner
20
+ * Preview (AGL-830). No server enricher runs there, so this reads the host's
21
+ * `actions` with the client SDK and compiles them the same way the enricher
22
+ * does — the Preview then mounts the SAME MarketingSiteRuntime the tenant
23
+ * uses, and hover-to-open menus/drawers behave exactly like the live site.
24
+ *
25
+ * Compiled with `actionsEntitled: false`, so only basic PRESENTATIONAL steps
26
+ * (menu/drawer/show-hide/class/nav) run and `hasServerSteps` stays false —
27
+ * preview never fires analytics, webhooks, or server events. `matchAllPaths`
28
+ * because the Preview renders one composed screen and scopes relevance by
29
+ * selector match, not page path.
30
+ */ export async function loadMarketingPreviewProps(ctx) {
31
+ const { hostId, firestore } = ctx;
32
+ if (!hostId || !firestore) return {};
33
+ try {
34
+ const snapshot = await getDocs(query(collection(firestore, 'hosts', hostId, 'actions'), limit(50)));
35
+ const actions = snapshot.docs.map((doc)=>({
36
+ id: doc.id,
37
+ action: doc.data()
38
+ }));
39
+ const clientAutomations = compileClientAutomations(actions, {
40
+ path: '/',
41
+ actionsEntitled: false,
42
+ allowJs: false,
43
+ matchAllPaths: true
44
+ });
45
+ return {
46
+ clientAutomations
47
+ };
48
+ } catch (error) {
49
+ console.error('marketing: preview props load failed', error);
50
+ return {};
51
+ }
52
+ }
53
+
54
+ //# sourceMappingURL=preview-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/plugins/marketing/src/lib/preview-props.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\nimport { collection, getDocs, limit, query, type Firestore } from 'firebase/firestore'\nimport type { HostAction } from '@aglyn/aglyn'\nimport type { SiteRuntimePreviewContext } from '@aglyn/aglyn'\nimport { compileClientAutomations, type RawHostAction } from './model'\n\n/**\n * The marketing site-runtime's client-side page-props for the besigner\n * Preview (AGL-830). No server enricher runs there, so this reads the host's\n * `actions` with the client SDK and compiles them the same way the enricher\n * does — the Preview then mounts the SAME MarketingSiteRuntime the tenant\n * uses, and hover-to-open menus/drawers behave exactly like the live site.\n *\n * Compiled with `actionsEntitled: false`, so only basic PRESENTATIONAL steps\n * (menu/drawer/show-hide/class/nav) run and `hasServerSteps` stays false —\n * preview never fires analytics, webhooks, or server events. `matchAllPaths`\n * because the Preview renders one composed screen and scopes relevance by\n * selector match, not page path.\n */\nexport async function loadMarketingPreviewProps(\n ctx: SiteRuntimePreviewContext,\n): Promise<Record<string, unknown>> {\n const { hostId, firestore } = ctx\n if (!hostId || !firestore) return {}\n try {\n const snapshot = await getDocs(\n query(\n collection(firestore as Firestore, 'hosts', hostId, 'actions'),\n limit(50),\n ),\n )\n const actions: RawHostAction[] = snapshot.docs.map((doc) => ({\n id: doc.id,\n action: doc.data() as HostAction,\n }))\n const clientAutomations = compileClientAutomations(actions, {\n path: '/',\n actionsEntitled: false,\n allowJs: false,\n matchAllPaths: true,\n })\n return { clientAutomations }\n } catch (error) {\n console.error('marketing: preview props load failed', error)\n return {}\n }\n}\n"],"names":["collection","getDocs","limit","query","compileClientAutomations","loadMarketingPreviewProps","ctx","hostId","firestore","snapshot","actions","docs","map","doc","id","action","data","clientAutomations","path","actionsEntitled","allowJs","matchAllPaths","error","console"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,UAAU,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAwB,qBAAoB;AAGtF,SAASC,wBAAwB,QAA4B,mBAAS;AAEtE;;;;;;;;;;;;CAYC,GACD,OAAO,eAAeC,0BACpBC,GAA8B;IAE9B,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGF;IAC9B,IAAI,CAACC,UAAU,CAACC,WAAW,OAAO,CAAC;IACnC,IAAI;QACF,MAAMC,WAAW,MAAMR,QACrBE,MACEH,WAAWQ,WAAwB,SAASD,QAAQ,YACpDL,MAAM;QAGV,MAAMQ,UAA2BD,SAASE,IAAI,CAACC,GAAG,CAAC,CAACC,MAAS,CAAA;gBAC3DC,IAAID,IAAIC,EAAE;gBACVC,QAAQF,IAAIG,IAAI;YAClB,CAAA;QACA,MAAMC,oBAAoBb,yBAAyBM,SAAS;YAC1DQ,MAAM;YACNC,iBAAiB;YACjBC,SAAS;YACTC,eAAe;QACjB;QACA,OAAO;YAAEJ;QAAkB;IAC7B,EAAE,OAAOK,OAAO;QACdC,QAAQD,KAAK,CAAC,wCAAwCA;QACtD,OAAO,CAAC;IACV;AACF"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type PluginApiHandler } from '@aglyn/aglyn/server';
18
+ import { type PluginResourceDraftWriter } from '@aglyn/aglyn/plugin-manager/plugin-resource-drafts';
19
+ /** The resource name the campaign draft writer is registered under. */
20
+ export declare const CAMPAIGN_DRAFT_RESOURCE = "campaign";
21
+ /** A drafted campaign's name when the caller asks for none. */
22
+ export declare const CAMPAIGN_DRAFT_DEFAULT_NAME = "Untitled campaign";
23
+ /** The longest subject or preheader a drafted email stores: the send route's header cap. */
24
+ export declare const CAMPAIGN_DRAFT_HEADER_MAX_CHARS = 200;
25
+ /** The most alternative subject lines or preheaders a drafted email keeps. */
26
+ export declare const CAMPAIGN_DRAFT_MAX_VARIANTS = 10;
27
+ /** The site roles that may compose this site's mail. */
28
+ export declare const CAMPAIGN_DRAFT_ROLES: readonly ["admin", "editor"];
29
+ /** The send route's refusal for a member who may not compose this site's mail. */
30
+ export declare const CAMPAIGN_DRAFT_ROLE_REFUSAL = "Not a site admin or editor";
31
+ /** The id of the one email inside a drafted campaign. */
32
+ export declare function campaignDraftEmailId(campaignId: string): string;
33
+ /** Every field a drafted email is written with, and so every field it can hold. */
34
+ export declare const CAMPAIGN_DRAFT_EMAIL_FIELDS: readonly ["subject", "preheader", "templateScreenId", "subjectVariants", "preheaderVariants", "emailCampaignId", "status", "createdAtMs", "draftedAt", "draftedBy"];
35
+ /** What a caller sends as `content`. */
36
+ export interface CampaignDraftContent {
37
+ /** The email design the email sends: a `kind: 'email'` screen on the site. */
38
+ templateScreenId: string;
39
+ subject: string;
40
+ preheader: string;
41
+ subjectVariants: string[];
42
+ preheaderVariants: string[];
43
+ }
44
+ export declare function readCampaignDraftContent(content: Readonly<Record<string, unknown>>): {
45
+ ok: true;
46
+ value: CampaignDraftContent;
47
+ } | {
48
+ ok: false;
49
+ problems: string[];
50
+ };
51
+ export interface CampaignDraftWriterDeps {
52
+ /** The Admin SDK handle; specs hand in a double. */
53
+ firestore?: () => FirebaseFirestore.Firestore;
54
+ }
55
+ export declare function createCampaignDraftWriter(deps?: CampaignDraftWriterDeps): PluginResourceDraftWriter;
56
+ export declare const campaignDraftWriter: PluginResourceDraftWriter;
57
+ /**
58
+ * Registers the writer; the console surface calls it, since only the console
59
+ * runs AI jobs (AGL-3026). Idempotent: a second call replaces the first.
60
+ */
61
+ export declare function registerCampaignDraftWriter(): void;
62
+ export declare const campaignManageHandler: PluginApiHandler;