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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1943,9 +1943,8 @@ declare module '@authing/react-ui-components/components/Login/core/withAppQrcode
1943
1943
  interface LoginWithAppQrcodeProps {
1944
1944
  onLoginSuccess: any;
1945
1945
  canLoop: boolean;
1946
- qrCodeScanOptions: any;
1947
1946
  }
1948
- export const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element;
1947
+ export const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element | null;
1949
1948
  export {};
1950
1949
 
1951
1950
  }
@@ -2074,9 +2073,8 @@ declare module '@authing/react-ui-components/components/Login/core/withWechatMin
2074
2073
  interface LoginWithWechatMiniQrcodeProps {
2075
2074
  onLoginSuccess: any;
2076
2075
  canLoop: boolean;
2077
- qrCodeScanOptions: any;
2078
2076
  }
2079
- export const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element;
2077
+ export const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element | null;
2080
2078
  export {};
2081
2079
 
2082
2080
  }
@@ -2085,9 +2083,8 @@ declare module '@authing/react-ui-components/components/Login/core/withWechatmpQ
2085
2083
  interface LoginWithWechatmpQrcodeProps {
2086
2084
  onLoginSuccess: any;
2087
2085
  canLoop: boolean;
2088
- qrCodeScanOptions: any;
2089
2086
  }
2090
- export const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element;
2087
+ export const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element | null;
2091
2088
  export {};
2092
2089
 
2093
2090
  }
@@ -2432,6 +2429,233 @@ declare module '@authing/react-ui-components/components/NeedHelpView/index' {
2432
2429
  /// <reference types="react" />
2433
2430
  export const GuardNeedHelpView: (props: any) => JSX.Element;
2434
2431
 
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
+
2435
2659
  }
2436
2660
  declare module '@authing/react-ui-components/components/RecoveryCode/businessRequest' {
2437
2661
  export enum TotpRecoveryCodeBusinessAction {
@@ -3285,11 +3509,7 @@ declare module '@authing/react-ui-components/components/_utils/index' {
3285
3509
  * @param ...sources
3286
3510
  */
3287
3511
  export function deepMerge<T extends any = any>(target: T, ...sources: any[]): T;
3288
- /**
3289
- * 在托管页下上传query中指定的用户自定义字段进行补全
3290
- * @param params 指定上传的用户自定义字段
3291
- */
3292
- export const getUserRegisterParams: (params?: string[] | undefined) => {
3512
+ export const getUserRegisterParams: () => {
3293
3513
  key: string;
3294
3514
  value: string | string[] | qs.ParsedQs | qs.ParsedQs[] | undefined;
3295
3515
  }[];
@@ -3543,7 +3763,7 @@ declare module '@authing/react-ui-components/components/version/index' {
3543
3763
 
3544
3764
  }
3545
3765
  declare module '@authing/react-ui-components/components/version/version' {
3546
- const _default: "3.1.35";
3766
+ const _default: "3.1.37-beta.0";
3547
3767
  export default _default;
3548
3768
 
3549
3769
  }