@whooshbang/sdk 5.1.0 → 7.0.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 +232 -83
- package/dist/cli/commands.js +2 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/client.d.ts +169 -1
- package/dist/client.js +534 -4
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interactions.js +18 -3
- package/dist/interactions.js.map +1 -1
- package/dist/recipient/digest-section.d.ts +29 -0
- package/dist/recipient/digest-section.js +400 -0
- package/dist/recipient/digest-section.js.map +1 -0
- package/dist/recipient/element.js +784 -14
- package/dist/recipient/element.js.map +1 -1
- package/dist/recipient/i18n/ar.js +114 -0
- package/dist/recipient/i18n/ar.js.map +1 -1
- package/dist/recipient/i18n/catalog.d.ts +113 -0
- package/dist/recipient/i18n/catalog.js.map +1 -1
- package/dist/recipient/i18n/de.js +119 -0
- package/dist/recipient/i18n/de.js.map +1 -1
- package/dist/recipient/i18n/en.js +119 -0
- package/dist/recipient/i18n/en.js.map +1 -1
- package/dist/recipient/i18n/es.js +119 -0
- package/dist/recipient/i18n/es.js.map +1 -1
- package/dist/recipient/i18n/fa.js +114 -0
- package/dist/recipient/i18n/fa.js.map +1 -1
- package/dist/recipient/i18n/fr.js +119 -0
- package/dist/recipient/i18n/fr.js.map +1 -1
- package/dist/recipient/i18n/hi.js +119 -0
- package/dist/recipient/i18n/hi.js.map +1 -1
- package/dist/recipient/i18n/id.js +119 -0
- package/dist/recipient/i18n/id.js.map +1 -1
- package/dist/recipient/i18n/it.js +119 -0
- package/dist/recipient/i18n/it.js.map +1 -1
- package/dist/recipient/i18n/nl.js +119 -0
- package/dist/recipient/i18n/nl.js.map +1 -1
- package/dist/recipient/i18n/pl.js +119 -0
- package/dist/recipient/i18n/pl.js.map +1 -1
- package/dist/recipient/i18n/pt-BR.js +119 -0
- package/dist/recipient/i18n/pt-BR.js.map +1 -1
- package/dist/recipient/i18n/ru.js +119 -0
- package/dist/recipient/i18n/ru.js.map +1 -1
- package/dist/recipient/i18n/tr.js +119 -0
- package/dist/recipient/i18n/tr.js.map +1 -1
- package/dist/recipient/i18n/uk.js +119 -0
- package/dist/recipient/i18n/uk.js.map +1 -1
- package/dist/recipient/i18n/zh-Hans.js +114 -0
- package/dist/recipient/i18n/zh-Hans.js.map +1 -1
- package/dist/recipient/mount.d.ts +5 -0
- package/dist/recipient/mount.js +2 -0
- package/dist/recipient/mount.js.map +1 -1
- package/dist/recipient/order-section.d.ts +41 -0
- package/dist/recipient/order-section.js +547 -0
- package/dist/recipient/order-section.js.map +1 -0
- package/dist/recipient/order-view.d.ts +123 -0
- package/dist/recipient/order-view.js +304 -0
- package/dist/recipient/order-view.js.map +1 -0
- package/dist/recipient/platform-mark.d.ts +1 -0
- package/dist/recipient/platform-mark.js +57 -0
- package/dist/recipient/platform-mark.js.map +1 -0
- package/dist/recipient/quiet-section.d.ts +51 -0
- package/dist/recipient/quiet-section.js +617 -0
- package/dist/recipient/quiet-section.js.map +1 -0
- package/dist/recipient/quiet-view.d.ts +104 -0
- package/dist/recipient/quiet-view.js +304 -0
- package/dist/recipient/quiet-view.js.map +1 -0
- package/dist/recipient/view.d.ts +2 -0
- package/dist/recipient/view.js.map +1 -1
- package/dist/webhooks.d.ts +30 -1
- package/dist/webhooks.js +57 -4
- package/dist/webhooks.js.map +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { QuietHours, SaveQuietHoursRequest } from "@whooshbang/contracts";
|
|
2
|
+
/**
|
|
3
|
+
* A person's quiet hours, as the "Quiet hours" tab edits them (FXO-2103).
|
|
4
|
+
*
|
|
5
|
+
* Pure, so the rules — what a save sends, what counts as a change, which
|
|
6
|
+
* field an error belongs to — are testable without a browser and shared by
|
|
7
|
+
* the subscriber panel and the dashboard, which cannot then drift apart.
|
|
8
|
+
*/
|
|
9
|
+
/** The channels quiet hours set a behaviour for, in the order they show. */
|
|
10
|
+
export declare const QUIET_CHANNELS: readonly ["telegram", "slack", "email"];
|
|
11
|
+
export type QuietChannel = (typeof QUIET_CHANNELS)[number];
|
|
12
|
+
export type QuietBehaviour = QuietHours["channels"][QuietChannel];
|
|
13
|
+
/** ISO weekdays, Monday first. */
|
|
14
|
+
export declare const QUIET_DAYS: readonly [1, 2, 3, 4, 5, 6, 7];
|
|
15
|
+
export declare const QUIET_WINDOWS_MAX = 7;
|
|
16
|
+
/** What a new period suggests: every night, 22:00 to 07:00. */
|
|
17
|
+
export declare const QUIET_SUGGESTED_WINDOW: QuietWindowDraft;
|
|
18
|
+
export interface QuietWindowDraft {
|
|
19
|
+
readonly days: readonly number[];
|
|
20
|
+
readonly start: string;
|
|
21
|
+
readonly end: string;
|
|
22
|
+
}
|
|
23
|
+
export interface QuietDraft {
|
|
24
|
+
readonly windows: readonly QuietWindowDraft[];
|
|
25
|
+
readonly channels: Readonly<Record<QuietChannel, QuietBehaviour>>;
|
|
26
|
+
readonly criticalBreakthrough: boolean;
|
|
27
|
+
readonly whenWithheld: QuietHours["when_withheld"];
|
|
28
|
+
/** Only one of `quiet_channel_options`; a saved one that went away is dropped. */
|
|
29
|
+
readonly quietChannelBindingId: string | undefined;
|
|
30
|
+
readonly timeZone: string;
|
|
31
|
+
/** The catch-up after quiet hours, when the project has one (FXO-3750). */
|
|
32
|
+
readonly catchUp?: QuietCatchUpDraft;
|
|
33
|
+
}
|
|
34
|
+
type CatchUp = NonNullable<QuietHours["catch_up"]>;
|
|
35
|
+
/** The person's catch-up as they are editing it, with what they may change. */
|
|
36
|
+
export interface QuietCatchUpDraft {
|
|
37
|
+
readonly enabled: boolean;
|
|
38
|
+
readonly detail: CatchUp["detail"];
|
|
39
|
+
readonly strategy: CatchUp["strategy"];
|
|
40
|
+
readonly canChange: boolean;
|
|
41
|
+
readonly available: boolean;
|
|
42
|
+
readonly detailChoices?: CatchUp["detail_choices"];
|
|
43
|
+
readonly strategyChoices?: CatchUp["strategy_choices"];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The draft with the catch-up as the project now has it, keeping every other
|
|
47
|
+
* edit: after the project changed it under an open panel, the person's next
|
|
48
|
+
* Save sends only what is still theirs to choose.
|
|
49
|
+
*/
|
|
50
|
+
export declare function withCurrentCatchUp(draft: QuietDraft, quiet: QuietHours): QuietDraft;
|
|
51
|
+
/** Field errors by JSON Pointer, such as `/windows/0/days`, to their code. */
|
|
52
|
+
export type QuietFieldErrors = Readonly<Record<string, string>>;
|
|
53
|
+
/** The browser's own named time zone, or UTC when it has none. */
|
|
54
|
+
export declare function browserTimeZone(): string;
|
|
55
|
+
/** The zone the times are shown in: the one quiet hours follow, else the browser's. */
|
|
56
|
+
export declare function quietTimeZone(quiet: QuietHours, fallback: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the person picks their own time zone. One an administrator set, or
|
|
59
|
+
* one their application supplies, wins over a saved one, so a picker there
|
|
60
|
+
* would change nothing.
|
|
61
|
+
*/
|
|
62
|
+
export declare function quietTimeZoneEditable(quiet: QuietHours): boolean;
|
|
63
|
+
export declare function startQuietDraft(quiet: QuietHours, fallbackTimeZone: string): QuietDraft;
|
|
64
|
+
/** Whether the person changed anything since the tab showed what is saved. */
|
|
65
|
+
export declare function quietEdited(draft: QuietDraft | null, quiet: QuietHours, fallbackTimeZone: string): boolean;
|
|
66
|
+
/** Whether Save would change anything. Nothing saved yet always would. */
|
|
67
|
+
export declare function quietChanged(draft: QuietDraft | null, quiet: QuietHours, fallbackTimeZone: string): boolean;
|
|
68
|
+
/** Whether any channel keeps messages back, so "where they go" matters. */
|
|
69
|
+
export declare function quietWithholds(draft: QuietDraft): boolean;
|
|
70
|
+
export declare function quietSaveRequest(draft: QuietDraft): SaveQuietHoursRequest;
|
|
71
|
+
/**
|
|
72
|
+
* The mistakes the panel can see before asking: a period with no days, a
|
|
73
|
+
* missing time, a period that starts and ends together, and a quiet channel
|
|
74
|
+
* not chosen. The service checks everything again.
|
|
75
|
+
*/
|
|
76
|
+
export declare function quietDraftErrors(draft: QuietDraft): QuietFieldErrors;
|
|
77
|
+
/** The service's field errors, by field, from a `request_invalid` problem. */
|
|
78
|
+
export declare function quietProblemErrors(problem: {
|
|
79
|
+
readonly field_errors?: readonly {
|
|
80
|
+
readonly field: string;
|
|
81
|
+
readonly code: string;
|
|
82
|
+
}[];
|
|
83
|
+
}): QuietFieldErrors;
|
|
84
|
+
/**
|
|
85
|
+
* The control a field error belongs to, by the `data-action` both editors
|
|
86
|
+
* give it, so focus can go there after a refused save.
|
|
87
|
+
*/
|
|
88
|
+
export declare function quietErrorControl(field: string, draft: QuietDraft): string | null;
|
|
89
|
+
/** A period ending at or before its start runs past midnight. */
|
|
90
|
+
export declare function quietOvernight(window: QuietWindowDraft): boolean;
|
|
91
|
+
export declare function setQuietWindow(draft: QuietDraft, index: number, change: Partial<QuietWindowDraft>): QuietDraft;
|
|
92
|
+
export declare function toggleQuietDay(draft: QuietDraft, index: number, day: number): QuietDraft;
|
|
93
|
+
export declare function addQuietWindow(draft: QuietDraft): QuietDraft;
|
|
94
|
+
export declare function removeQuietWindow(draft: QuietDraft, index: number): QuietDraft;
|
|
95
|
+
/** Day names in the reader's language: short for the toggle, long for its name. */
|
|
96
|
+
export declare function quietDayName(locale: string, day: number, width: "short" | "long"): string;
|
|
97
|
+
/**
|
|
98
|
+
* When quiet hours end, as the person reads a clock in their zone: "07:00",
|
|
99
|
+
* or with the day when it is more than a day away.
|
|
100
|
+
*/
|
|
101
|
+
export declare function quietEndsText(locale: string, endsAt: string, timeZone: string, now?: Date): string;
|
|
102
|
+
/** Every named zone the browser knows, with the current one always included. */
|
|
103
|
+
export declare function quietTimeZones(current: string): string[];
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A person's quiet hours, as the "Quiet hours" tab edits them (FXO-2103).
|
|
3
|
+
*
|
|
4
|
+
* Pure, so the rules — what a save sends, what counts as a change, which
|
|
5
|
+
* field an error belongs to — are testable without a browser and shared by
|
|
6
|
+
* the subscriber panel and the dashboard, which cannot then drift apart.
|
|
7
|
+
*/
|
|
8
|
+
/** The channels quiet hours set a behaviour for, in the order they show. */
|
|
9
|
+
export const QUIET_CHANNELS = ["telegram", "slack", "email"];
|
|
10
|
+
/** ISO weekdays, Monday first. */
|
|
11
|
+
export const QUIET_DAYS = [1, 2, 3, 4, 5, 6, 7];
|
|
12
|
+
export const QUIET_WINDOWS_MAX = 7;
|
|
13
|
+
/** What a new period suggests: every night, 22:00 to 07:00. */
|
|
14
|
+
export const QUIET_SUGGESTED_WINDOW = {
|
|
15
|
+
days: [...QUIET_DAYS],
|
|
16
|
+
end: "07:00",
|
|
17
|
+
start: "22:00",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The draft with the catch-up as the project now has it, keeping every other
|
|
21
|
+
* edit: after the project changed it under an open panel, the person's next
|
|
22
|
+
* Save sends only what is still theirs to choose.
|
|
23
|
+
*/
|
|
24
|
+
export function withCurrentCatchUp(draft, quiet) {
|
|
25
|
+
const rest = Object.fromEntries(Object.entries(draft).filter(([key]) => key !== "catchUp"));
|
|
26
|
+
return quiet.catch_up === undefined
|
|
27
|
+
? rest
|
|
28
|
+
: { ...rest, catchUp: catchUpDraft(quiet.catch_up) };
|
|
29
|
+
}
|
|
30
|
+
function catchUpDraft(catchUp) {
|
|
31
|
+
return {
|
|
32
|
+
available: catchUp.available,
|
|
33
|
+
canChange: catchUp.can_change,
|
|
34
|
+
detail: catchUp.detail,
|
|
35
|
+
enabled: catchUp.enabled,
|
|
36
|
+
strategy: catchUp.strategy,
|
|
37
|
+
...(catchUp.detail_choices === undefined
|
|
38
|
+
? {}
|
|
39
|
+
: { detailChoices: catchUp.detail_choices }),
|
|
40
|
+
...(catchUp.strategy_choices === undefined
|
|
41
|
+
? {}
|
|
42
|
+
: { strategyChoices: catchUp.strategy_choices }),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** The browser's own named time zone, or UTC when it has none. */
|
|
46
|
+
export function browserTimeZone() {
|
|
47
|
+
try {
|
|
48
|
+
const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
49
|
+
return zone.length > 0 ? zone : "UTC";
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return "UTC";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** The zone the times are shown in: the one quiet hours follow, else the browser's. */
|
|
56
|
+
export function quietTimeZone(quiet, fallback) {
|
|
57
|
+
return quiet.effective_time_zone ?? quiet.time_zone ?? fallback;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether the person picks their own time zone. One an administrator set, or
|
|
61
|
+
* one their application supplies, wins over a saved one, so a picker there
|
|
62
|
+
* would change nothing.
|
|
63
|
+
*/
|
|
64
|
+
export function quietTimeZoneEditable(quiet) {
|
|
65
|
+
return (quiet.time_zone_source !== "administrator" &&
|
|
66
|
+
quiet.time_zone_source !== "application");
|
|
67
|
+
}
|
|
68
|
+
export function startQuietDraft(quiet, fallbackTimeZone) {
|
|
69
|
+
const saved = quiet.quiet_channel?.binding_id;
|
|
70
|
+
const offered = saved !== undefined &&
|
|
71
|
+
quiet.quiet_channel_options.some((option) => option.binding_id === saved);
|
|
72
|
+
return {
|
|
73
|
+
channels: {
|
|
74
|
+
email: quiet.channels.email,
|
|
75
|
+
slack: quiet.channels.slack,
|
|
76
|
+
telegram: quiet.channels.telegram,
|
|
77
|
+
},
|
|
78
|
+
criticalBreakthrough: quiet.critical_breakthrough,
|
|
79
|
+
...(quiet.catch_up === undefined
|
|
80
|
+
? {}
|
|
81
|
+
: { catchUp: catchUpDraft(quiet.catch_up) }),
|
|
82
|
+
quietChannelBindingId: offered ? saved : undefined,
|
|
83
|
+
timeZone: quietTimeZone(quiet, fallbackTimeZone),
|
|
84
|
+
whenWithheld: quiet.when_withheld,
|
|
85
|
+
// Nothing saved yet: suggest every night, so turning quiet hours on is
|
|
86
|
+
// one press. Saved and empty stays empty.
|
|
87
|
+
windows: quiet.configured
|
|
88
|
+
? quiet.windows.map((window) => ({
|
|
89
|
+
days: [...window.days],
|
|
90
|
+
end: window.end,
|
|
91
|
+
start: window.start,
|
|
92
|
+
}))
|
|
93
|
+
: [QUIET_SUGGESTED_WINDOW],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function signature(draft) {
|
|
97
|
+
return JSON.stringify([
|
|
98
|
+
draft.windows.map((window) => [
|
|
99
|
+
[...window.days].sort((a, b) => a - b),
|
|
100
|
+
window.start,
|
|
101
|
+
window.end,
|
|
102
|
+
]),
|
|
103
|
+
QUIET_CHANNELS.map((channel) => draft.channels[channel]),
|
|
104
|
+
draft.criticalBreakthrough,
|
|
105
|
+
draft.whenWithheld,
|
|
106
|
+
draft.whenWithheld === "quiet_channel" ? draft.quietChannelBindingId : null,
|
|
107
|
+
draft.timeZone,
|
|
108
|
+
draft.catchUp === undefined
|
|
109
|
+
? null
|
|
110
|
+
: [draft.catchUp.enabled, draft.catchUp.detail, draft.catchUp.strategy],
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
/** Whether the person changed anything since the tab showed what is saved. */
|
|
114
|
+
export function quietEdited(draft, quiet, fallbackTimeZone) {
|
|
115
|
+
return (draft !== null &&
|
|
116
|
+
signature(draft) !== signature(startQuietDraft(quiet, fallbackTimeZone)));
|
|
117
|
+
}
|
|
118
|
+
/** Whether Save would change anything. Nothing saved yet always would. */
|
|
119
|
+
export function quietChanged(draft, quiet, fallbackTimeZone) {
|
|
120
|
+
return !quiet.configured || quietEdited(draft, quiet, fallbackTimeZone);
|
|
121
|
+
}
|
|
122
|
+
/** Whether any channel keeps messages back, so "where they go" matters. */
|
|
123
|
+
export function quietWithholds(draft) {
|
|
124
|
+
return QUIET_CHANNELS.some((channel) => draft.channels[channel] === "withhold");
|
|
125
|
+
}
|
|
126
|
+
export function quietSaveRequest(draft) {
|
|
127
|
+
const catchUp = draft.catchUp;
|
|
128
|
+
// Only what the project lets the person choose; the rest is the project's.
|
|
129
|
+
const choice = catchUp === undefined
|
|
130
|
+
? {}
|
|
131
|
+
: {
|
|
132
|
+
...(catchUp.canChange && catchUp.available
|
|
133
|
+
? { enabled: catchUp.enabled }
|
|
134
|
+
: {}),
|
|
135
|
+
...(catchUp.detailChoices === undefined
|
|
136
|
+
? {}
|
|
137
|
+
: { detail: catchUp.detail }),
|
|
138
|
+
...(catchUp.strategyChoices === undefined
|
|
139
|
+
? {}
|
|
140
|
+
: { strategy: catchUp.strategy }),
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
...(Object.keys(choice).length === 0 ? {} : { catch_up: choice }),
|
|
144
|
+
channels: { ...draft.channels },
|
|
145
|
+
critical_breakthrough: draft.criticalBreakthrough,
|
|
146
|
+
...(draft.whenWithheld === "quiet_channel" &&
|
|
147
|
+
draft.quietChannelBindingId !== undefined
|
|
148
|
+
? { quiet_channel_binding_id: draft.quietChannelBindingId }
|
|
149
|
+
: {}),
|
|
150
|
+
time_zone: draft.timeZone,
|
|
151
|
+
when_withheld: draft.whenWithheld,
|
|
152
|
+
windows: draft.windows.map((window) => ({
|
|
153
|
+
days: [...window.days].sort((a, b) => a - b),
|
|
154
|
+
end: window.end,
|
|
155
|
+
start: window.start,
|
|
156
|
+
})),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const TIME = /^(?:[01]\d|2[0-3]):[0-5]\d$/u;
|
|
160
|
+
/**
|
|
161
|
+
* The mistakes the panel can see before asking: a period with no days, a
|
|
162
|
+
* missing time, a period that starts and ends together, and a quiet channel
|
|
163
|
+
* not chosen. The service checks everything again.
|
|
164
|
+
*/
|
|
165
|
+
export function quietDraftErrors(draft) {
|
|
166
|
+
const errors = {};
|
|
167
|
+
if (draft.windows.length > QUIET_WINDOWS_MAX)
|
|
168
|
+
errors["/windows"] = "window_limit";
|
|
169
|
+
draft.windows.forEach((window, index) => {
|
|
170
|
+
const at = `/windows/${String(index)}`;
|
|
171
|
+
if (window.days.length === 0)
|
|
172
|
+
errors[`${at}/days`] = "window_days_invalid";
|
|
173
|
+
if (!TIME.test(window.start))
|
|
174
|
+
errors[`${at}/start`] = "window_time_invalid";
|
|
175
|
+
if (!TIME.test(window.end))
|
|
176
|
+
errors[`${at}/end`] = "window_time_invalid";
|
|
177
|
+
else if (window.start === window.end)
|
|
178
|
+
errors[`${at}/end`] = "window_empty";
|
|
179
|
+
});
|
|
180
|
+
if (draft.whenWithheld === "quiet_channel" &&
|
|
181
|
+
draft.quietChannelBindingId === undefined)
|
|
182
|
+
errors["/quiet_channel_binding_id"] = "quiet_channel_required";
|
|
183
|
+
return errors;
|
|
184
|
+
}
|
|
185
|
+
/** The service's field errors, by field, from a `request_invalid` problem. */
|
|
186
|
+
export function quietProblemErrors(problem) {
|
|
187
|
+
const errors = {};
|
|
188
|
+
for (const error of problem.field_errors ?? [])
|
|
189
|
+
errors[error.field.startsWith("/") ? error.field : `/${error.field}`] ??=
|
|
190
|
+
error.code;
|
|
191
|
+
return errors;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The control a field error belongs to, by the `data-action` both editors
|
|
195
|
+
* give it, so focus can go there after a refused save.
|
|
196
|
+
*/
|
|
197
|
+
export function quietErrorControl(field, draft) {
|
|
198
|
+
const window = /^\/windows\/(\d+)\/(days|start|end)/u.exec(field);
|
|
199
|
+
if (window) {
|
|
200
|
+
const [, index = "0", part = "days"] = window;
|
|
201
|
+
return part === "days"
|
|
202
|
+
? `quiet:day:${index}:${String(QUIET_DAYS[0])}`
|
|
203
|
+
: `quiet:${part}:${index}`;
|
|
204
|
+
}
|
|
205
|
+
const channel = /^\/channels\/(telegram|slack|email)/u.exec(field)?.[1];
|
|
206
|
+
if (channel !== undefined)
|
|
207
|
+
return `quiet:channel:${channel}:${draft.channels[channel]}`;
|
|
208
|
+
if (field === "/windows")
|
|
209
|
+
return "quiet:add";
|
|
210
|
+
if (field.startsWith("/quiet_channel"))
|
|
211
|
+
return draft.whenWithheld === "quiet_channel"
|
|
212
|
+
? "quiet:quiet-channel"
|
|
213
|
+
: "quiet:withheld:quiet_channel";
|
|
214
|
+
if (field === "/time_zone")
|
|
215
|
+
return "quiet:time-zone";
|
|
216
|
+
if (field.startsWith("/catch_up/detail"))
|
|
217
|
+
return "quiet:catch-up-detail";
|
|
218
|
+
if (field.startsWith("/catch_up/strategy"))
|
|
219
|
+
return "quiet:catch-up-strategy";
|
|
220
|
+
if (field.startsWith("/catch_up"))
|
|
221
|
+
return "quiet:catch-up";
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
/** A period ending at or before its start runs past midnight. */
|
|
225
|
+
export function quietOvernight(window) {
|
|
226
|
+
return TIME.test(window.start) && TIME.test(window.end)
|
|
227
|
+
? window.end < window.start
|
|
228
|
+
: false;
|
|
229
|
+
}
|
|
230
|
+
export function setQuietWindow(draft, index, change) {
|
|
231
|
+
return {
|
|
232
|
+
...draft,
|
|
233
|
+
windows: draft.windows.map((window, position) => position === index ? { ...window, ...change } : window),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export function toggleQuietDay(draft, index, day) {
|
|
237
|
+
const window = draft.windows[index];
|
|
238
|
+
if (window === undefined)
|
|
239
|
+
return draft;
|
|
240
|
+
const days = window.days.includes(day)
|
|
241
|
+
? window.days.filter((candidate) => candidate !== day)
|
|
242
|
+
: [...window.days, day].sort((a, b) => a - b);
|
|
243
|
+
return setQuietWindow(draft, index, { days });
|
|
244
|
+
}
|
|
245
|
+
export function addQuietWindow(draft) {
|
|
246
|
+
if (draft.windows.length >= QUIET_WINDOWS_MAX)
|
|
247
|
+
return draft;
|
|
248
|
+
return { ...draft, windows: [...draft.windows, QUIET_SUGGESTED_WINDOW] };
|
|
249
|
+
}
|
|
250
|
+
export function removeQuietWindow(draft, index) {
|
|
251
|
+
return {
|
|
252
|
+
...draft,
|
|
253
|
+
windows: draft.windows.filter((_, position) => position !== index),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
/** Day names in the reader's language: short for the toggle, long for its name. */
|
|
257
|
+
export function quietDayName(locale, day, width) {
|
|
258
|
+
// 1 January 2024 was a Monday.
|
|
259
|
+
const date = new Date(Date.UTC(2024, 0, day));
|
|
260
|
+
try {
|
|
261
|
+
return new Intl.DateTimeFormat(locale, {
|
|
262
|
+
timeZone: "UTC",
|
|
263
|
+
weekday: width,
|
|
264
|
+
}).format(date);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return new Intl.DateTimeFormat("en", {
|
|
268
|
+
timeZone: "UTC",
|
|
269
|
+
weekday: width,
|
|
270
|
+
}).format(date);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* When quiet hours end, as the person reads a clock in their zone: "07:00",
|
|
275
|
+
* or with the day when it is more than a day away.
|
|
276
|
+
*/
|
|
277
|
+
export function quietEndsText(locale, endsAt, timeZone, now = new Date()) {
|
|
278
|
+
const end = new Date(endsAt);
|
|
279
|
+
const options = {
|
|
280
|
+
hour: "2-digit",
|
|
281
|
+
minute: "2-digit",
|
|
282
|
+
...(end.getTime() - now.getTime() > 24 * 60 * 60 * 1000
|
|
283
|
+
? { weekday: "short" }
|
|
284
|
+
: {}),
|
|
285
|
+
};
|
|
286
|
+
try {
|
|
287
|
+
return new Intl.DateTimeFormat(locale, { ...options, timeZone }).format(end);
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return new Intl.DateTimeFormat(locale, options).format(end);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/** Every named zone the browser knows, with the current one always included. */
|
|
294
|
+
export function quietTimeZones(current) {
|
|
295
|
+
let zones;
|
|
296
|
+
try {
|
|
297
|
+
zones = Intl.supportedValuesOf("timeZone");
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
zones = [];
|
|
301
|
+
}
|
|
302
|
+
return [...new Set([...zones, "UTC", current])].sort((a, b) => a.localeCompare(b));
|
|
303
|
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AAC,EAAE,CAAC,EAAE,EAAE,CAC5D,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CACnB,CAAC;AACJ,CAAC"}
|
package/dist/recipient/view.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface RecipientCategoryView {
|
|
|
27
27
|
readonly description?: string;
|
|
28
28
|
readonly enabled: boolean;
|
|
29
29
|
readonly canTurnOff: boolean;
|
|
30
|
+
/** The urgency its messages escalate at, for "Used for" (FXO-3672). */
|
|
31
|
+
readonly level?: "low" | "normal" | "high" | "critical";
|
|
30
32
|
}
|
|
31
33
|
export interface RecipientView {
|
|
32
34
|
readonly accentColor: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/recipient/view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,GAIrC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/recipient/view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,GAIrC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAoE/E;;;;;;GAMG;AACH,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAElC,MAAM,cAAc,GAAqC;IACvD,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;IACzD,OAAO,CACL,kBAAkB,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;QAChD,cAAc,CAAC,OAAO,CAAC;QACvB,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,wBAAwB,CAC/B,OAAyB,EACzB,UAAwC;IAExC,IA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K,CAAC,YAAY;QACvC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY;QACrC,QAAQ;QACR,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,EAAE;QAClC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY;QACvC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC;QACjD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI;QAChD,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI;QAC9B,SAAS,EAAE,OAAO,CAAC,UAAU;QAC7B,oBAAoB,EAAE,UAAU,EAAE,WAAW,IAAI,CAAC;QAClD,qBAAqB,EAAE,cAAc;QACrC,KAAK,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;KACpE,CAAC;AACJ,CAAC"}
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import { verifyWebhookSignature } from "@whooshbang/contracts";
|
|
2
2
|
import type { VerifyWebhookSignatureOptions, WebhookVerificationFailureReason, WhooshBangEventV1ContractDocument } from "@whooshbang/contracts";
|
|
3
|
+
/** A signed event this SDK knows, typed by its `type`. */
|
|
3
4
|
export interface VerifiedWhooshBangEvent {
|
|
4
5
|
readonly attempt: number;
|
|
5
6
|
readonly event: WhooshBangEventV1ContractDocument;
|
|
6
7
|
readonly eventId: string;
|
|
8
|
+
readonly recognized: true;
|
|
9
|
+
readonly timestamp: number;
|
|
10
|
+
readonly verified: true;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A correctly signed event of a type newer than this SDK. Answer it with a
|
|
14
|
+
* 2xx: a 4xx stops its delivery and holds the endpoint's backlog behind it.
|
|
15
|
+
*/
|
|
16
|
+
export interface UnrecognizedWhooshBangEvent {
|
|
17
|
+
readonly created_at: string;
|
|
18
|
+
readonly data: Readonly<Record<string, unknown>>;
|
|
19
|
+
readonly environment: string;
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly organization_id: string;
|
|
22
|
+
readonly project_id: string;
|
|
23
|
+
readonly schema: "whooshbang.event.v1";
|
|
24
|
+
readonly type: string;
|
|
25
|
+
}
|
|
26
|
+
export interface VerifiedUnrecognizedWhooshBangEvent {
|
|
27
|
+
readonly attempt: number;
|
|
28
|
+
readonly event: UnrecognizedWhooshBangEvent;
|
|
29
|
+
readonly eventId: string;
|
|
30
|
+
readonly recognized: false;
|
|
7
31
|
readonly timestamp: number;
|
|
8
32
|
readonly verified: true;
|
|
9
33
|
}
|
|
@@ -11,7 +35,7 @@ export interface RejectedWhooshBangEvent {
|
|
|
11
35
|
readonly reason: WebhookVerificationFailureReason | "event_contract_mismatch" | "event_id_mismatch";
|
|
12
36
|
readonly verified: false;
|
|
13
37
|
}
|
|
14
|
-
export type WhooshBangEventVerification = RejectedWhooshBangEvent | VerifiedWhooshBangEvent;
|
|
38
|
+
export type WhooshBangEventVerification = RejectedWhooshBangEvent | VerifiedUnrecognizedWhooshBangEvent | VerifiedWhooshBangEvent;
|
|
15
39
|
/**
|
|
16
40
|
* Verifies a signed customer event and returns its typed body.
|
|
17
41
|
*
|
|
@@ -23,6 +47,11 @@ export type WhooshBangEventVerification = RejectedWhooshBangEvent | VerifiedWhoo
|
|
|
23
47
|
* checks pass, so unsigned or stale bytes are never decoded. Supplying both
|
|
24
48
|
* the previous and the current secret verifies through a rotation-overlap
|
|
25
49
|
* window without a gap.
|
|
50
|
+
*
|
|
51
|
+
* Newer events stay verifiable, the same way API responses do. A known type
|
|
52
|
+
* with fields or enum values added after this SDK was built verifies as that
|
|
53
|
+
* type, with the new values kept. A type this SDK has never seen verifies as
|
|
54
|
+
* `recognized: false` with only the shared envelope checked; answer it 2xx.
|
|
26
55
|
*/
|
|
27
56
|
export declare function verifyWhooshBangEvent(options: VerifyWebhookSignatureOptions): Promise<WhooshBangEventVerification>;
|
|
28
57
|
/** Signature-only verification over the exact raw request bytes. */
|
package/dist/webhooks.js
CHANGED
|
@@ -1,4 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateAgentBindingDegradedEvent, validateEscalationClosedEvent, validateInteractionExpiredEvent, validateInteractionReceivedEvent, validateMessageDeliveredEvent, validateMessageExpiredEvent, validateMessageFailedEvent, validateMessageProviderAcceptedEvent, validateSubscriptionActivatedEvent, validateSubscriptionAssertedEvent, validateSubscriptionAssertedRevokedEvent, validateSubscriptionRevokedEvent, verifyWebhookSignature, } from "@whooshbang/contracts";
|
|
2
|
+
import { validateAdditiveCompatible } from "./additive-compatibility.js";
|
|
3
|
+
/**
|
|
4
|
+
* Each event type this SDK version knows, with its own validator. The `Record`
|
|
5
|
+
* makes the compiler refuse a contract update that adds a type without one.
|
|
6
|
+
*/
|
|
7
|
+
const EVENT_VALIDATORS = {
|
|
8
|
+
"agent_binding.degraded": validateAgentBindingDegradedEvent,
|
|
9
|
+
"escalation.closed": validateEscalationClosedEvent,
|
|
10
|
+
"interaction.expired": validateInteractionExpiredEvent,
|
|
11
|
+
"interaction.received": validateInteractionReceivedEvent,
|
|
12
|
+
"message.delivered": validateMessageDeliveredEvent,
|
|
13
|
+
"message.expired": validateMessageExpiredEvent,
|
|
14
|
+
"message.failed": validateMessageFailedEvent,
|
|
15
|
+
"message.provider_accepted": validateMessageProviderAcceptedEvent,
|
|
16
|
+
"subscription.activated": validateSubscriptionActivatedEvent,
|
|
17
|
+
"subscription.asserted": validateSubscriptionAssertedEvent,
|
|
18
|
+
"subscription.asserted_revoked": validateSubscriptionAssertedRevokedEvent,
|
|
19
|
+
"subscription.revoked": validateSubscriptionRevokedEvent,
|
|
20
|
+
};
|
|
21
|
+
function isKnownEventType(type) {
|
|
22
|
+
return typeof type === "string" && Object.hasOwn(EVENT_VALIDATORS, type);
|
|
23
|
+
}
|
|
24
|
+
function isNonEmptyString(value) {
|
|
25
|
+
return typeof value === "string" && value.length > 0;
|
|
26
|
+
}
|
|
27
|
+
/** The version-1 envelope every event shares, whatever its type. */
|
|
28
|
+
function isEventEnvelope(value) {
|
|
29
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const event = value;
|
|
33
|
+
return (event.schema === "whooshbang.event.v1" &&
|
|
34
|
+
isNonEmptyString(event.id) &&
|
|
35
|
+
isNonEmptyString(event.type) &&
|
|
36
|
+
isNonEmptyString(event.created_at) &&
|
|
37
|
+
isNonEmptyString(event.organization_id) &&
|
|
38
|
+
isNonEmptyString(event.project_id) &&
|
|
39
|
+
isNonEmptyString(event.environment) &&
|
|
40
|
+
typeof event.data === "object" &&
|
|
41
|
+
event.data !== null &&
|
|
42
|
+
!Array.isArray(event.data));
|
|
43
|
+
}
|
|
2
44
|
/**
|
|
3
45
|
* Verifies a signed customer event and returns its typed body.
|
|
4
46
|
*
|
|
@@ -10,6 +52,11 @@ import { validateWhooshBangEvent, verifyWebhookSignature, } from "@whooshbang/co
|
|
|
10
52
|
* checks pass, so unsigned or stale bytes are never decoded. Supplying both
|
|
11
53
|
* the previous and the current secret verifies through a rotation-overlap
|
|
12
54
|
* window without a gap.
|
|
55
|
+
*
|
|
56
|
+
* Newer events stay verifiable, the same way API responses do. A known type
|
|
57
|
+
* with fields or enum values added after this SDK was built verifies as that
|
|
58
|
+
* type, with the new values kept. A type this SDK has never seen verifies as
|
|
59
|
+
* `recognized: false` with only the shared envelope checked; answer it 2xx.
|
|
13
60
|
*/
|
|
14
61
|
export async function verifyWhooshBangEvent(options) {
|
|
15
62
|
const verification = await verifyWebhookSignature(options);
|
|
@@ -23,7 +70,7 @@ export async function verifyWhooshBangEvent(options) {
|
|
|
23
70
|
catch {
|
|
24
71
|
return { reason: "event_contract_mismatch", verified: false };
|
|
25
72
|
}
|
|
26
|
-
if (!
|
|
73
|
+
if (!isEventEnvelope(parsed)) {
|
|
27
74
|
return { reason: "event_contract_mismatch", verified: false };
|
|
28
75
|
}
|
|
29
76
|
// The signed `webhook-id` and the body's own identifier must agree, or a
|
|
@@ -32,13 +79,19 @@ export async function verifyWhooshBangEvent(options) {
|
|
|
32
79
|
if (parsed.id !== verification.eventId) {
|
|
33
80
|
return { reason: "event_id_mismatch", verified: false };
|
|
34
81
|
}
|
|
35
|
-
|
|
82
|
+
const delivery = {
|
|
36
83
|
attempt: verification.attempt,
|
|
37
|
-
event: parsed,
|
|
38
84
|
eventId: verification.eventId,
|
|
39
85
|
timestamp: verification.timestamp,
|
|
40
86
|
verified: true,
|
|
41
87
|
};
|
|
88
|
+
if (!isKnownEventType(parsed.type)) {
|
|
89
|
+
return { ...delivery, event: parsed, recognized: false };
|
|
90
|
+
}
|
|
91
|
+
if (!validateAdditiveCompatible(parsed, EVENT_VALIDATORS[parsed.type])) {
|
|
92
|
+
return { reason: "event_contract_mismatch", verified: false };
|
|
93
|
+
}
|
|
94
|
+
return { ...delivery, event: parsed, recognized: true };
|
|
42
95
|
}
|
|
43
96
|
/** Signature-only verification over the exact raw request bytes. */
|
|
44
97
|
export async function verifyWhooshBangWebhook(options) {
|
package/dist/webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,6BAA6B,EAC7B,+BAA+B,EAC/B,gCAAgC,EAChC,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,EAC1B,oCAAoC,EACpC,kCAAkC,EAClC,iCAAiC,EACjC,wCAAwC,EACxC,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAazE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AAS;QACjC,QAAQ,EAAE,IAAI;KACN,CAAC;IACX,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAC3D,CAAC;IACD,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACvE,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAChE,CAAC;IACD,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC1D,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAAsC;IAEtC,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whooshbang/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "JavaScript client and browser recipient settings UI for WhooshBang V1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,6 +52,16 @@
|
|
|
52
52
|
"import": "./dist/recipient/i18n/catalog.js",
|
|
53
53
|
"default": "./dist/recipient/i18n/catalog.js"
|
|
54
54
|
},
|
|
55
|
+
"./recipient/order": {
|
|
56
|
+
"types": "./dist/recipient/order-view.d.ts",
|
|
57
|
+
"import": "./dist/recipient/order-view.js",
|
|
58
|
+
"default": "./dist/recipient/order-view.js"
|
|
59
|
+
},
|
|
60
|
+
"./recipient/quiet": {
|
|
61
|
+
"types": "./dist/recipient/quiet-view.d.ts",
|
|
62
|
+
"import": "./dist/recipient/quiet-view.js",
|
|
63
|
+
"default": "./dist/recipient/quiet-view.js"
|
|
64
|
+
},
|
|
55
65
|
"./package.json": "./package.json"
|
|
56
66
|
},
|
|
57
67
|
"bin": {
|
|
@@ -64,7 +74,7 @@
|
|
|
64
74
|
"type-check": "tsc --noEmit -p tsconfig.json"
|
|
65
75
|
},
|
|
66
76
|
"dependencies": {
|
|
67
|
-
"@whooshbang/contracts": "
|
|
77
|
+
"@whooshbang/contracts": "6.0.0"
|
|
68
78
|
},
|
|
69
79
|
"engines": {
|
|
70
80
|
"node": ">=22.13.0"
|