nfx-ui 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/hooks/auth.d.ts +30 -29
- package/dist/hooks/auth.d.ts.map +1 -1
- package/dist/hooks/auth.js +225 -226
- package/dist/hooks/auth.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +9 -8
- package/dist/hooks/toast.d.ts +12 -0
- package/dist/hooks/toast.d.ts.map +1 -0
- package/dist/hooks/toast.js +13 -0
- package/dist/hooks/toast.js.map +1 -0
- package/dist/languages/hooks/useLanguageLabel.d.ts.map +1 -1
- package/dist/languages/hooks/useLanguageLabel.js +11 -10
- package/dist/languages/hooks/useLanguageLabel.js.map +1 -1
- package/dist/languages/index.d.ts +0 -1
- package/dist/languages/index.d.ts.map +1 -1
- package/dist/languages/index.js +9 -10
- package/dist/languages/languages/i18n.d.ts.map +1 -1
- package/dist/languages/languages/i18n.js +30 -41
- package/dist/languages/languages/i18n.js.map +1 -1
- package/dist/schemas/loginSchema.d.ts +3 -3
- package/dist/schemas/loginSchema.d.ts.map +1 -1
- package/dist/schemas/loginSchema.js +22 -23
- package/dist/schemas/loginSchema.js.map +1 -1
- package/dist/schemas/profileEditSchema.d.ts +1 -1
- package/dist/schemas/profileEditSchema.d.ts.map +1 -1
- package/dist/schemas/profileEditSchema.js +18 -19
- package/dist/schemas/profileEditSchema.js.map +1 -1
- package/dist/schemas/signupSchema.d.ts +2 -2
- package/dist/schemas/signupSchema.d.ts.map +1 -1
- package/dist/schemas/signupSchema.js +16 -17
- package/dist/schemas/signupSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/auth.ts +79 -98
- package/src/hooks/index.ts +1 -0
- package/src/hooks/toast.ts +23 -0
- package/src/languages/hooks/useLanguageLabel.ts +2 -3
- package/src/languages/index.ts +0 -1
- package/src/languages/languages/i18n.ts +3 -17
- package/src/schemas/loginSchema.ts +3 -6
- package/src/schemas/profileEditSchema.ts +1 -3
- package/src/schemas/signupSchema.ts +2 -4
- package/dist/languages/resources/en/language.js +0 -52
- package/dist/languages/resources/en/language.js.map +0 -1
- package/dist/languages/resources/en/language.json.d.ts +0 -49
- package/dist/languages/resources/en/layout.js +0 -9
- package/dist/languages/resources/en/layout.js.map +0 -1
- package/dist/languages/resources/en/layout.json.d.ts +0 -9
- package/dist/languages/resources/en/preference.js +0 -50
- package/dist/languages/resources/en/preference.js.map +0 -1
- package/dist/languages/resources/en/preference.json.d.ts +0 -51
- package/dist/languages/resources/en/theme.js +0 -19
- package/dist/languages/resources/en/theme.js.map +0 -1
- package/dist/languages/resources/en/theme.json.d.ts +0 -17
- package/dist/languages/resources/fr/language.js +0 -52
- package/dist/languages/resources/fr/language.js.map +0 -1
- package/dist/languages/resources/fr/language.json.d.ts +0 -49
- package/dist/languages/resources/fr/layout.js +0 -9
- package/dist/languages/resources/fr/layout.js.map +0 -1
- package/dist/languages/resources/fr/layout.json.d.ts +0 -9
- package/dist/languages/resources/fr/preference.js +0 -50
- package/dist/languages/resources/fr/preference.js.map +0 -1
- package/dist/languages/resources/fr/preference.json.d.ts +0 -51
- package/dist/languages/resources/fr/theme.js +0 -19
- package/dist/languages/resources/fr/theme.js.map +0 -1
- package/dist/languages/resources/fr/theme.json.d.ts +0 -17
- package/dist/languages/resources/index.d.ts +0 -9
- package/dist/languages/resources/index.d.ts.map +0 -1
- package/dist/languages/resources/index.js +0 -54
- package/dist/languages/resources/index.js.map +0 -1
- package/dist/languages/resources/zh/language.js +0 -52
- package/dist/languages/resources/zh/language.js.map +0 -1
- package/dist/languages/resources/zh/language.json.d.ts +0 -49
- package/dist/languages/resources/zh/layout.js +0 -9
- package/dist/languages/resources/zh/layout.js.map +0 -1
- package/dist/languages/resources/zh/layout.json.d.ts +0 -9
- package/dist/languages/resources/zh/preference.js +0 -50
- package/dist/languages/resources/zh/preference.js.map +0 -1
- package/dist/languages/resources/zh/preference.json.d.ts +0 -51
- package/dist/languages/resources/zh/theme.js +0 -19
- package/dist/languages/resources/zh/theme.js.map +0 -1
- package/dist/languages/resources/zh/theme.json.d.ts +0 -17
- package/src/languages/resources/en/language.json +0 -47
- package/src/languages/resources/en/layout.json +0 -6
- package/src/languages/resources/en/preference.json +0 -49
- package/src/languages/resources/en/theme.json +0 -14
- package/src/languages/resources/fr/language.json +0 -47
- package/src/languages/resources/fr/layout.json +0 -6
- package/src/languages/resources/fr/preference.json +0 -49
- package/src/languages/resources/fr/theme.json +0 -14
- package/src/languages/resources/index.ts +0 -62
- package/src/languages/resources/zh/language.json +0 -47
- package/src/languages/resources/zh/layout.json +0 -6
- package/src/languages/resources/zh/preference.json +0 -49
- package/src/languages/resources/zh/theme.json +0 -14
package/dist/hooks/auth.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { safeOr as e, safeStringable as t } from "../utils/safe.js";
|
|
2
2
|
import { LanguageEnum as n } from "../enums/language.js";
|
|
3
3
|
import { AuthSignupPlatformEnum as r, ProfileKindEnum as i } from "../enums/auth.js";
|
|
4
|
-
import { AuthStore as a, EMPTY_PROFILE_ID as o, clearAuth as
|
|
5
|
-
import { ensureDeviceIdStorage as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { useEffect as
|
|
14
|
-
import { useTranslation as j } from "react-i18next";
|
|
4
|
+
import { AuthStore as a, EMPTY_PROFILE_ID as o, clearAuth as ee, hasSelectedProfile as s, setCurrentAccountId as c, setCurrentProfileId as l, setCurrentProfileKind as u, setIsAuthValid as d, setTokens as f, useAuthStore as p } from "../stores/auth.js";
|
|
5
|
+
import { ensureDeviceIdStorage as m } from "../stores/system.js";
|
|
6
|
+
import { authEventEmitter as h, authEvents as g } from "../events/auth.js";
|
|
7
|
+
import { useAuthRepository as _ } from "../apis/repositories/context.js";
|
|
8
|
+
import { AUTH_EMAILS as v, AUTH_ME as y, AUTH_OWNER_AUTHORITIES as b, AUTH_OWNER_FORGERS as x, AUTH_PHONES as S, AUTH_PROFILES as C, AUTH_PROFILE_SEARCH as w, AUTH_PUBLIC_CARD as T } from "../constants/key.js";
|
|
9
|
+
import { systemEventEmitter as E } from "../events/system.js";
|
|
10
|
+
import { useUnifiedQuery as D } from "../utils/factory/hooks.js";
|
|
11
|
+
import { pickProfile as O } from "../utils/domain/account.js";
|
|
12
|
+
import { emitHookError as k, emitHookSuccess as A } from "./toast.js";
|
|
13
|
+
import { useEffect as j } from "react";
|
|
15
14
|
import { useMutation as M } from "@tanstack/react-query";
|
|
16
15
|
import { flushSync as N } from "react-dom";
|
|
17
16
|
//#region src/hooks/auth.ts
|
|
18
17
|
function P() {
|
|
19
|
-
let e =
|
|
18
|
+
let e = p((e) => e.currentAccountId), t = p((e) => e.currentProfileId), n = p((e) => e.isAuthValid), r = p((e) => e.currentProfileKind);
|
|
20
19
|
return {
|
|
21
20
|
aID: e,
|
|
22
21
|
pID: t,
|
|
@@ -26,447 +25,447 @@ function P() {
|
|
|
26
25
|
};
|
|
27
26
|
}
|
|
28
27
|
function F(e, t) {
|
|
29
|
-
|
|
30
|
-
e && a.getState().isAuthValid &&
|
|
28
|
+
j(() => {
|
|
29
|
+
e && a.getState().isAuthValid && s(a.getState().currentProfileId) && (h.emit(g.LOGOUT, t), ee());
|
|
31
30
|
}, [e, t]);
|
|
32
31
|
}
|
|
33
32
|
function I() {
|
|
34
|
-
let e =
|
|
33
|
+
let e = _(), { aID: t, pID: n, isAuthValid: r, kind: i } = P(), a = D(({ kind: t }) => e.GetCurrentFullAccountInformationWithProfile(t), y(t, n), { kind: i }, { enabled: r && s(n) });
|
|
35
34
|
return F(a.isError, t), {
|
|
36
35
|
kind: i,
|
|
37
36
|
data: a.data,
|
|
38
|
-
profile:
|
|
37
|
+
profile: O(i, a.data),
|
|
39
38
|
isLoading: a.isLoading,
|
|
40
39
|
isError: a.isError,
|
|
41
40
|
refetch: a.refetch
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
|
-
var L = () => {
|
|
45
|
-
let
|
|
43
|
+
var L = (e) => {
|
|
44
|
+
let t = _();
|
|
46
45
|
return M({
|
|
47
|
-
mutationFn: (
|
|
46
|
+
mutationFn: (e) => t.SendVerificationCode(e),
|
|
48
47
|
onSuccess: () => {
|
|
49
|
-
|
|
48
|
+
A(e);
|
|
50
49
|
},
|
|
51
|
-
onError: (
|
|
52
|
-
|
|
50
|
+
onError: (t) => {
|
|
51
|
+
k(t, e, "[useSendVerificationCode] error");
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
|
-
}, R = () => {
|
|
56
|
-
let
|
|
54
|
+
}, R = (e) => {
|
|
55
|
+
let n = _();
|
|
57
56
|
return M({
|
|
58
|
-
mutationFn: async ({ rememberMe:
|
|
59
|
-
let r = await
|
|
60
|
-
return
|
|
61
|
-
...
|
|
57
|
+
mutationFn: async ({ rememberMe: e, ...t }) => {
|
|
58
|
+
let r = await m();
|
|
59
|
+
return n.SignupWithEmail({
|
|
60
|
+
...t,
|
|
62
61
|
deviceId: r
|
|
63
62
|
});
|
|
64
63
|
},
|
|
65
64
|
onSuccess: (e, n) => {
|
|
66
|
-
e?.accessToken && (
|
|
65
|
+
e?.accessToken && (f({
|
|
67
66
|
accessToken: e.accessToken,
|
|
68
67
|
refreshToken: t(e.refreshToken)
|
|
69
|
-
}, { rememberMe: n.rememberMe }),
|
|
68
|
+
}, { rememberMe: n.rememberMe }), d(!0), e.accountId && c(e.accountId), e.profileId ? (l(e.profileId), u(i.COMMUNITY), h.emit(g.LOGIN_SUCCESS, e.accountId)) : l(o));
|
|
70
69
|
},
|
|
71
|
-
onError: (
|
|
72
|
-
|
|
70
|
+
onError: (t) => {
|
|
71
|
+
k(t, e, "[useSignup] error");
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
|
-
}, z = () => {
|
|
76
|
-
let
|
|
74
|
+
}, z = (e) => {
|
|
75
|
+
let n = _();
|
|
77
76
|
return M({
|
|
78
|
-
mutationFn: async ({ rememberMe:
|
|
79
|
-
...
|
|
80
|
-
deviceId: await
|
|
77
|
+
mutationFn: async ({ rememberMe: e, ...t }) => n.LoginWithEmail({
|
|
78
|
+
...t,
|
|
79
|
+
deviceId: await m()
|
|
81
80
|
}),
|
|
82
81
|
onSuccess: (e, n) => {
|
|
83
|
-
e?.accessToken && (
|
|
82
|
+
e?.accessToken && (l(o), f({
|
|
84
83
|
accessToken: e.accessToken,
|
|
85
84
|
refreshToken: t(e.refreshToken)
|
|
86
|
-
}, { rememberMe: n.rememberMe }),
|
|
85
|
+
}, { rememberMe: n.rememberMe }), d(!0), e.accountId && c(e.accountId));
|
|
87
86
|
},
|
|
88
|
-
onError: (
|
|
89
|
-
|
|
87
|
+
onError: (t) => {
|
|
88
|
+
k(t, e, "[useLogin] error");
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
|
-
}, B = () => {
|
|
93
|
-
let
|
|
91
|
+
}, B = (e) => {
|
|
92
|
+
let n = _();
|
|
94
93
|
return M({
|
|
95
|
-
mutationFn: async ({ rememberMe:
|
|
96
|
-
...
|
|
97
|
-
deviceId: await
|
|
94
|
+
mutationFn: async ({ rememberMe: e, ...t }) => n.LoginWithPhone({
|
|
95
|
+
...t,
|
|
96
|
+
deviceId: await m()
|
|
98
97
|
}),
|
|
99
98
|
onSuccess: (e, n) => {
|
|
100
|
-
e?.accessToken && (
|
|
99
|
+
e?.accessToken && (l(o), f({
|
|
101
100
|
accessToken: e.accessToken,
|
|
102
101
|
refreshToken: t(e.refreshToken)
|
|
103
|
-
}, { rememberMe: n.rememberMe }),
|
|
102
|
+
}, { rememberMe: n.rememberMe }), d(!0), e.accountId && c(e.accountId));
|
|
104
103
|
},
|
|
105
|
-
onError: (
|
|
106
|
-
|
|
104
|
+
onError: (t) => {
|
|
105
|
+
k(t, e, "[useLoginWithPhone] error");
|
|
107
106
|
}
|
|
108
107
|
});
|
|
109
108
|
}, V = (e) => {
|
|
110
|
-
let n =
|
|
109
|
+
let n = _();
|
|
111
110
|
return M({
|
|
112
111
|
mutationFn: async ({ profileId: e, kind: t }) => n.SelectProfile({
|
|
113
112
|
profileId: e,
|
|
114
113
|
kind: t,
|
|
115
|
-
deviceId: await
|
|
114
|
+
deviceId: await m()
|
|
116
115
|
}),
|
|
117
116
|
onMutate: () => {
|
|
118
|
-
e?.switchingMsg &&
|
|
117
|
+
e?.switchingMsg && E.showLoading(e.switchingMsg);
|
|
119
118
|
},
|
|
120
119
|
onSuccess: (n, r) => {
|
|
121
120
|
try {
|
|
122
121
|
if (!n?.accessToken) return;
|
|
123
122
|
N(() => {
|
|
124
|
-
|
|
123
|
+
f({
|
|
125
124
|
accessToken: n.accessToken,
|
|
126
125
|
refreshToken: t(n.refreshToken)
|
|
127
|
-
}),
|
|
128
|
-
}),
|
|
126
|
+
}), u(r.kind), n.profileId && l(n.profileId), e?.onCommit?.();
|
|
127
|
+
}), h.emit(g.LOGIN_SUCCESS, n.accountId);
|
|
129
128
|
} finally {
|
|
130
|
-
|
|
129
|
+
E.hideLoading();
|
|
131
130
|
}
|
|
132
131
|
},
|
|
133
|
-
onError: (
|
|
134
|
-
|
|
132
|
+
onError: (t) => {
|
|
133
|
+
E.hideLoading(), k(t, e, "[useSelectProfile] error");
|
|
135
134
|
}
|
|
136
135
|
});
|
|
137
136
|
}, H = (t) => {
|
|
138
|
-
let n =
|
|
137
|
+
let n = _(), { kind: r } = P(), i = e(t?.silent, !1);
|
|
139
138
|
return M({
|
|
140
139
|
mutationFn: (e) => n.PatchProfile(r, e),
|
|
141
140
|
onSuccess: () => {
|
|
142
|
-
i ||
|
|
141
|
+
i || A(t);
|
|
143
142
|
let e = a.getState().currentAccountId;
|
|
144
|
-
|
|
143
|
+
h.invalidateProfiles({
|
|
145
144
|
aID: e,
|
|
146
145
|
kind: r
|
|
147
146
|
});
|
|
148
147
|
},
|
|
149
148
|
onError: (e) => {
|
|
150
|
-
|
|
149
|
+
k(e, t, "[usePatchProfile] error", i);
|
|
151
150
|
}
|
|
152
151
|
});
|
|
153
|
-
}, U = () => {
|
|
154
|
-
let
|
|
152
|
+
}, U = (e) => {
|
|
153
|
+
let t = _(), { kind: n } = P();
|
|
155
154
|
return M({
|
|
156
|
-
mutationFn: (
|
|
155
|
+
mutationFn: (e) => t.PatchProfileSettings(n, e),
|
|
157
156
|
onSuccess: () => {
|
|
158
|
-
let
|
|
159
|
-
|
|
157
|
+
let t = a.getState().currentAccountId;
|
|
158
|
+
h.emit(g.UPDATE_ACCOUNT_SUCCESS, t), A(e);
|
|
160
159
|
},
|
|
161
|
-
onError: (
|
|
162
|
-
|
|
160
|
+
onError: (t) => {
|
|
161
|
+
k(t, e, "[useUpdateProfileSettings] error");
|
|
163
162
|
}
|
|
164
163
|
});
|
|
165
|
-
}, W = () => {
|
|
166
|
-
let
|
|
164
|
+
}, W = (e) => {
|
|
165
|
+
let t = _(), { kind: n } = P();
|
|
167
166
|
return M({
|
|
168
|
-
mutationFn: (
|
|
169
|
-
onError: (
|
|
170
|
-
|
|
167
|
+
mutationFn: (e) => t.UpdatePreference(n, e),
|
|
168
|
+
onError: (t) => {
|
|
169
|
+
k(t, e, "[useUpdatePreference] error");
|
|
171
170
|
}
|
|
172
171
|
});
|
|
173
172
|
}, G = (e) => {
|
|
174
|
-
let t =
|
|
175
|
-
return
|
|
173
|
+
let t = _(), { aID: n, isAuthValid: r } = P();
|
|
174
|
+
return D(() => t.ListProfiles(e, {
|
|
176
175
|
limit: 50,
|
|
177
176
|
offset: 0
|
|
178
|
-
}),
|
|
179
|
-
}, K = () => {
|
|
180
|
-
let
|
|
177
|
+
}), C(n, e), void 0, { enabled: r && !!n });
|
|
178
|
+
}, K = (e) => {
|
|
179
|
+
let t = _();
|
|
181
180
|
return M({
|
|
182
|
-
mutationFn: (
|
|
181
|
+
mutationFn: (e) => t.CreateForgerProfile(e),
|
|
183
182
|
onSuccess: () => {
|
|
184
183
|
let e = a.getState().currentAccountId;
|
|
185
|
-
|
|
184
|
+
h.invalidateProfiles({
|
|
186
185
|
aID: e,
|
|
187
186
|
kind: i.COMMUNITY
|
|
188
187
|
});
|
|
189
188
|
},
|
|
190
|
-
onError: (
|
|
191
|
-
|
|
189
|
+
onError: (t) => {
|
|
190
|
+
k(t, e, "[useCreateForgerProfile] error");
|
|
192
191
|
}
|
|
193
192
|
});
|
|
194
|
-
}, q = () => {
|
|
195
|
-
let
|
|
193
|
+
}, q = (e) => {
|
|
194
|
+
let t = _();
|
|
196
195
|
return M({
|
|
197
|
-
mutationFn: (
|
|
196
|
+
mutationFn: (e) => t.CreateAuthorityProfile(e),
|
|
198
197
|
onSuccess: () => {
|
|
199
198
|
let e = a.getState().currentAccountId;
|
|
200
|
-
|
|
199
|
+
h.invalidateProfiles({
|
|
201
200
|
aID: e,
|
|
202
201
|
kind: i.AUTHORITY
|
|
203
202
|
});
|
|
204
203
|
},
|
|
205
|
-
onError: (
|
|
206
|
-
|
|
204
|
+
onError: (t) => {
|
|
205
|
+
k(t, e, "[useCreateAuthorityProfile] error");
|
|
207
206
|
}
|
|
208
207
|
});
|
|
209
|
-
}, J = () => {
|
|
210
|
-
let
|
|
208
|
+
}, J = (e) => {
|
|
209
|
+
let t = _();
|
|
211
210
|
return M({
|
|
212
|
-
mutationFn: ({ kind:
|
|
211
|
+
mutationFn: ({ kind: e, profileId: n }) => t.DeleteProfile(e, n),
|
|
213
212
|
onSuccess: (e, t) => {
|
|
214
213
|
let n = a.getState().currentAccountId;
|
|
215
|
-
|
|
214
|
+
h.invalidateProfiles({
|
|
216
215
|
aID: n,
|
|
217
216
|
kind: t.kind
|
|
218
217
|
});
|
|
219
218
|
},
|
|
220
|
-
onError: (
|
|
221
|
-
|
|
219
|
+
onError: (t) => {
|
|
220
|
+
k(t, e, "[useDeleteProfile] error");
|
|
222
221
|
}
|
|
223
222
|
});
|
|
224
|
-
}, te = () => {
|
|
225
|
-
let
|
|
223
|
+
}, te = (e) => {
|
|
224
|
+
let t = _(), { kind: n } = P();
|
|
226
225
|
return M({
|
|
227
|
-
mutationFn: (
|
|
226
|
+
mutationFn: (e) => t.ConfirmProfileAvatar(n, e),
|
|
228
227
|
onSuccess: () => {
|
|
229
228
|
let e = a.getState().currentAccountId;
|
|
230
|
-
|
|
229
|
+
h.emit(g.UPDATE_ACCOUNT_SUCCESS, e);
|
|
231
230
|
},
|
|
232
|
-
onError: (
|
|
233
|
-
|
|
231
|
+
onError: (t) => {
|
|
232
|
+
k(t, e, "[useConfirmProfileAvatar] error");
|
|
234
233
|
}
|
|
235
234
|
});
|
|
236
|
-
}, Y = () => {
|
|
237
|
-
let
|
|
235
|
+
}, Y = (e) => {
|
|
236
|
+
let t = _(), { kind: n } = P();
|
|
238
237
|
return M({
|
|
239
|
-
mutationFn: () =>
|
|
238
|
+
mutationFn: () => t.ClearProfileAvatar(n),
|
|
240
239
|
onSuccess: () => {
|
|
241
|
-
let
|
|
242
|
-
|
|
240
|
+
let t = a.getState().currentAccountId;
|
|
241
|
+
h.emit(g.UPDATE_ACCOUNT_SUCCESS, t), A(e);
|
|
243
242
|
},
|
|
244
|
-
onError: (
|
|
245
|
-
|
|
243
|
+
onError: (t) => {
|
|
244
|
+
k(t, e, "[useClearProfileAvatar] error");
|
|
246
245
|
}
|
|
247
246
|
});
|
|
248
247
|
}, X = () => {
|
|
249
|
-
let e =
|
|
250
|
-
return
|
|
248
|
+
let e = _(), { aID: t, isAuthValid: n } = P();
|
|
249
|
+
return D(() => e.ListEmails({
|
|
251
250
|
limit: 50,
|
|
252
251
|
offset: 0
|
|
253
|
-
}),
|
|
252
|
+
}), v(t), void 0, { enabled: n && !!t });
|
|
254
253
|
}, Z = () => {
|
|
255
|
-
let e =
|
|
256
|
-
return
|
|
254
|
+
let e = _(), { aID: t, isAuthValid: n } = P();
|
|
255
|
+
return D(() => e.ListPhones({
|
|
257
256
|
limit: 50,
|
|
258
257
|
offset: 0
|
|
259
|
-
}),
|
|
260
|
-
}, Q = () => {
|
|
261
|
-
let
|
|
258
|
+
}), S(t), void 0, { enabled: n && !!t });
|
|
259
|
+
}, Q = (e) => {
|
|
260
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
262
261
|
return M({
|
|
263
|
-
mutationFn: (
|
|
262
|
+
mutationFn: (e) => t.CreateEmail(e),
|
|
264
263
|
onSuccess: () => {
|
|
265
|
-
|
|
264
|
+
h.invalidateEmails(n), A(e);
|
|
266
265
|
},
|
|
267
|
-
onError: (
|
|
268
|
-
|
|
266
|
+
onError: (t) => {
|
|
267
|
+
k(t, e, "[useCreateEmail] error");
|
|
269
268
|
}
|
|
270
269
|
});
|
|
271
|
-
}, ne = () => {
|
|
272
|
-
let
|
|
270
|
+
}, ne = (e) => {
|
|
271
|
+
let t = _();
|
|
273
272
|
return M({
|
|
274
|
-
mutationFn: ({ emailId:
|
|
273
|
+
mutationFn: ({ emailId: e, lang: n }) => t.SendEmailVerificationCode(e, { lang: n }),
|
|
275
274
|
onSuccess: () => {
|
|
276
|
-
|
|
275
|
+
A(e);
|
|
277
276
|
},
|
|
278
|
-
onError: (
|
|
279
|
-
|
|
277
|
+
onError: (t) => {
|
|
278
|
+
k(t, e, "[useSendEmailVerificationCode] error");
|
|
280
279
|
}
|
|
281
280
|
});
|
|
282
|
-
}, re = () => {
|
|
283
|
-
let
|
|
281
|
+
}, re = (e) => {
|
|
282
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
284
283
|
return M({
|
|
285
|
-
mutationFn: ({ emailId:
|
|
284
|
+
mutationFn: ({ emailId: e, verificationCode: n }) => t.VerifyEmail(e, { verificationCode: n }),
|
|
286
285
|
onSuccess: () => {
|
|
287
|
-
|
|
286
|
+
h.invalidateEmails(n), A(e);
|
|
288
287
|
},
|
|
289
|
-
onError: (
|
|
290
|
-
|
|
288
|
+
onError: (t) => {
|
|
289
|
+
k(t, e, "[useVerifyEmail] error");
|
|
291
290
|
}
|
|
292
291
|
});
|
|
293
|
-
}, ie = () => {
|
|
294
|
-
let
|
|
292
|
+
}, ie = (e) => {
|
|
293
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
295
294
|
return M({
|
|
296
|
-
mutationFn: ({ emailId:
|
|
295
|
+
mutationFn: ({ emailId: e, email: n }) => t.UpdateEmail(e, { email: n }),
|
|
297
296
|
onSuccess: () => {
|
|
298
|
-
|
|
297
|
+
h.invalidateEmails(n), A(e);
|
|
299
298
|
},
|
|
300
|
-
onError: (
|
|
301
|
-
|
|
299
|
+
onError: (t) => {
|
|
300
|
+
k(t, e, "[useUpdateEmail] error");
|
|
302
301
|
}
|
|
303
302
|
});
|
|
304
|
-
}, ae = () => {
|
|
305
|
-
let
|
|
303
|
+
}, ae = (e) => {
|
|
304
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
306
305
|
return M({
|
|
307
|
-
mutationFn: (
|
|
306
|
+
mutationFn: (e) => t.SetPrimaryEmail(e),
|
|
308
307
|
onSuccess: () => {
|
|
309
|
-
|
|
308
|
+
h.invalidateEmails(n), h.emit(g.UPDATE_ACCOUNT_SUCCESS, n), A(e);
|
|
310
309
|
},
|
|
311
|
-
onError: (
|
|
312
|
-
|
|
310
|
+
onError: (t) => {
|
|
311
|
+
k(t, e, "[useSetPrimaryEmail] error");
|
|
313
312
|
}
|
|
314
313
|
});
|
|
315
|
-
}, oe = () => {
|
|
316
|
-
let
|
|
314
|
+
}, oe = (e) => {
|
|
315
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
317
316
|
return M({
|
|
318
|
-
mutationFn: (
|
|
317
|
+
mutationFn: (e) => t.DeleteEmail(e),
|
|
319
318
|
onSuccess: () => {
|
|
320
|
-
|
|
319
|
+
h.invalidateEmails(n), A(e);
|
|
321
320
|
},
|
|
322
|
-
onError: (
|
|
323
|
-
|
|
321
|
+
onError: (t) => {
|
|
322
|
+
k(t, e, "[useDeleteEmail] error");
|
|
324
323
|
}
|
|
325
324
|
});
|
|
326
|
-
}, se = () => {
|
|
327
|
-
let
|
|
325
|
+
}, se = (e) => {
|
|
326
|
+
let t = _();
|
|
328
327
|
return M({
|
|
329
|
-
mutationFn: (
|
|
328
|
+
mutationFn: (e = {}) => t.SendChangePasswordVerificationCode(e),
|
|
330
329
|
onSuccess: () => {
|
|
331
|
-
|
|
330
|
+
A(e);
|
|
332
331
|
},
|
|
333
|
-
onError: (
|
|
334
|
-
|
|
332
|
+
onError: (t) => {
|
|
333
|
+
k(t, e, "[useSendChangePasswordVerificationCode] error");
|
|
335
334
|
}
|
|
336
335
|
});
|
|
337
|
-
}, ce = () => {
|
|
338
|
-
let
|
|
336
|
+
}, ce = (e) => {
|
|
337
|
+
let t = _();
|
|
339
338
|
return M({
|
|
340
|
-
mutationFn: (
|
|
339
|
+
mutationFn: (e) => t.ChangePassword(e),
|
|
341
340
|
onSuccess: () => {
|
|
342
|
-
|
|
341
|
+
A(e);
|
|
343
342
|
},
|
|
344
|
-
onError: (
|
|
345
|
-
|
|
343
|
+
onError: (t) => {
|
|
344
|
+
k(t, e, "[useChangePassword] error");
|
|
346
345
|
}
|
|
347
346
|
});
|
|
348
|
-
}, le = () => {
|
|
349
|
-
let
|
|
347
|
+
}, le = (e) => {
|
|
348
|
+
let t = _(), { kind: n } = P();
|
|
350
349
|
return M({
|
|
351
|
-
mutationFn: (
|
|
350
|
+
mutationFn: (e) => t.ConfirmProfileBackgrounds(n, e),
|
|
352
351
|
onSuccess: () => {
|
|
353
352
|
let e = a.getState().currentAccountId;
|
|
354
|
-
|
|
353
|
+
h.emit(g.UPDATE_ACCOUNT_SUCCESS, e);
|
|
355
354
|
},
|
|
356
|
-
onError: (
|
|
357
|
-
|
|
355
|
+
onError: (t) => {
|
|
356
|
+
k(t, e, "[useConfirmProfileBackgrounds] error");
|
|
358
357
|
}
|
|
359
358
|
});
|
|
360
|
-
}, ue = () => {
|
|
361
|
-
let
|
|
359
|
+
}, ue = (e) => {
|
|
360
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
362
361
|
return M({
|
|
363
|
-
mutationFn: (
|
|
362
|
+
mutationFn: (e) => t.CreatePhone(e),
|
|
364
363
|
onSuccess: () => {
|
|
365
|
-
|
|
364
|
+
h.invalidatePhones(n), A(e);
|
|
366
365
|
},
|
|
367
|
-
onError: (
|
|
368
|
-
|
|
366
|
+
onError: (t) => {
|
|
367
|
+
k(t, e, "[useCreatePhone] error");
|
|
369
368
|
}
|
|
370
369
|
});
|
|
371
|
-
}, de = () => {
|
|
372
|
-
let
|
|
370
|
+
}, de = (e) => {
|
|
371
|
+
let t = _();
|
|
373
372
|
return M({
|
|
374
|
-
mutationFn: (
|
|
373
|
+
mutationFn: (e) => t.SendPhoneVerificationCode(e),
|
|
375
374
|
onSuccess: () => {
|
|
376
|
-
|
|
375
|
+
A(e);
|
|
377
376
|
},
|
|
378
|
-
onError: (
|
|
379
|
-
|
|
377
|
+
onError: (t) => {
|
|
378
|
+
k(t, e, "[useSendPhoneVerificationCode] error");
|
|
380
379
|
}
|
|
381
380
|
});
|
|
382
|
-
}, fe = () => {
|
|
383
|
-
let
|
|
381
|
+
}, fe = (e) => {
|
|
382
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
384
383
|
return M({
|
|
385
|
-
mutationFn: ({ phoneId:
|
|
384
|
+
mutationFn: ({ phoneId: e, verificationCode: n }) => t.VerifyPhone(e, { verificationCode: n }),
|
|
386
385
|
onSuccess: () => {
|
|
387
|
-
|
|
386
|
+
h.invalidatePhones(n), A(e);
|
|
388
387
|
},
|
|
389
|
-
onError: (
|
|
390
|
-
|
|
388
|
+
onError: (t) => {
|
|
389
|
+
k(t, e, "[useVerifyPhone] error");
|
|
391
390
|
}
|
|
392
391
|
});
|
|
393
|
-
}, pe = () => {
|
|
394
|
-
let
|
|
392
|
+
}, pe = (e) => {
|
|
393
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
395
394
|
return M({
|
|
396
|
-
mutationFn: ({ phoneId:
|
|
395
|
+
mutationFn: ({ phoneId: e, phone: n }) => t.UpdatePhone(e, { phone: n }),
|
|
397
396
|
onSuccess: () => {
|
|
398
|
-
|
|
397
|
+
h.invalidatePhones(n), A(e);
|
|
399
398
|
},
|
|
400
|
-
onError: (
|
|
401
|
-
|
|
399
|
+
onError: (t) => {
|
|
400
|
+
k(t, e, "[useUpdatePhone] error");
|
|
402
401
|
}
|
|
403
402
|
});
|
|
404
|
-
}, $ = () => {
|
|
405
|
-
let
|
|
403
|
+
}, $ = (e) => {
|
|
404
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
406
405
|
return M({
|
|
407
|
-
mutationFn: (
|
|
406
|
+
mutationFn: (e) => t.SetPrimaryPhone(e),
|
|
408
407
|
onSuccess: () => {
|
|
409
|
-
|
|
408
|
+
h.invalidatePhones(n), h.emit(g.UPDATE_ACCOUNT_SUCCESS, n), A(e);
|
|
410
409
|
},
|
|
411
|
-
onError: (
|
|
412
|
-
|
|
410
|
+
onError: (t) => {
|
|
411
|
+
k(t, e, "[useSetPrimaryPhone] error");
|
|
413
412
|
}
|
|
414
413
|
});
|
|
415
|
-
}, me = () => {
|
|
416
|
-
let
|
|
414
|
+
}, me = (e) => {
|
|
415
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
417
416
|
return M({
|
|
418
|
-
mutationFn: (
|
|
417
|
+
mutationFn: (e) => t.DeletePhone(e),
|
|
419
418
|
onSuccess: () => {
|
|
420
|
-
|
|
419
|
+
h.invalidatePhones(n), A(e);
|
|
421
420
|
},
|
|
422
|
-
onError: (
|
|
423
|
-
|
|
421
|
+
onError: (t) => {
|
|
422
|
+
k(t, e, "[useDeletePhone] error");
|
|
424
423
|
}
|
|
425
424
|
});
|
|
426
425
|
}, he = (e) => {
|
|
427
|
-
let t =
|
|
428
|
-
return
|
|
426
|
+
let t = _(), { aID: n, isAuthValid: r } = P(), a = e.trim();
|
|
427
|
+
return D(({ query: e }) => t.SearchForgerProfiles({
|
|
429
428
|
query: e,
|
|
430
429
|
limit: 50,
|
|
431
430
|
offset: 0
|
|
432
|
-
}),
|
|
431
|
+
}), w(n, i.COMMUNITY, a), { query: a }, { enabled: r && !!n && a.length > 0 });
|
|
433
432
|
}, ge = (e) => {
|
|
434
|
-
let t =
|
|
435
|
-
return
|
|
433
|
+
let t = _(), { aID: n, isAuthValid: r } = P(), a = e.trim();
|
|
434
|
+
return D(({ query: e }) => t.SearchAuthorityProfiles({
|
|
436
435
|
query: e,
|
|
437
436
|
limit: 50,
|
|
438
437
|
offset: 0
|
|
439
|
-
}),
|
|
438
|
+
}), w(n, i.AUTHORITY, a), { query: a }, { enabled: r && !!n && a.length > 0 });
|
|
440
439
|
}, _e = (e) => {
|
|
441
|
-
let t =
|
|
442
|
-
return
|
|
440
|
+
let t = _(), { isAuthValid: n } = P();
|
|
441
|
+
return D(() => t.GetPublicProfileCard(e), T(e), void 0, { enabled: n && !!e });
|
|
443
442
|
}, ve = (e = "") => {
|
|
444
|
-
let t =
|
|
445
|
-
return
|
|
443
|
+
let t = _(), { aID: n, isAuthValid: r } = P(), i = e.trim();
|
|
444
|
+
return D(({ query: e }) => t.ListOwnerForgerProfiles({
|
|
446
445
|
limit: 50,
|
|
447
446
|
offset: 0,
|
|
448
447
|
query: e || void 0
|
|
449
|
-
}), [...
|
|
448
|
+
}), [...x(n), i], { query: i }, { enabled: r && !!n });
|
|
450
449
|
}, ye = (e = "") => {
|
|
451
|
-
let t =
|
|
452
|
-
return
|
|
450
|
+
let t = _(), { aID: n, isAuthValid: r } = P(), i = e.trim();
|
|
451
|
+
return D(({ query: e }) => t.ListOwnerAuthorityProfiles({
|
|
453
452
|
limit: 50,
|
|
454
453
|
offset: 0,
|
|
455
454
|
query: e || void 0
|
|
456
|
-
}), [...
|
|
457
|
-
}, be = () => {
|
|
458
|
-
let
|
|
455
|
+
}), [...b(n), i], { query: i }, { enabled: r && !!n });
|
|
456
|
+
}, be = (e) => {
|
|
457
|
+
let t = _(), n = a.getState().currentAccountId;
|
|
459
458
|
return M({
|
|
460
|
-
mutationFn: ({ profileId:
|
|
459
|
+
mutationFn: ({ profileId: e, authorityRoles: n }) => t.UpdateAuthorityProfileRoles(e, { authorityRoles: n }),
|
|
461
460
|
onSuccess: () => {
|
|
462
|
-
|
|
461
|
+
h.invalidateOwner(n), A(e);
|
|
463
462
|
},
|
|
464
|
-
onError: (
|
|
465
|
-
|
|
463
|
+
onError: (t) => {
|
|
464
|
+
k(t, e, "[useUpdateAuthorityProfileRoles] error");
|
|
466
465
|
}
|
|
467
466
|
});
|
|
468
467
|
};
|
|
469
468
|
//#endregion
|
|
470
|
-
export { r as AuthSignupPlatformEnum, a as AuthStore, n as LanguageEnum,
|
|
469
|
+
export { r as AuthSignupPlatformEnum, a as AuthStore, n as LanguageEnum, s as hasSelectedProfile, P as useAuthQueryScope, p as useAuthStore, ce as useChangePassword, Y as useClearProfileAvatar, te as useConfirmProfileAvatar, le as useConfirmProfileBackgrounds, q as useCreateAuthorityProfile, Q as useCreateEmail, K as useCreateForgerProfile, ue as useCreatePhone, I as useCurrentProfile, oe as useDeleteEmail, me as useDeletePhone, J as useDeleteProfile, _e as useGetPublicProfileCard, X as useListEmails, ye as useListOwnerAuthorityProfiles, ve as useListOwnerForgerProfiles, Z as useListPhones, G as useListProfiles, z as useLoginWithEmail, B as useLoginWithPhone, H as usePatchProfile, ge as useSearchAuthorityProfiles, he as useSearchForgerProfiles, V as useSelectProfile, se as useSendChangePasswordVerificationCode, ne as useSendEmailVerificationCode, de as useSendPhoneVerificationCode, L as useSendVerificationCode, ae as useSetPrimaryEmail, $ as useSetPrimaryPhone, R as useSignupWithEmail, be as useUpdateAuthorityProfileRoles, ie as useUpdateEmail, pe as useUpdatePhone, W as useUpdatePreference, U as useUpdateProfileSettings, re as useVerifyEmail, fe as useVerifyPhone };
|
|
471
470
|
|
|
472
471
|
//# sourceMappingURL=auth.js.map
|