nfx-ui 0.27.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.
@@ -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