@aglyn/plugins-marketing 1.0.0-beta.218 → 1.0.0-beta.219

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 (57) hide show
  1. package/README.md +2 -0
  2. package/package.json +15 -15
  3. package/src/lib/analytics-provider.d.ts +177 -0
  4. package/src/lib/analytics-provider.js +370 -0
  5. package/src/lib/analytics-provider.js.map +1 -0
  6. package/src/lib/components/campaign-detail-card.js +16 -16
  7. package/src/lib/components/campaign-detail-card.js.map +1 -1
  8. package/src/lib/components/campaign-members-section.js +11 -11
  9. package/src/lib/components/campaign-members-section.js.map +1 -1
  10. package/src/lib/components/campaign-report-card.js +6 -4
  11. package/src/lib/components/campaign-report-card.js.map +1 -1
  12. package/src/lib/components/campaigns-card.js +1 -1
  13. package/src/lib/components/campaigns-card.js.map +1 -1
  14. package/src/lib/components/conversion-attribution.component.js +1 -1
  15. package/src/lib/components/conversion-attribution.component.js.map +1 -1
  16. package/src/lib/components/email-detail.js +12 -7
  17. package/src/lib/components/email-detail.js.map +1 -1
  18. package/src/lib/components/email-messages-widget.js +1 -1
  19. package/src/lib/components/email-messages-widget.js.map +1 -1
  20. package/src/lib/components/emails-list-card.js +11 -5
  21. package/src/lib/components/emails-list-card.js.map +1 -1
  22. package/src/lib/components/host-experiments-card.component.js +12 -7
  23. package/src/lib/components/host-experiments-card.component.js.map +1 -1
  24. package/src/lib/components/org-experiments-card.js +1 -1
  25. package/src/lib/components/org-experiments-card.js.map +1 -1
  26. package/src/lib/components/record-route-context.d.ts +41 -0
  27. package/src/lib/components/record-route-context.js +63 -0
  28. package/src/lib/components/record-route-context.js.map +1 -0
  29. package/src/lib/components/use-marketing-hub-path.d.ts +18 -5
  30. package/src/lib/components/use-marketing-hub-path.js +36 -6
  31. package/src/lib/components/use-marketing-hub-path.js.map +1 -1
  32. package/src/lib/model/campaign-send-time.d.ts +74 -0
  33. package/src/lib/model/campaign-send-time.js +120 -0
  34. package/src/lib/model/campaign-send-time.js.map +1 -0
  35. package/src/lib/model/experiments.js +1 -1
  36. package/src/lib/model/experiments.js.map +1 -1
  37. package/src/lib/server/campaign-batch-plan.d.ts +73 -0
  38. package/src/lib/server/campaign-batch-plan.js +79 -0
  39. package/src/lib/server/campaign-batch-plan.js.map +1 -0
  40. package/src/lib/server/campaign-send.js +10 -5
  41. package/src/lib/server/campaign-send.js.map +1 -1
  42. package/src/lib/server/email-events.js +7 -6
  43. package/src/lib/server/email-events.js.map +1 -1
  44. package/src/lib/server/list-send-time-facts.d.ts +60 -0
  45. package/src/lib/server/list-send-time-facts.js +108 -0
  46. package/src/lib/server/list-send-time-facts.js.map +1 -0
  47. package/src/lib/server.js +4 -0
  48. package/src/lib/server.js.map +1 -1
  49. package/src/lib/tenant-emails.d.ts +29 -0
  50. package/src/lib/tenant-emails.js +41 -0
  51. package/src/lib/tenant-emails.js.map +1 -0
  52. package/src/lib/testing/stand-in-emails-page-routes.d.ts +27 -0
  53. package/src/lib/testing/stand-in-emails-page-routes.js +42 -0
  54. package/src/lib/testing/stand-in-emails-page-routes.js.map +1 -0
  55. package/src/lib/components/use-emails-hub-path.d.ts +0 -58
  56. package/src/lib/components/use-emails-hub-path.js +0 -109
  57. package/src/lib/components/use-emails-hub-path.js.map +0 -1
@@ -0,0 +1,29 @@
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 { TenantEmailEntry } from '@aglyn/shared-util-email';
18
+ /**
19
+ * The emails a site sends its own customers through Marketing (AGL-769/770).
20
+ *
21
+ * Declared here, by the plugin that sends them, and compiled into the
22
+ * platform's tenant email catalog (`TENANT_EMAILS` in
23
+ * `@aglyn/shared-util-email`) by `tools/scripts/generate-plugin-manifests.mjs`
24
+ * (AGL-3080): the catalog's readers include the send path, which loads no
25
+ * plugin code, so a runtime registry it had not filled would quietly send
26
+ * the text card in place of the site's designed email. Regenerate after
27
+ * changing an entry; `--check` refuses a stale catalog.
28
+ */
29
+ export declare function marketingTenantEmails(): readonly TenantEmailEntry[];
@@ -0,0 +1,41 @@
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
+ * The emails a site sends its own customers through Marketing (AGL-769/770).
18
+ *
19
+ * Declared here, by the plugin that sends them, and compiled into the
20
+ * platform's tenant email catalog (`TENANT_EMAILS` in
21
+ * `@aglyn/shared-util-email`) by `tools/scripts/generate-plugin-manifests.mjs`
22
+ * (AGL-3080): the catalog's readers include the send path, which loads no
23
+ * plugin code, so a runtime registry it had not filled would quietly send
24
+ * the text card in place of the site's designed email. Regenerate after
25
+ * changing an entry; `--check` refuses a stale catalog.
26
+ */ export function marketingTenantEmails() {
27
+ return [
28
+ {
29
+ key: 'campaign',
30
+ name: 'Campaign broadcast',
31
+ description: "A campaign sent to the site's subscriber list.",
32
+ pluginId: 'marketing',
33
+ plugin: 'Marketing',
34
+ control: 'external',
35
+ authoredIn: 'Marketing → Campaigns',
36
+ footerReason: 'You’re receiving this email from {{host.businessName}}.'
37
+ }
38
+ ];
39
+ }
40
+
41
+ //# sourceMappingURL=tenant-emails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/plugins/marketing/src/lib/tenant-emails.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 type { TenantEmailEntry } from '@aglyn/shared-util-email'\n\n/**\n * The emails a site sends its own customers through Marketing (AGL-769/770).\n *\n * Declared here, by the plugin that sends them, and compiled into the\n * platform's tenant email catalog (`TENANT_EMAILS` in\n * `@aglyn/shared-util-email`) by `tools/scripts/generate-plugin-manifests.mjs`\n * (AGL-3080): the catalog's readers include the send path, which loads no\n * plugin code, so a runtime registry it had not filled would quietly send\n * the text card in place of the site's designed email. Regenerate after\n * changing an entry; `--check` refuses a stale catalog.\n */\nexport function marketingTenantEmails(): readonly TenantEmailEntry[] {\n return [\n {\n key: 'campaign',\n name: 'Campaign broadcast',\n description: \"A campaign sent to the site's subscriber list.\",\n pluginId: 'marketing',\n plugin: 'Marketing',\n control: 'external',\n authoredIn: 'Marketing → Campaigns',\n footerReason:\n 'You’re receiving this email from {{host.businessName}}.',\n },\n ]\n}\n"],"names":["marketingTenantEmails","key","name","description","pluginId","plugin","control","authoredIn","footerReason"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAID;;;;;;;;;;CAUC,GACD,OAAO,SAASA;IACd,OAAO;QACL;YACEC,KAAK;YACLC,MAAM;YACNC,aAAa;YACbC,UAAU;YACVC,QAAQ;YACRC,SAAS;YACTC,YAAY;YACZC,cACE;QACJ;KACD;AACH"}
@@ -0,0 +1,27 @@
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
+ /**
18
+ * The Emails page's record routes, as the email plugin publishes them
19
+ * (AGL-3080), stood in for this plugin's specs — a campaign links each
20
+ * message's report and the template it was built from, and this plugin may
21
+ * not load the email plugin that registers the real routes. What that plugin
22
+ * publishes is held in its own `email-record-routes.spec.ts`.
23
+ *
24
+ * Registered under the owner's id, `email`, so a spec asking what happens
25
+ * where it is not loaded unregisters that plugin's services.
26
+ */
27
+ export declare function standInEmailsPageRoutes(): void;
@@ -0,0 +1,42 @@
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 { registerPluginRecordRoute } from "@aglyn/aglyn/plugin-manager/plugin-record-routes";
17
+ /**
18
+ * The Emails page's record routes, as the email plugin publishes them
19
+ * (AGL-3080), stood in for this plugin's specs — a campaign links each
20
+ * message's report and the template it was built from, and this plugin may
21
+ * not load the email plugin that registers the real routes. What that plugin
22
+ * publishes is held in its own `email-record-routes.spec.ts`.
23
+ *
24
+ * Registered under the owner's id, `email`, so a spec asking what happens
25
+ * where it is not loaded unregisters that plugin's services.
26
+ */ export function standInEmailsPageRoutes() {
27
+ const hub = (orgSlug, host)=>host ? `/${orgSlug}/hosts/${host}/emails` : `/${orgSlug}/emails`;
28
+ registerPluginRecordRoute('emailMessage', {
29
+ list: ({ orgSlug, host })=>`${hub(orgSlug, host)}/messages`,
30
+ record: ({ orgSlug, host }, id)=>`${hub(orgSlug, host)}/messages/${encodeURIComponent(id)}`
31
+ }, {
32
+ pluginId: 'email'
33
+ });
34
+ registerPluginRecordRoute('emailTemplate', {
35
+ list: ({ orgSlug, host })=>host ? `${hub(orgSlug, host)}/templates` : null,
36
+ record: ({ orgSlug, host }, id)=>host ? `${hub(orgSlug, host)}/templates/${encodeURIComponent(id)}` : null
37
+ }, {
38
+ pluginId: 'email'
39
+ });
40
+ }
41
+
42
+ //# sourceMappingURL=stand-in-emails-page-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/marketing/src/lib/testing/stand-in-emails-page-routes.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 { registerPluginRecordRoute } from '@aglyn/aglyn/plugin-manager/plugin-record-routes'\n\n/**\n * The Emails page's record routes, as the email plugin publishes them\n * (AGL-3080), stood in for this plugin's specs — a campaign links each\n * message's report and the template it was built from, and this plugin may\n * not load the email plugin that registers the real routes. What that plugin\n * publishes is held in its own `email-record-routes.spec.ts`.\n *\n * Registered under the owner's id, `email`, so a spec asking what happens\n * where it is not loaded unregisters that plugin's services.\n */\nexport function standInEmailsPageRoutes(): void {\n const hub = (orgSlug: string, host: string | null) =>\n host ? `/${orgSlug}/hosts/${host}/emails` : `/${orgSlug}/emails`\n registerPluginRecordRoute(\n 'emailMessage',\n {\n list: ({ orgSlug, host }) => `${hub(orgSlug, host)}/messages`,\n record: ({ orgSlug, host }, id) => `${hub(orgSlug, host)}/messages/${encodeURIComponent(id)}`,\n },\n { pluginId: 'email' },\n )\n registerPluginRecordRoute(\n 'emailTemplate',\n {\n list: ({ orgSlug, host }) => (host ? `${hub(orgSlug, host)}/templates` : null),\n record: ({ orgSlug, host }, id) =>\n host ? `${hub(orgSlug, host)}/templates/${encodeURIComponent(id)}` : null,\n },\n { pluginId: 'email' },\n )\n}\n"],"names":["registerPluginRecordRoute","standInEmailsPageRoutes","hub","orgSlug","host","list","record","id","encodeURIComponent","pluginId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,yBAAyB,QAAQ,mDAAkD;AAE5F;;;;;;;;;CASC,GACD,OAAO,SAASC;IACd,MAAMC,MAAM,CAACC,SAAiBC,OAC5BA,OAAO,CAAC,CAAC,EAAED,QAAQ,OAAO,EAAEC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,EAAED,QAAQ,OAAO,CAAC;IAClEH,0BACE,gBACA;QACEK,MAAM,CAAC,EAAEF,OAAO,EAAEC,IAAI,EAAE,GAAK,GAAGF,IAAIC,SAASC,MAAM,SAAS,CAAC;QAC7DE,QAAQ,CAAC,EAAEH,OAAO,EAAEC,IAAI,EAAE,EAAEG,KAAO,GAAGL,IAAIC,SAASC,MAAM,UAAU,EAAEI,mBAAmBD,KAAK;IAC/F,GACA;QAAEE,UAAU;IAAQ;IAEtBT,0BACE,iBACA;QACEK,MAAM,CAAC,EAAEF,OAAO,EAAEC,IAAI,EAAE,GAAMA,OAAO,GAAGF,IAAIC,SAASC,MAAM,UAAU,CAAC,GAAG;QACzEE,QAAQ,CAAC,EAAEH,OAAO,EAAEC,IAAI,EAAE,EAAEG,KAC1BH,OAAO,GAAGF,IAAIC,SAASC,MAAM,WAAW,EAAEI,mBAAmBD,KAAK,GAAG;IACzE,GACA;QAAEE,UAAU;IAAQ;AAExB"}
@@ -1,58 +0,0 @@
1
- /**
2
- * The Emails console's URL: under the site being read, or the organization's
3
- * own Emails page on a surface mounted over the org.
4
- *
5
- * A campaign's page links to two records it does not own — the message that
6
- * was sent inside it, and the template that message was built from — and both
7
- * keep their pages on the Emails console. The shell hands a plugin page only
8
- * its OWN `basePath`, so the sibling hub is named here by its SLUG rather
9
- * than by editing the last segment off the current path: a slug is a string
10
- * this file can be searched for when a surface moves, and string surgery on
11
- * somebody else's path is a link that keeps resolving to the wrong place.
12
- *
13
- * Free, deliberately. The org slug and the subdomain are already in the URL
14
- * the console is on, so this reads the route rather than resolving the host
15
- * document — the two `getDoc`s that resolution costs would be paid on every
16
- * open of a campaign, to render a link. At the organization level the org
17
- * mount already carries the slug.
18
- *
19
- * The org answer comes from the MOUNT rather than from the route having no
20
- * site in it: a card is on the organization's page because it was handed the
21
- * org mount, and that is the fact a link to the org's messages has to follow.
22
- * A message is the org's document, so its page there is
23
- * `/[orgSlug]/emails/messages/{id}` — the Emails page over every site.
24
- *
25
- * `null` before the params resolve, so callers render plain text rather than
26
- * a link to nowhere.
27
- */
28
- export declare function useEmailsHubPath(): string | null;
29
- /**
30
- * The MARKETING console's URL: under the site being read, or the
31
- * organization's own Marketing hub on a page that names no site.
32
- *
33
- * Named for the same reason the Emails one is, from the opposite direction: a
34
- * converted record — a form submission in the Inbox, a contact in Contacts —
35
- * links to the campaign it came from, and those surfaces are handed their own
36
- * hub's `basePath`, not this one's.
37
- *
38
- * Campaigns belong to the organization, so the org-level CRM and the org
39
- * Marketing hub itself link a campaign to `/[orgSlug]/marketing/campaigns/{id}`.
40
- */
41
- export declare function useMarketingHubPath(): string | null;
42
- /** The organization's own Marketing hub, `/[orgSlug]/marketing`. */
43
- export declare function orgMarketingHubPath(orgSlug: string): string;
44
- /** The organization's own Emails page, `/[orgSlug]/emails`. */
45
- export declare function orgEmailsHubPath(orgSlug: string): string;
46
- /**
47
- * Any sibling hub's URL under the site being read, by plugin slug.
48
- *
49
- * One implementation, because "read the org slug and the subdomain off the
50
- * route rather than resolving the host document" is the property that keeps
51
- * these links free, and a second copy of it is where somebody pays for the
52
- * two `getDoc`s instead.
53
- *
54
- * `null` on a page that names no site: a site's hub is the only thing this
55
- * builds.
56
- */
57
- export declare function useConsoleHubPath(pluginSlug: string): string | null;
58
- export default useEmailsHubPath;
@@ -1,109 +0,0 @@
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
- */ 'use client';
17
- import { buildRoute, Route } from "@aglyn/aglyn";
18
- import { useParams } from "next/navigation";
19
- import { useMarketingOrgMount } from "./marketing-org-mount.js";
20
- /**
21
- * The Emails console's URL: under the site being read, or the organization's
22
- * own Emails page on a surface mounted over the org.
23
- *
24
- * A campaign's page links to two records it does not own — the message that
25
- * was sent inside it, and the template that message was built from — and both
26
- * keep their pages on the Emails console. The shell hands a plugin page only
27
- * its OWN `basePath`, so the sibling hub is named here by its SLUG rather
28
- * than by editing the last segment off the current path: a slug is a string
29
- * this file can be searched for when a surface moves, and string surgery on
30
- * somebody else's path is a link that keeps resolving to the wrong place.
31
- *
32
- * Free, deliberately. The org slug and the subdomain are already in the URL
33
- * the console is on, so this reads the route rather than resolving the host
34
- * document — the two `getDoc`s that resolution costs would be paid on every
35
- * open of a campaign, to render a link. At the organization level the org
36
- * mount already carries the slug.
37
- *
38
- * The org answer comes from the MOUNT rather than from the route having no
39
- * site in it: a card is on the organization's page because it was handed the
40
- * org mount, and that is the fact a link to the org's messages has to follow.
41
- * A message is the org's document, so its page there is
42
- * `/[orgSlug]/emails/messages/{id}` — the Emails page over every site.
43
- *
44
- * `null` before the params resolve, so callers render plain text rather than
45
- * a link to nowhere.
46
- */ export function useEmailsHubPath() {
47
- const orgMount = useMarketingOrgMount();
48
- const siteHub = useConsoleHubPath(EMAILS_SLUG);
49
- return orgMount ? orgEmailsHubPath(orgMount.orgSlug) : siteHub;
50
- }
51
- /**
52
- * The MARKETING console's URL: under the site being read, or the
53
- * organization's own Marketing hub on a page that names no site.
54
- *
55
- * Named for the same reason the Emails one is, from the opposite direction: a
56
- * converted record — a form submission in the Inbox, a contact in Contacts —
57
- * links to the campaign it came from, and those surfaces are handed their own
58
- * hub's `basePath`, not this one's.
59
- *
60
- * Campaigns belong to the organization, so the org-level CRM and the org
61
- * Marketing hub itself link a campaign to `/[orgSlug]/marketing/campaigns/{id}`.
62
- */ export function useMarketingHubPath() {
63
- const params = useParams();
64
- const orgSlug = params == null ? void 0 : params.orgSlug;
65
- if (!orgSlug) return null;
66
- return (params == null ? void 0 : params.host) ? buildRoute(Route.HOST_PLUGIN, {
67
- orgSlug,
68
- host: params.host,
69
- pluginSlug: MARKETING_SLUG
70
- }) : orgMarketingHubPath(orgSlug);
71
- }
72
- /** The Marketing hub's URL slug, under a site and under the org alike. */ const MARKETING_SLUG = 'marketing';
73
- /** The Emails console's URL slug, under a site and under the org alike. */ const EMAILS_SLUG = 'emails';
74
- /** The organization's own Marketing hub, `/[orgSlug]/marketing`. */ export function orgMarketingHubPath(orgSlug) {
75
- return buildRoute(Route.ORG_PLUGIN, {
76
- orgSlug,
77
- pluginSlug: MARKETING_SLUG
78
- });
79
- }
80
- /** The organization's own Emails page, `/[orgSlug]/emails`. */ export function orgEmailsHubPath(orgSlug) {
81
- return buildRoute(Route.ORG_PLUGIN, {
82
- orgSlug,
83
- pluginSlug: EMAILS_SLUG
84
- });
85
- }
86
- /**
87
- * Any sibling hub's URL under the site being read, by plugin slug.
88
- *
89
- * One implementation, because "read the org slug and the subdomain off the
90
- * route rather than resolving the host document" is the property that keeps
91
- * these links free, and a second copy of it is where somebody pays for the
92
- * two `getDoc`s instead.
93
- *
94
- * `null` on a page that names no site: a site's hub is the only thing this
95
- * builds.
96
- */ export function useConsoleHubPath(pluginSlug) {
97
- const params = useParams();
98
- const orgSlug = params == null ? void 0 : params.orgSlug;
99
- const host = params == null ? void 0 : params.host;
100
- if (!orgSlug || !host) return null;
101
- return buildRoute(Route.HOST_PLUGIN, {
102
- orgSlug,
103
- host,
104
- pluginSlug
105
- });
106
- }
107
- export default useEmailsHubPath;
108
-
109
- //# sourceMappingURL=use-emails-hub-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/marketing/src/lib/components/use-emails-hub-path.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'use client'\n\nimport { buildRoute, Route } from '@aglyn/aglyn'\nimport { useParams } from 'next/navigation'\nimport { useMarketingOrgMount } from './marketing-org-mount'\n\n/**\n * The Emails console's URL: under the site being read, or the organization's\n * own Emails page on a surface mounted over the org.\n *\n * A campaign's page links to two records it does not own — the message that\n * was sent inside it, and the template that message was built from — and both\n * keep their pages on the Emails console. The shell hands a plugin page only\n * its OWN `basePath`, so the sibling hub is named here by its SLUG rather\n * than by editing the last segment off the current path: a slug is a string\n * this file can be searched for when a surface moves, and string surgery on\n * somebody else's path is a link that keeps resolving to the wrong place.\n *\n * Free, deliberately. The org slug and the subdomain are already in the URL\n * the console is on, so this reads the route rather than resolving the host\n * document — the two `getDoc`s that resolution costs would be paid on every\n * open of a campaign, to render a link. At the organization level the org\n * mount already carries the slug.\n *\n * The org answer comes from the MOUNT rather than from the route having no\n * site in it: a card is on the organization's page because it was handed the\n * org mount, and that is the fact a link to the org's messages has to follow.\n * A message is the org's document, so its page there is\n * `/[orgSlug]/emails/messages/{id}` — the Emails page over every site.\n *\n * `null` before the params resolve, so callers render plain text rather than\n * a link to nowhere.\n */\nexport function useEmailsHubPath(): string | null {\n const orgMount = useMarketingOrgMount()\n const siteHub = useConsoleHubPath(EMAILS_SLUG)\n return orgMount ? orgEmailsHubPath(orgMount.orgSlug) : siteHub\n}\n\n/**\n * The MARKETING console's URL: under the site being read, or the\n * organization's own Marketing hub on a page that names no site.\n *\n * Named for the same reason the Emails one is, from the opposite direction: a\n * converted record — a form submission in the Inbox, a contact in Contacts —\n * links to the campaign it came from, and those surfaces are handed their own\n * hub's `basePath`, not this one's.\n *\n * Campaigns belong to the organization, so the org-level CRM and the org\n * Marketing hub itself link a campaign to `/[orgSlug]/marketing/campaigns/{id}`.\n */\nexport function useMarketingHubPath(): string | null {\n const params = useParams<{ orgSlug: string; host: string }>()\n const orgSlug = params?.orgSlug\n if (!orgSlug) return null\n return params?.host\n ? buildRoute(Route.HOST_PLUGIN, {\n orgSlug,\n host: params.host,\n pluginSlug: MARKETING_SLUG,\n })\n : orgMarketingHubPath(orgSlug)\n}\n\n/** The Marketing hub's URL slug, under a site and under the org alike. */\nconst MARKETING_SLUG = 'marketing'\n\n/** The Emails console's URL slug, under a site and under the org alike. */\nconst EMAILS_SLUG = 'emails'\n\n/** The organization's own Marketing hub, `/[orgSlug]/marketing`. */\nexport function orgMarketingHubPath(orgSlug: string): string {\n return buildRoute(Route.ORG_PLUGIN, { orgSlug, pluginSlug: MARKETING_SLUG })\n}\n\n/** The organization's own Emails page, `/[orgSlug]/emails`. */\nexport function orgEmailsHubPath(orgSlug: string): string {\n return buildRoute(Route.ORG_PLUGIN, { orgSlug, pluginSlug: EMAILS_SLUG })\n}\n\n/**\n * Any sibling hub's URL under the site being read, by plugin slug.\n *\n * One implementation, because \"read the org slug and the subdomain off the\n * route rather than resolving the host document\" is the property that keeps\n * these links free, and a second copy of it is where somebody pays for the\n * two `getDoc`s instead.\n *\n * `null` on a page that names no site: a site's hub is the only thing this\n * builds.\n */\nexport function useConsoleHubPath(pluginSlug: string): string | null {\n const params = useParams<{ orgSlug: string; host: string }>()\n const orgSlug = params?.orgSlug\n const host = params?.host\n if (!orgSlug || !host) return null\n return buildRoute(Route.HOST_PLUGIN, { orgSlug, host, pluginSlug })\n}\n\nexport default useEmailsHubPath\n"],"names":["buildRoute","Route","useParams","useMarketingOrgMount","useEmailsHubPath","orgMount","siteHub","useConsoleHubPath","EMAILS_SLUG","orgEmailsHubPath","orgSlug","useMarketingHubPath","params","host","HOST_PLUGIN","pluginSlug","MARKETING_SLUG","orgMarketingHubPath","ORG_PLUGIN"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;AAEA,SAASA,UAAU,EAAEC,KAAK,QAAQ,eAAc;AAChD,SAASC,SAAS,QAAQ,kBAAiB;AAC3C,SAASC,oBAAoB,QAAQ,2BAAuB;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,SAASC;IACd,MAAMC,WAAWF;IACjB,MAAMG,UAAUC,kBAAkBC;IAClC,OAAOH,WAAWI,iBAAiBJ,SAASK,OAAO,IAAIJ;AACzD;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASK;IACd,MAAMC,SAASV;IACf,MAAMQ,UAAUE,0BAAAA,OAAQF,OAAO;IAC/B,IAAI,CAACA,SAAS,OAAO;IACrB,OAAOE,CAAAA,0BAAAA,OAAQC,IAAI,IACfb,WAAWC,MAAMa,WAAW,EAAE;QAC5BJ;QACAG,MAAMD,OAAOC,IAAI;QACjBE,YAAYC;IACd,KACAC,oBAAoBP;AAC1B;AAEA,wEAAwE,GACxE,MAAMM,iBAAiB;AAEvB,yEAAyE,GACzE,MAAMR,cAAc;AAEpB,kEAAkE,GAClE,OAAO,SAASS,oBAAoBP,OAAe;IACjD,OAAOV,WAAWC,MAAMiB,UAAU,EAAE;QAAER;QAASK,YAAYC;IAAe;AAC5E;AAEA,6DAA6D,GAC7D,OAAO,SAASP,iBAAiBC,OAAe;IAC9C,OAAOV,WAAWC,MAAMiB,UAAU,EAAE;QAAER;QAASK,YAAYP;IAAY;AACzE;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASD,kBAAkBQ,UAAkB;IAClD,MAAMH,SAASV;IACf,MAAMQ,UAAUE,0BAAAA,OAAQF,OAAO;IAC/B,MAAMG,OAAOD,0BAAAA,OAAQC,IAAI;IACzB,IAAI,CAACH,WAAW,CAACG,MAAM,OAAO;IAC9B,OAAOb,WAAWC,MAAMa,WAAW,EAAE;QAAEJ;QAASG;QAAME;IAAW;AACnE;AAEA,eAAeX,iBAAgB"}