@aglyn/plugins-marketing 1.0.0-beta.202 → 1.0.0-beta.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-marketing",
3
- "version": "1.0.0-beta.202",
3
+ "version": "1.0.0-beta.204",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,20 +25,20 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.0.0-beta.202",
29
- "@aglyn/shared-data-enums": "1.0.0-beta.202",
30
- "@aglyn/shared-data-mdi": "1.0.0-beta.202",
31
- "@aglyn/shared-ui-email-campaigns": "1.0.0-beta.202",
32
- "@aglyn/shared-ui-jsx": "1.0.0-beta.202",
33
- "@aglyn/shared-ui-jsx-forms": "1.0.0-beta.202",
34
- "@aglyn/shared-ui-next": "1.0.0-beta.202",
35
- "@aglyn/shared-ui-snackstack": "1.0.0-beta.202",
36
- "@aglyn/shared-util-email": "1.0.0-beta.202",
37
- "@aglyn/shared-util-http": "1.0.0-beta.202",
38
- "@aglyn/shared-util-timestamp": "1.0.0-beta.202",
39
- "@aglyn/tenant-data-admin": "1.0.0-beta.202",
40
- "@aglyn/tenant-feature-instance": "1.0.0-beta.202",
41
- "@aglyn/tenant-runtime": "1.0.0-beta.202",
28
+ "@aglyn/aglyn": "1.0.0-beta.204",
29
+ "@aglyn/shared-data-enums": "1.0.0-beta.204",
30
+ "@aglyn/shared-data-mdi": "1.0.0-beta.204",
31
+ "@aglyn/shared-ui-email-campaigns": "1.0.0-beta.204",
32
+ "@aglyn/shared-ui-jsx": "1.0.0-beta.204",
33
+ "@aglyn/shared-ui-jsx-forms": "1.0.0-beta.204",
34
+ "@aglyn/shared-ui-next": "1.0.0-beta.204",
35
+ "@aglyn/shared-ui-snackstack": "1.0.0-beta.204",
36
+ "@aglyn/shared-util-email": "1.0.0-beta.204",
37
+ "@aglyn/shared-util-http": "1.0.0-beta.204",
38
+ "@aglyn/shared-util-timestamp": "1.0.0-beta.204",
39
+ "@aglyn/tenant-data-admin": "1.0.0-beta.204",
40
+ "@aglyn/tenant-feature-instance": "1.0.0-beta.204",
41
+ "@aglyn/tenant-runtime": "1.0.0-beta.204",
42
42
  "@swc/helpers": "0.5.23"
43
43
  },
44
44
  "peerDependencies": {
@@ -25,6 +25,7 @@ import { consentGroupForSite, orgDataCollectionForHost, orgDataQueryForHost, fil
25
25
  // The leaf, not the barrel: this plugin's specs substitute the barrel
26
26
  // wholesale, and the lookup must reach the real index logic under them.
27
27
  import { findContactByEmail } from "@aglyn/tenant-data-admin/server/contact-email-index";
28
+ import { siteEmailFrame } from "@aglyn/tenant-data-admin/server/host-email-tokens";
28
29
  import { isDocumentId } from "@aglyn/tenant-data-admin/server/document-id";
29
30
  /*
30
31
  * The LEAF for the phishing screen's hold (AGL-3356), for the reason every
@@ -346,6 +347,8 @@ const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
346
347
  }));
347
348
  return {
348
349
  nodes,
350
+ // The design as saved, for which bands it draws itself (AGL-3372).
351
+ storedNodes: stored,
349
352
  products,
350
353
  subject: String((_screenSnapshot_get = screenSnapshot.get('emailSubject')) != null ? _screenSnapshot_get : ''),
351
354
  preheader: String((_screenSnapshot_get1 = screenSnapshot.get('emailPreheader')) != null ? _screenSnapshot_get1 : '')
@@ -1388,6 +1391,10 @@ export async function performCampaignSend(options) {
1388
1391
  // white-label store reads as that store's brand. Resolved once for the whole
1389
1392
  // batch from the owning org doc through the one shared resolver.
1390
1393
  const branding = resolveBrandingProfile(orgForHost == null ? void 0 : orgForHost.org);
1394
+ // The site's header, footer and theme (AGL-3370), once for the batch: a
1395
+ // typed message is drawn inside them, and a design's picked colors resolve
1396
+ // against the theme. A failed read sends what it sent before.
1397
+ const siteFrame = await siteEmailFrame(firestore, hostId, 'campaign').catch(()=>undefined);
1391
1398
  const campaignId = options.campaignId || createResourceUid();
1392
1399
  /*
1393
1400
  * Whether this send MINTS the record or writes onto one that already
@@ -1826,7 +1833,7 @@ export async function performCampaignSend(options) {
1826
1833
  * send path has already shipped, product blocks silently dropped and
1827
1834
  * merge tags resolving to empty strings for a whole audience, are both
1828
1835
  * invisible to a preview that does not run this exact code.
1829
- */ const message = renderRecipientEmail({
1836
+ */ const message = renderRecipientEmail(_extends({
1830
1837
  subject: (variant == null ? void 0 : (_variant_subject = variant.subject) == null ? void 0 : _variant_subject.trim()) || subject,
1831
1838
  preheader: options.preheader,
1832
1839
  /*
@@ -1857,7 +1864,9 @@ export async function performCampaignSend(options) {
1857
1864
  siteBase,
1858
1865
  hostId,
1859
1866
  unsubscribeUrl
1860
- });
1867
+ }, siteFrame ? {
1868
+ frame: siteFrame
1869
+ } : {}));
1861
1870
  await paceProviderRequest();
1862
1871
  const result = await sendEmail(_extends({
1863
1872
  to: email,
@@ -3079,7 +3088,7 @@ function storedSendOptionsFrom(snapshot, hostId, senderUid, followUp) {
3079
3088
  * `{{firstName|there}}` tells a merchant nothing about what a recipient
3080
3089
  * will read, and inventing a fictional contact would make a merge tag
3081
3090
  * that resolves to nothing look like one that works.
3082
- */ const rendered = renderRecipientEmail({
3091
+ */ const rendered = renderRecipientEmail(_extends({
3083
3092
  subject,
3084
3093
  preheader,
3085
3094
  content: template ? _extends({
@@ -3102,7 +3111,9 @@ function storedSendOptionsFrom(snapshot, hostId, senderUid, followUp) {
3102
3111
  // address into a page they are only reading. The footer's presence,
3103
3112
  // and its wording, is what the preview is showing.
3104
3113
  unsubscribeUrl: `${siteBase}/api/email/preferences`
3105
- });
3114
+ }, await siteEmailFrame(firestore, hostId, 'campaign').then((frame)=>({
3115
+ frame
3116
+ })).catch(()=>({}))));
3106
3117
  return res.status(200).json(_extends({}, rendered, {
3107
3118
  preheader: preheader || (template == null ? void 0 : template.preheader) || '',
3108
3119
  fromName: fromName || branding.fromName