@pisell/pisellos 2.3.146 → 2.3.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/OpenData/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/ResourcePlanner/planner.js +5 -1
- package/dist/solution/BaseSales/pickupTiming.d.ts +2 -0
- package/dist/solution/BaseSales/pickupTiming.js +19 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +2 -1
- package/lib/modules/OpenData/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/ResourcePlanner/planner.js +5 -1
- package/lib/solution/BaseSales/pickupTiming.d.ts +2 -0
- package/lib/solution/BaseSales/pickupTiming.js +19 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +1 -0
- package/package.json +1 -1
|
@@ -73,6 +73,8 @@ export interface OpenDataConfig {
|
|
|
73
73
|
'sale.require_payment_on_submit'?: boolean | null;
|
|
74
74
|
'sale.enable_item_rules'?: boolean;
|
|
75
75
|
'sale.enable_short_number'?: boolean;
|
|
76
|
+
'sale.short_number_digits'?: number;
|
|
77
|
+
'sale.short_number_random'?: boolean;
|
|
76
78
|
'sale.short_number_daily_reset'?: boolean;
|
|
77
79
|
'sale.short_number_start_number'?: number;
|
|
78
80
|
'sale.short_number_prefix'?: string | null;
|
|
@@ -593,7 +593,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
593
593
|
generateIdempotencyToken(): string;
|
|
594
594
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
595
595
|
createOrder(params: CommitOrderParams['query']): {
|
|
596
|
-
type: "
|
|
596
|
+
type: "appointment_booking" | "virtual";
|
|
597
597
|
platform: string;
|
|
598
598
|
sales_channel: string;
|
|
599
599
|
order_sales_channel: string;
|
|
@@ -175,7 +175,11 @@ function resolveCutOffPolicyIssue(policy) {
|
|
|
175
175
|
return null;
|
|
176
176
|
}
|
|
177
177
|
function addLeadWindow(base, unit, unitType, _timezoneName) {
|
|
178
|
-
if (unitType === 'days')
|
|
178
|
+
if (unitType === 'days') {
|
|
179
|
+
var leadDate = addLocalCalendarDays(base, unit);
|
|
180
|
+
// Positive day lead times start at midnight; zero days keeps the current-time boundary.
|
|
181
|
+
return Math.trunc(unit) > 0 ? localDateToScalarStart(formatLocalDate(leadDate)) : leadDate;
|
|
182
|
+
}
|
|
179
183
|
if (unitType === 'hours') return addLocalHours(base, unit);
|
|
180
184
|
return addLocalMinutes(base, unit);
|
|
181
185
|
}
|
|
@@ -24,6 +24,8 @@ export declare class PickupTimingController {
|
|
|
24
24
|
private getRuntime;
|
|
25
25
|
private loadConfig;
|
|
26
26
|
private loadSchedules;
|
|
27
|
+
/** Preserve an existing POS choice without adding it to the shared settings cache. */
|
|
28
|
+
private getEffectiveConfig;
|
|
27
29
|
private snapshot;
|
|
28
30
|
getAvailability(params?: {
|
|
29
31
|
date?: string;
|
|
@@ -217,7 +217,20 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
217
217
|
return _loadSchedules.apply(this, arguments);
|
|
218
218
|
}
|
|
219
219
|
return loadSchedules;
|
|
220
|
-
}()
|
|
220
|
+
}() /** Preserve an existing POS choice without adding it to the shared settings cache. */
|
|
221
|
+
}, {
|
|
222
|
+
key: "getEffectiveConfig",
|
|
223
|
+
value: function getEffectiveConfig(config) {
|
|
224
|
+
var _this$host$getOrder$g;
|
|
225
|
+
if (!this.host.isPos()) return config;
|
|
226
|
+
var serviceType = (_this$host$getOrder$g = this.host.getOrder().getTempOrder()) === null || _this$host$getOrder$g === void 0 || (_this$host$getOrder$g = _this$host$getOrder$g.metadata) === null || _this$host$getOrder$g === void 0 || (_this$host$getOrder$g = _this$host$getOrder$g.shop_service_data) === null || _this$host$getOrder$g === void 0 ? void 0 : _this$host$getOrder$g.service_type;
|
|
227
|
+
if (serviceType !== 'dine_in' && serviceType !== 'takeaway' || config.handoverModes.includes(serviceType)) {
|
|
228
|
+
return config;
|
|
229
|
+
}
|
|
230
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
|
231
|
+
handoverModes: [].concat(_toConsumableArray(config.handoverModes), [serviceType])
|
|
232
|
+
});
|
|
233
|
+
}
|
|
221
234
|
}, {
|
|
222
235
|
key: "snapshot",
|
|
223
236
|
value: function () {
|
|
@@ -271,7 +284,10 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
271
284
|
error: error
|
|
272
285
|
};
|
|
273
286
|
this.latest = result;
|
|
274
|
-
|
|
287
|
+
// Read the live order after async loading; cached snapshots retain only configured modes.
|
|
288
|
+
return _context5.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
289
|
+
config: this.getEffectiveConfig(config)
|
|
290
|
+
}));
|
|
275
291
|
case 23:
|
|
276
292
|
case "end":
|
|
277
293
|
return _context5.stop();
|
|
@@ -339,7 +355,7 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
339
355
|
var order = this.host.getOrder();
|
|
340
356
|
var tempOrder = order.getTempOrder();
|
|
341
357
|
var booking = order.getPickupTimingBooking();
|
|
342
|
-
var config = ((_this$latest = this.latest) === null || _this$latest === void 0 ? void 0 : _this$latest.scope) === this.host.getScope() ? this.latest.config : undefined;
|
|
358
|
+
var config = ((_this$latest = this.latest) === null || _this$latest === void 0 ? void 0 : _this$latest.scope) === this.host.getScope() ? this.getEffectiveConfig(this.latest.config) : undefined;
|
|
343
359
|
var storedServiceType = String((tempOrder === null || tempOrder === void 0 || (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 || (_tempOrder$metadata = _tempOrder$metadata.shop_service_data) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.service_type) || '');
|
|
344
360
|
var serviceType = config !== null && config !== void 0 && config.handoverModes.length ? config.handoverModes.includes(storedServiceType) ? storedServiceType : config.handoverModes[0] : storedServiceType;
|
|
345
361
|
var details = serviceType === 'pick_up' ? booking === null || booking === void 0 ? void 0 : booking.metadata.fulfillment_timing : undefined;
|
|
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
328
328
|
date: string;
|
|
329
329
|
status: string;
|
|
330
330
|
week: string;
|
|
331
|
-
weekNum: 0 | 1 | 2 |
|
|
331
|
+
weekNum: 0 | 1 | 2 | 3 | 5 | 4 | 6;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -347,7 +347,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
347
347
|
count: number;
|
|
348
348
|
left: number;
|
|
349
349
|
summaryCount: number;
|
|
350
|
-
status: "
|
|
350
|
+
status: "sold_out" | "lots_of_space" | "filling_up_fast";
|
|
351
351
|
}[];
|
|
352
352
|
/**
|
|
353
353
|
* 找到多个资源的公共可用时间段
|
|
@@ -571,7 +571,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
571
571
|
value: function () {
|
|
572
572
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
573
573
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
574
|
-
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
574
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7;
|
|
575
575
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
576
576
|
while (1) switch (_context8.prev = _context8.next) {
|
|
577
577
|
case 0:
|
|
@@ -632,6 +632,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
632
632
|
// TODO 现在 picoding 没这个配置的 key
|
|
633
633
|
padReceiptSequence: false,
|
|
634
634
|
receiptSequenceLength: receiptSequenceLength,
|
|
635
|
+
randomReceiptSequence: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.short_number_random']) === true,
|
|
635
636
|
resetReceiptSequenceDaily: resetReceiptSequenceDaily,
|
|
636
637
|
receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
|
|
637
638
|
receiptSequenceStart: receiptSequenceStart,
|
|
@@ -73,6 +73,8 @@ export interface OpenDataConfig {
|
|
|
73
73
|
'sale.require_payment_on_submit'?: boolean | null;
|
|
74
74
|
'sale.enable_item_rules'?: boolean;
|
|
75
75
|
'sale.enable_short_number'?: boolean;
|
|
76
|
+
'sale.short_number_digits'?: number;
|
|
77
|
+
'sale.short_number_random'?: boolean;
|
|
76
78
|
'sale.short_number_daily_reset'?: boolean;
|
|
77
79
|
'sale.short_number_start_number'?: number;
|
|
78
80
|
'sale.short_number_prefix'?: string | null;
|
|
@@ -593,7 +593,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
593
593
|
generateIdempotencyToken(): string;
|
|
594
594
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
595
595
|
createOrder(params: CommitOrderParams['query']): {
|
|
596
|
-
type: "
|
|
596
|
+
type: "appointment_booking" | "virtual";
|
|
597
597
|
platform: string;
|
|
598
598
|
sales_channel: string;
|
|
599
599
|
order_sales_channel: string;
|
|
@@ -163,7 +163,11 @@ function resolveCutOffPolicyIssue(policy) {
|
|
|
163
163
|
return null;
|
|
164
164
|
}
|
|
165
165
|
function addLeadWindow(base, unit, unitType, _timezoneName) {
|
|
166
|
-
if (unitType === 'days')
|
|
166
|
+
if (unitType === 'days') {
|
|
167
|
+
const leadDate = (0, _localClock.addLocalCalendarDays)(base, unit);
|
|
168
|
+
// Positive day lead times start at midnight; zero days keeps the current-time boundary.
|
|
169
|
+
return Math.trunc(unit) > 0 ? (0, _localClock.localDateToScalarStart)((0, _localClock.formatLocalDate)(leadDate)) : leadDate;
|
|
170
|
+
}
|
|
167
171
|
if (unitType === 'hours') return (0, _localClock.addLocalHours)(base, unit);
|
|
168
172
|
return (0, _localClock.addLocalMinutes)(base, unit);
|
|
169
173
|
}
|
|
@@ -24,6 +24,8 @@ export declare class PickupTimingController {
|
|
|
24
24
|
private getRuntime;
|
|
25
25
|
private loadConfig;
|
|
26
26
|
private loadSchedules;
|
|
27
|
+
/** Preserve an existing POS choice without adding it to the shared settings cache. */
|
|
28
|
+
private getEffectiveConfig;
|
|
27
29
|
private snapshot;
|
|
28
30
|
getAvailability(params?: {
|
|
29
31
|
date?: string;
|
|
@@ -93,6 +93,19 @@ class PickupTimingController {
|
|
|
93
93
|
if (runtime.scheduleRequest === request) runtime.scheduleRequest = undefined;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
/** Preserve an existing POS choice without adding it to the shared settings cache. */
|
|
98
|
+
getEffectiveConfig(config) {
|
|
99
|
+
if (!this.host.isPos()) return config;
|
|
100
|
+
const serviceType = this.host.getOrder().getTempOrder()?.metadata?.shop_service_data?.service_type;
|
|
101
|
+
if (serviceType !== 'dine_in' && serviceType !== 'takeaway' || config.handoverModes.includes(serviceType)) {
|
|
102
|
+
return config;
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
...config,
|
|
106
|
+
handoverModes: [...config.handoverModes, serviceType]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
96
109
|
async snapshot(includeSchedule, tolerateScheduleError = false) {
|
|
97
110
|
const runtime = this.getRuntime();
|
|
98
111
|
const config = await this.loadConfig(runtime);
|
|
@@ -116,7 +129,11 @@ class PickupTimingController {
|
|
|
116
129
|
error
|
|
117
130
|
};
|
|
118
131
|
this.latest = result;
|
|
119
|
-
|
|
132
|
+
// Read the live order after async loading; cached snapshots retain only configured modes.
|
|
133
|
+
return {
|
|
134
|
+
...result,
|
|
135
|
+
config: this.getEffectiveConfig(config)
|
|
136
|
+
};
|
|
120
137
|
}
|
|
121
138
|
async getAvailability(params = {}) {
|
|
122
139
|
// `force` remains accepted for older callers; refresh recomputes time using the runtime catalog.
|
|
@@ -150,7 +167,7 @@ class PickupTimingController {
|
|
|
150
167
|
const order = this.host.getOrder();
|
|
151
168
|
const tempOrder = order.getTempOrder();
|
|
152
169
|
const booking = order.getPickupTimingBooking();
|
|
153
|
-
const config = this.latest?.scope === this.host.getScope() ? this.latest.config : undefined;
|
|
170
|
+
const config = this.latest?.scope === this.host.getScope() ? this.getEffectiveConfig(this.latest.config) : undefined;
|
|
154
171
|
const storedServiceType = String(tempOrder?.metadata?.shop_service_data?.service_type || '');
|
|
155
172
|
const serviceType = config?.handoverModes.length ? config.handoverModes.includes(storedServiceType) ? storedServiceType : config.handoverModes[0] : storedServiceType;
|
|
156
173
|
const details = serviceType === 'pick_up' ? booking?.metadata.fulfillment_timing : undefined;
|
|
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
328
328
|
date: string;
|
|
329
329
|
status: string;
|
|
330
330
|
week: string;
|
|
331
|
-
weekNum: 0 | 1 | 2 |
|
|
331
|
+
weekNum: 0 | 1 | 2 | 3 | 5 | 4 | 6;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -347,7 +347,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
347
347
|
count: number;
|
|
348
348
|
left: number;
|
|
349
349
|
summaryCount: number;
|
|
350
|
-
status: "
|
|
350
|
+
status: "sold_out" | "lots_of_space" | "filling_up_fast";
|
|
351
351
|
}[];
|
|
352
352
|
/**
|
|
353
353
|
* 找到多个资源的公共可用时间段
|
|
@@ -367,6 +367,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
367
367
|
// TODO 现在 picoding 没这个配置的 key
|
|
368
368
|
padReceiptSequence: false,
|
|
369
369
|
receiptSequenceLength,
|
|
370
|
+
randomReceiptSequence: openDataConfig?.['sale.short_number_random'] === true,
|
|
370
371
|
resetReceiptSequenceDaily,
|
|
371
372
|
receiptSequenceResetTime: operatingDayBoundary?.time,
|
|
372
373
|
receiptSequenceStart,
|