@arbidocs/react 0.4.106 → 0.4.108
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/index.cjs +104 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +65 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkX2KOIXHA_cjs = require('./chunk-X2KOIXHA.cjs');
|
|
4
4
|
var chunk5DCRIWCA_cjs = require('./chunk-5DCRIWCA.cjs');
|
|
5
|
+
var chunkF7KQVVD2_cjs = require('./chunk-F7KQVVD2.cjs');
|
|
5
6
|
var chunkKOZ2CJY6_cjs = require('./chunk-KOZ2CJY6.cjs');
|
|
6
7
|
var chunkTBELZWGV_cjs = require('./chunk-TBELZWGV.cjs');
|
|
7
8
|
var chunkWYZJLZ67_cjs = require('./chunk-WYZJLZ67.cjs');
|
|
8
9
|
var chunkZ3LLUO32_cjs = require('./chunk-Z3LLUO32.cjs');
|
|
9
|
-
var chunkF7KQVVD2_cjs = require('./chunk-F7KQVVD2.cjs');
|
|
10
10
|
var chunkHUZB36QU_cjs = require('./chunk-HUZB36QU.cjs');
|
|
11
11
|
var chunkHJDR5HEO_cjs = require('./chunk-HJDR5HEO.cjs');
|
|
12
12
|
var chunkS6A6FSG7_cjs = require('./chunk-S6A6FSG7.cjs');
|
|
@@ -2719,6 +2719,47 @@ function useSendMail(fallback) {
|
|
|
2719
2719
|
}
|
|
2720
2720
|
});
|
|
2721
2721
|
}
|
|
2722
|
+
function useMailDraftEditor() {
|
|
2723
|
+
const { client } = useMailClient();
|
|
2724
|
+
const queryClient = reactQuery.useQueryClient();
|
|
2725
|
+
return React.useMemo(() => {
|
|
2726
|
+
const call = (roomId, path, payload) => mailJson(client.fetch, `/drafts/editor/${encodeURIComponent(roomId)}${path}`, {
|
|
2727
|
+
method: "POST",
|
|
2728
|
+
body: JSON.stringify(payload)
|
|
2729
|
+
});
|
|
2730
|
+
return {
|
|
2731
|
+
/** Save as the draft: suggestions still waiting stay out of it. */
|
|
2732
|
+
save: async (roomId, compose, state) => {
|
|
2733
|
+
const saved = await call(roomId, "/save", { compose, state });
|
|
2734
|
+
void queryClient.invalidateQueries({ queryKey: mailQueryKeys.allMessages() });
|
|
2735
|
+
return saved;
|
|
2736
|
+
},
|
|
2737
|
+
/** Send (refused, `status` 409, while suggestions wait). */
|
|
2738
|
+
send: async (roomId, compose, state) => {
|
|
2739
|
+
const sent = await call(roomId, "/send", { compose, state });
|
|
2740
|
+
void queryClient.invalidateQueries({ queryKey: mailQueryKeys.all() });
|
|
2741
|
+
return sent;
|
|
2742
|
+
},
|
|
2743
|
+
/** The body as text and HTML (`final`: refused while suggestions wait). */
|
|
2744
|
+
body: (roomId, final, state) => call(roomId, "/body", { final, state }),
|
|
2745
|
+
/** Bill ARBI's work on this email to another project the person may bill (null: their own). */
|
|
2746
|
+
setProject: (roomId, projectExtId) => mailJson(
|
|
2747
|
+
client.fetch,
|
|
2748
|
+
`/drafts/editor/${encodeURIComponent(roomId)}/project`,
|
|
2749
|
+
{ method: "PUT", body: JSON.stringify({ project_ext_id: projectExtId }) }
|
|
2750
|
+
)
|
|
2751
|
+
};
|
|
2752
|
+
}, [client, queryClient]);
|
|
2753
|
+
}
|
|
2754
|
+
function useMailProjects(options = {}) {
|
|
2755
|
+
const { client } = useMailClient();
|
|
2756
|
+
return reactQuery.useQuery({
|
|
2757
|
+
queryKey: ["mail", "projects"],
|
|
2758
|
+
queryFn: () => mailJson(client.fetch, "/drafts/editor/projects"),
|
|
2759
|
+
enabled: options.enabled ?? true,
|
|
2760
|
+
staleTime: 6e4
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2722
2763
|
function useMailDraftCompose(account, draftId, prepare, options = {}) {
|
|
2723
2764
|
return reactQuery.useQuery({
|
|
2724
2765
|
queryKey: ["mail", "draft-compose", account?.id, draftId],
|
|
@@ -2729,6 +2770,27 @@ function useMailDraftCompose(account, draftId, prepare, options = {}) {
|
|
|
2729
2770
|
staleTime: Infinity
|
|
2730
2771
|
});
|
|
2731
2772
|
}
|
|
2773
|
+
var MAIL_DRAFT_REPLACED_EVENT = "arbi:mail-draft-replaced";
|
|
2774
|
+
function announceMailDraftReplaced(oldId, newId) {
|
|
2775
|
+
window.dispatchEvent(
|
|
2776
|
+
new CustomEvent(MAIL_DRAFT_REPLACED_EVENT, { detail: { oldId, newId } })
|
|
2777
|
+
);
|
|
2778
|
+
}
|
|
2779
|
+
function useMailDraftReplaced(draftId, onReplaced) {
|
|
2780
|
+
const latest = React.useRef(onReplaced);
|
|
2781
|
+
React.useEffect(() => {
|
|
2782
|
+
latest.current = onReplaced;
|
|
2783
|
+
});
|
|
2784
|
+
React.useEffect(() => {
|
|
2785
|
+
if (!draftId) return;
|
|
2786
|
+
const listener = (event) => {
|
|
2787
|
+
const { oldId, newId } = event.detail;
|
|
2788
|
+
if (oldId === draftId) latest.current(newId);
|
|
2789
|
+
};
|
|
2790
|
+
window.addEventListener(MAIL_DRAFT_REPLACED_EVENT, listener);
|
|
2791
|
+
return () => window.removeEventListener(MAIL_DRAFT_REPLACED_EVENT, listener);
|
|
2792
|
+
}, [draftId]);
|
|
2793
|
+
}
|
|
2732
2794
|
function useWorkspaceDocs(workspaceId) {
|
|
2733
2795
|
const { data: docs = [], isLoading, isError } = chunkX2KOIXHA_cjs.useDocuments(workspaceId);
|
|
2734
2796
|
const docIds = React.useMemo(
|
|
@@ -7117,6 +7179,42 @@ Object.defineProperty(exports, "unwrapCitationLinks", {
|
|
|
7117
7179
|
enumerable: true,
|
|
7118
7180
|
get: function () { return chunk5DCRIWCA_cjs.unwrapCitationLinks; }
|
|
7119
7181
|
});
|
|
7182
|
+
Object.defineProperty(exports, "DEFAULT_NOTIFY_TONE", {
|
|
7183
|
+
enumerable: true,
|
|
7184
|
+
get: function () { return chunkF7KQVVD2_cjs.DEFAULT_NOTIFY_TONE; }
|
|
7185
|
+
});
|
|
7186
|
+
Object.defineProperty(exports, "NotificationBell", {
|
|
7187
|
+
enumerable: true,
|
|
7188
|
+
get: function () { return chunkF7KQVVD2_cjs.NotificationBell; }
|
|
7189
|
+
});
|
|
7190
|
+
Object.defineProperty(exports, "Toaster", {
|
|
7191
|
+
enumerable: true,
|
|
7192
|
+
get: function () { return chunkF7KQVVD2_cjs.Toaster; }
|
|
7193
|
+
});
|
|
7194
|
+
Object.defineProperty(exports, "formatRelativeTime", {
|
|
7195
|
+
enumerable: true,
|
|
7196
|
+
get: function () { return chunkF7KQVVD2_cjs.formatRelativeTime; }
|
|
7197
|
+
});
|
|
7198
|
+
Object.defineProperty(exports, "notify", {
|
|
7199
|
+
enumerable: true,
|
|
7200
|
+
get: function () { return chunkF7KQVVD2_cjs.notify; }
|
|
7201
|
+
});
|
|
7202
|
+
Object.defineProperty(exports, "seedNotifications", {
|
|
7203
|
+
enumerable: true,
|
|
7204
|
+
get: function () { return chunkF7KQVVD2_cjs.seedNotifications; }
|
|
7205
|
+
});
|
|
7206
|
+
Object.defineProperty(exports, "selectUnread", {
|
|
7207
|
+
enumerable: true,
|
|
7208
|
+
get: function () { return chunkF7KQVVD2_cjs.selectUnread; }
|
|
7209
|
+
});
|
|
7210
|
+
Object.defineProperty(exports, "toast", {
|
|
7211
|
+
enumerable: true,
|
|
7212
|
+
get: function () { return chunkF7KQVVD2_cjs.toast; }
|
|
7213
|
+
});
|
|
7214
|
+
Object.defineProperty(exports, "useNotify", {
|
|
7215
|
+
enumerable: true,
|
|
7216
|
+
get: function () { return chunkF7KQVVD2_cjs.useNotify; }
|
|
7217
|
+
});
|
|
7120
7218
|
Object.defineProperty(exports, "AgentBadge", {
|
|
7121
7219
|
enumerable: true,
|
|
7122
7220
|
get: function () { return chunkKOZ2CJY6_cjs.AgentBadge; }
|
|
@@ -7709,42 +7807,6 @@ Object.defineProperty(exports, "trimOpenCitation", {
|
|
|
7709
7807
|
enumerable: true,
|
|
7710
7808
|
get: function () { return chunkZ3LLUO32_cjs.trimOpenCitation; }
|
|
7711
7809
|
});
|
|
7712
|
-
Object.defineProperty(exports, "DEFAULT_NOTIFY_TONE", {
|
|
7713
|
-
enumerable: true,
|
|
7714
|
-
get: function () { return chunkF7KQVVD2_cjs.DEFAULT_NOTIFY_TONE; }
|
|
7715
|
-
});
|
|
7716
|
-
Object.defineProperty(exports, "NotificationBell", {
|
|
7717
|
-
enumerable: true,
|
|
7718
|
-
get: function () { return chunkF7KQVVD2_cjs.NotificationBell; }
|
|
7719
|
-
});
|
|
7720
|
-
Object.defineProperty(exports, "Toaster", {
|
|
7721
|
-
enumerable: true,
|
|
7722
|
-
get: function () { return chunkF7KQVVD2_cjs.Toaster; }
|
|
7723
|
-
});
|
|
7724
|
-
Object.defineProperty(exports, "formatRelativeTime", {
|
|
7725
|
-
enumerable: true,
|
|
7726
|
-
get: function () { return chunkF7KQVVD2_cjs.formatRelativeTime; }
|
|
7727
|
-
});
|
|
7728
|
-
Object.defineProperty(exports, "notify", {
|
|
7729
|
-
enumerable: true,
|
|
7730
|
-
get: function () { return chunkF7KQVVD2_cjs.notify; }
|
|
7731
|
-
});
|
|
7732
|
-
Object.defineProperty(exports, "seedNotifications", {
|
|
7733
|
-
enumerable: true,
|
|
7734
|
-
get: function () { return chunkF7KQVVD2_cjs.seedNotifications; }
|
|
7735
|
-
});
|
|
7736
|
-
Object.defineProperty(exports, "selectUnread", {
|
|
7737
|
-
enumerable: true,
|
|
7738
|
-
get: function () { return chunkF7KQVVD2_cjs.selectUnread; }
|
|
7739
|
-
});
|
|
7740
|
-
Object.defineProperty(exports, "toast", {
|
|
7741
|
-
enumerable: true,
|
|
7742
|
-
get: function () { return chunkF7KQVVD2_cjs.toast; }
|
|
7743
|
-
});
|
|
7744
|
-
Object.defineProperty(exports, "useNotify", {
|
|
7745
|
-
enumerable: true,
|
|
7746
|
-
get: function () { return chunkF7KQVVD2_cjs.useNotify; }
|
|
7747
|
-
});
|
|
7748
7810
|
Object.defineProperty(exports, "ScrollArea", {
|
|
7749
7811
|
enumerable: true,
|
|
7750
7812
|
get: function () { return chunkHUZB36QU_cjs.ScrollArea; }
|
|
@@ -7901,6 +7963,7 @@ exports.GoogleIcon = GoogleIcon;
|
|
|
7901
7963
|
exports.ImageCropModal = ImageCropModal;
|
|
7902
7964
|
exports.ImageCropper = ImageCropper;
|
|
7903
7965
|
exports.LinkedInIcon = LinkedInIcon;
|
|
7966
|
+
exports.MAIL_DRAFT_REPLACED_EVENT = MAIL_DRAFT_REPLACED_EVENT;
|
|
7904
7967
|
exports.MAX_AVATAR_FILE_BYTES = MAX_AVATAR_FILE_BYTES;
|
|
7905
7968
|
exports.MailClientProvider = MailClientProvider;
|
|
7906
7969
|
exports.MailOfflineUnavailableError = MailOfflineUnavailableError;
|
|
@@ -7919,6 +7982,7 @@ exports.VoiceNoteRecorder = VoiceNoteRecorder;
|
|
|
7919
7982
|
exports.accountPath = accountPath;
|
|
7920
7983
|
exports.aliasTakenMessage = aliasTakenMessage;
|
|
7921
7984
|
exports.annotateThread = annotateThread;
|
|
7985
|
+
exports.announceMailDraftReplaced = announceMailDraftReplaced;
|
|
7922
7986
|
exports.arbiMailClient = arbiMailClient;
|
|
7923
7987
|
exports.captureFrameAsBlob = captureFrameAsBlob;
|
|
7924
7988
|
exports.createMailClient = createMailClient;
|
|
@@ -8006,11 +8070,14 @@ exports.useMailAccounts = useMailAccounts;
|
|
|
8006
8070
|
exports.useMailCache = useMailCache;
|
|
8007
8071
|
exports.useMailClient = useMailClient;
|
|
8008
8072
|
exports.useMailDraftCompose = useMailDraftCompose;
|
|
8073
|
+
exports.useMailDraftEditor = useMailDraftEditor;
|
|
8074
|
+
exports.useMailDraftReplaced = useMailDraftReplaced;
|
|
8009
8075
|
exports.useMailFolders = useMailFolders;
|
|
8010
8076
|
exports.useMailMessage = useMailMessage;
|
|
8011
8077
|
exports.useMailMessages = useMailMessages;
|
|
8012
8078
|
exports.useMailOnline = useMailOnline;
|
|
8013
8079
|
exports.useMailPolicy = useMailPolicy;
|
|
8080
|
+
exports.useMailProjects = useMailProjects;
|
|
8014
8081
|
exports.useMailUnlock = useMailUnlock;
|
|
8015
8082
|
exports.useNameEditor = useNameEditor;
|
|
8016
8083
|
exports.useNotificationPreferences = useNotificationPreferences;
|