@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.
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 5 | 2 | 3 | 4 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 3 | 4 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -275,7 +275,10 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
275
275
  const prefix = this.normalizeIdPrefix(openDataConfig?.['sale.short_number_prefix'], '');
276
276
  const shopOrderPrefix = this.normalizeIdPrefix(openDataConfig?.['sale.sale_number_prefix'], '');
277
277
  const resetReceiptSequenceDaily = typeof openDataConfig?.['sale.short_number_daily_reset'] === 'boolean' ? openDataConfig?.['sale.short_number_daily_reset'] : false;
278
- const operatingDayBoundary = this.getAppData('operating_day_boundary');
278
+ const operatingDayBoundary = this.getAppData('operating_day_boundary') || {
279
+ "type": "start_time",
280
+ "time": "00:00"
281
+ };
279
282
  const deviceId = await this.getShortNumberOrDeviceId();
280
283
  this.setPaymentNumberDevicePrefix(deviceId);
281
284
  const businessCode = this.getBookingTicketBusinessCode();
@@ -293,7 +296,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
293
296
  padReceiptSequence: false,
294
297
  receiptSequenceLength,
295
298
  resetReceiptSequenceDaily,
296
- receiptSequenceResetTime: operatingDayBoundary.time,
299
+ receiptSequenceResetTime: operatingDayBoundary?.time,
297
300
  receiptSequenceStart,
298
301
  shopOrderPrefix
299
302
  }
@@ -58,6 +58,30 @@ function normalizePositiveInteger(value) {
58
58
  if (!Number.isInteger(normalized) || normalized <= 0) return undefined;
59
59
  return normalized;
60
60
  }
61
+ function getCandidateDurationMinutes(candidate) {
62
+ const startAt = candidate.bookingStartAt || candidate.startAt;
63
+ const endAt = candidate.bookingEndAt || candidate.endAt;
64
+ try {
65
+ const start = (0, _localClock.localDateTimeToScalar)((0, _localClock.parseLocalDateTime)(startAt));
66
+ const end = (0, _localClock.localDateTimeToScalar)((0, _localClock.parseLocalDateTime)(endAt));
67
+ const minutes = Math.round((end - start) / 60000);
68
+ return Number.isInteger(minutes) && minutes > 0 ? minutes : undefined;
69
+ } catch (_error) {
70
+ return undefined;
71
+ }
72
+ }
73
+ function getCandidateStartTime(candidate) {
74
+ if (/^([01]\d|2[0-3]):[0-5]\d$/.test(candidate.startTime || '')) {
75
+ return candidate.startTime;
76
+ }
77
+ const startAt = candidate.bookingStartAt || candidate.startAt;
78
+ try {
79
+ const start = (0, _localClock.parseLocalDateTime)(startAt);
80
+ return `${String(start.hour).padStart(2, '0')}:${String(start.minute).padStart(2, '0')}`;
81
+ } catch (_error) {
82
+ return undefined;
83
+ }
84
+ }
61
85
  function isRecord(value) {
62
86
  return !!value && typeof value === 'object' && !Array.isArray(value);
63
87
  }
@@ -3027,12 +3051,24 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
3027
3051
  });
3028
3052
  }
3029
3053
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
3054
+ const candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
3055
+ const candidateStartTime = getCandidateStartTime(params.candidate);
3030
3056
  const refreshedRanges = (0, _ResourcePlanner.getProductTimeRanges)(refreshedProjection, {
3031
3057
  productIds: [params.candidate.productId],
3032
3058
  dateRange: {
3033
3059
  startDate: params.candidate.startAt.slice(0, 10),
3034
3060
  endDate: params.candidate.startAt.slice(0, 10)
3035
- }
3061
+ },
3062
+ ...(candidateDurationMinutes ? {
3063
+ durationMinutesByProductId: {
3064
+ [String(params.candidate.productId)]: candidateDurationMinutes
3065
+ },
3066
+ ...(candidateStartTime ? {
3067
+ durationStartTimesByProductId: {
3068
+ [String(params.candidate.productId)]: [candidateStartTime]
3069
+ }
3070
+ } : {})
3071
+ } : {})
3036
3072
  }).flatMap(group => group.ranges);
3037
3073
  const refreshedCandidateBase = refreshedRanges.find(candidate => candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt);
3038
3074
  if (!refreshedCandidateBase) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.86",
4
+ "version": "2.3.88",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",