@aglyn/shared-util-email 1.0.0-beta.200 → 1.0.0-beta.202

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 (41) hide show
  1. package/package.json +3 -3
  2. package/src/index.d.ts +6 -0
  3. package/src/index.js +16 -0
  4. package/src/index.js.map +1 -1
  5. package/src/lib/email-deliverability.d.ts +200 -0
  6. package/src/lib/email-deliverability.js +461 -0
  7. package/src/lib/email-deliverability.js.map +1 -0
  8. package/src/lib/email-delivery-events.d.ts +16 -39
  9. package/src/lib/email-delivery-events.js +28 -12
  10. package/src/lib/email-delivery-events.js.map +1 -1
  11. package/src/lib/email-linkify.d.ts +24 -0
  12. package/src/lib/email-linkify.js +73 -0
  13. package/src/lib/email-linkify.js.map +1 -0
  14. package/src/lib/email-render.js +6 -1
  15. package/src/lib/email-render.js.map +1 -1
  16. package/src/lib/hosted-page-screen.d.ts +60 -0
  17. package/src/lib/hosted-page-screen.js +314 -0
  18. package/src/lib/hosted-page-screen.js.map +1 -0
  19. package/src/lib/mail-bounce.d.ts +42 -0
  20. package/src/lib/mail-bounce.js +108 -0
  21. package/src/lib/mail-bounce.js.map +1 -0
  22. package/src/lib/mail-gateway.d.ts +161 -0
  23. package/src/lib/mail-gateway.js +330 -0
  24. package/src/lib/mail-gateway.js.map +1 -0
  25. package/src/lib/outbound-phishing-screen.d.ts +248 -0
  26. package/src/lib/outbound-phishing-screen.js +769 -0
  27. package/src/lib/outbound-phishing-screen.js.map +1 -0
  28. package/src/lib/outbound-screen-gate.d.ts +95 -0
  29. package/src/lib/outbound-screen-gate.js +109 -0
  30. package/src/lib/outbound-screen-gate.js.map +1 -0
  31. package/src/lib/send-email.d.ts +79 -1
  32. package/src/lib/send-email.js +153 -10
  33. package/src/lib/send-email.js.map +1 -1
  34. package/src/lib/sending-domain.d.ts +22 -1
  35. package/src/lib/sending-domain.js +0 -95
  36. package/src/lib/sending-domain.js.map +1 -1
  37. package/src/lib/system-email-catalog.js +400 -0
  38. package/src/lib/system-email-catalog.js.map +1 -1
  39. package/src/lib/text-email-html.d.ts +38 -0
  40. package/src/lib/text-email-html.js +3 -44
  41. package/src/lib/text-email-html.js.map +1 -1
@@ -756,6 +756,406 @@ const BASE_SYSTEM_EMAIL_TEMPLATES = [
756
756
  footerReason: 'You’re receiving this because someone asked to add this address ' + 'to a {{brand.productName}} account.',
757
757
  source: 'apps/console/app/api/account/emails/route.ts'
758
758
  },
759
+ // AGL-3367. The platform's other senders, each of which composed its
760
+ // own plain text and so went out with no header or footer. A sender whose
761
+ // message is assembled per send (a digest's list, an alert's figures)
762
+ // hands its composed text in as one body token: the built-in copy is that
763
+ // text in the brand's chrome, and a design can wrap it in anything else.
764
+ {
765
+ key: 'notification',
766
+ name: 'Notification',
767
+ description: 'The email copy of a console notification, sent to people who ' + 'turned email on for that kind of notification: staff alerts, ' + 'workspace-admin and site-manager notices.',
768
+ deliveredBy: 'resend',
769
+ defaultSubject: '{{notification.title}}',
770
+ mergeTokens: [
771
+ {
772
+ name: 'notification.title',
773
+ description: 'The notification, in one line',
774
+ sample: 'Subscription canceled'
775
+ },
776
+ {
777
+ name: 'notification.body',
778
+ description: 'The detail under it, when it has any',
779
+ sample: 'Test Org canceled, leaving the Advanced plan.'
780
+ },
781
+ {
782
+ name: 'notification.url',
783
+ description: 'Where the notification opens in the console',
784
+ sample: `${SAMPLE_CONSOLE_ORIGIN}/manage/notifications`
785
+ },
786
+ {
787
+ name: 'settingsUrl',
788
+ description: 'Notification settings, where email can be turned off',
789
+ sample: `${SAMPLE_CONSOLE_ORIGIN}/manage/notifications/settings`
790
+ }
791
+ ],
792
+ defaultBody: [
793
+ {
794
+ block: 'text',
795
+ text: '{{notification.title}}',
796
+ variant: 'heading'
797
+ },
798
+ {
799
+ block: 'text',
800
+ text: '{{notification.body}}',
801
+ variant: 'body'
802
+ },
803
+ {
804
+ block: 'button',
805
+ label: 'Open in {{brand.productName}}',
806
+ href: '{{notification.url}}'
807
+ },
808
+ {
809
+ block: 'text',
810
+ text: 'Change what you are emailed about: {{settingsUrl}}',
811
+ variant: 'caption'
812
+ }
813
+ ],
814
+ footerReason: 'You’re receiving this because you turned on email for these ' + 'notifications in {{brand.productName}}.',
815
+ source: 'libs/tenant/data/admin/src/lib/server/notifications.ts'
816
+ },
817
+ {
818
+ key: 'staff-alert',
819
+ name: 'Staff alert',
820
+ description: 'Operational alerts to STAFF_ALERT_EMAIL: free-tier AI spend, usage ' + 'margins, SSO re-verification and the like.',
821
+ deliveredBy: 'resend',
822
+ defaultSubject: '{{alert.subject}}',
823
+ mergeTokens: [
824
+ {
825
+ name: 'alert.subject',
826
+ description: 'The alert, in one line',
827
+ sample: 'Free AI spend at 80% of today’s ceiling'
828
+ },
829
+ {
830
+ name: 'alert.body',
831
+ description: 'The alert as its sender wrote it',
832
+ sample: 'Free-tier AI spend for 2026-09-28 (UTC) is at $40.00 of the $50.00 ceiling.'
833
+ }
834
+ ],
835
+ defaultBody: [
836
+ {
837
+ block: 'text',
838
+ text: '{{alert.body}}',
839
+ variant: 'body'
840
+ }
841
+ ],
842
+ footerReason: 'You’re receiving this because this address gets ' + '{{brand.productName}}’s staff alerts.',
843
+ source: 'libs/tenant/data/admin/src/lib/server/staff-alert-email.ts'
844
+ },
845
+ {
846
+ key: 'support-ticket-alert',
847
+ name: 'Support ticket to success manager',
848
+ description: 'Copies an organization’s named success manager on a support ticket ' + 'it opened or replied to.',
849
+ deliveredBy: 'resend',
850
+ defaultSubject: '{{ticket.heading}} — {{org.name}}: {{ticket.subject}}',
851
+ mergeTokens: [
852
+ {
853
+ name: 'ticket.heading',
854
+ description: '“New ticket” or “Ticket reply”',
855
+ sample: 'New ticket'
856
+ },
857
+ {
858
+ name: 'ticket.subject',
859
+ description: 'The ticket’s subject',
860
+ sample: 'Domain will not verify'
861
+ },
862
+ {
863
+ name: 'ticket.body',
864
+ description: 'Who wrote, and what they wrote',
865
+ sample: 'Test Org opened a support ticket.\nFrom: owner@example.com'
866
+ },
867
+ {
868
+ name: 'ticket.url',
869
+ description: 'The ticket in the staff console',
870
+ sample: `${SAMPLE_CONSOLE_ORIGIN}/admin/support`
871
+ },
872
+ {
873
+ name: 'manager.name',
874
+ description: 'The success manager’s name',
875
+ sample: 'Sam'
876
+ },
877
+ {
878
+ name: 'org.name',
879
+ description: 'The organization the ticket is from',
880
+ sample: 'Test Org'
881
+ }
882
+ ],
883
+ defaultBody: [
884
+ {
885
+ block: 'text',
886
+ text: '{{manager.name}},',
887
+ variant: 'body'
888
+ },
889
+ {
890
+ block: 'text',
891
+ text: '{{ticket.body}}',
892
+ variant: 'body'
893
+ },
894
+ {
895
+ block: 'button',
896
+ label: 'Open the ticket',
897
+ href: '{{ticket.url}}'
898
+ }
899
+ ],
900
+ footerReason: 'You’re receiving this because you are the success manager for ' + '{{org.name}} on {{brand.productName}}.',
901
+ source: 'apps/console/app/api/_lib/success-manager.ts'
902
+ },
903
+ {
904
+ key: 'workspace-notice',
905
+ name: 'Workspace notice',
906
+ description: 'Operational notices to a workspace’s people: usage alerts and SSO ' + 'domain lapses to its owners and admins, and a stopped outreach ' + 'mailbox to the member who connected it.',
907
+ deliveredBy: 'resend',
908
+ defaultSubject: '{{notice.subject}}',
909
+ mergeTokens: [
910
+ {
911
+ name: 'notice.subject',
912
+ description: 'The notice, in one line',
913
+ sample: 'Test Org has used 80% of this month’s emails'
914
+ },
915
+ {
916
+ name: 'notice.body',
917
+ description: 'The notice as its sender wrote it',
918
+ sample: 'Test Org has sent 8,000 of its 10,000 emails this month.'
919
+ },
920
+ {
921
+ name: 'org.name',
922
+ description: 'The workspace the notice is about',
923
+ sample: 'Test Org'
924
+ }
925
+ ],
926
+ defaultBody: [
927
+ {
928
+ block: 'text',
929
+ text: '{{notice.body}}',
930
+ variant: 'body'
931
+ }
932
+ ],
933
+ footerReason: 'You’re receiving this because you’re a member of {{org.name}} on ' + '{{brand.productName}}.',
934
+ source: 'libs/tenant/data/admin/src/lib/server/org-member-notice.ts'
935
+ },
936
+ {
937
+ key: 'member-email-alias-confirmation',
938
+ name: 'Member email address confirmation',
939
+ description: 'Sent to an address a workspace member asked to add as one of their ' + 'own, so mail from it is filed under the people it was written to.',
940
+ deliveredBy: 'resend',
941
+ defaultSubject: 'Confirm your address for {{org.name}}',
942
+ mergeTokens: [
943
+ {
944
+ name: 'member.name',
945
+ description: 'The member who asked',
946
+ sample: 'Alex'
947
+ },
948
+ {
949
+ name: 'address',
950
+ description: 'The address being confirmed',
951
+ sample: 'alex@example.com'
952
+ },
953
+ {
954
+ name: 'org.name',
955
+ description: 'The workspace',
956
+ sample: 'Test Org'
957
+ },
958
+ {
959
+ name: 'confirmUrl',
960
+ description: 'The one-time confirmation link',
961
+ sample: `${SAMPLE_CONSOLE_ORIGIN}/manage/account`
962
+ }
963
+ ],
964
+ defaultBody: [
965
+ {
966
+ block: 'text',
967
+ text: 'Confirm this address',
968
+ variant: 'heading'
969
+ },
970
+ {
971
+ block: 'text',
972
+ text: '{{member.name}} asked to add {{address}} as one of their own ' + 'email addresses in the {{org.name}} workspace on ' + '{{brand.productName}}. To confirm it, open the link while ' + 'signed in as that member.',
973
+ variant: 'body'
974
+ },
975
+ {
976
+ block: 'button',
977
+ label: 'Confirm the address',
978
+ href: '{{confirmUrl}}'
979
+ },
980
+ {
981
+ block: 'text',
982
+ text: 'Once it is confirmed, email sent from {{address}} with the ' + 'workspace’s capture address in BCC is filed under the person it ' + 'was written to. The link works for 24 hours.',
983
+ variant: 'body'
984
+ },
985
+ {
986
+ block: 'text',
987
+ text: 'If you did not expect this email, ignore it. Nothing changes ' + 'unless the member who asked opens the link.',
988
+ variant: 'caption'
989
+ }
990
+ ],
991
+ footerReason: 'You’re receiving this because a member of {{org.name}} on ' + '{{brand.productName}} asked to add this address to their account.',
992
+ source: 'libs/tenant/data/admin/src/lib/server/member-email-aliases.ts'
993
+ },
994
+ {
995
+ key: 'crm-daily-digest',
996
+ name: 'Daily CRM digest',
997
+ description: 'Each morning, a member’s overdue and due-today tasks and unworked ' + 'leads, for members who turned the digest on.',
998
+ deliveredBy: 'resend',
999
+ defaultSubject: '{{digest.subject}}',
1000
+ mergeTokens: [
1001
+ {
1002
+ name: 'digest.subject',
1003
+ description: 'The summary line',
1004
+ sample: '2 tasks overdue, 3 new leads'
1005
+ },
1006
+ {
1007
+ name: 'digest.body',
1008
+ description: 'The tasks and leads, one per line, with their links',
1009
+ sample: 'Overdue (2)\n- Call back Jordan · Sep 27, 9:00 AM'
1010
+ },
1011
+ {
1012
+ name: 'settingsUrl',
1013
+ description: 'Notification settings, where the digest is turned off',
1014
+ sample: `${SAMPLE_CONSOLE_ORIGIN}/manage/notifications/settings`
1015
+ }
1016
+ ],
1017
+ defaultBody: [
1018
+ {
1019
+ block: 'text',
1020
+ text: '{{digest.body}}',
1021
+ variant: 'body'
1022
+ },
1023
+ {
1024
+ block: 'text',
1025
+ text: 'Change what you are emailed about: {{settingsUrl}}',
1026
+ variant: 'caption'
1027
+ }
1028
+ ],
1029
+ footerReason: 'You’re receiving this each morning because the Daily CRM digest is ' + 'on in your {{brand.productName}} notification settings.',
1030
+ source: 'apps/console/app/api/crm/daily-digest/route.ts'
1031
+ },
1032
+ {
1033
+ key: 'crm-task-reminder',
1034
+ name: 'CRM task reminder',
1035
+ description: 'A reminder for CRM tasks that have come due.',
1036
+ deliveredBy: 'resend',
1037
+ defaultSubject: '{{reminder.subject}}',
1038
+ mergeTokens: [
1039
+ {
1040
+ name: 'reminder.subject',
1041
+ description: 'The task, or how many are due',
1042
+ sample: 'Reminder: Call back Jordan'
1043
+ },
1044
+ {
1045
+ name: 'reminder.body',
1046
+ description: 'The tasks, each with its link',
1047
+ sample: '- Call back Jordan · due today at 9:00 AM'
1048
+ },
1049
+ {
1050
+ name: 'settingsUrl',
1051
+ description: 'Notification settings, where reminders are turned off',
1052
+ sample: `${SAMPLE_CONSOLE_ORIGIN}/manage/notifications/settings`
1053
+ }
1054
+ ],
1055
+ defaultBody: [
1056
+ {
1057
+ block: 'text',
1058
+ text: '{{reminder.body}}',
1059
+ variant: 'body'
1060
+ },
1061
+ {
1062
+ block: 'text',
1063
+ text: 'Change what you are emailed about: {{settingsUrl}}',
1064
+ variant: 'caption'
1065
+ }
1066
+ ],
1067
+ footerReason: 'You’re receiving this because task reminders are on in your ' + '{{brand.productName}} notification settings.',
1068
+ source: 'apps/console/app/api/crm/task-reminders/route.ts'
1069
+ },
1070
+ {
1071
+ key: 'ai-insights-digest',
1072
+ name: 'Weekly insights digest',
1073
+ description: 'The week’s AI insights for a site, for members who turned the ' + 'digest on for that workspace.',
1074
+ deliveredBy: 'resend',
1075
+ defaultSubject: 'Your weekly insights for {{site.name}}',
1076
+ mergeTokens: [
1077
+ {
1078
+ name: 'site.name',
1079
+ description: 'The site the insights are about',
1080
+ sample: 'Test Site'
1081
+ },
1082
+ {
1083
+ name: 'digest.body',
1084
+ description: 'The insights, numbered, with their links',
1085
+ sample: '1. Visits from search rose 18% on last week.'
1086
+ }
1087
+ ],
1088
+ defaultBody: [
1089
+ {
1090
+ block: 'text',
1091
+ text: 'Weekly insights for {{site.name}}',
1092
+ variant: 'heading'
1093
+ },
1094
+ {
1095
+ block: 'text',
1096
+ text: '{{digest.body}}',
1097
+ variant: 'body'
1098
+ }
1099
+ ],
1100
+ footerReason: 'You’re receiving this because you turned on weekly insights in ' + '{{brand.productName}}.',
1101
+ source: 'libs/plugins/ai/src/lib/insights/ai-insight-digest.ts'
1102
+ },
1103
+ {
1104
+ key: 'legal-intake-receipt',
1105
+ name: 'Report and notice receipt',
1106
+ description: 'The receipt for an abuse report, a copyright notice or a ' + 'counter-notice, carrying its reference.',
1107
+ deliveredBy: 'resend',
1108
+ defaultSubject: '{{receipt.subject}}',
1109
+ mergeTokens: [
1110
+ {
1111
+ name: 'receipt.subject',
1112
+ description: 'What was received, and its reference',
1113
+ sample: 'Report received — AR-3F9K2'
1114
+ },
1115
+ {
1116
+ name: 'receipt.body',
1117
+ description: 'The receipt as the intake wrote it',
1118
+ sample: 'We have received your report about https://example.com.\n\nYour reference is AR-3F9K2.'
1119
+ }
1120
+ ],
1121
+ defaultBody: [
1122
+ {
1123
+ block: 'text',
1124
+ text: '{{receipt.body}}',
1125
+ variant: 'body'
1126
+ }
1127
+ ],
1128
+ footerReason: 'You’re receiving this because this address was given on a report ' + 'or notice sent to {{brand.productName}}.',
1129
+ source: 'apps/tenant/app/api/_legal-intake/acknowledge.ts'
1130
+ },
1131
+ {
1132
+ key: 'plugin-review-update',
1133
+ name: 'Plugin review update',
1134
+ description: 'Tells a marketplace publisher’s owners and admins what review ' + 'decided about their submission.',
1135
+ deliveredBy: 'resend',
1136
+ defaultSubject: '{{review.subject}}',
1137
+ mergeTokens: [
1138
+ {
1139
+ name: 'review.subject',
1140
+ description: 'The decision, in one line',
1141
+ sample: 'Your plugin was approved'
1142
+ },
1143
+ {
1144
+ name: 'review.body',
1145
+ description: 'The decision as review wrote it',
1146
+ sample: 'Test Plugin 1.2.0 passed review and is live in the marketplace.'
1147
+ }
1148
+ ],
1149
+ defaultBody: [
1150
+ {
1151
+ block: 'text',
1152
+ text: '{{review.body}}',
1153
+ variant: 'body'
1154
+ }
1155
+ ],
1156
+ footerReason: 'You’re receiving this because you manage a plugin published on ' + '{{brand.productName}}.',
1157
+ source: 'libs/plugins/marketplace/src/lib/server/publisher-review-email.ts'
1158
+ },
759
1159
  // Stripe-delivered billing email (AGL-767). Aglyn never composes these —
760
1160
  // Stripe sends them from the Dashboard's Customer-emails and Subscription
761
1161
  // settings, so they are listed for visibility only and are not designable.