@pisell/pisellos 2.2.323 → 2.2.325
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/model/strategy/adapter/promotion/index.js +9 -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 +55 -12
- 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/Product/index.d.ts +1 -1
- 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 +8 -0
- package/dist/server/index.js +1458 -1166
- 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 +16 -2
- 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/model/strategy/adapter/promotion/index.js +46 -1
- 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 +55 -12
- 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/Product/index.d.ts +1 -1
- 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 +8 -0
- package/lib/server/index.js +194 -19
- 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 +16 -2
- 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
|
@@ -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: {
|
|
@@ -15,14 +15,16 @@ exports.prepareBookingCacheItem = prepareBookingCacheItem;
|
|
|
15
15
|
exports.transformDetailToProductAndBooking = transformDetailToProductAndBooking;
|
|
16
16
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
17
17
|
var _BookingContext = require("../../../modules/BookingContext");
|
|
18
|
+
var _resolveUniqueCartDetail = require("./resolveUniqueCartDetail");
|
|
18
19
|
var _transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
|
|
19
20
|
var _weighingProductSku = require("./weighingProductSku");
|
|
21
|
+
var _platform = require("../../../utils/platform");
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
/**
|
|
22
24
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
23
25
|
*
|
|
24
26
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
25
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
27
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
26
28
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
27
29
|
*/
|
|
28
30
|
|
|
@@ -39,11 +41,12 @@ function needsSpecDetailModal(item) {
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
44
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
43
45
|
*/
|
|
44
46
|
function needsBookingEdit(cacheItem, ctx) {
|
|
47
|
+
if ((0, _BookingContext.getCalendarBookingRange)(cacheItem, ctx)) return (0, _BookingContext.calendarBookingNeedsInput)(cacheItem);
|
|
45
48
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
46
|
-
if (ctx?.channel
|
|
49
|
+
if ((0, _platform.isSelfServicePlatform)(ctx?.channel)) return true;
|
|
47
50
|
const isAutoAllocationOn = ctx?.isAutoAllocationOn || (() => true);
|
|
48
51
|
return !(0, _BookingContext.getIsAutoClose)(cacheItem, isAutoAllocationOn);
|
|
49
52
|
}
|
|
@@ -60,13 +63,26 @@ function buildRequiresBookingEditPayload(cacheItem, ctx) {
|
|
|
60
63
|
*/
|
|
61
64
|
function decideAddProduct(item, ctx) {
|
|
62
65
|
const derivedCtx = withDerivedBookingCtx(ctx);
|
|
63
|
-
|
|
66
|
+
const calendarRange = (0, _BookingContext.getCalendarBookingRange)(item, derivedCtx);
|
|
67
|
+
const uniqueValue = calendarRange ? (0, _resolveUniqueCartDetail.resolveUniqueCartDetailValue)(item) : null;
|
|
68
|
+
const selectedItem = uniqueValue ? {
|
|
69
|
+
...item,
|
|
70
|
+
cartDetailValue: uniqueValue,
|
|
71
|
+
isOpenDetailModal: false
|
|
72
|
+
} : item;
|
|
73
|
+
if (needsSpecDetailModal(selectedItem)) {
|
|
74
|
+
const preparedCacheItem = calendarRange ? prepareBookingCacheItem(buildCacheItemFromCartDetail(item, derivedCtx), derivedCtx) : undefined;
|
|
64
75
|
return {
|
|
65
76
|
action: 'requiresDetail',
|
|
66
|
-
payload:
|
|
77
|
+
payload: {
|
|
78
|
+
...buildRequiresDetailPayload(item, derivedCtx),
|
|
79
|
+
...(preparedCacheItem ? {
|
|
80
|
+
preparedCacheItem
|
|
81
|
+
} : {})
|
|
82
|
+
}
|
|
67
83
|
};
|
|
68
84
|
}
|
|
69
|
-
const cacheItem = prepareBookingCacheItem(buildCacheItemFromCartDetail(
|
|
85
|
+
const cacheItem = prepareBookingCacheItem(buildCacheItemFromCartDetail(selectedItem, derivedCtx), derivedCtx);
|
|
70
86
|
if (needsBookingEdit(cacheItem, derivedCtx)) {
|
|
71
87
|
return {
|
|
72
88
|
action: 'requiresBookingEdit',
|
|
@@ -146,6 +162,21 @@ function isMultiDayLike(cacheItem) {
|
|
|
146
162
|
* `_extend.resource / capacity / startDate / endDate` 等后续 booking mapper 需要的字段。
|
|
147
163
|
*/
|
|
148
164
|
function prepareBookingCacheItem(cacheItem, ctx) {
|
|
165
|
+
if ((0, _BookingContext.getCalendarBookingRange)(cacheItem, ctx)) {
|
|
166
|
+
if (cacheItem._data?.calendarBookingPreparationKey === (0, _BookingContext.calendarBookingPreparationKey)(cacheItem, ctx)) return cacheItem;
|
|
167
|
+
return (0, _BookingContext.getProductExtend)({
|
|
168
|
+
cacheItem,
|
|
169
|
+
ctx: ctx,
|
|
170
|
+
isDisabledTime: true
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (ctx?.bookingTimeRangeFromCalendar && (cacheItem.duration?.type === 'days' || cacheItem.duration_type === 'days' || cacheItem._extend?.sub_type === 'days')) {
|
|
174
|
+
ctx = {
|
|
175
|
+
...ctx,
|
|
176
|
+
bookingTimeRangeFromCalendar: undefined,
|
|
177
|
+
resourceIdFromCalendar: undefined
|
|
178
|
+
};
|
|
179
|
+
}
|
|
149
180
|
if (ctx?.rememberedTime === undefined && (isNormalBookingProduct(cacheItem) || hasPreparedBookingExtend(cacheItem))) {
|
|
150
181
|
return cacheItem;
|
|
151
182
|
}
|
|
@@ -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,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveUniqueCartDetailValue = resolveUniqueCartDetailValue;
|
|
7
|
+
const flag = value => value === true || value === 1 || value === '1';
|
|
8
|
+
const cleared = value => value === false || value === 0 || value === '0';
|
|
9
|
+
const enabled = item => item && !flag(item.disabled) && !cleared(item.is_enabled) && item.deleted_at == null;
|
|
10
|
+
const sellable = item => enabled(item) && (!flag(item.is_track) || flag(item.over_sold) || Number(item.stock_quantity) > 0);
|
|
11
|
+
const bound = (value, fallback = 0) => {
|
|
12
|
+
if (value == null || value === '') return fallback;
|
|
13
|
+
if (typeof value !== 'number' && typeof value !== 'string') return null;
|
|
14
|
+
const number = Number(value);
|
|
15
|
+
return Number.isInteger(number) && number >= 0 ? number : null;
|
|
16
|
+
};
|
|
17
|
+
const validId = value => (typeof value === 'number' || typeof value === 'string') && Number.isSafeInteger(Number(value)) && Number(value) > 0;
|
|
18
|
+
|
|
19
|
+
/** A choice is unique only if its complete allowed quantity interval is one value. */
|
|
20
|
+
function fixedQuantity(minimums, maximums) {
|
|
21
|
+
const min = Math.max(1, ...minimums);
|
|
22
|
+
const max = Math.min(...maximums.filter(value => value > 0), Infinity);
|
|
23
|
+
return min === max ? min : null;
|
|
24
|
+
}
|
|
25
|
+
function configuredGroups(product, key, countKey) {
|
|
26
|
+
const groups = product[key];
|
|
27
|
+
if (groups == null && product[countKey] == null) return null;
|
|
28
|
+
const count = bound(product[countKey]);
|
|
29
|
+
if (count == null || groups != null && !Array.isArray(groups)) return null;
|
|
30
|
+
if (count > 0 && (!Array.isArray(groups) || groups.length !== count)) return null;
|
|
31
|
+
return groups || [];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a whole SKU only when the original configuration proves one legal
|
|
36
|
+
* result. A default, a stock-filtered remainder, or missing detail is not proof
|
|
37
|
+
* of uniqueness. The input product and its existing selections stay untouched.
|
|
38
|
+
*/
|
|
39
|
+
function resolveUniqueCartDetailValue(product) {
|
|
40
|
+
if (!product || !validId(product.id ?? product.product_id) || flag(product.open_sold_weight)) return null;
|
|
41
|
+
const productId = product.id ?? product.product_id;
|
|
42
|
+
const existing = product.cartDetailValue;
|
|
43
|
+
const 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?.length > 0 || product.bundle_group?.length > 0 || product.bundle_groups?.length > 0 || product.variant_group?.length > 0;
|
|
44
|
+
if (existing && !hasConfiguredSku && !(existing.option?.length || existing.bundle?.length)) {
|
|
45
|
+
return {
|
|
46
|
+
...existing,
|
|
47
|
+
product_id: productId,
|
|
48
|
+
quantity: 1
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const knowsVariantShape = cleared(product.is_variant) || product.variant_count === 0 || product.variant_count === '0' || Array.isArray(product.variant) || Array.isArray(product.variant_group);
|
|
52
|
+
if (!knowsVariantShape) return null;
|
|
53
|
+
const optionGroups = configuredGroups(product, 'option_group', 'option_group_count');
|
|
54
|
+
const bundleKey = product.bundle_group != null ? 'bundle_group' : 'bundle_groups';
|
|
55
|
+
const bundleGroups = configuredGroups(product, bundleKey, 'bundle_group_count');
|
|
56
|
+
if (!optionGroups || !bundleGroups) return null;
|
|
57
|
+
const value = {
|
|
58
|
+
...(product.cartDetailValue || {}),
|
|
59
|
+
product_id: productId,
|
|
60
|
+
product_variant_id: 0,
|
|
61
|
+
option: [],
|
|
62
|
+
bundle: [],
|
|
63
|
+
quantity: 1
|
|
64
|
+
};
|
|
65
|
+
const 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;
|
|
66
|
+
if (hasVariant) {
|
|
67
|
+
if (!Array.isArray(product.variant) || product.variant.length !== 1 || Number(product.variant_count) > 0 && Number(product.variant_count) !== 1) return null;
|
|
68
|
+
const [variant] = product.variant;
|
|
69
|
+
if (!validId(variant?.id) || !sellable(variant)) return null;
|
|
70
|
+
value.product_variant_id = variant.id;
|
|
71
|
+
if (variant.price == null || variant.price === '' || !Number.isFinite(Number(variant.price)) || Number(variant.price) < 0) return null;
|
|
72
|
+
value.price = variant.price;
|
|
73
|
+
value.production_code = variant.production_code ?? variant.code ?? '';
|
|
74
|
+
}
|
|
75
|
+
for (const group of optionGroups) {
|
|
76
|
+
// Do not silently remove configured alternatives that are disabled or out of stock.
|
|
77
|
+
if (!validId(group?.id) || !enabled(group) || !Array.isArray(group.option_item) || group.option_item.length !== 1) return null;
|
|
78
|
+
const [item] = group.option_item;
|
|
79
|
+
if (!validId(item?.id) || !sellable(item)) return null;
|
|
80
|
+
const multiple = flag(group.is_multiple);
|
|
81
|
+
const groupMin = bound(group.min_quantity);
|
|
82
|
+
const groupMax = bound(group.max_quantity);
|
|
83
|
+
const itemMin = bound(item.min_quantity);
|
|
84
|
+
const itemMax = bound(item.max_quantity, 1);
|
|
85
|
+
if ([groupMin, groupMax, itemMin, itemMax].some(value => value == null)) return null;
|
|
86
|
+
const advanced = multiple && flag(group.metadata?.advanced_settings_enabled);
|
|
87
|
+
const minTypes = advanced ? bound(group.metadata?.option_types_config?.min) : 0;
|
|
88
|
+
const maxTypes = advanced ? bound(group.metadata?.option_types_config?.max) : 0;
|
|
89
|
+
if (minTypes == null || maxTypes == null || minTypes > 1 || maxTypes > 0 && maxTypes < minTypes) return null;
|
|
90
|
+
const required = multiple ? groupMin > 0 || minTypes > 0 : flag(group.required);
|
|
91
|
+
if (!required) return null;
|
|
92
|
+
const quantity = fixedQuantity([itemMin, ...(multiple ? [groupMin] : [])], [itemMax, ...(multiple ? [groupMax] : [])]);
|
|
93
|
+
if (!quantity) return null;
|
|
94
|
+
const price = item.price ?? item.add_price ?? 0;
|
|
95
|
+
value.option.push({
|
|
96
|
+
...item,
|
|
97
|
+
id: item.id,
|
|
98
|
+
product_option_item_id: item.id,
|
|
99
|
+
option_group_item_id: item.id,
|
|
100
|
+
option_group_id: group.id,
|
|
101
|
+
product_id: productId,
|
|
102
|
+
quantity,
|
|
103
|
+
num: quantity,
|
|
104
|
+
price,
|
|
105
|
+
original_price: price
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
for (const group of bundleGroups) {
|
|
109
|
+
if (!validId(group?.id) || !enabled(group) || !Array.isArray(group.bundle_item) || group.bundle_item.length !== 1) return null;
|
|
110
|
+
const [item] = group.bundle_item;
|
|
111
|
+
if (!validId(item?.id) || !validId(item?.bundle_product_id) || !sellable(item) || item.option_group?.length || item.variant_group?.length || item.variant?.length || item.bundle_group?.length || 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;
|
|
112
|
+
const groupMin = bound(group.min_quantity);
|
|
113
|
+
const groupMax = bound(group.max_quantity);
|
|
114
|
+
const itemMin = bound(item.min_quantity);
|
|
115
|
+
const itemMax = bound(item.max_quantity);
|
|
116
|
+
if ([groupMin, groupMax, itemMin, itemMax].some(value => value == null) || groupMin <= 0) return null;
|
|
117
|
+
const quantity = fixedQuantity([groupMin, itemMin], [groupMax, itemMax]);
|
|
118
|
+
if (!quantity) return null;
|
|
119
|
+
value.bundle.push({
|
|
120
|
+
...item,
|
|
121
|
+
id: item.id,
|
|
122
|
+
group_id: group.id,
|
|
123
|
+
bundle_group_id: group.id,
|
|
124
|
+
_bundle_product_id: item.bundle_product_id,
|
|
125
|
+
quantity,
|
|
126
|
+
num: quantity,
|
|
127
|
+
option: []
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const key = [productId, value.product_variant_id, ...value.option.map(item => `o${item.option_group_id}:${item.id}:${item.quantity}`), ...value.bundle.map(item => `b${item.group_id}:${item.id}:${item.quantity}`), ...(value.session ? [`s${value.session.key ?? value.session.id ?? ''}`] : [])].join('_');
|
|
131
|
+
return {
|
|
132
|
+
...value,
|
|
133
|
+
key,
|
|
134
|
+
rowKey: key
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -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,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyProductVoucherCollectionScan = applyProductVoucherCollectionScan;
|
|
7
|
+
var _applyGlobalScan = require("./applyGlobalScan");
|
|
8
|
+
/** Resolve the scanned account, then collect all of that customer's vouchers. */
|
|
9
|
+
async function applyProductVoucherCollectionScan(host, formatted, bridge) {
|
|
10
|
+
const assertCurrent = () => {
|
|
11
|
+
if (bridge.isCurrent?.() === false) {
|
|
12
|
+
throw new DOMException('Scan session ended', 'AbortError');
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const isPass = formatted.searchType === 'walletPass';
|
|
16
|
+
// Order numbers and wristbands resolve through batch-search. Their returned
|
|
17
|
+
// passes identify the customer; they are not the collection's voucher list.
|
|
18
|
+
// Resolve source-shop IDs before reusing the wallet customer-binding flow.
|
|
19
|
+
const customerScan = isPass ? {
|
|
20
|
+
...formatted,
|
|
21
|
+
searchType: 'wallet',
|
|
22
|
+
customerId: formatted.customerId ?? formatted.data?.id ?? formatted.data?.customer_id,
|
|
23
|
+
isCrossShopWallet: true
|
|
24
|
+
} : formatted;
|
|
25
|
+
assertCurrent();
|
|
26
|
+
const result = await (0, _applyGlobalScan.applyGlobalScan)({
|
|
27
|
+
...host,
|
|
28
|
+
setOrderCustomer: customer => {
|
|
29
|
+
assertCurrent();
|
|
30
|
+
host.setOrderCustomer(customer);
|
|
31
|
+
},
|
|
32
|
+
addProductToOrder: (product, booking) => {
|
|
33
|
+
assertCurrent();
|
|
34
|
+
return host.addProductToOrder(product, booking);
|
|
35
|
+
}
|
|
36
|
+
}, customerScan, {
|
|
37
|
+
...bridge,
|
|
38
|
+
// Without a switch bridge, do not return the previous customer's vouchers.
|
|
39
|
+
requestCustomerSwitch: bridge.requestCustomerSwitch ?? (async () => false)
|
|
40
|
+
});
|
|
41
|
+
assertCurrent();
|
|
42
|
+
if (customerScan.searchType === 'wallet' && result.status === 'success') {
|
|
43
|
+
const vouchers = await host.loadCustomerDiscounts();
|
|
44
|
+
assertCurrent();
|
|
45
|
+
return {
|
|
46
|
+
...result,
|
|
47
|
+
redemption: {
|
|
48
|
+
source: isPass ? 'scan' : 'wallet',
|
|
49
|
+
vouchers
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
@@ -10,6 +10,7 @@ exports.searchWalletPass = exports.searchWallet = exports.searchProduct = export
|
|
|
10
10
|
const searchWalletPass = async (request, code) => {
|
|
11
11
|
const params = {
|
|
12
12
|
code,
|
|
13
|
+
resolve_ticket_order: 1,
|
|
13
14
|
translate_flag: 1,
|
|
14
15
|
// 翻译识别码名称 0:不翻译 1:翻译
|
|
15
16
|
relation_product: 1,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.handleUniversalScan = exports.handleGlobalScan = exports.handleCustomerScan = void 0;
|
|
7
7
|
var _cloudSearch = require("./cloudSearch");
|
|
8
8
|
var _scanCache = _interopRequireDefault(require("./scanCache"));
|
|
9
|
+
var _platform = require("../../../../utils/platform");
|
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
11
|
/**
|
|
11
12
|
* Promise.any 的替代实现
|
|
@@ -107,7 +108,7 @@ const handleGlobalScan = (request, localSearch, channel) => {
|
|
|
107
108
|
if (value.startsWith('WL')) {
|
|
108
109
|
requestList = [(0, _cloudSearch.searchWallet)(request, value)];
|
|
109
110
|
} else {
|
|
110
|
-
requestList = [...(channel
|
|
111
|
+
requestList = [...((0, _platform.isSelfServicePlatform)(channel) ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
|
|
111
112
|
}
|
|
112
113
|
return requestList;
|
|
113
114
|
};
|
|
@@ -130,9 +130,12 @@ class OrderInvoicePreviewImpl extends _BaseModule.BaseModule {
|
|
|
130
130
|
const task = (async () => {
|
|
131
131
|
const [snapshot, context, template] = await Promise.all([this.loadSource(input), this.loadContext(input), (0, _loadCustomerInvoiceLayout.loadCustomerInvoiceTemplate)(this.request, input)]);
|
|
132
132
|
const source = (0, _loadPaymentMethods.withPaymentMethodNames)(snapshot, context.methods);
|
|
133
|
-
const
|
|
133
|
+
const appPlugin = this.core.getPlugin('app');
|
|
134
|
+
const getData = appPlugin?.getData?.();
|
|
134
135
|
if (getData?.('shop_id') != null && String(getData('shop_id')) !== String(input.shopId)) throw new Error('Invoice shop changed');
|
|
135
136
|
const coreData = getData?.('core');
|
|
137
|
+
const hostApp = appPlugin?.getApp?.();
|
|
138
|
+
const shopCore = hostApp?.models?.getStore?.().getDataByModel?.('core', 'core') || hostApp?.data?.store?.getStore?.().getDataByModel?.('core', 'core') || coreData?.core || coreData || {};
|
|
136
139
|
const shop = {
|
|
137
140
|
...(coreData?.core?.shop || coreData?.shop || {}),
|
|
138
141
|
...(getData?.('shop_info') || {}),
|
|
@@ -142,6 +145,9 @@ class OrderInvoicePreviewImpl extends _BaseModule.BaseModule {
|
|
|
142
145
|
tax_country_code: getData('tax_country_code')
|
|
143
146
|
} : {})
|
|
144
147
|
};
|
|
148
|
+
shop.default_domain || (shop.default_domain = shopCore.default_domain);
|
|
149
|
+
shop.private_domain || (shop.private_domain = shopCore.private_domain);
|
|
150
|
+
shop.private_domain_protocol || (shop.private_domain_protocol = shopCore.private_domain_protocol);
|
|
145
151
|
if (generation !== this.generation || this.disposed) throw new Error('Invoice request superseded');
|
|
146
152
|
const languageOptions = (0, _customerInvoiceLanguages.resolveCustomerInvoiceLanguages)(template.language, input.locale);
|
|
147
153
|
const remembered = this.languageSelection?.code;
|
|
@@ -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[]>;
|
|
@@ -31,6 +31,7 @@ var _getDateIsInSchedule = require("../../modules/Schedule/getDateIsInSchedule")
|
|
|
31
31
|
var _utils2 = require("../../modules/Order/utils");
|
|
32
32
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
33
33
|
var _itemRule = require("../../model/strategy/adapter/itemRule");
|
|
34
|
+
var _menuAvailability = require("./menuAvailability");
|
|
34
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
36
|
function isItemRewardProductDiscount(discount) {
|
|
36
37
|
return discount?.type === 'product' && discount?.metadata?.source === 'promotion' && discount?.metadata?.actionType === 'ITEM_REWARD';
|
|
@@ -994,6 +995,27 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
994
995
|
}
|
|
995
996
|
return result;
|
|
996
997
|
}
|
|
998
|
+
|
|
999
|
+
/** Read both current and legacy cart snapshots without changing the product catalog. */
|
|
1000
|
+
getMenuAvailabilityProductSources(tempOrder) {
|
|
1001
|
+
const products = tempOrder.products || [];
|
|
1002
|
+
const sources = [...this.enabledReservationRuleProducts];
|
|
1003
|
+
for (const product of products) {
|
|
1004
|
+
const uid = product.metadata?.unique_identification_number;
|
|
1005
|
+
const origins = [product._origin, product.metadata?.origin, uid ? tempOrder._extend?.productsByUid?.[String(uid)]?.origin : undefined];
|
|
1006
|
+
for (const origin of origins) {
|
|
1007
|
+
if (origin && typeof origin === 'object' && !Array.isArray(origin)) {
|
|
1008
|
+
sources.push({
|
|
1009
|
+
...origin,
|
|
1010
|
+
product_id: product.product_id
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
const cachedSources = this.store.products?.getRawProductPriceSources?.(products.map(product => Number(product.product_id)));
|
|
1016
|
+
if (cachedSources) sources.push(...cachedSources.values());
|
|
1017
|
+
return sources;
|
|
1018
|
+
}
|
|
997
1019
|
async submitScanOrder() {
|
|
998
1020
|
this.logMethodStart('submitScanOrder');
|
|
999
1021
|
try {
|
|
@@ -1016,8 +1038,51 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1016
1038
|
delete tempOrderForSubmit.table_number;
|
|
1017
1039
|
}
|
|
1018
1040
|
this.store.order.persistTempOrder();
|
|
1019
|
-
const
|
|
1020
|
-
const
|
|
1041
|
+
const isAdditionalOrder = this.isScanOrderMoreMode(tempOrderForSubmit);
|
|
1042
|
+
const enhanceBookingPayload = this.buildSubmitPayloadEnhancer();
|
|
1043
|
+
const ruleProduct = this.enabledReservationRuleProducts[0];
|
|
1044
|
+
const resource = this.store.resource;
|
|
1045
|
+
const willAppendRuleProduct = !tempOrderForSubmit.order_id && ruleProduct && String(resource?.relationId ?? '').trim() && resource?.tableFormId;
|
|
1046
|
+
const productsToPrepare = isAdditionalOrder ? tempOrderForSubmit.products.filter(product => product.metadata?.is_rule !== true) : [...tempOrderForSubmit.products, ...(willAppendRuleProduct ? [{
|
|
1047
|
+
product_id: ruleProduct.id,
|
|
1048
|
+
metadata: {
|
|
1049
|
+
is_rule: true
|
|
1050
|
+
}
|
|
1051
|
+
}] : [])];
|
|
1052
|
+
const associatedMenus = this.otherParams?.dineInConfig?.['menu.associated_menus'];
|
|
1053
|
+
if (!Array.isArray(associatedMenus)) {
|
|
1054
|
+
throw new _menuAvailability.ScanOrderMenuAvailabilityError('SCAN_ORDER_MENU_VALIDATION_FAILED');
|
|
1055
|
+
}
|
|
1056
|
+
const validateMenuAvailability = await (0, _menuAvailability.prepareScanOrderMenuAvailability)({
|
|
1057
|
+
request: this.request,
|
|
1058
|
+
menuIds: associatedMenus.map(menu => menu?.value),
|
|
1059
|
+
timezone: String(this.getPickupTimingContextData('timezone') ?? ''),
|
|
1060
|
+
products: productsToPrepare,
|
|
1061
|
+
productSources: this.getMenuAvailabilityProductSources(tempOrderForSubmit)
|
|
1062
|
+
});
|
|
1063
|
+
const enhancePayload = (payload, context) => {
|
|
1064
|
+
const enhancedPayload = enhanceBookingPayload(payload, context);
|
|
1065
|
+
const originalByUid = new Map(context.tempOrder.products.filter(product => product.metadata?.unique_identification_number).map(product => [String(product.metadata.unique_identification_number), product]));
|
|
1066
|
+
const outgoingProducts = isAdditionalOrder ? (0, _utils.filterProductsForScanOrderMore)(enhancedPayload.products) : enhancedPayload.products;
|
|
1067
|
+
// Serialization strips the prefill marker. Restore it only on validation
|
|
1068
|
+
// copies, by line UID, so a manually added row of the same product stays checked.
|
|
1069
|
+
const validationProducts = outgoingProducts.map(product => {
|
|
1070
|
+
const uid = product.metadata?.unique_identification_number;
|
|
1071
|
+
const original = uid ? originalByUid.get(String(uid)) : undefined;
|
|
1072
|
+
return original?.metadata?.item_rule_prefill === true ? {
|
|
1073
|
+
...product,
|
|
1074
|
+
metadata: {
|
|
1075
|
+
...product.metadata,
|
|
1076
|
+
item_rule_prefill: true
|
|
1077
|
+
}
|
|
1078
|
+
} : product;
|
|
1079
|
+
});
|
|
1080
|
+
// Both checkout and add-on build their payload after async quotation. Check
|
|
1081
|
+
// the actual outgoing lines using a fresh clock, never the draft schedule_date.
|
|
1082
|
+
validateMenuAvailability(validationProducts, this.getMenuAvailabilityProductSources(context.tempOrder));
|
|
1083
|
+
return enhancedPayload;
|
|
1084
|
+
};
|
|
1085
|
+
const result = isAdditionalOrder ? await this.submitScanOrderMore({
|
|
1021
1086
|
tempOrder: tempOrderForSubmit,
|
|
1022
1087
|
enhancePayload
|
|
1023
1088
|
}) : await this.submitSalesOrder({
|
|
@@ -2113,6 +2178,11 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
2113
2178
|
tempOrder.resource_id = normalizedResourceId;
|
|
2114
2179
|
tempOrder.relation_id = (0, _utils.toPositiveString)(occupyDetail?.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
2115
2180
|
tempOrder.table_form_id = (0, _utils.toPositiveString)(occupyDetail?.form_id) || tempOrder.table_form_id;
|
|
2181
|
+
// 冲突后转加餐需同步模式,否则重试仍会携带整单数据走 checkout。
|
|
2182
|
+
const resourceState = this.store.resource ?? this.normalizeResourceState(occupyDetail, resourceSelectType, true);
|
|
2183
|
+
resourceState.mode = 'additional_order';
|
|
2184
|
+
resourceState.order_id = result.order_id;
|
|
2185
|
+
this.store.resource = resourceState;
|
|
2116
2186
|
this.store.order?.persistTempOrder();
|
|
2117
2187
|
this.logMethodSuccess('syncAdditionalOrderFromResource', {
|
|
2118
2188
|
...result,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type Product = Record<string, any>;
|
|
2
|
+
type Request = {
|
|
3
|
+
get: (url: string, data?: any, options?: any) => Promise<any>;
|
|
4
|
+
post: (url: string, data?: any, options?: any) => Promise<any>;
|
|
5
|
+
};
|
|
6
|
+
export type ScanOrderMenuAvailabilityErrorCode = 'SCAN_ORDER_MENU_UNAVAILABLE' | 'SCAN_ORDER_MENU_VALIDATION_FAILED';
|
|
7
|
+
export declare class ScanOrderMenuAvailabilityError extends Error {
|
|
8
|
+
readonly code: ScanOrderMenuAvailabilityErrorCode;
|
|
9
|
+
readonly productIds: number[];
|
|
10
|
+
constructor(code: ScanOrderMenuAvailabilityErrorCode, productIds?: number[]);
|
|
11
|
+
}
|
|
12
|
+
export type ScanOrderMenuAvailabilityValidator = (products: Product[], productSources?: Product[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Prepare fresh menu definitions without changing ProductList or the cart. The
|
|
15
|
+
* returned validator reads the shop's current time again at the submission boundary.
|
|
16
|
+
*/
|
|
17
|
+
export declare function prepareScanOrderMenuAvailability({ request, menuIds, timezone, products, productSources, }: {
|
|
18
|
+
request: Request;
|
|
19
|
+
menuIds: Array<number | string>;
|
|
20
|
+
timezone: string;
|
|
21
|
+
products: Product[];
|
|
22
|
+
productSources?: Product[];
|
|
23
|
+
}): Promise<ScanOrderMenuAvailabilityValidator>;
|
|
24
|
+
export {};
|