@postalsys/ee-client 1.8.2 → 1.10.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.
- package/README.md +2 -0
- package/index.d.ts +15 -6
- package/index.js +650 -196
- package/package.json +16 -9
package/README.md
CHANGED
|
@@ -160,6 +160,8 @@ Load a page of messages from a folder. Pass `nextPageCursor` / `prevPageCursor`
|
|
|
160
160
|
|
|
161
161
|
Load a single message. HTML is requested with `webSafeHtml=true`, so EmailEngine returns it pre-processed with inline images embedded for safe display, and the message is marked as seen. Web-safe HTML also folds quoted thread history (reply history, forwarded content, disclaimers) into a `<details class="ee-collapsed-thread">` element - see [Quoted thread history](#quoted-thread-history).
|
|
162
162
|
|
|
163
|
+
When the message carries a one-time passcode (the `otp` field EmailEngine 2.87+ reads from an `OTP-Token` header), the viewer shows a "Code requested" box above the body with the code and a Copy code button. The site the code is for is named only when EmailEngine reports the origin as `authenticated`, since the header itself proves nothing about the sender.
|
|
164
|
+
|
|
163
165
|
### `markAsRead(messageId: string, seen?: boolean): Promise<boolean>`
|
|
164
166
|
|
|
165
167
|
Add or remove the `\Seen` flag. Pass `false` to mark as unread.
|
package/index.d.ts
CHANGED
|
@@ -38,6 +38,15 @@ export interface Attachment {
|
|
|
38
38
|
size?: number;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/** One-time passcode of a message, from its OTP-Token header (EmailEngine 2.87+, experimental) */
|
|
42
|
+
export interface MessageOtp {
|
|
43
|
+
code: string;
|
|
44
|
+
/** The origin the passcode is bound to, e.g. "https://example.com" */
|
|
45
|
+
origin: string;
|
|
46
|
+
/** Whether the receiving server vouches for the origin. The site is named in the UI only when true */
|
|
47
|
+
authenticated: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
export interface Message {
|
|
42
51
|
id: string;
|
|
43
52
|
subject?: string;
|
|
@@ -52,6 +61,7 @@ export interface Message {
|
|
|
52
61
|
intro?: string;
|
|
53
62
|
text?: MessageText;
|
|
54
63
|
attachments?: Attachment[];
|
|
64
|
+
otp?: MessageOtp;
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
export interface MessageListResponse {
|
|
@@ -85,12 +95,7 @@ export interface SubmitDraftOptions {
|
|
|
85
95
|
* `(message, title, cancelText, okText)`; `cancelText` is `null` for alerts.
|
|
86
96
|
* May be synchronous or asynchronous. Confirm handlers should resolve to a boolean.
|
|
87
97
|
*/
|
|
88
|
-
export type DialogMethod = (
|
|
89
|
-
message: string,
|
|
90
|
-
title?: string,
|
|
91
|
-
cancelText?: string | null,
|
|
92
|
-
okText?: string
|
|
93
|
-
) => boolean | void | Promise<boolean | void>;
|
|
98
|
+
export type DialogMethod = (message: string, title?: string, cancelText?: string | null, okText?: string) => boolean | void | Promise<boolean | void>;
|
|
94
99
|
|
|
95
100
|
export interface EmailEngineClientOptions {
|
|
96
101
|
apiUrl?: string;
|
|
@@ -143,6 +148,10 @@ export declare class EmailEngineClient {
|
|
|
143
148
|
formatDate(dateStr: string): string;
|
|
144
149
|
formatFileSize(bytes: number): string;
|
|
145
150
|
escapeHtml(value: unknown): string;
|
|
151
|
+
/** HTML of the "Code requested" box for a message's one-time passcode, empty without one */
|
|
152
|
+
renderOtpBox(otp?: MessageOtp): string;
|
|
153
|
+
/** Copies text to the clipboard, falling back to execCommand outside a secure context */
|
|
154
|
+
copyText(text: string): Promise<boolean>;
|
|
146
155
|
createStyles(): void;
|
|
147
156
|
buildFolderTree(): FolderTreeEntry[];
|
|
148
157
|
renderFolderList(): void;
|