@rapidmx/web-client 0.25.1 → 0.27.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 +15 -3
- package/apps/shared/components/admin/layout/AdminShell.tsx +3 -2
- package/apps/shared/components/calendar/EventDetails.tsx +5 -2
- package/apps/shared/components/contacts/ContactCard.tsx +356 -0
- package/apps/shared/components/contacts/ContactCardProvider.tsx +72 -0
- package/apps/shared/components/contacts/ContactDetailPane.tsx +25 -5
- package/apps/shared/components/contacts/ContactForm.tsx +36 -5
- package/apps/shared/components/contacts/ContactPhotoField.tsx +86 -0
- package/apps/shared/components/contacts/FavoriteStarButton.tsx +36 -0
- package/apps/shared/components/contacts/ParticipantLink.tsx +42 -0
- package/apps/shared/components/contacts/contactCardData.ts +220 -0
- package/apps/shared/components/contacts/participantDetails.ts +169 -0
- package/apps/shared/components/layout/AppShell.tsx +18 -6
- package/apps/shared/components/mail/InviteCard.tsx +27 -5
- package/apps/shared/components/mail/MailAddress.tsx +8 -3
- package/apps/shared/components/mail/MessageDetailPane.tsx +72 -27
- package/apps/shared/components/mail/VCardAttachmentChip.tsx +85 -0
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +112 -1
- package/apps/shared/components/mail/compose/RecipientInput.tsx +1 -0
- package/apps/shared/components/mail/compose/RichTextEditor.tsx +15 -2
- package/apps/shared/components/mail/compose/dropFiles.ts +21 -0
- package/apps/shared/components/settings/layout/SettingsShell.tsx +3 -3
- package/apps/shared/plugins/pluginIcons.ts +124 -0
- package/apps/shared/plugins/pluginNav.ts +8 -0
- package/apps/shared/plugins/useResolvedRailItems.ts +54 -0
- package/apps/www/contacts/[uid].tsx +1 -0
- package/apps/www/contacts/index.tsx +3 -1
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +1 -1
- package/dist/apps/shared/components/admin/layout/AdminShell.js +3 -2
- package/dist/apps/shared/components/calendar/EventDetails.js +2 -1
- package/dist/apps/shared/components/contacts/ContactCard.d.ts +19 -0
- package/dist/apps/shared/components/contacts/ContactCard.js +148 -0
- package/dist/apps/shared/components/contacts/ContactCardProvider.d.ts +25 -0
- package/dist/apps/shared/components/contacts/ContactCardProvider.js +41 -0
- package/dist/apps/shared/components/contacts/ContactDetailPane.d.ts +3 -1
- package/dist/apps/shared/components/contacts/ContactDetailPane.js +17 -2
- package/dist/apps/shared/components/contacts/ContactForm.js +20 -2
- package/dist/apps/shared/components/contacts/ContactPhotoField.d.ts +21 -0
- package/dist/apps/shared/components/contacts/ContactPhotoField.js +46 -0
- package/dist/apps/shared/components/contacts/FavoriteStarButton.d.ts +9 -0
- package/dist/apps/shared/components/contacts/FavoriteStarButton.js +12 -0
- package/dist/apps/shared/components/contacts/ParticipantLink.d.ts +18 -0
- package/dist/apps/shared/components/contacts/ParticipantLink.js +16 -0
- package/dist/apps/shared/components/contacts/contactCardData.d.ts +69 -0
- package/dist/apps/shared/components/contacts/contactCardData.js +158 -0
- package/dist/apps/shared/components/contacts/participantDetails.d.ts +64 -0
- package/dist/apps/shared/components/contacts/participantDetails.js +129 -0
- package/dist/apps/shared/components/layout/AppShell.d.ts +3 -2
- package/dist/apps/shared/components/layout/AppShell.js +24 -15
- package/dist/apps/shared/components/mail/InviteCard.js +5 -3
- package/dist/apps/shared/components/mail/MailAddress.d.ts +5 -2
- package/dist/apps/shared/components/mail/MailAddress.js +5 -3
- package/dist/apps/shared/components/mail/MessageDetailPane.js +19 -7
- package/dist/apps/shared/components/mail/VCardAttachmentChip.d.ts +18 -0
- package/dist/apps/shared/components/mail/VCardAttachmentChip.js +53 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +81 -4
- package/dist/apps/shared/components/mail/compose/RecipientInput.js +1 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +5 -2
- package/dist/apps/shared/components/mail/compose/RichTextEditor.js +10 -1
- package/dist/apps/shared/components/mail/compose/dropFiles.d.ts +8 -0
- package/dist/apps/shared/components/mail/compose/dropFiles.js +18 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +4 -3
- package/dist/apps/shared/plugins/pluginIcons.d.ts +10 -0
- package/dist/apps/shared/plugins/pluginIcons.js +64 -0
- package/dist/apps/shared/plugins/pluginNav.d.ts +8 -0
- package/dist/apps/shared/plugins/useResolvedRailItems.d.ts +12 -0
- package/dist/apps/shared/plugins/useResolvedRailItems.js +47 -0
- package/dist/apps/www/contacts/[uid].js +1 -1
- package/dist/apps/www/contacts/index.js +2 -2
- package/dist/lib/components/avatar/ContactAvatar.d.ts +9 -3
- package/dist/lib/components/avatar/ContactAvatar.js +29 -6
- package/dist/lib/components/buttons/CopyIconButton.d.ts +13 -0
- package/dist/lib/components/buttons/CopyIconButton.js +16 -0
- package/dist/lib/contacts/contactsApi.d.ts +15 -0
- package/dist/lib/contacts/contactsApi.js +31 -2
- package/dist/lib/contacts/gravatar.d.ts +12 -0
- package/dist/lib/contacts/gravatar.js +43 -0
- package/dist/lib/mail/directoryApi.d.ts +16 -10
- package/dist/lib/mail/directoryApi.js +20 -12
- package/lib/components/avatar/ContactAvatar.tsx +43 -7
- package/lib/components/buttons/CopyIconButton.tsx +49 -0
- package/lib/contacts/contactsApi.ts +35 -2
- package/lib/contacts/gravatar.ts +47 -0
- package/lib/mail/directoryApi.ts +30 -12
- package/package.json +1 -1
package/lib/mail/directoryApi.ts
CHANGED
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Typed wrappers over `@rapidmx/restapi`'s `BaseDirectoryRoute` - recipient suggestions for compose. `GET
|
|
7
7
|
* /mail/directory` searches the server's mailboxes (people, shared mailboxes, rooms and equipment) and distribution
|
|
8
|
-
* lists; `GET /mail/directory/contacts` searches the caller's own contacts
|
|
9
|
-
* the
|
|
8
|
+
* lists; `GET /mail/directory/contacts` searches the caller's own contacts; `GET /mail/directory/correspondents` searches
|
|
9
|
+
* everyone the caller's mailboxes have exchanged mail or shared an event with, address book or not. All match every word of
|
|
10
|
+
* the query against the start of a name word or of an address, and return only a display name, an address and a kind.
|
|
10
11
|
*/
|
|
11
12
|
import { ApiClient, ApiRequestError, withClient } from "../util/api.js";
|
|
12
13
|
|
|
13
|
-
/** What a suggestion names. `"contact"` comes from the caller's contacts,
|
|
14
|
-
|
|
14
|
+
/** What a suggestion names. `"contact"` comes from the caller's contacts, `"correspondent"` from the people they have written to, heard from or
|
|
15
|
+
* met with, everything else from the server directory. */
|
|
16
|
+
export type RecipientSuggestionKind = "user" | "shared" | "room" | "equipment" | "list" | "contact" | "correspondent";
|
|
15
17
|
|
|
16
18
|
export interface RecipientSuggestion {
|
|
17
19
|
displayName: string;
|
|
@@ -104,16 +106,29 @@ export function searchContactSuggestions(
|
|
|
104
106
|
);
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
+
/** Searches the people the caller's mailboxes have exchanged mail or shared an event with, whether or not they are in the address book. Rejects like
|
|
110
|
+
* `searchDirectory()`; a server that predates the endpoint answers 404, which `fetchRecipientSuggestions()` treats as "none". */
|
|
111
|
+
export function searchCorrespondents(query: string, options: ContactSuggestionOptions = {}, client?: ApiClient): Promise<RecipientSuggestion[]> {
|
|
112
|
+
return fetchSuggestions(
|
|
113
|
+
"/mail/directory/correspondents",
|
|
114
|
+
query,
|
|
115
|
+
{ limit: options.limit?.toString(), mailboxUid: options.mailboxUid },
|
|
116
|
+
options.signal,
|
|
117
|
+
client,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Contacts first, then directory entries, then the people the caller has corresponded with, without repeating an address (compared
|
|
122
|
+
* case-insensitively; the first occurrence wins), at most `limit`. */
|
|
109
123
|
export function mergeRecipientSuggestions(
|
|
110
124
|
contacts: RecipientSuggestion[],
|
|
111
125
|
directory: RecipientSuggestion[],
|
|
112
126
|
limit: number = RECIPIENT_SUGGESTION_DEFAULT_LIMIT,
|
|
127
|
+
correspondents: RecipientSuggestion[] = [],
|
|
113
128
|
): RecipientSuggestion[] {
|
|
114
129
|
const seen = new Set<string>();
|
|
115
130
|
const result: RecipientSuggestion[] = [];
|
|
116
|
-
for (const entry of [...contacts, ...directory]) {
|
|
131
|
+
for (const entry of [...contacts, ...directory, ...correspondents]) {
|
|
117
132
|
const key = entry.address.trim().toLowerCase();
|
|
118
133
|
if (result.length >= limit) {
|
|
119
134
|
break;
|
|
@@ -131,9 +146,10 @@ function isAbort(error: unknown): boolean {
|
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
/**
|
|
134
|
-
* Contacts and
|
|
135
|
-
* directory for a caller with no mailbox here, a 429, a network error
|
|
136
|
-
* both fail does this reject, with the contacts error
|
|
149
|
+
* Contacts, directory and correspondent suggestions for `query`, merged by `mergeRecipientSuggestions()`. Any source failing (a 403
|
|
150
|
+
* directory for a caller with no mailbox here, a 429, a network error, a server without the correspondents endpoint) still returns
|
|
151
|
+
* the others' entries; only when the contacts and the directory both fail does this reject, with the contacts error - the
|
|
152
|
+
* correspondents are a bonus and never turn a working search into an error. An aborted `signal` always rejects with the `AbortError`.
|
|
137
153
|
*/
|
|
138
154
|
export async function fetchRecipientSuggestions(
|
|
139
155
|
query: string,
|
|
@@ -141,11 +157,12 @@ export async function fetchRecipientSuggestions(
|
|
|
141
157
|
client?: ApiClient,
|
|
142
158
|
): Promise<RecipientSuggestion[]> {
|
|
143
159
|
const limit = options.limit ?? RECIPIENT_SUGGESTION_DEFAULT_LIMIT;
|
|
144
|
-
const [contacts, directory] = await Promise.allSettled([
|
|
160
|
+
const [contacts, directory, correspondents] = await Promise.allSettled([
|
|
145
161
|
searchContactSuggestions(query, { ...options, limit }, client),
|
|
146
162
|
searchDirectory(query, { limit, signal: options.signal }, client),
|
|
163
|
+
searchCorrespondents(query, { ...options, limit }, client),
|
|
147
164
|
]);
|
|
148
|
-
for (const outcome of [contacts, directory]) {
|
|
165
|
+
for (const outcome of [contacts, directory, correspondents]) {
|
|
149
166
|
if (outcome.status === "rejected" && isAbort(outcome.reason)) {
|
|
150
167
|
throw outcome.reason;
|
|
151
168
|
}
|
|
@@ -157,5 +174,6 @@ export async function fetchRecipientSuggestions(
|
|
|
157
174
|
contacts.status === "fulfilled" ? contacts.value : [],
|
|
158
175
|
directory.status === "fulfilled" ? directory.value : [],
|
|
159
176
|
limit,
|
|
177
|
+
correspondents.status === "fulfilled" ? correspondents.value : [],
|
|
160
178
|
);
|
|
161
179
|
}
|
package/package.json
CHANGED