@pisell/pisellos 2.2.314 → 2.2.315
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 +2 -0
- package/dist/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/dist/modules/BookingContext/utils/productExtend.js +62 -18
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/BusinessAvailability/index.d.ts +30 -0
- package/dist/modules/BusinessAvailability/index.js +204 -0
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/OpenData/types.d.ts +14 -0
- package/dist/modules/Order/index.d.ts +14 -2
- package/dist/modules/Order/index.js +856 -486
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +30 -2
- package/dist/modules/Order/utils.js +25 -7
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Product/types.d.ts +11 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +332 -23
- package/dist/modules/ResourcePlanner/types.d.ts +29 -0
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1536 -1309
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +15 -0
- package/dist/server/modules/order/index.js +920 -688
- package/dist/server/modules/order/types.d.ts +1 -0
- package/dist/server/test.json +1 -1
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
- package/dist/shared/receipt/small-ticket.d.ts +96 -0
- package/dist/shared/receipt/small-ticket.js +2751 -0
- package/dist/shared/receipt/templateVisibility.d.ts +23 -0
- package/dist/shared/receipt/templateVisibility.js +64 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +39 -16
- package/dist/solution/BaseSales/index.js +1754 -1154
- package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/dist/solution/BaseSales/pickupTiming.js +616 -0
- package/dist/solution/BaseSales/types.d.ts +11 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +3 -1
- package/dist/solution/BookingByStep/index.js +8 -3
- package/dist/solution/BookingTicket/index.d.ts +8 -2
- package/dist/solution/BookingTicket/index.js +513 -436
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/dist/solution/OrderInvoicePreview/index.js +340 -0
- package/dist/solution/RegisterAndLogin/config.js +54 -11
- package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
- package/dist/solution/RegisterAndLogin/index.js +1 -1
- package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/dist/solution/RegisterAndLogin/utils.js +36 -16
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/dist/solution/UnifiedBookingSales/index.js +1714 -905
- package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/dist/solution/VenueBooking/index.d.ts +15 -2
- package/dist/solution/VenueBooking/index.js +1062 -785
- package/dist/solution/VenueBooking/types.d.ts +2 -1
- package/dist/solution/VenueBooking/types.js +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/lib/modules/BookingContext/utils/productExtend.js +45 -2
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/BusinessAvailability/index.d.ts +30 -0
- package/lib/modules/BusinessAvailability/index.js +146 -0
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/OpenData/types.d.ts +14 -0
- package/lib/modules/Order/index.d.ts +14 -2
- package/lib/modules/Order/index.js +240 -38
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +30 -2
- package/lib/modules/Order/utils.js +21 -5
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Product/types.d.ts +11 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +252 -8
- package/lib/modules/ResourcePlanner/types.d.ts +29 -0
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +158 -37
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +15 -0
- package/lib/server/modules/order/index.js +114 -3
- package/lib/server/modules/order/types.d.ts +1 -0
- package/lib/server/test.json +1 -1
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
- package/lib/shared/receipt/small-ticket.d.ts +96 -0
- package/lib/shared/receipt/small-ticket.js +2546 -0
- package/lib/shared/receipt/templateVisibility.d.ts +23 -0
- package/lib/shared/receipt/templateVisibility.js +63 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +39 -16
- package/lib/solution/BaseSales/index.js +333 -31
- package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/lib/solution/BaseSales/pickupTiming.js +290 -0
- package/lib/solution/BaseSales/types.d.ts +11 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +3 -1
- package/lib/solution/BookingByStep/index.js +7 -3
- package/lib/solution/BookingTicket/index.d.ts +8 -2
- package/lib/solution/BookingTicket/index.js +65 -6
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/lib/solution/OrderInvoicePreview/index.js +246 -0
- package/lib/solution/RegisterAndLogin/config.js +57 -11
- package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
- package/lib/solution/RegisterAndLogin/index.js +9 -1
- package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/lib/solution/RegisterAndLogin/utils.js +24 -17
- package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/lib/solution/UnifiedBookingSales/index.js +561 -74
- package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/lib/solution/VenueBooking/index.d.ts +15 -2
- package/lib/solution/VenueBooking/index.js +243 -96
- package/lib/solution/VenueBooking/types.d.ts +2 -1
- package/lib/solution/VenueBooking/types.js +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type PickupTimingSelectionMode = 'asap' | 'scheduled';
|
|
2
|
+
export type PickupTimingSource = 'asap' | 'schedule' | 'pos_manual';
|
|
3
|
+
export interface PickupTimingBookingInput {
|
|
4
|
+
mode: PickupTimingSelectionMode;
|
|
5
|
+
source: PickupTimingSource;
|
|
6
|
+
/** Store-local calendar date and minute; the caller validates availability. */
|
|
7
|
+
date: string;
|
|
8
|
+
time: string;
|
|
9
|
+
/** Absolute timestamp disambiguates a repeated local minute at a DST change. */
|
|
10
|
+
instant?: string;
|
|
11
|
+
timezone?: string;
|
|
12
|
+
frozen?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PickupTimingBookingMetadata {
|
|
15
|
+
unique_identification_number: string;
|
|
16
|
+
is_fulfillment_timing: true;
|
|
17
|
+
fulfillment_timing: {
|
|
18
|
+
method: 'pick_up';
|
|
19
|
+
mode: PickupTimingSelectionMode;
|
|
20
|
+
source: PickupTimingSource;
|
|
21
|
+
instant?: string;
|
|
22
|
+
timezone?: string;
|
|
23
|
+
frozen?: boolean;
|
|
24
|
+
};
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface PickupTimingBooking {
|
|
28
|
+
schedule_id: number | string;
|
|
29
|
+
start_date: string;
|
|
30
|
+
end_date: string;
|
|
31
|
+
start_time: string;
|
|
32
|
+
end_time: string;
|
|
33
|
+
select_date: string;
|
|
34
|
+
duration: 0;
|
|
35
|
+
is_all: 0;
|
|
36
|
+
sub_type: 'minutes';
|
|
37
|
+
like_status: string;
|
|
38
|
+
resources: [];
|
|
39
|
+
metadata: PickupTimingBookingMetadata;
|
|
40
|
+
schedule_event_id?: number | string;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
/** The explicit marker is the only authority; unlinked ordinary bookings remain ordinary. */
|
|
44
|
+
export declare function isFulfillmentTimingBooking(booking: unknown): boolean;
|
|
45
|
+
/** Update an independent pickup appointment without changing its persisted row identity. */
|
|
46
|
+
export declare function buildPickupTimingBooking(input: PickupTimingBookingInput, existing?: Record<string, any> | null): PickupTimingBooking;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildPickupTimingBooking = buildPickupTimingBooking;
|
|
7
|
+
exports.isFulfillmentTimingBooking = isFulfillmentTimingBooking;
|
|
8
|
+
var _orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
9
|
+
/** The explicit marker is the only authority; unlinked ordinary bookings remain ordinary. */
|
|
10
|
+
function isFulfillmentTimingBooking(booking) {
|
|
11
|
+
return booking?.metadata?.is_fulfillment_timing === true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Update an independent pickup appointment without changing its persisted row identity. */
|
|
15
|
+
function buildPickupTimingBooking(input, existing) {
|
|
16
|
+
const booking = {
|
|
17
|
+
...(existing || {})
|
|
18
|
+
};
|
|
19
|
+
const metadata = {
|
|
20
|
+
...(booking.metadata || {})
|
|
21
|
+
};
|
|
22
|
+
// A fulfillment appointment never becomes a product/resource/holder purchase line.
|
|
23
|
+
for (const key of ['product_uid', 'product', 'holder', 'holder_id', 'collect_pax', 'capacity']) {
|
|
24
|
+
delete booking[key];
|
|
25
|
+
delete metadata[key];
|
|
26
|
+
}
|
|
27
|
+
delete metadata.booking_uid;
|
|
28
|
+
return {
|
|
29
|
+
...booking,
|
|
30
|
+
schedule_id: booking.schedule_id || 0,
|
|
31
|
+
start_date: input.date,
|
|
32
|
+
end_date: input.date,
|
|
33
|
+
start_time: input.time,
|
|
34
|
+
end_time: input.time,
|
|
35
|
+
select_date: input.date,
|
|
36
|
+
duration: 0,
|
|
37
|
+
is_all: 0,
|
|
38
|
+
sub_type: 'minutes',
|
|
39
|
+
like_status: booking.like_status || 'common',
|
|
40
|
+
resources: [],
|
|
41
|
+
metadata: {
|
|
42
|
+
...metadata,
|
|
43
|
+
unique_identification_number: String(metadata.unique_identification_number || (0, _orderCollectionIdentity.createUuidV4)()),
|
|
44
|
+
is_fulfillment_timing: true,
|
|
45
|
+
fulfillment_timing: {
|
|
46
|
+
method: 'pick_up',
|
|
47
|
+
mode: input.mode,
|
|
48
|
+
source: input.source,
|
|
49
|
+
...(input.instant !== undefined ? {
|
|
50
|
+
instant: input.instant
|
|
51
|
+
} : {}),
|
|
52
|
+
...(input.timezone !== undefined ? {
|
|
53
|
+
timezone: input.timezone
|
|
54
|
+
} : {}),
|
|
55
|
+
...(input.frozen !== undefined ? {
|
|
56
|
+
frozen: input.frozen
|
|
57
|
+
} : {})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -7,9 +7,10 @@ import type { SubmitPayloadEnhancer } from './utils';
|
|
|
7
7
|
import type { PaymentItem } from '../Payment/types';
|
|
8
8
|
import type { ICustomer } from '../AccountList/types';
|
|
9
9
|
import type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
10
|
+
import type { PickupTimingBooking, PickupTimingBookingInput } from './pickupTiming';
|
|
10
11
|
export type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
11
12
|
export type PickupReferenceMode = 'counter_pickup' | 'table_service';
|
|
12
|
-
export type ShopServiceType = 'dine_in' | 'takeaway';
|
|
13
|
+
export type ShopServiceType = 'dine_in' | 'takeaway' | 'pick_up' | 'delivery';
|
|
13
14
|
export interface ShopServiceData {
|
|
14
15
|
pickup_reference_mode?: PickupReferenceMode;
|
|
15
16
|
service_type?: ShopServiceType | '';
|
|
@@ -212,6 +213,7 @@ export interface VirtualCurrencySnapshotItem {
|
|
|
212
213
|
id: number | string;
|
|
213
214
|
tag: 'virtual_currency';
|
|
214
215
|
product_id?: number | string;
|
|
216
|
+
code?: string;
|
|
215
217
|
product_name: string;
|
|
216
218
|
par_value: string;
|
|
217
219
|
used_par_value: string;
|
|
@@ -439,16 +441,29 @@ export type AddProductBookingInput = Record<string, any>;
|
|
|
439
441
|
*/
|
|
440
442
|
export interface AddProductToOrderOptions {
|
|
441
443
|
insertAfterProductUid?: string;
|
|
444
|
+
/** 新增商品行插入 products 首位,优先于 insertAfterProductUid。 */
|
|
445
|
+
insertAtStart?: boolean;
|
|
442
446
|
/** 跳过同商品/规格匹配,始终新增购物车行。 */
|
|
443
447
|
disableMerge?: boolean;
|
|
444
448
|
/** 商品行 UID 落定后,由 OrderModule 原子绑定到该行的 Sales Notes 草稿。 */
|
|
445
449
|
salesNotes?: SalesNoteDraftInput[];
|
|
450
|
+
/**
|
|
451
|
+
* 自动预约加购的同步提交门禁;抛错时不发布本次新增。
|
|
452
|
+
* 带门禁时先在私有草稿中准备全部商品/booking,异步等待后及原子发布前重新调用。
|
|
453
|
+
* 门禁须校验当前订单身份/版本和真实时间;发布前不会因本次拆行改变订单版本。
|
|
454
|
+
* 不传时保留原有人工加购行为。
|
|
455
|
+
*/
|
|
456
|
+
availabilityCommitGuard?: () => void;
|
|
457
|
+
/** 发布后的订单/业务归属检查;只用于阻止旧异步收尾写入新单,不再校验截止或 revision。 */
|
|
458
|
+
availabilityCommitTargetGuard?: () => boolean;
|
|
446
459
|
}
|
|
447
460
|
/**
|
|
448
461
|
* 删除商品后的可选位置保持策略。
|
|
449
462
|
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
450
463
|
*/
|
|
451
464
|
export interface RemoveProductsFromOrderOptions {
|
|
465
|
+
/** 自动购物车写入的订单归属检查;失效时不再变更或发布异步收尾结果。 */
|
|
466
|
+
isCurrentOrder?: () => boolean;
|
|
452
467
|
preserveDisplayPosition?: {
|
|
453
468
|
remainingProductUid: string;
|
|
454
469
|
anchorProductUid: string;
|
|
@@ -516,7 +531,15 @@ export type OrderProductMergeDecisionResult = boolean | {
|
|
|
516
531
|
reason?: string;
|
|
517
532
|
[key: string]: any;
|
|
518
533
|
};
|
|
534
|
+
export interface OrderCartIntentCommitContext {
|
|
535
|
+
action: 'add_product' | 'update_product' | 'increase_quantity' | 'scan_promotion';
|
|
536
|
+
tempOrder: OrderTempOrder | null;
|
|
537
|
+
}
|
|
519
538
|
export interface OrderHooksConfig {
|
|
539
|
+
/** Optional customer-order guard; called synchronously before the first cart write. */
|
|
540
|
+
beforeCartIntentCommit?: (context: OrderCartIntentCommitContext) => void;
|
|
541
|
+
/** Captures tenant/business runtime identity for asynchronous cart intents. */
|
|
542
|
+
getCartIntentScope?: () => unknown;
|
|
520
543
|
onBeforeMergeProductToOrder?: (context: OrderProductMergeDecisionContext) => OrderProductMergeDecisionResult | Promise<OrderProductMergeDecisionResult>;
|
|
521
544
|
}
|
|
522
545
|
/**
|
|
@@ -863,6 +886,9 @@ export interface OrderModuleAPI {
|
|
|
863
886
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
864
887
|
updateTempOrderPickupReferenceMode: (mode: PickupReferenceMode) => ShopServiceData;
|
|
865
888
|
updateTempOrderServiceType: (serviceType: ShopServiceType) => ShopServiceData;
|
|
889
|
+
getPickupTimingBooking: () => PickupTimingBooking | null;
|
|
890
|
+
setPickupTimingBooking: (input: PickupTimingBookingInput) => PickupTimingBooking;
|
|
891
|
+
clearPickupTimingBooking: () => void;
|
|
866
892
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
867
893
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
868
894
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
@@ -875,7 +901,9 @@ export interface OrderModuleAPI {
|
|
|
875
901
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
876
902
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
877
903
|
updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
|
|
878
|
-
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams
|
|
904
|
+
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams, options?: {
|
|
905
|
+
isCurrentOrder?: () => boolean;
|
|
906
|
+
}) => Promise<OrderProduct[]>;
|
|
879
907
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
880
908
|
removeProductFromOrder: (identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
881
909
|
/** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
@@ -137,6 +137,7 @@ var _utils = require("../Holder/utils");
|
|
|
137
137
|
var _utils2 = require("../../solution/ScanOrder/utils");
|
|
138
138
|
var _orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
139
139
|
var _salesNotes = require("./salesNotes");
|
|
140
|
+
var _pickupTiming = require("./pickupTiming");
|
|
140
141
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
141
142
|
_dayjs.default.extend(_customParseFormat.default);
|
|
142
143
|
const POINT_CARD_SNAPSHOT_TAG = 'point_card';
|
|
@@ -283,6 +284,10 @@ function normalizeVirtualCurrencySnapshotItem(value) {
|
|
|
283
284
|
if (productId !== undefined) {
|
|
284
285
|
snapshot.product_id = productId;
|
|
285
286
|
}
|
|
287
|
+
const code = normalizeSnapshotScalar(value.code);
|
|
288
|
+
if (code !== undefined) {
|
|
289
|
+
snapshot.code = String(code).trim();
|
|
290
|
+
}
|
|
286
291
|
return snapshot;
|
|
287
292
|
}
|
|
288
293
|
function normalizeVirtualCurrencySnapshotList(value) {
|
|
@@ -313,6 +318,10 @@ function buildVirtualCurrencySnapshotFromList(value) {
|
|
|
313
318
|
if (productId !== undefined) {
|
|
314
319
|
snapshot.product_id = productId;
|
|
315
320
|
}
|
|
321
|
+
const code = normalizeSnapshotScalar(item.code);
|
|
322
|
+
if (code !== undefined) {
|
|
323
|
+
snapshot.code = String(code).trim();
|
|
324
|
+
}
|
|
316
325
|
result.push(snapshot);
|
|
317
326
|
return result;
|
|
318
327
|
}, []);
|
|
@@ -1318,7 +1327,7 @@ function normalizeSubmitProduct(product, formatOptions = {}) {
|
|
|
1318
1327
|
payment_price: formatOptions.virtualSettlementMode ? virtualPrice : submitProduct.payment_price ?? submitProduct.selling_price
|
|
1319
1328
|
};
|
|
1320
1329
|
}
|
|
1321
|
-
const SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
|
|
1330
|
+
const SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder', 'is_fulfillment_timing', 'fulfillment_timing'];
|
|
1322
1331
|
function normalizeBookingIsAll(booking) {
|
|
1323
1332
|
return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
|
|
1324
1333
|
}
|
|
@@ -1337,7 +1346,9 @@ function normalizeSubmitBooking(booking) {
|
|
|
1337
1346
|
cleanMetadata[key] = rawMetadata[key];
|
|
1338
1347
|
}
|
|
1339
1348
|
}
|
|
1340
|
-
if (cleanMetadata.holder_id === undefined
|
|
1349
|
+
if (cleanMetadata.holder_id === undefined && !(0, _pickupTiming.isFulfillmentTimingBooking)(booking)) {
|
|
1350
|
+
cleanMetadata.holder_id = null;
|
|
1351
|
+
}
|
|
1341
1352
|
const bookingRecord = booking;
|
|
1342
1353
|
const startDate = bookingRecord.start_date;
|
|
1343
1354
|
const shouldRestoreSelectDate = bookingRecord.select_date === undefined || bookingRecord.select_date === null || bookingRecord.select_date === '';
|
|
@@ -1349,6 +1360,10 @@ function normalizeSubmitBooking(booking) {
|
|
|
1349
1360
|
} : {}),
|
|
1350
1361
|
is_all: normalizeBookingIsAll(bookingRecord),
|
|
1351
1362
|
sub_type: normalizeBookingSubType(bookingRecord),
|
|
1363
|
+
...((0, _pickupTiming.isFulfillmentTimingBooking)(booking) ? {
|
|
1364
|
+
like_status: bookingRecord.like_status || 'common',
|
|
1365
|
+
schedule_id: bookingRecord.schedule_id || 0
|
|
1366
|
+
} : {}),
|
|
1352
1367
|
metadata: cleanMetadata
|
|
1353
1368
|
};
|
|
1354
1369
|
}
|
|
@@ -1434,6 +1449,7 @@ function hasBoundBookingResource(bookings) {
|
|
|
1434
1449
|
if (!Array.isArray(bookings)) return false;
|
|
1435
1450
|
return bookings.some(booking => {
|
|
1436
1451
|
if (!booking || typeof booking !== 'object') return false;
|
|
1452
|
+
if ((0, _pickupTiming.isFulfillmentTimingBooking)(booking)) return false;
|
|
1437
1453
|
if (Number(booking.parent_id) === 0) return false;
|
|
1438
1454
|
const resources = booking.resources;
|
|
1439
1455
|
if (!Array.isArray(resources)) return false;
|
|
@@ -1469,7 +1485,7 @@ function resolveSubmitOrderType(params) {
|
|
|
1469
1485
|
return 'table-order';
|
|
1470
1486
|
}
|
|
1471
1487
|
if (currentType) return currentType;
|
|
1472
|
-
if (Array.isArray(bookings) && bookings.
|
|
1488
|
+
if (Array.isArray(bookings) && bookings.some(booking => !(0, _pickupTiming.isFulfillmentTimingBooking)(booking))) {
|
|
1473
1489
|
return businessCode === 'dine_in' ? 'table-order' : 'appointment_booking';
|
|
1474
1490
|
}
|
|
1475
1491
|
return 'virtual';
|
|
@@ -1551,10 +1567,10 @@ function buildSubmitPayload(params) {
|
|
|
1551
1567
|
shop_discount: tempOrder.shop_discount || '0.00',
|
|
1552
1568
|
surcharge_fee: tempOrder.surcharge_fee || '0.00',
|
|
1553
1569
|
note: tempOrder.note || '',
|
|
1554
|
-
delivery_type: tempOrder.delivery_type || '
|
|
1570
|
+
delivery_type: tempOrder.delivery_type || 'shop_service',
|
|
1555
1571
|
schedule_date: scheduleDate,
|
|
1556
1572
|
// created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
|
|
1557
|
-
bookings: (tempOrder.bookings || []).filter(booking => Number(booking.parent_id) !== 0).map(booking => normalizeSubmitBooking(booking)),
|
|
1573
|
+
bookings: (tempOrder.bookings || []).filter(booking => (0, _pickupTiming.isFulfillmentTimingBooking)(booking) || Number(booking.parent_id) !== 0).map(booking => normalizeSubmitBooking(booking)),
|
|
1558
1574
|
payments: tempOrder.payments || [],
|
|
1559
1575
|
relation_forms: tempOrder.relation_forms || [],
|
|
1560
1576
|
// contacts: tempOrder.contacts || [],
|
|
@@ -9,6 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
};
|
|
10
10
|
exports.PaymentModule = void 0;
|
|
11
11
|
exports.generateRequestUniqueId = generateRequestUniqueId;
|
|
12
|
+
var _loadPaymentMethods = require("../../shared/payment/loadPaymentMethods");
|
|
12
13
|
var _BaseModule = require("../BaseModule");
|
|
13
14
|
var _types = require("./types");
|
|
14
15
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -282,12 +283,10 @@ class PaymentModule extends _BaseModule.BaseModule {
|
|
|
282
283
|
async getPayMethodListAsync() {
|
|
283
284
|
this.logInfo('Starting getPayMethodListAsync');
|
|
284
285
|
try {
|
|
285
|
-
const
|
|
286
|
+
const payMethods = await (0, _loadPaymentMethods.loadPaymentMethods)(this.request, {
|
|
287
|
+
transport: 'os-server',
|
|
286
288
|
filterPaymentMethods: true
|
|
287
|
-
}, {
|
|
288
|
-
osServer: true
|
|
289
289
|
});
|
|
290
|
-
const payMethods = response?.data || response || [];
|
|
291
290
|
this.logInfo('getPayMethodListAsync completed successfully', {
|
|
292
291
|
payMethods
|
|
293
292
|
});
|
|
@@ -218,6 +218,17 @@ export interface ProductData {
|
|
|
218
218
|
bundle?: any[];
|
|
219
219
|
/** 商品选项组成 */
|
|
220
220
|
options?: any[];
|
|
221
|
+
/** 单规格组;用于由已选 option 反查规格项名称、价格等商品快照字段。 */
|
|
222
|
+
option_group?: Array<{
|
|
223
|
+
id: number | string;
|
|
224
|
+
option_item?: Array<{
|
|
225
|
+
id: number | string;
|
|
226
|
+
name?: string | Record<string, any>;
|
|
227
|
+
title?: string | Record<string, any>;
|
|
228
|
+
[key: string]: any;
|
|
229
|
+
}>;
|
|
230
|
+
[key: string]: any;
|
|
231
|
+
}>;
|
|
221
232
|
/** 商品原信息 */
|
|
222
233
|
origin?: any;
|
|
223
234
|
/** 容量 */
|
|
@@ -125,7 +125,7 @@ class ProductList extends _BaseModule.BaseModule {
|
|
|
125
125
|
online_store: 'online-store',
|
|
126
126
|
scan_to_order: 'online-store',
|
|
127
127
|
'scan-to-order': 'online-store',
|
|
128
|
-
scan_to_order_2: '
|
|
128
|
+
scan_to_order_2: 'online-store',
|
|
129
129
|
scan_to_order_3: 'scantoorder3'
|
|
130
130
|
};
|
|
131
131
|
const rawApplicationCode = this.otherParams?.channel;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AvailabilityProjection, AvailabilityProjectionInput, AvailabilityQuery, AvailabilityQueryResult, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, GetProductTimeRangesRequest, GetProductTimeRangesRuntimeOptions, ProductTimeRangeGroup } from './types';
|
|
2
2
|
export declare function createAvailabilityProjection(input: AvailabilityProjectionInput): AvailabilityProjection;
|
|
3
|
+
/** Resolve the label without changing the real calendar timestamp. */
|
|
4
|
+
export declare function getDurationBusinessDate(projection: AvailabilityProjection, startAt: string): string;
|
|
3
5
|
export declare function getProductTimeRanges(projection: AvailabilityProjection, request?: GetProductTimeRangesRequest, runtimeOptions?: GetProductTimeRangesRuntimeOptions): ProductTimeRangeGroup[];
|
|
4
6
|
export declare function queryAvailabilityProjection(projection: AvailabilityProjection, request: AvailabilityQuery, runtimeOptions?: GetProductTimeRangesRuntimeOptions): AvailabilityQueryResult;
|
|
5
7
|
export declare function validateAvailabilitySelection(projection: AvailabilityProjection, params: AvailabilitySelectionValidationParams, runtimeOptions?: GetProductTimeRangesRuntimeOptions): AvailabilitySelectionValidationResult;
|