@pisell/private-materials 6.11.661 → 6.11.662
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.js +18 -18
- package/es/components/booking/utils.js +1 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.js +5 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.js +9 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.js +3 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/index.d.ts +5 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/index.js +2 -1
- package/es/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +103 -43
- package/es/plus/salesSdk/normalProductDetail/availabilityContextRouting.js +29 -0
- package/es/pro/skuDetailModal/flow/modules/date/availabilityWindow.js +71 -0
- package/es/pro/skuDetailModal/flow/modules/date/index.js +24 -9
- package/es/pro/skuDetailModal/flow/modules/time/index.js +28 -13
- package/es/pro/skuDetailModal/flow/modules/time/posCustomTime.js +7 -1
- package/es/pro/skuDetailModal/flow/types.d.ts +8 -0
- package/lib/components/booking/utils.js +1 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.js +5 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.js +9 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.js +3 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/index.d.ts +5 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/index.js +2 -1
- package/lib/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +103 -43
- package/lib/plus/salesSdk/normalProductDetail/availabilityContextRouting.js +32 -0
- package/lib/pro/skuDetailModal/flow/modules/date/availabilityWindow.js +74 -0
- package/lib/pro/skuDetailModal/flow/modules/date/index.js +24 -9
- package/lib/pro/skuDetailModal/flow/modules/time/index.js +27 -12
- package/lib/pro/skuDetailModal/flow/modules/time/posCustomTime.js +8 -0
- package/lib/pro/skuDetailModal/flow/types.d.ts +8 -0
- package/package.json +4 -4
|
@@ -174,16 +174,30 @@ const refreshAvailabilityTimes = function() {
|
|
|
174
174
|
const posDurationAvailability = isPosDurationAvailabilityContext(context);
|
|
175
175
|
const posSessionAvailability = isPosSessionAvailabilityContext(context);
|
|
176
176
|
const posCustomTimeAvailability = posDurationAvailability || posSessionAvailability;
|
|
177
|
-
const
|
|
178
|
-
const
|
|
177
|
+
const draftRequestedDuration = getAvailabilityDurationOverride(context, durationOverride);
|
|
178
|
+
const draftRequestedStartTime = getAvailabilityStartTimeOverride(context, startTimeOverride);
|
|
179
179
|
const selectedDate = context.draft.booking.startDate.format("YYYY-MM-DD");
|
|
180
180
|
const requestId = Date.now() + Math.random();
|
|
181
181
|
const previousTimeData = context.getModuleData(module.key);
|
|
182
|
-
const posCustomTimeHydrationKey = posCustomTimeAvailability &&
|
|
182
|
+
const posCustomTimeHydrationKey = posCustomTimeAvailability && draftRequestedDuration && draftRequestedStartTime ? `${selectedDate}|${draftRequestedStartTime}|${draftRequestedDuration}` : void 0;
|
|
183
|
+
const product = context.draft.productData;
|
|
184
|
+
const effectiveSelectionIntent = require_posCustomTime.resolvePosFlexibleDurationRequestIntent({
|
|
185
|
+
selectionIntent,
|
|
186
|
+
previousSelectionIntent: previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.posCustomTimeSelectionIntent,
|
|
187
|
+
hydrationKey: posCustomTimeHydrationKey,
|
|
188
|
+
previousHydrationKey: previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.posCustomTimeHydrationKey
|
|
189
|
+
});
|
|
190
|
+
const suppressFlexiblePresetOverride = posDurationAvailability && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && !require_posCustomTime.shouldApplyPosFlexibleDurationOverride({
|
|
191
|
+
selectionIntent: effectiveSelectionIntent,
|
|
192
|
+
isEditMode: context.services.selectionFlowMode === "edit"
|
|
193
|
+
});
|
|
194
|
+
const requestedDuration = suppressFlexiblePresetOverride ? void 0 : draftRequestedDuration;
|
|
195
|
+
const requestedStartTime = suppressFlexiblePresetOverride ? void 0 : draftRequestedStartTime;
|
|
183
196
|
context.setModuleData(module.key, {
|
|
184
197
|
requestId,
|
|
185
198
|
timeSlots: [],
|
|
186
|
-
posCustomTimeHydrationKey
|
|
199
|
+
posCustomTimeHydrationKey,
|
|
200
|
+
posCustomTimeSelectionIntent: effectiveSelectionIntent === "restore" ? void 0 : effectiveSelectionIntent
|
|
187
201
|
});
|
|
188
202
|
const group = (yield availability.getProductTimeRanges(availability.contextId, require_objectSpread2._objectSpread2({
|
|
189
203
|
productIds: [availability.productId],
|
|
@@ -194,8 +208,7 @@ const refreshAvailabilityTimes = function() {
|
|
|
194
208
|
partySize: require_index$1.resolveSelectionFlowQueryPartySize(context.draft, availability.partySize)
|
|
195
209
|
}, requestedDuration ? require_objectSpread2._objectSpread2({ durationMinutesByProductId: { [String(availability.productId)]: requestedDuration } }, requestedStartTime ? { durationStartTimesByProductId: { [String(availability.productId)]: [requestedStartTime] } } : {}) : {}))).find((item) => String(item.productId) === String(availability.productId));
|
|
196
210
|
const candidates = (group === null || group === void 0 ? void 0 : group.ranges) || [];
|
|
197
|
-
|
|
198
|
-
if (posDurationAvailability && selectionIntent === "restore" && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && candidates.length === 0) {
|
|
211
|
+
if (posDurationAvailability && effectiveSelectionIntent === "restore" && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && candidates.length === 0) {
|
|
199
212
|
var _context$hostContext, _moduleOptions$slice, _context$draft$bookin2, _normalizeDurationMin3;
|
|
200
213
|
const moduleOptions = require_index$1.getModuleOptions(module);
|
|
201
214
|
const configuredSlice = (_context$hostContext = context.hostContext) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.bookingConfig) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.config) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.basic) === null || _context$hostContext === void 0 ? void 0 : _context$hostContext.service_time;
|
|
@@ -236,7 +249,8 @@ const refreshAvailabilityTimes = function() {
|
|
|
236
249
|
timeSlots: [],
|
|
237
250
|
selectedCandidate: void 0,
|
|
238
251
|
slotStepMinutes: group === null || group === void 0 ? void 0 : group.slotStepMinutes,
|
|
239
|
-
posCustomTimeHydrationKey
|
|
252
|
+
posCustomTimeHydrationKey,
|
|
253
|
+
posCustomTimeSelectionIntent: effectiveSelectionIntent === "restore" ? void 0 : effectiveSelectionIntent
|
|
240
254
|
});
|
|
241
255
|
return;
|
|
242
256
|
}
|
|
@@ -252,8 +266,8 @@ const refreshAvailabilityTimes = function() {
|
|
|
252
266
|
const existingCandidate = context.draft.booking.selectedCandidate;
|
|
253
267
|
const draftStartTime = normalizeStartTimeValue(context.draft.booking.startTime);
|
|
254
268
|
const draftEndTime = normalizeStartTimeValue(context.draft.booking.endTime);
|
|
255
|
-
const requestedPosStartTime = requestedStartTime || draftStartTime;
|
|
256
|
-
const requestedPosDuration = (_ref4 = requestedDuration !== null && requestedDuration !== void 0 ? requestedDuration : normalizeDurationMinutesValue(context.draft.booking.duration)) !== null && _ref4 !== void 0 ? _ref4 : getDraftRangeDurationMinutes(context);
|
|
269
|
+
const requestedPosStartTime = suppressFlexiblePresetOverride ? requestedStartTime : requestedStartTime || draftStartTime;
|
|
270
|
+
const requestedPosDuration = suppressFlexiblePresetOverride ? requestedDuration : (_ref4 = requestedDuration !== null && requestedDuration !== void 0 ? requestedDuration : normalizeDurationMinutesValue(context.draft.booking.duration)) !== null && _ref4 !== void 0 ? _ref4 : getDraftRangeDurationMinutes(context);
|
|
257
271
|
const restoredDraftCandidate = draftStartTime ? times.find((candidate) => isAvailabilityCandidateSelectable(candidate, allowUnavailable) && (posSessionAvailability ? require_posCustomTime.isSameAvailabilityCandidateRange(candidate, {
|
|
258
272
|
date: selectedDate,
|
|
259
273
|
startTime: draftStartTime,
|
|
@@ -269,8 +283,8 @@ const refreshAvailabilityTimes = function() {
|
|
|
269
283
|
startTime: requestedPosStartTime,
|
|
270
284
|
durationMinutes: requestedPosDuration
|
|
271
285
|
}) : isSameCandidateStart(candidate, selectedDate, requestedPosStartTime)) : void 0;
|
|
272
|
-
const customSelectionIntent = posCustomTimeAvailability &&
|
|
273
|
-
const fallbackSelectionIntent = posCustomTimeAvailability &&
|
|
286
|
+
const customSelectionIntent = posCustomTimeAvailability && effectiveSelectionIntent === "custom";
|
|
287
|
+
const fallbackSelectionIntent = posCustomTimeAvailability && effectiveSelectionIntent === "fallback";
|
|
274
288
|
const requestedCustomRange = requestedPosStartTime && requestedPosDuration ? {
|
|
275
289
|
date: selectedDate,
|
|
276
290
|
startTime: requestedPosStartTime,
|
|
@@ -311,7 +325,8 @@ const refreshAvailabilityTimes = function() {
|
|
|
311
325
|
candidate
|
|
312
326
|
})),
|
|
313
327
|
selectedCandidate: initialCandidate,
|
|
314
|
-
posCustomTimeHydrationKey
|
|
328
|
+
posCustomTimeHydrationKey,
|
|
329
|
+
posCustomTimeSelectionIntent: effectiveSelectionIntent === "restore" ? void 0 : effectiveSelectionIntent
|
|
315
330
|
});
|
|
316
331
|
const shouldWriteInitialCandidate = Boolean(initialCandidate) && (posCustomTimeAvailability || !existingCandidate || initialCandidate.key !== existingCandidate.key);
|
|
317
332
|
if (initialCandidate && shouldWriteInitialCandidate) {
|
|
@@ -2,6 +2,12 @@ const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
|
|
|
2
2
|
let dayjs = require("dayjs");
|
|
3
3
|
dayjs = require_runtime.__toESM(dayjs);
|
|
4
4
|
//#region src/pro/skuDetailModal/flow/modules/time/posCustomTime.ts
|
|
5
|
+
const resolvePosFlexibleDurationRequestIntent = (params) => {
|
|
6
|
+
if (params.selectionIntent !== "restore") return params.selectionIntent;
|
|
7
|
+
if (params.hydrationKey && params.hydrationKey === params.previousHydrationKey && params.previousSelectionIntent) return params.previousSelectionIntent;
|
|
8
|
+
return "restore";
|
|
9
|
+
};
|
|
10
|
+
const shouldApplyPosFlexibleDurationOverride = (params) => params.isEditMode || params.selectionIntent !== "restore";
|
|
5
11
|
const isFlexibleDurationValue = (value) => {
|
|
6
12
|
if (typeof value === "string") {
|
|
7
13
|
const text = value.trim().toLowerCase();
|
|
@@ -83,5 +89,7 @@ exports.resolvePosCustomTimeCandidate = resolvePosCustomTimeCandidate;
|
|
|
83
89
|
exports.resolvePosCustomTimeDefaultDurationMinutes = resolvePosCustomTimeDefaultDurationMinutes;
|
|
84
90
|
exports.resolvePosCustomTimeDefaultStartTime = resolvePosCustomTimeDefaultStartTime;
|
|
85
91
|
exports.resolvePosFlexibleDurationInitialCandidate = resolvePosFlexibleDurationInitialCandidate;
|
|
92
|
+
exports.resolvePosFlexibleDurationRequestIntent = resolvePosFlexibleDurationRequestIntent;
|
|
93
|
+
exports.shouldApplyPosFlexibleDurationOverride = shouldApplyPosFlexibleDurationOverride;
|
|
86
94
|
exports.shouldResetPosFlexibleTimeForDate = shouldResetPosFlexibleTimeForDate;
|
|
87
95
|
exports.shouldShowPosCustomTimeCandidateCards = shouldShowPosCustomTimeCandidateCards;
|
|
@@ -163,6 +163,14 @@ interface SelectionFlowAvailabilityService {
|
|
|
163
163
|
contextId: string;
|
|
164
164
|
productId: number | string;
|
|
165
165
|
partySize: number;
|
|
166
|
+
/**
|
|
167
|
+
* 日历浏览超出当前投影时,按新的可视日期窗口准备一个 Availability context。
|
|
168
|
+
* Host 负责复用已覆盖该范围的 context,并保留仍可能被当前选择引用的旧 context。
|
|
169
|
+
*/
|
|
170
|
+
ensureDateRange?: (dateRange: {
|
|
171
|
+
startDate: string;
|
|
172
|
+
endDate: string;
|
|
173
|
+
}) => Promise<void>;
|
|
166
174
|
getProductTimeRanges: (contextId: string, request: Record<string, unknown>) => Promise<Array<{
|
|
167
175
|
productId: number | string;
|
|
168
176
|
title?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.662",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"react-zoom-pan-pinch": "^3.7.0",
|
|
70
70
|
"styled-components": "^6.0.0-rc.3",
|
|
71
71
|
"use-sync-external-store": "^1.6.0",
|
|
72
|
-
"@pisell/pi-payment-sdk": "0.0.3",
|
|
73
|
-
"@pisell/materials": "6.11.256",
|
|
74
72
|
"@pisell/utils": "3.0.4",
|
|
73
|
+
"@pisell/date-picker": "3.0.10",
|
|
74
|
+
"@pisell/materials": "6.11.256",
|
|
75
75
|
"@pisell/icon": "0.0.11",
|
|
76
|
-
"@pisell/
|
|
76
|
+
"@pisell/pi-payment-sdk": "0.0.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18.0.0",
|