@webx-ui/module-inbox 0.5.7 → 0.6.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/dist/FormNotifications.d.ts +3 -1
- package/dist/api.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1454 -1294
- package/dist/index.js.map +1 -1
- package/dist/recipients.d.ts +8 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +39 -1
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Recipient, RecipientProblem, RecipientState } from './types';
|
|
2
|
+
export declare function isAdmin(recipient: Recipient): recipient is {
|
|
3
|
+
admin_id: number;
|
|
4
|
+
};
|
|
5
|
+
/** Why this recipient would not get a letter, or null when it would. */
|
|
6
|
+
export declare function problemOf(recipient: Recipient, reported?: RecipientState[]): RecipientProblem | null;
|
|
7
|
+
/** Whether anybody on the list would be written to. */
|
|
8
|
+
export declare function reachesAnybody(recipients: Recipient[] | undefined, reported?: RecipientState[]): boolean;
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.wx-inbox-field-form[data-v-6696bbc1]{display:flex;flex-direction:column;gap:var(--wx-space-12)}.wx-inbox-field-form__row[data-v-6696bbc1]{display:flex;flex-wrap:wrap;gap:var(--wx-space-12)}.wx-inbox-field-form__row[data-v-6696bbc1]>*{flex:1 1 200px;min-width:0}.wx-inbox-field-form__row[data-v-6696bbc1]:empty{display:none}.wx-inbox-field-form__checks[data-v-6696bbc1]{display:flex;flex-wrap:wrap;gap:var(--wx-space-16)}.wx-inbox-choices[data-v-6696bbc1]{display:flex;flex-direction:column;gap:var(--wx-space-8);align-items:flex-start}.wx-inbox-choices__row[data-v-6696bbc1]{display:flex;align-items:center;gap:var(--wx-space-8);width:100%}.wx-inbox-choices__row[data-v-6696bbc1]>:first-child{flex:0 1 180px;min-width:0}.wx-inbox-choices__row[data-v-6696bbc1]>:nth-child(2){flex:1 1 auto;min-width:0}.wx-inbox-field[data-v-421ed0af]{display:flex;flex-direction:column;gap:var(--wx-space-2);flex:1 1 auto;min-width:0}.wx-inbox-field__name[data-v-421ed0af]{display:flex;align-items:center;gap:var(--wx-space-6);min-width:0}.wx-inbox-embed[data-v-e415689b]{display:flex;flex-direction:column;gap:var(--wx-space-16)}.wx-inbox-embed__snippet[data-v-e415689b]{display:flex;align-items:center;gap:var(--wx-space-8);margin-top:var(--wx-space-12);padding:var(--wx-space-10) var(--wx-space-12);border:1px solid var(--wx-border-default);border-radius:var(--wx-radius-md);background:var(--wx-bg-subtle)}.wx-inbox-embed__snippet code[data-v-e415689b]{flex:1 1 auto;min-width:0;overflow-x:auto;white-space:pre;font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-sm)}.wx-inbox-general[data-v-35e56e3d]{display:flex;flex-direction:column;gap:var(--wx-space-16)}.wx-inbox-recipients[data-v-
|
|
1
|
+
.wx-inbox-field-form[data-v-6696bbc1]{display:flex;flex-direction:column;gap:var(--wx-space-12)}.wx-inbox-field-form__row[data-v-6696bbc1]{display:flex;flex-wrap:wrap;gap:var(--wx-space-12)}.wx-inbox-field-form__row[data-v-6696bbc1]>*{flex:1 1 200px;min-width:0}.wx-inbox-field-form__row[data-v-6696bbc1]:empty{display:none}.wx-inbox-field-form__checks[data-v-6696bbc1]{display:flex;flex-wrap:wrap;gap:var(--wx-space-16)}.wx-inbox-choices[data-v-6696bbc1]{display:flex;flex-direction:column;gap:var(--wx-space-8);align-items:flex-start}.wx-inbox-choices__row[data-v-6696bbc1]{display:flex;align-items:center;gap:var(--wx-space-8);width:100%}.wx-inbox-choices__row[data-v-6696bbc1]>:first-child{flex:0 1 180px;min-width:0}.wx-inbox-choices__row[data-v-6696bbc1]>:nth-child(2){flex:1 1 auto;min-width:0}.wx-inbox-field[data-v-421ed0af]{display:flex;flex-direction:column;gap:var(--wx-space-2);flex:1 1 auto;min-width:0}.wx-inbox-field__name[data-v-421ed0af]{display:flex;align-items:center;gap:var(--wx-space-6);min-width:0}.wx-inbox-embed[data-v-e415689b]{display:flex;flex-direction:column;gap:var(--wx-space-16)}.wx-inbox-embed__snippet[data-v-e415689b]{display:flex;align-items:center;gap:var(--wx-space-8);margin-top:var(--wx-space-12);padding:var(--wx-space-10) var(--wx-space-12);border:1px solid var(--wx-border-default);border-radius:var(--wx-radius-md);background:var(--wx-bg-subtle)}.wx-inbox-embed__snippet code[data-v-e415689b]{flex:1 1 auto;min-width:0;overflow-x:auto;white-space:pre;font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-sm)}.wx-inbox-general[data-v-35e56e3d]{display:flex;flex-direction:column;gap:var(--wx-space-16)}.wx-inbox-recipients[data-v-2ce96844]{display:flex;flex-direction:column;gap:var(--wx-space-8);margin-block:var(--wx-space-12);max-width:var(--wx-field-max-width, 640px)}.wx-inbox-recipients__item[data-v-2ce96844]{display:flex;flex-direction:column;gap:var(--wx-space-4)}.wx-inbox-recipients__row[data-v-2ce96844]{display:flex;align-items:center;gap:var(--wx-space-8)}.wx-inbox-recipients__row[data-v-2ce96844]>:first-child{flex:1 1 auto;min-width:0}.wx-inbox-editor[data-v-8e53184e]{display:flex;flex-direction:column;gap:var(--wx-gap, var(--wx-space-16))}.wx-inbox-editor__head[data-v-8e53184e] .wx-screen-head__subtitle{font-family:var(--wx-font-family-mono)}.wx-inbox-editor__tabs[data-v-8e53184e]{flex:1 1 auto}.wx-inbox-create[data-v-55fb40d8],.wx-inbox-by-hand[data-v-72006299]{display:flex;flex-direction:column;gap:var(--wx-space-12)}.wx-submissions[data-v-6bb4ef13]{display:flex;flex-direction:column;gap:var(--wx-gap, var(--wx-space-16));padding:var(--wx-gap, var(--wx-space-16));min-width:0}.wx-submissions__head[data-v-6bb4ef13] .wx-screen-head__subtitle{font-family:var(--wx-font-family-mono)}.wx-submissions__views[data-v-6bb4ef13] .wx-tabs__panels{padding-top:var(--wx-space-8)}.wx-submissions__mass[data-v-6bb4ef13]{display:flex;align-items:center;gap:var(--wx-space-8);flex-wrap:wrap}.wx-submissions[data-v-6bb4ef13] .wx-submissions__when{white-space:nowrap}.wx-submissions__state[data-v-6bb4ef13]{display:flex;align-items:center;flex-wrap:wrap;gap:var(--wx-space-6);min-width:0}.wx-submissions[data-v-6bb4ef13] .is-unread{font-weight:var(--wx-font-weight-medium)}.wx-submissions[data-v-6bb4ef13] .is-unread td:first-child{box-shadow:inset 2px 0 0 0 var(--wx-color-primary)}.wx-inbox>.wx-card__body{display:flex;flex-direction:column;overflow:clip;border-radius:inherit}.wx-inbox__loading{padding:var(--wx-space-16)}.wx-inbox__forms{padding:var(--wx-space-8) var(--wx-space-12)}.wx-inbox__forms.is-panel{padding:0}.wx-inbox__forms.is-plain .wx-sortable-list__row{padding-inline:var(--wx-space-8)}.wx-inbox__forms.is-plain .wx-sortable-list__head{margin-block-end:var(--wx-space-6);padding-inline:var(--wx-space-8)}.wx-inbox-form{display:flex;flex-direction:column;gap:var(--wx-space-2);align-items:flex-start;flex:1 1 auto;min-width:0;padding:0;border:0;background:none;font:inherit;color:inherit;text-align:start;cursor:pointer}.wx-inbox-form__name{display:flex;align-items:center;gap:var(--wx-space-6);min-width:0;max-width:100%}.wx-inbox-form.is-off .wx-inbox-form__name>.wx-text{text-decoration:line-through}.wx-inbox__forms .wx-sortable-list__row:has(.wx-inbox-form.is-current){background:var(--wx-bg-subtle);border-radius:var(--wx-radius-sm)}.wx-inbox-form.is-current{color:var(--wx-color-primary)}.wx-inbox-form__silent{flex:none;color:var(--wx-color-warning)}.wx-inbox-form__count{flex:0 0 auto}.wx-inbox-status-form[data-v-b520b53b]{display:flex;flex-direction:column;gap:var(--wx-space-12)}.wx-inbox-status-form__checks[data-v-b520b53b]{display:flex;flex-wrap:wrap;gap:var(--wx-space-16)}.wx-inbox-statuses[data-v-f94bf140]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--wx-space-12)}.wx-inbox-statuses>.wx-list-screen[data-v-f94bf140]{align-self:stretch}.wx-inbox-status[data-v-f94bf140]{display:flex;align-items:center;gap:var(--wx-space-8);flex:1 1 auto;min-width:0;flex-wrap:wrap}.wx-submission[data-v-3d8c60d4]{display:flex;flex-direction:column;gap:var(--wx-gap, var(--wx-space-16));min-width:0;container-type:inline-size}.wx-submission__panes[data-v-3d8c60d4],.wx-submission__main[data-v-3d8c60d4],.wx-submission__aside[data-v-3d8c60d4]{display:flex;flex-direction:column;gap:var(--wx-gap, var(--wx-space-16));min-width:0}@container (min-width: 900px){.wx-submission__panes[data-v-3d8c60d4]{flex-direction:row;align-items:flex-start}.wx-submission__main[data-v-3d8c60d4]{flex:1 1 auto}.wx-submission__aside[data-v-3d8c60d4]{flex:0 0 320px;max-width:320px}}.wx-submission__value[data-v-3d8c60d4]{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.wx-submission__detail[data-v-3d8c60d4]{overflow-wrap:anywhere}.wx-submission__recipients[data-v-3d8c60d4]{display:flex;flex-direction:column;gap:var(--wx-space-4);margin:0;padding:0;list-style:none}.wx-submission__recipients li[data-v-3d8c60d4]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--wx-space-8);overflow-wrap:anywhere}.wx-submission__event[data-v-3d8c60d4]{margin:0}.wx-submission__by[data-v-3d8c60d4]{display:flex;align-items:baseline;gap:var(--wx-space-6);flex-wrap:wrap;margin:0}.wx-submission__files[data-v-3d8c60d4]{display:flex;flex-wrap:wrap;gap:var(--wx-space-8)}.wx-submission__fields[data-v-3d8c60d4]{display:flex;flex-direction:column;gap:var(--wx-space-12)}.wx-submission__field[data-v-3d8c60d4]{display:flex;flex-direction:column;gap:var(--wx-space-4)}
|
package/dist/types.d.ts
CHANGED
|
@@ -65,6 +65,17 @@ export type Recipient = {
|
|
|
65
65
|
} | {
|
|
66
66
|
email: string;
|
|
67
67
|
};
|
|
68
|
+
/** Why a recipient the form names would not get a letter. */
|
|
69
|
+
export type RecipientProblem = 'admin_deleted' | 'admin_inactive' | 'invalid_email';
|
|
70
|
+
/** A recipient as the server reads it today: who it is, and whether a letter would reach it. */
|
|
71
|
+
export interface RecipientState {
|
|
72
|
+
type: 'admin' | 'email';
|
|
73
|
+
admin_id?: number;
|
|
74
|
+
name?: string | null;
|
|
75
|
+
email: string | null;
|
|
76
|
+
receives: boolean;
|
|
77
|
+
problem: RecipientProblem | null;
|
|
78
|
+
}
|
|
68
79
|
/** The settings of a form (§5). Every key is literal, dots included. */
|
|
69
80
|
export interface FormOptions {
|
|
70
81
|
'thank-you.heading'?: LocalizedValue;
|
|
@@ -85,6 +96,13 @@ export interface InboxForm {
|
|
|
85
96
|
title: LocalizedValue;
|
|
86
97
|
is_enabled: boolean;
|
|
87
98
|
options: FormOptions;
|
|
99
|
+
/**
|
|
100
|
+
* Who a submission would be written to, read from `options.recipients` as saved. Optional
|
|
101
|
+
* only because a server older than this field does not send it.
|
|
102
|
+
*/
|
|
103
|
+
recipients?: RecipientState[];
|
|
104
|
+
/** False when a submission would be written to nobody at all. */
|
|
105
|
+
notifies?: boolean;
|
|
88
106
|
position: number;
|
|
89
107
|
/** Only where the query counted them — null on a form loaded on its own. */
|
|
90
108
|
submissions_count: number | null;
|
|
@@ -206,7 +224,7 @@ export interface SubmissionAttachment {
|
|
|
206
224
|
/** One line of what has happened to a submission. Never edited, never deleted. */
|
|
207
225
|
export interface SubmissionEvent {
|
|
208
226
|
id: number;
|
|
209
|
-
type: 'created' | 'status' | 'assignee' | 'note' | 'notified' | string;
|
|
227
|
+
type: 'created' | 'status' | 'assignee' | 'note' | 'notified' | 'handled' | 'handler_error' | 'no_recipients' | 'notify_queued' | 'notify_failed' | string;
|
|
210
228
|
from: string | null;
|
|
211
229
|
to: string | null;
|
|
212
230
|
/** Null is the system — the submission arriving, the notification going out. */
|
|
@@ -216,6 +234,24 @@ export interface SubmissionEvent {
|
|
|
216
234
|
} | null;
|
|
217
235
|
created_at: string | null;
|
|
218
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Whether the letter about a submission left (§9). `queued` is handed to the site's queue and
|
|
239
|
+
* not sent yet — on a site with a queue, sending is a worker's job, and a worker can be missing.
|
|
240
|
+
*/
|
|
241
|
+
export type NotifyState = 'none' | 'queued' | 'delivered' | 'failed';
|
|
242
|
+
export interface SubmissionNotification {
|
|
243
|
+
state: NotifyState;
|
|
244
|
+
error: string | null;
|
|
245
|
+
queued_at: string | null;
|
|
246
|
+
delivered_at: string | null;
|
|
247
|
+
/** Empty on a submission from before the letters were watched one by one. */
|
|
248
|
+
recipients: {
|
|
249
|
+
address: string;
|
|
250
|
+
state: 'queued' | 'delivered' | 'failed';
|
|
251
|
+
error: string | null;
|
|
252
|
+
at: string;
|
|
253
|
+
}[];
|
|
254
|
+
}
|
|
219
255
|
/** What the intake saw around the submission: the page, the language, the campaign. */
|
|
220
256
|
export interface SubmissionMeta {
|
|
221
257
|
ip?: string;
|
|
@@ -245,6 +281,8 @@ export interface InboxSubmission {
|
|
|
245
281
|
placement: string | null;
|
|
246
282
|
notified_at: string | null;
|
|
247
283
|
notify_error: string | null;
|
|
284
|
+
/** The same two read as a state, with how each letter went. */
|
|
285
|
+
notification: SubmissionNotification;
|
|
248
286
|
/** The neighbours in the list this was opened from, so the arrows walk the same pile. */
|
|
249
287
|
previous_id: number | null;
|
|
250
288
|
next_id: number | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webx-ui/module-inbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Forms and submissions for the WebX UI admin panel: the forms of a site, their fields, their statuses, and what has come in through them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@webx-ui/core": "^0.37.0",
|
|
48
|
-
"@webx-ui/module-admin": "^0.23.
|
|
48
|
+
"@webx-ui/module-admin": "^0.23.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^24.10.1",
|