@pisell/pisellos 2.3.129 → 2.3.130
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/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 +6 -0
- package/dist/modules/Order/index.d.ts +6 -0
- package/dist/modules/Order/index.js +55 -12
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +5 -1
- package/dist/modules/Order/utils.js +16 -6
- package/dist/modules/Payment/index.js +9 -10
- 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/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/loadCustomerInvoiceLayout.d.ts +22 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +142 -0
- package/dist/shared/receipt/small-ticket.d.ts +85 -0
- package/dist/shared/receipt/small-ticket.js +2576 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/index.d.ts +24 -0
- package/dist/solution/BaseSales/index.js +1221 -1038
- package/dist/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/dist/solution/BaseSales/pickupTiming.js +589 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +3 -3
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/dist/solution/OrderInvoicePreview/index.js +269 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +13 -4
- package/dist/solution/UnifiedBookingSales/index.js +872 -707
- 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/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 +6 -0
- package/lib/modules/Order/index.d.ts +6 -0
- package/lib/modules/Order/index.js +39 -8
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +5 -1
- package/lib/modules/Order/utils.js +12 -4
- package/lib/modules/Payment/index.js +3 -4
- 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/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/loadCustomerInvoiceLayout.d.ts +22 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +86 -0
- package/lib/shared/receipt/small-ticket.d.ts +85 -0
- package/lib/shared/receipt/small-ticket.js +2342 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/index.d.ts +24 -0
- package/lib/solution/BaseSales/index.js +97 -1
- package/lib/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/lib/solution/BaseSales/pickupTiming.js +269 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +3 -3
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/lib/solution/OrderInvoicePreview/index.js +192 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +13 -4
- package/lib/solution/UnifiedBookingSales/index.js +130 -46
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -30,11 +30,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
30
30
|
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; }
|
|
31
31
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
32
32
|
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); }
|
|
33
|
+
import { loadSalesOrderSnapshot } from "../../shared/sales/loadSalesOrderSnapshot";
|
|
33
34
|
import { BaseModule } from "../BaseModule";
|
|
34
35
|
import { OrderHooks } from "./types";
|
|
35
36
|
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeOrderMetaList, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, collectPointCardSnapshotCodeCandidates, mergePointCardSnapshotCodes as _mergePointCardSnapshotCodes, buildVirtualCurrencySnapshotFromList, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
|
|
36
37
|
import { isNormalProduct } from "../Product/utils";
|
|
37
38
|
import { getWeighedProductPriceFingerprint, resolveWeighedSourcePrice, withOriginalBundleOptionPrices } from "./utils/weighedProduct";
|
|
39
|
+
import { buildPickupTimingBooking, isFulfillmentTimingBooking } from "./pickupTiming";
|
|
38
40
|
import dayjs from 'dayjs';
|
|
39
41
|
import { getDiscountLifecycleReason } from "../Discount/availability";
|
|
40
42
|
import { stripOsPrivatePayloadFields } from "../../utils/os-private-payload";
|
|
@@ -3261,6 +3263,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3261
3263
|
bookings.forEach(function (booking) {
|
|
3262
3264
|
var _booking$metadata2, _booking$metadata3;
|
|
3263
3265
|
if (!booking || _typeof(booking) !== 'object') return;
|
|
3266
|
+
if (isFulfillmentTimingBooking(booking)) return;
|
|
3264
3267
|
var productUid = booking.product_uid || ((_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid);
|
|
3265
3268
|
if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
|
|
3266
3269
|
bookingByProductUid.set(String(productUid), booking);
|
|
@@ -3325,6 +3328,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3325
3328
|
try {
|
|
3326
3329
|
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
3327
3330
|
var booking = _step18.value;
|
|
3331
|
+
if (isFulfillmentTimingBooking(booking)) continue;
|
|
3328
3332
|
var holder = booking !== null && booking !== void 0 && booking.holder && _typeof(booking.holder) === 'object' ? booking.holder : null;
|
|
3329
3333
|
if (!baseHolder && holder) {
|
|
3330
3334
|
baseHolder = holder;
|
|
@@ -3383,7 +3387,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3383
3387
|
}, {
|
|
3384
3388
|
key: "syncTempOrderHolderFromBookings",
|
|
3385
3389
|
value: function syncTempOrderHolderFromBookings(tempOrder) {
|
|
3386
|
-
var bookings = tempOrder.bookings || []
|
|
3390
|
+
var bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
3391
|
+
return !isFulfillmentTimingBooking(booking);
|
|
3392
|
+
});
|
|
3387
3393
|
var hasHolderSource = bookings.some(function (booking) {
|
|
3388
3394
|
var _booking$metadata4;
|
|
3389
3395
|
return (booking === null || booking === void 0 ? void 0 : booking.holder) !== undefined || (booking === null || booking === void 0 || (_booking$metadata4 = booking.metadata) === null || _booking$metadata4 === void 0 ? void 0 : _booking$metadata4.holder_id) !== undefined;
|
|
@@ -3420,6 +3426,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3420
3426
|
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid);
|
|
3421
3427
|
if (!productUid && !bookingUid) return;
|
|
3422
3428
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
3429
|
+
if (isFulfillmentTimingBooking(booking)) return true;
|
|
3423
3430
|
var currentBookingUid = _this21.getBookingUniqueIdentificationNumber(booking);
|
|
3424
3431
|
if (bookingUid && currentBookingUid === String(bookingUid)) return false;
|
|
3425
3432
|
if (productUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) return false;
|
|
@@ -4007,10 +4014,47 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4007
4014
|
}, {
|
|
4008
4015
|
key: "updateTempOrderServiceType",
|
|
4009
4016
|
value: function updateTempOrderServiceType(serviceType) {
|
|
4017
|
+
if (serviceType !== 'pick_up') {
|
|
4018
|
+
var tempOrder = this.ensureTempOrder();
|
|
4019
|
+
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
4020
|
+
return !isFulfillmentTimingBooking(booking);
|
|
4021
|
+
});
|
|
4022
|
+
}
|
|
4010
4023
|
return this.updateTempOrderShopServiceData({
|
|
4011
4024
|
service_type: serviceType
|
|
4012
4025
|
});
|
|
4013
4026
|
}
|
|
4027
|
+
}, {
|
|
4028
|
+
key: "getPickupTimingBooking",
|
|
4029
|
+
value: function getPickupTimingBooking() {
|
|
4030
|
+
var _this$store$tempOrder7;
|
|
4031
|
+
return (((_this$store$tempOrder7 = this.store.tempOrder) === null || _this$store$tempOrder7 === void 0 ? void 0 : _this$store$tempOrder7.bookings) || []).find(isFulfillmentTimingBooking) || null;
|
|
4032
|
+
}
|
|
4033
|
+
}, {
|
|
4034
|
+
key: "setPickupTimingBooking",
|
|
4035
|
+
value: function setPickupTimingBooking(input) {
|
|
4036
|
+
var tempOrder = this.ensureTempOrder();
|
|
4037
|
+
var bookings = tempOrder.bookings || [];
|
|
4038
|
+
var firstIndex = bookings.findIndex(isFulfillmentTimingBooking);
|
|
4039
|
+
var nextBooking = buildPickupTimingBooking(input, bookings[firstIndex]);
|
|
4040
|
+
// Keep the first row's identity and position; repair duplicate marked rows only.
|
|
4041
|
+
tempOrder.bookings = firstIndex === -1 ? [].concat(_toConsumableArray(bookings), [nextBooking]) : bookings.flatMap(function (booking, index) {
|
|
4042
|
+
return index === firstIndex ? [nextBooking] : isFulfillmentTimingBooking(booking) ? [] : [booking];
|
|
4043
|
+
});
|
|
4044
|
+
this.notifyTempOrderChanged();
|
|
4045
|
+
return nextBooking;
|
|
4046
|
+
}
|
|
4047
|
+
}, {
|
|
4048
|
+
key: "clearPickupTimingBooking",
|
|
4049
|
+
value: function clearPickupTimingBooking() {
|
|
4050
|
+
var _tempOrder$bookings;
|
|
4051
|
+
var tempOrder = this.store.tempOrder;
|
|
4052
|
+
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.some(isFulfillmentTimingBooking))) return;
|
|
4053
|
+
tempOrder.bookings = tempOrder.bookings.filter(function (booking) {
|
|
4054
|
+
return !isFulfillmentTimingBooking(booking);
|
|
4055
|
+
});
|
|
4056
|
+
this.notifyTempOrderChanged();
|
|
4057
|
+
}
|
|
4014
4058
|
}, {
|
|
4015
4059
|
key: "updateTempOrderContactsInfo",
|
|
4016
4060
|
value: function updateTempOrderContactsInfo(contactsInfo) {
|
|
@@ -4224,8 +4268,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4224
4268
|
}, {
|
|
4225
4269
|
key: "getOrderCustomerSnapshot",
|
|
4226
4270
|
value: function getOrderCustomerSnapshot() {
|
|
4227
|
-
var _this$store$
|
|
4228
|
-
var snapshot = (_this$store$
|
|
4271
|
+
var _this$store$tempOrder8;
|
|
4272
|
+
var snapshot = (_this$store$tempOrder8 = this.store.tempOrder) === null || _this$store$tempOrder8 === void 0 || (_this$store$tempOrder8 = _this$store$tempOrder8._extend) === null || _this$store$tempOrder8 === void 0 ? void 0 : _this$store$tempOrder8.customerSnapshot;
|
|
4229
4273
|
return snapshot ? cloneDeep(snapshot) : null;
|
|
4230
4274
|
}
|
|
4231
4275
|
}, {
|
|
@@ -7257,12 +7301,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7257
7301
|
params.forceRemote = false;
|
|
7258
7302
|
}
|
|
7259
7303
|
_context49.next = 6;
|
|
7260
|
-
return this.request
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
forceRemote:
|
|
7264
|
-
} : {}), {
|
|
7265
|
-
osServer: true
|
|
7304
|
+
return loadSalesOrderSnapshot(this.request, {
|
|
7305
|
+
lookup: lookup,
|
|
7306
|
+
transport: 'os-server',
|
|
7307
|
+
forceRemote: params.forceRemote
|
|
7266
7308
|
});
|
|
7267
7309
|
case 6:
|
|
7268
7310
|
res = _context49.sent;
|
|
@@ -7894,8 +7936,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7894
7936
|
}, {
|
|
7895
7937
|
key: "getVouchers",
|
|
7896
7938
|
value: function getVouchers() {
|
|
7897
|
-
var _this$store$
|
|
7898
|
-
return ((_this$store$
|
|
7939
|
+
var _this$store$tempOrder9;
|
|
7940
|
+
return ((_this$store$tempOrder9 = this.store.tempOrder) === null || _this$store$tempOrder9 === void 0 ? void 0 : _this$store$tempOrder9.vouchers) || [];
|
|
7899
7941
|
}
|
|
7900
7942
|
}], [{
|
|
7901
7943
|
key: "populateSavedAmounts",
|
|
@@ -7989,4 +8031,5 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7989
8031
|
}
|
|
7990
8032
|
}]);
|
|
7991
8033
|
return OrderModule;
|
|
7992
|
-
}(BaseModule);
|
|
8034
|
+
}(BaseModule);
|
|
8035
|
+
export { isFulfillmentTimingBooking } from "./pickupTiming";
|
|
@@ -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,53 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
8
|
+
/** The explicit marker is the only authority; unlinked ordinary bookings remain ordinary. */
|
|
9
|
+
export function isFulfillmentTimingBooking(booking) {
|
|
10
|
+
var _metadata;
|
|
11
|
+
return (booking === null || booking === void 0 || (_metadata = booking.metadata) === null || _metadata === void 0 ? void 0 : _metadata.is_fulfillment_timing) === true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Update an independent pickup appointment without changing its persisted row identity. */
|
|
15
|
+
export function buildPickupTimingBooking(input, existing) {
|
|
16
|
+
var booking = _objectSpread({}, existing || {});
|
|
17
|
+
var metadata = _objectSpread({}, booking.metadata || {});
|
|
18
|
+
// A fulfillment appointment never becomes a product/resource/holder purchase line.
|
|
19
|
+
for (var _i = 0, _arr = ['product_uid', 'product', 'holder', 'holder_id', 'collect_pax', 'capacity']; _i < _arr.length; _i++) {
|
|
20
|
+
var _key = _arr[_i];
|
|
21
|
+
delete booking[_key];
|
|
22
|
+
delete metadata[_key];
|
|
23
|
+
}
|
|
24
|
+
delete metadata.booking_uid;
|
|
25
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
26
|
+
schedule_id: booking.schedule_id || 0,
|
|
27
|
+
start_date: input.date,
|
|
28
|
+
end_date: input.date,
|
|
29
|
+
start_time: input.time,
|
|
30
|
+
end_time: input.time,
|
|
31
|
+
select_date: input.date,
|
|
32
|
+
duration: 0,
|
|
33
|
+
is_all: 0,
|
|
34
|
+
sub_type: 'minutes',
|
|
35
|
+
like_status: booking.like_status || 'common',
|
|
36
|
+
resources: [],
|
|
37
|
+
metadata: _objectSpread(_objectSpread({}, metadata), {}, {
|
|
38
|
+
unique_identification_number: String(metadata.unique_identification_number || createUuidV4()),
|
|
39
|
+
is_fulfillment_timing: true,
|
|
40
|
+
fulfillment_timing: _objectSpread(_objectSpread(_objectSpread({
|
|
41
|
+
method: 'pick_up',
|
|
42
|
+
mode: input.mode,
|
|
43
|
+
source: input.source
|
|
44
|
+
}, input.instant !== undefined ? {
|
|
45
|
+
instant: input.instant
|
|
46
|
+
} : {}), input.timezone !== undefined ? {
|
|
47
|
+
timezone: input.timezone
|
|
48
|
+
} : {}), input.frozen !== undefined ? {
|
|
49
|
+
frozen: input.frozen
|
|
50
|
+
} : {})
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -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 | '';
|
|
@@ -863,6 +864,9 @@ export interface OrderModuleAPI {
|
|
|
863
864
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
864
865
|
updateTempOrderPickupReferenceMode: (mode: PickupReferenceMode) => ShopServiceData;
|
|
865
866
|
updateTempOrderServiceType: (serviceType: ShopServiceType) => ShopServiceData;
|
|
867
|
+
getPickupTimingBooking: () => PickupTimingBooking | null;
|
|
868
|
+
setPickupTimingBooking: (input: PickupTimingBookingInput) => PickupTimingBooking;
|
|
869
|
+
clearPickupTimingBooking: () => void;
|
|
866
870
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
867
871
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
868
872
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
@@ -31,6 +31,7 @@ import { getProductHolderConfig } from "../Holder/utils";
|
|
|
31
31
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
32
32
|
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
33
33
|
import { encodeSalesNotes } from "./salesNotes";
|
|
34
|
+
import { isFulfillmentTimingBooking } from "./pickupTiming";
|
|
34
35
|
dayjs.extend(customParseFormat);
|
|
35
36
|
var POINT_CARD_SNAPSHOT_TAG = 'point_card';
|
|
36
37
|
var VIRTUAL_CURRENCY_SNAPSHOT_TAG = 'virtual_currency';
|
|
@@ -1266,7 +1267,7 @@ function normalizeSubmitProduct(product) {
|
|
|
1266
1267
|
payment_price: formatOptions.virtualSettlementMode ? virtualPrice : (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
|
|
1267
1268
|
});
|
|
1268
1269
|
}
|
|
1269
|
-
var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
|
|
1270
|
+
var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder', 'is_fulfillment_timing', 'fulfillment_timing'];
|
|
1270
1271
|
export function normalizeBookingIsAll(booking) {
|
|
1271
1272
|
return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
|
|
1272
1273
|
}
|
|
@@ -1294,16 +1295,22 @@ export function normalizeSubmitBooking(booking) {
|
|
|
1294
1295
|
} finally {
|
|
1295
1296
|
_iterator7.f();
|
|
1296
1297
|
}
|
|
1297
|
-
if (cleanMetadata.holder_id === undefined
|
|
1298
|
+
if (cleanMetadata.holder_id === undefined && !isFulfillmentTimingBooking(booking)) {
|
|
1299
|
+
cleanMetadata.holder_id = null;
|
|
1300
|
+
}
|
|
1298
1301
|
var bookingRecord = booking;
|
|
1299
1302
|
var startDate = bookingRecord.start_date;
|
|
1300
1303
|
var shouldRestoreSelectDate = bookingRecord.select_date === undefined || bookingRecord.select_date === null || bookingRecord.select_date === '';
|
|
1301
1304
|
var selectDateFromStartDate = typeof startDate === 'string' ? startDate.split(/\s+/)[0] : startDate;
|
|
1302
|
-
return _objectSpread(_objectSpread(_objectSpread({}, booking), shouldRestoreSelectDate && selectDateFromStartDate ? {
|
|
1305
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, booking), shouldRestoreSelectDate && selectDateFromStartDate ? {
|
|
1303
1306
|
select_date: selectDateFromStartDate
|
|
1304
1307
|
} : {}), {}, {
|
|
1305
1308
|
is_all: normalizeBookingIsAll(bookingRecord),
|
|
1306
|
-
sub_type: normalizeBookingSubType(bookingRecord)
|
|
1309
|
+
sub_type: normalizeBookingSubType(bookingRecord)
|
|
1310
|
+
}, isFulfillmentTimingBooking(booking) ? {
|
|
1311
|
+
like_status: bookingRecord.like_status || 'common',
|
|
1312
|
+
schedule_id: bookingRecord.schedule_id || 0
|
|
1313
|
+
} : {}), {}, {
|
|
1307
1314
|
metadata: cleanMetadata
|
|
1308
1315
|
});
|
|
1309
1316
|
}
|
|
@@ -1392,6 +1399,7 @@ function hasBoundBookingResource(bookings) {
|
|
|
1392
1399
|
if (!Array.isArray(bookings)) return false;
|
|
1393
1400
|
return bookings.some(function (booking) {
|
|
1394
1401
|
if (!booking || _typeof(booking) !== 'object') return false;
|
|
1402
|
+
if (isFulfillmentTimingBooking(booking)) return false;
|
|
1395
1403
|
if (Number(booking.parent_id) === 0) return false;
|
|
1396
1404
|
var resources = booking.resources;
|
|
1397
1405
|
if (!Array.isArray(resources)) return false;
|
|
@@ -1426,7 +1434,9 @@ export function resolveSubmitOrderType(params) {
|
|
|
1426
1434
|
return 'table-order';
|
|
1427
1435
|
}
|
|
1428
1436
|
if (currentType) return currentType;
|
|
1429
|
-
if (Array.isArray(bookings) && bookings.
|
|
1437
|
+
if (Array.isArray(bookings) && bookings.some(function (booking) {
|
|
1438
|
+
return !isFulfillmentTimingBooking(booking);
|
|
1439
|
+
})) {
|
|
1430
1440
|
return businessCode === 'dine_in' ? 'table-order' : 'appointment_booking';
|
|
1431
1441
|
}
|
|
1432
1442
|
return 'virtual';
|
|
@@ -1510,7 +1520,7 @@ export function buildSubmitPayload(params) {
|
|
|
1510
1520
|
schedule_date: scheduleDate,
|
|
1511
1521
|
// created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
|
|
1512
1522
|
bookings: (tempOrder.bookings || []).filter(function (booking) {
|
|
1513
|
-
return Number(booking.parent_id) !== 0;
|
|
1523
|
+
return isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
|
|
1514
1524
|
}).map(function (booking) {
|
|
1515
1525
|
return normalizeSubmitBooking(booking);
|
|
1516
1526
|
}),
|
|
@@ -20,6 +20,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
20
20
|
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; }
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
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); }
|
|
23
|
+
import { loadPaymentMethods } from "../../shared/payment/loadPaymentMethods";
|
|
23
24
|
import { BaseModule } from "../BaseModule";
|
|
24
25
|
import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
|
|
25
26
|
import { getUniqueId } from "../Cart/utils";
|
|
@@ -363,37 +364,35 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
363
364
|
key: "getPayMethodListAsync",
|
|
364
365
|
value: (function () {
|
|
365
366
|
var _getPayMethodListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
366
|
-
var
|
|
367
|
+
var payMethods;
|
|
367
368
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
368
369
|
while (1) switch (_context3.prev = _context3.next) {
|
|
369
370
|
case 0:
|
|
370
371
|
this.logInfo('Starting getPayMethodListAsync');
|
|
371
372
|
_context3.prev = 1;
|
|
372
373
|
_context3.next = 4;
|
|
373
|
-
return this.request
|
|
374
|
+
return loadPaymentMethods(this.request, {
|
|
375
|
+
transport: 'os-server',
|
|
374
376
|
filterPaymentMethods: true
|
|
375
|
-
}, {
|
|
376
|
-
osServer: true
|
|
377
377
|
});
|
|
378
378
|
case 4:
|
|
379
|
-
|
|
380
|
-
payMethods = (response === null || response === void 0 ? void 0 : response.data) || response || [];
|
|
379
|
+
payMethods = _context3.sent;
|
|
381
380
|
this.logInfo('getPayMethodListAsync completed successfully', {
|
|
382
381
|
payMethods: payMethods
|
|
383
382
|
});
|
|
384
383
|
return _context3.abrupt("return", payMethods);
|
|
385
|
-
case
|
|
386
|
-
_context3.prev =
|
|
384
|
+
case 9:
|
|
385
|
+
_context3.prev = 9;
|
|
387
386
|
_context3.t0 = _context3["catch"](1);
|
|
388
387
|
console.error('[PaymentModule] 获取支付方式列表失败', _context3.t0);
|
|
389
388
|
this.logError('getPayMethodListAsync failed', _context3.t0);
|
|
390
389
|
// 如果所有操作都失败,返回空数组
|
|
391
390
|
return _context3.abrupt("return", []);
|
|
392
|
-
case
|
|
391
|
+
case 14:
|
|
393
392
|
case "end":
|
|
394
393
|
return _context3.stop();
|
|
395
394
|
}
|
|
396
|
-
}, _callee3, this, [[1,
|
|
395
|
+
}, _callee3, this, [[1, 9]]);
|
|
397
396
|
}));
|
|
398
397
|
function getPayMethodListAsync() {
|
|
399
398
|
return _getPayMethodListAsync.apply(this, arguments);
|
|
@@ -10,6 +10,10 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
10
10
|
private openCache;
|
|
11
11
|
private fatherModule;
|
|
12
12
|
private hasLoadedScheduleList;
|
|
13
|
+
private scheduleListPromise;
|
|
14
|
+
private scheduleListRequestVersion;
|
|
15
|
+
private scheduleCatalogScope;
|
|
16
|
+
private otherParams;
|
|
13
17
|
constructor(name?: string, version?: string);
|
|
14
18
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
15
19
|
/**
|
|
@@ -19,6 +23,9 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
19
23
|
* scheduleModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' });
|
|
20
24
|
*/
|
|
21
25
|
updateOtherParams(params: Record<string, any>): void;
|
|
26
|
+
private syncScheduleCatalogScope;
|
|
27
|
+
private resetScheduleCatalog;
|
|
28
|
+
destroy(): void;
|
|
22
29
|
/**
|
|
23
30
|
* 加载当前店铺下所有 schedule
|
|
24
31
|
*
|
|
@@ -27,6 +34,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
27
34
|
loadAllSchedule(options?: {
|
|
28
35
|
useCache?: boolean;
|
|
29
36
|
}): Promise<void>;
|
|
37
|
+
private loadScheduleCatalog;
|
|
30
38
|
setScheduleList(list: ScheduleItem[]): void;
|
|
31
39
|
private syncScheduleMap;
|
|
32
40
|
getScheduleList(): ScheduleItem[];
|