@pisell/pisellos 3.0.56 → 3.0.57
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/dist/core/index.js +2 -1
- package/dist/effects/index.d.ts +4 -3
- package/dist/effects/index.js +15 -6
- package/dist/modules/AccountList/index.d.ts +7 -1
- package/dist/modules/AccountList/index.js +81 -14
- package/dist/modules/AccountList/types.d.ts +28 -0
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
- package/dist/modules/Cart/utils/changePrice.js +1 -1
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Customer/constants.js +12 -0
- package/dist/modules/Customer/index.d.ts +122 -0
- package/dist/modules/Customer/index.js +697 -0
- package/dist/modules/Customer/types.d.ts +146 -0
- package/dist/modules/Customer/types.js +41 -0
- package/dist/modules/Payment/cash.d.ts +11 -0
- package/dist/modules/Payment/cash.js +78 -0
- package/dist/modules/Payment/eftpos.d.ts +11 -0
- package/dist/modules/Payment/eftpos.js +80 -0
- package/dist/modules/Payment/index.d.ts +273 -9
- package/dist/modules/Payment/index.js +2525 -109
- package/dist/modules/Payment/types.d.ts +382 -30
- package/dist/modules/Payment/types.js +116 -14
- package/dist/modules/Payment/wallet.d.ts +11 -0
- package/dist/modules/Payment/wallet.js +78 -0
- package/dist/modules/Payment/walletpass.d.ts +0 -0
- package/dist/modules/Payment/walletpass.js +0 -0
- package/dist/modules/ProductList/index.d.ts +13 -3
- package/dist/modules/ProductList/index.js +52 -42
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +27 -14
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/app-types/app/app.d.ts +83 -0
- package/dist/plugins/app-types/app/const.d.ts +4 -0
- package/dist/plugins/app-types/app/index.d.ts +14 -0
- package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/dist/plugins/app-types/config.d.ts +3 -0
- package/dist/plugins/app-types/cookie/index.d.ts +13 -0
- package/dist/plugins/app-types/data/index.d.ts +8 -0
- package/dist/plugins/app-types/history/config.d.ts +24 -0
- package/dist/plugins/app-types/history/index.d.ts +20 -0
- package/dist/plugins/app-types/history/type.d.ts +2 -0
- package/dist/plugins/app-types/hooks/index.d.ts +12 -0
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/dist/plugins/app-types/index.d.ts +6 -0
- package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
- package/dist/plugins/app-types/locales/en.d.ts +3 -0
- package/dist/plugins/app-types/locales/index.d.ts +37 -0
- package/dist/plugins/app-types/locales/original.d.ts +3 -0
- package/dist/plugins/app-types/locales/type.d.ts +19 -0
- package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
- package/dist/plugins/app-types/logger/index.d.ts +122 -0
- package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
- package/dist/plugins/app-types/models/global.d.ts +32 -0
- package/dist/plugins/app-types/models/index.d.ts +45 -0
- package/dist/plugins/app-types/models/type.d.ts +2 -0
- package/dist/plugins/app-types/package.json +15 -0
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
- package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
- package/dist/plugins/app-types/request/cache.d.ts +46 -0
- package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/dist/plugins/app-types/request/config.d.ts +3 -0
- package/dist/plugins/app-types/request/constants.d.ts +2 -0
- package/dist/plugins/app-types/request/index.d.ts +24 -0
- package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/dist/plugins/app-types/request/type.d.ts +41 -0
- package/dist/plugins/app-types/request/utils.d.ts +46 -0
- package/dist/plugins/app-types/routes/config.d.ts +7 -0
- package/dist/plugins/app-types/routes/index.d.ts +28 -0
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
- package/dist/plugins/app-types/socket/constants.d.ts +33 -0
- package/dist/plugins/app-types/socket/events.d.ts +31 -0
- package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/dist/plugins/app-types/socket/index.d.ts +61 -0
- package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
- package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/dist/plugins/app-types/socket/socket.d.ts +129 -0
- package/dist/plugins/app-types/socket/types.d.ts +85 -0
- package/dist/plugins/app-types/storage/index.d.ts +17 -0
- package/dist/plugins/app-types/tasks/index.d.ts +77 -0
- package/dist/plugins/app-types/tasks/type.d.ts +62 -0
- package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/dist/plugins/app-types/type.d.ts +2 -0
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/dist/plugins/app-types/variables/config.d.ts +3 -0
- package/dist/plugins/app-types/variables/index.d.ts +6 -0
- package/dist/plugins/app-types/variables/type.d.ts +2 -0
- package/dist/plugins/app-types/website/index.d.ts +6 -0
- package/dist/plugins/app.d.ts +8 -0
- package/dist/plugins/app.js +1 -0
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.js +59 -35
- package/dist/solution/BookingByStep/types.d.ts +3 -2
- package/dist/solution/BookingTicket/index.d.ts +172 -0
- package/dist/solution/BookingTicket/index.js +665 -0
- package/dist/solution/BookingTicket/types.d.ts +68 -0
- package/dist/solution/BookingTicket/types.js +43 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
- package/dist/solution/BuyTickets/index.d.ts +2 -2
- package/dist/solution/BuyTickets/index.js +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +181 -0
- package/dist/solution/Checkout/index.js +1596 -0
- package/dist/solution/Checkout/types.d.ts +550 -0
- package/dist/solution/Checkout/types.js +132 -0
- package/dist/solution/Checkout/utils/index.d.ts +73 -0
- package/dist/solution/Checkout/utils/index.js +371 -0
- package/dist/solution/ShopDiscount/index.js +4 -2
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/task.d.ts +40 -0
- package/dist/utils/task.js +171 -0
- package/dist/utils/watch.d.ts +102 -0
- package/dist/utils/watch.js +294 -0
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +4 -3
- package/lib/effects/index.js +4 -1
- package/lib/modules/AccountList/index.d.ts +7 -1
- package/lib/modules/AccountList/index.js +27 -0
- package/lib/modules/AccountList/types.d.ts +28 -0
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
- package/lib/modules/Cart/utils/changePrice.js +1 -1
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Customer/constants.js +39 -0
- package/lib/modules/Customer/index.d.ts +122 -0
- package/lib/modules/Customer/index.js +440 -0
- package/lib/modules/Customer/types.d.ts +146 -0
- package/lib/modules/Customer/types.js +37 -0
- package/lib/modules/Payment/cash.d.ts +11 -0
- package/lib/modules/Payment/cash.js +51 -0
- package/lib/modules/Payment/eftpos.d.ts +11 -0
- package/lib/modules/Payment/eftpos.js +51 -0
- package/lib/modules/Payment/index.d.ts +273 -9
- package/lib/modules/Payment/index.js +1285 -50
- package/lib/modules/Payment/types.d.ts +382 -30
- package/lib/modules/Payment/types.js +41 -6
- package/lib/modules/Payment/wallet.d.ts +11 -0
- package/lib/modules/Payment/wallet.js +51 -0
- package/lib/modules/Payment/walletpass.d.ts +0 -0
- package/lib/modules/Payment/walletpass.js +0 -0
- package/lib/modules/ProductList/index.d.ts +13 -3
- package/lib/modules/ProductList/index.js +37 -26
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/Rules/index.js +20 -12
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -0
- package/lib/plugins/app-types/app/app.d.ts +83 -0
- package/lib/plugins/app-types/app/const.d.ts +4 -0
- package/lib/plugins/app-types/app/index.d.ts +14 -0
- package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/lib/plugins/app-types/config.d.ts +3 -0
- package/lib/plugins/app-types/cookie/index.d.ts +13 -0
- package/lib/plugins/app-types/data/index.d.ts +8 -0
- package/lib/plugins/app-types/history/config.d.ts +24 -0
- package/lib/plugins/app-types/history/index.d.ts +20 -0
- package/lib/plugins/app-types/history/type.d.ts +2 -0
- package/lib/plugins/app-types/hooks/index.d.ts +12 -0
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/lib/plugins/app-types/index.d.ts +6 -0
- package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
- package/lib/plugins/app-types/locales/en.d.ts +3 -0
- package/lib/plugins/app-types/locales/index.d.ts +37 -0
- package/lib/plugins/app-types/locales/original.d.ts +3 -0
- package/lib/plugins/app-types/locales/type.d.ts +19 -0
- package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
- package/lib/plugins/app-types/logger/index.d.ts +122 -0
- package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
- package/lib/plugins/app-types/models/global.d.ts +32 -0
- package/lib/plugins/app-types/models/index.d.ts +45 -0
- package/lib/plugins/app-types/models/type.d.ts +2 -0
- package/lib/plugins/app-types/package.json +15 -0
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
- package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
- package/lib/plugins/app-types/request/cache.d.ts +46 -0
- package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/lib/plugins/app-types/request/config.d.ts +3 -0
- package/lib/plugins/app-types/request/constants.d.ts +2 -0
- package/lib/plugins/app-types/request/index.d.ts +24 -0
- package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/lib/plugins/app-types/request/type.d.ts +41 -0
- package/lib/plugins/app-types/request/utils.d.ts +46 -0
- package/lib/plugins/app-types/routes/config.d.ts +7 -0
- package/lib/plugins/app-types/routes/index.d.ts +28 -0
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
- package/lib/plugins/app-types/socket/constants.d.ts +33 -0
- package/lib/plugins/app-types/socket/events.d.ts +31 -0
- package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/lib/plugins/app-types/socket/index.d.ts +61 -0
- package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
- package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/lib/plugins/app-types/socket/socket.d.ts +129 -0
- package/lib/plugins/app-types/socket/types.d.ts +85 -0
- package/lib/plugins/app-types/storage/index.d.ts +17 -0
- package/lib/plugins/app-types/tasks/index.d.ts +77 -0
- package/lib/plugins/app-types/tasks/type.d.ts +62 -0
- package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/lib/plugins/app-types/type.d.ts +2 -0
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/lib/plugins/app-types/variables/config.d.ts +3 -0
- package/lib/plugins/app-types/variables/index.d.ts +6 -0
- package/lib/plugins/app-types/variables/type.d.ts +2 -0
- package/lib/plugins/app-types/website/index.d.ts +6 -0
- package/lib/plugins/app.d.ts +8 -0
- package/lib/plugins/app.js +17 -0
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.js +40 -29
- package/lib/solution/BookingByStep/types.d.ts +3 -2
- package/lib/solution/BookingTicket/index.d.ts +172 -0
- package/lib/solution/BookingTicket/index.js +399 -0
- package/lib/solution/BookingTicket/types.d.ts +68 -0
- package/lib/solution/BookingTicket/types.js +72 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
- package/lib/solution/BuyTickets/index.d.ts +2 -2
- package/lib/solution/BuyTickets/index.js +1 -1
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +181 -0
- package/lib/solution/Checkout/index.js +864 -0
- package/lib/solution/Checkout/types.d.ts +550 -0
- package/lib/solution/Checkout/types.js +75 -0
- package/lib/solution/Checkout/utils/index.d.ts +73 -0
- package/lib/solution/Checkout/utils/index.js +266 -0
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/utils/task.d.ts +40 -0
- package/lib/utils/task.js +109 -0
- package/lib/utils/watch.d.ts +102 -0
- package/lib/utils/watch.js +217 -0
- package/package.json +4 -2
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { Module } from '../../types';
|
|
2
|
+
import { OrderModule } from '../../modules/Order';
|
|
3
|
+
import { PaymentModule, PaymentModuleAPI, PaymentOrder, PaymentMethod, PaymentStatus } from '../../modules/Payment';
|
|
4
|
+
import { CartItem } from '../../modules/Cart/types';
|
|
5
|
+
/**
|
|
6
|
+
* 结账状态枚举
|
|
7
|
+
*/
|
|
8
|
+
export declare enum CheckoutStatus {
|
|
9
|
+
/** 初始化中 */
|
|
10
|
+
Initializing = "initializing",
|
|
11
|
+
/** 准备就绪 */
|
|
12
|
+
Ready = "ready",
|
|
13
|
+
/** 创建订单中 */
|
|
14
|
+
CreatingOrder = "creating_order",
|
|
15
|
+
/** 订单已创建 */
|
|
16
|
+
OrderCreated = "order_created",
|
|
17
|
+
/** 处理支付中 */
|
|
18
|
+
ProcessingPayment = "processing_payment",
|
|
19
|
+
/** 支付完成 */
|
|
20
|
+
PaymentCompleted = "payment_completed",
|
|
21
|
+
/** 结账完成 */
|
|
22
|
+
Completed = "completed",
|
|
23
|
+
/** 已取消 */
|
|
24
|
+
Cancelled = "cancelled",
|
|
25
|
+
/** 错误状态 */
|
|
26
|
+
Error = "error"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 结账步骤枚举
|
|
30
|
+
*/
|
|
31
|
+
export declare enum CheckoutStep {
|
|
32
|
+
/** 订单确认 */
|
|
33
|
+
OrderConfirmation = "order_confirmation",
|
|
34
|
+
/** 支付方式选择 */
|
|
35
|
+
PaymentMethod = "payment_method",
|
|
36
|
+
/** 支付处理 */
|
|
37
|
+
PaymentProcessing = "payment_processing",
|
|
38
|
+
/** 完成 */
|
|
39
|
+
Complete = "complete"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 结账错误类型
|
|
43
|
+
*/
|
|
44
|
+
export declare enum CheckoutErrorType {
|
|
45
|
+
/** 订单创建失败 */
|
|
46
|
+
OrderCreationFailed = "order_creation_failed",
|
|
47
|
+
/** 支付失败 */
|
|
48
|
+
PaymentFailed = "payment_failed",
|
|
49
|
+
/** 验证失败 */
|
|
50
|
+
ValidationFailed = "validation_failed",
|
|
51
|
+
/** 网络错误 */
|
|
52
|
+
NetworkError = "network_error",
|
|
53
|
+
/** 未知错误 */
|
|
54
|
+
UnknownError = "unknown_error"
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 结账错误信息
|
|
58
|
+
*/
|
|
59
|
+
export interface CheckoutError {
|
|
60
|
+
/** 错误类型 */
|
|
61
|
+
type: CheckoutErrorType;
|
|
62
|
+
/** 错误消息 */
|
|
63
|
+
message: string;
|
|
64
|
+
/** 错误详情 */
|
|
65
|
+
details?: any;
|
|
66
|
+
/** 错误时间戳 */
|
|
67
|
+
timestamp: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 结账初始化参数
|
|
71
|
+
*/
|
|
72
|
+
export interface CheckoutInitParams {
|
|
73
|
+
/** 购物车商品 */
|
|
74
|
+
cartItems: CartItem[];
|
|
75
|
+
/** 订单类型 */
|
|
76
|
+
orderType?: 'virtual' | 'appointment_booking';
|
|
77
|
+
/** 平台类型 */
|
|
78
|
+
platform?: 'pc' | 'h5';
|
|
79
|
+
/** 自动进入支付 */
|
|
80
|
+
autoPayment?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 购物车小计项
|
|
84
|
+
*/
|
|
85
|
+
export interface CartSummaryItem {
|
|
86
|
+
/** 项目键名 */
|
|
87
|
+
key: string;
|
|
88
|
+
/** 项目值 */
|
|
89
|
+
value: number;
|
|
90
|
+
/** 是否隐藏显示 */
|
|
91
|
+
hidden?: boolean;
|
|
92
|
+
/** 显示标签 */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** 税费详情 (当 key 为 tax 时) */
|
|
95
|
+
tax?: Record<string, any>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 从购物车小计提取的金额信息
|
|
99
|
+
*/
|
|
100
|
+
export interface ExtractedAmountInfo {
|
|
101
|
+
/** 总金额 (expect_amount) */
|
|
102
|
+
totalAmount: string;
|
|
103
|
+
/** 小计 (sub_total) */
|
|
104
|
+
subTotal: string;
|
|
105
|
+
/** 税费 (tax) */
|
|
106
|
+
taxAmount: string;
|
|
107
|
+
/** 折扣 (discount) */
|
|
108
|
+
discountAmount: string;
|
|
109
|
+
/** 商店折扣 (shop_discount) */
|
|
110
|
+
shopDiscountAmount: string;
|
|
111
|
+
/** 四舍五入金额 (custom_roundingAmount) */
|
|
112
|
+
roundingAmount: string;
|
|
113
|
+
/** 定金金额 (如果是定金订单) */
|
|
114
|
+
depositAmount?: string;
|
|
115
|
+
/** 税费详情 */
|
|
116
|
+
taxDetails?: Record<string, any>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 本地订单创建参数
|
|
120
|
+
*/
|
|
121
|
+
export interface CreateLocalOrderParams {
|
|
122
|
+
/** 订单数据 (来自购物车的完整订单参数) */
|
|
123
|
+
orderData: LocalOrderData;
|
|
124
|
+
/** 购物车小计数据 */
|
|
125
|
+
cartSummary: CartSummaryItem[];
|
|
126
|
+
/** 是否自动进入支付流程 */
|
|
127
|
+
autoPayment?: boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* 手动下单参数
|
|
131
|
+
*/
|
|
132
|
+
export interface PlaceOrderParams {
|
|
133
|
+
/** 订单提交的 URL (可选,默认使用 /order/appointment) */
|
|
134
|
+
url?: string;
|
|
135
|
+
/** 是否自动替换虚拟订单ID为真实订单ID */
|
|
136
|
+
autoReplaceOrderId?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 本地订单数据结构 (基于 appointmentDemo.json)
|
|
140
|
+
*/
|
|
141
|
+
export interface LocalOrderData {
|
|
142
|
+
/** 订单类型 */
|
|
143
|
+
type: 'appointment_booking' | 'virtual';
|
|
144
|
+
/** 平台 */
|
|
145
|
+
platform: 'PC' | 'H5';
|
|
146
|
+
/** 销售渠道 */
|
|
147
|
+
sales_channel: string;
|
|
148
|
+
/** 订单销售渠道 */
|
|
149
|
+
order_sales_channel: string;
|
|
150
|
+
/** 预订信息 */
|
|
151
|
+
bookings: LocalBookingItem[];
|
|
152
|
+
/** 商店备注 */
|
|
153
|
+
shop_note: string;
|
|
154
|
+
/** 预约日期 */
|
|
155
|
+
schedule_date: string;
|
|
156
|
+
/** 是否定金 */
|
|
157
|
+
is_deposit: number;
|
|
158
|
+
/** 关联商品 */
|
|
159
|
+
relation_products: any[];
|
|
160
|
+
/** 关联表单 */
|
|
161
|
+
relation_forms: any[];
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 本地预订项
|
|
165
|
+
*/
|
|
166
|
+
export interface LocalBookingItem {
|
|
167
|
+
/** ID */
|
|
168
|
+
id: number;
|
|
169
|
+
/** 数量 */
|
|
170
|
+
number: number;
|
|
171
|
+
/** 注册类型 */
|
|
172
|
+
registration_type: string;
|
|
173
|
+
/** 关联商品 */
|
|
174
|
+
relation_products: any[];
|
|
175
|
+
/** 是否全部 */
|
|
176
|
+
is_all: boolean;
|
|
177
|
+
/** 商品信息 */
|
|
178
|
+
product: LocalProductInfo;
|
|
179
|
+
/** 子类型 */
|
|
180
|
+
sub_type: string;
|
|
181
|
+
/** 时长 */
|
|
182
|
+
duration: number;
|
|
183
|
+
/** 喜好状态 */
|
|
184
|
+
like_status: string;
|
|
185
|
+
/** 资源列表 */
|
|
186
|
+
resources: LocalResourceItem[];
|
|
187
|
+
/** 预约ID */
|
|
188
|
+
schedule_id: number;
|
|
189
|
+
/** 开始日期 */
|
|
190
|
+
start_date: string;
|
|
191
|
+
/** 开始时间 */
|
|
192
|
+
start_time: string;
|
|
193
|
+
/** 选择日期 */
|
|
194
|
+
select_date: string;
|
|
195
|
+
/** 结束时间 */
|
|
196
|
+
end_time: string;
|
|
197
|
+
/** 结束日期 */
|
|
198
|
+
end_date: string;
|
|
199
|
+
/** 元数据 */
|
|
200
|
+
metadata: {
|
|
201
|
+
account?: {
|
|
202
|
+
id: number;
|
|
203
|
+
username: string;
|
|
204
|
+
};
|
|
205
|
+
capacity?: Array<{
|
|
206
|
+
id: number;
|
|
207
|
+
value: number;
|
|
208
|
+
name: string;
|
|
209
|
+
}>;
|
|
210
|
+
};
|
|
211
|
+
/** 持有者 */
|
|
212
|
+
holder: any;
|
|
213
|
+
/** 关联表单 */
|
|
214
|
+
relation_forms: any[];
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 本地商品信息
|
|
218
|
+
*/
|
|
219
|
+
export interface LocalProductInfo {
|
|
220
|
+
/** 数量 */
|
|
221
|
+
num: number;
|
|
222
|
+
/** 商品ID */
|
|
223
|
+
product_id: number;
|
|
224
|
+
/** 商品变体ID */
|
|
225
|
+
product_variant_id: number;
|
|
226
|
+
/** 商品套装 */
|
|
227
|
+
product_bundle: any[];
|
|
228
|
+
/** 商品选项 */
|
|
229
|
+
product_option_item: any[];
|
|
230
|
+
/** 折扣列表 */
|
|
231
|
+
discount_list: LocalDiscountItem[];
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 本地折扣项
|
|
235
|
+
*/
|
|
236
|
+
export interface LocalDiscountItem {
|
|
237
|
+
/** 金额 */
|
|
238
|
+
amount: number;
|
|
239
|
+
/** 类型 */
|
|
240
|
+
type: string;
|
|
241
|
+
/** 折扣详情 */
|
|
242
|
+
discount: {
|
|
243
|
+
resource_id: number;
|
|
244
|
+
title: {
|
|
245
|
+
auto: string;
|
|
246
|
+
original: string;
|
|
247
|
+
en?: string;
|
|
248
|
+
'zh-CN'?: string;
|
|
249
|
+
'zh-HK'?: string;
|
|
250
|
+
};
|
|
251
|
+
original_amount: number;
|
|
252
|
+
product_id: number;
|
|
253
|
+
percent: string;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* 本地资源项
|
|
258
|
+
*/
|
|
259
|
+
export interface LocalResourceItem {
|
|
260
|
+
/** 关联类型 */
|
|
261
|
+
relation_type: string;
|
|
262
|
+
/** 喜好状态 */
|
|
263
|
+
like_status: string;
|
|
264
|
+
/** 表单ID */
|
|
265
|
+
form_id: number;
|
|
266
|
+
/** 关联ID */
|
|
267
|
+
relation_id: number;
|
|
268
|
+
/** 容量 */
|
|
269
|
+
capacity: number;
|
|
270
|
+
/** 元数据 */
|
|
271
|
+
metadata: {
|
|
272
|
+
combined_resource?: {
|
|
273
|
+
status: number;
|
|
274
|
+
resource_ids: number[];
|
|
275
|
+
} | null;
|
|
276
|
+
form_name: string;
|
|
277
|
+
resource_name: string;
|
|
278
|
+
};
|
|
279
|
+
/** 子资源 */
|
|
280
|
+
children?: LocalResourceItem[];
|
|
281
|
+
/** ID (可选) */
|
|
282
|
+
id?: number;
|
|
283
|
+
/** 主字段 (可选) */
|
|
284
|
+
main_field?: string;
|
|
285
|
+
/** 资源类型 (可选) */
|
|
286
|
+
resourceType?: string;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* 订单创建参数
|
|
290
|
+
*/
|
|
291
|
+
export interface CreateOrderParams {
|
|
292
|
+
/** 购物车商品 */
|
|
293
|
+
cartItems: CartItem[];
|
|
294
|
+
/** 订单类型 */
|
|
295
|
+
type?: 'virtual' | 'appointment_booking';
|
|
296
|
+
/** 平台类型 */
|
|
297
|
+
platform?: 'pc' | 'h5';
|
|
298
|
+
/** 额外参数 */
|
|
299
|
+
extra?: Record<string, any>;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* 支付处理参数
|
|
303
|
+
*/
|
|
304
|
+
export interface ProcessPaymentParams {
|
|
305
|
+
/** 订单UUID */
|
|
306
|
+
orderUuid: string;
|
|
307
|
+
/** 支付方式代码 */
|
|
308
|
+
paymentMethodCode: string;
|
|
309
|
+
/** 支付金额 */
|
|
310
|
+
amount: string | number;
|
|
311
|
+
/** 支付元数据 */
|
|
312
|
+
metadata?: Record<string, any>;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* 结账状态信息
|
|
316
|
+
*/
|
|
317
|
+
export interface CheckoutStatusInfo {
|
|
318
|
+
/** 当前状态 */
|
|
319
|
+
status: CheckoutStatus;
|
|
320
|
+
/** 当前步骤 */
|
|
321
|
+
step: CheckoutStep;
|
|
322
|
+
/** 进度百分比 (0-100) */
|
|
323
|
+
progress: number;
|
|
324
|
+
/** 状态消息 */
|
|
325
|
+
message?: string;
|
|
326
|
+
/** 错误信息 */
|
|
327
|
+
error?: CheckoutError;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* 结账摘要信息
|
|
331
|
+
*/
|
|
332
|
+
export interface CheckoutSummary {
|
|
333
|
+
/** 订单信息 */
|
|
334
|
+
order?: PaymentOrder;
|
|
335
|
+
/** 总金额 */
|
|
336
|
+
totalAmount: string;
|
|
337
|
+
/** 已支付金额 */
|
|
338
|
+
paidAmount: string;
|
|
339
|
+
/** 待支付金额 */
|
|
340
|
+
remainingAmount: string;
|
|
341
|
+
/** 支付状态 */
|
|
342
|
+
paymentStatus: PaymentStatus;
|
|
343
|
+
/** 可用支付方式 */
|
|
344
|
+
availablePaymentMethods: PaymentMethod[];
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* 结账事件钩子
|
|
348
|
+
*/
|
|
349
|
+
export declare enum CheckoutHooks {
|
|
350
|
+
/** 结账初始化完成 */
|
|
351
|
+
OnCheckoutInitialized = "checkout:onInitialized",
|
|
352
|
+
/** 状态变更 */
|
|
353
|
+
OnStatusChanged = "checkout:onStatusChanged",
|
|
354
|
+
/** 步骤变更 */
|
|
355
|
+
OnStepChanged = "checkout:onStepChanged",
|
|
356
|
+
/** 订单创建成功 */
|
|
357
|
+
OnOrderCreated = "checkout:onOrderCreated",
|
|
358
|
+
/** 订单创建失败 */
|
|
359
|
+
OnOrderCreationFailed = "checkout:onOrderCreationFailed",
|
|
360
|
+
/** 支付开始 */
|
|
361
|
+
OnPaymentStarted = "checkout:onPaymentStarted",
|
|
362
|
+
/** 支付成功 */
|
|
363
|
+
OnPaymentSuccess = "checkout:onPaymentSuccess",
|
|
364
|
+
/** 支付失败 */
|
|
365
|
+
OnPaymentFailed = "checkout:onPaymentFailed",
|
|
366
|
+
/** 结账完成 */
|
|
367
|
+
OnCheckoutCompleted = "checkout:onCompleted",
|
|
368
|
+
/** 结账取消 */
|
|
369
|
+
OnCheckoutCancelled = "checkout:onCancelled",
|
|
370
|
+
/** 错误发生 */
|
|
371
|
+
OnError = "checkout:onError"
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* 结账状态数据
|
|
375
|
+
*/
|
|
376
|
+
export interface CheckoutState {
|
|
377
|
+
/** 订单模块 */
|
|
378
|
+
order: OrderModule;
|
|
379
|
+
/** 支付模块 */
|
|
380
|
+
payment: PaymentModule;
|
|
381
|
+
/** 当前状态 */
|
|
382
|
+
status: CheckoutStatus;
|
|
383
|
+
/** 当前步骤 */
|
|
384
|
+
step: CheckoutStep;
|
|
385
|
+
/** 当前订单 */
|
|
386
|
+
currentOrder?: PaymentOrder;
|
|
387
|
+
/** 购物车商品 */
|
|
388
|
+
cartItems: CartItem[];
|
|
389
|
+
/** 本地订单数据 */
|
|
390
|
+
localOrderData?: LocalOrderData;
|
|
391
|
+
/** 可用支付方式 */
|
|
392
|
+
paymentMethods: PaymentMethod[];
|
|
393
|
+
/** 错误信息 */
|
|
394
|
+
lastError?: CheckoutError;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* 当前订单基础信息
|
|
398
|
+
*/
|
|
399
|
+
export interface CurrentOrderInfo {
|
|
400
|
+
/** 订单UUID */
|
|
401
|
+
uuid?: string;
|
|
402
|
+
/** 订单ID */
|
|
403
|
+
orderId?: string;
|
|
404
|
+
/** 订单状态 */
|
|
405
|
+
status?: CheckoutStatus;
|
|
406
|
+
/** 当前步骤 */
|
|
407
|
+
step?: CheckoutStep;
|
|
408
|
+
/** 订单总金额 */
|
|
409
|
+
totalAmount?: string;
|
|
410
|
+
/** 待付金额 */
|
|
411
|
+
remainingAmount?: string;
|
|
412
|
+
/** 支付状态 */
|
|
413
|
+
paymentStatus?: PaymentStatus;
|
|
414
|
+
/** 是否为定金订单 */
|
|
415
|
+
isDeposit?: boolean;
|
|
416
|
+
/** 定金金额 */
|
|
417
|
+
depositAmount?: string;
|
|
418
|
+
/** 订单类型 */
|
|
419
|
+
orderType?: 'virtual' | 'appointment_booking';
|
|
420
|
+
/** 平台类型 */
|
|
421
|
+
platform?: 'pc' | 'h5';
|
|
422
|
+
/** 创建时间 */
|
|
423
|
+
createdAt?: string;
|
|
424
|
+
/** 商品数量 */
|
|
425
|
+
itemCount?: number;
|
|
426
|
+
/** 是否有本地订单数据 */
|
|
427
|
+
hasLocalOrderData?: boolean;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* 结账解决方案 API 接口
|
|
431
|
+
*/
|
|
432
|
+
export interface CheckoutModuleAPI extends Module {
|
|
433
|
+
/**
|
|
434
|
+
* 初始化结账流程
|
|
435
|
+
*/
|
|
436
|
+
initializeCheckoutAsync(params: CheckoutInitParams): Promise<void>;
|
|
437
|
+
/**
|
|
438
|
+
* 创建本地订单 (前端模拟下单流程)
|
|
439
|
+
*/
|
|
440
|
+
createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
|
|
441
|
+
/**
|
|
442
|
+
* 手动下单 (根据虚拟订单生成实际订单)
|
|
443
|
+
*/
|
|
444
|
+
placeOrderAsync(params?: PlaceOrderParams): Promise<{
|
|
445
|
+
success: boolean;
|
|
446
|
+
orderId?: string;
|
|
447
|
+
error?: string;
|
|
448
|
+
}>;
|
|
449
|
+
/**
|
|
450
|
+
* 创建订单
|
|
451
|
+
*/
|
|
452
|
+
createOrderAsync(params: CreateOrderParams): Promise<PaymentOrder>;
|
|
453
|
+
/**
|
|
454
|
+
* 处理支付
|
|
455
|
+
*/
|
|
456
|
+
processPaymentAsync(params: ProcessPaymentParams): Promise<void>;
|
|
457
|
+
/**
|
|
458
|
+
* 完成结账
|
|
459
|
+
*/
|
|
460
|
+
completeCheckoutAsync(): Promise<{
|
|
461
|
+
success: boolean;
|
|
462
|
+
orderId?: string;
|
|
463
|
+
}>;
|
|
464
|
+
/**
|
|
465
|
+
* 取消结账
|
|
466
|
+
*/
|
|
467
|
+
cancelCheckoutAsync(): Promise<void>;
|
|
468
|
+
/**
|
|
469
|
+
* 获取结账状态
|
|
470
|
+
*/
|
|
471
|
+
getCheckoutStatus(): CheckoutStatusInfo;
|
|
472
|
+
/**
|
|
473
|
+
* 获取结账摘要
|
|
474
|
+
*/
|
|
475
|
+
getCheckoutSummaryAsync(): Promise<CheckoutSummary>;
|
|
476
|
+
/**
|
|
477
|
+
* 获取可用支付方式
|
|
478
|
+
*/
|
|
479
|
+
getAvailablePaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
480
|
+
/**
|
|
481
|
+
* 刷新支付方式缓存
|
|
482
|
+
*/
|
|
483
|
+
refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
484
|
+
/**
|
|
485
|
+
* 获取当前订单基础信息
|
|
486
|
+
*/
|
|
487
|
+
getCurrentOrderInfo(): CurrentOrderInfo | null;
|
|
488
|
+
/**
|
|
489
|
+
* 验证结账前置条件
|
|
490
|
+
*/
|
|
491
|
+
validateCheckoutAsync(): Promise<{
|
|
492
|
+
valid: boolean;
|
|
493
|
+
errors: string[];
|
|
494
|
+
}>;
|
|
495
|
+
/**
|
|
496
|
+
* 重试失败的操作
|
|
497
|
+
*/
|
|
498
|
+
retryFailedOperationAsync(): Promise<void>;
|
|
499
|
+
/**
|
|
500
|
+
* 设置当前步骤
|
|
501
|
+
*/
|
|
502
|
+
setCurrentStep(step: CheckoutStep): void;
|
|
503
|
+
/**
|
|
504
|
+
* 获取订单模块
|
|
505
|
+
*/
|
|
506
|
+
getOrderModule(): OrderModule;
|
|
507
|
+
/**
|
|
508
|
+
* 获取支付模块
|
|
509
|
+
*/
|
|
510
|
+
getPaymentModule(): PaymentModuleAPI;
|
|
511
|
+
/**
|
|
512
|
+
* 替换本地订单ID为真实订单ID
|
|
513
|
+
*/
|
|
514
|
+
replaceLocalOrderIdAsync(newOrderId: string): Promise<PaymentOrder | null>;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* 结账事件数据类型
|
|
518
|
+
*/
|
|
519
|
+
export interface CheckoutEventData {
|
|
520
|
+
/** 状态变更事件 */
|
|
521
|
+
statusChanged: {
|
|
522
|
+
oldStatus: CheckoutStatus;
|
|
523
|
+
newStatus: CheckoutStatus;
|
|
524
|
+
timestamp: number;
|
|
525
|
+
};
|
|
526
|
+
/** 步骤变更事件 */
|
|
527
|
+
stepChanged: {
|
|
528
|
+
oldStep: CheckoutStep;
|
|
529
|
+
newStep: CheckoutStep;
|
|
530
|
+
timestamp: number;
|
|
531
|
+
};
|
|
532
|
+
/** 订单创建事件 */
|
|
533
|
+
orderCreated: {
|
|
534
|
+
order: PaymentOrder;
|
|
535
|
+
timestamp: number;
|
|
536
|
+
};
|
|
537
|
+
/** 支付事件 */
|
|
538
|
+
paymentEvent: {
|
|
539
|
+
orderUuid: string;
|
|
540
|
+
paymentMethodCode: string;
|
|
541
|
+
amount: string;
|
|
542
|
+
timestamp: number;
|
|
543
|
+
};
|
|
544
|
+
/** 错误事件 */
|
|
545
|
+
error: {
|
|
546
|
+
error: CheckoutError;
|
|
547
|
+
context?: any;
|
|
548
|
+
timestamp: number;
|
|
549
|
+
};
|
|
550
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/solution/Checkout/types.ts
|
|
20
|
+
var types_exports = {};
|
|
21
|
+
__export(types_exports, {
|
|
22
|
+
CheckoutErrorType: () => CheckoutErrorType,
|
|
23
|
+
CheckoutHooks: () => CheckoutHooks,
|
|
24
|
+
CheckoutStatus: () => CheckoutStatus,
|
|
25
|
+
CheckoutStep: () => CheckoutStep
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(types_exports);
|
|
28
|
+
var CheckoutStatus = /* @__PURE__ */ ((CheckoutStatus2) => {
|
|
29
|
+
CheckoutStatus2["Initializing"] = "initializing";
|
|
30
|
+
CheckoutStatus2["Ready"] = "ready";
|
|
31
|
+
CheckoutStatus2["CreatingOrder"] = "creating_order";
|
|
32
|
+
CheckoutStatus2["OrderCreated"] = "order_created";
|
|
33
|
+
CheckoutStatus2["ProcessingPayment"] = "processing_payment";
|
|
34
|
+
CheckoutStatus2["PaymentCompleted"] = "payment_completed";
|
|
35
|
+
CheckoutStatus2["Completed"] = "completed";
|
|
36
|
+
CheckoutStatus2["Cancelled"] = "cancelled";
|
|
37
|
+
CheckoutStatus2["Error"] = "error";
|
|
38
|
+
return CheckoutStatus2;
|
|
39
|
+
})(CheckoutStatus || {});
|
|
40
|
+
var CheckoutStep = /* @__PURE__ */ ((CheckoutStep2) => {
|
|
41
|
+
CheckoutStep2["OrderConfirmation"] = "order_confirmation";
|
|
42
|
+
CheckoutStep2["PaymentMethod"] = "payment_method";
|
|
43
|
+
CheckoutStep2["PaymentProcessing"] = "payment_processing";
|
|
44
|
+
CheckoutStep2["Complete"] = "complete";
|
|
45
|
+
return CheckoutStep2;
|
|
46
|
+
})(CheckoutStep || {});
|
|
47
|
+
var CheckoutErrorType = /* @__PURE__ */ ((CheckoutErrorType2) => {
|
|
48
|
+
CheckoutErrorType2["OrderCreationFailed"] = "order_creation_failed";
|
|
49
|
+
CheckoutErrorType2["PaymentFailed"] = "payment_failed";
|
|
50
|
+
CheckoutErrorType2["ValidationFailed"] = "validation_failed";
|
|
51
|
+
CheckoutErrorType2["NetworkError"] = "network_error";
|
|
52
|
+
CheckoutErrorType2["UnknownError"] = "unknown_error";
|
|
53
|
+
return CheckoutErrorType2;
|
|
54
|
+
})(CheckoutErrorType || {});
|
|
55
|
+
var CheckoutHooks = /* @__PURE__ */ ((CheckoutHooks2) => {
|
|
56
|
+
CheckoutHooks2["OnCheckoutInitialized"] = "checkout:onInitialized";
|
|
57
|
+
CheckoutHooks2["OnStatusChanged"] = "checkout:onStatusChanged";
|
|
58
|
+
CheckoutHooks2["OnStepChanged"] = "checkout:onStepChanged";
|
|
59
|
+
CheckoutHooks2["OnOrderCreated"] = "checkout:onOrderCreated";
|
|
60
|
+
CheckoutHooks2["OnOrderCreationFailed"] = "checkout:onOrderCreationFailed";
|
|
61
|
+
CheckoutHooks2["OnPaymentStarted"] = "checkout:onPaymentStarted";
|
|
62
|
+
CheckoutHooks2["OnPaymentSuccess"] = "checkout:onPaymentSuccess";
|
|
63
|
+
CheckoutHooks2["OnPaymentFailed"] = "checkout:onPaymentFailed";
|
|
64
|
+
CheckoutHooks2["OnCheckoutCompleted"] = "checkout:onCompleted";
|
|
65
|
+
CheckoutHooks2["OnCheckoutCancelled"] = "checkout:onCancelled";
|
|
66
|
+
CheckoutHooks2["OnError"] = "checkout:onError";
|
|
67
|
+
return CheckoutHooks2;
|
|
68
|
+
})(CheckoutHooks || {});
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
CheckoutErrorType,
|
|
72
|
+
CheckoutHooks,
|
|
73
|
+
CheckoutStatus,
|
|
74
|
+
CheckoutStep
|
|
75
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CheckoutInitParams, CheckoutError, CheckoutErrorType, CheckoutStatus, CheckoutStep } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* 验证结账数据
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateCheckoutData(params: CheckoutInitParams): {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
errors: string[];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 创建结账错误对象
|
|
11
|
+
*/
|
|
12
|
+
export declare function createCheckoutError(type: CheckoutErrorType, message: string, details?: any): CheckoutError;
|
|
13
|
+
/**
|
|
14
|
+
* 计算结账进度
|
|
15
|
+
*/
|
|
16
|
+
export declare function calculateProgress(status: CheckoutStatus, step: CheckoutStep): number;
|
|
17
|
+
/**
|
|
18
|
+
* 格式化金额
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatAmount(amount: string | number): string;
|
|
21
|
+
/**
|
|
22
|
+
* 验证金额
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateAmount(amount: string | number): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 生成唯一订单ID
|
|
27
|
+
*/
|
|
28
|
+
export declare function generateOrderId(prefix?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* 检查是否为有效的支付方式代码
|
|
31
|
+
*/
|
|
32
|
+
export declare function isValidPaymentMethodCode(code: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 安全地解析JSON
|
|
35
|
+
*/
|
|
36
|
+
export declare function safeJsonParse<T>(jsonString: string, defaultValue: T): T;
|
|
37
|
+
/**
|
|
38
|
+
* 深度克隆对象
|
|
39
|
+
*/
|
|
40
|
+
export declare function deepClone<T>(obj: T): T;
|
|
41
|
+
/**
|
|
42
|
+
* 防抖函数
|
|
43
|
+
*/
|
|
44
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* 节流函数
|
|
47
|
+
*/
|
|
48
|
+
export declare function throttle<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
49
|
+
/**
|
|
50
|
+
* 重试函数
|
|
51
|
+
*/
|
|
52
|
+
export declare function retry<T>(fn: () => Promise<T>, maxAttempts?: number, delay?: number): Promise<T>;
|
|
53
|
+
/**
|
|
54
|
+
* 检查对象是否为空
|
|
55
|
+
*/
|
|
56
|
+
export declare function isEmpty(obj: any): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* 获取错误消息
|
|
59
|
+
*/
|
|
60
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
61
|
+
/**
|
|
62
|
+
* 检查是否为生产环境
|
|
63
|
+
*/
|
|
64
|
+
export declare function isProduction(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 日志记录器
|
|
67
|
+
*/
|
|
68
|
+
export declare const logger: {
|
|
69
|
+
info: (message: string, ...args: any[]) => void;
|
|
70
|
+
warn: (message: string, ...args: any[]) => void;
|
|
71
|
+
error: (message: string, ...args: any[]) => void;
|
|
72
|
+
debug: (message: string, ...args: any[]) => void;
|
|
73
|
+
};
|