@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckCreateUser.js","sourceRoot":"","sources":["../../../src/hooks/users/useWildduckCreateUser.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;AAyBpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,aAA4B,EAC5B,MAAsB,EACtB,UAAmB,KAAK,EACH,EAAE;IACvB,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,sBAAsB;YACtB,MAAM,CAAC,mBAAmB,IAAI,MAAM,CAAC,UAAU;SAChD;QACD,UAAU,EAAE,KAAK,EACf,MAAiC,EACI,EAAE;YACvC,IAAI,CAAC;gBACH,OAAO,MAAM,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO;wBACL,OAAO,EAAE,IAAI;wBACb,EAAE,EAAE,aAAa,IAAI,CAAC,GAAG,EAAE,EAAE;qBAC9B,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;gBAC7C,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,EAAE,EAAE,EAAE;iBACP,CAAC;YACJ,CAAC;QACH,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YAEd,WAAW,CAAC,iBAAiB,CAAC;gBAC5B,QAAQ,EAAE,CAAC,gBAAgB,CAAC;aAC7B,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,WAAW,CAC5B,KAAK,EAAE,MAAiC,EAAE,EAAE;QAC1C,OAAO,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,CAC5B,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,EAC5B,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,UAAU;QACV,SAAS,EAAE,cAAc,CAAC,SAAS;QACnC,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,UAAU;KACX,CAAC,EACF,CAAC,UAAU,EAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CACzE,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 { WildduckSuccessResponse, WildduckUserAuth } from "@sudobility/types";
|
|
5
|
-
interface UseDeleteUserReturn {
|
|
6
|
-
deleteUser: (wildduckUserAuth: WildduckUserAuth) => Promise<WildduckSuccessResponse>;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
error: Optional<Error>;
|
|
9
|
-
clearError: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const useWildduckDeleteUser: (networkClient: NetworkClient, config: WildduckConfig, devMode?: boolean) => UseDeleteUserReturn;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=useWildduckDeleteUser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckDeleteUser.d.ts","sourceRoot":"","sources":["../../../src/hooks/users/useWildduckDeleteUser.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,mBAAmB;IAC3B,UAAU,EAAE,CACV,gBAAgB,EAAE,gBAAgB,KAC/B,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,qBAAqB,GAChC,eAAe,aAAa,EAC5B,QAAQ,cAAc,EACtB,UAAS,OAAe,KACvB,mBA2DF,CAAC"}
|
|
@@ -1,44 +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 useWildduckDeleteUser = (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-user",
|
|
10
|
-
config.cloudflareWorkerUrl || config.backendUrl,
|
|
11
|
-
],
|
|
12
|
-
mutationFn: async (wildduckUserAuth) => {
|
|
13
|
-
try {
|
|
14
|
-
return await wildduckClient.deleteUser(wildduckUserAuth);
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
if (devMode) {
|
|
18
|
-
return { success: true };
|
|
19
|
-
}
|
|
20
|
-
console.error("Failed to delete user:", err);
|
|
21
|
-
return { success: false };
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
onSuccess: (_, wildduckUserAuth) => {
|
|
25
|
-
queryClient.invalidateQueries({
|
|
26
|
-
queryKey: ["wildduck-users"],
|
|
27
|
-
});
|
|
28
|
-
queryClient.removeQueries({
|
|
29
|
-
queryKey: ["wildduck-user", wildduckUserAuth.userId],
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
const deleteUser = useCallback(async (wildduckUserAuth) => {
|
|
34
|
-
return deleteMutation.mutateAsync(wildduckUserAuth);
|
|
35
|
-
}, [deleteMutation]);
|
|
36
|
-
const clearError = useCallback(() => deleteMutation.reset(), [deleteMutation]);
|
|
37
|
-
return useMemo(() => ({
|
|
38
|
-
deleteUser,
|
|
39
|
-
isLoading: deleteMutation.isPending,
|
|
40
|
-
error: deleteMutation.error,
|
|
41
|
-
clearError,
|
|
42
|
-
}), [deleteUser, deleteMutation.isPending, deleteMutation.error, clearError]);
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=useWildduckDeleteUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckDeleteUser.js","sourceRoot":"","sources":["../../../src/hooks/users/useWildduckDeleteUser.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;AAyBpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,aAA4B,EAC5B,MAAsB,EACtB,UAAmB,KAAK,EACH,EAAE;IACvB,MAAM,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AC,KAAK,EAAE,EAC5B,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,UAAU;QACV,SAAS,EAAE,cAAc,CAAC,SAAS;QACnC,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,UAAU;KACX,CAAC,EACF,CAAC,UAAU,EAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CACzE,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,397 +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 UseWildduckGetUserParams {
|
|
5
|
-
wildduckUserAuth?: WildduckUserAuth;
|
|
6
|
-
devMode?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const useWildduckGetUser: (networkClient: NetworkClient, config: WildduckConfig, params?: UseWildduckGetUserParams) => {
|
|
9
|
-
data: import("@sudobility/types").WildduckUserResponse | {
|
|
10
|
-
success: boolean;
|
|
11
|
-
id: string;
|
|
12
|
-
username: string;
|
|
13
|
-
name: string;
|
|
14
|
-
address: string;
|
|
15
|
-
quota: {
|
|
16
|
-
allowed: number;
|
|
17
|
-
used: number;
|
|
18
|
-
};
|
|
19
|
-
hasPasswordSet: boolean;
|
|
20
|
-
activated: boolean;
|
|
21
|
-
disabled: boolean;
|
|
22
|
-
suspended: boolean;
|
|
23
|
-
error: null;
|
|
24
|
-
} | undefined;
|
|
25
|
-
error: Error;
|
|
26
|
-
isError: true;
|
|
27
|
-
isPending: false;
|
|
28
|
-
isLoading: false;
|
|
29
|
-
isLoadingError: false;
|
|
30
|
-
isRefetchError: true;
|
|
31
|
-
isSuccess: false;
|
|
32
|
-
isPlaceholderData: false;
|
|
33
|
-
status: "error";
|
|
34
|
-
dataUpdatedAt: number;
|
|
35
|
-
errorUpdatedAt: number;
|
|
36
|
-
failureCount: number;
|
|
37
|
-
failureReason: Error | null;
|
|
38
|
-
errorUpdateCount: number;
|
|
39
|
-
isFetched: boolean;
|
|
40
|
-
isFetchedAfterMount: boolean;
|
|
41
|
-
isFetching: boolean;
|
|
42
|
-
isInitialLoading: boolean;
|
|
43
|
-
isPaused: boolean;
|
|
44
|
-
isRefetching: boolean;
|
|
45
|
-
isStale: boolean;
|
|
46
|
-
isEnabled: boolean;
|
|
47
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckUserResponse | {
|
|
48
|
-
success: boolean;
|
|
49
|
-
id: string;
|
|
50
|
-
username: string;
|
|
51
|
-
name: string;
|
|
52
|
-
address: string;
|
|
53
|
-
quota: {
|
|
54
|
-
allowed: number;
|
|
55
|
-
used: number;
|
|
56
|
-
};
|
|
57
|
-
hasPasswordSet: boolean;
|
|
58
|
-
activated: boolean;
|
|
59
|
-
disabled: boolean;
|
|
60
|
-
suspended: boolean;
|
|
61
|
-
error: null;
|
|
62
|
-
} | undefined, Error>>;
|
|
63
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
64
|
-
promise: Promise<import("@sudobility/types").WildduckUserResponse | {
|
|
65
|
-
success: boolean;
|
|
66
|
-
id: string;
|
|
67
|
-
username: string;
|
|
68
|
-
name: string;
|
|
69
|
-
address: string;
|
|
70
|
-
quota: {
|
|
71
|
-
allowed: number;
|
|
72
|
-
used: number;
|
|
73
|
-
};
|
|
74
|
-
hasPasswordSet: boolean;
|
|
75
|
-
activated: boolean;
|
|
76
|
-
disabled: boolean;
|
|
77
|
-
suspended: boolean;
|
|
78
|
-
error: null;
|
|
79
|
-
} | undefined>;
|
|
80
|
-
} | {
|
|
81
|
-
data: import("@sudobility/types").WildduckUserResponse | {
|
|
82
|
-
success: boolean;
|
|
83
|
-
id: string;
|
|
84
|
-
username: string;
|
|
85
|
-
name: string;
|
|
86
|
-
address: string;
|
|
87
|
-
quota: {
|
|
88
|
-
allowed: number;
|
|
89
|
-
used: number;
|
|
90
|
-
};
|
|
91
|
-
hasPasswordSet: boolean;
|
|
92
|
-
activated: boolean;
|
|
93
|
-
disabled: boolean;
|
|
94
|
-
suspended: boolean;
|
|
95
|
-
error: null;
|
|
96
|
-
} | undefined;
|
|
97
|
-
error: null;
|
|
98
|
-
isError: false;
|
|
99
|
-
isPending: false;
|
|
100
|
-
isLoading: false;
|
|
101
|
-
isLoadingError: false;
|
|
102
|
-
isRefetchError: false;
|
|
103
|
-
isSuccess: true;
|
|
104
|
-
isPlaceholderData: false;
|
|
105
|
-
status: "success";
|
|
106
|
-
dataUpdatedAt: number;
|
|
107
|
-
errorUpdatedAt: number;
|
|
108
|
-
failureCount: number;
|
|
109
|
-
failureReason: Error | null;
|
|
110
|
-
errorUpdateCount: number;
|
|
111
|
-
isFetched: boolean;
|
|
112
|
-
isFetchedAfterMount: boolean;
|
|
113
|
-
isFetching: boolean;
|
|
114
|
-
isInitialLoading: boolean;
|
|
115
|
-
isPaused: boolean;
|
|
116
|
-
isRefetching: boolean;
|
|
117
|
-
isStale: boolean;
|
|
118
|
-
isEnabled: boolean;
|
|
119
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckUserResponse | {
|
|
120
|
-
success: boolean;
|
|
121
|
-
id: string;
|
|
122
|
-
username: string;
|
|
123
|
-
name: string;
|
|
124
|
-
address: string;
|
|
125
|
-
quota: {
|
|
126
|
-
allowed: number;
|
|
127
|
-
used: number;
|
|
128
|
-
};
|
|
129
|
-
hasPasswordSet: boolean;
|
|
130
|
-
activated: boolean;
|
|
131
|
-
disabled: boolean;
|
|
132
|
-
suspended: boolean;
|
|
133
|
-
error: null;
|
|
134
|
-
} | undefined, Error>>;
|
|
135
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
136
|
-
promise: Promise<import("@sudobility/types").WildduckUserResponse | {
|
|
137
|
-
success: boolean;
|
|
138
|
-
id: string;
|
|
139
|
-
username: string;
|
|
140
|
-
name: string;
|
|
141
|
-
address: string;
|
|
142
|
-
quota: {
|
|
143
|
-
allowed: number;
|
|
144
|
-
used: number;
|
|
145
|
-
};
|
|
146
|
-
hasPasswordSet: boolean;
|
|
147
|
-
activated: boolean;
|
|
148
|
-
disabled: boolean;
|
|
149
|
-
suspended: boolean;
|
|
150
|
-
error: null;
|
|
151
|
-
} | undefined>;
|
|
152
|
-
} | {
|
|
153
|
-
data: undefined;
|
|
154
|
-
error: Error;
|
|
155
|
-
isError: true;
|
|
156
|
-
isPending: false;
|
|
157
|
-
isLoading: false;
|
|
158
|
-
isLoadingError: true;
|
|
159
|
-
isRefetchError: false;
|
|
160
|
-
isSuccess: false;
|
|
161
|
-
isPlaceholderData: false;
|
|
162
|
-
status: "error";
|
|
163
|
-
dataUpdatedAt: number;
|
|
164
|
-
errorUpdatedAt: number;
|
|
165
|
-
failureCount: number;
|
|
166
|
-
failureReason: Error | null;
|
|
167
|
-
errorUpdateCount: number;
|
|
168
|
-
isFetched: boolean;
|
|
169
|
-
isFetchedAfterMount: boolean;
|
|
170
|
-
isFetching: boolean;
|
|
171
|
-
isInitialLoading: boolean;
|
|
172
|
-
isPaused: boolean;
|
|
173
|
-
isRefetching: boolean;
|
|
174
|
-
isStale: boolean;
|
|
175
|
-
isEnabled: boolean;
|
|
176
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckUserResponse | {
|
|
177
|
-
success: boolean;
|
|
178
|
-
id: string;
|
|
179
|
-
username: string;
|
|
180
|
-
name: string;
|
|
181
|
-
address: string;
|
|
182
|
-
quota: {
|
|
183
|
-
allowed: number;
|
|
184
|
-
used: number;
|
|
185
|
-
};
|
|
186
|
-
hasPasswordSet: boolean;
|
|
187
|
-
activated: boolean;
|
|
188
|
-
disabled: boolean;
|
|
189
|
-
suspended: boolean;
|
|
190
|
-
error: null;
|
|
191
|
-
} | undefined, Error>>;
|
|
192
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
193
|
-
promise: Promise<import("@sudobility/types").WildduckUserResponse | {
|
|
194
|
-
success: boolean;
|
|
195
|
-
id: string;
|
|
196
|
-
username: string;
|
|
197
|
-
name: string;
|
|
198
|
-
address: string;
|
|
199
|
-
quota: {
|
|
200
|
-
allowed: number;
|
|
201
|
-
used: number;
|
|
202
|
-
};
|
|
203
|
-
hasPasswordSet: boolean;
|
|
204
|
-
activated: boolean;
|
|
205
|
-
disabled: boolean;
|
|
206
|
-
suspended: boolean;
|
|
207
|
-
error: null;
|
|
208
|
-
} | undefined>;
|
|
209
|
-
} | {
|
|
210
|
-
data: undefined;
|
|
211
|
-
error: null;
|
|
212
|
-
isError: false;
|
|
213
|
-
isPending: true;
|
|
214
|
-
isLoading: true;
|
|
215
|
-
isLoadingError: false;
|
|
216
|
-
isRefetchError: false;
|
|
217
|
-
isSuccess: false;
|
|
218
|
-
isPlaceholderData: false;
|
|
219
|
-
status: "pending";
|
|
220
|
-
dataUpdatedAt: number;
|
|
221
|
-
errorUpdatedAt: number;
|
|
222
|
-
failureCount: number;
|
|
223
|
-
failureReason: Error | null;
|
|
224
|
-
errorUpdateCount: number;
|
|
225
|
-
isFetched: boolean;
|
|
226
|
-
isFetchedAfterMount: boolean;
|
|
227
|
-
isFetching: boolean;
|
|
228
|
-
isInitialLoading: boolean;
|
|
229
|
-
isPaused: boolean;
|
|
230
|
-
isRefetching: boolean;
|
|
231
|
-
isStale: boolean;
|
|
232
|
-
isEnabled: boolean;
|
|
233
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckUserResponse | {
|
|
234
|
-
success: boolean;
|
|
235
|
-
id: string;
|
|
236
|
-
username: string;
|
|
237
|
-
name: string;
|
|
238
|
-
address: string;
|
|
239
|
-
quota: {
|
|
240
|
-
allowed: number;
|
|
241
|
-
used: number;
|
|
242
|
-
};
|
|
243
|
-
hasPasswordSet: boolean;
|
|
244
|
-
activated: boolean;
|
|
245
|
-
disabled: boolean;
|
|
246
|
-
suspended: boolean;
|
|
247
|
-
error: null;
|
|
248
|
-
} | undefined, Error>>;
|
|
249
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
250
|
-
promise: Promise<import("@sudobility/types").WildduckUserResponse | {
|
|
251
|
-
success: boolean;
|
|
252
|
-
id: string;
|
|
253
|
-
username: string;
|
|
254
|
-
name: string;
|
|
255
|
-
address: string;
|
|
256
|
-
quota: {
|
|
257
|
-
allowed: number;
|
|
258
|
-
used: number;
|
|
259
|
-
};
|
|
260
|
-
hasPasswordSet: boolean;
|
|
261
|
-
activated: boolean;
|
|
262
|
-
disabled: boolean;
|
|
263
|
-
suspended: boolean;
|
|
264
|
-
error: null;
|
|
265
|
-
} | undefined>;
|
|
266
|
-
} | {
|
|
267
|
-
data: undefined;
|
|
268
|
-
error: null;
|
|
269
|
-
isError: false;
|
|
270
|
-
isPending: true;
|
|
271
|
-
isLoadingError: false;
|
|
272
|
-
isRefetchError: false;
|
|
273
|
-
isSuccess: false;
|
|
274
|
-
isPlaceholderData: false;
|
|
275
|
-
status: "pending";
|
|
276
|
-
dataUpdatedAt: number;
|
|
277
|
-
errorUpdatedAt: number;
|
|
278
|
-
failureCount: number;
|
|
279
|
-
failureReason: Error | null;
|
|
280
|
-
errorUpdateCount: number;
|
|
281
|
-
isFetched: boolean;
|
|
282
|
-
isFetchedAfterMount: boolean;
|
|
283
|
-
isFetching: boolean;
|
|
284
|
-
isLoading: boolean;
|
|
285
|
-
isInitialLoading: boolean;
|
|
286
|
-
isPaused: boolean;
|
|
287
|
-
isRefetching: boolean;
|
|
288
|
-
isStale: boolean;
|
|
289
|
-
isEnabled: boolean;
|
|
290
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckUserResponse | {
|
|
291
|
-
success: boolean;
|
|
292
|
-
id: string;
|
|
293
|
-
username: string;
|
|
294
|
-
name: string;
|
|
295
|
-
address: string;
|
|
296
|
-
quota: {
|
|
297
|
-
allowed: number;
|
|
298
|
-
used: number;
|
|
299
|
-
};
|
|
300
|
-
hasPasswordSet: boolean;
|
|
301
|
-
activated: boolean;
|
|
302
|
-
disabled: boolean;
|
|
303
|
-
suspended: boolean;
|
|
304
|
-
error: null;
|
|
305
|
-
} | undefined, Error>>;
|
|
306
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
307
|
-
promise: Promise<import("@sudobility/types").WildduckUserResponse | {
|
|
308
|
-
success: boolean;
|
|
309
|
-
id: string;
|
|
310
|
-
username: string;
|
|
311
|
-
name: string;
|
|
312
|
-
address: string;
|
|
313
|
-
quota: {
|
|
314
|
-
allowed: number;
|
|
315
|
-
used: number;
|
|
316
|
-
};
|
|
317
|
-
hasPasswordSet: boolean;
|
|
318
|
-
activated: boolean;
|
|
319
|
-
disabled: boolean;
|
|
320
|
-
suspended: boolean;
|
|
321
|
-
error: null;
|
|
322
|
-
} | undefined>;
|
|
323
|
-
} | {
|
|
324
|
-
data: import("@sudobility/types").WildduckUserResponse | {
|
|
325
|
-
success: boolean;
|
|
326
|
-
id: string;
|
|
327
|
-
username: string;
|
|
328
|
-
name: string;
|
|
329
|
-
address: string;
|
|
330
|
-
quota: {
|
|
331
|
-
allowed: number;
|
|
332
|
-
used: number;
|
|
333
|
-
};
|
|
334
|
-
hasPasswordSet: boolean;
|
|
335
|
-
activated: boolean;
|
|
336
|
-
disabled: boolean;
|
|
337
|
-
suspended: boolean;
|
|
338
|
-
error: null;
|
|
339
|
-
} | undefined;
|
|
340
|
-
isError: false;
|
|
341
|
-
error: null;
|
|
342
|
-
isPending: false;
|
|
343
|
-
isLoading: false;
|
|
344
|
-
isLoadingError: false;
|
|
345
|
-
isRefetchError: false;
|
|
346
|
-
isSuccess: true;
|
|
347
|
-
isPlaceholderData: true;
|
|
348
|
-
status: "success";
|
|
349
|
-
dataUpdatedAt: number;
|
|
350
|
-
errorUpdatedAt: number;
|
|
351
|
-
failureCount: number;
|
|
352
|
-
failureReason: Error | null;
|
|
353
|
-
errorUpdateCount: number;
|
|
354
|
-
isFetched: boolean;
|
|
355
|
-
isFetchedAfterMount: boolean;
|
|
356
|
-
isFetching: boolean;
|
|
357
|
-
isInitialLoading: boolean;
|
|
358
|
-
isPaused: boolean;
|
|
359
|
-
isRefetching: boolean;
|
|
360
|
-
isStale: boolean;
|
|
361
|
-
isEnabled: boolean;
|
|
362
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@sudobility/types").WildduckUserResponse | {
|
|
363
|
-
success: boolean;
|
|
364
|
-
id: string;
|
|
365
|
-
username: string;
|
|
366
|
-
name: string;
|
|
367
|
-
address: string;
|
|
368
|
-
quota: {
|
|
369
|
-
allowed: number;
|
|
370
|
-
used: number;
|
|
371
|
-
};
|
|
372
|
-
hasPasswordSet: boolean;
|
|
373
|
-
activated: boolean;
|
|
374
|
-
disabled: boolean;
|
|
375
|
-
suspended: boolean;
|
|
376
|
-
error: null;
|
|
377
|
-
} | undefined, Error>>;
|
|
378
|
-
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
379
|
-
promise: Promise<import("@sudobility/types").WildduckUserResponse | {
|
|
380
|
-
success: boolean;
|
|
381
|
-
id: string;
|
|
382
|
-
username: string;
|
|
383
|
-
name: string;
|
|
384
|
-
address: string;
|
|
385
|
-
quota: {
|
|
386
|
-
allowed: number;
|
|
387
|
-
used: number;
|
|
388
|
-
};
|
|
389
|
-
hasPasswordSet: boolean;
|
|
390
|
-
activated: boolean;
|
|
391
|
-
disabled: boolean;
|
|
392
|
-
suspended: boolean;
|
|
393
|
-
error: null;
|
|
394
|
-
} | undefined>;
|
|
395
|
-
};
|
|
396
|
-
export type UseWildduckGetUserReturn = ReturnType<typeof useWildduckGetUser>;
|
|
397
|
-
//# sourceMappingURL=useWildduckGetUser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckGetUser.d.ts","sourceRoot":"","sources":["../../../src/hooks/users/useWildduckGetUser.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,wBAAwB;IACvC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAWD,eAAO,MAAM,kBAAkB,GAC7B,eAAe,aAAa,EAC5B,QAAQ,cAAc,EACtB,SAAQ,wBAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,47 +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 useWildduckGetUser = (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.getUser(wildduckUserAuth);
|
|
14
|
-
}
|
|
15
|
-
catch (err) {
|
|
16
|
-
if (devMode) {
|
|
17
|
-
return {
|
|
18
|
-
success: true,
|
|
19
|
-
id: wildduckUserAuth.userId,
|
|
20
|
-
username: `${wildduckUserAuth.userId}@example.com`,
|
|
21
|
-
name: `Mock User ${wildduckUserAuth.userId}`,
|
|
22
|
-
address: `${wildduckUserAuth.userId}@example.com`,
|
|
23
|
-
quota: {
|
|
24
|
-
allowed: 1073741824,
|
|
25
|
-
used: 134217728,
|
|
26
|
-
},
|
|
27
|
-
hasPasswordSet: false,
|
|
28
|
-
activated: true,
|
|
29
|
-
disabled: false,
|
|
30
|
-
suspended: false,
|
|
31
|
-
error: null,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
console.error("Failed to get user:", err);
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
}, [wildduckUserAuth, api, devMode]);
|
|
38
|
-
const query = useQuery({
|
|
39
|
-
queryKey: ["wildduck-user", wildduckUserAuth?.userId],
|
|
40
|
-
queryFn,
|
|
41
|
-
enabled: !!wildduckUserAuth,
|
|
42
|
-
});
|
|
43
|
-
return useMemo(() => ({
|
|
44
|
-
...query,
|
|
45
|
-
}), [query]);
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=useWildduckGetUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckGetUser.js","sourceRoot":"","sources":["../../../src/hooks/users/useWild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AAS,EAAE,KAAK;oBAChB,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;YAC1C,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,eAAe,EAAE,gBAAgB,EAAE,MAAM,CAAC;QACrD,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,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, WildduckUpdateUserRequest, WildduckUserAuth } from "@sudobility/types";
|
|
5
|
-
interface UseUpdateUserReturn {
|
|
6
|
-
updateUser: (wildduckUserAuth: WildduckUserAuth, params: WildduckUpdateUserRequest) => Promise<WildduckSuccessResponse>;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
error: Optional<Error>;
|
|
9
|
-
clearError: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const useWildduckUpdateUser: (networkClient: NetworkClient, config: WildduckConfig, devMode?: boolean) => UseUpdateUserReturn;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=useWildduckUpdateUser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckUpdateUser.d.ts","sourceRoot":"","sources":["../../../src/hooks/users/useWildduckUpdateUser.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,yBAAyB,EACzB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,UAAU,mBAAmB;IAC3B,UAAU,EAAE,CACV,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,yBAAyB,KAC9B,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,qBAAqB,GAChC,eAAe,aAAa,EAC5B,QAAQ,cAAc,EACtB,UAAS,OAAe,KACvB,mBAiEF,CAAC"}
|
|
@@ -1,44 +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 useWildduckUpdateUser = (networkClient, config, devMode = false) => {
|
|
5
|
-
const queryClient = useQueryClient();
|
|
6
|
-
const wildduckClient = useMemo(() => new WildduckClient(networkClient, config), [networkClient, config]);
|
|
7
|
-
const updateMutation = useMutation({
|
|
8
|
-
mutationKey: [
|
|
9
|
-
"wildduck-update-user",
|
|
10
|
-
config.cloudflareWorkerUrl || config.backendUrl,
|
|
11
|
-
],
|
|
12
|
-
mutationFn: async ({ wildduckUserAuth, params, }) => {
|
|
13
|
-
try {
|
|
14
|
-
return await wildduckClient.updateUser(wildduckUserAuth, params);
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
if (devMode) {
|
|
18
|
-
return { success: true };
|
|
19
|
-
}
|
|
20
|
-
console.error("Failed to update user:", err);
|
|
21
|
-
return { success: false };
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
onSuccess: (_, variables) => {
|
|
25
|
-
queryClient.invalidateQueries({
|
|
26
|
-
queryKey: ["wildduck-user", variables.wildduckUserAuth.userId],
|
|
27
|
-
});
|
|
28
|
-
queryClient.invalidateQueries({
|
|
29
|
-
queryKey: ["wildduck-users"],
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
const updateUser = useCallback(async (wildduckUserAuth, params) => {
|
|
34
|
-
return updateMutation.mutateAsync({ wildduckUserAuth, params });
|
|
35
|
-
}, [updateMutation]);
|
|
36
|
-
const clearError = useCallback(() => updateMutation.reset(), [updateMutation]);
|
|
37
|
-
return useMemo(() => ({
|
|
38
|
-
updateUser,
|
|
39
|
-
isLoading: updateMutation.isPending,
|
|
40
|
-
error: updateMutation.error,
|
|
41
|
-
clearError,
|
|
42
|
-
}), [updateUser, updateMutation.isPending, updateMutation.error, clearError]);
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=useWildduckUpdateUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckUpdateUser.js","sourceRoot":"","sources":["../../../src/hooks/users/useWildduckUpdateUser.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,qBAAqB,GAAG,CACnC,aAA4B,EAC5B,MAAsB,EACtB,UAAmB,KAAK,EACH,EAAE;IACvB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,cAAc,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,aAAa,EAAE,MAAM,CAA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,CACjB,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,UAAU;QACV,SAAS,EAAE,cAAc,CAAC,SAAS;QACnC,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,UAAU;KACX,CAAC,EACF,CAAC,UAAU,EAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CACzE,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { WildduckClient } from "../../network/wildduck-client";
|
|
2
|
-
import type { WildduckUserAuth } from "@sudobility/types";
|
|
3
|
-
export interface TwoFASettings {
|
|
4
|
-
enabled2fa: string[];
|
|
5
|
-
}
|
|
6
|
-
export interface DisableTwoFAParams {
|
|
7
|
-
wildduckUserAuth: WildduckUserAuth;
|
|
8
|
-
}
|
|
9
|
-
export declare const useWildduckUser2FA: (api: WildduckClient, wildduckUserAuth?: WildduckUserAuth) => {
|
|
10
|
-
twoFA: TwoFASettings | undefined;
|
|
11
|
-
enabled2fa: string[];
|
|
12
|
-
isEnabled: boolean;
|
|
13
|
-
isLoading: boolean;
|
|
14
|
-
isError: boolean;
|
|
15
|
-
error: Error | null;
|
|
16
|
-
hasMethod: (method: string) => boolean;
|
|
17
|
-
hasTOTP: boolean;
|
|
18
|
-
hasU2F: boolean;
|
|
19
|
-
hasWebAuthn: boolean;
|
|
20
|
-
disable2FA: import("@tanstack/react-query").UseMutateFunction<import("@sudobility/types").WildduckSuccessResponse, Error, DisableTwoFAParams, unknown>;
|
|
21
|
-
disable2FAAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@sudobility/types").WildduckSuccessResponse, Error, DisableTwoFAParams, unknown>;
|
|
22
|
-
isDisabling: boolean;
|
|
23
|
-
disableError: Error | null;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=useWildduckUser2FA.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWildduckUser2FA.d.ts","sourceRoot":"","sources":["../../../src/hooks/users/useWildduckUser2FA.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAEhF,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAUD,eAAO,MAAM,kBAAkB,GAC7B,KAAK,cAAc,EACnB,mBAAmB,gBAAgB;;;;;;;wBA+CxB,MAAM,KAAG,OAAO;;;;;;;;CAsD5B,CAAC"}
|