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