@authing/react-ui-components 3.1.37 → 3.1.39

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,329 @@ 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
+ /**
1581
+ * 整体的思路:
1582
+ * 在所有登录方式中,当进行登录时保存登录方式(FE侧自定义)
1583
+ * 之后在登录成功(onLogin)中,触发store的方法保存用户信息以及对应的登录方式进入localStorage。
1584
+ * 当用户再次打开页面时,拿出数据进行对比。(主要对比 LoginWay ),TODO: 这里的代码主要显得乱的原因是因为枚举的不正当使用。(主要要和Server端进行互相映射,后续维护时可优化)
1585
+ *
1586
+ * 核心思路:登录成功时,保存的FE侧自定义 LoginWay
1587
+ * 再次打开页面时,初始化时先根据 FE 自定义的 LoginWay 跳转到不同的 tab 下(way)下使用 account 进行回填。TODO: 这里也可优化,应该在登录成功时候就进行 LoginWay 的格式化,而非转来转去。(但是这样无法直观的体现是哪种方式进行登录)
1588
+ */
1589
+ import { SelectOptions } from '@authing/react-ui-components/components/Login/multipleAccounts/panel';
1590
+ export const QR_CODE_WAY: LoginWay[];
1591
+ /**
1592
+ * 登录时所有支持的登录列表(前端定义列表)
1593
+ * 这里稍微有点乱 因为Login中的登录方式和这里的不匹配,暂时放在了一起
1594
+ */
1595
+ export 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';
1596
+ /**
1597
+ * when: 多账号页面跳转进入登录页面
1598
+ * 携带的回填数据信息
1599
+ */
1600
+ export interface BackFillMultipleState extends Omit<User, 'id' | 'name' | 'nickname' | 'username' | 'phone' | 'email' | 'photo' | '_updateTime'> {
1601
+ /**
1602
+ * 回填的账号名称 邮箱/用户名/手机
1603
+ */
1604
+ account: string;
1605
+ }
1606
+ /**
1607
+ * Store instance
1608
+ */
1609
+ export type StoreInstance = ReturnType<MultipleAccount['getStore']>;
1610
+ /**
1611
+ * 当前 userId 对应的类型
1612
+ */
1613
+ export interface CurrentStore {
1614
+ [id: string]: User;
1615
+ }
1616
+ export interface User {
1617
+ /**
1618
+ * userId
1619
+ */
1620
+ id: string;
1621
+ /**
1622
+ * Tab 栏状态
1623
+ */
1624
+ tab: 'input' | 'qrcode';
1625
+ /**
1626
+ * 登录方式
1627
+ */
1628
+ way: LoginWay;
1629
+ /**
1630
+ * 姓名
1631
+ */
1632
+ name?: string | null;
1633
+ /**
1634
+ * 昵称
1635
+ */
1636
+ nickname?: string | null;
1637
+ /**
1638
+ * 用户名
1639
+ */
1640
+ username?: string | null;
1641
+ /**
1642
+ * 手机号
1643
+ */
1644
+ phone?: string | null;
1645
+ /**
1646
+ * 邮箱
1647
+ */
1648
+ email?: string | null;
1649
+ /**
1650
+ * 头像
1651
+ */
1652
+ photo?: string | null;
1653
+ /**
1654
+ * qrCodeId 对应的ID
1655
+ */
1656
+ qrCodeId?: string;
1657
+ /**
1658
+ * 国际化短信区号
1659
+ */
1660
+ phoneCountryCode?: string;
1661
+ /**
1662
+ * 国际化短信选择框回填
1663
+ */
1664
+ areaCode?: string;
1665
+ /**
1666
+ * 登录时间
1667
+ */
1668
+ _updateTime?: string;
1669
+ }
1670
+ class MultipleAccount {
1671
+ /**
1672
+ * 原始的登录账号
1673
+ */
1674
+ private originAccount;
1675
+ private originWay;
1676
+ /**
1677
+ * 原始的 localStore 值
1678
+ */
1679
+ private originStore;
1680
+ /**
1681
+ * 当前 AppId Store
1682
+ */
1683
+ private currentStore;
1684
+ /**
1685
+ * 单账号直接回填
1686
+ */
1687
+ private firstBackFillData?;
1688
+ /**
1689
+ * server 返回支持的登录方式
1690
+ */
1691
+ private serverSideLoginMethods;
1692
+ /**
1693
+ * 是否显示多账号登录页面
1694
+ * true 存在
1695
+ */
1696
+ private memberState;
1697
+ /**
1698
+ * 二维码登录时的ID
1699
+ */
1700
+ private qrCodeId?;
1701
+ /**
1702
+ * 国际化短信前缀 区号
1703
+ */
1704
+ private phoneCountryCode?;
1705
+ /**
1706
+ * 国际化短信前缀 选中地区编号
1707
+ */
1708
+ private areaCode?;
1709
+ private tabStatus?;
1710
+ /**
1711
+ * 当前登录二级状态
1712
+ */
1713
+ private loginWay?;
1714
+ private appId;
1715
+ /**
1716
+ * 是否开启国际化短信
1717
+ */
1718
+ private isInternationSms?;
1719
+ constructor();
1720
+ /**
1721
+ * 页面首次加载时初始化 Store
1722
+ * 从 LocalStore 中拿值 放到这里来
1723
+ */
1724
+ private initStore;
1725
+ /**
1726
+ * 初始化记住账号相关信息
1727
+ * @param normalCount
1728
+ * @returns
1729
+ */
1730
+ private initMemberState;
1731
+ /**
1732
+ * 获取当前ID下有效账号个数
1733
+ * @returns qrCount 有效的二维码登录个数 normalCount 有效的账号登录方式
1734
+ */
1735
+ private memberStateCount;
1736
+ /**
1737
+ * 初始化第一次的数据 TODO: 逻辑有点脏 待整理
1738
+ */
1739
+ private initBackfillData;
1740
+ /**
1741
+ * 根据前端存储的登录方式返回后端映射方式
1742
+ * @param front
1743
+ */
1744
+ private getServerLoginMethodByFront;
1745
+ /**
1746
+ * 当前 Store DONE
1747
+ */
1748
+ private getCurrentStore;
1749
+ /**
1750
+ * 国际化短信过滤
1751
+ * true 表示通过 需要保留
1752
+ * false 表示不通过 需要过滤
1753
+ */
1754
+ private validateInternationSms;
1755
+ /**
1756
+ * 校验有效的登录方式账号
1757
+ * @param user
1758
+ * @param serverSideLoginMethods
1759
+ * @returns
1760
+ */
1761
+ private validateMethod;
1762
+ /**
1763
+ *
1764
+ * @param tab 一级Tab状态
1765
+ * @param way 二级Tab状态
1766
+ * @param id 二维码登录时 记录对应的二维码 ID
1767
+ */
1768
+ private setLoginWay;
1769
+ /**
1770
+ * 设置/更新 store 内的用户信息
1771
+ */
1772
+ private setUserInfo;
1773
+ /**
1774
+ * 持久化保存
1775
+ */
1776
+ private saveStore;
1777
+ /**
1778
+ * 根据登录的 account 判断本次登录的方式
1779
+ * @param account 登录输入的账号
1780
+ * @param param1 登录成功返回的相关信息 用户名/手机号/邮箱
1781
+ * @returns
1782
+ */
1783
+ private setLoginWayByHttpData;
1784
+ /**
1785
+ * 根据登录的 account 判断本次LDAP登录方式
1786
+ * @param account 登录输入的账号
1787
+ * @param param1 登录成功返回的相关信息 用户名/手机号/邮箱
1788
+ * @returns
1789
+ */
1790
+ private setLoginWayByLDAPData;
1791
+ /**
1792
+ * 根据用户 ID 删除 localStorage 中当前用户 ID
1793
+ */
1794
+ private delUserById;
1795
+ /**
1796
+ * 获得多账号登录页面的所有用户列表
1797
+ * @param excludeWays
1798
+ */
1799
+ private getMemoUser;
1800
+ /**
1801
+ * 根据 id 获得当前已登录的用户信息
1802
+ * @param userId
1803
+ * @returns User / undefined
1804
+ */
1805
+ private getMemoSingleUser;
1806
+ /**
1807
+ * 该方法仅仅需要回填账号的登录方式,其他都不计入
1808
+ * 当用户名/手机号/邮箱/AD/LDAP 相同时,根据登录顺序匹配不同的账号
1809
+ * 根据记住的用户登录方式获取对应的登录账户名
1810
+ * @param way
1811
+ * @param user
1812
+ * @returns
1813
+ */
1814
+ private getAccountByWay;
1815
+ private _mappingUser;
1816
+ /**
1817
+ * 外部暴露方法
1818
+ */
1819
+ getStore: () => {
1820
+ initStore: (appId: string, options: {
1821
+ serverSideLoginMethods: LoginWay[];
1822
+ isInternationSms: boolean;
1823
+ }) => void;
1824
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
1825
+ phoneCountryCode: string;
1826
+ areaCode: string;
1827
+ } | undefined) => void;
1828
+ setUserInfo: (user: Pick<User & {
1829
+ id: string;
1830
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1831
+ setLoginWayByHttpData: (account: string, data: {
1832
+ username?: string | undefined;
1833
+ phone?: string | undefined;
1834
+ email?: string | undefined;
1835
+ }) => void;
1836
+ setLoginWayByLDAPData: (account: string, data: {
1837
+ name?: string | undefined;
1838
+ phone?: string | undefined;
1839
+ email?: string | undefined;
1840
+ }) => void;
1841
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
1842
+ getMemoSingleUser: (id: string) => {
1843
+ way: LoginWay;
1844
+ account: string;
1845
+ } | undefined;
1846
+ delUserById: (id: string) => string;
1847
+ getMemberState: () => boolean;
1848
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
1849
+ getOriginAccount: () => string;
1850
+ getOriginWay: () => string;
1851
+ };
1852
+ }
1853
+ /**
1854
+ * MultipleAccounts 相关 Hook
1855
+ * Finally Config 类型过滤
1856
+ */
1857
+ const useMultipleAccounts: ({ appId, finallyConfig }: {
1858
+ appId?: string | undefined;
1859
+ finallyConfig?: any;
1860
+ }) => {
1861
+ instance: {
1862
+ initStore: (appId: string, options: {
1863
+ serverSideLoginMethods: LoginWay[];
1864
+ isInternationSms: boolean;
1865
+ }) => void;
1866
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
1867
+ phoneCountryCode: string;
1868
+ areaCode: string;
1869
+ } | undefined) => void;
1870
+ setUserInfo: (user: Pick<User & {
1871
+ id: string;
1872
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1873
+ setLoginWayByHttpData: (account: string, data: {
1874
+ username?: string | undefined;
1875
+ phone?: string | undefined;
1876
+ email?: string | undefined;
1877
+ }) => void;
1878
+ setLoginWayByLDAPData: (account: string, data: {
1879
+ name?: string | undefined;
1880
+ phone?: string | undefined;
1881
+ email?: string | undefined;
1882
+ }) => void;
1883
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
1884
+ getMemoSingleUser: (id: string) => {
1885
+ way: LoginWay;
1886
+ account: string;
1887
+ } | undefined;
1888
+ delUserById: (id: string) => string;
1889
+ getMemberState: () => boolean;
1890
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
1891
+ getOriginAccount: () => string;
1892
+ getOriginWay: () => string;
1893
+ } | undefined;
1894
+ isMultipleAccount: boolean;
1895
+ referMultipleState: (type: 'login' | 'multiple', data?: BackFillMultipleState | undefined) => void;
1896
+ multipleAccountData: BackFillMultipleState | undefined;
1897
+ clearBackFillData: () => void;
1898
+ };
1899
+ export default useMultipleAccounts;
1900
+
1578
1901
  }
1579
1902
  declare module '@authing/react-ui-components/components/Guard/core/index' {
1580
1903
  /// <reference types="react" />
@@ -1634,7 +1957,39 @@ declare module '@authing/react-ui-components/components/Guard/event' {
1634
1957
  export interface GuardEvents extends LoginEvents, RegisterEvents, CompleteInfoEvents, ForgetPasswordEvents, IdentityBindingEvents, IdentityBindingAskEvents {
1635
1958
  onBeforeChangeModule?: (key: GuardModuleType, initData?: any) => boolean | Promise<boolean>;
1636
1959
  }
1637
- export const guardEventsFilter: (props: any, openEventsMapping?: boolean | undefined) => GuardEvents;
1960
+ export const guardEventsFilter: (props: any, multipleInstance?: {
1961
+ initStore: (appId: string, options: {
1962
+ serverSideLoginMethods: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[];
1963
+ isInternationSms: boolean;
1964
+ }) => void;
1965
+ setLoginWay: (tab: "input" | "qrcode", way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay, id?: string | undefined, internation?: {
1966
+ phoneCountryCode: string;
1967
+ areaCode: string;
1968
+ } | undefined) => void;
1969
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
1970
+ id: string;
1971
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1972
+ setLoginWayByHttpData: (account: string, data: {
1973
+ username?: string | undefined;
1974
+ phone?: string | undefined;
1975
+ email?: string | undefined;
1976
+ }) => void;
1977
+ setLoginWayByLDAPData: (account: string, data: {
1978
+ name?: string | undefined;
1979
+ phone?: string | undefined;
1980
+ email?: string | undefined;
1981
+ }) => void;
1982
+ getMemoUser: (excludeWays?: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[]) => import("../Login/multipleAccounts/panel").SelectOptions[];
1983
+ getMemoSingleUser: (id: string) => {
1984
+ way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay;
1985
+ account: string;
1986
+ } | undefined;
1987
+ delUserById: (id: string) => string;
1988
+ getMemberState: () => boolean;
1989
+ getFirstBackFillData: () => import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").BackFillMultipleState | undefined;
1990
+ getOriginAccount: () => string;
1991
+ getOriginWay: () => string;
1992
+ } | undefined, openEventsMapping?: boolean | undefined) => GuardEvents;
1638
1993
  export const guardEventsHijacking: (events: GuardEvents, openEventsMapping?: boolean | undefined) => GuardEvents;
1639
1994
  export const GuardEventsCamelToKebabMapping: {
1640
1995
  readonly onLoad: "load";
@@ -1926,6 +2281,7 @@ declare module '@authing/react-ui-components/components/Login/codemap' {
1926
2281
  declare module '@authing/react-ui-components/components/Login/core/withAD' {
1927
2282
  /// <reference types="react" />
1928
2283
  import { Agreement } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2284
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1929
2285
  interface LoginWithADProps {
1930
2286
  publicKey: string;
1931
2287
  autoRegister?: boolean;
@@ -1933,6 +2289,14 @@ declare module '@authing/react-ui-components/components/Login/core/withAD' {
1933
2289
  onLoginFailed: any;
1934
2290
  onBeforeLogin: any;
1935
2291
  agreements: Agreement[];
2292
+ /**
2293
+ * 回填的数据
2294
+ */
2295
+ backfillData?: BackFillMultipleState;
2296
+ /**
2297
+ * 根据输入的账号 & 返回获得对应的登录方法
2298
+ */
2299
+ multipleInstance?: StoreInstance;
1936
2300
  }
1937
2301
  export const LoginWithAD: (props: LoginWithADProps) => JSX.Element;
1938
2302
  export {};
@@ -1940,10 +2304,12 @@ declare module '@authing/react-ui-components/components/Login/core/withAD' {
1940
2304
  }
1941
2305
  declare module '@authing/react-ui-components/components/Login/core/withAppQrcode' {
1942
2306
  /// <reference types="react" />
2307
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1943
2308
  interface LoginWithAppQrcodeProps {
1944
2309
  onLoginSuccess: any;
1945
2310
  canLoop: boolean;
1946
2311
  qrCodeScanOptions: any;
2312
+ multipleInstance?: StoreInstance;
1947
2313
  }
1948
2314
  export const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element;
1949
2315
  export {};
@@ -1952,6 +2318,7 @@ declare module '@authing/react-ui-components/components/Login/core/withAppQrcode
1952
2318
  declare module '@authing/react-ui-components/components/Login/core/withLDAP' {
1953
2319
  /// <reference types="react" />
1954
2320
  import { Agreement } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2321
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1955
2322
  interface LoginWithLDAPProps {
1956
2323
  publicKey: string;
1957
2324
  autoRegister?: boolean;
@@ -1960,6 +2327,14 @@ declare module '@authing/react-ui-components/components/Login/core/withLDAP' {
1960
2327
  onLoginFailed: any;
1961
2328
  onBeforeLogin: any;
1962
2329
  agreements: Agreement[];
2330
+ /**
2331
+ * 根据输入的账号 & 返回获得对应的登录方法
2332
+ */
2333
+ multipleInstance?: StoreInstance;
2334
+ /**
2335
+ * 多账号回填的数据
2336
+ */
2337
+ backfillData?: BackFillMultipleState;
1963
2338
  }
1964
2339
  export const LoginWithLDAP: (props: LoginWithLDAPProps) => JSX.Element;
1965
2340
  export {};
@@ -2000,6 +2375,7 @@ declare module '@authing/react-ui-components/components/Login/core/withPassword/
2000
2375
  import { Agreement, PasswordLoginMethods } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2001
2376
  import { LoginMethods } from '@authing/react-ui-components/components/index';
2002
2377
  import { AuthingResponse } from '@authing/react-ui-components/components/_utils/http';
2378
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2003
2379
  interface LoginWithPasswordProps {
2004
2380
  publicKey: string;
2005
2381
  autoRegister?: boolean;
@@ -2013,6 +2389,14 @@ declare module '@authing/react-ui-components/components/Login/core/withPassword/
2013
2389
  loginWay?: LoginMethods;
2014
2390
  submitButText?: string;
2015
2391
  saveIdentify?: (type: LoginMethods, identity: string) => void;
2392
+ /**
2393
+ * 根据输入的账号 & 返回获得对应的登录方法
2394
+ */
2395
+ multipleInstance?: StoreInstance;
2396
+ /**
2397
+ * 多账号回填的数据
2398
+ */
2399
+ backfillData?: BackFillMultipleState;
2016
2400
  }
2017
2401
  export const LoginWithPassword: (props: LoginWithPasswordProps) => JSX.Element;
2018
2402
  export {};
@@ -2046,6 +2430,10 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2046
2430
  import React, { FC } from 'react';
2047
2431
  import './styles.less';
2048
2432
  export interface VirtualDropdownProps {
2433
+ /**
2434
+ * 回填的国际化区号
2435
+ */
2436
+ regionCode?: string;
2049
2437
  value?: string;
2050
2438
  onChange?: (value: string) => void;
2051
2439
  style?: React.CSSProperties;
@@ -2056,7 +2444,8 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2056
2444
  declare module '@authing/react-ui-components/components/Login/core/withVerifyCode/index' {
2057
2445
  /// <reference types="react" />
2058
2446
  import './styles.less';
2059
- export const LoginWithVerifyCode: (props: any) => JSX.Element;
2447
+ const LoginWithVerifyCode: (props: any) => JSX.Element;
2448
+ export { LoginWithVerifyCode };
2060
2449
 
2061
2450
  }
2062
2451
  declare module '@authing/react-ui-components/components/Login/core/withVerifyCode/inputIdentify' {
@@ -2071,10 +2460,13 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2071
2460
  }
2072
2461
  declare module '@authing/react-ui-components/components/Login/core/withWechatMiniQrcode' {
2073
2462
  /// <reference types="react" />
2463
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2074
2464
  interface LoginWithWechatMiniQrcodeProps {
2075
2465
  onLoginSuccess: any;
2076
2466
  canLoop: boolean;
2077
2467
  qrCodeScanOptions: any;
2468
+ id: string;
2469
+ multipleInstance?: StoreInstance;
2078
2470
  }
2079
2471
  export const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element;
2080
2472
  export {};
@@ -2082,14 +2474,85 @@ declare module '@authing/react-ui-components/components/Login/core/withWechatMin
2082
2474
  }
2083
2475
  declare module '@authing/react-ui-components/components/Login/core/withWechatmpQrcode' {
2084
2476
  /// <reference types="react" />
2477
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2085
2478
  interface LoginWithWechatmpQrcodeProps {
2086
2479
  onLoginSuccess: any;
2087
2480
  canLoop: boolean;
2088
2481
  qrCodeScanOptions: any;
2482
+ id: string;
2483
+ /**
2484
+ * 多账号存储实例
2485
+ */
2486
+ multipleInstance?: StoreInstance;
2089
2487
  }
2090
2488
  export const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element;
2091
2489
  export {};
2092
2490
 
2491
+ }
2492
+ declare module '@authing/react-ui-components/components/Login/hooks/useLoginMultiple' {
2493
+ /// <reference types="react" />
2494
+ import { FormInstance } from 'antd/lib/form';
2495
+ import { BackFillMultipleState, LoginWay } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2496
+ /**
2497
+ * 多账号登录下 账户 & 登录方式自动回填
2498
+ * TODO: HOOK 参数有时间整理成为对象,开始没有想到有这么多
2499
+ * 调用地方 core 中需要回填的两个登录方式
2500
+ */
2501
+ function useLoginMultipleBackFill(options: {
2502
+ form: FormInstance<any>;
2503
+ way: LoginWay;
2504
+ formKey: string;
2505
+ backfillData?: BackFillMultipleState;
2506
+ isOnlyInternationSms?: boolean;
2507
+ setAreaCode?: React.Dispatch<React.SetStateAction<string>>;
2508
+ cancelBackfill?: boolean;
2509
+ }): void;
2510
+ /**
2511
+ * 多账号统一状态管理
2512
+ * @param setLoginWay
2513
+ * @returns
2514
+ */
2515
+ function useLoginMultiple(setLoginWay: React.Dispatch<any>): {
2516
+ isMultipleAccount: boolean;
2517
+ multipleInstance: {
2518
+ initStore: (appId: string, options: {
2519
+ serverSideLoginMethods: LoginWay[];
2520
+ isInternationSms: boolean;
2521
+ }) => void;
2522
+ setLoginWay: (tab: "input" | "qrcode", way: LoginWay, id?: string | undefined, internation?: {
2523
+ phoneCountryCode: string;
2524
+ areaCode: string;
2525
+ } | undefined) => void;
2526
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
2527
+ id: string;
2528
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
2529
+ setLoginWayByHttpData: (account: string, data: {
2530
+ username?: string | undefined;
2531
+ phone?: string | undefined;
2532
+ email?: string | undefined;
2533
+ }) => void;
2534
+ setLoginWayByLDAPData: (account: string, data: {
2535
+ name?: string | undefined;
2536
+ phone?: string | undefined;
2537
+ email?: string | undefined;
2538
+ }) => void;
2539
+ getMemoUser: (excludeWays?: LoginWay[]) => import("@authing/react-ui-components/components/Login/multipleAccounts/panel").SelectOptions[];
2540
+ getMemoSingleUser: (id: string) => {
2541
+ way: LoginWay;
2542
+ account: string;
2543
+ } | undefined;
2544
+ delUserById: (id: string) => string;
2545
+ getMemberState: () => boolean;
2546
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
2547
+ getOriginAccount: () => string;
2548
+ getOriginWay: () => string;
2549
+ } | undefined;
2550
+ referMultipleState: ((type: "login" | "multiple") => void) | undefined;
2551
+ backfillData: BackFillMultipleState | undefined;
2552
+ defaultQrWay: string | undefined;
2553
+ };
2554
+ export { useLoginMultipleBackFill, useLoginMultiple };
2555
+
2093
2556
  }
2094
2557
  declare module '@authing/react-ui-components/components/Login/index' {
2095
2558
  /// <reference types="react" />
@@ -2138,6 +2601,79 @@ declare module '@authing/react-ui-components/components/Login/interface' {
2138
2601
  }
2139
2602
  export const getDefaultLoginConfig: () => LoginConfig;
2140
2603
 
2604
+ }
2605
+ declare module '@authing/react-ui-components/components/Login/multipleAccounts/index' {
2606
+ import React from 'react';
2607
+ import { LoginWay, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2608
+ import { GuardModuleType } from '@authing/react-ui-components/components/Guard/index';
2609
+ interface MultipleAccountsProps {
2610
+ /**
2611
+ * 多账号存储实例
2612
+ */
2613
+ multipleInstance?: StoreInstance;
2614
+ /**
2615
+ * 切换 Guard 方法
2616
+ */
2617
+ changeModule?: (moduleName: GuardModuleType, initData?: any) => Promise<void>;
2618
+ /**
2619
+ * 切换多账号状态
2620
+ */
2621
+ referMultipleState?: (type: 'login' | 'multiple', data?: {
2622
+ account: string;
2623
+ way: LoginWay;
2624
+ }) => void;
2625
+ }
2626
+ const MultipleAccounts: React.NamedExoticComponent<MultipleAccountsProps>;
2627
+ export { MultipleAccounts };
2628
+
2629
+ }
2630
+ declare module '@authing/react-ui-components/components/Login/multipleAccounts/panel' {
2631
+ import React from 'react';
2632
+ import './style.less';
2633
+ interface SelectPanelProps {
2634
+ lists: SelectOptions[];
2635
+ /**
2636
+ * 点击删除
2637
+ */
2638
+ handleDel: (id: string) => void;
2639
+ /**
2640
+ * 点击 li
2641
+ */
2642
+ onClick: (id: string) => void;
2643
+ }
2644
+ export interface SelectOptions {
2645
+ /**
2646
+ * 头像
2647
+ */
2648
+ photo?: string;
2649
+ /**
2650
+ * 标题
2651
+ */
2652
+ title?: string;
2653
+ /**
2654
+ * 描述
2655
+ */
2656
+ description?: string;
2657
+ /**
2658
+ * 用户 ID 唯一标识符
2659
+ */
2660
+ id: string | 'other';
2661
+ /**
2662
+ * 显示操作栏 default: true
2663
+ */
2664
+ operation?: boolean;
2665
+ /**
2666
+ * 登录时间
2667
+ */
2668
+ _updateTime: number;
2669
+ /**
2670
+ * 替代图片元素
2671
+ */
2672
+ element?: React.ReactElement;
2673
+ }
2674
+ const SelectPanel: React.FC<SelectPanelProps>;
2675
+ export { SelectPanel };
2676
+
2141
2677
  }
2142
2678
  declare module '@authing/react-ui-components/components/Login/socialLogin/IdpButton/index' {
2143
2679
  /// <reference types="react" />
@@ -2149,6 +2685,7 @@ declare module '@authing/react-ui-components/components/Login/socialLogin/index'
2149
2685
  import { ApplicationConfig, SocialConnectionItem } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2150
2686
  import './style.less';
2151
2687
  import { GuardLocalConfig } from '@authing/react-ui-components/components/Guard/index';
2688
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2152
2689
  export interface SocialLoginProps {
2153
2690
  appId: string;
2154
2691
  config: GuardLocalConfig;
@@ -2156,6 +2693,10 @@ declare module '@authing/react-ui-components/components/Login/socialLogin/index'
2156
2693
  onLoginSuccess: any;
2157
2694
  enterpriseConnectionObjs: ApplicationConfig['identityProviders'];
2158
2695
  socialConnectionObjs: SocialConnectionItem[];
2696
+ /**
2697
+ * 根据输入的账号 & 返回获得对应的登录方法
2698
+ */
2699
+ multipleInstance?: StoreInstance;
2159
2700
  }
2160
2701
  export const SocialLogin: React.FC<SocialLoginProps>;
2161
2702
 
@@ -3021,6 +3562,7 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3021
3562
  import React from 'react';
3022
3563
  import { GuardEvents, GuardLocalConfig, GuardModuleType, GuardPageConfig } from '@authing/react-ui-components/components/index';
3023
3564
  import { ApplicationConfig } from '@authing/react-ui-components/components/AuthingGuard/api/index';
3565
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
3024
3566
  import { ModuleState } from '@authing/react-ui-components/components/Guard/GuardModule/stateMachine';
3025
3567
  import { GuardHttp } from '@authing/react-ui-components/components/_utils/guardHttp';
3026
3568
  export interface IGuardContext {
@@ -3038,6 +3580,29 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3038
3580
  isAuthFlow: boolean;
3039
3581
  contextLoaded: boolean;
3040
3582
  guardPageConfig: Partial<GuardPageConfig>;
3583
+ multipleInstance: {
3584
+ /**
3585
+ * 多账号相关
3586
+ */
3587
+ isMultipleAccount: boolean;
3588
+ /**
3589
+ * when: 多账号页面跳转进入登录页面
3590
+ * 携带的回填数据信息
3591
+ */
3592
+ multipleAccountData?: BackFillMultipleState;
3593
+ /**
3594
+ * 多账号 store 实例
3595
+ */
3596
+ instance?: StoreInstance;
3597
+ /**
3598
+ * 切换多账号 isMultipleAccount 状态
3599
+ */
3600
+ referMultipleState?: (type: 'login' | 'multiple') => void;
3601
+ /**
3602
+ * 清空回填数据
3603
+ */
3604
+ clearBackFillData?: () => void;
3605
+ };
3041
3606
  }
3042
3607
  export const createGuardXContext: () => {
3043
3608
  Provider: React.FC<{
@@ -3075,6 +3640,64 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3075
3640
  export const useGuardContextLoaded: () => boolean;
3076
3641
  export const useGuardIsAuthFlow: () => boolean;
3077
3642
  export const useGuardPageConfig: () => Partial<GuardPageConfig>;
3643
+ /**
3644
+ * 多账号登录 store 实例
3645
+ */
3646
+ export const useGuardMultipleInstance: () => {
3647
+ /**
3648
+ * 多账号相关
3649
+ */
3650
+ isMultipleAccount: boolean;
3651
+ /**
3652
+ * when: 多账号页面跳转进入登录页面
3653
+ * 携带的回填数据信息
3654
+ */
3655
+ multipleAccountData?: BackFillMultipleState | undefined;
3656
+ /**
3657
+ * 多账号 store 实例
3658
+ */
3659
+ instance?: {
3660
+ initStore: (appId: string, options: {
3661
+ serverSideLoginMethods: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[];
3662
+ isInternationSms: boolean;
3663
+ }) => void;
3664
+ setLoginWay: (tab: "input" | "qrcode", way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay, id?: string | undefined, internation?: {
3665
+ phoneCountryCode: string;
3666
+ areaCode: string;
3667
+ } | undefined) => void;
3668
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
3669
+ id: string;
3670
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
3671
+ setLoginWayByHttpData: (account: string, data: {
3672
+ username?: string | undefined;
3673
+ phone?: string | undefined;
3674
+ email?: string | undefined;
3675
+ }) => void;
3676
+ setLoginWayByLDAPData: (account: string, data: {
3677
+ name?: string | undefined;
3678
+ phone?: string | undefined;
3679
+ email?: string | undefined;
3680
+ }) => void;
3681
+ getMemoUser: (excludeWays?: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[]) => import("../Login/multipleAccounts/panel").SelectOptions[];
3682
+ getMemoSingleUser: (id: string) => {
3683
+ way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay;
3684
+ account: string;
3685
+ } | undefined;
3686
+ delUserById: (id: string) => string;
3687
+ getMemberState: () => boolean;
3688
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
3689
+ getOriginAccount: () => string;
3690
+ getOriginWay: () => string;
3691
+ } | undefined;
3692
+ /**
3693
+ * 切换多账号 isMultipleAccount 状态
3694
+ */
3695
+ referMultipleState?: ((type: 'login' | 'multiple') => void) | undefined;
3696
+ /**
3697
+ * 清空回填数据
3698
+ */
3699
+ clearBackFillData?: (() => void) | undefined;
3700
+ };
3078
3701
 
3079
3702
  }
3080
3703
  declare module '@authing/react-ui-components/components/_utils/corsVerification' {
@@ -3543,7 +4166,7 @@ declare module '@authing/react-ui-components/components/version/index' {
3543
4166
 
3544
4167
  }
3545
4168
  declare module '@authing/react-ui-components/components/version/version' {
3546
- const _default: "3.1.37";
4169
+ const _default: "3.1.39";
3547
4170
  export default _default;
3548
4171
 
3549
4172
  }