@pisell/pisellos 0.0.235 → 0.0.237
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/modules/Payment/types.d.ts +46 -1
- package/dist/modules/Payment/types.js +15 -0
- package/dist/modules/Payment/walletpass.js +37 -12
- package/dist/solution/Checkout/index.d.ts +23 -1
- package/dist/solution/Checkout/index.js +1092 -885
- package/dist/solution/Checkout/types.d.ts +11 -1
- package/dist/solution/Checkout/types.js +1 -0
- package/lib/modules/Payment/types.d.ts +46 -1
- package/lib/modules/Payment/types.js +3 -0
- package/lib/modules/Payment/walletpass.js +28 -3
- package/lib/solution/Checkout/index.d.ts +23 -1
- package/lib/solution/Checkout/index.js +334 -121
- package/lib/solution/Checkout/types.d.ts +11 -1
- package/lib/solution/Checkout/types.js +1 -0
- package/package.json +1 -1
|
@@ -476,6 +476,48 @@ export interface OnSearchIdentificationCodeCompletedEventData {
|
|
|
476
476
|
/** 搜索参数 */
|
|
477
477
|
searchParams: SearchIdentificationCodeParams;
|
|
478
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* 钱包初始化开始事件数据
|
|
481
|
+
*/
|
|
482
|
+
export interface OnWalletInitializationStartedEventData {
|
|
483
|
+
/** 业务数据 */
|
|
484
|
+
businessData: WalletInitBusinessData;
|
|
485
|
+
/** 开始时间 */
|
|
486
|
+
startTime: number;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* 钱包初始化完成事件数据
|
|
490
|
+
*/
|
|
491
|
+
export interface OnWalletInitializationCompletedEventData {
|
|
492
|
+
/** 业务数据 */
|
|
493
|
+
businessData: WalletInitBusinessData;
|
|
494
|
+
/** 初始化结果 */
|
|
495
|
+
result: {
|
|
496
|
+
walletRecommendList: WalletRecommendItem[];
|
|
497
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
498
|
+
};
|
|
499
|
+
/** 开始时间 */
|
|
500
|
+
startTime: number;
|
|
501
|
+
/** 结束时间 */
|
|
502
|
+
endTime: number;
|
|
503
|
+
/** 执行时长(毫秒) */
|
|
504
|
+
duration: number;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* 钱包初始化失败事件数据
|
|
508
|
+
*/
|
|
509
|
+
export interface OnWalletInitializationFailedEventData {
|
|
510
|
+
/** 业务数据 */
|
|
511
|
+
businessData: WalletInitBusinessData;
|
|
512
|
+
/** 错误信息 */
|
|
513
|
+
error: Error;
|
|
514
|
+
/** 开始时间 */
|
|
515
|
+
startTime: number;
|
|
516
|
+
/** 结束时间 */
|
|
517
|
+
endTime: number;
|
|
518
|
+
/** 执行时长(毫秒) */
|
|
519
|
+
duration: number;
|
|
520
|
+
}
|
|
479
521
|
/**
|
|
480
522
|
* 钱包支付事件枚举
|
|
481
523
|
*/
|
|
@@ -485,7 +527,10 @@ export declare enum WalletPassHooks {
|
|
|
485
527
|
OnUserIdentificationCodesUpdated = "wallet:onUserIdentificationCodesUpdated",
|
|
486
528
|
OnUserIdentificationCodesCleared = "wallet:onUserIdentificationCodesCleared",
|
|
487
529
|
OnWalletCacheCleared = "wallet:onWalletCacheCleared",
|
|
488
|
-
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted"
|
|
530
|
+
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted",
|
|
531
|
+
OnWalletInitializationStarted = "wallet:onWalletInitializationStarted",
|
|
532
|
+
OnWalletInitializationCompleted = "wallet:onWalletInitializationCompleted",
|
|
533
|
+
OnWalletInitializationFailed = "wallet:onWalletInitializationFailed"
|
|
489
534
|
}
|
|
490
535
|
/**
|
|
491
536
|
* 支付钩子事件(统一接口)
|
|
@@ -156,6 +156,18 @@ export var RoundingInterval = /*#__PURE__*/function (RoundingInterval) {
|
|
|
156
156
|
* 搜索识别码完成事件数据
|
|
157
157
|
*/
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* 钱包初始化开始事件数据
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 钱包初始化完成事件数据
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 钱包初始化失败事件数据
|
|
169
|
+
*/
|
|
170
|
+
|
|
159
171
|
/**
|
|
160
172
|
* 钱包支付事件枚举
|
|
161
173
|
*/
|
|
@@ -166,6 +178,9 @@ export var WalletPassHooks = /*#__PURE__*/function (WalletPassHooks) {
|
|
|
166
178
|
WalletPassHooks["OnUserIdentificationCodesCleared"] = "wallet:onUserIdentificationCodesCleared";
|
|
167
179
|
WalletPassHooks["OnWalletCacheCleared"] = "wallet:onWalletCacheCleared";
|
|
168
180
|
WalletPassHooks["OnSearchIdentificationCodeCompleted"] = "wallet:onSearchIdentificationCodeCompleted";
|
|
181
|
+
WalletPassHooks["OnWalletInitializationStarted"] = "wallet:onWalletInitializationStarted";
|
|
182
|
+
WalletPassHooks["OnWalletInitializationCompleted"] = "wallet:onWalletInitializationCompleted";
|
|
183
|
+
WalletPassHooks["OnWalletInitializationFailed"] = "wallet:onWalletInitializationFailed";
|
|
169
184
|
return WalletPassHooks;
|
|
170
185
|
}({});
|
|
171
186
|
|
|
@@ -110,27 +110,52 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
110
110
|
key: "initializeWalletDataFromBusinessAsync",
|
|
111
111
|
value: (function () {
|
|
112
112
|
var _initializeWalletDataFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(businessData) {
|
|
113
|
-
var walletParams;
|
|
113
|
+
var startTime, walletParams, result, endTime, duration, _endTime, _duration;
|
|
114
114
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
115
115
|
while (1) switch (_context.prev = _context.next) {
|
|
116
116
|
case 0:
|
|
117
|
-
|
|
117
|
+
startTime = Date.now(); // 发送初始化开始事件
|
|
118
|
+
this.emitEvent(WalletPassHooks.OnWalletInitializationStarted, {
|
|
119
|
+
businessData: businessData,
|
|
120
|
+
startTime: startTime
|
|
121
|
+
});
|
|
122
|
+
_context.prev = 2;
|
|
118
123
|
// 生成钱包API参数
|
|
119
124
|
walletParams = this.generateWalletParams(businessData); // 调用标准的初始化流程
|
|
120
|
-
_context.next =
|
|
125
|
+
_context.next = 6;
|
|
121
126
|
return this.initializeWalletDataAsync(walletParams);
|
|
122
|
-
case
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
case 6:
|
|
128
|
+
result = _context.sent;
|
|
129
|
+
endTime = Date.now();
|
|
130
|
+
duration = endTime - startTime; // 发送初始化完成事件
|
|
131
|
+
this.emitEvent(WalletPassHooks.OnWalletInitializationCompleted, {
|
|
132
|
+
businessData: businessData,
|
|
133
|
+
result: result,
|
|
134
|
+
startTime: startTime,
|
|
135
|
+
endTime: endTime,
|
|
136
|
+
duration: duration
|
|
137
|
+
});
|
|
138
|
+
console.log("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u6210\u529F\uFF0C\u8017\u65F6: ".concat(duration, "ms"));
|
|
139
|
+
return _context.abrupt("return", result);
|
|
140
|
+
case 14:
|
|
141
|
+
_context.prev = 14;
|
|
142
|
+
_context.t0 = _context["catch"](2);
|
|
143
|
+
_endTime = Date.now();
|
|
144
|
+
_duration = _endTime - startTime; // 发送初始化失败事件
|
|
145
|
+
this.emitEvent(WalletPassHooks.OnWalletInitializationFailed, {
|
|
146
|
+
businessData: businessData,
|
|
147
|
+
error: _context.t0,
|
|
148
|
+
startTime: startTime,
|
|
149
|
+
endTime: _endTime,
|
|
150
|
+
duration: _duration
|
|
151
|
+
});
|
|
152
|
+
console.error("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25\uFF0C\u8017\u65F6: ".concat(_duration, "ms"), _context.t0);
|
|
128
153
|
throw _context.t0;
|
|
129
|
-
case
|
|
154
|
+
case 21:
|
|
130
155
|
case "end":
|
|
131
156
|
return _context.stop();
|
|
132
157
|
}
|
|
133
|
-
}, _callee, this, [[
|
|
158
|
+
}, _callee, this, [[2, 14]]);
|
|
134
159
|
}));
|
|
135
160
|
function initializeWalletDataFromBusinessAsync(_x) {
|
|
136
161
|
return _initializeWalletDataFromBusinessAsync.apply(this, arguments);
|
|
@@ -311,7 +336,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
311
336
|
walletDetailParams = {
|
|
312
337
|
code: code,
|
|
313
338
|
with_customer: 1,
|
|
314
|
-
with: ['
|
|
339
|
+
with: ['wallet']
|
|
315
340
|
};
|
|
316
341
|
_context5.next = 8;
|
|
317
342
|
return this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
|
|
@@ -185,7 +185,8 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
185
185
|
/**
|
|
186
186
|
* 获取支付方式列表
|
|
187
187
|
*
|
|
188
|
-
*
|
|
188
|
+
* 优先使用 store 中的缓存数据,避免重复接口调用。
|
|
189
|
+
* 如果 store 中没有数据,则调用 Payment 模块的方法获取。
|
|
189
190
|
*
|
|
190
191
|
* @returns 支付方式列表
|
|
191
192
|
*/
|
|
@@ -476,4 +477,25 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
476
477
|
roundingDifference: string;
|
|
477
478
|
}>;
|
|
478
479
|
destroy(): Promise<void>;
|
|
480
|
+
/**
|
|
481
|
+
* 重置 store 状态
|
|
482
|
+
*
|
|
483
|
+
* 在创建新订单前调用,确保状态完全干净
|
|
484
|
+
*/
|
|
485
|
+
private resetStoreStateAsync;
|
|
486
|
+
/**
|
|
487
|
+
* 手动清理已完成的订单状态(公开方法)
|
|
488
|
+
*
|
|
489
|
+
* 供UI层调用的公开方法,用于手动清理订单状态
|
|
490
|
+
*
|
|
491
|
+
* @returns 清理结果
|
|
492
|
+
*/
|
|
493
|
+
clearCompletedOrderAsync(): Promise<{
|
|
494
|
+
success: boolean;
|
|
495
|
+
message?: string;
|
|
496
|
+
clearedOrder?: {
|
|
497
|
+
uuid: string;
|
|
498
|
+
orderId: string;
|
|
499
|
+
} | null;
|
|
500
|
+
}>;
|
|
479
501
|
}
|