@authing/react-ui-components 3.1.36-rc.0 → 3.1.37-beta.1

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/lib/index.d.ts CHANGED
@@ -1575,6 +1575,293 @@ declare module '@authing/react-ui-components/components/Guard/config' {
1575
1575
  }
1576
1576
  export const getDefaultGuardLocalConfig: () => GuardLocalConfig;
1577
1577
 
1578
+ }
1579
+ declare module '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts' {
1580
+ import { SelectOptions } from '@authing/react-ui-components/components/Login/multipleAccounts/panel';
1581
+ export const QR_CODE_WAY: LoginWay[];
1582
+ /**
1583
+ * 登录时所有支持的登录列表(前端定义列表)
1584
+ */
1585
+ export type LoginWay = 'email' | 'phone' | 'password' | 'phone-code' | 'email-code' | 'social' | 'wechat-miniprogram-qrcode' | 'wechatmp-qrcode' | 'app-qrcode' | 'ad' | 'ldap';
1586
+ /**
1587
+ * when: 多账号页面跳转进入登录页面
1588
+ * 携带的回填数据信息
1589
+ */
1590
+ export interface BackFillMultipleState extends Omit<User, 'id' | 'name' | 'nickname' | 'username' | 'phone' | 'email' | 'photo' | '_updateTime'> {
1591
+ /**
1592
+ * 回填的账号名称 邮箱/用户名/手机
1593
+ */
1594
+ account: string;
1595
+ }
1596
+ /**
1597
+ * Store instance
1598
+ */
1599
+ export type StoreInstance = ReturnType<MultipleAccount['getStore']>;
1600
+ /**
1601
+ * 当前 userId 对应的类型
1602
+ */
1603
+ export interface CurrentStore {
1604
+ [id: string]: User;
1605
+ }
1606
+ export interface User {
1607
+ /**
1608
+ * userId
1609
+ */
1610
+ id: string;
1611
+ /**
1612
+ * Tab 栏状态
1613
+ */
1614
+ tab: 'input' | 'qrcode';
1615
+ /**
1616
+ * 登录方式
1617
+ */
1618
+ way: LoginWay;
1619
+ /**
1620
+ * 姓名
1621
+ */
1622
+ name?: string | null;
1623
+ /**
1624
+ * 昵称
1625
+ */
1626
+ nickname?: string | null;
1627
+ /**
1628
+ * 用户名
1629
+ */
1630
+ username?: string | null;
1631
+ /**
1632
+ * 手机号
1633
+ */
1634
+ phone?: string | null;
1635
+ /**
1636
+ * 邮箱
1637
+ */
1638
+ email?: string | null;
1639
+ /**
1640
+ * 头像
1641
+ */
1642
+ photo?: string | null;
1643
+ /**
1644
+ * qrCodeId 对应的ID
1645
+ */
1646
+ qrCodeId?: string;
1647
+ /**
1648
+ * 国际化短信区号
1649
+ */
1650
+ phoneCountryCode?: string;
1651
+ /**
1652
+ * 国际化短信选择框回填
1653
+ */
1654
+ areaCode?: string;
1655
+ /**
1656
+ * 登录时间
1657
+ */
1658
+ _updateTime?: string;
1659
+ }
1660
+ class MultipleAccount {
1661
+ /**
1662
+ * 原始的 localStore 值
1663
+ */
1664
+ private originStore;
1665
+ /**
1666
+ * 当前 AppId Store
1667
+ */
1668
+ private currentStore;
1669
+ /**
1670
+ * 单账号直接回填
1671
+ */
1672
+ private firstBackFillData?;
1673
+ /**
1674
+ * server 返回支持的登录方式
1675
+ */
1676
+ private serverSideLoginMethods;
1677
+ /**
1678
+ * 是否显示多账号登录页面
1679
+ * true 存在
1680
+ */
1681
+ private memberState;
1682
+ /**
1683
+ * 二维码登录时的ID
1684
+ */
1685
+ private qrCodeId?;
1686
+ /**
1687
+ * 国际化短信前缀 区号
1688
+ */
1689
+ private phoneCountryCode?;
1690
+ /**
1691
+ * 国际化短信前缀 选中地区编号
1692
+ */
1693
+ private areaCode?;
1694
+ private tabStatus?;
1695
+ /**
1696
+ * 当前登录二级状态
1697
+ */
1698
+ private loginWay?;
1699
+ private appId;
1700
+ /**
1701
+ * 是否开启国际化短信
1702
+ */
1703
+ private isInternationSms?;
1704
+ constructor();
1705
+ /**
1706
+ * 页面首次加载时初始化 Store
1707
+ * 从 LocalStore 中拿值 放到这里来
1708
+ */
1709
+ private initStore;
1710
+ /**
1711
+ * 初始化记住账号相关信息
1712
+ * @param normalCount
1713
+ * @returns
1714
+ */
1715
+ private initMemberState;
1716
+ /**
1717
+ * 获取当前ID下有效账号个数
1718
+ * @returns qrCount 有效的二维码登录个数 normalCount 有效的账号登录方式
1719
+ */
1720
+ private memberStateCount;
1721
+ /**
1722
+ * 初始化第一次的数据 TODO: 逻辑有点脏 待整理
1723
+ */
1724
+ private initBackfillData;
1725
+ /**
1726
+ * 根据前端存储的登录方式返回后端映射方式
1727
+ * @param front
1728
+ */
1729
+ private getServerLoginMethodByFront;
1730
+ /**
1731
+ * 当前 Store DONE
1732
+ */
1733
+ private getCurrentStore;
1734
+ /**
1735
+ * 国际化短信过滤
1736
+ * true 表示通过 需要保留
1737
+ * false 表示不通过 需要过滤
1738
+ */
1739
+ private validateInternationSms;
1740
+ /**
1741
+ * 校验有效的登录方式账号
1742
+ * @param user
1743
+ * @param serverSideLoginMethods
1744
+ * @returns
1745
+ */
1746
+ private validateMethod;
1747
+ /**
1748
+ *
1749
+ * @param tab 一级Tab状态
1750
+ * @param way 二级Tab状态
1751
+ * @param id 二维码登录时 记录对应的二维码 ID
1752
+ */
1753
+ private setLoginWay;
1754
+ /**
1755
+ * 设置/更新 store 内的用户信息
1756
+ */
1757
+ private setUserInfo;
1758
+ /**
1759
+ * 持久化保存
1760
+ */
1761
+ private saveStore;
1762
+ /**
1763
+ * 根据登录的 account 判断本次登录的方式
1764
+ * @param account 登录输入的账号
1765
+ * @param param1 登录成功返回的相关信息 用户名/手机号/邮箱
1766
+ * @returns
1767
+ */
1768
+ private setLoginWayByHttpData;
1769
+ /**
1770
+ * 根据用户 ID 删除 localStorage 中当前用户 ID
1771
+ */
1772
+ private delUserById;
1773
+ /**
1774
+ * 获得多账号登录页面的所有用户列表
1775
+ * @param excludeWays
1776
+ */
1777
+ private getMemoUser;
1778
+ /**
1779
+ * 根据 id 获得当前已登录的用户信息
1780
+ * @param userId
1781
+ * @returns User / undefined
1782
+ */
1783
+ private getMemoSingleUser;
1784
+ /**
1785
+ * 该方法仅仅需要回填账号的登录方式,其他都不计入
1786
+ * 当用户名/手机号/邮箱/AD/LDAP 相同时,根据登录顺序匹配不同的账号
1787
+ * 根据记住的用户登录方式获取对应的登录账户名
1788
+ * @param way
1789
+ * @param user
1790
+ * @returns
1791
+ */
1792
+ private getAccountByWay;
1793
+ private _mappingUser;
1794
+ /**
1795
+ * 外部暴露方法
1796
+ */
1797
+ getStore: () => {
1798
+ initStore: (appId: string, options: {
1799
+ serverSideLoginMethods: LoginWay[];
1800
+ isInternationSms: boolean;
1801
+ }) => void;
1802
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
1803
+ phoneCountryCode: string;
1804
+ areaCode: string;
1805
+ } | undefined) => void;
1806
+ setUserInfo: (user: Pick<User & {
1807
+ id: string;
1808
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1809
+ setLoginWayByHttpData: (account: string, data: {
1810
+ username?: string | undefined;
1811
+ phone?: string | undefined;
1812
+ email?: string | undefined;
1813
+ }) => void;
1814
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
1815
+ getMemoSingleUser: (id: string) => {
1816
+ way: LoginWay;
1817
+ account: string;
1818
+ } | undefined;
1819
+ delUserById: (id: string) => string;
1820
+ getMemberState: () => boolean;
1821
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
1822
+ };
1823
+ }
1824
+ /**
1825
+ * MultipleAccounts 相关 Hook
1826
+ * Finally Config 类型过滤
1827
+ */
1828
+ const useMultipleAccounts: ({ appId, finallyConfig }: {
1829
+ appId?: string | undefined;
1830
+ finallyConfig?: any;
1831
+ }) => {
1832
+ instance: {
1833
+ initStore: (appId: string, options: {
1834
+ serverSideLoginMethods: LoginWay[];
1835
+ isInternationSms: boolean;
1836
+ }) => void;
1837
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
1838
+ phoneCountryCode: string;
1839
+ areaCode: string;
1840
+ } | undefined) => void;
1841
+ setUserInfo: (user: Pick<User & {
1842
+ id: string;
1843
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1844
+ setLoginWayByHttpData: (account: string, data: {
1845
+ username?: string | undefined;
1846
+ phone?: string | undefined;
1847
+ email?: string | undefined;
1848
+ }) => void;
1849
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
1850
+ getMemoSingleUser: (id: string) => {
1851
+ way: LoginWay;
1852
+ account: string;
1853
+ } | undefined;
1854
+ delUserById: (id: string) => string;
1855
+ getMemberState: () => boolean;
1856
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
1857
+ } | undefined;
1858
+ isMultipleAccount: boolean;
1859
+ referMultipleState: (type: 'login' | 'multiple', data?: BackFillMultipleState | undefined) => void;
1860
+ multipleAccountData: BackFillMultipleState | undefined;
1861
+ clearBackFillData: () => void;
1862
+ };
1863
+ export default useMultipleAccounts;
1864
+
1578
1865
  }
1579
1866
  declare module '@authing/react-ui-components/components/Guard/core/index' {
1580
1867
  /// <reference types="react" />
@@ -1634,7 +1921,32 @@ declare module '@authing/react-ui-components/components/Guard/event' {
1634
1921
  export interface GuardEvents extends LoginEvents, RegisterEvents, CompleteInfoEvents, ForgetPasswordEvents, IdentityBindingEvents, IdentityBindingAskEvents {
1635
1922
  onBeforeChangeModule?: (key: GuardModuleType, initData?: any) => boolean | Promise<boolean>;
1636
1923
  }
1637
- export const guardEventsFilter: (props: any, openEventsMapping?: boolean | undefined) => GuardEvents;
1924
+ export const guardEventsFilter: (props: any, multipleInstance?: {
1925
+ initStore: (appId: string, options: {
1926
+ serverSideLoginMethods: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[];
1927
+ isInternationSms: boolean;
1928
+ }) => void;
1929
+ setLoginWay: (tab: "input" | "qrcode", way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay, id?: string | undefined, internation?: {
1930
+ phoneCountryCode: string;
1931
+ areaCode: string;
1932
+ } | undefined) => void;
1933
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
1934
+ id: string;
1935
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1936
+ setLoginWayByHttpData: (account: string, data: {
1937
+ username?: string | undefined;
1938
+ phone?: string | undefined;
1939
+ email?: string | undefined;
1940
+ }) => void;
1941
+ getMemoUser: (excludeWays?: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[]) => import("../Login/multipleAccounts/panel").SelectOptions[];
1942
+ getMemoSingleUser: (id: string) => {
1943
+ way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay;
1944
+ account: string;
1945
+ } | undefined;
1946
+ delUserById: (id: string) => string;
1947
+ getMemberState: () => boolean;
1948
+ getFirstBackFillData: () => import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").BackFillMultipleState | undefined;
1949
+ } | undefined, openEventsMapping?: boolean | undefined) => GuardEvents;
1638
1950
  export const guardEventsHijacking: (events: GuardEvents, openEventsMapping?: boolean | undefined) => GuardEvents;
1639
1951
  export const GuardEventsCamelToKebabMapping: {
1640
1952
  readonly onLoad: "load";
@@ -1926,6 +2238,7 @@ declare module '@authing/react-ui-components/components/Login/codemap' {
1926
2238
  declare module '@authing/react-ui-components/components/Login/core/withAD' {
1927
2239
  /// <reference types="react" />
1928
2240
  import { Agreement } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2241
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1929
2242
  interface LoginWithADProps {
1930
2243
  publicKey: string;
1931
2244
  autoRegister?: boolean;
@@ -1933,6 +2246,14 @@ declare module '@authing/react-ui-components/components/Login/core/withAD' {
1933
2246
  onLoginFailed: any;
1934
2247
  onBeforeLogin: any;
1935
2248
  agreements: Agreement[];
2249
+ /**
2250
+ * 回填的数据
2251
+ */
2252
+ backfillData?: BackFillMultipleState;
2253
+ /**
2254
+ * 根据输入的账号 & 返回获得对应的登录方法
2255
+ */
2256
+ multipleInstance?: StoreInstance;
1936
2257
  }
1937
2258
  export const LoginWithAD: (props: LoginWithADProps) => JSX.Element;
1938
2259
  export {};
@@ -1940,10 +2261,12 @@ declare module '@authing/react-ui-components/components/Login/core/withAD' {
1940
2261
  }
1941
2262
  declare module '@authing/react-ui-components/components/Login/core/withAppQrcode' {
1942
2263
  /// <reference types="react" />
2264
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1943
2265
  interface LoginWithAppQrcodeProps {
1944
2266
  onLoginSuccess: any;
1945
2267
  canLoop: boolean;
1946
2268
  qrCodeScanOptions: any;
2269
+ multipleInstance?: StoreInstance;
1947
2270
  }
1948
2271
  export const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element;
1949
2272
  export {};
@@ -1952,6 +2275,7 @@ declare module '@authing/react-ui-components/components/Login/core/withAppQrcode
1952
2275
  declare module '@authing/react-ui-components/components/Login/core/withLDAP' {
1953
2276
  /// <reference types="react" />
1954
2277
  import { Agreement } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2278
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1955
2279
  interface LoginWithLDAPProps {
1956
2280
  publicKey: string;
1957
2281
  autoRegister?: boolean;
@@ -1960,6 +2284,14 @@ declare module '@authing/react-ui-components/components/Login/core/withLDAP' {
1960
2284
  onLoginFailed: any;
1961
2285
  onBeforeLogin: any;
1962
2286
  agreements: Agreement[];
2287
+ /**
2288
+ * 根据输入的账号 & 返回获得对应的登录方法
2289
+ */
2290
+ multipleInstance?: StoreInstance;
2291
+ /**
2292
+ * 多账号回填的数据
2293
+ */
2294
+ backfillData?: BackFillMultipleState;
1963
2295
  }
1964
2296
  export const LoginWithLDAP: (props: LoginWithLDAPProps) => JSX.Element;
1965
2297
  export {};
@@ -2000,6 +2332,7 @@ declare module '@authing/react-ui-components/components/Login/core/withPassword/
2000
2332
  import { Agreement, PasswordLoginMethods } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2001
2333
  import { LoginMethods } from '@authing/react-ui-components/components/index';
2002
2334
  import { AuthingResponse } from '@authing/react-ui-components/components/_utils/http';
2335
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2003
2336
  interface LoginWithPasswordProps {
2004
2337
  publicKey: string;
2005
2338
  autoRegister?: boolean;
@@ -2013,6 +2346,14 @@ declare module '@authing/react-ui-components/components/Login/core/withPassword/
2013
2346
  loginWay?: LoginMethods;
2014
2347
  submitButText?: string;
2015
2348
  saveIdentify?: (type: LoginMethods, identity: string) => void;
2349
+ /**
2350
+ * 根据输入的账号 & 返回获得对应的登录方法
2351
+ */
2352
+ multipleInstance?: StoreInstance;
2353
+ /**
2354
+ * 多账号回填的数据
2355
+ */
2356
+ backfillData?: BackFillMultipleState;
2016
2357
  }
2017
2358
  export const LoginWithPassword: (props: LoginWithPasswordProps) => JSX.Element;
2018
2359
  export {};
@@ -2046,6 +2387,10 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2046
2387
  import React, { FC } from 'react';
2047
2388
  import './styles.less';
2048
2389
  export interface VirtualDropdownProps {
2390
+ /**
2391
+ * 回填的国际化区号
2392
+ */
2393
+ regionCode?: string;
2049
2394
  value?: string;
2050
2395
  onChange?: (value: string) => void;
2051
2396
  style?: React.CSSProperties;
@@ -2056,7 +2401,8 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2056
2401
  declare module '@authing/react-ui-components/components/Login/core/withVerifyCode/index' {
2057
2402
  /// <reference types="react" />
2058
2403
  import './styles.less';
2059
- export const LoginWithVerifyCode: (props: any) => JSX.Element;
2404
+ const LoginWithVerifyCode: (props: any) => JSX.Element;
2405
+ export { LoginWithVerifyCode };
2060
2406
 
2061
2407
  }
2062
2408
  declare module '@authing/react-ui-components/components/Login/core/withVerifyCode/inputIdentify' {
@@ -2071,10 +2417,13 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2071
2417
  }
2072
2418
  declare module '@authing/react-ui-components/components/Login/core/withWechatMiniQrcode' {
2073
2419
  /// <reference types="react" />
2420
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2074
2421
  interface LoginWithWechatMiniQrcodeProps {
2075
2422
  onLoginSuccess: any;
2076
2423
  canLoop: boolean;
2077
2424
  qrCodeScanOptions: any;
2425
+ id: string;
2426
+ multipleInstance?: StoreInstance;
2078
2427
  }
2079
2428
  export const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element;
2080
2429
  export {};
@@ -2082,14 +2431,78 @@ declare module '@authing/react-ui-components/components/Login/core/withWechatMin
2082
2431
  }
2083
2432
  declare module '@authing/react-ui-components/components/Login/core/withWechatmpQrcode' {
2084
2433
  /// <reference types="react" />
2434
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2085
2435
  interface LoginWithWechatmpQrcodeProps {
2086
2436
  onLoginSuccess: any;
2087
2437
  canLoop: boolean;
2088
2438
  qrCodeScanOptions: any;
2439
+ id: string;
2440
+ /**
2441
+ * 多账号存储实例
2442
+ */
2443
+ multipleInstance?: StoreInstance;
2089
2444
  }
2090
2445
  export const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element;
2091
2446
  export {};
2092
2447
 
2448
+ }
2449
+ declare module '@authing/react-ui-components/components/Login/hooks/useLoginMultiple' {
2450
+ /// <reference types="react" />
2451
+ import { FormInstance } from 'antd/lib/form';
2452
+ import { BackFillMultipleState, LoginWay } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2453
+ /**
2454
+ * 多账号登录下 账户 & 登录方式自动回填
2455
+ * TODO: HOOK 参数有时间整理成为对象,开始没有想到有这么多
2456
+ * 调用地方 core 中需要回填的两个登录方式
2457
+ */
2458
+ function useLoginMultipleBackFill(options: {
2459
+ form: FormInstance<any>;
2460
+ way: LoginWay;
2461
+ formKey: string;
2462
+ backfillData?: BackFillMultipleState;
2463
+ isOnlyInternationSms?: boolean;
2464
+ setAreaCode?: React.Dispatch<React.SetStateAction<string>>;
2465
+ cancelBackfill?: boolean;
2466
+ }): void;
2467
+ /**
2468
+ * 多账号统一状态管理
2469
+ * @param setLoginWay
2470
+ * @returns
2471
+ */
2472
+ function useLoginMultiple(setLoginWay: React.Dispatch<any>): {
2473
+ isMultipleAccount: boolean;
2474
+ multipleInstance: {
2475
+ initStore: (appId: string, options: {
2476
+ serverSideLoginMethods: LoginWay[];
2477
+ isInternationSms: boolean;
2478
+ }) => void;
2479
+ setLoginWay: (tab: "input" | "qrcode", way: LoginWay, id?: string | undefined, internation?: {
2480
+ phoneCountryCode: string;
2481
+ areaCode: string;
2482
+ } | undefined) => void;
2483
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
2484
+ id: string;
2485
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
2486
+ setLoginWayByHttpData: (account: string, data: {
2487
+ username?: string | undefined;
2488
+ phone?: string | undefined;
2489
+ email?: string | undefined;
2490
+ }) => void;
2491
+ getMemoUser: (excludeWays?: LoginWay[]) => import("@authing/react-ui-components/components/Login/multipleAccounts/panel").SelectOptions[];
2492
+ getMemoSingleUser: (id: string) => {
2493
+ way: LoginWay;
2494
+ account: string;
2495
+ } | undefined;
2496
+ delUserById: (id: string) => string;
2497
+ getMemberState: () => boolean;
2498
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
2499
+ } | undefined;
2500
+ referMultipleState: ((type: "login" | "multiple") => void) | undefined;
2501
+ backfillData: BackFillMultipleState | undefined;
2502
+ defaultQrWay: string | undefined;
2503
+ };
2504
+ export { useLoginMultipleBackFill, useLoginMultiple };
2505
+
2093
2506
  }
2094
2507
  declare module '@authing/react-ui-components/components/Login/index' {
2095
2508
  /// <reference types="react" />
@@ -2138,6 +2551,79 @@ declare module '@authing/react-ui-components/components/Login/interface' {
2138
2551
  }
2139
2552
  export const getDefaultLoginConfig: () => LoginConfig;
2140
2553
 
2554
+ }
2555
+ declare module '@authing/react-ui-components/components/Login/multipleAccounts/index' {
2556
+ import React from 'react';
2557
+ import { LoginWay, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2558
+ import { GuardModuleType } from '@authing/react-ui-components/components/Guard/index';
2559
+ interface MultipleAccountsProps {
2560
+ /**
2561
+ * 多账号存储实例
2562
+ */
2563
+ multipleInstance?: StoreInstance;
2564
+ /**
2565
+ * 切换 Guard 方法
2566
+ */
2567
+ changeModule?: (moduleName: GuardModuleType, initData?: any) => Promise<void>;
2568
+ /**
2569
+ * 切换多账号状态
2570
+ */
2571
+ referMultipleState?: (type: 'login' | 'multiple', data?: {
2572
+ account: string;
2573
+ way: LoginWay;
2574
+ }) => void;
2575
+ }
2576
+ const MultipleAccounts: React.NamedExoticComponent<MultipleAccountsProps>;
2577
+ export { MultipleAccounts };
2578
+
2579
+ }
2580
+ declare module '@authing/react-ui-components/components/Login/multipleAccounts/panel' {
2581
+ import React from 'react';
2582
+ import './style.less';
2583
+ interface SelectPanelProps {
2584
+ lists: SelectOptions[];
2585
+ /**
2586
+ * 点击删除
2587
+ */
2588
+ handleDel: (id: string) => void;
2589
+ /**
2590
+ * 点击 li
2591
+ */
2592
+ onClick: (id: string) => void;
2593
+ }
2594
+ export interface SelectOptions {
2595
+ /**
2596
+ * 头像
2597
+ */
2598
+ photo?: string;
2599
+ /**
2600
+ * 标题
2601
+ */
2602
+ title?: string;
2603
+ /**
2604
+ * 描述
2605
+ */
2606
+ description?: string;
2607
+ /**
2608
+ * 用户 ID 唯一标识符
2609
+ */
2610
+ id: string | 'other';
2611
+ /**
2612
+ * 显示操作栏 default: true
2613
+ */
2614
+ operation?: boolean;
2615
+ /**
2616
+ * 登录时间
2617
+ */
2618
+ _updateTime: number;
2619
+ /**
2620
+ * 替代图片元素
2621
+ */
2622
+ element?: React.ReactElement;
2623
+ }
2624
+ const SelectPanel: React.FC<SelectPanelProps>;
2625
+ export { SelectPanel };
2626
+
2141
2627
  }
2142
2628
  declare module '@authing/react-ui-components/components/Login/socialLogin/IdpButton/index' {
2143
2629
  /// <reference types="react" />
@@ -2149,6 +2635,7 @@ declare module '@authing/react-ui-components/components/Login/socialLogin/index'
2149
2635
  import { ApplicationConfig, SocialConnectionItem } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2150
2636
  import './style.less';
2151
2637
  import { GuardLocalConfig } from '@authing/react-ui-components/components/Guard/index';
2638
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2152
2639
  export interface SocialLoginProps {
2153
2640
  appId: string;
2154
2641
  config: GuardLocalConfig;
@@ -2156,6 +2643,10 @@ declare module '@authing/react-ui-components/components/Login/socialLogin/index'
2156
2643
  onLoginSuccess: any;
2157
2644
  enterpriseConnectionObjs: ApplicationConfig['identityProviders'];
2158
2645
  socialConnectionObjs: SocialConnectionItem[];
2646
+ /**
2647
+ * 根据输入的账号 & 返回获得对应的登录方法
2648
+ */
2649
+ multipleInstance?: StoreInstance;
2159
2650
  }
2160
2651
  export const SocialLogin: React.FC<SocialLoginProps>;
2161
2652
 
@@ -3021,6 +3512,7 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3021
3512
  import React from 'react';
3022
3513
  import { GuardEvents, GuardLocalConfig, GuardModuleType, GuardPageConfig } from '@authing/react-ui-components/components/index';
3023
3514
  import { ApplicationConfig } from '@authing/react-ui-components/components/AuthingGuard/api/index';
3515
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
3024
3516
  import { ModuleState } from '@authing/react-ui-components/components/Guard/GuardModule/stateMachine';
3025
3517
  import { GuardHttp } from '@authing/react-ui-components/components/_utils/guardHttp';
3026
3518
  export interface IGuardContext {
@@ -3038,6 +3530,29 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3038
3530
  isAuthFlow: boolean;
3039
3531
  contextLoaded: boolean;
3040
3532
  guardPageConfig: Partial<GuardPageConfig>;
3533
+ multipleInstance: {
3534
+ /**
3535
+ * 多账号相关
3536
+ */
3537
+ isMultipleAccount: boolean;
3538
+ /**
3539
+ * when: 多账号页面跳转进入登录页面
3540
+ * 携带的回填数据信息
3541
+ */
3542
+ multipleAccountData?: BackFillMultipleState;
3543
+ /**
3544
+ * 多账号 store 实例
3545
+ */
3546
+ instance?: StoreInstance;
3547
+ /**
3548
+ * 切换多账号 isMultipleAccount 状态
3549
+ */
3550
+ referMultipleState?: (type: 'login' | 'multiple') => void;
3551
+ /**
3552
+ * 清空回填数据
3553
+ */
3554
+ clearBackFillData?: () => void;
3555
+ };
3041
3556
  }
3042
3557
  export const createGuardXContext: () => {
3043
3558
  Provider: React.FC<{
@@ -3075,6 +3590,57 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3075
3590
  export const useGuardContextLoaded: () => boolean;
3076
3591
  export const useGuardIsAuthFlow: () => boolean;
3077
3592
  export const useGuardPageConfig: () => Partial<GuardPageConfig>;
3593
+ /**
3594
+ * 多账号登录 store 实例
3595
+ */
3596
+ export const useGuardMultipleInstance: () => {
3597
+ /**
3598
+ * 多账号相关
3599
+ */
3600
+ isMultipleAccount: boolean;
3601
+ /**
3602
+ * when: 多账号页面跳转进入登录页面
3603
+ * 携带的回填数据信息
3604
+ */
3605
+ multipleAccountData?: BackFillMultipleState | undefined;
3606
+ /**
3607
+ * 多账号 store 实例
3608
+ */
3609
+ instance?: {
3610
+ initStore: (appId: string, options: {
3611
+ serverSideLoginMethods: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[];
3612
+ isInternationSms: boolean;
3613
+ }) => void;
3614
+ setLoginWay: (tab: "input" | "qrcode", way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay, id?: string | undefined, internation?: {
3615
+ phoneCountryCode: string;
3616
+ areaCode: string;
3617
+ } | undefined) => void;
3618
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
3619
+ id: string;
3620
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
3621
+ setLoginWayByHttpData: (account: string, data: {
3622
+ username?: string | undefined;
3623
+ phone?: string | undefined;
3624
+ email?: string | undefined;
3625
+ }) => void;
3626
+ getMemoUser: (excludeWays?: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[]) => import("../Login/multipleAccounts/panel").SelectOptions[];
3627
+ getMemoSingleUser: (id: string) => {
3628
+ way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay;
3629
+ account: string;
3630
+ } | undefined;
3631
+ delUserById: (id: string) => string;
3632
+ getMemberState: () => boolean;
3633
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
3634
+ } | undefined;
3635
+ /**
3636
+ * 切换多账号 isMultipleAccount 状态
3637
+ */
3638
+ referMultipleState?: ((type: 'login' | 'multiple') => void) | undefined;
3639
+ /**
3640
+ * 清空回填数据
3641
+ */
3642
+ clearBackFillData?: (() => void) | undefined;
3643
+ };
3078
3644
 
3079
3645
  }
3080
3646
  declare module '@authing/react-ui-components/components/_utils/corsVerification' {
@@ -3543,7 +4109,7 @@ declare module '@authing/react-ui-components/components/version/index' {
3543
4109
 
3544
4110
  }
3545
4111
  declare module '@authing/react-ui-components/components/version/version' {
3546
- const _default: "3.1.36-rc.0";
4112
+ const _default: "3.1.37-beta.1";
3547
4113
  export default _default;
3548
4114
 
3549
4115
  }