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