@authing/react-ui-components 3.1.37-beta.0 → 3.1.37-beta.3

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,299 @@ 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
+ * 原始的登录账号
1663
+ */
1664
+ private originAccount;
1665
+ /**
1666
+ * 原始的 localStore 值
1667
+ */
1668
+ private originStore;
1669
+ /**
1670
+ * 当前 AppId Store
1671
+ */
1672
+ private currentStore;
1673
+ /**
1674
+ * 单账号直接回填
1675
+ */
1676
+ private firstBackFillData?;
1677
+ /**
1678
+ * server 返回支持的登录方式
1679
+ */
1680
+ private serverSideLoginMethods;
1681
+ /**
1682
+ * 是否显示多账号登录页面
1683
+ * true 存在
1684
+ */
1685
+ private memberState;
1686
+ /**
1687
+ * 二维码登录时的ID
1688
+ */
1689
+ private qrCodeId?;
1690
+ /**
1691
+ * 国际化短信前缀 区号
1692
+ */
1693
+ private phoneCountryCode?;
1694
+ /**
1695
+ * 国际化短信前缀 选中地区编号
1696
+ */
1697
+ private areaCode?;
1698
+ private tabStatus?;
1699
+ /**
1700
+ * 当前登录二级状态
1701
+ */
1702
+ private loginWay?;
1703
+ private appId;
1704
+ /**
1705
+ * 是否开启国际化短信
1706
+ */
1707
+ private isInternationSms?;
1708
+ constructor();
1709
+ /**
1710
+ * 页面首次加载时初始化 Store
1711
+ * 从 LocalStore 中拿值 放到这里来
1712
+ */
1713
+ private initStore;
1714
+ /**
1715
+ * 初始化记住账号相关信息
1716
+ * @param normalCount
1717
+ * @returns
1718
+ */
1719
+ private initMemberState;
1720
+ /**
1721
+ * 获取当前ID下有效账号个数
1722
+ * @returns qrCount 有效的二维码登录个数 normalCount 有效的账号登录方式
1723
+ */
1724
+ private memberStateCount;
1725
+ /**
1726
+ * 初始化第一次的数据 TODO: 逻辑有点脏 待整理
1727
+ */
1728
+ private initBackfillData;
1729
+ /**
1730
+ * 根据前端存储的登录方式返回后端映射方式
1731
+ * @param front
1732
+ */
1733
+ private getServerLoginMethodByFront;
1734
+ /**
1735
+ * 当前 Store DONE
1736
+ */
1737
+ private getCurrentStore;
1738
+ /**
1739
+ * 国际化短信过滤
1740
+ * true 表示通过 需要保留
1741
+ * false 表示不通过 需要过滤
1742
+ */
1743
+ private validateInternationSms;
1744
+ /**
1745
+ * 校验有效的登录方式账号
1746
+ * @param user
1747
+ * @param serverSideLoginMethods
1748
+ * @returns
1749
+ */
1750
+ private validateMethod;
1751
+ /**
1752
+ *
1753
+ * @param tab 一级Tab状态
1754
+ * @param way 二级Tab状态
1755
+ * @param id 二维码登录时 记录对应的二维码 ID
1756
+ */
1757
+ private setLoginWay;
1758
+ /**
1759
+ * 设置/更新 store 内的用户信息
1760
+ */
1761
+ private setUserInfo;
1762
+ /**
1763
+ * 持久化保存
1764
+ */
1765
+ private saveStore;
1766
+ /**
1767
+ * 根据登录的 account 判断本次登录的方式
1768
+ * @param account 登录输入的账号
1769
+ * @param param1 登录成功返回的相关信息 用户名/手机号/邮箱
1770
+ * @returns
1771
+ */
1772
+ private setLoginWayByHttpData;
1773
+ /**
1774
+ * 根据用户 ID 删除 localStorage 中当前用户 ID
1775
+ */
1776
+ private delUserById;
1777
+ /**
1778
+ * 获得多账号登录页面的所有用户列表
1779
+ * @param excludeWays
1780
+ */
1781
+ private getMemoUser;
1782
+ /**
1783
+ * 根据 id 获得当前已登录的用户信息
1784
+ * @param userId
1785
+ * @returns User / undefined
1786
+ */
1787
+ private getMemoSingleUser;
1788
+ /**
1789
+ * 该方法仅仅需要回填账号的登录方式,其他都不计入
1790
+ * 当用户名/手机号/邮箱/AD/LDAP 相同时,根据登录顺序匹配不同的账号
1791
+ * 根据记住的用户登录方式获取对应的登录账户名
1792
+ * @param way
1793
+ * @param user
1794
+ * @returns
1795
+ */
1796
+ private getAccountByWay;
1797
+ private _mappingUser;
1798
+ /**
1799
+ * 外部暴露方法
1800
+ */
1801
+ getStore: () => {
1802
+ initStore: (appId: string, options: {
1803
+ serverSideLoginMethods: LoginWay[];
1804
+ isInternationSms: boolean;
1805
+ }) => void;
1806
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
1807
+ phoneCountryCode: string;
1808
+ areaCode: string;
1809
+ } | undefined) => void;
1810
+ setUserInfo: (user: Pick<User & {
1811
+ id: string;
1812
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1813
+ setLoginWayByHttpData: (account: string, data: {
1814
+ username?: string | undefined;
1815
+ phone?: string | undefined;
1816
+ email?: string | undefined;
1817
+ }) => void;
1818
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
1819
+ getMemoSingleUser: (id: string) => {
1820
+ way: LoginWay;
1821
+ account: string;
1822
+ } | undefined;
1823
+ delUserById: (id: string) => string;
1824
+ getMemberState: () => boolean;
1825
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
1826
+ getOriginAccount: () => string;
1827
+ };
1828
+ }
1829
+ /**
1830
+ * MultipleAccounts 相关 Hook
1831
+ * Finally Config 类型过滤
1832
+ */
1833
+ const useMultipleAccounts: ({ appId, finallyConfig }: {
1834
+ appId?: string | undefined;
1835
+ finallyConfig?: any;
1836
+ }) => {
1837
+ instance: {
1838
+ initStore: (appId: string, options: {
1839
+ serverSideLoginMethods: LoginWay[];
1840
+ isInternationSms: boolean;
1841
+ }) => void;
1842
+ setLoginWay: (tab: 'input' | 'qrcode', way: LoginWay, id?: string | undefined, internation?: {
1843
+ phoneCountryCode: string;
1844
+ areaCode: string;
1845
+ } | undefined) => void;
1846
+ setUserInfo: (user: Pick<User & {
1847
+ id: string;
1848
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1849
+ setLoginWayByHttpData: (account: string, data: {
1850
+ username?: string | undefined;
1851
+ phone?: string | undefined;
1852
+ email?: string | undefined;
1853
+ }) => void;
1854
+ getMemoUser: (excludeWays?: LoginWay[]) => SelectOptions[];
1855
+ getMemoSingleUser: (id: string) => {
1856
+ way: LoginWay;
1857
+ account: string;
1858
+ } | undefined;
1859
+ delUserById: (id: string) => string;
1860
+ getMemberState: () => boolean;
1861
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
1862
+ getOriginAccount: () => string;
1863
+ } | undefined;
1864
+ isMultipleAccount: boolean;
1865
+ referMultipleState: (type: 'login' | 'multiple', data?: BackFillMultipleState | undefined) => void;
1866
+ multipleAccountData: BackFillMultipleState | undefined;
1867
+ clearBackFillData: () => void;
1868
+ };
1869
+ export default useMultipleAccounts;
1870
+
1578
1871
  }
1579
1872
  declare module '@authing/react-ui-components/components/Guard/core/index' {
1580
1873
  /// <reference types="react" />
@@ -1634,7 +1927,33 @@ declare module '@authing/react-ui-components/components/Guard/event' {
1634
1927
  export interface GuardEvents extends LoginEvents, RegisterEvents, CompleteInfoEvents, ForgetPasswordEvents, IdentityBindingEvents, IdentityBindingAskEvents {
1635
1928
  onBeforeChangeModule?: (key: GuardModuleType, initData?: any) => boolean | Promise<boolean>;
1636
1929
  }
1637
- export const guardEventsFilter: (props: any, openEventsMapping?: boolean | undefined) => GuardEvents;
1930
+ export const guardEventsFilter: (props: any, multipleInstance?: {
1931
+ initStore: (appId: string, options: {
1932
+ serverSideLoginMethods: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[];
1933
+ isInternationSms: boolean;
1934
+ }) => void;
1935
+ setLoginWay: (tab: "input" | "qrcode", way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay, id?: string | undefined, internation?: {
1936
+ phoneCountryCode: string;
1937
+ areaCode: string;
1938
+ } | undefined) => void;
1939
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
1940
+ id: string;
1941
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
1942
+ setLoginWayByHttpData: (account: string, data: {
1943
+ username?: string | undefined;
1944
+ phone?: string | undefined;
1945
+ email?: string | undefined;
1946
+ }) => void;
1947
+ getMemoUser: (excludeWays?: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[]) => import("../Login/multipleAccounts/panel").SelectOptions[];
1948
+ getMemoSingleUser: (id: string) => {
1949
+ way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay;
1950
+ account: string;
1951
+ } | undefined;
1952
+ delUserById: (id: string) => string;
1953
+ getMemberState: () => boolean;
1954
+ getFirstBackFillData: () => import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").BackFillMultipleState | undefined;
1955
+ getOriginAccount: () => string;
1956
+ } | undefined, openEventsMapping?: boolean | undefined) => GuardEvents;
1638
1957
  export const guardEventsHijacking: (events: GuardEvents, openEventsMapping?: boolean | undefined) => GuardEvents;
1639
1958
  export const GuardEventsCamelToKebabMapping: {
1640
1959
  readonly onLoad: "load";
@@ -1926,6 +2245,7 @@ declare module '@authing/react-ui-components/components/Login/codemap' {
1926
2245
  declare module '@authing/react-ui-components/components/Login/core/withAD' {
1927
2246
  /// <reference types="react" />
1928
2247
  import { Agreement } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2248
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1929
2249
  interface LoginWithADProps {
1930
2250
  publicKey: string;
1931
2251
  autoRegister?: boolean;
@@ -1933,6 +2253,14 @@ declare module '@authing/react-ui-components/components/Login/core/withAD' {
1933
2253
  onLoginFailed: any;
1934
2254
  onBeforeLogin: any;
1935
2255
  agreements: Agreement[];
2256
+ /**
2257
+ * 回填的数据
2258
+ */
2259
+ backfillData?: BackFillMultipleState;
2260
+ /**
2261
+ * 根据输入的账号 & 返回获得对应的登录方法
2262
+ */
2263
+ multipleInstance?: StoreInstance;
1936
2264
  }
1937
2265
  export const LoginWithAD: (props: LoginWithADProps) => JSX.Element;
1938
2266
  export {};
@@ -1940,17 +2268,21 @@ declare module '@authing/react-ui-components/components/Login/core/withAD' {
1940
2268
  }
1941
2269
  declare module '@authing/react-ui-components/components/Login/core/withAppQrcode' {
1942
2270
  /// <reference types="react" />
2271
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1943
2272
  interface LoginWithAppQrcodeProps {
1944
2273
  onLoginSuccess: any;
1945
2274
  canLoop: boolean;
2275
+ qrCodeScanOptions: any;
2276
+ multipleInstance?: StoreInstance;
1946
2277
  }
1947
- export const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element | null;
2278
+ export const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element;
1948
2279
  export {};
1949
2280
 
1950
2281
  }
1951
2282
  declare module '@authing/react-ui-components/components/Login/core/withLDAP' {
1952
2283
  /// <reference types="react" />
1953
2284
  import { Agreement } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2285
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
1954
2286
  interface LoginWithLDAPProps {
1955
2287
  publicKey: string;
1956
2288
  autoRegister?: boolean;
@@ -1959,6 +2291,14 @@ declare module '@authing/react-ui-components/components/Login/core/withLDAP' {
1959
2291
  onLoginFailed: any;
1960
2292
  onBeforeLogin: any;
1961
2293
  agreements: Agreement[];
2294
+ /**
2295
+ * 根据输入的账号 & 返回获得对应的登录方法
2296
+ */
2297
+ multipleInstance?: StoreInstance;
2298
+ /**
2299
+ * 多账号回填的数据
2300
+ */
2301
+ backfillData?: BackFillMultipleState;
1962
2302
  }
1963
2303
  export const LoginWithLDAP: (props: LoginWithLDAPProps) => JSX.Element;
1964
2304
  export {};
@@ -1999,6 +2339,7 @@ declare module '@authing/react-ui-components/components/Login/core/withPassword/
1999
2339
  import { Agreement, PasswordLoginMethods } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2000
2340
  import { LoginMethods } from '@authing/react-ui-components/components/index';
2001
2341
  import { AuthingResponse } from '@authing/react-ui-components/components/_utils/http';
2342
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2002
2343
  interface LoginWithPasswordProps {
2003
2344
  publicKey: string;
2004
2345
  autoRegister?: boolean;
@@ -2012,6 +2353,14 @@ declare module '@authing/react-ui-components/components/Login/core/withPassword/
2012
2353
  loginWay?: LoginMethods;
2013
2354
  submitButText?: string;
2014
2355
  saveIdentify?: (type: LoginMethods, identity: string) => void;
2356
+ /**
2357
+ * 根据输入的账号 & 返回获得对应的登录方法
2358
+ */
2359
+ multipleInstance?: StoreInstance;
2360
+ /**
2361
+ * 多账号回填的数据
2362
+ */
2363
+ backfillData?: BackFillMultipleState;
2015
2364
  }
2016
2365
  export const LoginWithPassword: (props: LoginWithPasswordProps) => JSX.Element;
2017
2366
  export {};
@@ -2045,6 +2394,10 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2045
2394
  import React, { FC } from 'react';
2046
2395
  import './styles.less';
2047
2396
  export interface VirtualDropdownProps {
2397
+ /**
2398
+ * 回填的国际化区号
2399
+ */
2400
+ regionCode?: string;
2048
2401
  value?: string;
2049
2402
  onChange?: (value: string) => void;
2050
2403
  style?: React.CSSProperties;
@@ -2055,7 +2408,8 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2055
2408
  declare module '@authing/react-ui-components/components/Login/core/withVerifyCode/index' {
2056
2409
  /// <reference types="react" />
2057
2410
  import './styles.less';
2058
- export const LoginWithVerifyCode: (props: any) => JSX.Element;
2411
+ const LoginWithVerifyCode: (props: any) => JSX.Element;
2412
+ export { LoginWithVerifyCode };
2059
2413
 
2060
2414
  }
2061
2415
  declare module '@authing/react-ui-components/components/Login/core/withVerifyCode/inputIdentify' {
@@ -2070,23 +2424,93 @@ declare module '@authing/react-ui-components/components/Login/core/withVerifyCod
2070
2424
  }
2071
2425
  declare module '@authing/react-ui-components/components/Login/core/withWechatMiniQrcode' {
2072
2426
  /// <reference types="react" />
2427
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2073
2428
  interface LoginWithWechatMiniQrcodeProps {
2074
2429
  onLoginSuccess: any;
2075
2430
  canLoop: boolean;
2431
+ qrCodeScanOptions: any;
2432
+ id: string;
2433
+ multipleInstance?: StoreInstance;
2076
2434
  }
2077
- export const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element | null;
2435
+ export const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element;
2078
2436
  export {};
2079
2437
 
2080
2438
  }
2081
2439
  declare module '@authing/react-ui-components/components/Login/core/withWechatmpQrcode' {
2082
2440
  /// <reference types="react" />
2441
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2083
2442
  interface LoginWithWechatmpQrcodeProps {
2084
2443
  onLoginSuccess: any;
2085
2444
  canLoop: boolean;
2445
+ qrCodeScanOptions: any;
2446
+ id: string;
2447
+ /**
2448
+ * 多账号存储实例
2449
+ */
2450
+ multipleInstance?: StoreInstance;
2086
2451
  }
2087
- export const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element | null;
2452
+ export const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element;
2088
2453
  export {};
2089
2454
 
2455
+ }
2456
+ declare module '@authing/react-ui-components/components/Login/hooks/useLoginMultiple' {
2457
+ /// <reference types="react" />
2458
+ import { FormInstance } from 'antd/lib/form';
2459
+ import { BackFillMultipleState, LoginWay } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2460
+ /**
2461
+ * 多账号登录下 账户 & 登录方式自动回填
2462
+ * TODO: HOOK 参数有时间整理成为对象,开始没有想到有这么多
2463
+ * 调用地方 core 中需要回填的两个登录方式
2464
+ */
2465
+ function useLoginMultipleBackFill(options: {
2466
+ form: FormInstance<any>;
2467
+ way: LoginWay;
2468
+ formKey: string;
2469
+ backfillData?: BackFillMultipleState;
2470
+ isOnlyInternationSms?: boolean;
2471
+ setAreaCode?: React.Dispatch<React.SetStateAction<string>>;
2472
+ cancelBackfill?: boolean;
2473
+ }): void;
2474
+ /**
2475
+ * 多账号统一状态管理
2476
+ * @param setLoginWay
2477
+ * @returns
2478
+ */
2479
+ function useLoginMultiple(setLoginWay: React.Dispatch<any>): {
2480
+ isMultipleAccount: boolean;
2481
+ multipleInstance: {
2482
+ initStore: (appId: string, options: {
2483
+ serverSideLoginMethods: LoginWay[];
2484
+ isInternationSms: boolean;
2485
+ }) => void;
2486
+ setLoginWay: (tab: "input" | "qrcode", way: LoginWay, id?: string | undefined, internation?: {
2487
+ phoneCountryCode: string;
2488
+ areaCode: string;
2489
+ } | undefined) => void;
2490
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
2491
+ id: string;
2492
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
2493
+ setLoginWayByHttpData: (account: string, data: {
2494
+ username?: string | undefined;
2495
+ phone?: string | undefined;
2496
+ email?: string | undefined;
2497
+ }) => void;
2498
+ getMemoUser: (excludeWays?: LoginWay[]) => import("@authing/react-ui-components/components/Login/multipleAccounts/panel").SelectOptions[];
2499
+ getMemoSingleUser: (id: string) => {
2500
+ way: LoginWay;
2501
+ account: string;
2502
+ } | undefined;
2503
+ delUserById: (id: string) => string;
2504
+ getMemberState: () => boolean;
2505
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
2506
+ getOriginAccount: () => string;
2507
+ } | undefined;
2508
+ referMultipleState: ((type: "login" | "multiple") => void) | undefined;
2509
+ backfillData: BackFillMultipleState | undefined;
2510
+ defaultQrWay: string | undefined;
2511
+ };
2512
+ export { useLoginMultipleBackFill, useLoginMultiple };
2513
+
2090
2514
  }
2091
2515
  declare module '@authing/react-ui-components/components/Login/index' {
2092
2516
  /// <reference types="react" />
@@ -2135,6 +2559,79 @@ declare module '@authing/react-ui-components/components/Login/interface' {
2135
2559
  }
2136
2560
  export const getDefaultLoginConfig: () => LoginConfig;
2137
2561
 
2562
+ }
2563
+ declare module '@authing/react-ui-components/components/Login/multipleAccounts/index' {
2564
+ import React from 'react';
2565
+ import { LoginWay, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2566
+ import { GuardModuleType } from '@authing/react-ui-components/components/Guard/index';
2567
+ interface MultipleAccountsProps {
2568
+ /**
2569
+ * 多账号存储实例
2570
+ */
2571
+ multipleInstance?: StoreInstance;
2572
+ /**
2573
+ * 切换 Guard 方法
2574
+ */
2575
+ changeModule?: (moduleName: GuardModuleType, initData?: any) => Promise<void>;
2576
+ /**
2577
+ * 切换多账号状态
2578
+ */
2579
+ referMultipleState?: (type: 'login' | 'multiple', data?: {
2580
+ account: string;
2581
+ way: LoginWay;
2582
+ }) => void;
2583
+ }
2584
+ const MultipleAccounts: React.NamedExoticComponent<MultipleAccountsProps>;
2585
+ export { MultipleAccounts };
2586
+
2587
+ }
2588
+ declare module '@authing/react-ui-components/components/Login/multipleAccounts/panel' {
2589
+ import React from 'react';
2590
+ import './style.less';
2591
+ interface SelectPanelProps {
2592
+ lists: SelectOptions[];
2593
+ /**
2594
+ * 点击删除
2595
+ */
2596
+ handleDel: (id: string) => void;
2597
+ /**
2598
+ * 点击 li
2599
+ */
2600
+ onClick: (id: string) => void;
2601
+ }
2602
+ export interface SelectOptions {
2603
+ /**
2604
+ * 头像
2605
+ */
2606
+ photo?: string;
2607
+ /**
2608
+ * 标题
2609
+ */
2610
+ title?: string;
2611
+ /**
2612
+ * 描述
2613
+ */
2614
+ description?: string;
2615
+ /**
2616
+ * 用户 ID 唯一标识符
2617
+ */
2618
+ id: string | 'other';
2619
+ /**
2620
+ * 显示操作栏 default: true
2621
+ */
2622
+ operation?: boolean;
2623
+ /**
2624
+ * 登录时间
2625
+ */
2626
+ _updateTime: number;
2627
+ /**
2628
+ * 替代图片元素
2629
+ */
2630
+ element?: React.ReactElement;
2631
+ }
2632
+ const SelectPanel: React.FC<SelectPanelProps>;
2633
+ export { SelectPanel };
2634
+
2138
2635
  }
2139
2636
  declare module '@authing/react-ui-components/components/Login/socialLogin/IdpButton/index' {
2140
2637
  /// <reference types="react" />
@@ -2146,6 +2643,7 @@ declare module '@authing/react-ui-components/components/Login/socialLogin/index'
2146
2643
  import { ApplicationConfig, SocialConnectionItem } from '@authing/react-ui-components/components/AuthingGuard/api/index';
2147
2644
  import './style.less';
2148
2645
  import { GuardLocalConfig } from '@authing/react-ui-components/components/Guard/index';
2646
+ import { StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
2149
2647
  export interface SocialLoginProps {
2150
2648
  appId: string;
2151
2649
  config: GuardLocalConfig;
@@ -2153,6 +2651,10 @@ declare module '@authing/react-ui-components/components/Login/socialLogin/index'
2153
2651
  onLoginSuccess: any;
2154
2652
  enterpriseConnectionObjs: ApplicationConfig['identityProviders'];
2155
2653
  socialConnectionObjs: SocialConnectionItem[];
2654
+ /**
2655
+ * 根据输入的账号 & 返回获得对应的登录方法
2656
+ */
2657
+ multipleInstance?: StoreInstance;
2156
2658
  }
2157
2659
  export const SocialLogin: React.FC<SocialLoginProps>;
2158
2660
 
@@ -2429,233 +2931,6 @@ declare module '@authing/react-ui-components/components/NeedHelpView/index' {
2429
2931
  /// <reference types="react" />
2430
2932
  export const GuardNeedHelpView: (props: any) => JSX.Element;
2431
2933
 
2432
- }
2433
- declare module '@authing/react-ui-components/components/Qrcode/UiQrCode' {
2434
- import React from 'react';
2435
- import './index.less';
2436
- import { CodeStatusDescriptions } from '@authing/react-ui-components/components/Qrcode/WorkQrCode';
2437
- export type CodeStatus = 'loading' | 'ready' | 'already' | 'success' | 'error' | 'expired' | 'cancel' | 'MFA';
2438
- export const prefix = "refactor";
2439
- export interface UiQrProps {
2440
- /**
2441
- * Loading 组件
2442
- */
2443
- loadingComponent?: React.ReactElement;
2444
- /**
2445
- * 二维码组件三种状态
2446
- * ready 准备状态
2447
- * already 已扫描状态
2448
- * success 扫描成功/登录成功状态
2449
- * error 错误状态(超时、网络错误)
2450
- */
2451
- status: CodeStatus;
2452
- /**
2453
- * 二维码 URL
2454
- */
2455
- src?: string;
2456
- /**
2457
- * 二维码底部内容
2458
- */
2459
- descriptions: CodeStatusDescriptions;
2460
- /**
2461
- * 外层 container 样式
2462
- */
2463
- containerStyle?: React.CSSProperties;
2464
- /**
2465
- * 内层 container 样式(图片)
2466
- */
2467
- imageStyle?: React.CSSProperties;
2468
- /**
2469
- * 二维码图片准备好的回调
2470
- */
2471
- onLoad?: () => void;
2472
- /**
2473
- * 点击遮罩中的内容区
2474
- * status 当前组件所处状态
2475
- */
2476
- onClickMaskEl?: (status: CodeStatus) => void;
2477
- /**
2478
- * 点击全部遮罩区域
2479
- * status 当前组件所处状态
2480
- */
2481
- onMaskContent?: (status: CodeStatus) => void;
2482
- }
2483
- const UiQrCode: React.NamedExoticComponent<UiQrProps>;
2484
- export { UiQrCode };
2485
-
2486
- }
2487
- declare module '@authing/react-ui-components/components/Qrcode/WorkQrCode' {
2488
- import React from 'react';
2489
- import { QrCodeResponse } from '@authing/react-ui-components/components/Qrcode/hooks/usePostQrCode';
2490
- import { CodeStatus, UiQrProps } from '@authing/react-ui-components/components/Qrcode/UiQrCode';
2491
- /**
2492
- * 二维码不同状态下的底部描述文字
2493
- */
2494
- export type CodeStatusDescriptions = Partial<Record<Exclude<CodeStatus, 'loading'>, React.ReactNode | ((referQrCode?: () => void) => React.ReactNode)>>;
2495
- export interface WorkQrCodeRef {
2496
- referQrCode: () => Promise<{
2497
- random: string;
2498
- url: string;
2499
- } | undefined>;
2500
- }
2501
- interface WorkQrCodeProps extends Omit<UiQrProps, 'description' | 'status'> {
2502
- /**
2503
- * 二维码场景
2504
- */
2505
- scene: 'WXAPP_AUTH' | 'APP_AUTH' | 'WECHATMP_AUTH';
2506
- /**
2507
- * 不同状态请求文字
2508
- */
2509
- descriptions: CodeStatusDescriptions;
2510
- /**
2511
- * 睡眠时间 默认 1000
2512
- */
2513
- sleepTime?: number;
2514
- /**
2515
- * 每当状态变化时,触发的 callback 。
2516
- */
2517
- onStatusChange?: (status: CodeStatus, data: QrCodeResponse) => void;
2518
- /**
2519
- * 不同状态下点击遮罩中间区域方法
2520
- */
2521
- onClickMaskContent?: (status: CodeStatus) => void;
2522
- }
2523
- const WorkQrCode: React.ForwardRefExoticComponent<WorkQrCodeProps & React.RefAttributes<any>>;
2524
- export { WorkQrCode };
2525
-
2526
- }
2527
- declare module '@authing/react-ui-components/components/Qrcode/hooks/useImage' {
2528
- const useImage: (src: string | undefined, options: {
2529
- onLoad?: (() => void) | undefined;
2530
- }) => (string | undefined)[];
2531
- export { useImage };
2532
-
2533
- }
2534
- declare module '@authing/react-ui-components/components/Qrcode/hooks/usePostQrCode' {
2535
- /// <reference types="react" />
2536
- import { AuthingGuardResponse, AuthingResponse } from '@authing/react-ui-components/components/_utils/http';
2537
- import { CodeStatus } from '@authing/react-ui-components/components/Qrcode/UiQrCode';
2538
- import { CodeStatusDescriptions } from '@authing/react-ui-components/components/Qrcode/WorkQrCode';
2539
- import { ReducerType, RootState } from '@authing/react-ui-components/components/Qrcode/hooks/usePreQrCode';
2540
- export interface QrCodeResponse {
2541
- /**
2542
- * 根据状态确定不同的流程
2543
- */
2544
- status: number;
2545
- /**
2546
- * 返回的随机值
2547
- */
2548
- random: number;
2549
- /**
2550
- * 返回的用户信息
2551
- */
2552
- userInfo?: any;
2553
- /**
2554
- * 扫码成功后 Tick 换取用户信息
2555
- */
2556
- ticket?: string;
2557
- /**
2558
- * MFA 状态下的返回
2559
- */
2560
- scannedResult?: AuthingResponse;
2561
- }
2562
- /**
2563
- * 二维码请求相关
2564
- */
2565
- interface QrCodeRequest {
2566
- genCodeRequest?: () => Promise<AuthingGuardResponse<{
2567
- random: string;
2568
- url: string;
2569
- }>>;
2570
- /**
2571
- * 未扫码下的请求方法
2572
- */
2573
- readyCheckedRequest?: () => Promise<AuthingGuardResponse<QrCodeResponse>>;
2574
- /**
2575
- * 已经扫码下的请求方法(待确认)
2576
- */
2577
- alreadyCheckedRequest?: () => Promise<AuthingGuardResponse<QrCodeResponse>>;
2578
- /**
2579
- * 使用 ticket 交换用户信息
2580
- */
2581
- exchangeUserInfo?: (ticket: string) => Promise<any>;
2582
- }
2583
- interface QrCodeOptions {
2584
- state: RootState;
2585
- dispatch: React.Dispatch<{
2586
- type: ReducerType;
2587
- payload: Partial<RootState>;
2588
- }>;
2589
- descriptions: CodeStatusDescriptions;
2590
- sleepTime?: number;
2591
- /**
2592
- * 状态改变时触发事件,仅在 Server 返回的二维码状态改变时进行触发
2593
- */
2594
- onStatusChange?: (status: CodeStatus, data: QrCodeResponse) => void;
2595
- }
2596
- /**
2597
- * 二维码处理阶段
2598
- * 二维码处理阶段分为两个主要流程
2599
- * 1. 同一状态下的轮询逻辑处理
2600
- * 2. 根据不同返回状态码进行处理
2601
- */
2602
- export const useQrCode: (options: QrCodeOptions, request: QrCodeRequest) => void;
2603
- export {};
2604
-
2605
- }
2606
- declare module '@authing/react-ui-components/components/Qrcode/hooks/usePreQrCode' {
2607
- /// <reference types="react" />
2608
- import { CodeStatus } from '@authing/react-ui-components/components/Qrcode/UiQrCode';
2609
- export type ReducerType = 'change' | 'changeStatus' | 'changeDesc';
2610
- export type RootState = {
2611
- /**
2612
- * 状态
2613
- */
2614
- status: CodeStatus;
2615
- /**
2616
- * 底部描述
2617
- */
2618
- /**
2619
- * 当前二维码 URL
2620
- */
2621
- src?: string;
2622
- /**
2623
- * 二维码随机值
2624
- */
2625
- random?: string;
2626
- };
2627
- /**
2628
- * QrCode 准备阶段 Hook
2629
- */
2630
- const usePreQrCode: () => {
2631
- state: RootState;
2632
- dispatch: import("react").Dispatch<{
2633
- type: ReducerType;
2634
- payload: Partial<RootState>;
2635
- }>;
2636
- };
2637
- export { usePreQrCode };
2638
-
2639
- }
2640
- declare module '@authing/react-ui-components/components/Qrcode/hooks/useStatus' {
2641
- import { CodeStatus } from '@authing/react-ui-components/components/Qrcode/UiQrCode';
2642
- /**
2643
- * 根据不同状态添加不同的元素
2644
- * 维护不同状态的处理
2645
- */
2646
- const useStatus: (status: CodeStatus) => ({} | null | undefined)[];
2647
- export { useStatus };
2648
-
2649
- }
2650
- declare module '@authing/react-ui-components/components/Qrcode/index' {
2651
- import { UiQrCode } from '@authing/react-ui-components/components/Qrcode/UiQrCode';
2652
- import { WorkQrCode } from '@authing/react-ui-components/components/Qrcode/WorkQrCode';
2653
- type IQrCode = typeof WorkQrCode & {
2654
- UI: typeof UiQrCode;
2655
- };
2656
- const QrCode: IQrCode;
2657
- export { QrCode };
2658
-
2659
2934
  }
2660
2935
  declare module '@authing/react-ui-components/components/RecoveryCode/businessRequest' {
2661
2936
  export enum TotpRecoveryCodeBusinessAction {
@@ -3245,6 +3520,7 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3245
3520
  import React from 'react';
3246
3521
  import { GuardEvents, GuardLocalConfig, GuardModuleType, GuardPageConfig } from '@authing/react-ui-components/components/index';
3247
3522
  import { ApplicationConfig } from '@authing/react-ui-components/components/AuthingGuard/api/index';
3523
+ import { BackFillMultipleState, StoreInstance } from '@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts';
3248
3524
  import { ModuleState } from '@authing/react-ui-components/components/Guard/GuardModule/stateMachine';
3249
3525
  import { GuardHttp } from '@authing/react-ui-components/components/_utils/guardHttp';
3250
3526
  export interface IGuardContext {
@@ -3262,6 +3538,29 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3262
3538
  isAuthFlow: boolean;
3263
3539
  contextLoaded: boolean;
3264
3540
  guardPageConfig: Partial<GuardPageConfig>;
3541
+ multipleInstance: {
3542
+ /**
3543
+ * 多账号相关
3544
+ */
3545
+ isMultipleAccount: boolean;
3546
+ /**
3547
+ * when: 多账号页面跳转进入登录页面
3548
+ * 携带的回填数据信息
3549
+ */
3550
+ multipleAccountData?: BackFillMultipleState;
3551
+ /**
3552
+ * 多账号 store 实例
3553
+ */
3554
+ instance?: StoreInstance;
3555
+ /**
3556
+ * 切换多账号 isMultipleAccount 状态
3557
+ */
3558
+ referMultipleState?: (type: 'login' | 'multiple') => void;
3559
+ /**
3560
+ * 清空回填数据
3561
+ */
3562
+ clearBackFillData?: () => void;
3563
+ };
3265
3564
  }
3266
3565
  export const createGuardXContext: () => {
3267
3566
  Provider: React.FC<{
@@ -3299,6 +3598,58 @@ declare module '@authing/react-ui-components/components/_utils/context' {
3299
3598
  export const useGuardContextLoaded: () => boolean;
3300
3599
  export const useGuardIsAuthFlow: () => boolean;
3301
3600
  export const useGuardPageConfig: () => Partial<GuardPageConfig>;
3601
+ /**
3602
+ * 多账号登录 store 实例
3603
+ */
3604
+ export const useGuardMultipleInstance: () => {
3605
+ /**
3606
+ * 多账号相关
3607
+ */
3608
+ isMultipleAccount: boolean;
3609
+ /**
3610
+ * when: 多账号页面跳转进入登录页面
3611
+ * 携带的回填数据信息
3612
+ */
3613
+ multipleAccountData?: BackFillMultipleState | undefined;
3614
+ /**
3615
+ * 多账号 store 实例
3616
+ */
3617
+ instance?: {
3618
+ initStore: (appId: string, options: {
3619
+ serverSideLoginMethods: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[];
3620
+ isInternationSms: boolean;
3621
+ }) => void;
3622
+ setLoginWay: (tab: "input" | "qrcode", way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay, id?: string | undefined, internation?: {
3623
+ phoneCountryCode: string;
3624
+ areaCode: string;
3625
+ } | undefined) => void;
3626
+ setUserInfo: (user: Pick<import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").User & {
3627
+ id: string;
3628
+ }, "email" | "username" | "phone" | "id" | "nickname" | "photo" | "name" | "_updateTime" | "qrCodeId" | "areaCode">) => void;
3629
+ setLoginWayByHttpData: (account: string, data: {
3630
+ username?: string | undefined;
3631
+ phone?: string | undefined;
3632
+ email?: string | undefined;
3633
+ }) => void;
3634
+ getMemoUser: (excludeWays?: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay[]) => import("../Login/multipleAccounts/panel").SelectOptions[];
3635
+ getMemoSingleUser: (id: string) => {
3636
+ way: import("@authing/react-ui-components/components/Guard/core/hooks/useMultipleAccounts").LoginWay;
3637
+ account: string;
3638
+ } | undefined;
3639
+ delUserById: (id: string) => string;
3640
+ getMemberState: () => boolean;
3641
+ getFirstBackFillData: () => BackFillMultipleState | undefined;
3642
+ getOriginAccount: () => string;
3643
+ } | undefined;
3644
+ /**
3645
+ * 切换多账号 isMultipleAccount 状态
3646
+ */
3647
+ referMultipleState?: ((type: 'login' | 'multiple') => void) | undefined;
3648
+ /**
3649
+ * 清空回填数据
3650
+ */
3651
+ clearBackFillData?: (() => void) | undefined;
3652
+ };
3302
3653
 
3303
3654
  }
3304
3655
  declare module '@authing/react-ui-components/components/_utils/corsVerification' {
@@ -3509,7 +3860,11 @@ declare module '@authing/react-ui-components/components/_utils/index' {
3509
3860
  * @param ...sources
3510
3861
  */
3511
3862
  export function deepMerge<T extends any = any>(target: T, ...sources: any[]): T;
3512
- export const getUserRegisterParams: () => {
3863
+ /**
3864
+ * 在托管页下上传query中指定的用户自定义字段进行补全
3865
+ * @param params 指定上传的用户自定义字段
3866
+ */
3867
+ export const getUserRegisterParams: (params?: string[] | undefined) => {
3513
3868
  key: string;
3514
3869
  value: string | string[] | qs.ParsedQs | qs.ParsedQs[] | undefined;
3515
3870
  }[];
@@ -3763,7 +4118,7 @@ declare module '@authing/react-ui-components/components/version/index' {
3763
4118
 
3764
4119
  }
3765
4120
  declare module '@authing/react-ui-components/components/version/version' {
3766
- const _default: "3.1.37-beta.0";
4121
+ const _default: "3.1.37-beta.3";
3767
4122
  export default _default;
3768
4123
 
3769
4124
  }