import { BaseResponsiveProps } from "../../responsive/type.js"; import { SalesSdkCartContextValue, SalesSdkContextValue, SalesSdkCustomerContextValue, SalesSdkProviderProps, SalesSdkSummaryContextValue } from "../salesSdk/types.js"; import { SalesSdkBookingContextValue } from "../salesSdk/context/SalesSdkBookingContext.js"; import { DetailActionConfig, DetailActionsLayoutConfig } from "./components/DetailActions/types.js"; import { PromotionWalletPanelsProps } from "./components/PromotionWalletPanels/index.js"; import { SaleWalletAssetsCleanupCoordinator } from "./components/PromotionWalletPanels/useSaleWalletAssets.js"; import { ReactNode } from "react"; import * as _$_pisell_materials0 from "@pisell/materials"; //#region src/plus/saleDetail/types.d.ts type SaleDetailRenderType = 'current' | 'modal' | 'drawer'; type SaleDetailTemplate = 'A' | 'B'; type SaleDetailMobilePresentation = 'inline' | 'bottomSheet'; type SaleDetailModuleKey = 'overview' | 'customer' | 'contact' | 'orderNote' | 'cartItems' | 'cartActions' | 'amountDetails' | 'orderActions' | 'promotionAlert' | 'promotionWalletPanels'; interface SaleDetailCartItemsLayoutConfig { columns?: number; } interface SaleDetailModuleConfig { hidden?: SaleDetailModuleKey[]; cartItems?: { layout?: SaleDetailCartItemsLayoutConfig; showBookingItems?: boolean; showProductItems?: boolean; showProductImage?: boolean; /** 是否展示商品图片左上角的数量角标,默认展示。 */ showQuantityBadge?: boolean; showRemoveButton?: boolean; /** 是否显示卡片内部的小删除按钮;默认跟随 showRemoveButton。 */ showInlineRemoveButton?: boolean; /** 右侧数量与删除操作的展示方式;inline 时与卡片永久平铺。 */ rightActionsDisplay?: 'swipe' | 'inline'; /** 预约商品数量的交互方式;hidden 不在购物车操作区展示数量。 */ bookingQuantityMode?: 'editable' | 'hidden'; /** 独立开启商品行备注编辑;不影响改规格、数量或删除等其它编辑权限。 */ lineNoteEditingEnabled?: boolean; /** 删除商品前的可选确认钩子;返回 false 时取消删除。 */ confirmRemoveItem?: (item: any) => boolean | Promise; /** 数量已全选时,删除键是否一次清空整个输入值。 */ clearSelectedQuantityOnDelete?: boolean; /** 商品行使用的共享 ProductCard.LineItem 变体;默认保持 a9。 */ productLineItemType?: 'a2' | 'a5' | 'a9' | 'a12'; /** A12 的跨业务外观配置;不承载数量、删除等业务行为。 */ productLineItemPresentation?: _$_pisell_materials0.CartSkuCardA12Presentation; /** A12 编辑入口的业务判定;未配置时不展示编辑按钮。 */ isProductLineItemEditable?: (item: any) => boolean; /** A12 编辑入口的业务动作,由宿主决定打开弹窗或跳转页面。 */ onProductLineItemEdit?: (item: any) => void | Promise; }; amountDetails?: { defaultExpanded?: boolean; }; /** * 购物车底部、Summary 上方的 Promotion / Wallet Assets 折叠面板。 * 不传时由 Template A 接入当前购物车促销与折扣卡/商品券;传对象时完整覆盖默认内容。 */ promotionWalletPanels?: PromotionWalletPanelsProps | false; /** Promotion / Wallet 面板的配色;默认为原有深色。 */ promotionWalletPanelsAppearance?: PromotionWalletPanelsProps['appearance']; /** * Promotion / Wallet 面板的业务行为开关。默认关闭,避免影响通用 SaleDetail。 */ promotionWalletPanelsBehavior?: { /** BigSale:空购物车展示客户卡券,并允许从卡券入口加购适用商品。 */enableVoucherProductAdd?: boolean; /** BigSale:使用 BaseSales 共享 Wallet Assets 状态。 */ enableWalletAssets?: boolean; /** Kiosk:资产重新校验期间保留已有内容,防止购物车滚动区域高度跳变。 */ preserveWalletAssetsWhileRefreshing?: boolean; /** Kiosk:让商品列表和购物车共享同一次 Walk-In 清理结果。 */ walletAssetsCleanupCoordinator?: SaleWalletAssetsCleanupCoordinator; /** Kiosk:始终展示 Promotion 面板,并提供手动输入券码入口。 */ enableManualPromotionCode?: boolean; /** Kiosk:在 Promotion 折叠区上方展示动画引导横幅。 */ enablePromotionBanner?: boolean; /** Kiosk:外部控制手动券码 Find 的打开状态。 */ manualPromotionCodeOpen?: boolean; /** Kiosk:接收手动券码 Find 的打开状态变化。 */ onManualPromotionCodeOpenChange?: (open: boolean) => void; }; /** * 覆盖模板 A 底部订单操作按钮;不传时使用默认 TEMPLATE_A_ACTIONS。 * * @example * { orderActions: [{ key: 'note' }, { key: 'save' }, { key: 'checkout-cart' }] } */ orderActions?: DetailActionConfig[]; /** Template A Footer 的 action 排布;BigSale Standard 使用单行溢出。 */ orderActionsLayout?: DetailActionsLayoutConfig; } interface SaleDetailContext { sales: SalesSdkContextValue; customer: SalesSdkCustomerContextValue; cart: SalesSdkCartContextValue; summary: SalesSdkSummaryContextValue; booking?: SalesSdkBookingContextValue; /** * 弹窗场景(如 BigSaleDialog)在保存 / 结账成功后回调,用于关闭外层容器。 * * @example * onOrderComplete?.({ type: 'save', order_id: 123, reset: true }); */ onOrderComplete?: (payload: SaleDetailOrderCompletePayload) => void; } /** 对齐 TicketBookingDialog callback 的 save / checkout 语义。 */ interface SaleDetailOrderCompletePayload { type: 'save' | 'checkout'; data?: any; order_id?: number | string; reset?: boolean; } type SaleOrderExternalPaymentSettlement = { status: 'success'; result: any; } | { status: 'failed'; error: string; payments?: any[]; } | { status: 'cancelled'; }; type SaleOrderExternalPaymentResult = { requestId: string; } & SaleOrderExternalPaymentSettlement; interface SaleDetailBaseProps extends BaseResponsiveProps { context?: SaleDetailContext; tmpl?: SaleDetailTemplate; template?: SaleDetailTemplate; moduleConfig?: SaleDetailModuleConfig; mobilePresentation?: SaleDetailMobilePresentation; /** * 仅模板 B 的 summary tab 生效:开启后将「金额明细 + 底部金额汇总/操作按钮」 * 抽到右侧独立列,与左侧订单内容形成两栏(宽度不足时自动回落为单栏堆叠), * 同时底部操作按钮改为一行一个。默认 false,不影响其他用法。 */ summaryTwoColumn?: boolean; } interface SaleDetailSdkProviderProps { osProps: Pick; } type SaleDetailBaseComponentProps = SaleDetailBaseProps & ({ renderType?: 'current'; containerProps?: never; } | { renderType: Exclude; containerProps: Record; }); type SaleDetailProps = SaleDetailBaseComponentProps & SaleDetailSdkProviderProps; //#endregion export { SaleDetailBaseComponentProps, SaleDetailContext, SaleDetailModuleConfig, SaleDetailModuleKey, SaleDetailOrderCompletePayload, SaleDetailProps, SaleDetailRenderType, SaleDetailTemplate, SaleOrderExternalPaymentResult };