@pisell/pisellos 0.10.4 → 0.10.6
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/Order/index.d.ts +1 -1
- package/dist/modules/Order/utils.js +0 -1
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +21 -7
- package/dist/solution/BookingTicket/index.d.ts +4 -2
- package/dist/solution/BookingTicket/index.js +71 -47
- package/dist/solution/UnifiedBookingSales/index.d.ts +6 -0
- package/dist/solution/UnifiedBookingSales/index.js +531 -344
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/utils.js +0 -1
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +12 -0
- package/lib/solution/BookingTicket/index.d.ts +4 -2
- package/lib/solution/BookingTicket/index.js +30 -7
- package/lib/solution/UnifiedBookingSales/index.d.ts +6 -0
- package/lib/solution/UnifiedBookingSales/index.js +115 -18
- package/package.json +1 -1
|
@@ -497,7 +497,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
497
497
|
generateIdempotencyToken(): string;
|
|
498
498
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
499
499
|
createOrder(params: CommitOrderParams['query']): {
|
|
500
|
-
type: "
|
|
500
|
+
type: "virtual" | "appointment_booking";
|
|
501
501
|
platform: string;
|
|
502
502
|
sales_channel: string;
|
|
503
503
|
order_sales_channel: string;
|
|
@@ -1395,7 +1395,6 @@ export function productRequiresFormSubject(tempOrder, product) {
|
|
|
1395
1395
|
}
|
|
1396
1396
|
export function resolveIsFormSubject(tempOrder, product) {
|
|
1397
1397
|
var _tempOrder$holder;
|
|
1398
|
-
debugger;
|
|
1399
1398
|
// 旧版预约维度的 holder 类型仍然生效;新版则从当前商品 holder_config 判断。
|
|
1400
1399
|
if ((tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.type) === 'form') return true;
|
|
1401
1400
|
if (product) return productRequiresFormSubject(tempOrder, product);
|
|
@@ -41,6 +41,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
41
41
|
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
42
42
|
*/
|
|
43
43
|
updateOtherParams(params: Record<string, any>): void;
|
|
44
|
+
/**
|
|
45
|
+
* 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
|
|
46
|
+
*/
|
|
47
|
+
getPlatform(): string;
|
|
44
48
|
private getPaymentNumberAppData;
|
|
45
49
|
/**
|
|
46
50
|
* 记录信息日志
|
|
@@ -231,6 +231,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
231
231
|
value: function updateOtherParams(params) {
|
|
232
232
|
this.otherParams = params || {};
|
|
233
233
|
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
|
|
237
|
+
*/
|
|
238
|
+
}, {
|
|
239
|
+
key: "getPlatform",
|
|
240
|
+
value: function getPlatform() {
|
|
241
|
+
var _this$otherParams;
|
|
242
|
+
return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase();
|
|
243
|
+
}
|
|
234
244
|
}, {
|
|
235
245
|
key: "getPaymentNumberAppData",
|
|
236
246
|
value: function getPaymentNumberAppData(key) {
|
|
@@ -247,10 +257,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
247
257
|
}, {
|
|
248
258
|
key: "logInfo",
|
|
249
259
|
value: function logInfo(title, metadata) {
|
|
250
|
-
var _this$
|
|
251
|
-
if ((_this$
|
|
252
|
-
var _this$
|
|
253
|
-
var fatherModule = this.core.getModule((_this$
|
|
260
|
+
var _this$otherParams2;
|
|
261
|
+
if ((_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.fatherModule) {
|
|
262
|
+
var _this$otherParams3;
|
|
263
|
+
var fatherModule = this.core.getModule((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.fatherModule);
|
|
254
264
|
if (fatherModule) {
|
|
255
265
|
fatherModule.logInfo("".concat(title), metadata);
|
|
256
266
|
return;
|
|
@@ -759,7 +759,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
759
759
|
key: "getUserIdentificationCodeListAsync",
|
|
760
760
|
value: function () {
|
|
761
761
|
var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
762
|
-
var _newParams$products, _newParams$prepare_pa, _this$walletParams2, newParams, response, sortedData;
|
|
762
|
+
var _newParams$products, _newParams$prepare_pa, _this$walletParams2, newParams, platform, response, sortedData;
|
|
763
763
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
764
764
|
while (1) switch (_context6.prev = _context6.next) {
|
|
765
765
|
case 0:
|
|
@@ -772,6 +772,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
772
772
|
this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
|
|
773
773
|
return _context6.abrupt("return", []);
|
|
774
774
|
case 5:
|
|
775
|
+
platform = this.paymentModule.getPlatform();
|
|
776
|
+
if (!(platform === 'pc' || platform === 'h5')) {
|
|
777
|
+
_context6.next = 11;
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
this.userIdentificationCodes = [];
|
|
781
|
+
this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
782
|
+
userIdentificationCodes: []
|
|
783
|
+
});
|
|
784
|
+
this.paymentModule.logInfo('[WalletPass] 用户端平台跳过获取用户识别码列表', {
|
|
785
|
+
platform: platform
|
|
786
|
+
});
|
|
787
|
+
return _context6.abrupt("return", []);
|
|
788
|
+
case 11:
|
|
775
789
|
if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
|
|
776
790
|
newParams.payment_order_id = undefined;
|
|
777
791
|
}
|
|
@@ -782,9 +796,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
782
796
|
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
783
797
|
payment_order_id: (_this$walletParams2 = this.walletParams) === null || _this$walletParams2 === void 0 ? void 0 : _this$walletParams2.payment_order_id
|
|
784
798
|
});
|
|
785
|
-
_context6.next =
|
|
799
|
+
_context6.next = 15;
|
|
786
800
|
return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
|
|
787
|
-
case
|
|
801
|
+
case 15:
|
|
788
802
|
response = _context6.sent;
|
|
789
803
|
// 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
|
|
790
804
|
sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
|
|
@@ -805,19 +819,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
805
819
|
})
|
|
806
820
|
});
|
|
807
821
|
return _context6.abrupt("return", this.userIdentificationCodes);
|
|
808
|
-
case
|
|
809
|
-
_context6.prev =
|
|
822
|
+
case 23:
|
|
823
|
+
_context6.prev = 23;
|
|
810
824
|
_context6.t0 = _context6["catch"](0);
|
|
811
825
|
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context6.t0, {
|
|
812
826
|
customer_id: params.customer_id,
|
|
813
827
|
available: params.available
|
|
814
828
|
});
|
|
815
829
|
return _context6.abrupt("return", []);
|
|
816
|
-
case
|
|
830
|
+
case 27:
|
|
817
831
|
case "end":
|
|
818
832
|
return _context6.stop();
|
|
819
833
|
}
|
|
820
|
-
}, _callee6, this, [[0,
|
|
834
|
+
}, _callee6, this, [[0, 23]]);
|
|
821
835
|
}));
|
|
822
836
|
function getUserIdentificationCodeListAsync(_x7) {
|
|
823
837
|
return _getUserIdentificationCodeListAsync.apply(this, arguments);
|
|
@@ -29,6 +29,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
29
29
|
private addTimeProductsCatalog;
|
|
30
30
|
private orderCustomerDiscountRefreshInFlight;
|
|
31
31
|
private orderCustomerDiscountRefreshCustomerId;
|
|
32
|
+
private orderCustomerPromotionRefreshInFlight;
|
|
32
33
|
private loadOpenDataConfigInFlight;
|
|
33
34
|
/**
|
|
34
35
|
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext。
|
|
@@ -282,7 +283,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
282
283
|
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
283
284
|
/** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
|
|
284
285
|
private buildOrderCustomerPayload;
|
|
285
|
-
|
|
286
|
+
protected refreshDiscountConfigAfterOrderCustomerChange(customerId: number | null): Promise<void>;
|
|
287
|
+
protected waitForOrderCustomerPromotionRefresh(): Promise<void>;
|
|
286
288
|
/**
|
|
287
289
|
* 获取客户分页信息
|
|
288
290
|
* @returns 分页信息
|
|
@@ -326,7 +328,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
326
328
|
* 获取当前的客户搜索条件
|
|
327
329
|
* @returns 当前搜索条件
|
|
328
330
|
*/
|
|
329
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
331
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
330
332
|
/**
|
|
331
333
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
332
334
|
* @returns 客户状态
|
|
@@ -52,6 +52,7 @@ import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resol
|
|
|
52
52
|
import { createUuidV4 } from "../../modules/Order/utils";
|
|
53
53
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
54
54
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
55
|
+
var USER_PLATFORM = ['pc', 'h5'];
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* 读取已有 booking 的协议唯一值,用于加时商品行绑定原预约。
|
|
@@ -178,6 +179,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
178
179
|
_defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
|
|
179
180
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
180
181
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
182
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
181
183
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
182
184
|
return _this;
|
|
183
185
|
}
|
|
@@ -559,7 +561,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
559
561
|
key: "scanPromotionCode",
|
|
560
562
|
value: function () {
|
|
561
563
|
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
|
|
562
|
-
var raw, scannedList, extractedCustomerId, hasOrderCustomer, tempOrder;
|
|
564
|
+
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
563
565
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
564
566
|
while (1) switch (_context7.prev = _context7.next) {
|
|
565
567
|
case 0:
|
|
@@ -575,33 +577,34 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
575
577
|
raw = _context7.sent;
|
|
576
578
|
scannedList = raw.scannedDiscountList || [];
|
|
577
579
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
578
|
-
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
579
|
-
|
|
580
|
-
|
|
580
|
+
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
581
|
+
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
582
|
+
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
583
|
+
_context7.next = 12;
|
|
581
584
|
break;
|
|
582
585
|
}
|
|
583
|
-
_context7.next =
|
|
586
|
+
_context7.next = 12;
|
|
584
587
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
585
|
-
case
|
|
588
|
+
case 12:
|
|
586
589
|
if (!raw.isAvailable) {
|
|
587
|
-
_context7.next =
|
|
590
|
+
_context7.next = 19;
|
|
588
591
|
break;
|
|
589
592
|
}
|
|
590
|
-
_context7.next =
|
|
593
|
+
_context7.next = 15;
|
|
591
594
|
return this.store.order.recalculateSummary({
|
|
592
595
|
createIfMissing: true
|
|
593
596
|
});
|
|
594
|
-
case
|
|
597
|
+
case 15:
|
|
595
598
|
this.store.order.persistTempOrder();
|
|
596
599
|
tempOrder = this.store.order.ensureTempOrder();
|
|
597
|
-
_context7.next =
|
|
600
|
+
_context7.next = 19;
|
|
598
601
|
return this.effectsEmit('onDiscountApplied', {
|
|
599
602
|
productList: tempOrder.products || [],
|
|
600
603
|
discountList: this.store.order.getDiscountList(),
|
|
601
604
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
602
605
|
tempOrder: tempOrder
|
|
603
606
|
});
|
|
604
|
-
case
|
|
607
|
+
case 19:
|
|
605
608
|
return _context7.abrupt("return", _objectSpread(_objectSpread({
|
|
606
609
|
isAvailable: raw.isAvailable
|
|
607
610
|
}, raw.isAccepted !== undefined ? {
|
|
@@ -611,7 +614,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
611
614
|
unavailableReason: raw.unavailableReason,
|
|
612
615
|
scannedDiscountList: raw.scannedDiscountList
|
|
613
616
|
}));
|
|
614
|
-
case
|
|
617
|
+
case 20:
|
|
615
618
|
case "end":
|
|
616
619
|
return _context7.stop();
|
|
617
620
|
}
|
|
@@ -1532,7 +1535,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1532
1535
|
}, {
|
|
1533
1536
|
key: "setOrderCustomer",
|
|
1534
1537
|
value: function setOrderCustomer(customer) {
|
|
1535
|
-
var _this$store$order$get3
|
|
1538
|
+
var _this$store$order$get3,
|
|
1539
|
+
_this3 = this;
|
|
1536
1540
|
if (!customer) {
|
|
1537
1541
|
this.clearOrderCustomer();
|
|
1538
1542
|
return;
|
|
@@ -1561,8 +1565,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1561
1565
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
|
|
1562
1566
|
this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
1563
1567
|
// 客户切换可能改变可用促销/赠品;触发一次重算(recursion-safe)。
|
|
1564
|
-
|
|
1568
|
+
var promotionRefreshTask = this.store.order.applyPromotion().then(function () {
|
|
1569
|
+
return undefined;
|
|
1570
|
+
});
|
|
1571
|
+
this.orderCustomerPromotionRefreshInFlight = promotionRefreshTask;
|
|
1572
|
+
void promotionRefreshTask.then(function () {
|
|
1573
|
+
if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
|
|
1574
|
+
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1575
|
+
}, function (error) {
|
|
1565
1576
|
console.error('[BookingTicket] applyPromotion after customer change failed', error);
|
|
1577
|
+
if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
|
|
1578
|
+
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1566
1579
|
});
|
|
1567
1580
|
}
|
|
1568
1581
|
|
|
@@ -1592,7 +1605,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1592
1605
|
value: function clearOrderCustomer() {
|
|
1593
1606
|
var _discountModule$setOr,
|
|
1594
1607
|
_discountModule$setDi,
|
|
1595
|
-
|
|
1608
|
+
_this4 = this;
|
|
1596
1609
|
this.store.order.clearOrderCustomer();
|
|
1597
1610
|
this.discountConfigCacheKey = null;
|
|
1598
1611
|
this.hasManualDiscountSelection = false;
|
|
@@ -1605,9 +1618,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1605
1618
|
createIfMissing: true
|
|
1606
1619
|
}).then(function () {
|
|
1607
1620
|
var _discountModule$getDi;
|
|
1608
|
-
var tempOrder =
|
|
1609
|
-
|
|
1610
|
-
return
|
|
1621
|
+
var tempOrder = _this4.store.order.ensureTempOrder();
|
|
1622
|
+
_this4.store.order.persistTempOrder();
|
|
1623
|
+
return _this4.effectsEmit('onDiscountApplied', {
|
|
1611
1624
|
productList: tempOrder.products || [],
|
|
1612
1625
|
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
1613
1626
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
@@ -1668,14 +1681,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1668
1681
|
}, {
|
|
1669
1682
|
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
1670
1683
|
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
1671
|
-
var
|
|
1672
|
-
if (!customerId || customerId === 1) return;
|
|
1684
|
+
var _this5 = this;
|
|
1685
|
+
if (!customerId || customerId === 1) return Promise.resolve();
|
|
1673
1686
|
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
1674
|
-
return;
|
|
1687
|
+
return this.orderCustomerDiscountRefreshInFlight;
|
|
1675
1688
|
}
|
|
1676
1689
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1677
1690
|
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1678
|
-
var
|
|
1691
|
+
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1692
|
+
var currentCustomer, tempOrder, orderId, action;
|
|
1679
1693
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1680
1694
|
while (1) switch (_context22.prev = _context22.next) {
|
|
1681
1695
|
case 0:
|
|
@@ -1688,18 +1702,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1688
1702
|
return undefined;
|
|
1689
1703
|
});
|
|
1690
1704
|
case 3:
|
|
1691
|
-
currentCustomer =
|
|
1705
|
+
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1692
1706
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1693
1707
|
_context22.next = 6;
|
|
1694
1708
|
break;
|
|
1695
1709
|
}
|
|
1696
1710
|
return _context22.abrupt("return");
|
|
1697
1711
|
case 6:
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1712
|
+
tempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
|
|
1713
|
+
orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 || (_this5$getOrderIdenti = _this5$getOrderIdenti.call(_this5)) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.orderId);
|
|
1714
|
+
action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1715
|
+
_context22.next = 11;
|
|
1716
|
+
return _this5.loadDiscountConfig({
|
|
1717
|
+
customerId: customerId,
|
|
1718
|
+
action: action
|
|
1701
1719
|
});
|
|
1702
|
-
case
|
|
1720
|
+
case 11:
|
|
1703
1721
|
case "end":
|
|
1704
1722
|
return _context22.stop();
|
|
1705
1723
|
}
|
|
@@ -1710,10 +1728,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1710
1728
|
refreshTask.catch(function (error) {
|
|
1711
1729
|
console.error('Failed to load discount config after customer change:', error);
|
|
1712
1730
|
}).finally(function () {
|
|
1713
|
-
if (
|
|
1714
|
-
|
|
1715
|
-
|
|
1731
|
+
if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
1732
|
+
_this5.orderCustomerDiscountRefreshInFlight = null;
|
|
1733
|
+
_this5.orderCustomerDiscountRefreshCustomerId = null;
|
|
1716
1734
|
});
|
|
1735
|
+
return refreshTask;
|
|
1736
|
+
}
|
|
1737
|
+
}, {
|
|
1738
|
+
key: "waitForOrderCustomerPromotionRefresh",
|
|
1739
|
+
value: function waitForOrderCustomerPromotionRefresh() {
|
|
1740
|
+
return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
|
|
1717
1741
|
}
|
|
1718
1742
|
|
|
1719
1743
|
/**
|
|
@@ -1897,9 +1921,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1897
1921
|
}, {
|
|
1898
1922
|
key: "scanGlobalListener",
|
|
1899
1923
|
value: function scanGlobalListener(callback) {
|
|
1900
|
-
var
|
|
1924
|
+
var _this6 = this;
|
|
1901
1925
|
var localSearch = function localSearch(v) {
|
|
1902
|
-
return
|
|
1926
|
+
return _this6.store.products.findProductsByCodeOrBarcode(v);
|
|
1903
1927
|
};
|
|
1904
1928
|
var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
1905
1929
|
var safeCallback = function safeCallback(d) {
|
|
@@ -2375,7 +2399,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2375
2399
|
key: "handleGlobalScanCode",
|
|
2376
2400
|
value: (function () {
|
|
2377
2401
|
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, bridge) {
|
|
2378
|
-
var
|
|
2402
|
+
var _this7 = this;
|
|
2379
2403
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2380
2404
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2381
2405
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -2393,7 +2417,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2393
2417
|
case 4:
|
|
2394
2418
|
_context28.prev = 4;
|
|
2395
2419
|
localSearch = function localSearch(v) {
|
|
2396
|
-
return
|
|
2420
|
+
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2397
2421
|
};
|
|
2398
2422
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2399
2423
|
_context28.next = 9;
|
|
@@ -2417,35 +2441,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2417
2441
|
_context28.next = 16;
|
|
2418
2442
|
return applyGlobalScan({
|
|
2419
2443
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2420
|
-
return
|
|
2444
|
+
return _this7.setOrderCustomer(customer);
|
|
2421
2445
|
},
|
|
2422
2446
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2423
|
-
return
|
|
2447
|
+
return _this7.getOrderCustomerSnapshot();
|
|
2424
2448
|
},
|
|
2425
2449
|
getBusinessCode: function getBusinessCode() {
|
|
2426
|
-
var
|
|
2427
|
-
return (
|
|
2450
|
+
var _this7$otherParams;
|
|
2451
|
+
return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
|
|
2428
2452
|
},
|
|
2429
2453
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
2430
|
-
return
|
|
2454
|
+
return _this7.buildAddProductCtx(extra);
|
|
2431
2455
|
},
|
|
2432
2456
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
2433
|
-
return
|
|
2457
|
+
return _this7.decideAddProduct(item, options);
|
|
2434
2458
|
},
|
|
2435
2459
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
2436
|
-
return
|
|
2460
|
+
return _this7.decideAfterDetail(cacheItem, options);
|
|
2437
2461
|
},
|
|
2438
2462
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
2439
|
-
return
|
|
2463
|
+
return _this7.transformDetailToProductAndBooking(input);
|
|
2440
2464
|
},
|
|
2441
2465
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2442
|
-
return
|
|
2466
|
+
return _this7.addProductToOrder(product, booking);
|
|
2443
2467
|
},
|
|
2444
2468
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2445
|
-
return
|
|
2469
|
+
return _this7.refreshWalletAssets(params);
|
|
2446
2470
|
},
|
|
2447
2471
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2448
|
-
return
|
|
2472
|
+
return _this7.scanWalletAsset(scanCode);
|
|
2449
2473
|
}
|
|
2450
2474
|
}, formatted, bridge);
|
|
2451
2475
|
case 16:
|
|
@@ -2584,7 +2608,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2584
2608
|
key: "addAddTimeProductsToBooking",
|
|
2585
2609
|
value: (function () {
|
|
2586
2610
|
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
|
|
2587
|
-
var
|
|
2611
|
+
var _this8 = this,
|
|
2588
2612
|
_input$bookingPatch;
|
|
2589
2613
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2590
2614
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
@@ -2599,7 +2623,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2599
2623
|
case 3:
|
|
2600
2624
|
orderLines = (input.products || []).map(function (line) {
|
|
2601
2625
|
return {
|
|
2602
|
-
product:
|
|
2626
|
+
product: _this8.buildAddTimeOrderLine(line, bookingUid)
|
|
2603
2627
|
};
|
|
2604
2628
|
});
|
|
2605
2629
|
if (this.store.order) {
|
|
@@ -75,6 +75,12 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
75
75
|
protected getRegisteredModuleNames(): readonly string[];
|
|
76
76
|
protected createSubModule(moduleName: string): Module | null;
|
|
77
77
|
addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
78
|
+
syncAuthenticatedOrderCustomer(): Promise<boolean>;
|
|
79
|
+
private isAuthenticatedCustomerUserPlatform;
|
|
80
|
+
private resolveDiscountOrderIdentity;
|
|
81
|
+
private resolveDiscountAction;
|
|
82
|
+
private resetCachedCustomerDiscountState;
|
|
83
|
+
private refreshLegacySessionCustomerDiscounts;
|
|
78
84
|
/**
|
|
79
85
|
* Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
|
|
80
86
|
* business/channel target so a reused solution instance cannot leak another entry's menus.
|