emailengine-app 2.76.0 → 2.77.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 (102) hide show
  1. package/.github/workflows/release.yaml +24 -19
  2. package/.ncurc.js +14 -2
  3. package/.release-please-manifest.json +3 -0
  4. package/CHANGELOG.md +23 -0
  5. package/README.md +1 -1
  6. package/data/google-crawlers.json +1 -1
  7. package/encrypt.js +71 -4
  8. package/lib/address-strategies.js +18 -0
  9. package/lib/api-reference/code-samples.js +194 -0
  10. package/lib/api-reference/format.js +179 -0
  11. package/lib/api-reference/index.js +205 -0
  12. package/lib/api-reference/model.js +336 -0
  13. package/lib/api-reference/schema-tree.js +366 -0
  14. package/lib/api-routes/account-routes.js +117 -37
  15. package/lib/api-routes/behavior-notes.js +54 -0
  16. package/lib/api-routes/blocklist-routes.js +9 -9
  17. package/lib/api-routes/changes-routes.js +6 -4
  18. package/lib/api-routes/chat-routes.js +3 -3
  19. package/lib/api-routes/delivery-test-routes.js +24 -6
  20. package/lib/api-routes/export-routes.js +14 -12
  21. package/lib/api-routes/gateway-routes.js +11 -11
  22. package/lib/api-routes/license-routes.js +7 -7
  23. package/lib/api-routes/mailbox-routes.js +18 -9
  24. package/lib/api-routes/message-routes.js +55 -35
  25. package/lib/api-routes/oauth2-app-routes.js +22 -16
  26. package/lib/api-routes/outbox-routes.js +7 -7
  27. package/lib/api-routes/pubsub-routes.js +3 -3
  28. package/lib/api-routes/settings-routes.js +10 -9
  29. package/lib/api-routes/stats-routes.js +3 -3
  30. package/lib/api-routes/submit-routes.js +58 -8
  31. package/lib/api-routes/template-routes.js +13 -13
  32. package/lib/api-routes/token-routes.js +15 -10
  33. package/lib/api-routes/webhook-route-routes.js +5 -5
  34. package/lib/consts.js +7 -0
  35. package/lib/email-client/base-client.js +66 -12
  36. package/lib/enum-descriptions.js +130 -0
  37. package/lib/imapproxy/imap-server.js +30 -26
  38. package/lib/imapproxy/upstream-client.js +38 -0
  39. package/lib/oauth2-apps.js +9 -3
  40. package/lib/openapi/build-document.js +318 -0
  41. package/lib/openapi/index.js +95 -0
  42. package/lib/openapi/joi-schema.js +523 -0
  43. package/lib/routes-ui.js +5 -1
  44. package/lib/schemas.js +76 -17
  45. package/lib/swagger-options.js +173 -0
  46. package/lib/tokens.js +69 -5
  47. package/lib/ui-routes/admin-entities-routes.js +3 -0
  48. package/lib/ui-routes/dashboard-routes.js +2 -26
  49. package/lib/ui-routes/reference-routes.js +195 -0
  50. package/lib/ui-routes/route-helpers.js +11 -0
  51. package/package.json +9 -11
  52. package/prepare-bundle-deps.sh +28 -0
  53. package/release-please-config.json +11 -0
  54. package/sbom.json +0 -1
  55. package/server.js +10 -2
  56. package/static/css/flyonui.css +1 -1
  57. package/static/css/src/app.tailwind.css +90 -0
  58. package/static/js/ee-client.js +238 -8
  59. package/static/js/reference.js +736 -0
  60. package/static/js/ui.js +61 -33
  61. package/static/licenses.html +4 -4
  62. package/translations/messages.pot +27 -27
  63. package/views/config/ai.hbs +1 -1
  64. package/views/config/document-store/chat.hbs +5 -5
  65. package/views/config/document-store/index.hbs +2 -2
  66. package/views/config/document-store/pre-processing/index.hbs +1 -1
  67. package/views/config/email-processing.hbs +1 -1
  68. package/views/config/imap-proxy.hbs +1 -1
  69. package/views/config/license.hbs +1 -1
  70. package/views/config/oauth/index.hbs +3 -3
  71. package/views/config/security.hbs +1 -1
  72. package/views/config/smtp.hbs +2 -2
  73. package/views/dashboard.hbs +1 -1
  74. package/views/layout/app.hbs +18 -7
  75. package/views/partials/oauth_form.hbs +4 -4
  76. package/views/partials/reference/anchor-link.hbs +20 -0
  77. package/views/partials/reference/disclosure.hbs +37 -0
  78. package/views/partials/reference/nav.hbs +93 -0
  79. package/views/partials/reference/operation.hbs +127 -0
  80. package/views/partials/reference/params.hbs +20 -0
  81. package/views/partials/reference/schema-node.hbs +99 -0
  82. package/views/partials/reference/schema.hbs +19 -0
  83. package/views/partials/reference/section-heading.hbs +16 -0
  84. package/views/partials/reference/token-alert.hbs +24 -0
  85. package/views/partials/reference/try-field.hbs +31 -0
  86. package/views/partials/reference/try-it.hbs +78 -0
  87. package/views/partials/side_menu.hbs +1 -1
  88. package/views/partials/ui/badge.hbs +4 -2
  89. package/views/partials/ui/page-header.hbs +1 -1
  90. package/views/partials/ui/search-input.hbs +31 -0
  91. package/views/partials/ui/setting-ref.hbs +1 -1
  92. package/views/partials/ui/stat-card.hbs +4 -2
  93. package/views/partials/ui/tab.hbs +6 -1
  94. package/views/partials/ui/tabs.hbs +2 -2
  95. package/views/reference/index.hbs +76 -0
  96. package/views/reference/redirect.hbs +49 -0
  97. package/views/reference/tag.hbs +28 -0
  98. package/views/reference/token.hbs +49 -0
  99. package/views/tokens/index.hbs +9 -1
  100. package/views/webhooks/index.hbs +3 -3
  101. package/workers/api.js +37 -215
  102. package/views/swagger/index.hbs +0 -82
@@ -0,0 +1,93 @@
1
+ {{!--
2
+ reference/nav - the API reference's section navigation: an operation filter over the
3
+ whole API, and the tag list with the current tag's operations expanded.
4
+
5
+ Rendered by views/layout/app.hbs into the secondary-nav column (the route sets
6
+ `secondaryNav: 'reference/nav'`), so this partial owns only its inner content - the
7
+ column's surface, border, width and sticky behavior belong to the layout. It emits
8
+ no card or shadow on purpose: the column sits flush against the main sidebar and has
9
+ to read as a continuation of it.
10
+
11
+ The filter list is rendered server-side (all operations, hidden until the box has
12
+ input) and narrowed by static/js/reference.js. There is no client-side index to
13
+ fetch or build - filtering is plain DOM work over markup that is already there.
14
+
15
+ A hit matches on more than it shows: `data-search` carries the operation id and every
16
+ parameter and request-body property name as well. What is searchable is decided in one
17
+ place, searchCorpus() in lib/api-reference/model.js - so "mailbox" or "mailMerge" finds
18
+ the endpoints that accept them, not only the ones with the word in their path.
19
+
20
+ Params (from the reference view context):
21
+ nav - tags with { name, slug, operationCount, active, operations[] }
22
+ searchIndex - flat operation list backing the filter
23
+ --}}
24
+ <div class="flex flex-col gap-3 p-3">
25
+
26
+ {{!-- Back to the reference home. Without it the only way out of a group page is the
27
+ main side menu, which is easy to miss. --}}
28
+ <a href="/admin/reference"
29
+ class="flex items-center gap-2 rounded-field px-2 py-1.5 text-sm{{#if overviewActive}} bg-primary/10 text-primary font-semibold{{else}} hover:bg-base-200{{/if}}">
30
+ <span class="icon-[tabler--home] size-4 shrink-0"></span>
31
+ Overview
32
+ </a>
33
+
34
+ {{!-- Access-token status. Always a link to the control on the overview page, whatever
35
+ the current state - the try-it panels on every group page depend on it, so it has
36
+ to be reachable from all of them. The state text is repainted by
37
+ static/js/reference.js from the token held for this tab. --}}
38
+ <a href="/admin/reference/token"
39
+ class="flex items-center justify-between gap-2 rounded-field px-2 py-1.5 text-sm{{#if tokenActive}} bg-primary/10 text-primary font-semibold{{else}} hover:bg-base-200{{/if}}">
40
+ <span class="flex items-center gap-2">
41
+ <span class="icon-[tabler--key] size-4 shrink-0"></span>
42
+ Access token
43
+ </span>
44
+ <span id="ref-token-state" class="text-base-content/50 text-2xs">Not set</span>
45
+ </a>
46
+
47
+ {{> ui/search-input id="ref-filter" placeholder="Filter endpoints" shortcut="Ctrl K" shortcutMac="Cmd K" name="" value="" type="" class=""}}
48
+
49
+ {{!-- Result count and key hints, shown only while the filter has input. The count is a
50
+ live region so it is announced; the key hints are static decoration beside it. --}}
51
+ <div id="ref-filter-hint" class="text-base-content/50 hidden items-center justify-between gap-2 px-2 text-2xs">
52
+ <span role="status"></span>
53
+ <span aria-hidden="true">Up/Down move, Enter open</span>
54
+ </div>
55
+
56
+ <ul id="ref-filter-results" class="flex flex-col gap-0.5 hidden">
57
+ {{#each searchIndex}}
58
+ <li class="ee-ref-hit" data-search="{{search}}">
59
+ <a href="{{url}}" class="hover:bg-base-200 block rounded-field px-2 py-1.5">
60
+ <span class="flex items-center gap-2">
61
+ <span class="text-{{methodVariant}} shrink-0 font-mono text-2xs font-semibold">{{method}}</span>
62
+ <span class="text-base-content/80 truncate text-xs">{{path}}</span>
63
+ </span>
64
+ {{#if summary}}<span class="text-base-content/50 block truncate ps-1 text-2xs">{{summary}}</span>{{/if}}
65
+ </a>
66
+ </li>
67
+ {{/each}}
68
+ <li id="ref-filter-empty" class="text-base-content/50 hidden px-2 py-2 text-xs">No matching endpoints</li>
69
+ </ul>
70
+
71
+ <ul id="ref-tag-list" class="flex flex-col gap-0.5">
72
+ {{#each nav}}
73
+ <li>
74
+ <a href="/admin/reference/{{slug}}"
75
+ class="flex items-center justify-between gap-2 rounded-field px-2 py-1.5 text-sm{{#if active}} bg-primary/10 text-primary font-semibold{{else}} hover:bg-base-200{{/if}}">
76
+ <span class="truncate">{{name}}</span>
77
+ <span class="text-base-content/40 text-2xs">{{operationCount}}</span>
78
+ </a>
79
+ {{#if operations.length}}
80
+ <ul class="border-base-content/10 my-1 ms-3 border-s ps-2">
81
+ {{#each operations}}
82
+ <li>
83
+ <a href="#{{id}}"
84
+ class="text-base-content/70 hover:bg-base-200 hover:text-base-content block truncate rounded-field px-2 py-1 text-xs">{{summary}}</a>
85
+ </li>
86
+ {{/each}}
87
+ </ul>
88
+ {{/if}}
89
+ </li>
90
+ {{/each}}
91
+ </ul>
92
+
93
+ </div>
@@ -0,0 +1,127 @@
1
+ {{!--
2
+ reference/operation - one API operation: signature, parameters, request body,
3
+ responses, code samples and the try-it panel.
4
+
5
+ Context is an operation view model from lib/api-reference/model.js, decorated with
6
+ per-request `samples` in lib/api-reference/index.js.
7
+
8
+ descriptionHtml fields are pre-escaped in lib/api-reference/format.js (escape first,
9
+ then a closed tag set added back), which is why they render unescaped.
10
+
11
+ Tab ids (response.tabId, sample.tabId) are precomputed in the model: ui/tabs
12
+ neutralizes its own hash params inside the partial block, so the operation id is
13
+ not reachable from there to compose them with.
14
+ --}}
15
+ <section id="{{id}}" class="ee-ref-op card bg-base-100 mb-6 scroll-mt-20 shadow-md">
16
+ <div class="card-body">
17
+
18
+ <div class="flex flex-wrap items-center gap-2">
19
+ {{> ui/badge label=methodLabel variant=methodVariant icon="" class="font-mono" soft=""}}
20
+ <code class="text-sm font-semibold break-all">{{path}}</code>
21
+ {{#if deprecated}}
22
+ {{> ui/badge label="Deprecated" variant="warning" soft=true icon="" class=""}}
23
+ {{/if}}
24
+ {{> reference/anchor-link target=id label="Link to this operation" class="ms-auto" small=""}}
25
+ </div>
26
+
27
+ {{#if summary}}
28
+ <h3 class="text-base-content mt-2 text-lg font-semibold">{{summary}}</h3>
29
+ {{/if}}
30
+
31
+ {{#if descriptionHtml}}
32
+ <div class="text-base-content/70 mt-1 text-sm"><p>{{{descriptionHtml}}}</p></div>
33
+ {{/if}}
34
+
35
+ {{#if behavior.length}}
36
+ {{!-- notes are pre-escaped by formatDescription, hence the triple stash --}}
37
+ <div class="alert alert-soft alert-info mt-4 flex items-start gap-3" role="note">
38
+ <span class="icon-[tabler--info-circle] size-5 shrink-0"></span>
39
+ <div class="min-w-0 text-sm">
40
+ <div class="mb-1 font-semibold">Behavior</div>
41
+ <ul class="list-disc space-y-1 ps-4">
42
+ {{#each behavior}}<li>{{{this}}}</li>{{/each}}
43
+ </ul>
44
+ </div>
45
+ </div>
46
+ {{/if}}
47
+
48
+ {{> reference/params title="Path parameters" params=pathParams}}
49
+ {{> reference/params title="Query parameters" params=queryParams}}
50
+ {{> reference/params title="Headers" params=headerParams}}
51
+
52
+ {{#if body}}
53
+ <div class="mt-5">
54
+ {{> reference/section-heading label="Request body" suffix=body.contentType class="mb-2"}}
55
+ {{#if body.descriptionHtml}}
56
+ <div class="text-base-content/70 mb-2 text-sm"><p>{{{body.descriptionHtml}}}</p></div>
57
+ {{/if}}
58
+ {{#if body.tree}}
59
+ {{> reference/schema body.tree}}
60
+ {{/if}}
61
+ {{#if body.exampleJson}}
62
+ {{#> reference/disclosure label="Example request body" class="mt-3"}}
63
+ <pre class="ee-code-block mt-2"><code class="language-json">{{body.exampleJson}}</code></pre>
64
+ {{/reference/disclosure}}
65
+ {{/if}}
66
+ </div>
67
+ {{/if}}
68
+
69
+ {{#if responses.length}}
70
+ <div class="mt-5">
71
+ {{> reference/section-heading label="Responses" class="mb-2"}}
72
+ {{#> ui/tabs label="Response status codes" class="mb-3"}}
73
+ {{#each responses}}
74
+ {{> ui/tab target=tabId label=code active=active}}
75
+ {{/each}}
76
+ {{/ui/tabs}}
77
+ {{#each responses}}
78
+ <div id="{{tabId}}" role="tabpanel" aria-labelledby="{{tabId}}-tab" {{#unless active}}class="hidden" {{/unless}}>
79
+ <div class="flex flex-wrap items-center gap-2">
80
+ {{> ui/badge label=code variant=variant soft=true icon="" class=""}}
81
+ {{#if contentType}}<span class="text-base-content/50 text-xs">{{contentType}}</span>{{/if}}
82
+ </div>
83
+ {{#if descriptionHtml}}
84
+ <div class="text-base-content/70 mt-1 text-sm"><p>{{{descriptionHtml}}}</p></div>
85
+ {{/if}}
86
+ {{#if tree}}
87
+ <div class="mt-2">{{> reference/schema tree}}</div>
88
+ {{/if}}
89
+ {{#if exampleJson}}
90
+ {{#> reference/disclosure label="Example response" class="mt-3"}}
91
+ <pre class="ee-code-block mt-2"><code class="language-json">{{exampleJson}}</code></pre>
92
+ {{/reference/disclosure}}
93
+ {{/if}}
94
+ </div>
95
+ {{/each}}
96
+ </div>
97
+ {{/if}}
98
+
99
+ {{!-- data-sample-tabs marks this strip for static/js/reference.js, which reselects the
100
+ language the reader last chose so a page of 13 operations does not reset to curl
101
+ on every one of them --}}
102
+ {{#if samples.length}}
103
+ <div class="mt-5" data-sample-tabs>
104
+ {{> reference/section-heading label="Code samples" class="mb-2"}}
105
+ {{#> ui/tabs label="Code sample languages" class="mb-3"}}
106
+ {{#each samples}}
107
+ {{> ui/tab target=tabId label=label active=active key=id}}
108
+ {{/each}}
109
+ {{/ui/tabs}}
110
+ {{#each samples}}
111
+ <div id="{{tabId}}" role="tabpanel" aria-labelledby="{{tabId}}-tab" {{#unless active}}class="hidden" {{/unless}}>
112
+ <div class="relative">
113
+ <button type="button" class="copy-btn btn btn-text btn-xs absolute end-2 top-2"
114
+ data-copy-target="#{{tabId}}-code" aria-label="Copy to clipboard">
115
+ <span class="icon-[tabler--copy] size-4"></span>
116
+ </button>
117
+ <pre class="ee-code-block"><code id="{{tabId}}-code" class="language-{{language}}">{{code}}</code></pre>
118
+ </div>
119
+ </div>
120
+ {{/each}}
121
+ </div>
122
+ {{/if}}
123
+
124
+ {{> reference/try-it}}
125
+
126
+ </div>
127
+ </section>
@@ -0,0 +1,20 @@
1
+ {{!--
2
+ reference/params - one parameter group (path, query or header) for an operation.
3
+ Renders nothing when the group is empty, so callers can include all three
4
+ unconditionally.
5
+ Params:
6
+ title - group heading, e.g. "Path parameters" (required)
7
+ params - array of parameter view models from lib/api-reference/model.js (required)
8
+
9
+ Rows are reference/schema-node: buildParameter() emits the same field names as a
10
+ schema tree node, so a parameter renders identically to a property without a
11
+ second copy of the row markup.
12
+ --}}
13
+ {{#if params.length}}
14
+ <div class="mt-4">
15
+ {{> reference/section-heading label=title class="mb-2"}}
16
+ <ul class="ee-ref-props">
17
+ {{#each params}}{{> reference/schema-node}}{{/each}}
18
+ </ul>
19
+ </div>
20
+ {{/if}}
@@ -0,0 +1,99 @@
1
+ {{!--
2
+ reference/schema-node - one property row in an API reference schema tree.
3
+
4
+ Recursive: the nested-properties block renders this same partial for each child,
5
+ which terminates because lib/api-reference/schema-tree.js builds a finite tree
6
+ (depth-capped, with $ref cycles marked instead of followed).
7
+
8
+ Also rendered directly for operation parameters (reference/params) - the parameter
9
+ view models from buildParameter() carry the same field names and simply have no
10
+ children or variants, so the nested blocks below render nothing for them.
11
+
12
+ Context is a node from buildSchemaTree(): name, anchor, typeLabel, required, nullable,
13
+ deprecated, constraints[], enumValues[], defaultValue, descriptionHtml, children[],
14
+ variants[], openByDefault, truncated, circular, unresolved.
15
+
16
+ `anchor` is the dotted id of this property within its operation, e.g.
17
+ "accountCreate.body.imap.tls.rejectUnauthorized", so a single field can be linked to
18
+ directly. The row highlight on arrival is plain :target CSS; static/js/reference.js only
19
+ has to open the collapsed groups and response tab the row may be buried in.
20
+
21
+ descriptionHtml is pre-escaped by lib/api-reference/format.js (escape first, then a
22
+ closed set of tags added back), which is why it renders unescaped.
23
+ --}}
24
+ <li class="ee-ref-prop min-w-0 scroll-mt-20"{{#if anchor}} id="{{anchor}}"{{/if}}>
25
+
26
+ <div class="ee-ref-prop-head flex flex-wrap items-baseline gap-x-2 gap-y-1">
27
+ {{#if name}}<code class="text-sm font-semibold break-all">{{name}}</code>{{/if}}
28
+ <span class="text-primary text-xs font-medium">{{typeLabel}}</span>
29
+ {{#if required}}<span class="text-error text-2xs font-semibold tracking-wide uppercase">required</span>{{/if}}
30
+ {{#if nullable}}<span class="ee-chip">nullable</span>{{/if}}
31
+ {{#if deprecated}}{{> ui/badge label="deprecated" variant="warning" soft=true icon="" class=""}}{{/if}}
32
+ {{#each constraints}}<span class="ee-chip">{{this}}</span>{{/each}}
33
+ {{#if anchor}}
34
+ {{> reference/anchor-link target=anchor label=(concat "Link to the " name " property") small=true class="ee-ref-prop-anchor"}}
35
+ {{/if}}
36
+ </div>
37
+
38
+ {{#if descriptionHtml}}
39
+ <div class="text-base-content/70 mt-1 text-sm"><p>{{{descriptionHtml}}}</p></div>
40
+ {{/if}}
41
+
42
+ {{#if enumValues}}
43
+ {{#if enumDocumented}}
44
+ {{!-- documented values get a row each; joi .meta({enumDescriptions}) is the source --}}
45
+ <div class="mt-1">
46
+ <span class="text-base-content/50 text-2xs tracking-wide uppercase">Allowed values</span>
47
+ <ul class="ee-ref-nest mt-1 space-y-1">
48
+ {{#each enumValues}}
49
+ <li class="flex flex-wrap items-baseline gap-x-2 text-sm">
50
+ <code class="ee-chip">{{value}}</code>
51
+ {{#if description}}<span class="text-base-content/70">{{description}}</span>{{/if}}
52
+ </li>
53
+ {{/each}}
54
+ </ul>
55
+ </div>
56
+ {{else}}
57
+ <div class="mt-1 flex flex-wrap items-baseline gap-1">
58
+ <span class="text-base-content/50 text-2xs tracking-wide uppercase">Allowed</span>
59
+ {{#each enumValues}}<code class="ee-chip">{{value}}</code>{{/each}}
60
+ </div>
61
+ {{/if}}
62
+ {{/if}}
63
+
64
+ {{#if defaultValue}}
65
+ <div class="text-base-content/50 mt-1 text-xs">Default <code class="ee-chip">{{defaultValue}}</code></div>
66
+ {{/if}}
67
+
68
+ {{#if circular}}
69
+ <div class="text-warning mt-1 text-xs">Recursive reference - see the parent definition</div>
70
+ {{/if}}
71
+
72
+ {{#if truncated}}
73
+ <div class="text-warning mt-1 text-xs">Nesting too deep to display</div>
74
+ {{/if}}
75
+
76
+ {{#if unresolved}}
77
+ <div class="text-warning mt-1 text-xs">Unresolved reference {{unresolved}}</div>
78
+ {{/if}}
79
+
80
+ {{#if variants.length}}
81
+ <div class="ee-ref-nest mt-2 space-y-2">
82
+ {{#each variants}}
83
+ <div>
84
+ <div class="text-base-content/50 text-2xs tracking-wide uppercase">Either</div>
85
+ <ul class="ee-ref-props">{{> reference/schema-node}}</ul>
86
+ </div>
87
+ {{/each}}
88
+ </div>
89
+ {{/if}}
90
+
91
+ {{#if children.length}}
92
+ {{#> reference/disclosure label=childLabel open=openByDefault class="mt-2"}}
93
+ <ul class="ee-ref-props ee-ref-nest mt-2">
94
+ {{#each children}}{{> reference/schema-node}}{{/each}}
95
+ </ul>
96
+ {{/reference/disclosure}}
97
+ {{/if}}
98
+
99
+ </li>
@@ -0,0 +1,19 @@
1
+ {{!--
2
+ reference/schema - root of a schema tree. Renders the top-level properties as a
3
+ list of reference/schema-node rows, or a single type line when the schema has no
4
+ properties to expand (a bare string, an array of scalars).
5
+ Context is a node from buildSchemaTree().
6
+ --}}
7
+ {{#if children.length}}
8
+ <ul class="ee-ref-props">
9
+ {{#each children}}{{> reference/schema-node}}{{/each}}
10
+ </ul>
11
+ {{else}}
12
+ <div class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
13
+ <span class="text-primary text-xs font-medium">{{typeLabel}}</span>
14
+ {{#each constraints}}<span class="ee-chip">{{this}}</span>{{/each}}
15
+ </div>
16
+ {{#if descriptionHtml}}
17
+ <div class="text-base-content/70 mt-1 text-sm"><p>{{{descriptionHtml}}}</p></div>
18
+ {{/if}}
19
+ {{/if}}
@@ -0,0 +1,16 @@
1
+ {{!--
2
+ reference/section-heading - small uppercase label for a block inside an operation
3
+ card (Path parameters, Request body, Responses, Code samples).
4
+ Params:
5
+ label - heading text (required)
6
+ suffix - muted normal-case text after the label, e.g. a content type (optional)
7
+ class - extra classes on the heading (optional; the caller owns spacing)
8
+
9
+ Not ui/section-title: that partial emits an <h2> for page-level groups of cards.
10
+ These sit under the operation's own <h3>, so they have to be <h4> to keep the
11
+ heading outline in order.
12
+ --}}
13
+ <h4 class="text-base-content/50 text-xs font-semibold tracking-wide uppercase{{#if class}} {{class}}{{/if}}">
14
+ {{~label~}}
15
+ {{#if suffix}} <span class="text-base-content/40 normal-case">({{suffix}})</span>{{/if}}
16
+ </h4>
@@ -0,0 +1,24 @@
1
+ {{!--
2
+ reference/token-alert - "no access token set" banner shown at the top of the reference
3
+ pages. Server-rendered but hidden by default; static/js/reference.js unhides it when
4
+ the tab holds no token, because whether one is set is client state.
5
+
6
+ Rendered only when a token is actually required: with the `disableTokens` setting on,
7
+ the API accepts uncredentialed callers, so the banner would be wrong.
8
+
9
+ Not shown on the access-token page itself - the control is already there.
10
+ --}}
11
+ {{#unless disableTokens}}
12
+ <div id="ref-token-alert" class="alert alert-soft alert-warning mb-6 hidden flex-wrap items-center gap-3" role="alert">
13
+ <span class="icon-[tabler--key-off] size-5 shrink-0"></span>
14
+ <div class="min-w-0 grow text-sm">
15
+ No access token is set, so the <strong>Try it</strong> panels on this page will be rejected with a 401.
16
+ </div>
17
+ <div class="flex shrink-0 flex-wrap items-center gap-2">
18
+ {{> ui/btn variant="primary" size="sm" icon="icon-[tabler--clock-plus]" label="Mint temporary token"
19
+ class="ref-token-mint" id="" href="" style="" bare="" type="" overlay="" external=""}}
20
+ {{> ui/btn href="/admin/reference/token" variant="neutral" style="soft" size="sm" label="Set a token" icon=""
21
+ id="" bare="" type="" overlay="" external=""}}
22
+ </div>
23
+ </div>
24
+ {{/unless}}
@@ -0,0 +1,31 @@
1
+ {{!--
2
+ reference/try-field - one input in a try-it form. Renders a select for booleans and
3
+ enums and a text field otherwise; static/js/reference.js reads data-param/data-in to
4
+ place the value in the path, the query string or a header.
5
+
6
+ Context is a parameter view model from lib/api-reference/model.js, which already
7
+ carries `in` - so the three groups render from one partial rather than three
8
+ near-identical blocks.
9
+
10
+ Path parameters are prefilled (an operation is not callable without them); query and
11
+ header values start empty with the sample shown as a placeholder, so an unset
12
+ parameter is not silently sent.
13
+ --}}
14
+ <label class="block">
15
+ <span class="text-base-content/70 text-xs font-semibold">{{name}}{{#if required}} <span class="text-error">*</span>{{/if}}</span>
16
+ {{#if isBoolean}}
17
+ <select class="select select-sm mt-1" data-param="{{name}}" data-in="{{in}}">
18
+ <option value=""></option>
19
+ <option value="true">true</option>
20
+ <option value="false">false</option>
21
+ </select>
22
+ {{else if enumValues}}
23
+ <select class="select select-sm mt-1" data-param="{{name}}" data-in="{{in}}">
24
+ <option value=""></option>
25
+ {{#each enumValues}}<option value="{{value}}">{{value}}</option>{{/each}}
26
+ </select>
27
+ {{else}}
28
+ <input type="text" class="input input-sm mt-1" data-param="{{name}}" data-in="{{in}}"
29
+ {{#equals in "path"}}value="{{tryValue}}" {{/equals}}placeholder="{{#if tryValue}}{{tryValue}}{{else}}{{typeLabel}}{{/if}}">
30
+ {{/if}}
31
+ </label>
@@ -0,0 +1,78 @@
1
+ {{!--
2
+ reference/try-it - live request runner for one operation.
3
+
4
+ The form is rendered server-side (one field per parameter, prefilled from the
5
+ schema example) and static/js/reference.js reads it to build and send the request.
6
+ Requests go to this same instance, so they need a real access token - the shared
7
+ token field at the top of the page feeds every panel.
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.
12
+
13
+ Context is an operation view model from lib/api-reference/model.js.
14
+ --}}
15
+ {{#> reference/disclosure label="Try it" primary=true elId=(concat "try-" id) class="mt-4"}}
16
+
17
+ <form class="ee-ref-try border-base-content/20 mt-3 rounded-box border p-4" data-method="{{method}}" data-path="{{path}}">
18
+
19
+ {{#> 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>
23
+ {{/ui/alert-banner}}
24
+
25
+ {{#if pathParams.length}}
26
+ <div class="mb-3 grid gap-3 sm:grid-cols-2">
27
+ {{#each pathParams}}{{> reference/try-field}}{{/each}}
28
+ </div>
29
+ {{/if}}
30
+
31
+ {{#if queryParams.length}}
32
+ <div class="mb-3">
33
+ {{> reference/section-heading label="Query" class="mb-2"}}
34
+ <div class="grid gap-3 sm:grid-cols-2">
35
+ {{#each queryParams}}{{> reference/try-field}}{{/each}}
36
+ </div>
37
+ </div>
38
+ {{/if}}
39
+
40
+ {{#if headerParams.length}}
41
+ <div class="mb-3">
42
+ {{> reference/section-heading label="Headers" class="mb-2"}}
43
+ <div class="grid gap-3 sm:grid-cols-2">
44
+ {{#each headerParams}}{{> reference/try-field}}{{/each}}
45
+ </div>
46
+ </div>
47
+ {{/if}}
48
+
49
+ {{#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>
54
+ {{/if}}
55
+
56
+ {{!-- id="" on both: ui/btn reads `id`, and Handlebars merges a partial's hash params into
57
+ the caller's context, so without it every button here would carry the surrounding
58
+ operation's id (the same trap reference/disclosure documents). --}}
59
+ <div class="flex flex-wrap items-center gap-3">
60
+ {{> ui/btn label="Send request" variant="primary" size="sm" icon="icon-[tabler--send]" type="submit" id="" class=""}}
61
+ {{!-- The code samples above are built from the schema examples; this one is built from
62
+ whatever is in the fields right now, so what you read is what you would run. The
63
+ token is emitted as $EMAILENGINE_TOKEN, never the live one. --}}
64
+ {{> ui/btn label="Copy as curl" bare=true style="text" size="sm" icon="icon-[tabler--copy]" class="ee-ref-try-curl" id=""}}
65
+ <span class="ee-ref-try-status text-base-content/60 text-sm"></span>
66
+ </div>
67
+
68
+ <div class="ee-ref-try-result mt-4 hidden">
69
+ <div class="mb-2 flex flex-wrap items-center gap-2">
70
+ <span class="ee-ref-try-code badge badge-sm"></span>
71
+ <span class="ee-ref-try-time text-base-content/50 text-xs"></span>
72
+ </div>
73
+ <pre class="ee-code-block"><code class="ee-ref-try-body language-json"></code></pre>
74
+ </div>
75
+
76
+ </form>
77
+
78
+ {{/reference/disclosure}}
@@ -11,7 +11,7 @@
11
11
  {{> ui/menu-item href="/admin/templates" label="Templates" icon="icon-[tabler--template] size-4.5" active=menuTemplates}}
12
12
 
13
13
  {{> ui/menu-title label="Integrations"}}
14
- {{> ui/menu-item href="/admin/swagger" label="API Reference" icon="icon-[tabler--file-code] size-4.5" active=menuSwagger}}
14
+ {{> ui/menu-item href="/admin/reference" label="API Reference" icon="icon-[tabler--file-code] size-4.5" active=menuReference}}
15
15
  {{> ui/menu-item href="/admin/tokens" label="Access Tokens" icon="icon-[tabler--key] size-4.5" active=menuTokens}}
16
16
  {{> ui/menu-item href="/admin/config/oauth" label="OAuth2 Apps" icon="icon-[tabler--brand-oauth] size-4.5" active=menuOauthApps}}
17
17
  {{> ui/menu-item href="/admin/webhooks" label="Webhook Routes" icon="icon-[tabler--webhook] size-4.5" active=menuWebhooks}}
@@ -6,10 +6,12 @@
6
6
  (default neutral; the legacy "danger" normalizes to error via eeColor)
7
7
  soft - true for the soft (tinted) style
8
8
  icon - full iconify class (optional)
9
- id - element id (optional)
9
+ elId - element id (optional). NOT named `id`: Handlebars merges hash params
10
+ into the caller's context, so a partial reading `id` also inherits one
11
+ that merely happens to be in scope - a row's id inside {{#each}}
10
12
  class - extra classes, e.g. "state-info" hooks (optional)
11
13
  --}}
12
- <span {{#if id}}id="{{id}}" {{/if}}class="badge badge-{{eeColor variant}}{{#if soft}} badge-soft{{/if}}{{#if class}} {{class}}{{/if}}">
14
+ <span {{#if elId}}id="{{elId}}" {{/if}}class="badge badge-{{eeColor variant}}{{#if soft}} badge-soft{{/if}}{{#if class}} {{class}}{{/if}}">
13
15
  {{~#if icon}}<span class="{{icon}} size-3.5 shrink-0"></span>{{/if~}}
14
16
  {{~#if label includeZero=true}}{{label}}{{else if @partial-block}}{{> @partial-block label="" variant="" soft="" icon="" id="" class=""}}{{/if~}}
15
17
  </span>
@@ -23,7 +23,7 @@
23
23
  <h1 class="flex items-center gap-2 text-2xl font-semibold text-base-content">
24
24
  {{~#if icon}}<span class="{{icon}} size-6 text-base-content/60"></span>{{/if~}}
25
25
  {{title}}
26
- {{~#if badgeLabel}} {{> ui/badge label=badgeLabel variant=badgeVariant icon="" id="" class="" soft=""}}{{/if~}}
26
+ {{~#if badgeLabel}} {{> ui/badge label=badgeLabel variant=badgeVariant icon="" class="" soft=""}}{{/if~}}
27
27
  {{~#if stateLabel}} {{> ui/state-badge label=stateLabel dataType=stateType account="" pointer="" class=""}}{{/if~}}
28
28
  </h1>
29
29
  {{#if @partial-block}}
@@ -0,0 +1,31 @@
1
+ {{!--
2
+ ui/search-input - text input with a leading magnifier, the standard search field
3
+ look used by the topbar search and the API reference filter.
4
+ {{> ui/search-input id="ref-filter" placeholder="Filter endpoints"}}
5
+ Params:
6
+ id - element id, for the script that reads the value (optional)
7
+ name - form field name, for inputs that submit (optional)
8
+ value - initial value (optional)
9
+ placeholder - placeholder text, also used as the aria-label (required)
10
+ type - input type, "search" or "text" (default "search")
11
+ shortcut - keyboard hint rendered as a <kbd> at the end of the field, for
12
+ fields a page binds a focus hotkey to (optional). Decorative:
13
+ aria-hidden, because the shortcut belongs in the input's own
14
+ accessible name, not as a separate thing to read out.
15
+ shortcutMac - the macOS spelling of the same hint, e.g. "Cmd K" (optional).
16
+ Swapped in by static/js/ui.js, which is where the platform is
17
+ known - the server renders the non-Mac form because it cannot
18
+ tell. Keeping the swap generic means a page that binds a hotkey
19
+ never has to reach into this partial's markup to fix the label.
20
+ class - extra classes on the wrapper, e.g. "grow" (optional)
21
+ The wrapper is the FlyonUI .input; the actual <input> inside it is unstyled and
22
+ grows to fill, which is why the classes sit where they do.
23
+ --}}
24
+ <div class="input input-sm{{#if class}} {{class}}{{/if}}">
25
+ <span class="icon-[tabler--search] text-base-content/60 my-auto me-2 size-4 shrink-0"></span>
26
+ <input type="{{#if type}}{{type}}{{else}}search{{/if}}" class="grow" placeholder="{{placeholder}}" aria-label="{{placeholder}}"
27
+ autocomplete="off" {{#if id}}id="{{id}}" {{/if}}{{#if name}}name="{{name}}" {{/if}}{{#if value}}value="{{value}}" {{/if}}>
28
+ {{#if shortcut}}
29
+ <kbd class="kbd kbd-xs my-auto shrink-0" aria-hidden="true"{{#if shortcutMac}} data-mac="{{shortcutMac}}"{{/if}}>{{shortcut}}</kbd>
30
+ {{/if}}
31
+ </div>
@@ -17,5 +17,5 @@
17
17
  flex-row placements where the float is inert (optional)
18
18
  --}}
19
19
  <div class="text-base-content/60{{#unless nofloat}} float-right{{/unless}} code-link{{#if class}} {{class}}{{/if}}">[{{prefix}}{{#if plain}}{{name}}{{else}}<a
20
- href="{{#if href}}{{href}}{{else}}/admin/swagger#/Settings/postV1Settings{{/if}}" target="_blank"
20
+ href="{{#if href}}{{href}}{{else}}/admin/reference/settings#postV1Settings{{/if}}" target="_blank"
21
21
  rel="noopener noreferrer" class="link link-animated">{{name}}</a>{{/if}}{{suffix}}]</div>
@@ -10,7 +10,9 @@
10
10
  title - header label next to the icon (optional)
11
11
  value - large value text; ignored when a block is given (optional)
12
12
  icon - full iconify class shown in the tinted container (optional)
13
- id - element id (optional)
13
+ elId - element id (optional). NOT named `id`: Handlebars merges hash params
14
+ into the caller's context, so a partial reading `id` also inherits one
15
+ that merely happens to be in scope - a row's id inside {{#each}}
14
16
  class - extra classes (optional)
15
17
  --}}
16
18
  {{#*inline "iconBox"}}
@@ -18,7 +20,7 @@
18
20
  <span class="{{icon}} size-5"></span>
19
21
  </div>
20
22
  {{/inline}}
21
- <div {{#if id}}id="{{id}}" {{/if}}class="card bg-base-100 shadow-md{{#if class}} {{class}}{{/if}}">
23
+ <div {{#if elId}}id="{{elId}}" {{/if}}class="card bg-base-100 shadow-md{{#if class}} {{class}}{{/if}}">
22
24
  <div class="card-body">
23
25
  {{#if title}}
24
26
  <div class="flex items-center gap-3 mb-2">
@@ -5,5 +5,10 @@
5
5
  "<target>-tab" (required)
6
6
  label - button text (required)
7
7
  active - true for the initially selected tab
8
+ key - stable identity for this tab within its strip, emitted as
9
+ data-tab-key (optional). For scripts that reselect a tab across
10
+ pages: `target` carries the operation id so it cannot match
11
+ anywhere else, and the label is display text that changes when
12
+ the wording does.
8
13
  --}}
9
- <button type="button" class="tab active-tab:tab-active{{#if active}} active{{/if}}" id="{{target}}-tab" data-tab="#{{target}}" role="tab" aria-controls="{{target}}" aria-selected="{{#if active}}true{{else}}false{{/if}}">{{label}}</button>
14
+ <button type="button" class="tab active-tab:tab-active{{#if active}} active{{/if}}" id="{{target}}-tab" data-tab="#{{target}}" role="tab" aria-controls="{{target}}" aria-selected="{{#if active}}true{{else}}false{{/if}}"{{#if key}} data-tab-key="{{key}}"{{/if}}>{{label}}</button>