/** * 支付页 schema 描述当前执行页的展示结构。 * 它只承载数据协议,不包含 React 组件、DOM 或样式实现。 */ import type { EftposProvider, PaymentMode, PaymentSchemaActionType } from './types'; /** 支付执行页允许展示的业务状态。 */ export declare type PaymentPageSchemaStatus = 'processing' | 'actionRequired'; /** 支付执行页允许展示的图标名称。 */ export declare type PaymentSchemaIconName = 'loading' | 'success' | 'warning' | 'error'; /** 支付执行页文字的语义色。 */ export declare type PaymentSchemaTextTone = 'normal' | 'warning' | 'danger'; /** 支付执行页按钮的展示风格。 */ export declare type PaymentSchemaButtonVariant = 'primary' | 'default' | 'danger'; /** 支付执行页步骤状态。 */ export declare type PaymentSchemaStepStatus = 'pending' | 'success' | 'failed'; /** * schema button 触发的标准动作。 * UI 不理解 provider 私有语义,只把 action 原样交回 session。 */ export interface PaymentSchemaAction { /** 标准动作类型,同时作为 SDK 内部 action lock 的 key。 */ type: PaymentSchemaActionType; /** provider 或 route 需要继续传递的动作载荷。 */ payload?: Record; } /** 支付执行页 schema 中的图标 item。 */ export interface PaymentSchemaIconItem { /** item 类型。 */ type: 'icon'; /** 图标名称。 */ name: PaymentSchemaIconName; /** loading 图标是否旋转。 */ spinning?: boolean; } /** 支付执行页 schema 中的文字 item。 */ export interface PaymentSchemaTextItem { /** item 类型。 */ type: 'text'; /** 展示文案。 */ text: string; /** 文案语义色。 */ tone?: PaymentSchemaTextTone; /** 是否允许多行展示。 */ multiline?: boolean; } /** 支付执行页 schema 中的标题 item。 */ export interface PaymentSchemaTitleItem { /** item 类型。 */ type: 'title'; /** 标题文案。 */ text: string; } /** 支付执行页 schema 中的按钮 item。 */ export interface PaymentSchemaButtonItem { /** item 类型。 */ type: 'button'; /** 按钮文案。 */ label: string; /** 按钮展示风格。 */ variant?: PaymentSchemaButtonVariant; /** 是否禁用按钮。 */ disabled?: boolean; /** 点击后是否展示 loading。 */ loading?: boolean; /** 点击后交回 SDK 的标准动作。 */ action: PaymentSchemaAction; } /** 支付执行页输入框 item。 */ export interface PaymentSchemaInputItem { type: 'input'; name: string; label?: string; placeholder?: string; defaultValue?: string; disabled?: boolean; } /** 支付执行页图片 item。 */ export interface PaymentSchemaImageItem { type: 'image'; src: string; alt?: string; } /** 支付执行页中的步骤 item。 */ export interface PaymentSchemaStepItem { /** item 类型。 */ type: 'step'; /** 步骤文案。 */ text: string; /** 步骤状态。 */ status: PaymentSchemaStepStatus; } /** 支付执行页 schema item 白名单。 */ export declare type PaymentSchemaItem = PaymentSchemaIconItem | PaymentSchemaTitleItem | PaymentSchemaTextItem | PaymentSchemaButtonItem | PaymentSchemaStepItem | PaymentSchemaInputItem | PaymentSchemaImageItem; /** 支付执行页的一行内容。 */ export interface PaymentSchemaRow { /** 行唯一标识,用于 React key 和日志定位。 */ id: string; /** 行布局,默认 horizontal。 */ layout?: 'horizontal' | 'vertical'; /** 当前行内的 item 列表。 */ items: PaymentSchemaItem[]; } /** eftpos 支付执行页完整 schema。 */ export interface PaymentPageSchema { /** 当前 schema 所属支付路线。 */ route: 'eftpos'; /** 当前 schema 所属刷卡机 provider。 */ provider: EftposProvider; /** 当前交易模式。 */ mode: PaymentMode; /** 当前后端 payment handle。 */ number: string; /** 当前执行页状态。 */ status: PaymentPageSchemaStatus; /** 可选标题。 */ title?: string; /** 完整 rows 展示结构。 */ rows: PaymentSchemaRow[]; /** provider 原始或半原始响应,仅用于排障和日志。 */ raw?: unknown; }