@pisell/pisellos 2.2.323 → 2.2.324
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/modules/BookingContext/index.d.ts +2 -2
- package/dist/modules/BookingContext/index.js +55 -25
- package/dist/modules/BookingContext/types.d.ts +2 -0
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/dist/modules/BookingContext/utils/productExtend.js +122 -29
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +16 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +54 -11
- package/dist/modules/Order/index.js +2699 -1411
- package/dist/modules/Order/types.d.ts +43 -5
- package/dist/modules/Order/types.js +4 -0
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +6 -2
- package/dist/modules/ProductList/clientDataVariants.js +6 -2
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +161 -51
- package/dist/modules/ResourcePlanner/planner.js +58 -2
- package/dist/modules/ResourcePlanner/types.d.ts +13 -0
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +58 -39
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1312 -1154
- package/dist/server/modules/order/index.js +2 -1
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +4 -0
- package/dist/shared/receipt/small-ticket.js +70 -12
- package/dist/solution/BaseSales/index.d.ts +39 -5
- package/dist/solution/BaseSales/index.js +1828 -1462
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +17 -3
- package/dist/solution/BookingByStep/index.js +676 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +15 -3
- package/dist/solution/BookingTicket/index.js +249 -135
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/OrderInvoicePreview/index.js +14 -8
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +166 -67
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/dist/solution/UnifiedBookingSales/index.js +3374 -1177
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/dist/solution/UnifiedBookingSales/types.js +7 -1
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/modules/BookingContext/index.d.ts +2 -2
- package/lib/modules/BookingContext/index.js +42 -10
- package/lib/modules/BookingContext/types.d.ts +2 -0
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/lib/modules/BookingContext/utils/productExtend.js +96 -7
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +16 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +54 -11
- package/lib/modules/Order/index.js +659 -80
- package/lib/modules/Order/types.d.ts +43 -5
- package/lib/modules/Order/types.js +2 -0
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +6 -2
- package/lib/modules/ProductList/clientDataVariants.js +6 -2
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +74 -0
- package/lib/modules/ResourcePlanner/planner.js +52 -1
- package/lib/modules/ResourcePlanner/types.d.ts +13 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +25 -9
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +124 -16
- package/lib/server/modules/order/index.js +2 -1
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +4 -0
- package/lib/shared/receipt/small-ticket.js +63 -8
- package/lib/solution/BaseSales/index.d.ts +39 -5
- package/lib/solution/BaseSales/index.js +212 -18
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BookingByStep/index.d.ts +17 -3
- package/lib/solution/BookingByStep/index.js +222 -14
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +15 -3
- package/lib/solution/BookingTicket/index.js +47 -4
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/OrderInvoicePreview/index.js +7 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +72 -2
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/lib/solution/UnifiedBookingSales/index.js +1316 -73
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/lib/solution/UnifiedBookingSales/types.js +4 -1
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -208,6 +208,10 @@ export interface AddAddTimeProductsToBookingInput {
|
|
|
208
208
|
}
|
|
209
209
|
/** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
|
|
210
210
|
export interface GlobalScanHostBridge {
|
|
211
|
+
/** product-voucher handles voucher codes; product-voucher-collection loads all vouchers for the scanned customer. */
|
|
212
|
+
scanScope?: 'all' | 'product-voucher' | 'product-voucher-collection';
|
|
213
|
+
/** A one-shot entry may outlive its page while requests are in flight. */
|
|
214
|
+
isCurrent?: () => boolean;
|
|
211
215
|
openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
|
|
212
216
|
openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
|
|
213
217
|
confirmDetail?: (input: {
|
|
@@ -232,11 +236,13 @@ export interface GlobalScanHostBridge {
|
|
|
232
236
|
*/
|
|
233
237
|
applyPromotionCode?: (code: string, customerId?: number, options?: {
|
|
234
238
|
suppressFailureNotification?: boolean;
|
|
239
|
+
productVouchersOnly?: boolean;
|
|
235
240
|
}) => Promise<{
|
|
236
241
|
isAvailable?: boolean;
|
|
237
242
|
isAccepted?: boolean;
|
|
238
243
|
type?: string;
|
|
239
244
|
unavailableReason?: string;
|
|
245
|
+
scannedDiscountList?: Record<string, any>[];
|
|
240
246
|
}>;
|
|
241
247
|
/** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
|
|
242
248
|
requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
|
|
@@ -244,7 +250,7 @@ export interface GlobalScanHostBridge {
|
|
|
244
250
|
refresh?: () => void;
|
|
245
251
|
}
|
|
246
252
|
/** handleGlobalScanCode 结构化返回 */
|
|
247
|
-
export type GlobalScanHandleResult = {
|
|
253
|
+
export type GlobalScanHandleResult = ({
|
|
248
254
|
status: 'success';
|
|
249
255
|
kind: 'customer' | 'products' | 'promotion';
|
|
250
256
|
meta?: {
|
|
@@ -257,5 +263,11 @@ export type GlobalScanHandleResult = {
|
|
|
257
263
|
status: 'cancelled';
|
|
258
264
|
} | {
|
|
259
265
|
status: 'failed';
|
|
260
|
-
reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge';
|
|
266
|
+
reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge' | 'entry_resolution_failed';
|
|
267
|
+
}) & {
|
|
268
|
+
/** product-voucher-collection returns voucher candidates; the caller decides how to use them. */
|
|
269
|
+
redemption?: {
|
|
270
|
+
source: 'wallet' | 'scan';
|
|
271
|
+
vouchers: Record<string, any>[];
|
|
272
|
+
};
|
|
261
273
|
};
|
|
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
|
|
|
5
5
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
6
6
|
*
|
|
7
7
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
8
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
8
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
9
9
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
10
10
|
*/
|
|
11
11
|
export type AddProductDecision = {
|
|
@@ -41,6 +41,8 @@ export declare function decideAfterDetail(cacheItem: any, ctx?: AddProductDecide
|
|
|
41
41
|
* @deprecated 请用 `decideAddProduct`;保留兼容:autoClose=true 仅表示可直接加车(action=add)。
|
|
42
42
|
*/
|
|
43
43
|
export interface AddProductRequiresDetailPayload {
|
|
44
|
+
/** Same prepared decision cache supplied to the Host; never a separate Flow preflight. */
|
|
45
|
+
preparedCacheItem?: any;
|
|
44
46
|
item: ProductData | Record<string, any>;
|
|
45
47
|
/** UI 需展示的子弹窗开关。 */
|
|
46
48
|
showConfig: {
|
|
@@ -5,15 +5,17 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
|
-
import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
|
|
8
|
+
import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend, getCalendarBookingRange, calendarBookingNeedsInput, calendarBookingPreparationKey } from "../../../modules/BookingContext";
|
|
9
|
+
import { resolveUniqueCartDetailValue } from "./resolveUniqueCartDetail";
|
|
9
10
|
import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
|
|
10
11
|
import { buildProductSkuFromCacheItem } from "./weighingProductSku";
|
|
12
|
+
import { isSelfServicePlatform } from "../../../utils/platform";
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
14
16
|
*
|
|
15
17
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
16
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
18
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
17
19
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
18
20
|
*/
|
|
19
21
|
|
|
@@ -30,11 +32,12 @@ function needsSpecDetailModal(item) {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
35
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
34
36
|
*/
|
|
35
37
|
function needsBookingEdit(cacheItem, ctx) {
|
|
38
|
+
if (getCalendarBookingRange(cacheItem, ctx)) return calendarBookingNeedsInput(cacheItem);
|
|
36
39
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
37
|
-
if ((ctx === null || ctx === void 0 ? void 0 : ctx.channel)
|
|
40
|
+
if (isSelfServicePlatform(ctx === null || ctx === void 0 ? void 0 : ctx.channel)) return true;
|
|
38
41
|
var isAutoAllocationOn = (ctx === null || ctx === void 0 ? void 0 : ctx.isAutoAllocationOn) || function () {
|
|
39
42
|
return true;
|
|
40
43
|
};
|
|
@@ -53,13 +56,22 @@ function buildRequiresBookingEditPayload(cacheItem, ctx) {
|
|
|
53
56
|
*/
|
|
54
57
|
export function decideAddProduct(item, ctx) {
|
|
55
58
|
var derivedCtx = withDerivedBookingCtx(ctx);
|
|
56
|
-
|
|
59
|
+
var calendarRange = getCalendarBookingRange(item, derivedCtx);
|
|
60
|
+
var uniqueValue = calendarRange ? resolveUniqueCartDetailValue(item) : null;
|
|
61
|
+
var selectedItem = uniqueValue ? _objectSpread(_objectSpread({}, item), {}, {
|
|
62
|
+
cartDetailValue: uniqueValue,
|
|
63
|
+
isOpenDetailModal: false
|
|
64
|
+
}) : item;
|
|
65
|
+
if (needsSpecDetailModal(selectedItem)) {
|
|
66
|
+
var preparedCacheItem = calendarRange ? prepareBookingCacheItem(buildCacheItemFromCartDetail(item, derivedCtx), derivedCtx) : undefined;
|
|
57
67
|
return {
|
|
58
68
|
action: 'requiresDetail',
|
|
59
|
-
payload: buildRequiresDetailPayload(item, derivedCtx)
|
|
69
|
+
payload: _objectSpread(_objectSpread({}, buildRequiresDetailPayload(item, derivedCtx)), preparedCacheItem ? {
|
|
70
|
+
preparedCacheItem: preparedCacheItem
|
|
71
|
+
} : {})
|
|
60
72
|
};
|
|
61
73
|
}
|
|
62
|
-
var cacheItem = prepareBookingCacheItem(buildCacheItemFromCartDetail(
|
|
74
|
+
var cacheItem = prepareBookingCacheItem(buildCacheItemFromCartDetail(selectedItem, derivedCtx), derivedCtx);
|
|
63
75
|
if (needsBookingEdit(cacheItem, derivedCtx)) {
|
|
64
76
|
return {
|
|
65
77
|
action: 'requiresBookingEdit',
|
|
@@ -141,7 +153,23 @@ function isMultiDayLike(cacheItem) {
|
|
|
141
153
|
* `_extend.resource / capacity / startDate / endDate` 等后续 booking mapper 需要的字段。
|
|
142
154
|
*/
|
|
143
155
|
export function prepareBookingCacheItem(cacheItem, ctx) {
|
|
144
|
-
|
|
156
|
+
var _ctx, _cacheItem$duration2, _cacheItem$_extend, _ctx2;
|
|
157
|
+
if (getCalendarBookingRange(cacheItem, ctx)) {
|
|
158
|
+
var _cacheItem$_data;
|
|
159
|
+
if (((_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.calendarBookingPreparationKey) === calendarBookingPreparationKey(cacheItem, ctx)) return cacheItem;
|
|
160
|
+
return getProductExtend({
|
|
161
|
+
cacheItem: cacheItem,
|
|
162
|
+
ctx: ctx,
|
|
163
|
+
isDisabledTime: true
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if ((_ctx = ctx) !== null && _ctx !== void 0 && _ctx.bookingTimeRangeFromCalendar && (((_cacheItem$duration2 = cacheItem.duration) === null || _cacheItem$duration2 === void 0 ? void 0 : _cacheItem$duration2.type) === 'days' || cacheItem.duration_type === 'days' || ((_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.sub_type) === 'days')) {
|
|
167
|
+
ctx = _objectSpread(_objectSpread({}, ctx), {}, {
|
|
168
|
+
bookingTimeRangeFromCalendar: undefined,
|
|
169
|
+
resourceIdFromCalendar: undefined
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (((_ctx2 = ctx) === null || _ctx2 === void 0 ? void 0 : _ctx2.rememberedTime) === undefined && (isNormalBookingProduct(cacheItem) || hasPreparedBookingExtend(cacheItem))) {
|
|
145
173
|
return cacheItem;
|
|
146
174
|
}
|
|
147
175
|
return getProductExtend({
|
|
@@ -319,9 +347,9 @@ export function transformDetailToProductAndBooking(cacheItem, ctx) {
|
|
|
319
347
|
* 把 cacheItem._extend.other 中的字段 + 顶层运行态拼成 `BaseProductDetailPayload`。
|
|
320
348
|
*/
|
|
321
349
|
function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
322
|
-
var _cacheItem$
|
|
323
|
-
var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$
|
|
324
|
-
var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$
|
|
350
|
+
var _cacheItem$_extend2, _cacheItem$_extend$qu, _cacheItem$_extend3, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _other$production_cod, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2, _cacheItem$metadata$s, _cacheItem$metadata, _extend$metadata;
|
|
351
|
+
var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.other) || {};
|
|
352
|
+
var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend3 = cacheItem._extend) === null || _cacheItem$_extend3 === void 0 ? void 0 : _cacheItem$_extend3.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
|
|
325
353
|
var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
|
|
326
354
|
var extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
|
|
327
355
|
var productSku = buildProductSkuFromCacheItem(cacheItem);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type RecordValue = Record<string, any>;
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a whole SKU only when the original configuration proves one legal
|
|
4
|
+
* result. A default, a stock-filtered remainder, or missing detail is not proof
|
|
5
|
+
* of uniqueness. The input product and its existing selections stay untouched.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveUniqueCartDetailValue(product: RecordValue): RecordValue | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
+
var flag = function flag(value) {
|
|
19
|
+
return value === true || value === 1 || value === '1';
|
|
20
|
+
};
|
|
21
|
+
var cleared = function cleared(value) {
|
|
22
|
+
return value === false || value === 0 || value === '0';
|
|
23
|
+
};
|
|
24
|
+
var enabled = function enabled(item) {
|
|
25
|
+
return item && !flag(item.disabled) && !cleared(item.is_enabled) && item.deleted_at == null;
|
|
26
|
+
};
|
|
27
|
+
var sellable = function sellable(item) {
|
|
28
|
+
return enabled(item) && (!flag(item.is_track) || flag(item.over_sold) || Number(item.stock_quantity) > 0);
|
|
29
|
+
};
|
|
30
|
+
var bound = function bound(value) {
|
|
31
|
+
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
32
|
+
if (value == null || value === '') return fallback;
|
|
33
|
+
if (typeof value !== 'number' && typeof value !== 'string') return null;
|
|
34
|
+
var number = Number(value);
|
|
35
|
+
return Number.isInteger(number) && number >= 0 ? number : null;
|
|
36
|
+
};
|
|
37
|
+
var validId = function validId(value) {
|
|
38
|
+
return (typeof value === 'number' || typeof value === 'string') && Number.isSafeInteger(Number(value)) && Number(value) > 0;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** A choice is unique only if its complete allowed quantity interval is one value. */
|
|
42
|
+
function fixedQuantity(minimums, maximums) {
|
|
43
|
+
var min = Math.max.apply(Math, [1].concat(_toConsumableArray(minimums)));
|
|
44
|
+
var max = Math.min.apply(Math, _toConsumableArray(maximums.filter(function (value) {
|
|
45
|
+
return value > 0;
|
|
46
|
+
})).concat([Infinity]));
|
|
47
|
+
return min === max ? min : null;
|
|
48
|
+
}
|
|
49
|
+
function configuredGroups(product, key, countKey) {
|
|
50
|
+
var groups = product[key];
|
|
51
|
+
if (groups == null && product[countKey] == null) return null;
|
|
52
|
+
var count = bound(product[countKey]);
|
|
53
|
+
if (count == null || groups != null && !Array.isArray(groups)) return null;
|
|
54
|
+
if (count > 0 && (!Array.isArray(groups) || groups.length !== count)) return null;
|
|
55
|
+
return groups || [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Resolve a whole SKU only when the original configuration proves one legal
|
|
60
|
+
* result. A default, a stock-filtered remainder, or missing detail is not proof
|
|
61
|
+
* of uniqueness. The input product and its existing selections stay untouched.
|
|
62
|
+
*/
|
|
63
|
+
export function resolveUniqueCartDetailValue(product) {
|
|
64
|
+
var _product$id, _product$id2, _product$option_group, _product$bundle_group, _product$bundle_group2, _product$variant_grou, _existing$option, _existing$bundle, _ref2, _value$session$key;
|
|
65
|
+
if (!product || !validId((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id) || flag(product.open_sold_weight)) return null;
|
|
66
|
+
var productId = (_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id;
|
|
67
|
+
var existing = product.cartDetailValue;
|
|
68
|
+
var hasConfiguredSku = flag(product.is_variant) || Number(product.variant_count) > 0 || Number(product.option_group_count) > 0 || Number(product.bundle_group_count) > 0 || ((_product$option_group = product.option_group) === null || _product$option_group === void 0 ? void 0 : _product$option_group.length) > 0 || ((_product$bundle_group = product.bundle_group) === null || _product$bundle_group === void 0 ? void 0 : _product$bundle_group.length) > 0 || ((_product$bundle_group2 = product.bundle_groups) === null || _product$bundle_group2 === void 0 ? void 0 : _product$bundle_group2.length) > 0 || ((_product$variant_grou = product.variant_group) === null || _product$variant_grou === void 0 ? void 0 : _product$variant_grou.length) > 0;
|
|
69
|
+
if (existing && !hasConfiguredSku && !((_existing$option = existing.option) !== null && _existing$option !== void 0 && _existing$option.length || (_existing$bundle = existing.bundle) !== null && _existing$bundle !== void 0 && _existing$bundle.length)) {
|
|
70
|
+
return _objectSpread(_objectSpread({}, existing), {}, {
|
|
71
|
+
product_id: productId,
|
|
72
|
+
quantity: 1
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
var knowsVariantShape = cleared(product.is_variant) || product.variant_count === 0 || product.variant_count === '0' || Array.isArray(product.variant) || Array.isArray(product.variant_group);
|
|
76
|
+
if (!knowsVariantShape) return null;
|
|
77
|
+
var optionGroups = configuredGroups(product, 'option_group', 'option_group_count');
|
|
78
|
+
var bundleKey = product.bundle_group != null ? 'bundle_group' : 'bundle_groups';
|
|
79
|
+
var bundleGroups = configuredGroups(product, bundleKey, 'bundle_group_count');
|
|
80
|
+
if (!optionGroups || !bundleGroups) return null;
|
|
81
|
+
var value = _objectSpread(_objectSpread({}, product.cartDetailValue || {}), {}, {
|
|
82
|
+
product_id: productId,
|
|
83
|
+
product_variant_id: 0,
|
|
84
|
+
option: [],
|
|
85
|
+
bundle: [],
|
|
86
|
+
quantity: 1
|
|
87
|
+
});
|
|
88
|
+
var hasVariant = flag(product.is_variant) || Number(product.variant_count) > 0 || Array.isArray(product.variant_group) && product.variant_group.length > 0 || Array.isArray(product.variant) && product.variant.length > 0;
|
|
89
|
+
if (hasVariant) {
|
|
90
|
+
var _ref, _variant$production_c;
|
|
91
|
+
if (!Array.isArray(product.variant) || product.variant.length !== 1 || Number(product.variant_count) > 0 && Number(product.variant_count) !== 1) return null;
|
|
92
|
+
var _product$variant = _slicedToArray(product.variant, 1),
|
|
93
|
+
variant = _product$variant[0];
|
|
94
|
+
if (!validId(variant === null || variant === void 0 ? void 0 : variant.id) || !sellable(variant)) return null;
|
|
95
|
+
value.product_variant_id = variant.id;
|
|
96
|
+
if (variant.price == null || variant.price === '' || !Number.isFinite(Number(variant.price)) || Number(variant.price) < 0) return null;
|
|
97
|
+
value.price = variant.price;
|
|
98
|
+
value.production_code = (_ref = (_variant$production_c = variant.production_code) !== null && _variant$production_c !== void 0 ? _variant$production_c : variant.code) !== null && _ref !== void 0 ? _ref : '';
|
|
99
|
+
}
|
|
100
|
+
var _iterator = _createForOfIteratorHelper(optionGroups),
|
|
101
|
+
_step;
|
|
102
|
+
try {
|
|
103
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
104
|
+
var _group$metadata, _group$metadata2, _group$metadata3, _ref3, _item$price;
|
|
105
|
+
var group = _step.value;
|
|
106
|
+
// Do not silently remove configured alternatives that are disabled or out of stock.
|
|
107
|
+
if (!validId(group === null || group === void 0 ? void 0 : group.id) || !enabled(group) || !Array.isArray(group.option_item) || group.option_item.length !== 1) return null;
|
|
108
|
+
var _group$option_item = _slicedToArray(group.option_item, 1),
|
|
109
|
+
item = _group$option_item[0];
|
|
110
|
+
if (!validId(item === null || item === void 0 ? void 0 : item.id) || !sellable(item)) return null;
|
|
111
|
+
var multiple = flag(group.is_multiple);
|
|
112
|
+
var groupMin = bound(group.min_quantity);
|
|
113
|
+
var groupMax = bound(group.max_quantity);
|
|
114
|
+
var itemMin = bound(item.min_quantity);
|
|
115
|
+
var itemMax = bound(item.max_quantity, 1);
|
|
116
|
+
if ([groupMin, groupMax, itemMin, itemMax].some(function (value) {
|
|
117
|
+
return value == null;
|
|
118
|
+
})) return null;
|
|
119
|
+
var advanced = multiple && flag((_group$metadata = group.metadata) === null || _group$metadata === void 0 ? void 0 : _group$metadata.advanced_settings_enabled);
|
|
120
|
+
var minTypes = advanced ? bound((_group$metadata2 = group.metadata) === null || _group$metadata2 === void 0 || (_group$metadata2 = _group$metadata2.option_types_config) === null || _group$metadata2 === void 0 ? void 0 : _group$metadata2.min) : 0;
|
|
121
|
+
var maxTypes = advanced ? bound((_group$metadata3 = group.metadata) === null || _group$metadata3 === void 0 || (_group$metadata3 = _group$metadata3.option_types_config) === null || _group$metadata3 === void 0 ? void 0 : _group$metadata3.max) : 0;
|
|
122
|
+
if (minTypes == null || maxTypes == null || minTypes > 1 || maxTypes > 0 && maxTypes < minTypes) return null;
|
|
123
|
+
var required = multiple ? groupMin > 0 || minTypes > 0 : flag(group.required);
|
|
124
|
+
if (!required) return null;
|
|
125
|
+
var quantity = fixedQuantity([itemMin].concat(_toConsumableArray(multiple ? [groupMin] : [])), [itemMax].concat(_toConsumableArray(multiple ? [groupMax] : [])));
|
|
126
|
+
if (!quantity) return null;
|
|
127
|
+
var price = (_ref3 = (_item$price = item.price) !== null && _item$price !== void 0 ? _item$price : item.add_price) !== null && _ref3 !== void 0 ? _ref3 : 0;
|
|
128
|
+
value.option.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
129
|
+
id: item.id,
|
|
130
|
+
product_option_item_id: item.id,
|
|
131
|
+
option_group_item_id: item.id,
|
|
132
|
+
option_group_id: group.id,
|
|
133
|
+
product_id: productId,
|
|
134
|
+
quantity: quantity,
|
|
135
|
+
num: quantity,
|
|
136
|
+
price: price,
|
|
137
|
+
original_price: price
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
} catch (err) {
|
|
141
|
+
_iterator.e(err);
|
|
142
|
+
} finally {
|
|
143
|
+
_iterator.f();
|
|
144
|
+
}
|
|
145
|
+
var _iterator2 = _createForOfIteratorHelper(bundleGroups),
|
|
146
|
+
_step2;
|
|
147
|
+
try {
|
|
148
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
149
|
+
var _item$option_group, _item$variant_group, _item$variant, _item$bundle_group, _item$bundle_groups;
|
|
150
|
+
var _group = _step2.value;
|
|
151
|
+
if (!validId(_group === null || _group === void 0 ? void 0 : _group.id) || !enabled(_group) || !Array.isArray(_group.bundle_item) || _group.bundle_item.length !== 1) return null;
|
|
152
|
+
var _group$bundle_item = _slicedToArray(_group.bundle_item, 1),
|
|
153
|
+
_item = _group$bundle_item[0];
|
|
154
|
+
if (!validId(_item === null || _item === void 0 ? void 0 : _item.id) || !validId(_item === null || _item === void 0 ? void 0 : _item.bundle_product_id) || !sellable(_item) || (_item$option_group = _item.option_group) !== null && _item$option_group !== void 0 && _item$option_group.length || (_item$variant_group = _item.variant_group) !== null && _item$variant_group !== void 0 && _item$variant_group.length || (_item$variant = _item.variant) !== null && _item$variant !== void 0 && _item$variant.length || (_item$bundle_group = _item.bundle_group) !== null && _item$bundle_group !== void 0 && _item$bundle_group.length || (_item$bundle_groups = _item.bundle_groups) !== null && _item$bundle_groups !== void 0 && _item$bundle_groups.length || flag(_item.is_variant) || flag(_item.open_sold_weight) || Number(_item.variant_count) > 0 || Number(_item.option_group_count) > 0 || Number(_item.bundle_group_count) > 0) return null;
|
|
155
|
+
var _groupMin = bound(_group.min_quantity);
|
|
156
|
+
var _groupMax = bound(_group.max_quantity);
|
|
157
|
+
var _itemMin = bound(_item.min_quantity);
|
|
158
|
+
var _itemMax = bound(_item.max_quantity);
|
|
159
|
+
if ([_groupMin, _groupMax, _itemMin, _itemMax].some(function (value) {
|
|
160
|
+
return value == null;
|
|
161
|
+
}) || _groupMin <= 0) return null;
|
|
162
|
+
var _quantity = fixedQuantity([_groupMin, _itemMin], [_groupMax, _itemMax]);
|
|
163
|
+
if (!_quantity) return null;
|
|
164
|
+
value.bundle.push(_objectSpread(_objectSpread({}, _item), {}, {
|
|
165
|
+
id: _item.id,
|
|
166
|
+
group_id: _group.id,
|
|
167
|
+
bundle_group_id: _group.id,
|
|
168
|
+
_bundle_product_id: _item.bundle_product_id,
|
|
169
|
+
quantity: _quantity,
|
|
170
|
+
num: _quantity,
|
|
171
|
+
option: []
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
} catch (err) {
|
|
175
|
+
_iterator2.e(err);
|
|
176
|
+
} finally {
|
|
177
|
+
_iterator2.f();
|
|
178
|
+
}
|
|
179
|
+
var key = [productId, value.product_variant_id].concat(_toConsumableArray(value.option.map(function (item) {
|
|
180
|
+
return "o".concat(item.option_group_id, ":").concat(item.id, ":").concat(item.quantity);
|
|
181
|
+
})), _toConsumableArray(value.bundle.map(function (item) {
|
|
182
|
+
return "b".concat(item.group_id, ":").concat(item.id, ":").concat(item.quantity);
|
|
183
|
+
})), _toConsumableArray(value.session ? ["s".concat((_ref2 = (_value$session$key = value.session.key) !== null && _value$session$key !== void 0 ? _value$session$key : value.session.id) !== null && _ref2 !== void 0 ? _ref2 : '')] : [])).join('_');
|
|
184
|
+
return _objectSpread(_objectSpread({}, value), {}, {
|
|
185
|
+
key: key,
|
|
186
|
+
rowKey: key
|
|
187
|
+
});
|
|
188
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GlobalScanHandleResult, GlobalScanHostBridge } from '../../types';
|
|
2
|
+
import { type GlobalScanApplyHost } from './applyGlobalScan';
|
|
3
|
+
import type { GlobalScanFormattedResult } from './formatGlobalScan';
|
|
4
|
+
export interface ProductVoucherCollectionScanHost extends GlobalScanApplyHost {
|
|
5
|
+
loadCustomerDiscounts(): Promise<Record<string, any>[]>;
|
|
6
|
+
}
|
|
7
|
+
/** Resolve the scanned account, then collect all of that customer's vouchers. */
|
|
8
|
+
export declare function applyProductVoucherCollectionScan(host: ProductVoucherCollectionScanHost, formatted: GlobalScanFormattedResult, bridge: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
import { applyGlobalScan } from "./applyGlobalScan";
|
|
11
|
+
/** Resolve the scanned account, then collect all of that customer's vouchers. */
|
|
12
|
+
export function applyProductVoucherCollectionScan(_x, _x2, _x3) {
|
|
13
|
+
return _applyProductVoucherCollectionScan.apply(this, arguments);
|
|
14
|
+
}
|
|
15
|
+
function _applyProductVoucherCollectionScan() {
|
|
16
|
+
_applyProductVoucherCollectionScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(host, formatted, bridge) {
|
|
17
|
+
var _ref, _formatted$customerId, _formatted$data, _formatted$data2, _bridge$requestCustom;
|
|
18
|
+
var assertCurrent, isPass, customerScan, result, vouchers;
|
|
19
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
20
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
assertCurrent = function assertCurrent() {
|
|
23
|
+
var _bridge$isCurrent;
|
|
24
|
+
if (((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false) {
|
|
25
|
+
throw new DOMException('Scan session ended', 'AbortError');
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
isPass = formatted.searchType === 'walletPass'; // Order numbers and wristbands resolve through batch-search. Their returned
|
|
29
|
+
// passes identify the customer; they are not the collection's voucher list.
|
|
30
|
+
// Resolve source-shop IDs before reusing the wallet customer-binding flow.
|
|
31
|
+
customerScan = isPass ? _objectSpread(_objectSpread({}, formatted), {}, {
|
|
32
|
+
searchType: 'wallet',
|
|
33
|
+
customerId: (_ref = (_formatted$customerId = formatted.customerId) !== null && _formatted$customerId !== void 0 ? _formatted$customerId : (_formatted$data = formatted.data) === null || _formatted$data === void 0 ? void 0 : _formatted$data.id) !== null && _ref !== void 0 ? _ref : (_formatted$data2 = formatted.data) === null || _formatted$data2 === void 0 ? void 0 : _formatted$data2.customer_id,
|
|
34
|
+
isCrossShopWallet: true
|
|
35
|
+
}) : formatted;
|
|
36
|
+
assertCurrent();
|
|
37
|
+
_context2.next = 6;
|
|
38
|
+
return applyGlobalScan(_objectSpread(_objectSpread({}, host), {}, {
|
|
39
|
+
setOrderCustomer: function setOrderCustomer(customer) {
|
|
40
|
+
assertCurrent();
|
|
41
|
+
host.setOrderCustomer(customer);
|
|
42
|
+
},
|
|
43
|
+
addProductToOrder: function addProductToOrder(product, booking) {
|
|
44
|
+
assertCurrent();
|
|
45
|
+
return host.addProductToOrder(product, booking);
|
|
46
|
+
}
|
|
47
|
+
}), customerScan, _objectSpread(_objectSpread({}, bridge), {}, {
|
|
48
|
+
// Without a switch bridge, do not return the previous customer's vouchers.
|
|
49
|
+
requestCustomerSwitch: (_bridge$requestCustom = bridge.requestCustomerSwitch) !== null && _bridge$requestCustom !== void 0 ? _bridge$requestCustom : /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
50
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
51
|
+
while (1) switch (_context.prev = _context.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
return _context.abrupt("return", false);
|
|
54
|
+
case 1:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
58
|
+
}, _callee);
|
|
59
|
+
}))
|
|
60
|
+
}));
|
|
61
|
+
case 6:
|
|
62
|
+
result = _context2.sent;
|
|
63
|
+
assertCurrent();
|
|
64
|
+
if (!(customerScan.searchType === 'wallet' && result.status === 'success')) {
|
|
65
|
+
_context2.next = 14;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
_context2.next = 11;
|
|
69
|
+
return host.loadCustomerDiscounts();
|
|
70
|
+
case 11:
|
|
71
|
+
vouchers = _context2.sent;
|
|
72
|
+
assertCurrent();
|
|
73
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
74
|
+
redemption: {
|
|
75
|
+
source: isPass ? 'scan' : 'wallet',
|
|
76
|
+
vouchers: vouchers
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
case 14:
|
|
80
|
+
return _context2.abrupt("return", result);
|
|
81
|
+
case 15:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context2.stop();
|
|
84
|
+
}
|
|
85
|
+
}, _callee2);
|
|
86
|
+
}));
|
|
87
|
+
return _applyProductVoucherCollectionScan.apply(this, arguments);
|
|
88
|
+
}
|
|
@@ -10,6 +10,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
10
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
11
|
import { searchWalletPass, searchWallet, searchProduct, searchOrder } from "./cloudSearch";
|
|
12
12
|
import scanCache from "./scanCache";
|
|
13
|
+
import { isSelfServicePlatform } from "../../../../utils/platform";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Promise.any 的替代实现
|
|
@@ -161,7 +162,7 @@ export var handleGlobalScan = function handleGlobalScan(request, localSearch, ch
|
|
|
161
162
|
if (value.startsWith('WL')) {
|
|
162
163
|
requestList = [searchWallet(request, value)];
|
|
163
164
|
} else {
|
|
164
|
-
requestList = [].concat(_toConsumableArray(channel
|
|
165
|
+
requestList = [].concat(_toConsumableArray(isSelfServicePlatform(channel) ? [] : [searchOrder(request, value)]), [searchWalletPass(request, value), searchWallet(request, value), searchProduct(request, value)]);
|
|
165
166
|
}
|
|
166
167
|
return requestList;
|
|
167
168
|
};
|
|
@@ -187,8 +187,8 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
187
187
|
error: null
|
|
188
188
|
});
|
|
189
189
|
var task = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
190
|
-
var
|
|
191
|
-
var _yield$Promise$all, _yield$Promise$all2, snapshot, context, template, source, getData, coreData, shop, languageOptions, remembered, selected, locale, result;
|
|
190
|
+
var _appPlugin$getData, _appPlugin$getApp, _hostApp$models, _hostApp$models$getSt, _hostApp$models$getSt2, _hostApp$models$getSt3, _hostApp$data, _hostApp$data$getStor, _hostApp$data$getStor2, _hostApp$data$getStor3, _coreData$core, _this3$languageSelect;
|
|
191
|
+
var _yield$Promise$all, _yield$Promise$all2, snapshot, context, template, source, appPlugin, getData, coreData, hostApp, shopCore, shop, languageOptions, remembered, selected, locale, result;
|
|
192
192
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
193
193
|
while (1) switch (_context.prev = _context.next) {
|
|
194
194
|
case 0:
|
|
@@ -201,23 +201,29 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
201
201
|
context = _yield$Promise$all2[1];
|
|
202
202
|
template = _yield$Promise$all2[2];
|
|
203
203
|
source = withPaymentMethodNames(snapshot, context.methods);
|
|
204
|
-
|
|
204
|
+
appPlugin = _this3.core.getPlugin('app');
|
|
205
|
+
getData = appPlugin === null || appPlugin === void 0 || (_appPlugin$getData = appPlugin.getData) === null || _appPlugin$getData === void 0 ? void 0 : _appPlugin$getData.call(appPlugin);
|
|
205
206
|
if (!((getData === null || getData === void 0 ? void 0 : getData('shop_id')) != null && String(getData('shop_id')) !== String(input.shopId))) {
|
|
206
|
-
_context.next =
|
|
207
|
+
_context.next = 12;
|
|
207
208
|
break;
|
|
208
209
|
}
|
|
209
210
|
throw new Error('Invoice shop changed');
|
|
210
|
-
case
|
|
211
|
+
case 12:
|
|
211
212
|
coreData = getData === null || getData === void 0 ? void 0 : getData('core');
|
|
213
|
+
hostApp = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
|
|
214
|
+
shopCore = (hostApp === null || hostApp === void 0 || (_hostApp$models = hostApp.models) === null || _hostApp$models === void 0 || (_hostApp$models$getSt = _hostApp$models.getStore) === null || _hostApp$models$getSt === void 0 || (_hostApp$models$getSt2 = (_hostApp$models$getSt3 = _hostApp$models$getSt.call(_hostApp$models)).getDataByModel) === null || _hostApp$models$getSt2 === void 0 ? void 0 : _hostApp$models$getSt2.call(_hostApp$models$getSt3, 'core', 'core')) || (hostApp === null || hostApp === void 0 || (_hostApp$data = hostApp.data) === null || _hostApp$data === void 0 || (_hostApp$data = _hostApp$data.store) === null || _hostApp$data === void 0 || (_hostApp$data$getStor = _hostApp$data.getStore) === null || _hostApp$data$getStor === void 0 || (_hostApp$data$getStor2 = (_hostApp$data$getStor3 = _hostApp$data$getStor.call(_hostApp$data)).getDataByModel) === null || _hostApp$data$getStor2 === void 0 ? void 0 : _hostApp$data$getStor2.call(_hostApp$data$getStor3, 'core', 'core')) || (coreData === null || coreData === void 0 ? void 0 : coreData.core) || coreData || {};
|
|
212
215
|
shop = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (coreData === null || coreData === void 0 || (_coreData$core = coreData.core) === null || _coreData$core === void 0 ? void 0 : _coreData$core.shop) || (coreData === null || coreData === void 0 ? void 0 : coreData.shop) || {}), (getData === null || getData === void 0 ? void 0 : getData('shop_info')) || {}), input.shop), context.shop), getData !== null && getData !== void 0 && getData('tax_country_code') ? {
|
|
213
216
|
tax_country_code: getData('tax_country_code')
|
|
214
217
|
} : {});
|
|
218
|
+
shop.default_domain || (shop.default_domain = shopCore.default_domain);
|
|
219
|
+
shop.private_domain || (shop.private_domain = shopCore.private_domain);
|
|
220
|
+
shop.private_domain_protocol || (shop.private_domain_protocol = shopCore.private_domain_protocol);
|
|
215
221
|
if (!(generation !== _this3.generation || _this3.disposed)) {
|
|
216
|
-
_context.next =
|
|
222
|
+
_context.next = 21;
|
|
217
223
|
break;
|
|
218
224
|
}
|
|
219
225
|
throw new Error('Invoice request superseded');
|
|
220
|
-
case
|
|
226
|
+
case 21:
|
|
221
227
|
languageOptions = resolveCustomerInvoiceLanguages(template.language, input.locale);
|
|
222
228
|
remembered = (_this3$languageSelect = _this3.languageSelection) === null || _this3$languageSelect === void 0 ? void 0 : _this3$languageSelect.code;
|
|
223
229
|
selected = languageOptions.find(function (option) {
|
|
@@ -254,7 +260,7 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
254
260
|
error: null
|
|
255
261
|
});
|
|
256
262
|
return _context.abrupt("return", result);
|
|
257
|
-
case
|
|
263
|
+
case 28:
|
|
258
264
|
case "end":
|
|
259
265
|
return _context.stop();
|
|
260
266
|
}
|
|
@@ -101,6 +101,8 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
|
|
|
101
101
|
private buildSubmitPayloadEnhancer;
|
|
102
102
|
private isScanOrderMoreMode;
|
|
103
103
|
private submitScanOrderMore;
|
|
104
|
+
/** Read both current and legacy cart snapshots without changing the product catalog. */
|
|
105
|
+
private getMenuAvailabilityProductSources;
|
|
104
106
|
submitScanOrder<T = any>(): Promise<T>;
|
|
105
107
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
106
108
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|