@authing/react-ui-components 4.0.0-rc.2 → 4.0.0-rc.5

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.
@@ -10,6 +10,15 @@
10
10
  http://jedwatson.github.io/classnames
11
11
  */
12
12
 
13
+ /**
14
+ * @license
15
+ * Lodash <https://lodash.com/>
16
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
17
+ * Released under MIT license <https://lodash.com/license>
18
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
19
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
20
+ */
21
+
13
22
  /** @license React v16.13.1
14
23
  * react-is.production.min.js
15
24
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authing/react-ui-components",
3
- "version": "4.0.0-rc.2",
3
+ "version": "4.0.0-rc.5",
4
4
  "private": false,
5
5
  "main": "lib/index.min.js",
6
6
  "typings": "types/index.d.ts",
@@ -15,6 +15,7 @@
15
15
  "fastclick": "^1.0.6",
16
16
  "global": "^4.4.0",
17
17
  "phone": "^3.1.12",
18
+ "prompt": "^1.3.0",
18
19
  "qs": "^6.9.4",
19
20
  "react-responsive": "^9.0.0-beta.5",
20
21
  "react-use": "^17.3.1",
@@ -27,8 +28,8 @@
27
28
  },
28
29
  "scripts": {
29
30
  "build": "node ./scripts/build.js",
30
- "build:types": "tsc",
31
- "build:lib": "clear && tsc && node ./scripts/lib.js",
31
+ "build:types": "npx tsc",
32
+ "build:lib": "clear && npm run build:types && node ./scripts/lib.js",
32
33
  "clear": "npm run clear:dist && npm run clear:lib && npm run clear:types",
33
34
  "clear:dist": "rm -rf dist",
34
35
  "clear:lib": "rm -rf lib",
@@ -42,7 +43,8 @@
42
43
  "start": "PORT=1221 node ./scripts/start.js",
43
44
  "vite": "vite",
44
45
  "generate-version": "node ./scripts/generate-version",
45
- "generate-examples": "node ./scripts/generate-examples.js"
46
+ "generate-examples": "node ./scripts/generate-examples.js",
47
+ "test": "node ./scripts/dev/pre-build.js"
46
48
  },
47
49
  "publishConfig": {
48
50
  "access": "public",
@@ -193,6 +195,7 @@
193
195
  "mini-css-extract-plugin": "0.11.3",
194
196
  "npm-dts-webpack-plugin": "^1.3.5",
195
197
  "optimize-css-assets-webpack-plugin": "5.0.4",
198
+ "ora": "^5.4.1",
196
199
  "pnp-webpack-plugin": "1.6.4",
197
200
  "postcss-flexbugs-fixes": "4.2.1",
198
201
  "postcss-loader": "3.0.0",
@@ -217,6 +220,7 @@
217
220
  "semver": "7.3.2",
218
221
  "shelljs": "^0.8.4",
219
222
  "shortid": "^2.2.16",
223
+ "signale": "^1.4.0",
220
224
  "style-loader": "1.3.0",
221
225
  "terser-webpack-plugin": "4.2.3",
222
226
  "ts-pnp": "1.2.0",
@@ -230,4 +234,4 @@
230
234
  "webpack-manifest-plugin": "2.2.0",
231
235
  "workbox-webpack-plugin": "5.1.4"
232
236
  }
233
- }
237
+ }
@@ -0,0 +1,320 @@
1
+ /**
2
+ * 整体的思路:
3
+ * 在所有登录方式中,当进行登录时保存登录方式(FE侧自定义)
4
+ * 之后在登录成功(onLogin)中,触发store的方法保存用户信息以及对应的登录方式进入localStorage。
5
+ * 当用户再次打开页面时,拿出数据进行对比。(主要对比 LoginWay ),TODO: 这里的代码主要显得乱的原因是因为枚举的不正当使用。(主要要和Server端进行互相映射,后续维护时可优化)
6
+ *
7
+ * 核心思路:登录成功时,保存的FE侧自定义 LoginWay
8
+ * 再次打开页面时,初始化时先根据 FE 自定义的 LoginWay 跳转到不同的 tab 下(way)下使用 account 进行回填。TODO: 这里也可优化,应该在登录成功时候就进行 LoginWay 的格式化,而非转来转去。(但是这样无法直观的体现是哪种方式进行登录)
9
+ */
10
+ import { SelectOptions } from '../../../Login/multipleAccounts/panel';
11
+ export declare const QR_CODE_WAY: LoginWay[];
12
+ /**
13
+ * 登录时所有支持的登录列表(前端定义列表)
14
+ * 这里稍微有点乱 因为Login中的登录方式和这里的不匹配,暂时放在了一起
15
+ */
16
+ export declare type LoginWay = 'email' | 'phone' | 'password' | 'phone-code' | 'email-code' | 'social' | 'wechat-miniprogram-qrcode' | 'wechatmp-qrcode' | 'app-qrcode' | 'ad' | 'ldap' | 'ldap-password' | 'ldap-email' | 'ldap-phone';
17
+ /**
18
+ * when: 多账号页面跳转进入登录页面
19
+ * 携带的回填数据信息
20
+ */
21
+ export interface BackFillMultipleState extends Omit<User, 'id' | 'name' | 'nickname' | 'username' | 'phone' | 'email' | 'photo' | '_updateTime'> {
22
+ /**
23
+ * 回填的账号名称 邮箱/用户名/手机
24
+ */
25
+ account: string;
26
+ }
27
+ /**
28
+ * Store instance
29
+ */
30
+ export declare type StoreInstance = ReturnType<MultipleAccount['getStore']>;
31
+ /**
32
+ * 当前 userId 对应的类型
33
+ */
34
+ export interface CurrentStore {
35
+ [id: string]: User;
36
+ }
37
+ export interface User {
38
+ /**
39
+ * userId
40
+ */
41
+ id: string;
42
+ /**
43
+ * Tab 栏状态
44
+ */
45
+ tab: 'input' | 'qrcode';
46
+ /**
47
+ * 登录方式
48
+ */
49
+ way: LoginWay;
50
+ /**
51
+ * 姓名
52
+ */
53
+ name?: string | null;
54
+ /**
55
+ * 昵称
56
+ */
57
+ nickname?: string | null;
58
+ /**
59
+ * 用户名
60
+ */
61
+ username?: string | null;
62
+ /**
63
+ * 手机号
64
+ */
65
+ phone?: string | null;
66
+ /**
67
+ * 邮箱
68
+ */
69
+ email?: string | null;
70
+ /**
71
+ * 头像
72
+ */
73
+ photo?: string | null;
74
+ /**
75
+ * qrCodeId 对应的ID
76
+ */
77
+ qrCodeId?: string;
78
+ /**
79
+ * 国际化短信区号
80
+ */
81
+ phoneCountryCode?: string;
82
+ /**
83
+ * 国际化短信选择框回填
84
+ */
85
+ areaCode?: string;
86
+ /**
87
+ * 登录时间
88
+ */
89
+ _updateTime?: string;
90
+ }
91
+ declare class MultipleAccount {
92
+ /**
93
+ * 原始的登录账号
94
+ */
95
+ private originAccount;
96
+ private originWay;
97
+ /**
98
+ * 原始的 localStore 值
99
+ */
100
+ private originStore;
101
+ /**
102
+ * 当前 AppId Store
103
+ */
104
+ private currentStore;
105
+ /**
106
+ * 单账号直接回填
107
+ */
108
+ private firstBackFillData?;
109
+ /**
110
+ * server 返回支持的登录方式
111
+ */
112
+ private serverSideLoginMethods;
113
+ /**
114
+ * 是否显示多账号登录页面
115
+ * true 存在
116
+ */
117
+ private memberState;
118
+ /**
119
+ * 二维码登录时的ID
120
+ */
121
+ private qrCodeId?;
122
+ /**
123
+ * 国际化短信前缀 区号
124
+ */
125
+ private phoneCountryCode?;
126
+ /**
127
+ * 国际化短信前缀 选中地区编号
128
+ */
129
+ private areaCode?;
130
+ private tabStatus?;
131
+ /**
132
+ * 当前登录二级状态
133
+ */
134
+ private loginWay?;
135
+ private appId;
136
+ /**
137
+ * 是否开启国际化短信
138
+ */
139
+ private isInternationSms?;
140
+ constructor();
141
+ /**
142
+ * 页面首次加载时初始化 Store
143
+ * 从 LocalStore 中拿值 放到这里来
144
+ */
145
+ private initStore;
146
+ /**
147
+ * 初始化记住账号相关信息
148
+ * @param normalCount
149
+ * @returns
150
+ */
151
+ private initMemberState;
152
+ /**
153
+ * 获取当前ID下有效账号个数
154
+ * @returns qrCount 有效的二维码登录个数 normalCount 有效的账号登录方式
155
+ */
156
+ private memberStateCount;
157
+ /**
158
+ * 初始化第一次的数据 TODO: 逻辑有点脏 待整理
159
+ */
160
+ private initBackfillData;
161
+ /**
162
+ * 根据前端存储的登录方式返回后端映射方式
163
+ * @param front
164
+ */
165
+ private getServerLoginMethodByFront;
166
+ /**
167
+ * 当前 Store DONE
168
+ */
169
+ private getCurrentStore;
170
+ /**
171
+ * 国际化短信过滤
172
+ * true 表示通过 需要保留
173
+ * false 表示不通过 需要过滤
174
+ */
175
+ private validateInternationSms;
176
+ /**
177
+ * 校验有效的登录方式账号
178
+ * @param user
179
+ * @param serverSideLoginMethods
180
+ * @returns
181
+ */
182
+ private validateMethod;
183
+ /**
184
+ *
185
+ * @param tab 一级Tab状态
186
+ * @param way 二级Tab状态
187
+ * @param id 二维码登录时 记录对应的二维码 ID
188
+ */
189
+ private setLoginWay;
190
+ /**
191
+ * 设置/更新 store 内的用户信息
192
+ */
193
+ private setUserInfo;
194
+ /**
195
+ * 持久化保存
196
+ */
197
+ private saveStore;
198
+ /**
199
+ * 根据登录的 account 判断本次登录的方式
200
+ * @param account 登录输入的账号
201
+ * @param param1 登录成功返回的相关信息 用户名/手机号/邮箱
202
+ * @returns
203
+ */
204
+ private setLoginWayByHttpData;
205
+ /**
206
+ * 根据登录的 account 判断本次LDAP登录方式
207
+ * @param account 登录输入的账号
208
+ * @param param1 登录成功返回的相关信息 用户名/手机号/邮箱
209
+ * @returns
210
+ */
211
+ private setLoginWayByLDAPData;
212
+ /**
213
+ * 根据用户 ID 删除 localStorage 中当前用户 ID
214
+ */
215
+ private delUserById;
216
+ /**
217
+ * 获得多账号登录页面的所有用户列表
218
+ * @param excludeWays
219
+ */
220
+ private getMemoUser;
221
+ /**
222
+ * 根据 id 获得当前已登录的用户信息
223
+ * @param userId
224
+ * @returns User / undefined
225
+ */
226
+ private getMemoSingleUser;
227
+ /**
228
+ * 该方法仅仅需要回填账号的登录方式,其他都不计入
229
+ * 当用户名/手机号/邮箱/AD/LDAP 相同时,根据登录顺序匹配不同的账号
230
+ * 根据记住的用户登录方式获取对应的登录账户名
231
+ * @param way
232
+ * @param user
233
+ * @returns
234
+ */
235
+ private getAccountByWay;
236
+ private _mappingUser;
237
+ /**
238
+ * 外部暴露方法
239
+ */
240
+ getStore: () => {
241
+ initStore: (appId: string, options: {
242
+ serverSideLoginMethods: LoginWay[];
243
+ isInternationSms: boolean;
244
+ }) => void;
245
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
246
+ phoneCountryCode: string;
247
+ areaCode: string;
248
+ } | undefined) => void;
249
+ setUserInfo: (user: Pick<User & {
250
+ id: string;
251
+ }, "email" | "username" | "phone" | "photo" | "id" | "name" | "nickname" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
252
+ setLoginWayByHttpData: (account: string, data: {
253
+ username?: string | undefined;
254
+ phone?: string | undefined;
255
+ email?: string | undefined;
256
+ }) => void;
257
+ setLoginWayByLDAPData: (account: string, data: {
258
+ name?: string | undefined;
259
+ phone?: string | undefined;
260
+ email?: string | undefined;
261
+ }) => void;
262
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
263
+ getMemoSingleUser: (id: string) => {
264
+ way: LoginWay;
265
+ account: string;
266
+ } | undefined;
267
+ delUserById: (id: string) => string;
268
+ getMemberState: () => boolean;
269
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
270
+ getOriginAccount: () => string;
271
+ getOriginWay: () => string;
272
+ };
273
+ }
274
+ /**
275
+ * MultipleAccounts 相关 Hook
276
+ * Finally Config 类型过滤
277
+ */
278
+ declare const useMultipleAccounts: ({ appId, finallyConfig }: {
279
+ appId?: string | undefined;
280
+ finallyConfig?: any;
281
+ }) => {
282
+ instance: {
283
+ initStore: (appId: string, options: {
284
+ serverSideLoginMethods: LoginWay[];
285
+ isInternationSms: boolean;
286
+ }) => void;
287
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
288
+ phoneCountryCode: string;
289
+ areaCode: string;
290
+ } | undefined) => void;
291
+ setUserInfo: (user: Pick<User & {
292
+ id: string;
293
+ }, "email" | "username" | "phone" | "photo" | "id" | "name" | "nickname" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
294
+ setLoginWayByHttpData: (account: string, data: {
295
+ username?: string | undefined;
296
+ phone?: string | undefined;
297
+ email?: string | undefined;
298
+ }) => void;
299
+ setLoginWayByLDAPData: (account: string, data: {
300
+ name?: string | undefined;
301
+ phone?: string | undefined;
302
+ email?: string | undefined;
303
+ }) => void;
304
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
305
+ getMemoSingleUser: (id: string) => {
306
+ way: LoginWay;
307
+ account: string;
308
+ } | undefined;
309
+ delUserById: (id: string) => string;
310
+ getMemberState: () => boolean;
311
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
312
+ getOriginAccount: () => string;
313
+ getOriginWay: () => string;
314
+ } | undefined;
315
+ isMultipleAccount: boolean;
316
+ referMultipleState: (type: 'login' | 'multiple', data?: BackFillMultipleState | undefined) => void;
317
+ multipleAccountData: BackFillMultipleState | undefined;
318
+ clearBackFillData: () => void;
319
+ };
320
+ export default useMultipleAccounts;
@@ -8,7 +8,39 @@ import { RegisterEvents } from '../Register/interface';
8
8
  export interface GuardEvents extends LoginEvents, RegisterEvents, CompleteInfoEvents, ForgetPasswordEvents, IdentityBindingEvents, IdentityBindingAskEvents {
9
9
  onBeforeChangeModule?: (key: GuardModuleType, initData?: any) => boolean | Promise<boolean>;
10
10
  }
11
- export declare const guardEventsFilter: (props: any, openEventsMapping?: boolean | undefined) => GuardEvents;
11
+ export declare const guardEventsFilter: (props: any, multipleInstance?: {
12
+ initStore: (appId: string, options: {
13
+ serverSideLoginMethods: import("./core/hooks/useMultipleAccounts").LoginWay[];
14
+ isInternationSms: boolean;
15
+ }) => void;
16
+ setLoginWay: (tab: "input" | "qrcode", way: import("./core/hooks/useMultipleAccounts").LoginWay, id?: string | undefined, internation?: {
17
+ phoneCountryCode: string;
18
+ areaCode: string;
19
+ } | undefined) => void;
20
+ setUserInfo: (user: Pick<import("./core/hooks/useMultipleAccounts").User & {
21
+ id: string;
22
+ }, "email" | "username" | "phone" | "photo" | "id" | "name" | "nickname" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
23
+ setLoginWayByHttpData: (account: string, data: {
24
+ username?: string | undefined;
25
+ phone?: string | undefined;
26
+ email?: string | undefined;
27
+ }) => void;
28
+ setLoginWayByLDAPData: (account: string, data: {
29
+ name?: string | undefined;
30
+ phone?: string | undefined;
31
+ email?: string | undefined;
32
+ }) => void;
33
+ getMemoUser: (excludeWays?: import("./core/hooks/useMultipleAccounts").LoginWay[]) => import("../Login/multipleAccounts/panel").SelectOptions[];
34
+ getMemoSingleUser: (id: string) => {
35
+ way: import("./core/hooks/useMultipleAccounts").LoginWay;
36
+ account: string;
37
+ } | undefined;
38
+ delUserById: (id: string) => string;
39
+ getMemberState: () => boolean;
40
+ getFirstBackFillData: () => import("./core/hooks/useMultipleAccounts").BackFillMultipleState | undefined;
41
+ getOriginAccount: () => string;
42
+ getOriginWay: () => string;
43
+ } | undefined, openEventsMapping?: boolean | undefined) => GuardEvents;
12
44
  export declare const guardEventsHijacking: (events: GuardEvents, openEventsMapping?: boolean | undefined) => GuardEvents;
13
45
  export declare const GuardEventsCamelToKebabMapping: {
14
46
  readonly onLoad: "load";
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { BackFillMultipleState, StoreInstance } from '../../Guard/core/hooks/useMultipleAccounts';
2
3
  import { Agreement } from '../../Type/application';
3
4
  interface LoginWithADProps {
4
5
  publicKey: string;
@@ -7,6 +8,14 @@ interface LoginWithADProps {
7
8
  onLoginFailed: any;
8
9
  onBeforeLogin: any;
9
10
  agreements: Agreement[];
11
+ /**
12
+ * 回填的数据
13
+ */
14
+ backfillData?: BackFillMultipleState;
15
+ /**
16
+ * 根据输入的账号 & 返回获得对应的登录方法
17
+ */
18
+ multipleInstance?: StoreInstance;
10
19
  }
11
20
  export declare const LoginWithAD: (props: LoginWithADProps) => JSX.Element;
12
21
  export {};
@@ -1,8 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { StoreInstance } from '../../Guard/core/hooks/useMultipleAccounts';
2
3
  interface LoginWithAppQrcodeProps {
3
4
  onLoginSuccess: any;
4
5
  canLoop: boolean;
5
6
  qrCodeScanOptions: any;
7
+ multipleInstance?: StoreInstance;
6
8
  }
7
9
  export declare const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element;
8
10
  export {};
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Agreement } from '../../Type/application';
3
+ import { BackFillMultipleState, StoreInstance } from '../../Guard/core/hooks/useMultipleAccounts';
3
4
  interface LoginWithLDAPProps {
4
5
  publicKey: string;
5
6
  autoRegister?: boolean;
@@ -8,6 +9,14 @@ interface LoginWithLDAPProps {
8
9
  onLoginFailed: any;
9
10
  onBeforeLogin: any;
10
11
  agreements: Agreement[];
12
+ /**
13
+ * 根据输入的账号 & 返回获得对应的登录方法
14
+ */
15
+ multipleInstance?: StoreInstance;
16
+ /**
17
+ * 多账号回填的数据
18
+ */
19
+ backfillData?: BackFillMultipleState;
11
20
  }
12
21
  export declare const LoginWithLDAP: (props: LoginWithLDAPProps) => JSX.Element;
13
22
  export {};
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { AuthingResponse } from '../../../_utils/http';
3
3
  import { Agreement, LoginMethods, PasswordLoginMethods } from '../../../Type/application';
4
+ import { BackFillMultipleState, StoreInstance } from '../../../Guard/core/hooks/useMultipleAccounts';
4
5
  interface LoginWithPasswordProps {
5
6
  publicKey: string;
6
7
  autoRegister?: boolean;
@@ -14,6 +15,14 @@ interface LoginWithPasswordProps {
14
15
  loginWay?: LoginMethods;
15
16
  submitButText?: string;
16
17
  saveIdentify?: (type: LoginMethods, identity: string) => void;
18
+ /**
19
+ * 根据输入的账号 & 返回获得对应的登录方法
20
+ */
21
+ multipleInstance?: StoreInstance;
22
+ /**
23
+ * 多账号回填的数据
24
+ */
25
+ backfillData?: BackFillMultipleState;
17
26
  }
18
27
  export declare const LoginWithPassword: (props: LoginWithPasswordProps) => JSX.Element;
19
28
  export {};
@@ -1,6 +1,10 @@
1
1
  import React, { FC } from 'react';
2
2
  import './styles.less';
3
3
  export interface VirtualDropdownProps {
4
+ /**
5
+ * 回填的国际化区号
6
+ */
7
+ regionCode?: string;
4
8
  value?: string;
5
9
  onChange?: (value: string) => void;
6
10
  style?: React.CSSProperties;
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import './styles.less';
3
- export declare const LoginWithVerifyCode: (props: any) => JSX.Element;
3
+ declare const LoginWithVerifyCode: (props: any) => JSX.Element;
4
+ export { LoginWithVerifyCode };
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import { StoreInstance } from '../../Guard/core/hooks/useMultipleAccounts';
2
3
  interface LoginWithWechatMiniQrcodeProps {
3
4
  onLoginSuccess: any;
4
5
  canLoop: boolean;
5
6
  qrCodeScanOptions: any;
7
+ id: string;
8
+ multipleInstance?: StoreInstance;
6
9
  }
7
10
  export declare const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element;
8
11
  export {};
@@ -1,8 +1,14 @@
1
1
  /// <reference types="react" />
2
+ import { StoreInstance } from '../../Guard/core/hooks/useMultipleAccounts';
2
3
  interface LoginWithWechatmpQrcodeProps {
3
4
  onLoginSuccess: any;
4
5
  canLoop: boolean;
5
6
  qrCodeScanOptions: any;
7
+ id: string;
8
+ /**
9
+ * 多账号存储实例
10
+ */
11
+ multipleInstance?: StoreInstance;
6
12
  }
7
13
  export declare const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element;
8
14
  export {};
@@ -0,0 +1,62 @@
1
+ /// <reference types="react" />
2
+ import { FormInstance } from 'antd/lib/form';
3
+ import { BackFillMultipleState, LoginWay } from '../../Guard/core/hooks/useMultipleAccounts';
4
+ /**
5
+ * 多账号登录下 账户 & 登录方式自动回填
6
+ * TODO: HOOK 参数有时间整理成为对象,开始没有想到有这么多
7
+ * 调用地方 core 中需要回填的两个登录方式
8
+ */
9
+ declare function useLoginMultipleBackFill(options: {
10
+ form: FormInstance<any>;
11
+ way: LoginWay;
12
+ formKey: string;
13
+ backfillData?: BackFillMultipleState;
14
+ isOnlyInternationSms?: boolean;
15
+ setAreaCode?: React.Dispatch<React.SetStateAction<string>>;
16
+ cancelBackfill?: boolean;
17
+ }): void;
18
+ /**
19
+ * 多账号统一状态管理
20
+ * @param setLoginWay
21
+ * @returns
22
+ */
23
+ declare function useLoginMultiple(setLoginWay: React.Dispatch<any>): {
24
+ isMultipleAccount: boolean;
25
+ multipleInstance: {
26
+ initStore: (appId: string, options: {
27
+ serverSideLoginMethods: LoginWay[];
28
+ isInternationSms: boolean;
29
+ }) => void;
30
+ setLoginWay: (tab: "input" | "qrcode", way: LoginWay, id?: string | undefined, internation?: {
31
+ phoneCountryCode: string;
32
+ areaCode: string;
33
+ } | undefined) => void;
34
+ setUserInfo: (user: Pick<import("../../Guard/core/hooks/useMultipleAccounts").User & {
35
+ id: string;
36
+ }, "email" | "username" | "phone" | "photo" | "id" | "name" | "nickname" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
37
+ setLoginWayByHttpData: (account: string, data: {
38
+ username?: string | undefined;
39
+ phone?: string | undefined;
40
+ email?: string | undefined;
41
+ }) => void;
42
+ setLoginWayByLDAPData: (account: string, data: {
43
+ name?: string | undefined;
44
+ phone?: string | undefined;
45
+ email?: string | undefined;
46
+ }) => void;
47
+ getMemoUser: (excludeWays?: LoginWay[]) => import("../multipleAccounts/panel").SelectOptions[];
48
+ getMemoSingleUser: (id: string) => {
49
+ way: LoginWay;
50
+ account: string;
51
+ } | undefined;
52
+ delUserById: (id: string) => string;
53
+ getMemberState: () => boolean;
54
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
55
+ getOriginAccount: () => string;
56
+ getOriginWay: () => string;
57
+ } | undefined;
58
+ referMultipleState: ((type: "login" | "multiple") => void) | undefined;
59
+ backfillData: BackFillMultipleState | undefined;
60
+ defaultQrWay: string | undefined;
61
+ };
62
+ export { useLoginMultipleBackFill, useLoginMultiple };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { LoginWay, StoreInstance } from '../../Guard/core/hooks/useMultipleAccounts';
3
+ import { GuardModuleType } from '../../Guard';
4
+ interface MultipleAccountsProps {
5
+ /**
6
+ * 多账号存储实例
7
+ */
8
+ multipleInstance?: StoreInstance;
9
+ /**
10
+ * 切换 Guard 方法
11
+ */
12
+ changeModule?: (moduleName: GuardModuleType, initData?: any) => Promise<void>;
13
+ /**
14
+ * 切换多账号状态
15
+ */
16
+ referMultipleState?: (type: 'login' | 'multiple', data?: {
17
+ account: string;
18
+ way: LoginWay;
19
+ }) => void;
20
+ }
21
+ declare const MultipleAccounts: React.NamedExoticComponent<MultipleAccountsProps>;
22
+ export { MultipleAccounts };