@mezo-org/passport 0.14.1 → 0.14.3-dev.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/src/api/auth.d.ts +11 -0
- package/dist/src/api/auth.d.ts.map +1 -1
- package/dist/src/api/auth.js +7 -0
- package/dist/src/api/auth.js.map +1 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +1 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/useAcceptDocuments.d.ts +117 -0
- package/dist/src/hooks/useAcceptDocuments.d.ts.map +1 -0
- package/dist/src/hooks/useAcceptDocuments.js +19 -0
- package/dist/src/hooks/useAcceptDocuments.js.map +1 -0
- package/dist/src/hooks/useCreateAccount.d.ts +9 -0
- package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
- package/dist/src/hooks/useUpdateMezoId.d.ts +9 -0
- package/dist/src/hooks/useUpdateMezoId.d.ts.map +1 -1
- package/package.json +14 -12
- package/src/api/auth.ts +26 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAcceptDocuments.ts +33 -0
package/dist/src/api/auth.d.ts
CHANGED
|
@@ -12,10 +12,19 @@ export type LinkedProviderAccount = {
|
|
|
12
12
|
avatarUrl: string;
|
|
13
13
|
};
|
|
14
14
|
export type LinkedAccount = LinkedWalletAccount | LinkedProviderAccount;
|
|
15
|
+
type UserDocumentStatus = {
|
|
16
|
+
currentVersion: string;
|
|
17
|
+
acceptedVersion?: string;
|
|
18
|
+
acceptedAt?: string;
|
|
19
|
+
isCurrentVersionAccepted: boolean;
|
|
20
|
+
};
|
|
21
|
+
type DocumentType = "termsOfUse" | "privacyPolicy";
|
|
22
|
+
export type UserDocuments = Record<DocumentType, UserDocumentStatus>;
|
|
15
23
|
type Account = {
|
|
16
24
|
mezoId: string;
|
|
17
25
|
hasModifiedMezoId: boolean;
|
|
18
26
|
linkedAccounts: LinkedAccount[];
|
|
27
|
+
documents?: UserDocuments;
|
|
19
28
|
};
|
|
20
29
|
export type Session = {
|
|
21
30
|
expiresIn: number;
|
|
@@ -63,6 +72,7 @@ export type CreateAccountRequest = {
|
|
|
63
72
|
};
|
|
64
73
|
export type CreateAccountResponse = Account;
|
|
65
74
|
export type UpdateMezoIdResponse = Account;
|
|
75
|
+
export type AcceptDocumentsResponse = Account;
|
|
66
76
|
export declare const AUTH_API_ENDPOINTS_BY_ENV: {
|
|
67
77
|
mainnet: string;
|
|
68
78
|
testnet: string;
|
|
@@ -77,6 +87,7 @@ export declare class AuthApiClient extends ApiClient {
|
|
|
77
87
|
linkAccount(linkAccountRequest: LinkAccountRequest): Promise<LinkAccountResponse>;
|
|
78
88
|
createAccount(createAccountRequest: CreateAccountRequest): Promise<Account>;
|
|
79
89
|
updateMezoId(newMezoId: string): Promise<Account>;
|
|
90
|
+
acceptDocuments(): Promise<Account>;
|
|
80
91
|
}
|
|
81
92
|
export {};
|
|
82
93
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,KAAK,YAAY,GAAG,SAAS,CAAA;AAE7B,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,YAAY,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAEvE,KAAK,OAAO,GAAG;IACb,MAA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M,MAAM,uBAAuB,GAAG,OAAO,CAAA;AAE7C,eAAO,MAAM,yBAAyB;;;CAGrC,CAAA;AAED,qBAAa,aAAc,SAAQ,SAAS;gBAExC,WAAW,GAAE,MAAM,OAAO,yBAAqC,EAC/D,MAAM,CAAC,EAAE,MAAM;IAOX,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM;IASxB,aAAa,CAAC,oBAAoB,EAAE,oBAAoB;IASxD,aAAa;IAQb,iBAAiB;IAWjB,2BAA2B,CAAC,eAAe,EAAE,MAAM;IAqBnD,WAAW,CAAC,kBAAkB,EAAE,kBAAkB;IAYlD,aAAa,CAAC,oBAAoB,EAAE,oBAAoB;IASxD,YAAY,CAAC,SAAS,EAAE,MAAM;IAY9B,eAAe;CAWtB"}
|
package/dist/src/api/auth.js
CHANGED
|
@@ -75,5 +75,12 @@ export class AuthApiClient extends ApiClient {
|
|
|
75
75
|
});
|
|
76
76
|
return data;
|
|
77
77
|
}
|
|
78
|
+
async acceptDocuments() {
|
|
79
|
+
const data = await this.handleRequest("/session/account", {
|
|
80
|
+
method: "PATCH",
|
|
81
|
+
body: { updateAcceptedDocuments: true },
|
|
82
|
+
});
|
|
83
|
+
return data;
|
|
84
|
+
}
|
|
78
85
|
}
|
|
79
86
|
//# sourceMappingURL=auth.js.map
|
package/dist/src/api/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAyF1C,MAAM,CAAC,MAAM,yBAAyB,G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AAE,CAAC;YACf,mEAAmE;YACnE,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACxD,IAAI,GAAG,IAAI,CAAA;YACb,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,kBAAsC;QACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,kCAAkC,EAClC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB;SACzB,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,oBAA0C;QAC5D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAwB,WAAW,EAAE;YACxE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,oBAAoB;SAC3B,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAiB;QAClC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,kBAAkB,EAClB;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;SAC5B,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,kBAAkB,EAClB;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE;SACxC,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { useBitcoinAccount, useSendBitcoin, useSendTransaction, useSubscribeToConnectedToUnsupportedBitcoinAddress, useSubscribeToConnectorEvent, useSubscribeToWalletNetworkDoesNotMatchProviderChain, } from "@mezo-org/orangekit";
|
|
2
2
|
export { useInvalidateBorrowData, useResetBorrowData } from "./useBorrowData";
|
|
3
|
+
export * from "./useAcceptDocuments";
|
|
3
4
|
export * from "./useGetAccountByAddress";
|
|
4
5
|
export * from "./useGetAccountByMezoId";
|
|
5
6
|
export * from "./useGetCurrentAccount";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC7E,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC7E,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
|
package/dist/src/hooks/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { useBitcoinAccount, useSendBitcoin, useSendTransaction, useSubscribeToConnectedToUnsupportedBitcoinAddress, useSubscribeToConnectorEvent, useSubscribeToWalletNetworkDoesNotMatchProviderChain, } from "@mezo-org/orangekit";
|
|
2
2
|
export { useInvalidateBorrowData, useResetBorrowData } from "./useBorrowData";
|
|
3
|
+
export * from "./useAcceptDocuments";
|
|
3
4
|
export * from "./useGetAccountByAddress";
|
|
4
5
|
export * from "./useGetAccountByMezoId";
|
|
5
6
|
export * from "./useGetCurrentAccount";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC7E,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kDAAkD,EAClD,4BAA4B,EAC5B,oDAAoD,GACrD,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC7E,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { MutationOptions, DefaultError } from "@tanstack/react-query";
|
|
2
|
+
import type { AcceptDocumentsResponse } from "../api";
|
|
3
|
+
export declare function useAcceptDocuments(mutationOptions?: Omit<MutationOptions<AcceptDocumentsResponse, DefaultError, void>, "mutationFn" | "mutationKey">): {
|
|
4
|
+
data: undefined;
|
|
5
|
+
variables: undefined;
|
|
6
|
+
error: null;
|
|
7
|
+
isError: false;
|
|
8
|
+
isIdle: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isSuccess: false;
|
|
11
|
+
status: "idle";
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Error | null;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
submittedAt: number;
|
|
18
|
+
acceptDocuments: import("@tanstack/react-query").UseMutateFunction<{
|
|
19
|
+
mezoId: string;
|
|
20
|
+
hasModifiedMezoId: boolean;
|
|
21
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
22
|
+
documents?: import("../api").UserDocuments;
|
|
23
|
+
}, Error, void, unknown>;
|
|
24
|
+
acceptDocumentsAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
25
|
+
mezoId: string;
|
|
26
|
+
hasModifiedMezoId: boolean;
|
|
27
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
28
|
+
documents?: import("../api").UserDocuments;
|
|
29
|
+
}, Error, void, unknown>;
|
|
30
|
+
} | {
|
|
31
|
+
data: undefined;
|
|
32
|
+
variables: void;
|
|
33
|
+
error: null;
|
|
34
|
+
isError: false;
|
|
35
|
+
isIdle: false;
|
|
36
|
+
isPending: true;
|
|
37
|
+
isSuccess: false;
|
|
38
|
+
status: "pending";
|
|
39
|
+
reset: () => void;
|
|
40
|
+
context: unknown;
|
|
41
|
+
failureCount: number;
|
|
42
|
+
failureReason: Error | null;
|
|
43
|
+
isPaused: boolean;
|
|
44
|
+
submittedAt: number;
|
|
45
|
+
acceptDocuments: import("@tanstack/react-query").UseMutateFunction<{
|
|
46
|
+
mezoId: string;
|
|
47
|
+
hasModifiedMezoId: boolean;
|
|
48
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
49
|
+
documents?: import("../api").UserDocuments;
|
|
50
|
+
}, Error, void, unknown>;
|
|
51
|
+
acceptDocumentsAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
52
|
+
mezoId: string;
|
|
53
|
+
hasModifiedMezoId: boolean;
|
|
54
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
55
|
+
documents?: import("../api").UserDocuments;
|
|
56
|
+
}, Error, void, unknown>;
|
|
57
|
+
} | {
|
|
58
|
+
data: undefined;
|
|
59
|
+
error: Error;
|
|
60
|
+
variables: void;
|
|
61
|
+
isError: true;
|
|
62
|
+
isIdle: false;
|
|
63
|
+
isPending: false;
|
|
64
|
+
isSuccess: false;
|
|
65
|
+
status: "error";
|
|
66
|
+
reset: () => void;
|
|
67
|
+
context: unknown;
|
|
68
|
+
failureCount: number;
|
|
69
|
+
failureReason: Error | null;
|
|
70
|
+
isPaused: boolean;
|
|
71
|
+
submittedAt: number;
|
|
72
|
+
acceptDocuments: import("@tanstack/react-query").UseMutateFunction<{
|
|
73
|
+
mezoId: string;
|
|
74
|
+
hasModifiedMezoId: boolean;
|
|
75
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
76
|
+
documents?: import("../api").UserDocuments;
|
|
77
|
+
}, Error, void, unknown>;
|
|
78
|
+
acceptDocumentsAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
79
|
+
mezoId: string;
|
|
80
|
+
hasModifiedMezoId: boolean;
|
|
81
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
82
|
+
documents?: import("../api").UserDocuments;
|
|
83
|
+
}, Error, void, unknown>;
|
|
84
|
+
} | {
|
|
85
|
+
data: {
|
|
86
|
+
mezoId: string;
|
|
87
|
+
hasModifiedMezoId: boolean;
|
|
88
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
89
|
+
documents?: import("../api").UserDocuments;
|
|
90
|
+
};
|
|
91
|
+
error: null;
|
|
92
|
+
variables: void;
|
|
93
|
+
isError: false;
|
|
94
|
+
isIdle: false;
|
|
95
|
+
isPending: false;
|
|
96
|
+
isSuccess: true;
|
|
97
|
+
status: "success";
|
|
98
|
+
reset: () => void;
|
|
99
|
+
context: unknown;
|
|
100
|
+
failureCount: number;
|
|
101
|
+
failureReason: Error | null;
|
|
102
|
+
isPaused: boolean;
|
|
103
|
+
submittedAt: number;
|
|
104
|
+
acceptDocuments: import("@tanstack/react-query").UseMutateFunction<{
|
|
105
|
+
mezoId: string;
|
|
106
|
+
hasModifiedMezoId: boolean;
|
|
107
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
108
|
+
documents?: import("../api").UserDocuments;
|
|
109
|
+
}, Error, void, unknown>;
|
|
110
|
+
acceptDocumentsAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
111
|
+
mezoId: string;
|
|
112
|
+
hasModifiedMezoId: boolean;
|
|
113
|
+
linkedAccounts: import("../api").LinkedAccount[];
|
|
114
|
+
documents?: import("../api").UserDocuments;
|
|
115
|
+
}, Error, void, unknown>;
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=useAcceptDocuments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAcceptDocuments.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAcceptDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,YAAY,EACb,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAA;AAErD,wBAAgB,kBAAkB,CAChC,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,uBAAuB,EAAE,YAAY,EAAE,IAAI,CAAC,EAC5D,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBP"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useQueryClient, useMutation, } from "@tanstack/react-query";
|
|
2
|
+
import { useAuthApiClient } from "./useAuthApiClient";
|
|
3
|
+
import { QUERY_KEYS } from "./constants";
|
|
4
|
+
export function useAcceptDocuments(mutationOptions = {}) {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
const authApiClient = useAuthApiClient();
|
|
7
|
+
const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions;
|
|
8
|
+
const { mutate, mutateAsync, ...rest } = useMutation({
|
|
9
|
+
mutationFn: () => authApiClient.acceptDocuments(),
|
|
10
|
+
onSuccess: (data, variables, context) => {
|
|
11
|
+
queryClient.resetQueries({ queryKey: [QUERY_KEYS.ACCOUNT] });
|
|
12
|
+
if (customOnSuccess)
|
|
13
|
+
customOnSuccess(data, variables, context);
|
|
14
|
+
},
|
|
15
|
+
...restMutationOptions,
|
|
16
|
+
});
|
|
17
|
+
return { acceptDocuments: mutate, acceptDocumentsAsync: mutateAsync, ...rest };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=useAcceptDocuments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAcceptDocuments.js","sourceRoot":"","sources":["../../../src/hooks/useAcceptDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,MAAM,UAAU,kBAAkB,CAChC,kBAGI,EAAE;IAEN,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IAExC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,mBAAmB,EAAE,GAAG,eAAe,CAAA;IAE9E,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,WAAW,CAAC;QACnD,UAAU,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,eAAe,EAAE;QACjD,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;YACtC,WAAW,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YAE5D,IAAI,eAAe;gBAAE,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAChE,CAAC;QACD,GAAG,mBAAmB;KACvB,CAAC,CAAA;IAEF,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAA;AAChF,CAAC"}
|
|
@@ -19,11 +19,13 @@ export declare function useCreateAccount(mutationOptions?: Omit<MutationOptions<
|
|
|
19
19
|
mezoId: string;
|
|
20
20
|
hasModifiedMezoId: boolean;
|
|
21
21
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
22
|
+
documents?: import("../api").UserDocuments;
|
|
22
23
|
}, Error, CreateAccountRequest, unknown>;
|
|
23
24
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
24
25
|
mezoId: string;
|
|
25
26
|
hasModifiedMezoId: boolean;
|
|
26
27
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
28
|
+
documents?: import("../api").UserDocuments;
|
|
27
29
|
}, Error, CreateAccountRequest, unknown>;
|
|
28
30
|
} | {
|
|
29
31
|
data: undefined;
|
|
@@ -44,11 +46,13 @@ export declare function useCreateAccount(mutationOptions?: Omit<MutationOptions<
|
|
|
44
46
|
mezoId: string;
|
|
45
47
|
hasModifiedMezoId: boolean;
|
|
46
48
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
49
|
+
documents?: import("../api").UserDocuments;
|
|
47
50
|
}, Error, CreateAccountRequest, unknown>;
|
|
48
51
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
49
52
|
mezoId: string;
|
|
50
53
|
hasModifiedMezoId: boolean;
|
|
51
54
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
55
|
+
documents?: import("../api").UserDocuments;
|
|
52
56
|
}, Error, CreateAccountRequest, unknown>;
|
|
53
57
|
} | {
|
|
54
58
|
data: undefined;
|
|
@@ -69,17 +73,20 @@ export declare function useCreateAccount(mutationOptions?: Omit<MutationOptions<
|
|
|
69
73
|
mezoId: string;
|
|
70
74
|
hasModifiedMezoId: boolean;
|
|
71
75
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
76
|
+
documents?: import("../api").UserDocuments;
|
|
72
77
|
}, Error, CreateAccountRequest, unknown>;
|
|
73
78
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
74
79
|
mezoId: string;
|
|
75
80
|
hasModifiedMezoId: boolean;
|
|
76
81
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
82
|
+
documents?: import("../api").UserDocuments;
|
|
77
83
|
}, Error, CreateAccountRequest, unknown>;
|
|
78
84
|
} | {
|
|
79
85
|
data: {
|
|
80
86
|
mezoId: string;
|
|
81
87
|
hasModifiedMezoId: boolean;
|
|
82
88
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
89
|
+
documents?: import("../api").UserDocuments;
|
|
83
90
|
};
|
|
84
91
|
error: null;
|
|
85
92
|
variables: CreateAccountRequest;
|
|
@@ -98,11 +105,13 @@ export declare function useCreateAccount(mutationOptions?: Omit<MutationOptions<
|
|
|
98
105
|
mezoId: string;
|
|
99
106
|
hasModifiedMezoId: boolean;
|
|
100
107
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
108
|
+
documents?: import("../api").UserDocuments;
|
|
101
109
|
}, Error, CreateAccountRequest, unknown>;
|
|
102
110
|
createAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
103
111
|
mezoId: string;
|
|
104
112
|
hasModifiedMezoId: boolean;
|
|
105
113
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
114
|
+
documents?: import("../api").UserDocuments;
|
|
106
115
|
}, Error, CreateAccountRequest, unknown>;
|
|
107
116
|
};
|
|
108
117
|
//# sourceMappingURL=useCreateAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,YAAY,EACb,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAIzE,wBAAgB,gBAAgB,CAC9B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,CAAC,EAC1E,YAAY,GAAG,aAAa,CACxB
|
|
1
|
+
{"version":3,"file":"useCreateAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,YAAY,EACb,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAIzE,wBAAgB,gBAAgB,CAC9B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,CAAC,EAC1E,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CP"}
|
|
@@ -19,11 +19,13 @@ export declare function useUpdateMezoId(mutationOptions?: Omit<MutationOptions<U
|
|
|
19
19
|
mezoId: string;
|
|
20
20
|
hasModifiedMezoId: boolean;
|
|
21
21
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
22
|
+
documents?: import("../api").UserDocuments;
|
|
22
23
|
}, Error, string, unknown>;
|
|
23
24
|
updateMezoIdAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
24
25
|
mezoId: string;
|
|
25
26
|
hasModifiedMezoId: boolean;
|
|
26
27
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
28
|
+
documents?: import("../api").UserDocuments;
|
|
27
29
|
}, Error, string, unknown>;
|
|
28
30
|
} | {
|
|
29
31
|
data: undefined;
|
|
@@ -44,11 +46,13 @@ export declare function useUpdateMezoId(mutationOptions?: Omit<MutationOptions<U
|
|
|
44
46
|
mezoId: string;
|
|
45
47
|
hasModifiedMezoId: boolean;
|
|
46
48
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
49
|
+
documents?: import("../api").UserDocuments;
|
|
47
50
|
}, Error, string, unknown>;
|
|
48
51
|
updateMezoIdAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
49
52
|
mezoId: string;
|
|
50
53
|
hasModifiedMezoId: boolean;
|
|
51
54
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
55
|
+
documents?: import("../api").UserDocuments;
|
|
52
56
|
}, Error, string, unknown>;
|
|
53
57
|
} | {
|
|
54
58
|
data: undefined;
|
|
@@ -69,17 +73,20 @@ export declare function useUpdateMezoId(mutationOptions?: Omit<MutationOptions<U
|
|
|
69
73
|
mezoId: string;
|
|
70
74
|
hasModifiedMezoId: boolean;
|
|
71
75
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
76
|
+
documents?: import("../api").UserDocuments;
|
|
72
77
|
}, Error, string, unknown>;
|
|
73
78
|
updateMezoIdAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
74
79
|
mezoId: string;
|
|
75
80
|
hasModifiedMezoId: boolean;
|
|
76
81
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
82
|
+
documents?: import("../api").UserDocuments;
|
|
77
83
|
}, Error, string, unknown>;
|
|
78
84
|
} | {
|
|
79
85
|
data: {
|
|
80
86
|
mezoId: string;
|
|
81
87
|
hasModifiedMezoId: boolean;
|
|
82
88
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
89
|
+
documents?: import("../api").UserDocuments;
|
|
83
90
|
};
|
|
84
91
|
error: null;
|
|
85
92
|
variables: string;
|
|
@@ -98,11 +105,13 @@ export declare function useUpdateMezoId(mutationOptions?: Omit<MutationOptions<U
|
|
|
98
105
|
mezoId: string;
|
|
99
106
|
hasModifiedMezoId: boolean;
|
|
100
107
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
108
|
+
documents?: import("../api").UserDocuments;
|
|
101
109
|
}, Error, string, unknown>;
|
|
102
110
|
updateMezoIdAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
103
111
|
mezoId: string;
|
|
104
112
|
hasModifiedMezoId: boolean;
|
|
105
113
|
linkedAccounts: import("../api").LinkedAccount[];
|
|
114
|
+
documents?: import("../api").UserDocuments;
|
|
106
115
|
}, Error, string, unknown>;
|
|
107
116
|
};
|
|
108
117
|
//# sourceMappingURL=useUpdateMezoId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUpdateMezoId.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUpdateMezoId.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,YAAY,EACb,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAElD,wBAAgB,eAAe,CAC7B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,oBAAoB,EAAE,YAAY,EAAE,MAAM,CAAC,EAC3D,YAAY,GAAG,aAAa,CACxB
|
|
1
|
+
{"version":3,"file":"useUpdateMezoId.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUpdateMezoId.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,YAAY,EACb,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAElD,wBAAgB,eAAe,CAC7B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,oBAAoB,EAAE,YAAY,EAAE,MAAM,CAAC,EAC3D,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBP"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezo-org/passport",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3-dev.0",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"scripts": {
|
|
@@ -24,33 +24,35 @@
|
|
|
24
24
|
"directory": "typescript/passport"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@thesis-co/eslint-config": "
|
|
27
|
+
"@thesis-co/eslint-config": "github:thesis/eslint-config#7b9bc8c",
|
|
28
28
|
"@types/jest": "^29.5.12",
|
|
29
29
|
"@types/node": "^20.11.30",
|
|
30
30
|
"@types/react": "^18.2.64",
|
|
31
|
-
"eslint": "
|
|
31
|
+
"eslint": "^8.57.1",
|
|
32
32
|
"jest": "^29.7.0",
|
|
33
33
|
"jest-environment-jsdom": "^29.7.0",
|
|
34
|
-
"prettier": "
|
|
34
|
+
"prettier": "^3.2.5",
|
|
35
35
|
"ts-jest": "^29.1.2",
|
|
36
36
|
"ts-node": "^10.9.2",
|
|
37
|
-
"typescript": "
|
|
37
|
+
"typescript": "^5.4.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@mezo-org/mezo-clay": "0.1.0-dev.37",
|
|
41
41
|
"@mezo-org/mezod-contracts": "^1.0.0",
|
|
42
42
|
"@mezo-org/musd-contracts": "^1.0.1",
|
|
43
|
-
"@mezo-org/orangekit": "
|
|
43
|
+
"@mezo-org/orangekit": "1.0.0-beta.40-dev.19",
|
|
44
44
|
"@mezo-org/sign-in-with-wallet": "1.0.0-beta.8",
|
|
45
|
-
"@rainbow-me/rainbowkit": "2.0.2",
|
|
46
|
-
"@tanstack/react-query": "^5.28.4",
|
|
47
|
-
"motion": "^12.23.6",
|
|
48
45
|
"qrcode.react": "^4.2.0",
|
|
49
|
-
"react": "^18.2.0",
|
|
50
46
|
"styletron-engine-monolithic": "^1.0.0",
|
|
51
47
|
"usehooks-ts": "^3.1.1",
|
|
52
|
-
"
|
|
53
|
-
"wagmi": "2.5.12",
|
|
48
|
+
"motion": "^12.23.6",
|
|
54
49
|
"zustand": "^5.0.3"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@rainbow-me/rainbowkit": "2.0.2",
|
|
53
|
+
"@tanstack/react-query": "^5.28.4",
|
|
54
|
+
"react": "^18.2.0",
|
|
55
|
+
"viem": "2.22.8",
|
|
56
|
+
"wagmi": "2.5.12"
|
|
55
57
|
}
|
|
56
58
|
}
|
package/src/api/auth.ts
CHANGED
|
@@ -18,10 +18,22 @@ export type LinkedProviderAccount = {
|
|
|
18
18
|
|
|
19
19
|
export type LinkedAccount = LinkedWalletAccount | LinkedProviderAccount
|
|
20
20
|
|
|
21
|
+
type UserDocumentStatus = {
|
|
22
|
+
currentVersion: string
|
|
23
|
+
acceptedVersion?: string
|
|
24
|
+
acceptedAt?: string
|
|
25
|
+
isCurrentVersionAccepted: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type DocumentType = "termsOfUse" | "privacyPolicy"
|
|
29
|
+
|
|
30
|
+
export type UserDocuments = Record<DocumentType, UserDocumentStatus>
|
|
31
|
+
|
|
21
32
|
type Account = {
|
|
22
33
|
mezoId: string
|
|
23
34
|
hasModifiedMezoId: boolean
|
|
24
35
|
linkedAccounts: LinkedAccount[]
|
|
36
|
+
documents?: UserDocuments
|
|
25
37
|
}
|
|
26
38
|
|
|
27
39
|
export type Session = {
|
|
@@ -74,6 +86,8 @@ export type CreateAccountResponse = Account
|
|
|
74
86
|
|
|
75
87
|
export type UpdateMezoIdResponse = Account
|
|
76
88
|
|
|
89
|
+
export type AcceptDocumentsResponse = Account
|
|
90
|
+
|
|
77
91
|
export const AUTH_API_ENDPOINTS_BY_ENV = {
|
|
78
92
|
mainnet: "https://api.mezo.org",
|
|
79
93
|
testnet: "https://api.test.mezo.org",
|
|
@@ -179,4 +193,16 @@ export class AuthApiClient extends ApiClient {
|
|
|
179
193
|
|
|
180
194
|
return data
|
|
181
195
|
}
|
|
196
|
+
|
|
197
|
+
async acceptDocuments() {
|
|
198
|
+
const data = await this.handleRequest<AcceptDocumentsResponse>(
|
|
199
|
+
"/session/account",
|
|
200
|
+
{
|
|
201
|
+
method: "PATCH",
|
|
202
|
+
body: { updateAcceptedDocuments: true },
|
|
203
|
+
},
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
return data
|
|
207
|
+
}
|
|
182
208
|
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export {
|
|
|
7
7
|
useSubscribeToWalletNetworkDoesNotMatchProviderChain,
|
|
8
8
|
} from "@mezo-org/orangekit"
|
|
9
9
|
export { useInvalidateBorrowData, useResetBorrowData } from "./useBorrowData"
|
|
10
|
+
export * from "./useAcceptDocuments"
|
|
10
11
|
export * from "./useGetAccountByAddress"
|
|
11
12
|
export * from "./useGetAccountByMezoId"
|
|
12
13
|
export * from "./useGetCurrentAccount"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useQueryClient,
|
|
3
|
+
useMutation,
|
|
4
|
+
MutationOptions,
|
|
5
|
+
DefaultError,
|
|
6
|
+
} from "@tanstack/react-query"
|
|
7
|
+
import { useAuthApiClient } from "./useAuthApiClient"
|
|
8
|
+
import { QUERY_KEYS } from "./constants"
|
|
9
|
+
import type { AcceptDocumentsResponse } from "../api"
|
|
10
|
+
|
|
11
|
+
export function useAcceptDocuments(
|
|
12
|
+
mutationOptions: Omit<
|
|
13
|
+
MutationOptions<AcceptDocumentsResponse, DefaultError, void>,
|
|
14
|
+
"mutationFn" | "mutationKey"
|
|
15
|
+
> = {},
|
|
16
|
+
) {
|
|
17
|
+
const queryClient = useQueryClient()
|
|
18
|
+
const authApiClient = useAuthApiClient()
|
|
19
|
+
|
|
20
|
+
const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions
|
|
21
|
+
|
|
22
|
+
const { mutate, mutateAsync, ...rest } = useMutation({
|
|
23
|
+
mutationFn: () => authApiClient.acceptDocuments(),
|
|
24
|
+
onSuccess: (data, variables, context) => {
|
|
25
|
+
queryClient.resetQueries({ queryKey: [QUERY_KEYS.ACCOUNT] })
|
|
26
|
+
|
|
27
|
+
if (customOnSuccess) customOnSuccess(data, variables, context)
|
|
28
|
+
},
|
|
29
|
+
...restMutationOptions,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return { acceptDocuments: mutate, acceptDocumentsAsync: mutateAsync, ...rest }
|
|
33
|
+
}
|