import React, { ReactNode } from 'react'; import { DeviceStatusType, StatusType, ModeType, RouteType, ClientEnum } from '../const'; import { ThunkDispatch } from './useThunkReducer'; export declare enum EActionTypes { UPDATE_INIT = "UPDATE_INIT", UPDATE_CUSTOM = "UPDATE_CUSTOM", UPDATE_KEY = "UPDATE_KEY", UPDATE_STEP_KEY = "UPDATE_STEP_KEY", UPDATE_DEVICE = "UPDATE_DEVICE", UPDATE_NEXT_STEP = "UPDATE_NEXT_STEP", UPDATE_STATUS = "UPDATE_STATUS", UPDATE_TITLE = "UPDATE_TITLE", UPDATE_LOADING = "UPDATE_LOADING", UPDATE_COMPONENT = "UPDATE_COMPONENT", UPDATE_STEPS = "UPDATE_STEPS", UPDATE_STEP_CURRENT_ITEM_CUSTOM = "UPDATE_STEP_CURRENT_ITEM_CUSTOM", UPDATE_STEP_ITEM = "UPDATE_STEP_ITEM", BACKUP_PRODUCTION = "BACKUP_PRODUCTION", BACKUP_FREE = "BACKUP_FREE", UPDATE_CLIENT = "UPDATE_CLIENT" } export declare type State = { /** 支付名称 */ name: string; /** 金额单位 */ symbol: string; /** 支付原始金额 */ amount: string | number; /** 模式 */ mode: ModeType; /** 订单号 */ order_id: string | number; /** 厂商 */ eftpos: DeviceStatusType; action?: RouteType; /** 用于重置页面特指 =》全部步骤 */ key: number; /** 当前执行到哪一步了 */ step: number; /** 标题 */ title: string; /** 标题 */ subTitle?: string; /** step : 常规步骤页面 ,unset 自定义页面 */ type: 'step' | 'unset'; render: boolean; /** 网络 */ net?: boolean; /** 上面 unset 自定义页面,这里需要指定到具体页面 */ component: string; form?: string; /** 页面状态 */ status: StatusType; /** 警告文案 */ warn: string; steps: { /** 用于重置当前步骤 */ key: number; title?: string; text?: string; warn?: string; tip?: string; success?: string; fail?: string; loading?: string; /** 步骤状态 */ status: StatusType; custom?: { /** 步骤自定义 */ [key: string]: unknown; }; }[]; /** 支付流水号 */ number?: string | number; /** 设备信息 */ device?: { [key: string]: unknown; }; /** 支付信息 */ pay?: { [key: string]: unknown; }; custom?: { [key: string]: unknown; }; manual?: { title: string; text: string; status?: boolean; money?: number; }; backup?: Omit; client: ClientEnum; /** 原始参数 - 用于 retry 时完整恢复 */ originalParams?: { [key: string]: any; }; }; export declare type Action = { type: EActionTypes; payload: Partial; }; /** * @title: 刷新 key * @description: 用户重置组件生命周期, * @param {number} key * @Author: hongbing.wang * @Date: 2024-08-19 09:56 */ export declare const updateKey: (key: number) => { type: EActionTypes; payload: { key: number; }; }; /** * @title: 更新设备信息 * @description: 用户选择设备将回填到此处 * @param {object} payload * @Author: hongbing.wang * @Date: 2024-08-19 09:57 */ export declare const updateDevice: (payload: { device: State['device']; }) => { type: EActionTypes; payload: { device: State['device']; }; }; /** * @title: 刷新 步骤key * @description: 重置某一步生命周期 * @Author: hongbing.wang * @Date: 2024-08-19 09:58 */ export declare const updateStepKey: () => { type: EActionTypes; payload: {}; }; /** * @title: 更新至下一步 * @description: 更新至下一步 * @param {string} warn?: 错误信息 * @Author: hongbing.wang * @Date: 2024-08-19 09:58 */ export declare const updateNextStep: (warn?: string) => { type: EActionTypes; payload: { warn: string; } | { warn?: undefined; }; }; /** * @title: 更新自定义信息 * @description: 更新自定义信息 * @param {object} payload * @Author: hongbing.wang * @Date: 2024-08-19 10:03 */ export declare const updateCustom: (payload: { [key: string]: unknown; }) => { type: EActionTypes; payload: { [key: string]: unknown; }; }; /** * @title: 更新 全局状态 * @description: 更新 全局状态 * @param {string} status : 状态 * * @Author: hongbing.wang * @Date: 2024-08-19 10:03 */ export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => { type: EActionTypes; payload: { status: "loading" | "success" | "warn" | "fail" | "question"; }; }; /** * @title: 更新自定义组件 * @description: 更新自定义组件 * @param {string} component 组件名称 * @param {boolean} render : true : 隐藏 原组件(维持原组件内状态) ;false : 卸载 * @return {*} * @Author: hongbing.wang * @Date: 2024-08-19 10:04 */ export declare const updateComponent: (component: string, render?: boolean) => { type: EActionTypes; payload: { readonly component: string; readonly type: "unset"; readonly render: boolean; } | { readonly type: "step"; readonly render: boolean; readonly component?: undefined; }; }; /** * @title: 更新步骤信息 * @description: 更新某一步骤信息 * @param {State} steps 某一步骤信息 * @Author: hongbing.wang * @Date: 2024-08-19 10:07 */ export declare const updateSteps: (steps: State['steps']) => { type: EActionTypes; payload: { steps: { /** 用于重置当前步骤 */ key: number; title?: string | undefined; text?: string | undefined; warn?: string | undefined; tip?: string | undefined; success?: string | undefined; fail?: string | undefined; loading?: string | undefined; /** 步骤状态 */ status: StatusType; custom?: { [key: string]: unknown; } | undefined; }[]; }; }; /** * @title: 更新状态管理信息 * @description: 更新状态管理信息 * @param {Partial} payload * @return {*} * @Author: hongbing.wang * @Date: 2024-08-19 10:08 */ export declare const updateState: (payload: Partial) => { type: EActionTypes; payload: Partial; }; /** * @title: 更新当前步骤自定义信息 * @description: 更新当前步骤自定义信息 * @Author: hongbing.wang * @Date: 2024-08-19 10:09 */ export declare const updateCurrentCustomStemItem: (payload: NonNullable>) => { type: EActionTypes; payload: Partial<{ [key: string]: unknown; }>; }; /** * @title: 更新当前步骤信息 * @description: 更新当前步骤信息 * @Author: hongbing.wang * @Date: 2024-08-19 10:09 */ export declare const updateCurrentStemItem: (payload: any) => { type: EActionTypes; payload: any; }; /** * @title: 更新当前步骤信息 * @description: 更新当前步骤信息 * @Author: hongbing.wang * @Date: 2024-08-19 10:09 */ export declare const updateClient: (payload: ClientEnum) => { type: EActionTypes; payload: { client: ClientEnum; }; }; /** * @title: 更新备份信息 * @description: 更新备份信息 * @Author: hongbing.wang * @Date: 2024-08-19 10:25 */ export declare const backUpProduction: (payload: Partial) => { type: EActionTypes; payload: Partial; }; /** * @title: 释放备份信息 * @description: 释放备份信息 * @param {Partial} payload * @Author: hongbing.wang * @Date: 2024-08-19 10:27 */ export declare const backUpFree: (payload: Partial) => { type: EActionTypes; payload: { name?: string | undefined; symbol?: string | undefined; amount?: string | number | undefined; mode?: "pay" | "refund" | "fullPay" | "query" | undefined; order_id?: string | number | undefined; eftpos?: "mx51" | "tyro" | "windcave" | "payo" | "stripe" | "linkly" | "huifu" | "adyenpos" | "adyenalipay" | "adyenwechat" | undefined; action?: "pay" | "amount" | "deviceList" | undefined; key?: number | undefined; step?: number | undefined; title?: string | undefined; subTitle?: string | undefined; type?: "unset" | "step" | undefined; render?: boolean | undefined; net?: boolean | undefined; component?: string | undefined; form?: string | undefined; status?: "loading" | "success" | "warn" | "fail" | "init" | "pedding" | "resove" | "reject" | "question" | undefined; warn?: string | undefined; steps?: { /** 用于重置当前步骤 */ key: number; title?: string | undefined; text?: string | undefined; warn?: string | undefined; tip?: string | undefined; success?: string | undefined; fail?: string | undefined; loading?: string | undefined; /** 步骤状态 */ status: StatusType; custom?: { [key: string]: unknown; } | undefined; }[] | undefined; number?: string | number | undefined; device?: { [key: string]: unknown; } | undefined; pay?: { [key: string]: unknown; } | undefined; custom?: { [key: string]: unknown; } | undefined; manual?: { title: string; text: string; status?: boolean | undefined; money?: number | undefined; } | undefined; backup?: Omit | undefined; client?: ClientEnum | undefined; originalParams?: { [key: string]: any; } | undefined; }; }; export declare function reducers(state: State, action: Action): State; export declare const Provider: ({ children, state: providerState, }: { children: ReactNode; state?: State | undefined; }) => React.JSX.Element; export declare function useContextData(): State; export declare function useDispatch(): ThunkDispatch;