emailengine-app 2.78.0 → 2.79.0

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 (142) hide show
  1. package/.ncurc.js +23 -13
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +29 -0
  4. package/config/e2e.toml +2 -1
  5. package/config/test.toml +2 -1
  6. package/data/google-crawlers.json +1 -1
  7. package/lib/account.js +70 -35
  8. package/lib/api-reference/format.js +91 -4
  9. package/lib/api-reference/model.js +144 -19
  10. package/lib/api-reference/schema-tree.js +282 -28
  11. package/lib/api-routes/account-routes.js +80 -34
  12. package/lib/api-routes/blocklist-routes.js +21 -47
  13. package/lib/api-routes/chat-routes.js +10 -12
  14. package/lib/api-routes/delivery-test-routes.js +6 -26
  15. package/lib/api-routes/export-routes.js +2 -0
  16. package/lib/api-routes/gateway-routes.js +52 -11
  17. package/lib/api-routes/license-routes.js +2 -0
  18. package/lib/api-routes/mailbox-routes.js +29 -26
  19. package/lib/api-routes/message-routes.js +27 -21
  20. package/lib/api-routes/oauth2-app-routes.js +11 -29
  21. package/lib/api-routes/operation-impact.js +80 -0
  22. package/lib/api-routes/outbox-routes.js +15 -5
  23. package/lib/api-routes/permission-map.js +397 -0
  24. package/lib/api-routes/route-helpers.js +223 -9
  25. package/lib/api-routes/route-metadata.js +28 -0
  26. package/lib/api-routes/settings-routes.js +30 -25
  27. package/lib/api-routes/stats-routes.js +2 -2
  28. package/lib/api-routes/submit-routes.js +53 -31
  29. package/lib/api-routes/template-routes.js +3 -0
  30. package/lib/api-routes/token-routes.js +319 -33
  31. package/lib/api-routes/webhook-route-routes.js +14 -4
  32. package/lib/auth-token.js +80 -8
  33. package/lib/consts.js +10 -0
  34. package/lib/db.js +20 -2
  35. package/lib/delivery-error.js +30 -1
  36. package/lib/email-client/base-client.js +27 -41
  37. package/lib/email-client/gmail-client.js +19 -10
  38. package/lib/email-client/imap/mailbox.js +23 -24
  39. package/lib/email-client/imap/subconnection.js +10 -7
  40. package/lib/email-client/imap/sync-operations.js +46 -46
  41. package/lib/email-client/imap-client.js +36 -26
  42. package/lib/email-client/message-builder.js +3 -3
  43. package/lib/email-client/notification-handler.js +1 -1
  44. package/lib/email-client/outlook/graph-api.js +10 -4
  45. package/lib/email-client/outlook-client.js +53 -54
  46. package/lib/email-client/smtp-pool-manager.js +1 -1
  47. package/lib/enum-descriptions.js +92 -2
  48. package/lib/export.js +1 -1
  49. package/lib/field-usage.js +133 -0
  50. package/lib/gateway.js +1 -1
  51. package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +3 -3
  52. package/lib/imapproxy/imap-core/lib/commands/id.js +2 -13
  53. package/lib/imapproxy/imap-core/lib/commands/starttls.js +1 -1
  54. package/lib/imapproxy/imap-core/lib/imap-command.js +21 -5
  55. package/lib/imapproxy/imap-core/lib/imap-connection.js +15 -5
  56. package/lib/imapproxy/imap-server.js +27 -7
  57. package/lib/license-beacon.js +4 -9
  58. package/lib/lists.js +49 -1
  59. package/lib/llm-pre-process.js +5 -5
  60. package/lib/logger.js +5 -1
  61. package/lib/metrics-collector.js +2 -2
  62. package/lib/oauth/gmail.js +9 -12
  63. package/lib/oauth/mail-ru.js +5 -7
  64. package/lib/oauth/outlook.js +9 -9
  65. package/lib/oauth/pubsub/google.js +25 -10
  66. package/lib/oauth/scope-checker.js +1 -1
  67. package/lib/oauth2-apps.js +223 -294
  68. package/lib/openapi/build-document.js +15 -7
  69. package/lib/openapi/joi-schema.js +20 -0
  70. package/lib/outbox.js +85 -17
  71. package/lib/pre-process.js +8 -8
  72. package/lib/queue-stats.js +49 -0
  73. package/lib/read-env-value.js +1 -1
  74. package/lib/reconnection-manager.js +2 -2
  75. package/lib/rewrite-text-nodes.js +4 -3
  76. package/lib/routes-ui.js +4 -0
  77. package/lib/schemas.js +216 -160
  78. package/lib/settings.js +84 -5
  79. package/lib/sub-script.js +2 -1
  80. package/lib/swagger-options.js +2 -1
  81. package/lib/templates.js +4 -4
  82. package/lib/threads.js +2 -2
  83. package/lib/token-audit-log.js +208 -0
  84. package/lib/token-permission-view.js +219 -0
  85. package/lib/token-permissions.js +172 -0
  86. package/lib/tokens.js +99 -15
  87. package/lib/tools.js +142 -37
  88. package/lib/ui-routes/account-routes.js +31 -11
  89. package/lib/ui-routes/admin-config-routes.js +18 -10
  90. package/lib/ui-routes/admin-entities-routes.js +66 -22
  91. package/lib/ui-routes/auth-routes.js +30 -24
  92. package/lib/ui-routes/export-routes.js +10 -4
  93. package/lib/ui-routes/oauth-config-routes.js +5 -5
  94. package/lib/ui-routes/reference-routes.js +3 -3
  95. package/lib/ui-routes/route-helpers.js +51 -2
  96. package/lib/ui-routes/settings-page.js +1 -1
  97. package/lib/ui-routes/smtp-test-routes.js +1 -1
  98. package/lib/ui-routes/suppression-list-routes.js +294 -0
  99. package/lib/ui-routes/unsubscribe-routes.js +19 -29
  100. package/lib/utils/network.js +2 -2
  101. package/lib/web-safe-html.js +1 -1
  102. package/lib/webhook-routing.js +80 -0
  103. package/lib/webhooks.js +20 -14
  104. package/package.json +11 -10
  105. package/sbom.json +1 -1
  106. package/server.js +80 -41
  107. package/static/css/flyonui.css +1 -1
  108. package/static/css/src/app.tailwind.css +136 -9
  109. package/static/js/reference.js +456 -10
  110. package/static/js/ui.js +43 -0
  111. package/static/licenses.html +51 -41
  112. package/translations/messages.pot +59 -59
  113. package/views/accounts/account.hbs +69 -7
  114. package/views/accounts/browse.hbs +18 -35
  115. package/views/config/logging.hbs +6 -0
  116. package/views/config/oauth/app.hbs +0 -2
  117. package/views/config/security.hbs +13 -0
  118. package/views/partials/oauth_form.hbs +0 -15
  119. package/views/partials/reference/disclosure.hbs +8 -2
  120. package/views/partials/reference/operation.hbs +47 -13
  121. package/views/partials/reference/params.hbs +17 -1
  122. package/views/partials/reference/schema-node.hbs +110 -52
  123. package/views/partials/reference/schema-tools.hbs +25 -0
  124. package/views/partials/reference/try-it.hbs +84 -11
  125. package/views/partials/side_menu.hbs +1 -0
  126. package/views/partials/ui/checkbox.hbs +2 -2
  127. package/views/partials/ui/tabs.hbs +7 -1
  128. package/views/reference/token.hbs +4 -0
  129. package/views/suppression-lists/index.hbs +85 -0
  130. package/views/suppression-lists/list.hbs +87 -0
  131. package/views/templates/index.hbs +8 -2
  132. package/views/tokens/index.hbs +31 -4
  133. package/views/tokens/new.hbs +324 -2
  134. package/workers/api.js +146 -57
  135. package/workers/documents.js +46 -26
  136. package/workers/export.js +20 -8
  137. package/workers/imap-proxy.js +2 -2
  138. package/workers/imap.js +12 -6
  139. package/workers/smtp.js +13 -7
  140. package/workers/submit.js +40 -30
  141. package/workers/webhooks.js +59 -25
  142. package/lib/feature-flags.js +0 -48
@@ -6,21 +6,36 @@
6
6
  Requests go to this same instance, so they need a real access token - the shared
7
7
  token field at the top of the page feeds every panel.
8
8
 
9
- The request body is a plain <textarea> rather than an ACE editor on purpose: a tag
10
- page carries up to 13 operations, and mounting that many editors costs far more
11
- than the syntax highlighting is worth on a form that is usually submitted as-is.
9
+ The request body textarea stays in the server-rendered HTML and remains the value
10
+ everything downstream reads - the submit path, "Copy as curl" and the JSON validation.
11
+ static/js/reference.js upgrades it to an ACE editor and syncs back into it, so the panel
12
+ works unchanged with no JS and the editor is purely additive.
13
+
14
+ That upgrade is deliberately lazy on both axes. ace.js is 127 KB gzipped and no
15
+ reference page loads it otherwise, so it is fetched only once someone opens a Try it
16
+ panel that has a body; and the editor is mounted per panel on first open, because these
17
+ disclosures start closed and ACE cannot size itself in a container with no layout box.
18
+ Between them a tag page mounts one or two editors rather than the seven its bodies would
19
+ suggest, and a reader who never opens Try it pays nothing.
12
20
 
13
21
  Context is an operation view model from lib/api-reference/model.js.
14
22
  --}}
15
23
  {{#> reference/disclosure label="Try it" primary=true elId=(concat "try-" id) class="mt-4"}}
16
24
 
17
- <form class="ee-ref-try border-base-content/20 mt-3 rounded-box border p-4" data-method="{{method}}" data-path="{{path}}">
25
+ <form class="ee-ref-try border-base-content/20 mt-3 rounded-box border p-4" data-method="{{method}}" data-path="{{path}}"
26
+ {{#if tryImpact.confirm}}data-confirm="ee-ref-confirm-{{id}}" {{/if}}>
18
27
 
28
+ {{!-- Weight tracks consequence - see tryImpact() in lib/api-reference/model.js. A read
29
+ says nothing, an ordinary write gets one muted line, and only the operations that
30
+ destroy data or send mail get a warning box. The same warning on all 82 operations
31
+ is what taught readers to skim past the fourteen where it mattered. --}}
32
+ {{#if tryImpact.warn}}
19
33
  {{#> ui/alert-banner variant="warning"}}
20
- <div class="text-sm">Requests run against this EmailEngine instance with real data. A
21
- <code class="ee-code">{{methodLabel}}</code> here has the same effect as calling the API directly.
22
- </div>
34
+ <div class="text-sm">{{tryImpact.text}}</div>
23
35
  {{/ui/alert-banner}}
36
+ {{else if tryImpact}}
37
+ <p class="text-base-content/50 mb-3 text-xs">{{tryImpact.text}}</p>
38
+ {{/if}}
24
39
 
25
40
  {{#if pathParams.length}}
26
41
  <div class="mb-3 grid gap-3 sm:grid-cols-2">
@@ -46,11 +61,28 @@
46
61
  </div>
47
62
  {{/if}}
48
63
 
64
+ {{!-- Not a <label> wrapper: reference.js replaces the textarea with an ACE mount, which a
65
+ label cannot legitimately wrap. The heading is tied to the field by aria-label
66
+ instead, which survives the swap. data-schema names the rendered property tree the
67
+ completer harvests field names from - already on the page, so nothing is duplicated
68
+ into the markup for it. --}}
49
69
  {{#if body}}
50
- <label class="mb-3 block">
51
- {{> reference/section-heading label="Request body" suffix=body.contentType}}
52
- <textarea class="textarea mt-1 font-mono text-xs" rows="10" data-body spellcheck="false">{{body.exampleJson}}</textarea>
53
- </label>
70
+ <div class="mb-3" data-body-field data-schema="{{body.scopeId}}" {{#if body.completeJson}}data-complete-source="{{body.completeTabId}}" {{/if}}>
71
+ <div class="flex flex-wrap items-baseline justify-between gap-2">
72
+ {{> reference/section-heading label="Request body" suffix=body.contentType class=""}}
73
+ {{!-- The field starts on the typical payload, which is what most calls are. This
74
+ swaps in the complete one, because the panel is exactly where you find out
75
+ what else the endpoint takes: the reader is already editing the body.
76
+ Reads the JSON back out of the rendered tab panel above rather than
77
+ carrying a second copy of it in an attribute. --}}
78
+ {{#if body.completeJson}}
79
+ {{> ui/btn label="Fill in every field" bare=true style="text" size="xs" icon="icon-[tabler--list-details]"
80
+ class="ee-ref-try-fill" id=""}}
81
+ {{/if}}
82
+ </div>
83
+ <textarea class="textarea mt-1 font-mono text-xs" rows="10" data-body spellcheck="false"
84
+ aria-label="Request body">{{body.exampleJson}}</textarea>
85
+ </div>
54
86
  {{/if}}
55
87
 
56
88
  {{!-- id="" on both: ui/btn reads `id`, and Handlebars merges a partial's hash params into
@@ -75,4 +107,45 @@
75
107
 
76
108
  </form>
77
109
 
110
+ {{!-- Sits after the form rather than inside it, so the dialog is not a descendant of the
111
+ thing it is confirming. Nothing breaks if it moves; it just reads wrong.
112
+
113
+ Both buttons dismiss through ui/btn's `overlay` param, which is FlyonUI's own
114
+ data-overlay path and what every other modal in the admin UI uses. "Run it" carries a
115
+ class as well, so static/js/reference.js can tell an answer from a dismissal without
116
+ closing the overlay itself - see the note there. A class rather than an id because
117
+ ui/modal neutralizes `id` inside its block.
118
+
119
+ No neutralizing hash params on these three calls: ui/modal already neutralizes its own
120
+ for the block, reference/disclosure neutralizes `class`, and nothing else ui/btn reads
121
+ exists on the operation view model. The `id=""` on the buttons inside the form above is
122
+ a different case - the operation's own `id` is in context there.
123
+
124
+ static=true so neither Escape nor a stray backdrop click dismisses a confirmation; the
125
+ corner close button remains, and reads as declining like Cancel does. --}}
126
+ {{#if tryImpact.confirm}}
127
+ {{#> ui/modal id=(concat "ee-ref-confirm-" id) title="Run this request?" static=true}}
128
+ <div class="modal-body space-y-3">
129
+ <p class="text-sm">{{tryImpact.text}}</p>
130
+ <div>
131
+ <div class="text-base-content/50 text-2xs mb-1 tracking-wide uppercase">Request</div>
132
+ <pre class="ee-code-block text-xs"><code class="ee-ref-confirm-request"></code></pre>
133
+ </div>
134
+ {{!-- Deleting messages by search, flushing an account, submitting a message: these carry
135
+ what they act on in the body, so a dialog showing only the path would be confirming
136
+ the wrong half. Filled and unhidden by static/js/reference.js when the request has
137
+ one, and capped like the example payloads so a large body cannot outgrow the
138
+ dialog. --}}
139
+ <div class="ee-ref-confirm-body-wrap hidden">
140
+ <div class="text-base-content/50 text-2xs mb-1 tracking-wide uppercase">Body</div>
141
+ <pre class="ee-code-block ee-ref-example text-xs"><code class="ee-ref-confirm-body"></code></pre>
142
+ </div>
143
+ </div>
144
+ <div class="modal-footer">
145
+ {{> ui/btn label="Cancel" variant="neutral" style="soft" overlay=closeOverlay}}
146
+ {{> ui/btn label="Run it" variant="error" icon="icon-[tabler--alert-triangle]" class="ee-ref-confirm-run" overlay=closeOverlay}}
147
+ </div>
148
+ {{/ui/modal}}
149
+ {{/if}}
150
+
78
151
  {{/reference/disclosure}}
@@ -9,6 +9,7 @@
9
9
  {{> ui/menu-item href="/admin/accounts" label="Accounts" icon="icon-[tabler--users] size-4.5" active=menuAccounts}}
10
10
  {{> ui/menu-item href="/admin/gateways" label="Gateways" icon="icon-[tabler--send] size-4.5" active=menuGateways}}
11
11
  {{> ui/menu-item href="/admin/templates" label="Templates" icon="icon-[tabler--template] size-4.5" active=menuTemplates}}
12
+ {{> ui/menu-item href="/admin/suppression-lists" label="Suppression Lists" icon="icon-[tabler--mail-off] size-4.5" active=menuSuppressionLists}}
12
13
 
13
14
  {{> ui/menu-title label="Integrations"}}
14
15
  {{> ui/menu-item href="/admin/reference" label="API Reference" icon="icon-[tabler--file-code] size-4.5" active=menuReference}}
@@ -29,11 +29,11 @@
29
29
  <div class="flex items-center gap-2">
30
30
  <input type="checkbox" class="checkbox checkbox-sm{{#if error}} is-invalid{{/if}}{{#if class}} {{class}}{{/if}}"
31
31
  id="{{id}}" {{#unless noName}}name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}" {{/unless}}{{#if checked}}checked {{/if}}{{#if
32
- dataTarget}}data-target="{{dataTarget}}" {{/if}}{{#if dataReverse}}data-reverse="true" {{/if}}{{#if disabled}}disabled {{/if}}>
32
+ dataTarget}}data-target="{{dataTarget}}" {{/if}}{{#if dataValue}}data-value="{{dataValue}}" {{/if}}{{#if dataReverse}}data-reverse="true" {{/if}}{{#if disabled}}disabled {{/if}}>
33
33
  <label class="label-text p-0" for="{{id}}" {{#if labelTitle}}title="{{labelTitle}}" {{/if}}>{{label}}</label>
34
34
  {{#if @partial-block}}
35
35
  {{!-- own hash params are neutralized so they cannot fall through into nested ui/* calls inside the block --}}
36
- {{> @partial-block id="" label="" name="" noName="" labelTitle="" checked="" tooltip="" hint="" error="" dataTarget="" dataReverse="" disabled="" class=""}}
36
+ {{> @partial-block id="" label="" name="" noName="" labelTitle="" checked="" tooltip="" hint="" error="" dataTarget="" dataValue="" dataReverse="" disabled="" class=""}}
37
37
  {{/if}}
38
38
  {{#if tooltip}}
39
39
  {{!-- class="" blocks this partial's own class param (meant for the
@@ -8,12 +8,18 @@
8
8
  label - aria-label describing the strip (required)
9
9
  elId - element id (optional; see ui/badge for why it is not called `id`)
10
10
  class - extra classes on the nav, e.g. "mb-4" (optional)
11
+ flex-wrap because FlyonUI lays the strip out as a nowrap flex row with no overflow
12
+ handling, so one wider than its column pushes the whole page sideways instead of
13
+ adapting: an API reference operation documents up to eight status codes, which is 464px
14
+ of tabs against a 390px phone. Wrapping rather than scrolling because these are
15
+ navigation - a second row keeps every tab reachable, where a scroller hides some behind
16
+ an interaction with no affordance for it. No strip in the app wraps at desktop width.
11
17
  Panels are the caller's responsibility: each ui/tab target must match a
12
18
  tabpanel element with that id (role="tabpanel" aria-labelledby="<target>-tab").
13
19
  The auth-method tabs in oauth_form.hbs intentionally do NOT use this partial -
14
20
  they run a custom script instead of the FlyonUI data-tabs plugin.
15
21
  --}}
16
- <nav class="tabs tabs-bordered{{#if class}} {{class}}{{/if}}" aria-label="{{label}}" role="tablist"{{#if elId}} id="{{elId}}"{{/if}} data-tabs>
22
+ <nav class="tabs tabs-bordered flex-wrap{{#if class}} {{class}}{{/if}}" aria-label="{{label}}" role="tablist"{{#if elId}} id="{{elId}}"{{/if}} data-tabs>
17
23
  {{!-- own hash params neutralized against fallthrough into the block --}}
18
24
  {{> @partial-block label="" id="" class=""}}
19
25
  </nav>
@@ -35,6 +35,10 @@ subtitle="Enables the Try it panels on the endpoint pages."}}
35
35
  <span id="ref-token-clear-wrap" class="hidden">
36
36
  {{> ui/btn id="ref-token-clear" variant="neutral" style="text" size="sm" icon="icon-[tabler--x]" label="Clear"}}
37
37
  </span>
38
+ {{!-- How much of a minted token's hour is left, filled in and counted down by
39
+ static/js/reference.js. Deliberately not a live region: it changes every
40
+ minute, and announcing that each time is noise, not news. --}}
41
+ {{> ui/badge elId="ref-token-expiry" variant="primary" soft=true class="badge-sm hidden" label="" icon=""}}
38
42
  </div>
39
43
  <p class="text-base-content/50 mt-2 text-xs">Creates an API-scoped token that expires in one hour and activates it
40
44
  here. It is a real token until then - it appears on the
@@ -0,0 +1,85 @@
1
+ {{#> ui/page-header title="Suppression Lists" icon="icon-[tabler--mail-off]" subtitle="Recipients excluded from list-based sending. Only messages submitted with a listId are checked against these lists - the send skips every listed address. Messages without a listId are not affected." badgeLabel=total badgeVariant="neutral" class="mb-6"}}
2
+ {{> ui/btn label="Add address" icon="icon-[tabler--plus]" overlay="#addAddressModal"}}
3
+ {{/ui/page-header}}
4
+
5
+ {{#if suppressionLists}}
6
+ <div class="card bg-base-100 shadow-md mb-6">
7
+ <div class="overflow-x-auto">
8
+ <table class="table">
9
+ <thead>
10
+ <tr>
11
+ <th>List ID</th>
12
+ <th>Addresses</th>
13
+ <th class="w-12"><span class="sr-only">Actions</span></th>
14
+ </tr>
15
+ </thead>
16
+
17
+ <tbody>
18
+ {{#each suppressionLists}}
19
+ <tr class="hover:bg-base-200/60">
20
+ <td class="relative">
21
+ {{> ui/row-link href=(concat "/admin/suppression-lists/list/" listId) label="Open suppression list"}}
22
+ <strong>{{listId}}</strong>
23
+ </td>
24
+
25
+ <td class="relative">
26
+ {{> ui/row-link href=(concat "/admin/suppression-lists/list/" listId)}}{{count}}
27
+ </td>
28
+
29
+ <td class="relative text-end">
30
+ {{> ui/row-actions openHref=(concat "/admin/suppression-lists/list/" listId) label="Suppression list actions"
31
+ deleteModal="#deleteList" deleteId=listId deleteName=listId}}
32
+ </td>
33
+ </tr>
34
+ {{/each}}
35
+ </tbody>
36
+ </table>
37
+ </div>
38
+
39
+ {{> ui/pagination showPaging=showPaging prevPage=prevPage nextPage=nextPage pageLinks=pageLinks}}
40
+ </div>
41
+ {{else}}
42
+ {{> ui/list-empty noun="suppression lists" firstPage=firstPage createOverlay="#addAddressModal" createLabel="Add your first suppressed address"}}
43
+ {{/if}}
44
+
45
+ {{#> ui/details summary="How suppression lists work" class="card bg-base-100 shadow-md mb-6"}}
46
+ <div>
47
+ <p class="mb-2">
48
+ Suppression lists collect addresses that must not receive further emails. An address is
49
+ added when a recipient unsubscribes through the hosted subscription management page or
50
+ the one-click <em>List-Unsubscribe</em> action, through the <em>Blocklists</em> API, or
51
+ manually from this page. When a message is submitted with a <code>listId</code>,
52
+ recipients on that list are skipped; messages submitted without a
53
+ <code>listId</code> are never checked against these lists.
54
+ </p>
55
+ <p class="mb-2">
56
+ Lists are registered on first use: adding an address to a new list ID creates the list,
57
+ and removing the last address deletes it.
58
+ </p>
59
+ <p class="mb-2">
60
+ Each listed address links to its public subscription management page, the same page the
61
+ <em>List-Unsubscribe</em> link in emails opens. Use it to preview the page or send the
62
+ link to a recipient who wants to re-subscribe themselves.
63
+ </p>
64
+ <p class="mb-0"><a href="https://learn.emailengine.app/docs/advanced/virtual-lists" target="_blank"
65
+ rel="noopener noreferrer" referrerpolicy="no-referrer" class="link link-animated">Learn more about virtual
66
+ lists and sending with a listId</a>.</p>
67
+ </div>
68
+ {{/ui/details}}
69
+
70
+ {{#> ui/modal id="addAddressModal" title="Add suppressed address"}}
71
+ <form method="post" action="/admin/suppression-lists/add">
72
+ <input type="hidden" name="crumb" value="{{crumb}}">
73
+ <div class="modal-body space-y-4">
74
+ {{> ui/form-field id="add-list-id" name="listId" label="List ID" required=true placeholder="e.g. newsletter" hint="Subdomain name format. An unknown ID registers a new list."}}
75
+ {{> ui/form-field id="add-recipient" name="recipient" label="Email address" type="email" required=true placeholder="user@example.com"}}
76
+ {{> ui/form-field id="add-reason" name="reason" label="Reason" placeholder="block" hint="Optional identifier stored with the entry (default: block)."}}
77
+ </div>
78
+ <div class="modal-footer">
79
+ {{> ui/btn label="Cancel" variant="neutral" style="soft" overlay=closeOverlay}}
80
+ {{> ui/btn label="Add address" variant="primary" type="submit" icon="icon-[tabler--plus]"}}
81
+ </div>
82
+ </form>
83
+ {{/ui/modal}}
84
+
85
+ {{> ui/delete-modal id="deleteList" noun="suppression list" action="/admin/suppression-lists/delete" fieldName="listId"}}
@@ -0,0 +1,87 @@
1
+ {{> ui/breadcrumb parentHref="/admin/suppression-lists" parentLabel="Suppression Lists" current=listId class="mb-6"}}
2
+
3
+ {{#> ui/card}}
4
+
5
+ {{#> ui/detail-toolbar label="Suppression list actions"}}
6
+ {{> ui/btn variant="primary" style="outline" size="sm" icon="icon-[tabler--plus]" label="Add address" overlay="#addAddressModal"}}
7
+ {{> ui/btn variant="error" style="outline" size="sm" icon="icon-[tabler--trash]" label="Delete list" overlay="#deleteListModal"}}
8
+ {{/ui/detail-toolbar}}
9
+
10
+ <h6 class="card-title">{{listId}}</h6>
11
+ <h6 class="mb-6 text-base-content/60">{{total}} suppressed {{#equals total 1}}address{{else}}addresses{{/equals}}</h6>
12
+
13
+ <div class="overflow-x-auto">
14
+ <table class="table">
15
+ <thead>
16
+ <tr>
17
+ <th>Address</th>
18
+ <th>Reason</th>
19
+ <th>Source</th>
20
+ <th>Account</th>
21
+ <th>Added</th>
22
+ <th class="w-12"><span class="sr-only">Actions</span></th>
23
+ </tr>
24
+ </thead>
25
+
26
+ <tbody>
27
+ {{#each addresses}}
28
+ <tr class="hover:bg-base-200/60">
29
+ <td><strong>{{recipient}}</strong></td>
30
+ <td>{{reason}}</td>
31
+ <td>{{source}}</td>
32
+ <td>
33
+ {{#if account}}
34
+ <a href="/admin/accounts/{{account}}" class="link link-primary">{{account}}</a>
35
+ {{else}}
36
+ <span class="text-base-content/60">-</span>
37
+ {{/if}}
38
+ </td>
39
+ <td><span class="text-base-content/60">{{created}}</span></td>
40
+ <td class="relative text-end">
41
+ {{!-- The condition sits OUTSIDE the ui/row-actions block on purpose: a partial
42
+ block whose content is nothing but a {{#if}} wrapper loses its content to a
43
+ Handlebars program-association bug (the menu rendered without the items).
44
+ Keep the block's first content token a static element. --}}
45
+ {{#if unsubscribeUrl}}
46
+ {{#> ui/row-actions label="Address actions" deleteModal="#deleteEntry" deleteId=recipient deleteName=recipient}}
47
+ <li><a class="dropdown-item" href="{{unsubscribeUrl}}" target="_blank" rel="noopener noreferrer">
48
+ <span class="icon-[tabler--external-link] size-4"></span>
49
+ Subscription page</a></li>
50
+ <li><button type="button" class="dropdown-item copy-btn" data-copy-value="{{unsubscribeUrl}}">
51
+ <span class="icon-[tabler--copy] size-4"></span>
52
+ Copy page link</button></li>
53
+ {{/ui/row-actions}}
54
+ {{else}}
55
+ {{> ui/row-actions label="Address actions" deleteModal="#deleteEntry" deleteId=recipient deleteName=recipient}}
56
+ {{/if}}
57
+ </td>
58
+ </tr>
59
+ {{/each}}
60
+ </tbody>
61
+ </table>
62
+ </div>
63
+
64
+ {{> ui/pagination showPaging=showPaging prevPage=prevPage nextPage=nextPage pageLinks=pageLinks}}
65
+
66
+ {{/ui/card}}
67
+
68
+ {{#> ui/modal id="addAddressModal" title="Add suppressed address"}}
69
+ <form method="post" action="/admin/suppression-lists/add">
70
+ <input type="hidden" name="crumb" value="{{crumb}}">
71
+ <input type="hidden" name="listId" value="{{listId}}">
72
+ <div class="modal-body space-y-4">
73
+ {{> ui/form-field id="add-recipient" name="recipient" label="Email address" type="email" required=true placeholder="user@example.com"}}
74
+ {{> ui/form-field id="add-reason" name="reason" label="Reason" placeholder="block" hint="Optional identifier stored with the entry (default: block)."}}
75
+ </div>
76
+ <div class="modal-footer">
77
+ {{> ui/btn label="Cancel" variant="neutral" style="soft" overlay=closeOverlay}}
78
+ {{> ui/btn label="Add address" variant="primary" type="submit" icon="icon-[tabler--plus]"}}
79
+ </div>
80
+ </form>
81
+ {{/ui/modal}}
82
+
83
+ {{> ui/delete-modal id="deleteEntry" noun="address" action=(concat "/admin/suppression-lists/list/" listId "/remove") fieldName="recipient"}}
84
+
85
+ {{#> ui/confirm-modal id="deleteListModal" title="Delete suppression list" action="/admin/suppression-lists/delete" fieldName="listId" fieldValue=listId submitLabel="Delete list"}}
86
+ Are you sure you want to delete <strong>{{listId}}</strong> with all of its addresses? Everyone on this list becomes reachable again. This action cannot be undone.
87
+ {{/ui/confirm-modal}}
@@ -57,15 +57,21 @@
57
57
  {{> ui/pagination showPaging=showPaging prevPage=prevPage nextPage=nextPage pageLinks=pageLinks}}
58
58
  </div>
59
59
  {{else}}
60
- {{#> ui/list-empty noun="templates" query=query firstPage=firstPage createHref=newLink createLabel="Create your first template" clearHref="/admin/templates"}}
60
+ {{!-- The condition sits OUTSIDE the ui/list-empty block on purpose: a partial block whose
61
+ content is nothing but a {{#if}} wrapper loses its content to a Handlebars
62
+ program-association bug (the account note never rendered). Keep the block's first
63
+ content token a static element. --}}
61
64
  {{#if account}}
65
+ {{#> ui/list-empty noun="templates" query=query firstPage=firstPage createHref=newLink createLabel="Create your first template" clearHref="/admin/templates"}}
62
66
  <div class="mb-2">
63
67
  Currently showing email templates for <strong><a href="/admin/accounts/{{account.account}}"
64
68
  class="link link-animated">{{#if account.name}}{{account.name}}{{else}}{{account.email}}{{/if}}</a></strong>.
65
69
  These templates cannot be used by other accounts.
66
70
  </div>
67
- {{/if}}
68
71
  {{/ui/list-empty}}
72
+ {{else}}
73
+ {{> ui/list-empty noun="templates" query=query firstPage=firstPage createHref=newLink createLabel="Create your first template" clearHref="/admin/templates"}}
74
+ {{/if}}
69
75
  {{/if}}
70
76
 
71
77
  {{> ui/delete-modal id="deleteTemplate" noun="template" action="/admin/templates/delete" fieldName="template"}}
@@ -1,5 +1,14 @@
1
1
  {{#> ui/page-header title="Access Tokens" icon="icon-[tabler--key]" subtitle="Bearer tokens that authenticate requests to the EmailEngine API." badgeLabel=total badgeVariant="neutral" class="mb-6"}}
2
+ {{!-- Without an admin session the create form cannot submit, so the button would be an invitation
3
+ to lose the work. Disabled with the reason rather than hidden: the capability exists, it is the
4
+ instance that is not ready for it. --}}
5
+ {{#if canProvision}}
2
6
  {{> ui/btn href=newLink label="Create access token" icon="icon-[tabler--plus]"}}
7
+ {{else}}
8
+ {{#> ui/tooltip text="Set an admin password to issue access tokens"}}
9
+ {{> ui/btn href="/admin/account/password" variant="primary" style="soft" label="Create access token" icon="icon-[tabler--lock]"}}
10
+ {{/ui/tooltip}}
11
+ {{/if}}
3
12
  {{/ui/page-header}}
4
13
 
5
14
  {{> ui/search-crumb parentHref="/admin/tokens" parentLabel="Access Tokens" query=query}}
@@ -42,9 +51,21 @@
42
51
  {{/if}}
43
52
  </td>
44
53
 
45
- <td>
54
+ <td class="align-top">
46
55
  {{#if scopes}}
47
- {{#each scopes}}{{#unless first}}, {{/unless}}{{name}}{{/each}}
56
+ <div class="max-w-xs whitespace-normal">{{#each scopes}}{{#unless first}}, {{/unless}}{{name}}{{/each}}</div>
57
+ {{/if}}
58
+
59
+ {{#if permissionSummary}}
60
+ {{#if permissionSummary.unreadable}}
61
+ {{> ui/badge label="Unreadable restriction" variant="error" soft=true icon="" class="mt-1"}}
62
+ <div class="text-base-content/60 text-xs">Every request with this token is refused. Delete and reissue it.</div>
63
+ {{else}}
64
+ {{> ui/badge label="Restricted" variant="info" soft=true icon="" class="mt-1"}}
65
+ {{!-- Wraps and is width-capped: a token granted several sections produced one
66
+ long line that pushed the whole table into horizontal scroll. --}}
67
+ <div class="text-base-content/60 text-xs max-w-xs whitespace-normal">{{permissionSummary.sentence}}</div>
68
+ {{/if}}
48
69
  {{/if}}
49
70
  </td>
50
71
 
@@ -70,15 +91,21 @@
70
91
  </div>
71
92
 
72
93
  {{else}}
73
- {{#> ui/list-empty noun="access tokens" query=query firstPage=firstPage createHref=newLink createLabel="Create your first access token" clearHref="/admin/tokens"}}
94
+ {{!-- The condition sits OUTSIDE the ui/list-empty block on purpose: a partial block whose
95
+ content is nothing but a {{#if}} wrapper loses its content to a Handlebars
96
+ program-association bug (the account note never rendered). Keep the block's first
97
+ content token a static element. --}}
74
98
  {{#if account}}
99
+ {{#> ui/list-empty noun="access tokens" query=query firstPage=firstPage createHref=newLink createLabel="Create your first access token" clearHref="/admin/tokens"}}
75
100
  <div class="mb-2">
76
101
  Currently showing tokens for <strong><a href="/admin/accounts/{{account.account}}"
77
102
  class="link link-animated">{{#if account.name}}{{account.name}}{{else}}{{account.email}}{{/if}}</a></strong>.
78
103
  These tokens cannot be used by other accounts.
79
104
  </div>
80
- {{/if}}
81
105
  {{/ui/list-empty}}
106
+ {{else}}
107
+ {{> ui/list-empty noun="access tokens" query=query firstPage=firstPage createHref=newLink createLabel="Create your first access token" clearHref="/admin/tokens"}}
108
+ {{/if}}
82
109
  {{/if}}
83
110
 
84
111