@pisell/pisellos 2.3.86 → 2.3.88
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/Order/index.js +17 -16
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/ResourcePlanner/planner.js +54 -17
- package/dist/modules/ResourcePlanner/types.d.ts +3 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +154 -64
- package/dist/solution/BaseSales/index.d.ts +3 -0
- package/dist/solution/BaseSales/index.js +127 -82
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +5 -2
- package/dist/solution/UnifiedBookingSales/index.js +62 -32
- package/lib/modules/Order/index.js +8 -7
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/ResourcePlanner/planner.js +48 -17
- package/lib/modules/ResourcePlanner/types.d.ts +3 -0
- package/lib/server/index.d.ts +4 -0
- package/lib/server/index.js +83 -2
- package/lib/solution/BaseSales/index.d.ts +3 -0
- package/lib/solution/BaseSales/index.js +35 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +5 -2
- package/lib/solution/UnifiedBookingSales/index.js +37 -1
- package/package.json +1 -1
|
@@ -5468,7 +5468,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5468
5468
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
5469
5469
|
var _this32 = this,
|
|
5470
5470
|
_params$confirmPendin;
|
|
5471
|
-
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitParams, submitResult;
|
|
5471
|
+
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, enhancePayload, submitParams, submitResult;
|
|
5472
5472
|
return _regeneratorRuntime().wrap(function _callee34$(_context37) {
|
|
5473
5473
|
while (1) switch (_context37.prev = _context37.next) {
|
|
5474
5474
|
case 0:
|
|
@@ -5521,6 +5521,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5521
5521
|
case 25:
|
|
5522
5522
|
this.store.syncState = 'submitting';
|
|
5523
5523
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
|
|
5524
|
+
enhancePayload = function enhancePayload(payload, ctx) {
|
|
5525
|
+
var enhancedPayload = params.enhancePayload ? params.enhancePayload(payload, ctx) : payload;
|
|
5526
|
+
return _objectSpread(_objectSpread({}, enhancedPayload), {}, {
|
|
5527
|
+
request_unique_idempotency_token: paymentSyncIdempotencyToken
|
|
5528
|
+
});
|
|
5529
|
+
};
|
|
5524
5530
|
submitParams = {
|
|
5525
5531
|
payments: effectivePayments,
|
|
5526
5532
|
paymentStatus: paymentStatus,
|
|
@@ -5528,34 +5534,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5528
5534
|
businessCode: params.businessCode,
|
|
5529
5535
|
channel: params.channel,
|
|
5530
5536
|
confirmPendingVoucherPayments: true,
|
|
5531
|
-
enhancePayload:
|
|
5532
|
-
var nextPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
5533
|
-
request_unique_idempotency_token: paymentSyncIdempotencyToken
|
|
5534
|
-
});
|
|
5535
|
-
return nextPayload;
|
|
5536
|
-
}
|
|
5537
|
+
enhancePayload: enhancePayload
|
|
5537
5538
|
};
|
|
5538
5539
|
if (!(params.checkoutSyncTaskEnabled === false)) {
|
|
5539
|
-
_context37.next =
|
|
5540
|
+
_context37.next = 35;
|
|
5540
5541
|
break;
|
|
5541
5542
|
}
|
|
5542
|
-
_context37.next =
|
|
5543
|
+
_context37.next = 32;
|
|
5543
5544
|
return this.submitTempOrderAsync(submitParams);
|
|
5544
|
-
case
|
|
5545
|
+
case 32:
|
|
5545
5546
|
_context37.t1 = _context37.sent;
|
|
5546
|
-
_context37.next =
|
|
5547
|
+
_context37.next = 38;
|
|
5547
5548
|
break;
|
|
5548
|
-
case
|
|
5549
|
-
_context37.next =
|
|
5549
|
+
case 35:
|
|
5550
|
+
_context37.next = 37;
|
|
5550
5551
|
return this.submitTempOrder(submitParams);
|
|
5551
|
-
case 36:
|
|
5552
|
-
_context37.t1 = _context37.sent;
|
|
5553
5552
|
case 37:
|
|
5553
|
+
_context37.t1 = _context37.sent;
|
|
5554
|
+
case 38:
|
|
5554
5555
|
submitResult = _context37.t1;
|
|
5555
5556
|
return _context37.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
|
|
5556
5557
|
submitResult: submitResult
|
|
5557
5558
|
}));
|
|
5558
|
-
case
|
|
5559
|
+
case 40:
|
|
5559
5560
|
case "end":
|
|
5560
5561
|
return _context37.stop();
|
|
5561
5562
|
}
|
|
@@ -608,6 +608,7 @@ export interface SyncPaymentsToOrderParams {
|
|
|
608
608
|
businessCode?: string;
|
|
609
609
|
channel?: string;
|
|
610
610
|
confirmPendingVoucherPayments?: boolean;
|
|
611
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
611
612
|
}
|
|
612
613
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
613
614
|
isFullyPaid: boolean;
|
|
@@ -52,6 +52,23 @@ function normalizeBookingCount(bookingCount) {
|
|
|
52
52
|
}
|
|
53
53
|
return normalized;
|
|
54
54
|
}
|
|
55
|
+
function resolveRequestedDurationMinutes(product, request) {
|
|
56
|
+
var _request$durationMinu;
|
|
57
|
+
var configured = Math.max(1, Number(product.durationMinutes || 30) || 30);
|
|
58
|
+
if (product.kind !== 'duration') return configured;
|
|
59
|
+
var override = (_request$durationMinu = request.durationMinutesByProductId) === null || _request$durationMinu === void 0 ? void 0 : _request$durationMinu[String(product.id)];
|
|
60
|
+
var normalized = Number(override);
|
|
61
|
+
return Number.isInteger(normalized) && normalized > 0 ? normalized : configured;
|
|
62
|
+
}
|
|
63
|
+
function resolveRequestedDurationStartTimes(product, request) {
|
|
64
|
+
var _request$durationStar;
|
|
65
|
+
if (product.kind !== 'duration') return [];
|
|
66
|
+
var values = (_request$durationStar = request.durationStartTimesByProductId) === null || _request$durationStar === void 0 ? void 0 : _request$durationStar[String(product.id)];
|
|
67
|
+
if (!Array.isArray(values)) return [];
|
|
68
|
+
return Array.from(new Set(values.filter(function (value) {
|
|
69
|
+
return typeof value === 'string' && /^([01]\d|2[0-3]):[0-5]\d$/.test(value);
|
|
70
|
+
})));
|
|
71
|
+
}
|
|
55
72
|
function toDateTime(value, _timezoneName) {
|
|
56
73
|
try {
|
|
57
74
|
return localDateTimeToScalar(parseLocalDateTime(value));
|
|
@@ -962,11 +979,29 @@ function dedupeProductRanges(ranges) {
|
|
|
962
979
|
return left.startAt.localeCompare(right.startAt);
|
|
963
980
|
});
|
|
964
981
|
}
|
|
982
|
+
function createDurationTimeRange(product, start, durationMinutes, projection, fixedOffsetMinutes) {
|
|
983
|
+
var bookingEnd = addMinutesZoned(start, durationMinutes, projection.meta.timezone);
|
|
984
|
+
return {
|
|
985
|
+
key: "".concat(String(product.id), ":").concat(start, ":").concat(bookingEnd),
|
|
986
|
+
productId: product.id,
|
|
987
|
+
source: 'duration_window',
|
|
988
|
+
startAt: formatDateTime(start, projection.meta.timezone, fixedOffsetMinutes),
|
|
989
|
+
endAt: formatDateTime(bookingEnd, projection.meta.timezone, fixedOffsetMinutes),
|
|
990
|
+
bookingStartAt: formatDateTime(start, projection.meta.timezone, fixedOffsetMinutes),
|
|
991
|
+
bookingEndAt: formatDateTime(bookingEnd, projection.meta.timezone, fixedOffsetMinutes),
|
|
992
|
+
date: formatDate(start, projection.meta.timezone),
|
|
993
|
+
startTime: formatTime(start, projection.meta.timezone),
|
|
994
|
+
endTime: formatTime(bookingEnd, projection.meta.timezone),
|
|
995
|
+
timezone: projection.meta.timezone,
|
|
996
|
+
scheduleRefs: []
|
|
997
|
+
};
|
|
998
|
+
}
|
|
965
999
|
export function getProductTimeRanges(projection) {
|
|
966
1000
|
var _extractFixedOffsetMi3, _request$productIds;
|
|
967
1001
|
var request = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
968
1002
|
var normalizedPartySize = normalizePartySize(request.partySize);
|
|
969
1003
|
var dateRange = resolveProjectionDateRange(projection, request.dateRange);
|
|
1004
|
+
var slotStepMinutes = projection.meta.defaults.slotStepMinutes;
|
|
970
1005
|
var fixedOffsetMinutes = (_extractFixedOffsetMi3 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi3 !== void 0 ? _extractFixedOffsetMi3 : captureRuntimeOffsetMinutes();
|
|
971
1006
|
var resourceWindowIndex = buildResourceWindowIndex(projection);
|
|
972
1007
|
var filteredProductIdSet = (_request$productIds = request.productIds) !== null && _request$productIds !== void 0 && _request$productIds.length ? new Set(request.productIds.map(String)) : null;
|
|
@@ -978,6 +1013,7 @@ export function getProductTimeRanges(projection) {
|
|
|
978
1013
|
productId: product.id,
|
|
979
1014
|
title: product.title,
|
|
980
1015
|
kind: product.kind,
|
|
1016
|
+
slotStepMinutes: slotStepMinutes,
|
|
981
1017
|
ranges: []
|
|
982
1018
|
};
|
|
983
1019
|
}
|
|
@@ -986,6 +1022,7 @@ export function getProductTimeRanges(projection) {
|
|
|
986
1022
|
productId: product.id,
|
|
987
1023
|
title: product.title,
|
|
988
1024
|
kind: product.kind,
|
|
1025
|
+
slotStepMinutes: slotStepMinutes,
|
|
989
1026
|
ranges: getSessionRangesForProduct(projection, product, dateRange)
|
|
990
1027
|
};
|
|
991
1028
|
}
|
|
@@ -1007,9 +1044,9 @@ export function getProductTimeRanges(projection) {
|
|
|
1007
1044
|
return current === null ? ranges : intersectRangeLists(current, ranges);
|
|
1008
1045
|
}, null) || [] : null;
|
|
1009
1046
|
var baseRanges = resourceRanges === null ? operatingRanges : intersectRangeLists(resourceRanges, operatingRanges);
|
|
1010
|
-
var durationMinutes =
|
|
1011
|
-
var timeSliceMinutes = projection.meta.defaults.slotStepMinutes;
|
|
1047
|
+
var durationMinutes = resolveRequestedDurationMinutes(product, request);
|
|
1012
1048
|
var durationAnchor = ceilToTenMinutes(toDateTime(projection.meta.durationCandidateAnchorAt, projection.meta.timezone), projection.meta.timezone);
|
|
1049
|
+
var requestedStartTimes = resolveRequestedDurationStartTimes(product, request);
|
|
1013
1050
|
var ranges = [];
|
|
1014
1051
|
baseRanges.forEach(function (range) {
|
|
1015
1052
|
if (range.end <= durationAnchor) return;
|
|
@@ -1022,28 +1059,28 @@ export function getProductTimeRanges(projection) {
|
|
|
1022
1059
|
if (bookingEnd > range.end) break;
|
|
1023
1060
|
var bookingDate = formatDate(cursor);
|
|
1024
1061
|
if (bookingDate >= dateRange.startDate && bookingDate <= dateRange.endDate) {
|
|
1025
|
-
ranges.push(
|
|
1026
|
-
key: "".concat(String(product.id), ":").concat(cursor, ":").concat(bookingEnd),
|
|
1027
|
-
productId: product.id,
|
|
1028
|
-
source: 'duration_window',
|
|
1029
|
-
startAt: formatDateTime(cursor, projection.meta.timezone, fixedOffsetMinutes),
|
|
1030
|
-
endAt: formatDateTime(bookingEnd, projection.meta.timezone, fixedOffsetMinutes),
|
|
1031
|
-
bookingStartAt: formatDateTime(cursor, projection.meta.timezone, fixedOffsetMinutes),
|
|
1032
|
-
bookingEndAt: formatDateTime(bookingEnd, projection.meta.timezone, fixedOffsetMinutes),
|
|
1033
|
-
date: formatDate(cursor, projection.meta.timezone),
|
|
1034
|
-
startTime: formatTime(cursor, projection.meta.timezone),
|
|
1035
|
-
endTime: formatTime(bookingEnd, projection.meta.timezone),
|
|
1036
|
-
timezone: projection.meta.timezone,
|
|
1037
|
-
scheduleRefs: []
|
|
1038
|
-
});
|
|
1062
|
+
ranges.push(createDurationTimeRange(product, cursor, durationMinutes, projection, fixedOffsetMinutes));
|
|
1039
1063
|
}
|
|
1040
|
-
cursor = addMinutesZoned(cursor,
|
|
1064
|
+
cursor = addMinutesZoned(cursor, slotStepMinutes, projection.meta.timezone);
|
|
1041
1065
|
}
|
|
1042
1066
|
});
|
|
1067
|
+
if (dateRange.startDate === dateRange.endDate && requestedStartTimes.length > 0) {
|
|
1068
|
+
requestedStartTimes.forEach(function (startTime) {
|
|
1069
|
+
var start = toDateTimeInDate(dateRange.startDate, startTime, projection.meta.timezone);
|
|
1070
|
+
if (!Number.isFinite(start)) return;
|
|
1071
|
+
var end = addMinutesZoned(start, durationMinutes, projection.meta.timezone);
|
|
1072
|
+
var startsInOperatingRange = operatingRanges.some(function (range) {
|
|
1073
|
+
return range.start <= start && start < range.end;
|
|
1074
|
+
});
|
|
1075
|
+
if (!startsInOperatingRange) return;
|
|
1076
|
+
ranges.push(createDurationTimeRange(product, start, durationMinutes, projection, fixedOffsetMinutes));
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1043
1079
|
return {
|
|
1044
1080
|
productId: product.id,
|
|
1045
1081
|
title: product.title,
|
|
1046
1082
|
kind: product.kind,
|
|
1083
|
+
slotStepMinutes: slotStepMinutes,
|
|
1047
1084
|
ranges: dedupeProductRanges(ranges)
|
|
1048
1085
|
};
|
|
1049
1086
|
});
|
|
@@ -211,6 +211,7 @@ export interface ProductTimeRangeGroup {
|
|
|
211
211
|
productId: AvailabilityId;
|
|
212
212
|
title?: string;
|
|
213
213
|
kind: AvailabilityProductKind;
|
|
214
|
+
slotStepMinutes?: number;
|
|
214
215
|
ranges: ProductTimeRange[];
|
|
215
216
|
}
|
|
216
217
|
export interface AvailabilityAssignment extends AvailabilityAbsoluteRange {
|
|
@@ -231,6 +232,8 @@ export interface GetProductTimeRangesRequest {
|
|
|
231
232
|
dateRange?: Partial<AvailabilityDateRange>;
|
|
232
233
|
resourceIds?: AvailabilityId[];
|
|
233
234
|
partySize?: number;
|
|
235
|
+
durationMinutesByProductId?: Record<string, number>;
|
|
236
|
+
durationStartTimesByProductId?: Record<string, string[]>;
|
|
234
237
|
}
|
|
235
238
|
export interface QueryAvailabilityBaseRequest {
|
|
236
239
|
productIds?: AvailabilityId[];
|
package/dist/server/index.d.ts
CHANGED
|
@@ -511,6 +511,10 @@ declare class Server {
|
|
|
511
511
|
private buildCheckoutTaskIdempotencyKey;
|
|
512
512
|
private isBlankCheckoutValue;
|
|
513
513
|
private isLocalCheckoutOrderId;
|
|
514
|
+
private applyCheckoutFulfillmentBuzzer;
|
|
515
|
+
private buildCheckoutResourceIdentifierBuzzer;
|
|
516
|
+
private getCheckoutResourceIdentifier;
|
|
517
|
+
private stringifyCheckoutResourceIdentifier;
|
|
514
518
|
private normalizeCheckoutSubmitData;
|
|
515
519
|
private ensureCheckoutOrderNumbers;
|
|
516
520
|
private dispatchCheckoutSyncTask;
|