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