nfx-ui 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +12 -0
- package/README.md +4 -111
- package/dist/apis/repositories/AuthRepository.js +9 -9
- package/dist/apis/repositories/AuthRepository.js.map +1 -1
- package/dist/enums/auth.d.ts +3 -3
- package/dist/enums/auth.d.ts.map +1 -1
- package/dist/enums/auth.js +2 -2
- package/dist/enums/auth.js.map +1 -1
- package/dist/hooks/auth.d.ts +1 -3
- package/dist/hooks/auth.d.ts.map +1 -1
- package/dist/hooks/auth.js +17 -28
- package/dist/hooks/auth.js.map +1 -1
- package/dist/themes/index.css +1 -1
- package/dist/types/domain/auth/profile.d.ts +4 -4
- package/dist/types/domain/auth/profile.d.ts.map +1 -1
- package/dist/types/domain/auth/signup.d.ts +6 -2
- package/dist/types/domain/auth/signup.d.ts.map +1 -1
- package/dist/utils/domain/account.d.ts +1 -1
- package/dist/utils/domain/account.d.ts.map +1 -1
- package/dist/utils/domain/account.js +1 -1
- package/dist/utils/domain/account.js.map +1 -1
- package/package.json +1 -1
- package/src/apis/repositories/AuthRepository.ts +10 -10
- package/src/enums/auth.ts +5 -4
- package/src/hooks/auth.ts +5 -13
- package/src/themes/index.css +52 -0
- package/src/types/domain/auth/profile.ts +5 -5
- package/src/types/domain/auth/signup.ts +6 -3
- package/src/utils/domain/account.ts +2 -2
package/README.en.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# NFX-UI
|
|
2
|
+
|
|
3
|
+
[中文](README.md)
|
|
4
|
+
|
|
5
|
+
Shared React library for NebulaForgeX (theme, i18n, hooks). **Not** a standalone site. Hosts: Identity, Vault, News, Storages, Documentation.
|
|
6
|
+
|
|
7
|
+
Exports and host wiring: [NFX-Documentation chapter 7](https://github.com/NebulaForgeX/NFX-Documentation/blob/main/books/en/chapter-07-nfx-ui.md). Current **0.29.0**; hosts pin exactly `"nfx-ui": "0.29.0"`. No `file:` dual path.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
npm run build
|
|
12
|
+
```
|
package/README.md
CHANGED
|
@@ -1,119 +1,12 @@
|
|
|
1
|
-
# NFX-UI
|
|
1
|
+
# NFX-UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](README.en.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
NebulaForgeX 共享 React 库(主题、i18n、hooks)。**不是**独立站点。宿主:Identity、Vault、News、Storages、Documentation。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
宿主:Identity、Vault、Documentation、Storages。不含 LSR / PQTTEC / SJGZ。
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Install / 安装
|
|
14
|
-
|
|
15
|
-
Host apps use the local package:
|
|
16
|
-
|
|
17
|
-
宿主使用本地包:
|
|
18
|
-
|
|
19
|
-
```json
|
|
20
|
-
"nfx-ui": "file:../../NFX-UI"
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Peer versions follow PulsoLink-WEB (do not `ncu` past them independently):
|
|
24
|
-
|
|
25
|
-
对等依赖版本对齐 PulsoLink-WEB(不要单独 `ncu` 越过):
|
|
26
|
-
|
|
27
|
-
- `react` / `react-dom` `^19.2.8`
|
|
28
|
-
- `react-router` `^8.3.1` (not `react-router-dom`)
|
|
29
|
-
- `@radix-ui/themes` `^3.3.0`, `radix-ui` `^1.6.7`, `@radix-ui/react-icons` `^1.3.2`
|
|
30
|
-
- `lucide-react` `^1.41.0`
|
|
31
|
-
- `vite` `^8.2.2`, `typescript` `~6.0.3`
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Host bootstrap / 宿主接入
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
import { LanguageEnum } from "nfx-ui/enums";
|
|
39
|
-
import { LanguageProvider, ThemeProvider, ModalProvider } from "nfx-ui/providers";
|
|
40
|
-
import { LayoutFrame, LayoutProvider, Sidebar, Header, Main, PageFrame } from "nfx-ui/layouts";
|
|
41
|
-
import { PreferencesPopover, ThemeSettings, PageHeader, EmptyState } from "nfx-ui/components";
|
|
42
|
-
import { usePreferenceStore } from "nfx-ui/stores";
|
|
43
|
-
import { configurePreferenceSync, useSyncPreference, useApplyPreferenceOnLoad } from "nfx-ui/hooks";
|
|
44
|
-
import { showInfo, showError, showSuccess, showConfirm } from "nfx-ui/stores";
|
|
45
|
-
import "@radix-ui/themes/styles.css";
|
|
46
|
-
import "nfx-ui/themes/fonts";
|
|
47
|
-
import "nfx-ui/themes/styles.css";
|
|
48
|
-
|
|
49
|
-
export function App() {
|
|
50
|
-
return (
|
|
51
|
-
<LanguageProvider getBuiltinBundles={getBuiltinI18nBundles}>
|
|
52
|
-
<ThemeProvider>
|
|
53
|
-
<LayoutProvider>
|
|
54
|
-
<ModalProvider>
|
|
55
|
-
<LayoutFrame items={menuItems}>{/* pages */}</LayoutFrame>
|
|
56
|
-
</ModalProvider>
|
|
57
|
-
</LayoutProvider>
|
|
58
|
-
</ThemeProvider>
|
|
59
|
-
</LanguageProvider>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
- `ThemeProvider` does **not** take `defaultTheme`. Theme lives on preference: `{ accent, gray, appearance, radius, scaling, panelBackground, fontFamily }`.
|
|
65
|
-
- `ThemeProvider` **不再**接收 `defaultTheme`。主题在 preference 的 theme 对象上。
|
|
66
|
-
- Fonts: import `"nfx-ui/themes/fonts"` (source, not bundled into every lib entry).
|
|
67
|
-
- 字体:`"nfx-ui/themes/fonts"`(源码入口,不要打进每个 lib chunk)。
|
|
68
|
-
- Page chrome: `PageFrame` + `PageHeader` (`icon` is required) + Radix `Card` / `Flex` / `Button` / `TextField`.
|
|
69
|
-
- 页面壳:`PageFrame` + `PageHeader`(必须有 `icon`)+ Radix 原语。
|
|
70
|
-
- Auth screens copy PulsoLink `AuthShell`. Theme/language UI is `PreferencesPopover` / `ThemeSettings`.
|
|
71
|
-
- 登录页拷 PulsoLink `AuthShell`。主题/语言用 `PreferencesPopover` / `ThemeSettings`。
|
|
72
|
-
- Queries: `useUnifiedQuery` / `useUnifiedInfiniteQuery` from `nfx-ui/hooks` (or `nfx-ui/utils`). Pages never call axios.
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
import { Button, TextField, Flex, Card } from "@radix-ui/themes";
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Modules / 模块
|
|
81
|
-
|
|
82
|
-
| Module | Contents |
|
|
83
|
-
|--------|----------|
|
|
84
|
-
| **enums** | Language, appearance, accent, radius, dashboard background |
|
|
85
|
-
| **providers** | ThemeProvider, LanguageProvider, ModalProvider |
|
|
86
|
-
| **themes** | Radix mappings, fonts, CSS |
|
|
87
|
-
| **languages** | i18n init, createI18nResources, labels |
|
|
88
|
-
| **layouts** | LayoutFrame, Sidebar (`react-pro-sidebar`), Header, Main, PageFrame, UserTopBar |
|
|
89
|
-
| **components** | PreferencesPopover, ThemeSettings, PageHeader, EmptyState, LucideIcon, Logo, VirtualList + Radix re-exports |
|
|
90
|
-
| **stores** | preference + modal (`showInfo` / `showSuccess` / `showError` / `showConfirm` / `showLoading`) |
|
|
91
|
-
| **hooks** | useUnifiedQuery, useSyncPreference, useApplyPreferenceOnLoad, configurePreferenceSync |
|
|
92
|
-
| **animations** | WaveBackground, ECGLoading, TruckLoading, … |
|
|
93
|
-
| **types / utils / constants** | Shared types and helpers |
|
|
94
|
-
|
|
95
|
-
`useTheme().setTheme` takes `Partial<ResolvedThemePreference>`. Preference persist key is `nfx-preference`.
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## Development / 开发
|
|
100
|
-
|
|
101
|
-
This repo is library-only. Build with `npm run build`. Output in `dist/`. Font CSS must not be injected into every lib entry.
|
|
102
|
-
|
|
103
|
-
本仓库仅库模式。`npm run build` 输出到 `dist/`。字体 CSS 不得注入每个入口。
|
|
7
|
+
接入与真实导出:[NFX-Documentation 第七章](https://github.com/NebulaForgeX/NFX-Documentation/blob/main/books/zh/chapter-07-nfx-ui.md)。当前 **0.29.0**,宿主精确钉 `"nfx-ui": "0.29.0"`。不要 `file:` 双路径。
|
|
104
8
|
|
|
105
9
|
```bash
|
|
106
10
|
npm install
|
|
107
11
|
npm run build
|
|
108
|
-
npm run lint
|
|
109
12
|
```
|
|
110
|
-
|
|
111
|
-
Test via host `file:../../NFX-UI`. Do not modify `Example/` (CityPulso PulsoLink is source of truth only).
|
|
112
|
-
|
|
113
|
-
用宿主 `file:../../NFX-UI` 验证。不要改 `Example/`(CityPulso PulsoLink 只作对照源)。
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## License
|
|
118
|
-
|
|
119
|
-
[MIT](LICENSE)
|
|
@@ -32,7 +32,7 @@ var o = class {
|
|
|
32
32
|
}
|
|
33
33
|
async GetCurrentFullAccountInformationWithProfile(i) {
|
|
34
34
|
switch (i) {
|
|
35
|
-
case e.
|
|
35
|
+
case e.COMMUNITY: {
|
|
36
36
|
let { data: e } = await r.get(t.AUTH.Me.FullAccountInformationWithForgerProfile);
|
|
37
37
|
return n(e, "GetCurrentFullAccountInformationWithProfile");
|
|
38
38
|
}
|
|
@@ -45,7 +45,7 @@ var o = class {
|
|
|
45
45
|
}
|
|
46
46
|
async PatchProfile(n, i) {
|
|
47
47
|
switch (n) {
|
|
48
|
-
case e.
|
|
48
|
+
case e.COMMUNITY:
|
|
49
49
|
await r.patch(t.AUTH.Me.ForgerProfile, i);
|
|
50
50
|
return;
|
|
51
51
|
case e.AUTHORITY:
|
|
@@ -56,7 +56,7 @@ var o = class {
|
|
|
56
56
|
}
|
|
57
57
|
async PatchProfileSettings(n, i) {
|
|
58
58
|
switch (n) {
|
|
59
|
-
case e.
|
|
59
|
+
case e.COMMUNITY:
|
|
60
60
|
await r.patch(t.AUTH.Me.ForgerProfileSettings, i);
|
|
61
61
|
return;
|
|
62
62
|
case e.AUTHORITY:
|
|
@@ -67,7 +67,7 @@ var o = class {
|
|
|
67
67
|
}
|
|
68
68
|
async ConfirmProfileAvatar(n, i) {
|
|
69
69
|
switch (n) {
|
|
70
|
-
case e.
|
|
70
|
+
case e.COMMUNITY:
|
|
71
71
|
await r.put(t.AUTH.Me.ForgerProfileAvatars, i);
|
|
72
72
|
return;
|
|
73
73
|
case e.AUTHORITY:
|
|
@@ -78,7 +78,7 @@ var o = class {
|
|
|
78
78
|
}
|
|
79
79
|
async ClearProfileAvatar(n) {
|
|
80
80
|
switch (n) {
|
|
81
|
-
case e.
|
|
81
|
+
case e.COMMUNITY:
|
|
82
82
|
await r.delete(t.AUTH.Me.ForgerProfileAvatars);
|
|
83
83
|
return;
|
|
84
84
|
case e.AUTHORITY:
|
|
@@ -89,7 +89,7 @@ var o = class {
|
|
|
89
89
|
}
|
|
90
90
|
async ConfirmProfileBackgrounds(n, i) {
|
|
91
91
|
switch (n) {
|
|
92
|
-
case e.
|
|
92
|
+
case e.COMMUNITY:
|
|
93
93
|
await r.put(t.AUTH.Me.ForgerProfileBackgrounds, i);
|
|
94
94
|
return;
|
|
95
95
|
case e.AUTHORITY:
|
|
@@ -100,7 +100,7 @@ var o = class {
|
|
|
100
100
|
}
|
|
101
101
|
async ListProfiles(i, a = {}) {
|
|
102
102
|
switch (i) {
|
|
103
|
-
case e.
|
|
103
|
+
case e.COMMUNITY: {
|
|
104
104
|
let { data: e } = await r.get(t.AUTH.Me.Profiles, { params: a });
|
|
105
105
|
return n(e, "ListProfiles");
|
|
106
106
|
}
|
|
@@ -113,7 +113,7 @@ var o = class {
|
|
|
113
113
|
}
|
|
114
114
|
async DeleteProfile(n, i) {
|
|
115
115
|
switch (n) {
|
|
116
|
-
case e.
|
|
116
|
+
case e.COMMUNITY:
|
|
117
117
|
await r.delete(t.AUTH.Me.ProfileById(i));
|
|
118
118
|
return;
|
|
119
119
|
case e.AUTHORITY:
|
|
@@ -124,7 +124,7 @@ var o = class {
|
|
|
124
124
|
}
|
|
125
125
|
async UpdatePreference(n, i) {
|
|
126
126
|
switch (n) {
|
|
127
|
-
case e.
|
|
127
|
+
case e.COMMUNITY:
|
|
128
128
|
await r.put(t.AUTH.Me.ForgerProfilePreference, { preference: i });
|
|
129
129
|
return;
|
|
130
130
|
case e.AUTHORITY:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthRepository.js","names":[],"sources":["../../../src/apis/repositories/AuthRepository.ts"],"sourcesContent":["import type { DataResponse, FullAccountInfoByKind, ListDTOWithTotalNumber, Login, Profile, ProfileItemsByKind, Signup, Tokens } from \"nfx-ui/types\";\n\nimport { ProfileKindEnum } from \"nfx-ui/enums\";\n\nimport { protectedClient, publicClient, publicClientWithoutTransform } from \"../clients\";\nimport { dataFromResponse, URL_PATHS } from \"../ip\";\n\nexport interface AuthRepository {\n GetErrorTranslations(lang: string): Promise<Record<string, string>>;\n GetMessageTranslations(lang: string): Promise<Record<string, unknown>>;\n SendVerificationCode(params: Signup.Request.SendVerificationCode): Promise<void>;\n SignupWithEmail(params: Signup.Request.SignupWithEmail): Promise<Signup.Response.SignupWithEmail>;\n LoginWithEmail(params: Login.Request.LoginWithEmail): Promise<Login.Response.LoginWithEmail>;\n LoginWithPhone(params: Login.Request.LoginWithPhone): Promise<Login.Response.LoginWithPhone>;\n SelectProfile(params: Login.Request.SelectProfile): Promise<Login.Response.SelectProfile>;\n GetCurrentFullAccountInformationWithProfile<K extends ProfileKindEnum>(kind: K): Promise<FullAccountInfoByKind<K>>;\n PatchProfile(kind: ProfileKindEnum, body: Profile.Request.PatchProfile): Promise<void>;\n PatchProfileSettings(kind: ProfileKindEnum, body: Profile.Request.PatchProfileSettings): Promise<void>;\n ConfirmProfileAvatar(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileAvatar): Promise<void>;\n ClearProfileAvatar(kind: ProfileKindEnum): Promise<void>;\n ConfirmProfileBackgrounds(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileBackgrounds): Promise<void>;\n ListProfiles<K extends ProfileKindEnum>(kind: K, params?: { limit?: number; offset?: number }): Promise<ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>>;\n DeleteProfile(kind: ProfileKindEnum, profileId: string): Promise<void>;\n UpdatePreference(kind: ProfileKindEnum, preference: string): Promise<void>;\n CreateForgerProfile(body: Login.Request.CreateForgerProfile): Promise<Login.Response.CreateForgerProfile>;\n CreateAuthorityProfile(body: Login.Request.CreateAuthorityProfile): Promise<Login.Response.CreateAuthorityProfile>;\n SearchForgerProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>;\n SearchAuthorityProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>;\n GetPublicProfileCard(profileId: string): Promise<Profile.Response.ForgerProfileItem>;\n ListEmails(params?: { limit?: number; offset?: number }): Promise<ListDTOWithTotalNumber<Login.EmailItem>>;\n CreateEmail(body: Login.Request.CreateEmail): Promise<Login.Response.CreateEmail>;\n SendEmailVerificationCode(emailId: string, body?: Login.Request.SendEmailVerificationCode): Promise<void>;\n VerifyEmail(emailId: string, body: Login.Request.VerifyEmail): Promise<void>;\n UpdateEmail(emailId: string, body: Login.Request.UpdateEmail): Promise<void>;\n SetPrimaryEmail(emailId: string): Promise<void>;\n DeleteEmail(emailId: string): Promise<void>;\n ListPhones(params?: { limit?: number; offset?: number }): Promise<ListDTOWithTotalNumber<Login.PhoneItem>>;\n CreatePhone(body: Login.Request.CreatePhone): Promise<Login.Response.CreatePhone>;\n SendPhoneVerificationCode(phoneId: string): Promise<void>;\n VerifyPhone(phoneId: string, body: Login.Request.VerifyPhone): Promise<void>;\n UpdatePhone(phoneId: string, body: Login.Request.UpdatePhone): Promise<void>;\n SetPrimaryPhone(phoneId: string): Promise<void>;\n DeletePhone(phoneId: string): Promise<void>;\n SendChangePasswordVerificationCode(body?: Login.Request.SendChangePasswordVerificationCode): Promise<void>;\n ChangePassword(body: Login.Request.ChangePassword): Promise<void>;\n RefreshTokens(params: Tokens.Request.RefreshTokens): Promise<Tokens.Response.Tokens>;\n Logout(params: Tokens.Request.Logout): Promise<void>;\n ListOwnerForgerProfiles(params?: { limit?: number; offset?: number; query?: string }): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>;\n ListOwnerAuthorityProfiles(params?: { limit?: number; offset?: number; query?: string }): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>;\n UpdateAuthorityProfileRoles(profileId: string, params: Profile.Request.UpdateAuthorityProfileRoles): Promise<void>;\n}\n\nexport class ApiAuthRepository implements AuthRepository {\n async GetErrorTranslations(lang: string): Promise<Record<string, string>> {\n const { data } = await publicClientWithoutTransform.get<Record<string, string>>(URL_PATHS.AUTH.Locales.errorsByLang(lang));\n return data;\n }\n\n async GetMessageTranslations(lang: string): Promise<Record<string, unknown>> {\n const { data } = await publicClientWithoutTransform.get<Record<string, unknown>>(URL_PATHS.AUTH.Messages.byLang(lang));\n return data;\n }\n\n async SendVerificationCode(params: Signup.Request.SendVerificationCode): Promise<void> {\n await publicClient.post(URL_PATHS.AUTH.SignupSendCode, params);\n }\n\n async SignupWithEmail(params: Signup.Request.SignupWithEmail): Promise<Signup.Response.SignupWithEmail> {\n const { data } = await publicClient.post<DataResponse<Signup.Response.SignupWithEmail>>(URL_PATHS.AUTH.SignupWithEmail, params);\n return data.data;\n }\n\n async LoginWithEmail(params: Login.Request.LoginWithEmail): Promise<Login.Response.LoginWithEmail> {\n const { data } = await publicClient.post<DataResponse<Login.Response.LoginWithEmail>>(URL_PATHS.AUTH.LoginWithEmail, params);\n return data.data;\n }\n\n async LoginWithPhone(params: Login.Request.LoginWithPhone): Promise<Login.Response.LoginWithPhone> {\n const { data } = await publicClient.post<DataResponse<Login.Response.LoginWithPhone>>(URL_PATHS.AUTH.LoginWithPhone, params);\n return data.data;\n }\n\n async SelectProfile(params: Login.Request.SelectProfile): Promise<Login.Response.SelectProfile> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.SelectProfile>>(URL_PATHS.AUTH.Me.SelectProfile, params);\n return dataFromResponse(data, \"SelectProfile\");\n }\n\n async GetCurrentFullAccountInformationWithProfile<K extends ProfileKindEnum>(kind: K): Promise<FullAccountInfoByKind<K>> {\n switch (kind) {\n case ProfileKindEnum.FORGER: {\n const { data } = await protectedClient.get<DataResponse<Profile.Response.FullAccountInformationWithForgerProfile>>(\n URL_PATHS.AUTH.Me.FullAccountInformationWithForgerProfile,\n );\n return dataFromResponse(data, \"GetCurrentFullAccountInformationWithProfile\") as FullAccountInfoByKind<K>;\n }\n case ProfileKindEnum.AUTHORITY: {\n const { data } = await protectedClient.get<DataResponse<Profile.Response.FullAccountInformationWithAuthorityProfile>>(\n URL_PATHS.AUTH.Me.FullAccountInformationWithAuthorityProfile,\n );\n return dataFromResponse(data, \"GetCurrentFullAccountInformationWithProfile\") as FullAccountInfoByKind<K>;\n }\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async PatchProfile(kind: ProfileKindEnum, body: Profile.Request.PatchProfile): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.FORGER:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfile, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfile, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async PatchProfileSettings(kind: ProfileKindEnum, body: Profile.Request.PatchProfileSettings): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.FORGER:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileSettings, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileSettings, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ConfirmProfileAvatar(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileAvatar): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.FORGER:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileAvatars, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileAvatars, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ClearProfileAvatar(kind: ProfileKindEnum): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.FORGER:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileAvatars);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileAvatars);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ConfirmProfileBackgrounds(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileBackgrounds): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.FORGER:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileBackgrounds, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileBackgrounds, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ListProfiles<K extends ProfileKindEnum>(kind: K, params: { limit?: number; offset?: number } = {}): Promise<ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>> {\n switch (kind) {\n case ProfileKindEnum.FORGER: {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>>(URL_PATHS.AUTH.Me.Profiles, { params });\n return dataFromResponse(data, \"ListProfiles\") as ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>;\n }\n case ProfileKindEnum.AUTHORITY: {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>>(URL_PATHS.AUTH.Me.AuthorityProfiles, { params });\n return dataFromResponse(data, \"ListProfiles\") as ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>;\n }\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async DeleteProfile(kind: ProfileKindEnum, profileId: string): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.FORGER:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.ProfileById(profileId));\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileById(profileId));\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async UpdatePreference(kind: ProfileKindEnum, preference: string): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.FORGER:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfilePreference, { preference });\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfilePreference, { preference });\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async CreateForgerProfile(body: Login.Request.CreateForgerProfile): Promise<Login.Response.CreateForgerProfile> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreateForgerProfile>>(URL_PATHS.AUTH.Me.Profiles, body);\n return dataFromResponse(data, \"CreateForgerProfile\");\n }\n\n async CreateAuthorityProfile(body: Login.Request.CreateAuthorityProfile): Promise<Login.Response.CreateAuthorityProfile> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreateAuthorityProfile>>(URL_PATHS.AUTH.Me.AuthorityProfiles, body);\n return dataFromResponse(data, \"CreateAuthorityProfile\");\n }\n\n async SearchForgerProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>> {\n const { data } = await protectedClient.post<DataResponse<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>>(URL_PATHS.AUTH.Me.SearchForgerProfiles, params);\n return dataFromResponse(data, \"SearchForgerProfiles\");\n }\n\n async SearchAuthorityProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>> {\n const { data } = await protectedClient.post<DataResponse<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>>(URL_PATHS.AUTH.Me.SearchAuthorityProfiles, params);\n return dataFromResponse(data, \"SearchAuthorityProfiles\");\n }\n\n async GetPublicProfileCard(profileId: string): Promise<Profile.Response.ForgerProfileItem> {\n const { data } = await protectedClient.get<DataResponse<Profile.Response.ForgerProfileItem>>(URL_PATHS.AUTH.Me.PublicProfileCardById(profileId));\n return dataFromResponse(data, \"GetPublicProfileCard\");\n }\n\n async ListEmails(params: { limit?: number; offset?: number } = {}): Promise<ListDTOWithTotalNumber<Login.EmailItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Login.EmailItem>>>(URL_PATHS.AUTH.Me.Emails, { params });\n return dataFromResponse(data, \"ListEmails\");\n }\n\n async CreateEmail(body: Login.Request.CreateEmail): Promise<Login.Response.CreateEmail> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreateEmail>>(URL_PATHS.AUTH.Me.Emails, body);\n return dataFromResponse(data, \"CreateEmail\");\n }\n\n async SendEmailVerificationCode(emailId: string, body: Login.Request.SendEmailVerificationCode = {}): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.EmailSendVerificationCode(emailId), body);\n }\n\n async VerifyEmail(emailId: string, body: Login.Request.VerifyEmail): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.EmailVerify(emailId), body);\n }\n\n async UpdateEmail(emailId: string, body: Login.Request.UpdateEmail): Promise<void> {\n await protectedClient.patch(URL_PATHS.AUTH.Me.EmailById(emailId), body);\n }\n\n async SetPrimaryEmail(emailId: string): Promise<void> {\n await protectedClient.put(URL_PATHS.AUTH.Me.EmailPrimary(emailId));\n }\n\n async DeleteEmail(emailId: string): Promise<void> {\n await protectedClient.delete(URL_PATHS.AUTH.Me.EmailById(emailId));\n }\n\n async ListPhones(params: { limit?: number; offset?: number } = {}): Promise<ListDTOWithTotalNumber<Login.PhoneItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Login.PhoneItem>>>(URL_PATHS.AUTH.Me.Phones, { params });\n return dataFromResponse(data, \"ListPhones\");\n }\n\n async CreatePhone(body: Login.Request.CreatePhone): Promise<Login.Response.CreatePhone> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreatePhone>>(URL_PATHS.AUTH.Me.Phones, body);\n return dataFromResponse(data, \"CreatePhone\");\n }\n\n async SendPhoneVerificationCode(phoneId: string): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.PhoneSendVerificationCode(phoneId));\n }\n\n async VerifyPhone(phoneId: string, body: Login.Request.VerifyPhone): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.PhoneVerify(phoneId), body);\n }\n\n async UpdatePhone(phoneId: string, body: Login.Request.UpdatePhone): Promise<void> {\n await protectedClient.patch(URL_PATHS.AUTH.Me.PhoneById(phoneId), body);\n }\n\n async SetPrimaryPhone(phoneId: string): Promise<void> {\n await protectedClient.put(URL_PATHS.AUTH.Me.PhonePrimary(phoneId));\n }\n\n async DeletePhone(phoneId: string): Promise<void> {\n await protectedClient.delete(URL_PATHS.AUTH.Me.PhoneById(phoneId));\n }\n\n async SendChangePasswordVerificationCode(body: Login.Request.SendChangePasswordVerificationCode = {}): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.PasswordSendVerificationCode, body);\n }\n\n async ChangePassword(body: Login.Request.ChangePassword): Promise<void> {\n await protectedClient.put(URL_PATHS.AUTH.Me.Password, body);\n }\n\n async RefreshTokens(params: Tokens.Request.RefreshTokens): Promise<Tokens.Response.Tokens> {\n const { data } = await publicClient.post<DataResponse<Tokens.Response.Tokens>>(URL_PATHS.AUTH.Refresh, params);\n return dataFromResponse(data, \"RefreshTokens\");\n }\n\n async Logout(params: Tokens.Request.Logout): Promise<void> {\n await publicClient.post(URL_PATHS.AUTH.Logout, params);\n }\n\n async ListOwnerForgerProfiles(params: { limit?: number; offset?: number; query?: string } = {}): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>>(URL_PATHS.AUTH.Owner.ForgerProfiles, { params });\n return dataFromResponse(data, \"ListOwnerForgerProfiles\");\n }\n\n async ListOwnerAuthorityProfiles(params: { limit?: number; offset?: number; query?: string } = {}): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>>(URL_PATHS.AUTH.Owner.AuthorityProfiles, { params });\n return dataFromResponse(data, \"ListOwnerAuthorityProfiles\");\n }\n\n async UpdateAuthorityProfileRoles(profileId: string, params: Profile.Request.UpdateAuthorityProfileRoles): Promise<void> {\n await protectedClient.patch(URL_PATHS.AUTH.Owner.UpdateAuthorityProfileRoles(profileId), params);\n }\n}\n"],"mappings":";;;;AAoDA,IAAa,IAAb,MAAyD;CACvD,MAAM,qBAAqB,GAA+C;EACxE,IAAM,EAAE,YAAS,MAAM,EAA6B,IAA4B,EAAU,KAAK,QAAQ,aAAa,CAAI,CAAC;EACzH,OAAO;CACT;CAEA,MAAM,uBAAuB,GAAgD;EAC3E,IAAM,EAAE,YAAS,MAAM,EAA6B,IAA6B,EAAU,KAAK,SAAS,OAAO,CAAI,CAAC;EACrH,OAAO;CACT;CAEA,MAAM,qBAAqB,GAA4D;EACrF,MAAM,EAAa,KAAK,EAAU,KAAK,gBAAgB,CAAM;CAC/D;CAEA,MAAM,gBAAgB,GAAkF;EACtG,IAAM,EAAE,YAAS,MAAM,EAAa,KAAoD,EAAU,KAAK,iBAAiB,CAA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4B,GAAmB,GAAoE;EACvH,MAAM,EAAgB,MAAM,EAAU,KAAK,MAAM,4BAA4B,CAAS,GAAG,CAAM;CACjG;AACF"}
|
|
1
|
+
{"version":3,"file":"AuthRepository.js","names":[],"sources":["../../../src/apis/repositories/AuthRepository.ts"],"sourcesContent":["import type { DataResponse, FullAccountInfoByKind, ListDTOWithTotalNumber, Login, Profile, ProfileItemsByKind, Signup, Tokens } from \"nfx-ui/types\";\n\nimport { ProfileKindEnum } from \"nfx-ui/enums\";\n\nimport { protectedClient, publicClient, publicClientWithoutTransform } from \"../clients\";\nimport { dataFromResponse, URL_PATHS } from \"../ip\";\n\nexport interface AuthRepository {\n GetErrorTranslations(lang: string): Promise<Record<string, string>>;\n GetMessageTranslations(lang: string): Promise<Record<string, unknown>>;\n SendVerificationCode(params: Signup.Request.SendVerificationCode): Promise<void>;\n SignupWithEmail(params: Signup.Request.SignupWithEmail): Promise<Signup.Response.SignupWithEmail>;\n LoginWithEmail(params: Login.Request.LoginWithEmail): Promise<Login.Response.LoginWithEmail>;\n LoginWithPhone(params: Login.Request.LoginWithPhone): Promise<Login.Response.LoginWithPhone>;\n SelectProfile(params: Login.Request.SelectProfile): Promise<Login.Response.SelectProfile>;\n GetCurrentFullAccountInformationWithProfile<K extends ProfileKindEnum>(kind: K): Promise<FullAccountInfoByKind<K>>;\n PatchProfile(kind: ProfileKindEnum, body: Profile.Request.PatchProfile): Promise<void>;\n PatchProfileSettings(kind: ProfileKindEnum, body: Profile.Request.PatchProfileSettings): Promise<void>;\n ConfirmProfileAvatar(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileAvatar): Promise<void>;\n ClearProfileAvatar(kind: ProfileKindEnum): Promise<void>;\n ConfirmProfileBackgrounds(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileBackgrounds): Promise<void>;\n ListProfiles<K extends ProfileKindEnum>(kind: K, params?: { limit?: number; offset?: number }): Promise<ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>>;\n DeleteProfile(kind: ProfileKindEnum, profileId: string): Promise<void>;\n UpdatePreference(kind: ProfileKindEnum, preference: string): Promise<void>;\n CreateForgerProfile(body: Login.Request.CreateForgerProfile): Promise<Login.Response.CreateForgerProfile>;\n CreateAuthorityProfile(body: Login.Request.CreateAuthorityProfile): Promise<Login.Response.CreateAuthorityProfile>;\n SearchForgerProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>;\n SearchAuthorityProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>;\n GetPublicProfileCard(profileId: string): Promise<Profile.Response.ForgerProfileItem>;\n ListEmails(params?: { limit?: number; offset?: number }): Promise<ListDTOWithTotalNumber<Login.EmailItem>>;\n CreateEmail(body: Login.Request.CreateEmail): Promise<Login.Response.CreateEmail>;\n SendEmailVerificationCode(emailId: string, body?: Login.Request.SendEmailVerificationCode): Promise<void>;\n VerifyEmail(emailId: string, body: Login.Request.VerifyEmail): Promise<void>;\n UpdateEmail(emailId: string, body: Login.Request.UpdateEmail): Promise<void>;\n SetPrimaryEmail(emailId: string): Promise<void>;\n DeleteEmail(emailId: string): Promise<void>;\n ListPhones(params?: { limit?: number; offset?: number }): Promise<ListDTOWithTotalNumber<Login.PhoneItem>>;\n CreatePhone(body: Login.Request.CreatePhone): Promise<Login.Response.CreatePhone>;\n SendPhoneVerificationCode(phoneId: string): Promise<void>;\n VerifyPhone(phoneId: string, body: Login.Request.VerifyPhone): Promise<void>;\n UpdatePhone(phoneId: string, body: Login.Request.UpdatePhone): Promise<void>;\n SetPrimaryPhone(phoneId: string): Promise<void>;\n DeletePhone(phoneId: string): Promise<void>;\n SendChangePasswordVerificationCode(body?: Login.Request.SendChangePasswordVerificationCode): Promise<void>;\n ChangePassword(body: Login.Request.ChangePassword): Promise<void>;\n RefreshTokens(params: Tokens.Request.RefreshTokens): Promise<Tokens.Response.Tokens>;\n Logout(params: Tokens.Request.Logout): Promise<void>;\n ListOwnerForgerProfiles(params?: { limit?: number; offset?: number; query?: string }): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>;\n ListOwnerAuthorityProfiles(params?: { limit?: number; offset?: number; query?: string }): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>;\n UpdateAuthorityProfileRoles(profileId: string, params: Profile.Request.UpdateAuthorityProfileRoles): Promise<void>;\n}\n\nexport class ApiAuthRepository implements AuthRepository {\n async GetErrorTranslations(lang: string): Promise<Record<string, string>> {\n const { data } = await publicClientWithoutTransform.get<Record<string, string>>(URL_PATHS.AUTH.Locales.errorsByLang(lang));\n return data;\n }\n\n async GetMessageTranslations(lang: string): Promise<Record<string, unknown>> {\n const { data } = await publicClientWithoutTransform.get<Record<string, unknown>>(URL_PATHS.AUTH.Messages.byLang(lang));\n return data;\n }\n\n async SendVerificationCode(params: Signup.Request.SendVerificationCode): Promise<void> {\n await publicClient.post(URL_PATHS.AUTH.SignupSendCode, params);\n }\n\n async SignupWithEmail(params: Signup.Request.SignupWithEmail): Promise<Signup.Response.SignupWithEmail> {\n const { data } = await publicClient.post<DataResponse<Signup.Response.SignupWithEmail>>(URL_PATHS.AUTH.SignupWithEmail, params);\n return data.data;\n }\n\n async LoginWithEmail(params: Login.Request.LoginWithEmail): Promise<Login.Response.LoginWithEmail> {\n const { data } = await publicClient.post<DataResponse<Login.Response.LoginWithEmail>>(URL_PATHS.AUTH.LoginWithEmail, params);\n return data.data;\n }\n\n async LoginWithPhone(params: Login.Request.LoginWithPhone): Promise<Login.Response.LoginWithPhone> {\n const { data } = await publicClient.post<DataResponse<Login.Response.LoginWithPhone>>(URL_PATHS.AUTH.LoginWithPhone, params);\n return data.data;\n }\n\n async SelectProfile(params: Login.Request.SelectProfile): Promise<Login.Response.SelectProfile> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.SelectProfile>>(URL_PATHS.AUTH.Me.SelectProfile, params);\n return dataFromResponse(data, \"SelectProfile\");\n }\n\n async GetCurrentFullAccountInformationWithProfile<K extends ProfileKindEnum>(kind: K): Promise<FullAccountInfoByKind<K>> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY: {\n const { data } = await protectedClient.get<DataResponse<Profile.Response.FullAccountInformationWithCommunityProfile>>(\n URL_PATHS.AUTH.Me.FullAccountInformationWithForgerProfile,\n );\n return dataFromResponse(data, \"GetCurrentFullAccountInformationWithProfile\") as FullAccountInfoByKind<K>;\n }\n case ProfileKindEnum.AUTHORITY: {\n const { data } = await protectedClient.get<DataResponse<Profile.Response.FullAccountInformationWithAuthorityProfile>>(\n URL_PATHS.AUTH.Me.FullAccountInformationWithAuthorityProfile,\n );\n return dataFromResponse(data, \"GetCurrentFullAccountInformationWithProfile\") as FullAccountInfoByKind<K>;\n }\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async PatchProfile(kind: ProfileKindEnum, body: Profile.Request.PatchProfile): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfile, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfile, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async PatchProfileSettings(kind: ProfileKindEnum, body: Profile.Request.PatchProfileSettings): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileSettings, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.patch<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileSettings, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ConfirmProfileAvatar(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileAvatar): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileAvatars, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileAvatars, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ClearProfileAvatar(kind: ProfileKindEnum): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileAvatars);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileAvatars);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ConfirmProfileBackgrounds(kind: ProfileKindEnum, body: Profile.Request.ConfirmProfileBackgrounds): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfileBackgrounds, body);\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileBackgrounds, body);\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async ListProfiles<K extends ProfileKindEnum>(kind: K, params: { limit?: number; offset?: number } = {}): Promise<ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY: {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>>(URL_PATHS.AUTH.Me.Profiles, { params });\n return dataFromResponse(data, \"ListProfiles\") as ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>;\n }\n case ProfileKindEnum.AUTHORITY: {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>>(URL_PATHS.AUTH.Me.AuthorityProfiles, { params });\n return dataFromResponse(data, \"ListProfiles\") as ListDTOWithTotalNumber<ProfileItemsByKind<K>[number]>;\n }\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async DeleteProfile(kind: ProfileKindEnum, profileId: string): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.ProfileById(profileId));\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.delete<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfileById(profileId));\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async UpdatePreference(kind: ProfileKindEnum, preference: string): Promise<void> {\n switch (kind) {\n case ProfileKindEnum.COMMUNITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.ForgerProfilePreference, { preference });\n return;\n case ProfileKindEnum.AUTHORITY:\n await protectedClient.put<DataResponse<null>>(URL_PATHS.AUTH.Me.AuthorityProfilePreference, { preference });\n return;\n default:\n throw new Error(\"Invalid profile kind\");\n }\n }\n\n async CreateForgerProfile(body: Login.Request.CreateForgerProfile): Promise<Login.Response.CreateForgerProfile> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreateForgerProfile>>(URL_PATHS.AUTH.Me.Profiles, body);\n return dataFromResponse(data, \"CreateForgerProfile\");\n }\n\n async CreateAuthorityProfile(body: Login.Request.CreateAuthorityProfile): Promise<Login.Response.CreateAuthorityProfile> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreateAuthorityProfile>>(URL_PATHS.AUTH.Me.AuthorityProfiles, body);\n return dataFromResponse(data, \"CreateAuthorityProfile\");\n }\n\n async SearchForgerProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>> {\n const { data } = await protectedClient.post<DataResponse<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>>(URL_PATHS.AUTH.Me.SearchForgerProfiles, params);\n return dataFromResponse(data, \"SearchForgerProfiles\");\n }\n\n async SearchAuthorityProfiles(params: Profile.Request.SearchProfiles): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>> {\n const { data } = await protectedClient.post<DataResponse<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>>(URL_PATHS.AUTH.Me.SearchAuthorityProfiles, params);\n return dataFromResponse(data, \"SearchAuthorityProfiles\");\n }\n\n async GetPublicProfileCard(profileId: string): Promise<Profile.Response.ForgerProfileItem> {\n const { data } = await protectedClient.get<DataResponse<Profile.Response.ForgerProfileItem>>(URL_PATHS.AUTH.Me.PublicProfileCardById(profileId));\n return dataFromResponse(data, \"GetPublicProfileCard\");\n }\n\n async ListEmails(params: { limit?: number; offset?: number } = {}): Promise<ListDTOWithTotalNumber<Login.EmailItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Login.EmailItem>>>(URL_PATHS.AUTH.Me.Emails, { params });\n return dataFromResponse(data, \"ListEmails\");\n }\n\n async CreateEmail(body: Login.Request.CreateEmail): Promise<Login.Response.CreateEmail> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreateEmail>>(URL_PATHS.AUTH.Me.Emails, body);\n return dataFromResponse(data, \"CreateEmail\");\n }\n\n async SendEmailVerificationCode(emailId: string, body: Login.Request.SendEmailVerificationCode = {}): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.EmailSendVerificationCode(emailId), body);\n }\n\n async VerifyEmail(emailId: string, body: Login.Request.VerifyEmail): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.EmailVerify(emailId), body);\n }\n\n async UpdateEmail(emailId: string, body: Login.Request.UpdateEmail): Promise<void> {\n await protectedClient.patch(URL_PATHS.AUTH.Me.EmailById(emailId), body);\n }\n\n async SetPrimaryEmail(emailId: string): Promise<void> {\n await protectedClient.put(URL_PATHS.AUTH.Me.EmailPrimary(emailId));\n }\n\n async DeleteEmail(emailId: string): Promise<void> {\n await protectedClient.delete(URL_PATHS.AUTH.Me.EmailById(emailId));\n }\n\n async ListPhones(params: { limit?: number; offset?: number } = {}): Promise<ListDTOWithTotalNumber<Login.PhoneItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Login.PhoneItem>>>(URL_PATHS.AUTH.Me.Phones, { params });\n return dataFromResponse(data, \"ListPhones\");\n }\n\n async CreatePhone(body: Login.Request.CreatePhone): Promise<Login.Response.CreatePhone> {\n const { data } = await protectedClient.post<DataResponse<Login.Response.CreatePhone>>(URL_PATHS.AUTH.Me.Phones, body);\n return dataFromResponse(data, \"CreatePhone\");\n }\n\n async SendPhoneVerificationCode(phoneId: string): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.PhoneSendVerificationCode(phoneId));\n }\n\n async VerifyPhone(phoneId: string, body: Login.Request.VerifyPhone): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.PhoneVerify(phoneId), body);\n }\n\n async UpdatePhone(phoneId: string, body: Login.Request.UpdatePhone): Promise<void> {\n await protectedClient.patch(URL_PATHS.AUTH.Me.PhoneById(phoneId), body);\n }\n\n async SetPrimaryPhone(phoneId: string): Promise<void> {\n await protectedClient.put(URL_PATHS.AUTH.Me.PhonePrimary(phoneId));\n }\n\n async DeletePhone(phoneId: string): Promise<void> {\n await protectedClient.delete(URL_PATHS.AUTH.Me.PhoneById(phoneId));\n }\n\n async SendChangePasswordVerificationCode(body: Login.Request.SendChangePasswordVerificationCode = {}): Promise<void> {\n await protectedClient.post(URL_PATHS.AUTH.Me.PasswordSendVerificationCode, body);\n }\n\n async ChangePassword(body: Login.Request.ChangePassword): Promise<void> {\n await protectedClient.put(URL_PATHS.AUTH.Me.Password, body);\n }\n\n async RefreshTokens(params: Tokens.Request.RefreshTokens): Promise<Tokens.Response.Tokens> {\n const { data } = await publicClient.post<DataResponse<Tokens.Response.Tokens>>(URL_PATHS.AUTH.Refresh, params);\n return dataFromResponse(data, \"RefreshTokens\");\n }\n\n async Logout(params: Tokens.Request.Logout): Promise<void> {\n await publicClient.post(URL_PATHS.AUTH.Logout, params);\n }\n\n async ListOwnerForgerProfiles(params: { limit?: number; offset?: number; query?: string } = {}): Promise<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.ForgerProfileItem>>>(URL_PATHS.AUTH.Owner.ForgerProfiles, { params });\n return dataFromResponse(data, \"ListOwnerForgerProfiles\");\n }\n\n async ListOwnerAuthorityProfiles(params: { limit?: number; offset?: number; query?: string } = {}): Promise<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>> {\n const { data } = await protectedClient.get<DataResponse<ListDTOWithTotalNumber<Profile.Response.AuthorityProfileItem>>>(URL_PATHS.AUTH.Owner.AuthorityProfiles, { params });\n return dataFromResponse(data, \"ListOwnerAuthorityProfiles\");\n }\n\n async UpdateAuthorityProfileRoles(profileId: string, params: Profile.Request.UpdateAuthorityProfileRoles): Promise<void> {\n await protectedClient.patch(URL_PATHS.AUTH.Owner.UpdateAuthorityProfileRoles(profileId), params);\n }\n}\n"],"mappings":";;;;AAoDA,IAAa,IAAb,MAAyD;CACvD,MAAM,qBAAqB,GAA+C;EACxE,IAAM,EAAE,YAAS,MAAM,EAA6B,IAA4B,EAAU,KAAK,QAAQ,aAAa,CAAI,CAAC;EACzH,OAAO;CACT;CAEA,MAAM,uBAAuB,GAAgD;EAC3E,IAAM,EAAE,YAAS,MAAM,EAA6B,IAA6B,EAAU,KAAK,SAAS,OAAO,CAAI,CAAC;EACrH,OAAO;CACT;CAEA,MAAM,qBAAqB,GAA4D;EACrF,MAAM,EAAa,KAAK,EAAU,KAAK,gBAAgB,CAAM;CAC/D;CAEA,MAAM,gBAAgB,GAAkF;EACtG,IAAM,EAAE,YAAS,MAAM,EAAa,KAAoD,EAAU,KAAK,iBAAiB,CAAM;EAC9H,OAAO,EAAK;CACd;CAEA,MAAM,eAAe,GAA8E;EACjG,IAAM,EAAE,YAAS,MAAM,EAAa,KAAkD,EAAU,KAAK,gBAAgB,CAAM;E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ANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Nilable } from '../types';
|
|
2
2
|
export declare function hasRole<T>(role: T, roles: Nilable<readonly T[]>): boolean;
|
|
3
3
|
export declare function hasAnyRole<T>(roles: Nilable<readonly T[]>, ...candidates: T[]): boolean;
|
|
4
|
-
/** 与后端 ProfileKind / profile_scope
|
|
4
|
+
/** 与后端 ProfileKind / profile_scope 一致("community" | "authority")。forger 是 community 档上的角色,不是 kind。 */
|
|
5
5
|
export declare enum ProfileKindEnum {
|
|
6
|
-
|
|
6
|
+
COMMUNITY = "community",
|
|
7
7
|
AUTHORITY = "authority"
|
|
8
8
|
}
|
|
9
|
-
export declare const DEFAULT_PROFILE_KIND = ProfileKindEnum.
|
|
9
|
+
export declare const DEFAULT_PROFILE_KIND = ProfileKindEnum.COMMUNITY;
|
|
10
10
|
export declare const PROFILE_KIND_VALUES: ProfileKindEnum[];
|
|
11
11
|
export declare const ProfileKind: (value: Nilable<string>) => ProfileKindEnum;
|
|
12
12
|
/** 普通档 forger_roles。 */
|
package/dist/enums/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/enums/auth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/enums/auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAEzE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC,EAAE,GAAG,OAAO,CAEvF;AAED,sGAAsG;AACtG,oBAAY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,OAAO,CAAC,MAAM,CAAC,6BACqB,CAAC;AAEjF,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB"}
|
package/dist/enums/auth.js
CHANGED
|
@@ -7,8 +7,8 @@ function r(e, ...t) {
|
|
|
7
7
|
return t.some((t) => n(t, e));
|
|
8
8
|
}
|
|
9
9
|
var i = /* @__PURE__ */ function(e) {
|
|
10
|
-
return e.
|
|
11
|
-
}({}), a = "
|
|
10
|
+
return e.COMMUNITY = "community", e.AUTHORITY = "authority", e;
|
|
11
|
+
}({}), a = "community", o = Object.values(i), s = (e) => t(e, o, a), c = /* @__PURE__ */ function(e) {
|
|
12
12
|
return e.FORGER = "forger", e;
|
|
13
13
|
}({}), l = "forger", u = Object.values(c), d = (e) => t(e, u, l), f = /* @__PURE__ */ function(e) {
|
|
14
14
|
return e.AUDITOR = "auditor", e.ADMINISTRATOR = "administrator", e.OWNER = "owner", e;
|
package/dist/enums/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","names":[],"sources":["../../src/enums/auth.ts"],"sourcesContent":["/**\n * Auth 枚举,镜像 Identity 后端。\n * ProfileKindEnum 与 JWT profile_scope 共用 wire 值 \"
|
|
1
|
+
{"version":3,"file":"auth.js","names":[],"sources":["../../src/enums/auth.ts"],"sourcesContent":["/**\n * Auth 枚举,镜像 Identity 后端。\n * ProfileKindEnum 与 JWT profile_scope 共用 wire 值 \"community\" | \"authority\"。\n * forger 是 community 档上的角色(AuthForgerRoleEnum),不是 kind。\n * 角色不在 JWT;能力门控按纯成员判定(hasRole / hasAnyRole)。\n */\n\nimport type { Nilable } from \"nfx-ui/types\";\n\nimport { safeArray, safeEnum } from \"nfx-ui/utils/safe\";\n\nexport function hasRole<T>(role: T, roles: Nilable<readonly T[]>): boolean {\n return safeArray(roles).includes(role);\n}\n\nexport function hasAnyRole<T>(roles: Nilable<readonly T[]>, ...candidates: T[]): boolean {\n return candidates.some((role) => hasRole(role, roles));\n}\n\n/** 与后端 ProfileKind / profile_scope 一致(\"community\" | \"authority\")。forger 是 community 档上的角色,不是 kind。 */\nexport enum ProfileKindEnum {\n COMMUNITY = \"community\",\n AUTHORITY = \"authority\",\n}\n\nexport const DEFAULT_PROFILE_KIND = ProfileKindEnum.COMMUNITY;\nexport const PROFILE_KIND_VALUES = Object.values(ProfileKindEnum);\nexport const ProfileKind = (value: Nilable<string>) => safeEnum(value, PROFILE_KIND_VALUES, DEFAULT_PROFILE_KIND);\n\n/** 普通档 forger_roles。 */\nexport enum AuthForgerRoleEnum {\n FORGER = \"forger\",\n}\nexport const DEFAULT_AUTH_FORGER_ROLE = AuthForgerRoleEnum.FORGER;\nexport const AUTH_FORGER_ROLE_VALUES = Object.values(AuthForgerRoleEnum);\nexport const AuthForgerRole = (value: Nilable<string>) => safeEnum(value, AUTH_FORGER_ROLE_VALUES, DEFAULT_AUTH_FORGER_ROLE);\n\n/** 管理档 authority_roles。角色不是包含关系。 */\nexport enum AuthAuthorityRoleEnum {\n AUDITOR = \"auditor\",\n ADMINISTRATOR = \"administrator\",\n OWNER = \"owner\",\n}\n\nexport const DEFAULT_AUTH_AUTHORITY_ROLE = AuthAuthorityRoleEnum.ADMINISTRATOR;\nexport const AUTH_AUTHORITY_ROLE_VALUES = Object.values(AuthAuthorityRoleEnum);\nexport const AuthAuthorityRole = (value: Nilable<string>) =>\n safeEnum(value, AUTH_AUTHORITY_ROLE_VALUES, DEFAULT_AUTH_AUTHORITY_ROLE);\n\n/** 可通过 UI/API 分配的权限角色(owner 仅允许数据库手动变更)。 */\nexport const UI_ASSIGNABLE_AUTH_AUTHORITY_ROLES = AUTH_AUTHORITY_ROLE_VALUES.filter(\n (role): role is Exclude<AuthAuthorityRoleEnum, AuthAuthorityRoleEnum.OWNER> => role !== AuthAuthorityRoleEnum.OWNER,\n);\n\nexport type ProfileRole = AuthForgerRoleEnum | AuthAuthorityRoleEnum;\n\nexport enum AuthSignupPlatformEnum {\n NFXIDENTITY = \"nfxidentity\",\n NFXNEWS = \"nfxnews\",\n NFXSTORAGES = \"nfxstorages\",\n NFXVAULT = \"nfxvault\",\n}\nexport const DEFAULT_AUTH_SIGNUP_PLATFORM = AuthSignupPlatformEnum.NFXIDENTITY;\nexport const AUTH_SIGNUP_PLATFORM_VALUES = Object.values(AuthSignupPlatformEnum);\nexport const AuthSignupPlatform = (value: Nilable<string>) =>\n safeEnum(value, AUTH_SIGNUP_PLATFORM_VALUES, DEFAULT_AUTH_SIGNUP_PLATFORM);\n\nexport enum AuthIdentityProviderEnum {\n PASSWORD = \"password\",\n}\nexport const DEFAULT_AUTH_IDENTITY_PROVIDER = AuthIdentityProviderEnum.PASSWORD;\nexport const AUTH_IDENTITY_PROVIDER_VALUES = Object.values(AuthIdentityProviderEnum);\nexport const AuthIdentityProvider = (value: Nilable<string>) =>\n safeEnum(value, AUTH_IDENTITY_PROVIDER_VALUES, DEFAULT_AUTH_IDENTITY_PROVIDER);\n\nexport enum AssetKindEnum {\n IMAGES = \"images\",\n FILES = \"files\",\n VIDEOS = \"videos\",\n AUDIOS = \"audios\",\n}\n"],"mappings":";;AAWA,SAAgB,EAAW,GAAS,GAAuC;CACzE,OAAO,EAAU,CAAK,CAAC,CAAC,SAAS,CAAI;AACvC;AAEA,SAAgB,EAAc,GAA8B,GAAG,GAA0B;CACvF,OAAO,EAAW,MAAM,MAAS,EAAQ,GAAM,CAAK,CAAC;AACvD;AAGA,IAAY,IAAL,yBAAA,GAAA;QACL,EAAA,YAAA,aACA,EAAA,YAAA;AACF,EAAA,CAAA,CAAA,GAEa,IAAA,aACA,IAAsB,OAAO,OAAO,CAAe,GACnD,KAAe,MAA2B,EAAS,GAAO,GAAqB,CAAoB,GAGpG,IAAL,yBAAA,GAAA;QACL,EAAA,SAAA;AACF,EAAA,CAAA,CAAA,GACa,IAAA,UACA,IAA0B,OAAO,OAAO,CAAkB,GAC1D,KAAkB,MAA2B,EAAS,GAAO,GAAyB,CAAwB,GAG/G,IAAL,yBAAA,GAAA;QACL,EAAA,UAAA,WACA,EAAA,gBAAA,iBACA,EAAA,QAAA;AACF,EAAA,CAAA,CAAA,GAEa,IAAA,iBACA,IAA6B,OAAO,OAAO,CAAqB,GAChE,KAAqB,MAChC,EAAS,GAAO,GAA4B,CAA2B,GAG5D,IAAqC,EAA2B,QAC1E,MAA8E,MAAA,OACjF,GAIY,IAAL,yBAAA,GAAA;QACL,EAAA,cAAA,eACA,EAAA,UAAA,WACA,EAAA,cAAA,eACA,EAAA,WAAA;AACF,EAAA,CAAA,CAAA,GACa,IAAA,eACA,IAA8B,OAAO,OAAO,CAAsB,GAClE,KAAsB,MACjC,EAAS,GAAO,GAA6B,CAA4B,GAE/D,IAAL,yBAAA,GAAA;QACL,EAAA,WAAA;AACF,EAAA,CAAA,CAAA,GACa,IAAA,YACA,IAAgC,OAAO,OAAO,CAAwB,GACtE,KAAwB,MACnC,EAAS,GAAO,GAA+B,CAA8B,GAEnE,IAAL,yBAAA,GAAA;QACL,EAAA,SAAA,UACA,EAAA,QAAA,SACA,EAAA,SAAA,UACA,EAAA,SAAA;AACF,EAAA,CAAA,CAAA"}
|
package/dist/hooks/auth.d.ts
CHANGED
|
@@ -11,9 +11,7 @@ export declare function useAuthQueryScope(): {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function useCurrentProfile(): CurrentProfileResult;
|
|
13
13
|
export declare const useSendVerificationCode: () => import('@tanstack/react-query').UseMutationResult<void, AxiosError<unknown, any, any>, Signup.Request.SendVerificationCode, unknown>;
|
|
14
|
-
export declare const useSignupWithEmail: () => import('@tanstack/react-query').UseMutationResult<
|
|
15
|
-
profileId?: string;
|
|
16
|
-
}, AxiosError<unknown, any, any>, {
|
|
14
|
+
export declare const useSignupWithEmail: () => import('@tanstack/react-query').UseMutationResult<Signup.Response.SignupWithEmail, AxiosError<unknown, any, any>, {
|
|
17
15
|
rememberMe: boolean;
|
|
18
16
|
} & Omit<Signup.Request.SignupWithEmail, "deviceId">, unknown>;
|
|
19
17
|
export declare const useLoginWithEmail: () => import('@tanstack/react-query').UseMutationResult<Login.Response.LoginWithEmail, AxiosError<unknown, any, any>, {
|
package/dist/hooks/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/hooks/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAMjF,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGrF,OAAO,EACL,SAAS,EAGT,kBAAkB,EAMlB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAQ5B,wBAAgB,iBAAiB;;;;;;EAMhC;AAWD,wBAAgB,iBAAiB,IAAI,oBAAoB,CAkBxD;AAED,eAAO,MAAM,uBAAuB,4IAYnC,CAAC;AAEF,eAAO,MAAM,kBAAkB;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/hooks/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAMjF,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGrF,OAAO,EACL,SAAS,EAGT,kBAAkB,EAMlB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAQ5B,wBAAgB,iBAAiB;;;;;;EAMhC;AAWD,wBAAgB,iBAAiB,IAAI,oBAAoB,CAkBxD;AAED,eAAO,MAAM,uBAAuB,4IAYnC,CAAC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7B,CAAC;AAEF,eAAO,MAAM,4BAA4B,kJAaxC,CAAC;AAEF,eAAO,MAAM,cAAc,wJAc1B,CAAC;AAEF,eAAO,MAAM,4BAA4B,+GAYxC,CAAC;AAEF,eAAO,MAAM,cAAc;aAKgC,MAAM;sBAAoB,MAAM;WAU1F,CAAC;AAEF,eAAO,MAAM,cAAc;aAKqB,MAAM;WAAS,MAAM;WASpE,CAAC;AAEF,eAAO,MAAM,kBAAkB,+GAe9B,CAAC;AAEF,eAAO,MAAM,cAAc,+GAc1B,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,qKAUpD,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,OAAO,MAAM,wKAUvD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,WAAW,MAAM,sHASxD,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,cAAU,qKAUpD,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,cAAU,wKAUvD,CAAC;AAEF,eAAO,MAAM,8BAA8B;eAKkB,MAAM;oBAAkB,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,gBAAgB,CAAC;WAUjJ,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
|
package/dist/hooks/auth.js
CHANGED
|
@@ -6,7 +6,7 @@ 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
|
|
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
10
|
import { systemEventEmitter as D } from "../events/system.js";
|
|
11
11
|
import { useUnifiedQuery as O } from "../utils/factory/hooks.js";
|
|
12
12
|
import { pickProfile as k } from "../utils/domain/account.js";
|
|
@@ -30,7 +30,7 @@ function P(e, t) {
|
|
|
30
30
|
}, [e, t]);
|
|
31
31
|
}
|
|
32
32
|
function F() {
|
|
33
|
-
let e = y(), { aID: t, pID: n, isAuthValid: r, kind: i } = N(), a = O(({ kind: t }) => e.GetCurrentFullAccountInformationWithProfile(t),
|
|
33
|
+
let e = y(), { aID: t, pID: n, isAuthValid: r, kind: i } = N(), a = O(({ kind: t }) => e.GetCurrentFullAccountInformationWithProfile(t), x(t, n), { kind: i }, { enabled: r && c(n) });
|
|
34
34
|
return P(a.isError, t), {
|
|
35
35
|
kind: i,
|
|
36
36
|
data: a.data,
|
|
@@ -55,28 +55,17 @@ var I = () => {
|
|
|
55
55
|
let e = y();
|
|
56
56
|
return M({
|
|
57
57
|
mutationFn: async ({ rememberMe: t, ...n }) => {
|
|
58
|
-
let r = await h()
|
|
58
|
+
let r = await h();
|
|
59
|
+
return e.SignupWithEmail({
|
|
59
60
|
...n,
|
|
60
61
|
deviceId: r
|
|
61
|
-
}), o = a.profiles?.find((e) => e.kind === i.FORGER) ?? a.profiles?.[0];
|
|
62
|
-
if (!o) return a;
|
|
63
|
-
let s = await e.SelectProfile({
|
|
64
|
-
profileId: o.profileId,
|
|
65
|
-
kind: o.kind,
|
|
66
|
-
deviceId: r
|
|
67
62
|
});
|
|
68
|
-
return {
|
|
69
|
-
...a,
|
|
70
|
-
accessToken: s.accessToken,
|
|
71
|
-
refreshToken: s.refreshToken,
|
|
72
|
-
profileId: s.profileId
|
|
73
|
-
};
|
|
74
63
|
},
|
|
75
64
|
onSuccess: (e, n) => {
|
|
76
65
|
e?.accessToken && (p({
|
|
77
66
|
accessToken: e.accessToken,
|
|
78
67
|
refreshToken: t(e.refreshToken)
|
|
79
|
-
}, { rememberMe: n.rememberMe }), f(!0), e.accountId && l(e.accountId), e.profileId ? (u(e.profileId), d(i.
|
|
68
|
+
}, { 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));
|
|
80
69
|
},
|
|
81
70
|
onError: (e) => {
|
|
82
71
|
D.showError(g(e, "[useSignup] error"));
|
|
@@ -175,7 +164,7 @@ var I = () => {
|
|
|
175
164
|
return O(() => t.ListProfiles(e, {
|
|
176
165
|
limit: 50,
|
|
177
166
|
offset: 0
|
|
178
|
-
}),
|
|
167
|
+
}), ee(n, e), void 0, { enabled: r && !!n });
|
|
179
168
|
}, G = () => {
|
|
180
169
|
let e = y();
|
|
181
170
|
return M({
|
|
@@ -184,14 +173,14 @@ var I = () => {
|
|
|
184
173
|
let e = a.getState().currentAccountId;
|
|
185
174
|
_.invalidateProfiles({
|
|
186
175
|
aID: e,
|
|
187
|
-
kind: i.
|
|
176
|
+
kind: i.COMMUNITY
|
|
188
177
|
});
|
|
189
178
|
},
|
|
190
179
|
onError: (e) => {
|
|
191
180
|
D.showError(g(e, "[useCreateForgerProfile] error"));
|
|
192
181
|
}
|
|
193
182
|
});
|
|
194
|
-
},
|
|
183
|
+
}, K = () => {
|
|
195
184
|
let e = y();
|
|
196
185
|
return M({
|
|
197
186
|
mutationFn: (t) => e.CreateAuthorityProfile(t),
|
|
@@ -206,7 +195,7 @@ var I = () => {
|
|
|
206
195
|
D.showError(g(e, "[useCreateAuthorityProfile] error"));
|
|
207
196
|
}
|
|
208
197
|
});
|
|
209
|
-
},
|
|
198
|
+
}, q = () => {
|
|
210
199
|
let e = y();
|
|
211
200
|
return M({
|
|
212
201
|
mutationFn: ({ kind: t, profileId: n }) => e.DeleteProfile(t, n),
|
|
@@ -221,7 +210,7 @@ var I = () => {
|
|
|
221
210
|
D.showError(g(e, "[useDeleteProfile] error"));
|
|
222
211
|
}
|
|
223
212
|
});
|
|
224
|
-
},
|
|
213
|
+
}, J = () => {
|
|
225
214
|
let e = y(), { kind: t } = N();
|
|
226
215
|
return M({
|
|
227
216
|
mutationFn: (n) => e.ConfirmProfileAvatar(t, n),
|
|
@@ -233,7 +222,7 @@ var I = () => {
|
|
|
233
222
|
D.showError(g(e, "[useConfirmProfileAvatar] error"));
|
|
234
223
|
}
|
|
235
224
|
});
|
|
236
|
-
},
|
|
225
|
+
}, te = () => {
|
|
237
226
|
let e = y(), { kind: t } = N(), { t: n } = j("hooks", { keyPrefix: "account" });
|
|
238
227
|
return M({
|
|
239
228
|
mutationFn: () => e.ClearProfileAvatar(t),
|
|
@@ -250,13 +239,13 @@ var I = () => {
|
|
|
250
239
|
return O(() => e.ListEmails({
|
|
251
240
|
limit: 50,
|
|
252
241
|
offset: 0
|
|
253
|
-
}),
|
|
242
|
+
}), b(t), void 0, { enabled: n && !!t });
|
|
254
243
|
}, X = () => {
|
|
255
244
|
let e = y(), { aID: t, isAuthValid: n } = N();
|
|
256
245
|
return O(() => e.ListPhones({
|
|
257
246
|
limit: 50,
|
|
258
247
|
offset: 0
|
|
259
|
-
}),
|
|
248
|
+
}), w(t), void 0, { enabled: n && !!t });
|
|
260
249
|
}, Z = () => {
|
|
261
250
|
let e = y(), t = a.getState().currentAccountId, { t: n } = j("hooks", { keyPrefix: "account" });
|
|
262
251
|
return M({
|
|
@@ -429,7 +418,7 @@ var I = () => {
|
|
|
429
418
|
query: e,
|
|
430
419
|
limit: 50,
|
|
431
420
|
offset: 0
|
|
432
|
-
}), T(n, i.
|
|
421
|
+
}), T(n, i.COMMUNITY, a), { query: a }, { enabled: r && !!n && a.length > 0 });
|
|
433
422
|
}, he = (e) => {
|
|
434
423
|
let t = y(), { aID: n, isAuthValid: r } = N(), a = e.trim();
|
|
435
424
|
return O(({ query: e }) => t.SearchAuthorityProfiles({
|
|
@@ -446,14 +435,14 @@ var I = () => {
|
|
|
446
435
|
limit: 50,
|
|
447
436
|
offset: 0,
|
|
448
437
|
query: e || void 0
|
|
449
|
-
}), [...
|
|
438
|
+
}), [...C(n), i], { query: i }, { enabled: r && !!n });
|
|
450
439
|
}, ve = (e = "") => {
|
|
451
440
|
let t = y(), { aID: n, isAuthValid: r } = N(), i = e.trim();
|
|
452
441
|
return O(({ query: e }) => t.ListOwnerAuthorityProfiles({
|
|
453
442
|
limit: 50,
|
|
454
443
|
offset: 0,
|
|
455
444
|
query: e || void 0
|
|
456
|
-
}), [...
|
|
445
|
+
}), [...S(n), i], { query: i }, { enabled: r && !!n });
|
|
457
446
|
}, ye = () => {
|
|
458
447
|
let e = y(), t = a.getState().currentAccountId, { t: n } = j("hooks", { keyPrefix: "account" });
|
|
459
448
|
return M({
|
|
@@ -467,6 +456,6 @@ var I = () => {
|
|
|
467
456
|
});
|
|
468
457
|
};
|
|
469
458
|
//#endregion
|
|
470
|
-
export { r as AuthSignupPlatformEnum, a as AuthStore, n as LanguageEnum, c as hasSelectedProfile, N as useAuthQueryScope, m as useAuthStore, se as useChangePassword,
|
|
459
|
+
export { r as AuthSignupPlatformEnum, a as AuthStore, n as LanguageEnum, c as hasSelectedProfile, N as useAuthQueryScope, m as useAuthStore, se as useChangePassword, te as useClearProfileAvatar, J as useConfirmProfileAvatar, ce as useConfirmProfileBackgrounds, K as useCreateAuthorityProfile, Z as useCreateEmail, G as useCreateForgerProfile, le as useCreatePhone, F as useCurrentProfile, ae as useDeleteEmail, $ as useDeletePhone, q 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 };
|
|
471
460
|
|
|
472
461
|
//# sourceMappingURL=auth.js.map
|