@sudobility/wildduck_client 1.5.3 → 2.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/dist/hooks/index.d.ts +5 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +5 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useWildduckMessage.d.ts +33 -0
- package/dist/hooks/useWildduckMessage.d.ts.map +1 -0
- package/dist/hooks/useWildduckMessage.js +299 -0
- package/dist/hooks/useWildduckMessage.js.map +1 -0
- package/dist/hooks/useWildduckMessages.d.ts +7 -1
- package/dist/hooks/useWildduckMessages.d.ts.map +1 -1
- package/dist/hooks/useWildduckMessages.js +59 -26
- package/dist/hooks/useWildduckMessages.js.map +1 -1
- package/dist/hooks/useWildduckSearch.d.ts +10 -0
- package/dist/hooks/useWildduckSearch.d.ts.map +1 -0
- package/dist/hooks/{messages/useWildduckSearchMessages.js → useWildduckSearch.js} +3 -3
- package/dist/hooks/useWildduckSearch.js.map +1 -0
- package/dist/hooks/useWildduckUser.d.ts +143 -0
- package/dist/hooks/useWildduckUser.d.ts.map +1 -0
- package/dist/hooks/useWildduckUser.js +353 -0
- package/dist/hooks/useWildduckUser.js.map +1 -0
- package/dist/hooks/useWildduckUsers.d.ts +5 -1
- package/dist/hooks/useWildduckUsers.d.ts.map +1 -1
- package/dist/hooks/useWildduckUsers.js +59 -3
- package/dist/hooks/useWildduckUsers.js.map +1 -1
- package/package.json +1 -1
- package/dist/hooks/addresses/index.d.ts +0 -2
- package/dist/hooks/addresses/index.d.ts.map +0 -1
- package/dist/hooks/addresses/index.js +0 -2
- package/dist/hooks/addresses/index.js.map +0 -1
- package/dist/hooks/addresses/useWildduckGetAddresses.d.ts +0 -232
- package/dist/hooks/addresses/useWildduckGetAddresses.d.ts.map +0 -1
- package/dist/hooks/addresses/useWildduckGetAddresses.js +0 -36
- package/dist/hooks/addresses/useWildduckGetAddresses.js.map +0 -1
- package/dist/hooks/messages/index.d.ts +0 -12
- package/dist/hooks/messages/index.d.ts.map +0 -1
- package/dist/hooks/messages/index.js +0 -12
- package/dist/hooks/messages/index.js.map +0 -1
- package/dist/hooks/messages/useWildduckDeleteMessage.d.ts +0 -13
- package/dist/hooks/messages/useWildduckDeleteMessage.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckDeleteMessage.js +0 -52
- package/dist/hooks/messages/useWildduckDeleteMessage.js.map +0 -1
- package/dist/hooks/messages/useWildduckForwardMessage.d.ts +0 -13
- package/dist/hooks/messages/useWildduckForwardMessage.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckForwardMessage.js +0 -51
- package/dist/hooks/messages/useWildduckForwardMessage.js.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessage.d.ts +0 -654
- package/dist/hooks/messages/useWildduckGetMessage.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessage.js +0 -50
- package/dist/hooks/messages/useWildduckGetMessage.js.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessageAttachment.d.ts +0 -13
- package/dist/hooks/messages/useWildduckGetMessageAttachment.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessageAttachment.js +0 -51
- package/dist/hooks/messages/useWildduckGetMessageAttachment.js.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessageSource.d.ts +0 -12
- package/dist/hooks/messages/useWildduckGetMessageSource.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessageSource.js +0 -41
- package/dist/hooks/messages/useWildduckGetMessageSource.js.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessages.d.ts +0 -11
- package/dist/hooks/messages/useWildduckGetMessages.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckGetMessages.js +0 -19
- package/dist/hooks/messages/useWildduckGetMessages.js.map +0 -1
- package/dist/hooks/messages/useWildduckSearchMessages.d.ts +0 -10
- package/dist/hooks/messages/useWildduckSearchMessages.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckSearchMessages.js.map +0 -1
- package/dist/hooks/messages/useWildduckSendMessage.d.ts +0 -13
- package/dist/hooks/messages/useWildduckSendMessage.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckSendMessage.js +0 -48
- package/dist/hooks/messages/useWildduckSendMessage.js.map +0 -1
- package/dist/hooks/messages/useWildduckSubmitDraft.d.ts +0 -13
- package/dist/hooks/messages/useWildduckSubmitDraft.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckSubmitDraft.js +0 -48
- package/dist/hooks/messages/useWildduckSubmitDraft.js.map +0 -1
- package/dist/hooks/messages/useWildduckUpdateMessage.d.ts +0 -13
- package/dist/hooks/messages/useWildduckUpdateMessage.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckUpdateMessage.js +0 -53
- package/dist/hooks/messages/useWildduckUpdateMessage.js.map +0 -1
- package/dist/hooks/messages/useWildduckUploadMessage.d.ts +0 -13
- package/dist/hooks/messages/useWildduckUploadMessage.d.ts.map +0 -1
- package/dist/hooks/messages/useWildduckUploadMessage.js +0 -55
- package/dist/hooks/messages/useWildduckUploadMessage.js.map +0 -1
- package/dist/hooks/users/index.d.ts +0 -12
- package/dist/hooks/users/index.d.ts.map +0 -1
- package/dist/hooks/users/index.js +0 -12
- package/dist/hooks/users/index.js.map +0 -1
- package/dist/hooks/users/useWildduckCreateUser.d.ts +0 -13
- package/dist/hooks/users/useWildduckCreateUser.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckCreateUser.js +0 -47
- package/dist/hooks/users/useWildduckCreateUser.js.map +0 -1
- package/dist/hooks/users/useWildduckDeleteUser.d.ts +0 -13
- package/dist/hooks/users/useWildduckDeleteUser.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckDeleteUser.js +0 -44
- package/dist/hooks/users/useWildduckDeleteUser.js.map +0 -1
- package/dist/hooks/users/useWildduckGetUser.d.ts +0 -397
- package/dist/hooks/users/useWildduckGetUser.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckGetUser.js +0 -47
- package/dist/hooks/users/useWildduckGetUser.js.map +0 -1
- package/dist/hooks/users/useWildduckUpdateUser.d.ts +0 -13
- package/dist/hooks/users/useWildduckUpdateUser.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUpdateUser.js +0 -44
- package/dist/hooks/users/useWildduckUpdateUser.js.map +0 -1
- package/dist/hooks/users/useWildduckUser2FA.d.ts +0 -25
- package/dist/hooks/users/useWildduckUser2FA.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUser2FA.js +0 -72
- package/dist/hooks/users/useWildduckUser2FA.js.map +0 -1
- package/dist/hooks/users/useWildduckUserEncryption.d.ts +0 -40
- package/dist/hooks/users/useWildduckUserEncryption.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUserEncryption.js +0 -98
- package/dist/hooks/users/useWildduckUserEncryption.js.map +0 -1
- package/dist/hooks/users/useWildduckUserForwarding.d.ts +0 -44
- package/dist/hooks/users/useWildduckUserForwarding.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUserForwarding.js +0 -126
- package/dist/hooks/users/useWildduckUserForwarding.js.map +0 -1
- package/dist/hooks/users/useWildduckUserLimits.d.ts +0 -63
- package/dist/hooks/users/useWildduckUserLimits.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUserLimits.js +0 -62
- package/dist/hooks/users/useWildduckUserLimits.js.map +0 -1
- package/dist/hooks/users/useWildduckUserProfile.d.ts +0 -78
- package/dist/hooks/users/useWildduckUserProfile.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUserProfile.js +0 -141
- package/dist/hooks/users/useWildduckUserProfile.js.map +0 -1
- package/dist/hooks/users/useWildduckUserQuota.d.ts +0 -31
- package/dist/hooks/users/useWildduckUserQuota.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUserQuota.js +0 -69
- package/dist/hooks/users/useWildduckUserQuota.js.map +0 -1
- package/dist/hooks/users/useWildduckUserSpam.d.ts +0 -54
- package/dist/hooks/users/useWildduckUserSpam.d.ts.map +0 -1
- package/dist/hooks/users/useWildduckUserSpam.js +0 -146
- package/dist/hooks/users/useWildduckUserSpam.js.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useCallback, useMemo, useState } from "react";
|
|
2
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { WildduckMockData } from "./mocks";
|
|
4
4
|
import { WildduckClient } from "../network/wildduck-client";
|
|
5
5
|
const useWildduckUsers = (networkClient, config, devMode = false) => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
const [isLoading, setIsLoading] = useState(false);
|
|
8
8
|
const [error, setError] = useState(null);
|
|
9
|
+
const [lastFetchParams, setLastFetchParams] = useState(null);
|
|
9
10
|
const api = useMemo(() => new WildduckClient(networkClient, config), [networkClient, config]);
|
|
10
11
|
const getUser = useCallback(async (wildduckUserAuth) => {
|
|
11
12
|
setIsLoading(true);
|
|
@@ -45,6 +46,7 @@ const useWildduckUsers = (networkClient, config, devMode = false) => {
|
|
|
45
46
|
total: usersData.total || 0,
|
|
46
47
|
};
|
|
47
48
|
queryClient.setQueryData(["wildduck-users", query, limit], result);
|
|
49
|
+
setLastFetchParams({ query: query || undefined, limit });
|
|
48
50
|
return result;
|
|
49
51
|
}
|
|
50
52
|
catch (err) {
|
|
@@ -66,14 +68,68 @@ const useWildduckUsers = (networkClient, config, devMode = false) => {
|
|
|
66
68
|
setIsLoading(false);
|
|
67
69
|
}
|
|
68
70
|
}, [api, queryClient, devMode]);
|
|
69
|
-
const
|
|
71
|
+
const createMutation = useMutation({
|
|
72
|
+
mutationKey: [
|
|
73
|
+
"wildduck-create-user",
|
|
74
|
+
config.cloudflareWorkerUrl || config.backendUrl,
|
|
75
|
+
],
|
|
76
|
+
mutationFn: async (params) => {
|
|
77
|
+
try {
|
|
78
|
+
return await api.createUser(params);
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
if (devMode) {
|
|
82
|
+
return {
|
|
83
|
+
success: true,
|
|
84
|
+
id: `mock-user-${Date.now()}`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
console.error("Failed to create user:", err);
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
onSuccess: async () => {
|
|
92
|
+
queryClient.invalidateQueries({
|
|
93
|
+
queryKey: ["wildduck-users"],
|
|
94
|
+
});
|
|
95
|
+
if (lastFetchParams) {
|
|
96
|
+
await getUsers(lastFetchParams.query, lastFetchParams.limit);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
const createUser = useCallback(async (params) => {
|
|
101
|
+
return createMutation.mutateAsync(params);
|
|
102
|
+
}, [createMutation]);
|
|
103
|
+
const refresh = useCallback(async () => {
|
|
104
|
+
if (lastFetchParams) {
|
|
105
|
+
await getUsers(lastFetchParams.query, lastFetchParams.limit);
|
|
106
|
+
}
|
|
107
|
+
}, [lastFetchParams, getUsers]);
|
|
108
|
+
const clearError = useCallback(() => {
|
|
109
|
+
setError(null);
|
|
110
|
+
createMutation.reset();
|
|
111
|
+
}, [createMutation]);
|
|
70
112
|
return useMemo(() => ({
|
|
71
113
|
isLoading,
|
|
72
114
|
error,
|
|
73
115
|
getUser,
|
|
74
116
|
getUsers,
|
|
117
|
+
createUser,
|
|
118
|
+
isCreating: createMutation.isPending,
|
|
119
|
+
createError: createMutation.error,
|
|
120
|
+
refresh,
|
|
121
|
+
clearError,
|
|
122
|
+
}), [
|
|
123
|
+
isLoading,
|
|
124
|
+
error,
|
|
125
|
+
getUser,
|
|
126
|
+
getUsers,
|
|
127
|
+
createUser,
|
|
128
|
+
createMutation.isPending,
|
|
129
|
+
createMutation.error,
|
|
130
|
+
refresh,
|
|
75
131
|
clearError,
|
|
76
|
-
|
|
132
|
+
]);
|
|
77
133
|
};
|
|
78
134
|
export { useWildduckUsers };
|
|
79
135
|
//# sourceMappingURL=useWildduckUsers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckUsers.js","sourceRoot":"","sources":["../../src/hooks/useWildduckUsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useWildduckUsers.js","sourceRoot":"","sources":["../../src/hooks/useWildduckUsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AA2B5D,MAAM,gBAAgB,GAAG,CACvB,aAA4B,EAC5B,MAAsB,EACtB,UAAmB,KAAK,EACA,EAAE;IAC1B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC,CAAC;IAC3D,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAG5C,IAAI,CAAC,CAAC;IAGhB,MAAM,GAAG,GAAG,OAAO,CACjB,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,EAC/C,CAAC,aAAa,EAAE,MAAM,CAAC,CACxB,CAAC;IAGF,MAAM,OAAO,GAAG,WAAW,CACzB,KAAK,EAAE,gBAAkC,EAAyB,EAAE;QAClE,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IA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AC,CAAC;QAC/D,CAAC;IACH,CAAC,EAAE,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEhC,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,cAAc,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,SAAS;QACT,KAAK;QACL,OAAO;QACP,QAAQ;QACR,UAAU;QACV,UAAU,EAAE,cAAc,CAAC,SAAS;QACpC,WAAW,EAAE,cAAc,CAAC,KAAK;QACjC,OAAO;QACP,UAAU;KACX,CAAC,EACF;QACE,SAAS;QACT,KAAK;QACL,OAAO;QACP,QAAQ;QACR,UAAU;QACV,cAAc,CAAC,SAAS;QACxB,cAAc,CAAC,KAAK;QACpB,OAAO;QACP,UAAU;KACX,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/addresses/index.ts"],"names":[],"mappings":"AAMA,cAAc,2BAA2B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/addresses/index.ts"],"names":[],"mappings":"AAMA,cAAc,2BAA2B,CAAC"}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { type NetworkClient } from "@sudobility/types";
|
|
2
|
-
import { type WildduckConfig } from "@sudobility/types";
|
|
3
|
-
import type { WildduckUserAuth } from "@sudobility/types";
|
|
4
|
-
export interface UseWildduckGetAddressesParams {
|
|
5
|
-
wildduckUserAuth?: WildduckUserAuth;
|
|
6
|
-
devMode?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const useWildduckGetAddresses: (networkClient: NetworkClient, config: WildduckConfig, params?: UseWildduckGetAddressesParams) => {
|
|
9
|
-
data: import("@sudobility/types").WildduckAddressResponse | {
|
|
10
|
-
success: boolean;
|
|
11
|
-
results: never[];
|
|
12
|
-
error: null;
|
|
13
|
-
} | undefined;
|
|
14
|
-
error: Error;
|
|
15
|
-
isError: true;
|
|
16
|
-
isPending: false;
|
|
17
|
-
isLoading: false;
|
|
18
|
-
isLoadingError: false;
|
|
19
|
-
isRefetchError: true;
|
|
20
|
-
isSuccess: false;
|
|
21
|
-
isPlaceholderData: false;
|
|
22
|
-
status: "error";
|
|
23
|
-
dataUpdatedAt: number;
|
|
24
|
-
errorUpdatedAt: number;
|
|
25
|
-
failureCount: number;
|
|
26
|
-
failureReason: Error | null;
|
|
27
|
-
errorUpdateCount: number;
|
|
28
|
-
isFetched: boolean;
|
|
29
|
-
isFetchedAfterMount: boolean;
|
|
30
|
-
isFetching: boolean;
|
|
31
|
-
isInitialLoading: boolean;
|
|
32
|
-
isPaused: boolean;
|
|
33
|
-
isRefetching: boolean;
|
|
34
|
-
isStale: boolean;
|
|
35
|
-
isEnabled: boolean;
|
|
36
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckAddressResponse | {
|
|
37
|
-
success: boolean;
|
|
38
|
-
results: never[];
|
|
39
|
-
error: null;
|
|
40
|
-
} | undefined, Error>>;
|
|
41
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
42
|
-
promise: Promise<import("@sudobility/types").WildduckAddressResponse | {
|
|
43
|
-
success: boolean;
|
|
44
|
-
results: never[];
|
|
45
|
-
error: null;
|
|
46
|
-
} | undefined>;
|
|
47
|
-
} | {
|
|
48
|
-
data: import("@sudobility/types").WildduckAddressResponse | {
|
|
49
|
-
success: boolean;
|
|
50
|
-
results: never[];
|
|
51
|
-
error: null;
|
|
52
|
-
} | undefined;
|
|
53
|
-
error: null;
|
|
54
|
-
isError: false;
|
|
55
|
-
isPending: false;
|
|
56
|
-
isLoading: false;
|
|
57
|
-
isLoadingError: false;
|
|
58
|
-
isRefetchError: false;
|
|
59
|
-
isSuccess: true;
|
|
60
|
-
isPlaceholderData: false;
|
|
61
|
-
status: "success";
|
|
62
|
-
dataUpdatedAt: number;
|
|
63
|
-
errorUpdatedAt: number;
|
|
64
|
-
failureCount: number;
|
|
65
|
-
failureReason: Error | null;
|
|
66
|
-
errorUpdateCount: number;
|
|
67
|
-
isFetched: boolean;
|
|
68
|
-
isFetchedAfterMount: boolean;
|
|
69
|
-
isFetching: boolean;
|
|
70
|
-
isInitialLoading: boolean;
|
|
71
|
-
isPaused: boolean;
|
|
72
|
-
isRefetching: boolean;
|
|
73
|
-
isStale: boolean;
|
|
74
|
-
isEnabled: boolean;
|
|
75
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckAddressResponse | {
|
|
76
|
-
success: boolean;
|
|
77
|
-
results: never[];
|
|
78
|
-
error: null;
|
|
79
|
-
} | undefined, Error>>;
|
|
80
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
81
|
-
promise: Promise<import("@sudobility/types").WildduckAddressResponse | {
|
|
82
|
-
success: boolean;
|
|
83
|
-
results: never[];
|
|
84
|
-
error: null;
|
|
85
|
-
} | undefined>;
|
|
86
|
-
} | {
|
|
87
|
-
data: undefined;
|
|
88
|
-
error: Error;
|
|
89
|
-
isError: true;
|
|
90
|
-
isPending: false;
|
|
91
|
-
isLoading: false;
|
|
92
|
-
isLoadingError: true;
|
|
93
|
-
isRefetchError: false;
|
|
94
|
-
isSuccess: false;
|
|
95
|
-
isPlaceholderData: false;
|
|
96
|
-
status: "error";
|
|
97
|
-
dataUpdatedAt: number;
|
|
98
|
-
errorUpdatedAt: number;
|
|
99
|
-
failureCount: number;
|
|
100
|
-
failureReason: Error | null;
|
|
101
|
-
errorUpdateCount: number;
|
|
102
|
-
isFetched: boolean;
|
|
103
|
-
isFetchedAfterMount: boolean;
|
|
104
|
-
isFetching: boolean;
|
|
105
|
-
isInitialLoading: boolean;
|
|
106
|
-
isPaused: boolean;
|
|
107
|
-
isRefetching: boolean;
|
|
108
|
-
isStale: boolean;
|
|
109
|
-
isEnabled: boolean;
|
|
110
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckAddressResponse | {
|
|
111
|
-
success: boolean;
|
|
112
|
-
results: never[];
|
|
113
|
-
error: null;
|
|
114
|
-
} | undefined, Error>>;
|
|
115
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
116
|
-
promise: Promise<import("@sudobility/types").WildduckAddressResponse | {
|
|
117
|
-
success: boolean;
|
|
118
|
-
results: never[];
|
|
119
|
-
error: null;
|
|
120
|
-
} | undefined>;
|
|
121
|
-
} | {
|
|
122
|
-
data: undefined;
|
|
123
|
-
error: null;
|
|
124
|
-
isError: false;
|
|
125
|
-
isPending: true;
|
|
126
|
-
isLoading: true;
|
|
127
|
-
isLoadingError: false;
|
|
128
|
-
isRefetchError: false;
|
|
129
|
-
isSuccess: false;
|
|
130
|
-
isPlaceholderData: false;
|
|
131
|
-
status: "pending";
|
|
132
|
-
dataUpdatedAt: number;
|
|
133
|
-
errorUpdatedAt: number;
|
|
134
|
-
failureCount: number;
|
|
135
|
-
failureReason: Error | null;
|
|
136
|
-
errorUpdateCount: number;
|
|
137
|
-
isFetched: boolean;
|
|
138
|
-
isFetchedAfterMount: boolean;
|
|
139
|
-
isFetching: boolean;
|
|
140
|
-
isInitialLoading: boolean;
|
|
141
|
-
isPaused: boolean;
|
|
142
|
-
isRefetching: boolean;
|
|
143
|
-
isStale: boolean;
|
|
144
|
-
isEnabled: boolean;
|
|
145
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckAddressResponse | {
|
|
146
|
-
success: boolean;
|
|
147
|
-
results: never[];
|
|
148
|
-
error: null;
|
|
149
|
-
} | undefined, Error>>;
|
|
150
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
151
|
-
promise: Promise<import("@sudobility/types").WildduckAddressResponse | {
|
|
152
|
-
success: boolean;
|
|
153
|
-
results: never[];
|
|
154
|
-
error: null;
|
|
155
|
-
} | undefined>;
|
|
156
|
-
} | {
|
|
157
|
-
data: undefined;
|
|
158
|
-
error: null;
|
|
159
|
-
isError: false;
|
|
160
|
-
isPending: true;
|
|
161
|
-
isLoadingError: false;
|
|
162
|
-
isRefetchError: false;
|
|
163
|
-
isSuccess: false;
|
|
164
|
-
isPlaceholderData: false;
|
|
165
|
-
status: "pending";
|
|
166
|
-
dataUpdatedAt: number;
|
|
167
|
-
errorUpdatedAt: number;
|
|
168
|
-
failureCount: number;
|
|
169
|
-
failureReason: Error | null;
|
|
170
|
-
errorUpdateCount: number;
|
|
171
|
-
isFetched: boolean;
|
|
172
|
-
isFetchedAfterMount: boolean;
|
|
173
|
-
isFetching: boolean;
|
|
174
|
-
isLoading: boolean;
|
|
175
|
-
isInitialLoading: boolean;
|
|
176
|
-
isPaused: boolean;
|
|
177
|
-
isRefetching: boolean;
|
|
178
|
-
isStale: boolean;
|
|
179
|
-
isEnabled: boolean;
|
|
180
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckAddressResponse | {
|
|
181
|
-
success: boolean;
|
|
182
|
-
results: never[];
|
|
183
|
-
error: null;
|
|
184
|
-
} | undefined, Error>>;
|
|
185
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
186
|
-
promise: Promise<import("@sudobility/types").WildduckAddressResponse | {
|
|
187
|
-
success: boolean;
|
|
188
|
-
results: never[];
|
|
189
|
-
error: null;
|
|
190
|
-
} | undefined>;
|
|
191
|
-
} | {
|
|
192
|
-
data: import("@sudobility/types").WildduckAddressResponse | {
|
|
193
|
-
success: boolean;
|
|
194
|
-
results: never[];
|
|
195
|
-
error: null;
|
|
196
|
-
} | undefined;
|
|
197
|
-
isError: false;
|
|
198
|
-
error: null;
|
|
199
|
-
isPending: false;
|
|
200
|
-
isLoading: false;
|
|
201
|
-
isLoadingError: false;
|
|
202
|
-
isRefetchError: false;
|
|
203
|
-
isSuccess: true;
|
|
204
|
-
isPlaceholderData: true;
|
|
205
|
-
status: "success";
|
|
206
|
-
dataUpdatedAt: number;
|
|
207
|
-
errorUpdatedAt: number;
|
|
208
|
-
failureCount: number;
|
|
209
|
-
failureReason: Error | null;
|
|
210
|
-
errorUpdateCount: number;
|
|
211
|
-
isFetched: boolean;
|
|
212
|
-
isFetchedAfterMount: boolean;
|
|
213
|
-
isFetching: boolean;
|
|
214
|
-
isInitialLoading: boolean;
|
|
215
|
-
isPaused: boolean;
|
|
216
|
-
isRefetching: boolean;
|
|
217
|
-
isStale: boolean;
|
|
218
|
-
isEnabled: boolean;
|
|
219
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckAddressResponse | {
|
|
220
|
-
success: boolean;
|
|
221
|
-
results: never[];
|
|
222
|
-
error: null;
|
|
223
|
-
} | undefined, Error>>;
|
|
224
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
225
|
-
promise: Promise<import("@sudobility/types").WildduckAddressResponse | {
|
|
226
|
-
success: boolean;
|
|
227
|
-
results: never[];
|
|
228
|
-
error: null;
|
|
229
|
-
} | undefined>;
|
|
230
|
-
};
|
|
231
|
-
export type UseWildduckGetAddressesReturn = ReturnType<typeof useWildduckGetAddresses>;
|
|
232
|
-
//# sourceMappingURL=useWildduckGetAddresses.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckGetAddresses.d.ts","sourceRoot":"","sources":["../../../src/hooks/addresses/useWildduckGetAddresses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,6BAA6B;IAC5C,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAWD,eAAO,MAAM,uBAAuB,GAClC,eAAe,aAAa,EAC5B,QAAQ,cAAc,EACtB,SAAQ,6BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C3C,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CACpD,OAAO,uBAAuB,CAC/B,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3
|
-
import { WildduckClient } from "../../network/wildduck-client";
|
|
4
|
-
export const useWildduckGetAddresses = (networkClient, config, params = {}) => {
|
|
5
|
-
const { wildduckUserAuth, devMode = false } = params;
|
|
6
|
-
const api = useMemo(() => new WildduckClient(networkClient, config), [networkClient, config]);
|
|
7
|
-
const queryFn = useCallback(async () => {
|
|
8
|
-
if (!wildduckUserAuth) {
|
|
9
|
-
console.error("wildduckUserAuth is required");
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
return await api.getAddresses(wildduckUserAuth);
|
|
14
|
-
}
|
|
15
|
-
catch (err) {
|
|
16
|
-
if (devMode) {
|
|
17
|
-
return {
|
|
18
|
-
success: true,
|
|
19
|
-
results: [],
|
|
20
|
-
error: null,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
console.error("Failed to get addresses:", err);
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
}, [wildduckUserAuth, api, devMode]);
|
|
27
|
-
const query = useQuery({
|
|
28
|
-
queryKey: ["wildduck-addresses", wildduckUserAuth?.userId],
|
|
29
|
-
queryFn,
|
|
30
|
-
enabled: !!wildduckUserAuth,
|
|
31
|
-
});
|
|
32
|
-
return useMemo(() => ({
|
|
33
|
-
...query,
|
|
34
|
-
}), [query]);
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=useWildduckGetAddresses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckGetAddresses.js","sourceRoot":"","sources":["../../../src/hooks/addresses/useWildduckGetAddresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAmB/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,aAA4B,EAC5B,MAAsB,EACtB,SAAwC,EAAE,EAC1C,EAAE;IACF,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;IAErD,MAAM,GAAG,GAAG,OAAO,CACjB,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,EAC/C,CAAC,aAAa,EAAE,MAAM,CAAC,CACxB,CAAC;IAEF,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACrC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAC9C,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,GAAG,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,EAAE;oBACX,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;YAC/C,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IAErC,MAAM,KAAK,GAAG,QAAQ,CAAC;QACrB,QAAQ,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,CAAC;QAC1D,OAAO;QACP,OAAO,EAAE,CAAC,CAAC,gBAAgB;KAC5B,CAAC,CAAC;IAEH,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,KAAK;KACT,CAAC,EACF,CAAC,KAAK,CAAC,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from "./useWildduckGetMessages";
|
|
2
|
-
export * from "./useWildduckGetMessage";
|
|
3
|
-
export * from "./useWildduckSearchMessages";
|
|
4
|
-
export * from "./useWildduckGetMessageSource";
|
|
5
|
-
export * from "./useWildduckGetMessageAttachment";
|
|
6
|
-
export * from "./useWildduckSendMessage";
|
|
7
|
-
export * from "./useWildduckUpdateMessage";
|
|
8
|
-
export * from "./useWildduckDeleteMessage";
|
|
9
|
-
export * from "./useWildduckUploadMessage";
|
|
10
|
-
export * from "./useWildduckForwardMessage";
|
|
11
|
-
export * from "./useWildduckSubmitDraft";
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/messages/index.ts"],"names":[],"mappings":"AAMA,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAGlD,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from "./useWildduckGetMessages";
|
|
2
|
-
export * from "./useWildduckGetMessage";
|
|
3
|
-
export * from "./useWildduckSearchMessages";
|
|
4
|
-
export * from "./useWildduckGetMessageSource";
|
|
5
|
-
export * from "./useWildduckGetMessageAttachment";
|
|
6
|
-
export * from "./useWildduckSendMessage";
|
|
7
|
-
export * from "./useWildduckUpdateMessage";
|
|
8
|
-
export * from "./useWildduckDeleteMessage";
|
|
9
|
-
export * from "./useWildduckUploadMessage";
|
|
10
|
-
export * from "./useWildduckForwardMessage";
|
|
11
|
-
export * from "./useWildduckSubmitDraft";
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/messages/index.ts"],"names":[],"mappings":"AAMA,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAGlD,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Optional } from "@sudobility/types";
|
|
2
|
-
import { type NetworkClient } from "@sudobility/types";
|
|
3
|
-
import { type WildduckConfig } from "@sudobility/types";
|
|
4
|
-
import type { WildduckSuccessResponse, WildduckUserAuth } from "@sudobility/types";
|
|
5
|
-
interface UseWildduckDeleteMessageReturn {
|
|
6
|
-
deleteMessage: (wildduckUserAuth: WildduckUserAuth, mailboxId: string, messageId: number) => Promise<WildduckSuccessResponse>;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
error: Optional<Error>;
|
|
9
|
-
clearError: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const useWildduckDeleteMessage: (networkClient: NetworkClient, config: WildduckConfig, devMode?: boolean) => UseWildduckDeleteMessageReturn;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=useWildduckDeleteMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckDeleteMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/messages/useWildduckDeleteMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,UAAU,8BAA8B;IACtC,aAAa,EAAE,CACb,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAYD,eAAO,MAAM,wBAAwB,GACnC,eAAe,aAAa,EAC5B,QAAQ,cAAc,EACtB,UAAS,OAAe,KACvB,8BAgFF,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
-
import { WildduckClient } from "../../network/wildduck-client";
|
|
3
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
export const useWildduckDeleteMessage = (networkClient, config, devMode = false) => {
|
|
5
|
-
const queryClient = useQueryClient();
|
|
6
|
-
const wildduckClient = useMemo(() => new WildduckClient(networkClient, config), [networkClient, config]);
|
|
7
|
-
const deleteMutation = useMutation({
|
|
8
|
-
mutationKey: [
|
|
9
|
-
"wildduck-delete-message",
|
|
10
|
-
config.cloudflareWorkerUrl || config.backendUrl,
|
|
11
|
-
],
|
|
12
|
-
mutationFn: async ({ wildduckUserAuth, mailboxId, messageId, }) => {
|
|
13
|
-
try {
|
|
14
|
-
return await wildduckClient.deleteMessage(wildduckUserAuth, mailboxId, messageId);
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
if (devMode) {
|
|
18
|
-
return { success: true };
|
|
19
|
-
}
|
|
20
|
-
console.error("Failed to delete message:", err);
|
|
21
|
-
return { success: false };
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
onSuccess: (_, variables) => {
|
|
25
|
-
queryClient.invalidateQueries({
|
|
26
|
-
queryKey: [
|
|
27
|
-
"wildduck-message",
|
|
28
|
-
variables.wildduckUserAuth.userId,
|
|
29
|
-
variables.messageId,
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
queryClient.invalidateQueries({
|
|
33
|
-
queryKey: ["wildduck-messages", variables.wildduckUserAuth.userId],
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
const deleteMessage = useCallback(async (wildduckUserAuth, mailboxId, messageId) => {
|
|
38
|
-
return deleteMutation.mutateAsync({
|
|
39
|
-
wildduckUserAuth,
|
|
40
|
-
mailboxId,
|
|
41
|
-
messageId,
|
|
42
|
-
});
|
|
43
|
-
}, [deleteMutation]);
|
|
44
|
-
const clearError = useCallback(() => deleteMutation.reset(), [deleteMutation]);
|
|
45
|
-
return useMemo(() => ({
|
|
46
|
-
deleteMessage,
|
|
47
|
-
isLoading: deleteMutation.isPending,
|
|
48
|
-
error: deleteMutation.error,
|
|
49
|
-
clearError,
|
|
50
|
-
}), [deleteMessage, deleteMutation.isPending, deleteMutation.error, clearError]);
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=useWildduckDeleteMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckDeleteMessage.js","sourceRoot":"","sources":["../../../src/hooks/messages/useWildduckDeleteMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA2BpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,aAA4B,EAC5B,MAAsB,EACtB,UAAmB,KAAK,EACQ,EAAE;IAClC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,cAAc,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,EAC/C,CAAC,aAAa,EAAE,MAAM,CAAC,CACxB,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAAC;QACjC,WAAW,EAAE;YACX,yBAAyB;YACzB,MAAM,CAAC,mBAAmB,IAAI,MAAM,CAAC,UAAU;SAChD;QACD,UAAU,EAAE,KAAK,EAAE,EACjB,gBAAgB,EAChB,SAAS,EACT,SAAS,GAKV,EAAoC,EAAE;YACrC,IAAI,CAAC;gBACH,OAAO,MAAM,cAAc,CAAC,aAAa,CACvC,gBAAgB,EACh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AAK,EAAE,UAAU,CAAC,CAC5E,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Optional } from "@sudobility/types";
|
|
2
|
-
import { type NetworkClient } from "@sudobility/types";
|
|
3
|
-
import { type WildduckConfig } from "@sudobility/types";
|
|
4
|
-
import type { WildduckForwardMessageRequest, WildduckSuccessResponse, WildduckUserAuth } from "@sudobility/types";
|
|
5
|
-
interface UseWildduckForwardMessageReturn {
|
|
6
|
-
forwardMessage: (wildduckUserAuth: WildduckUserAuth, mailboxId: string, messageId: number, params: WildduckForwardMessageRequest) => Promise<WildduckSuccessResponse>;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
error: Optional<Error>;
|
|
9
|
-
clearError: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const useWildduckForwardMessage: (networkClient: NetworkClient, config: WildduckConfig, devMode?: boolean) => UseWildduckForwardMessageReturn;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=useWildduckForwardMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckForwardMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/messages/useWildduckForwardMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,UAAU,+BAA+B;IACvC,cAAc,EAAE,CACd,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,6BAA6B,KAClC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAYD,eAAO,MAAM,yBAAyB,GACpC,eAAe,aAAa,EAC5B,QAAQ,cAAc,EACtB,UAAS,OAAe,KACvB,+BAmFF,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
-
import { WildduckClient } from "../../network/wildduck-client";
|
|
3
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
export const useWildduckForwardMessage = (networkClient, config, devMode = false) => {
|
|
5
|
-
const queryClient = useQueryClient();
|
|
6
|
-
const wildduckClient = useMemo(() => new WildduckClient(networkClient, config), [networkClient, config]);
|
|
7
|
-
const forwardMutation = useMutation({
|
|
8
|
-
mutationKey: [
|
|
9
|
-
"wildduck-forward-message",
|
|
10
|
-
config.cloudflareWorkerUrl || config.backendUrl,
|
|
11
|
-
],
|
|
12
|
-
mutationFn: async ({ wildduckUserAuth, mailboxId, messageId, params, }) => {
|
|
13
|
-
try {
|
|
14
|
-
return await wildduckClient.forwardMessage(wildduckUserAuth, mailboxId, messageId, params);
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
if (devMode) {
|
|
18
|
-
return { success: true };
|
|
19
|
-
}
|
|
20
|
-
console.error("Failed to forward message:", err);
|
|
21
|
-
return { success: false };
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
onSuccess: (_, variables) => {
|
|
25
|
-
queryClient.invalidateQueries({
|
|
26
|
-
queryKey: ["wildduck-messages", variables.wildduckUserAuth.userId],
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
const forwardMessage = useCallback(async (wildduckUserAuth, mailboxId, messageId, params) => {
|
|
31
|
-
return forwardMutation.mutateAsync({
|
|
32
|
-
wildduckUserAuth,
|
|
33
|
-
mailboxId,
|
|
34
|
-
messageId,
|
|
35
|
-
params,
|
|
36
|
-
});
|
|
37
|
-
}, [forwardMutation]);
|
|
38
|
-
const clearError = useCallback(() => forwardMutation.reset(), [forwardMutation]);
|
|
39
|
-
return useMemo(() => ({
|
|
40
|
-
forwardMessage,
|
|
41
|
-
isLoading: forwardMutation.isPending,
|
|
42
|
-
error: forwardMutation.error,
|
|
43
|
-
clearError,
|
|
44
|
-
}), [
|
|
45
|
-
forwardMessage,
|
|
46
|
-
forwardMutation.isPending,
|
|
47
|
-
forwardMutation.error,
|
|
48
|
-
clearError,
|
|
49
|
-
]);
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=useWildduckForwardMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckForwardMessage.js","sourceRoot":"","sources":["../../../src/hooks/messages/useWildduckForwardMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA6BpE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,aAA4B,EAC5B,MAAsB,EACtB,UAAmB,KAAK,EACS,EAAE;IACnC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,cAAc,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,EAC/C,CAAC,aAAa,EAAE,MAAM,CAAC,CACxB,CAAC;IAEF,MAAM,eAAe,GAAG,WAAW,CAAC;QAClC,WAAW,EAAE;YACX,0BAA0B;YAC1B,MAAM,CAAC,mBAAmB,IAAI,MAAM,CAAC,UAAU;SAChD;QACD,UAAU,EAAE,KAAK,EAAE,EACjB,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,MAAM,GAMP,EAAoC,EAAE;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