@pisell/private-materials 6.12.197 → 6.12.198
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/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
- package/es/components/bigSale/components/TimeBar/index.js +1 -0
- package/es/components/bigSale/dialog.js +1 -0
- package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
- package/es/components/bigSale/hooks/useSyncBigSaleCartToCds.js +46 -17
- package/es/components/bigSale/index.js +1 -0
- package/es/components/bigSale/templates/Kiosk/index.js +1 -0
- 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/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
- package/es/index.js +2 -0
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/data/reservationDataUtils.js +2 -8
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/pisellReservation/index.js +17 -0
- package/es/plus/pisellSaleSummaryDetail/index.js +2 -1
- package/es/plus/saleDetail/Base.js +1 -0
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +7 -3
- package/es/plus/saleDetail/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/components/Pay/index.js +2 -1
- package/es/plus/saleDetail/tmpl/B/index.js +1 -0
- package/es/plus/saleDetail/utils/paymentStatus.js +15 -0
- package/es/plus/salesSdk/index.js +52 -0
- package/es/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +105 -45
- package/es/plus/salesSdk/normalProductDetail/availabilityContextRouting.js +29 -0
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +2 -1
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- 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 +36 -17
- package/es/pro/skuDetailModal/flow/modules/time/posCustomTime.js +10 -24
- package/es/pro/skuDetailModal/flow/posAutoResolution.js +3 -1
- package/es/pro/skuDetailModal/flow/registry.d.ts +2 -2
- package/es/pro/skuDetailModal/flow/types.d.ts +8 -0
- package/es/pro/skuDetailModal/index.js +50 -12
- package/lib/components/bigSale/hooks/useSyncBigSaleCartToCds.js +46 -17
- 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/pisellReservation/data/reservationDataUtils.js +2 -8
- package/lib/plus/pisellSaleSummaryDetail/index.js +2 -1
- package/lib/plus/saleDetail/components/SummaryFinancialSections/index.js +6 -3
- package/lib/plus/saleDetail/tmpl/B/components/Pay/index.js +2 -1
- package/lib/plus/saleDetail/utils/paymentStatus.js +15 -0
- package/lib/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +105 -45
- 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 +39 -20
- package/lib/pro/skuDetailModal/flow/modules/time/posCustomTime.js +11 -24
- package/lib/pro/skuDetailModal/flow/posAutoResolution.js +4 -0
- package/lib/pro/skuDetailModal/flow/registry.d.ts +2 -2
- package/lib/pro/skuDetailModal/flow/types.d.ts +8 -0
- package/lib/pro/skuDetailModal/index.js +49 -11
- package/package.json +2 -2
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
|
@@ -15,7 +15,7 @@ require("./index.less");
|
|
|
15
15
|
//#region src/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.tsx
|
|
16
16
|
dayjs.default.extend(dayjs_plugin_isSameOrBefore.default);
|
|
17
17
|
const CalendarDate = (props, ref) => {
|
|
18
|
-
const { cutTime, getLimitData, dateLimitData, loading, disableCallToBook = false, enforceAvailabilitySelection = false, ignoreAvailabilityDisabled = false, availabilityRange, minSelectableDate, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), closeOnSelect = false } = props;
|
|
18
|
+
const { cutTime, getLimitData, dateLimitData, loading, disableCallToBook = false, enforceAvailabilitySelection = false, ignoreAvailabilityDisabled = false, availabilityRange, minSelectableDate, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), closeOnSelect = false, onVisibleDateRangeChange } = props;
|
|
19
19
|
const [productId, setProductId] = (0, react.useState)("");
|
|
20
20
|
const [currentDate, setCurrentDate] = (0, react.useState)("");
|
|
21
21
|
const [dateMonthList, setDateMonthList] = (0, react.useState)([]);
|
|
@@ -79,6 +79,10 @@ const CalendarDate = (props, ref) => {
|
|
|
79
79
|
let newLastMonth = (0, dayjs.default)(currentMonth.format("YYYY-MM")).subtract(1, "month");
|
|
80
80
|
setCurrentMonth(newLastMonth);
|
|
81
81
|
setDateMonthList(getMonthData(newLastMonth.format("YYYY-MM")));
|
|
82
|
+
onVisibleDateRangeChange === null || onVisibleDateRangeChange === void 0 || onVisibleDateRangeChange({
|
|
83
|
+
startDate: newLastMonth.startOf("month").format("YYYY-MM-DD"),
|
|
84
|
+
endDate: newLastMonth.endOf("month").format("YYYY-MM-DD")
|
|
85
|
+
});
|
|
82
86
|
};
|
|
83
87
|
/**
|
|
84
88
|
* @title: 切换下个月
|
|
@@ -92,6 +96,10 @@ const CalendarDate = (props, ref) => {
|
|
|
92
96
|
let newNextMonth = (0, dayjs.default)(currentMonth.format("YYYY-MM")).add(1, "month");
|
|
93
97
|
setCurrentMonth(newNextMonth);
|
|
94
98
|
setDateMonthList(getMonthData(newNextMonth.format("YYYY-MM")));
|
|
99
|
+
onVisibleDateRangeChange === null || onVisibleDateRangeChange === void 0 || onVisibleDateRangeChange({
|
|
100
|
+
startDate: newNextMonth.startOf("month").format("YYYY-MM-DD"),
|
|
101
|
+
endDate: newNextMonth.endOf("month").format("YYYY-MM-DD")
|
|
102
|
+
});
|
|
95
103
|
};
|
|
96
104
|
/**
|
|
97
105
|
* @title: 根据当前选择的月份剩余量
|
|
@@ -16,7 +16,7 @@ let classnames = require("classnames");
|
|
|
16
16
|
classnames = require_runtime.__toESM(classnames);
|
|
17
17
|
require("./index.less");
|
|
18
18
|
//#region src/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.tsx
|
|
19
|
-
const SelectDate = ({ currentDate, detail, currentDateChange, setSurplusDisabledChange, cutTime, setCutTime, showCalendarPopup, showStatusLegend = true, showDateStatusBar = true, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), showHeader = true, showDisabledStatus = true, ignoreAvailabilityDisabled = false, minSelectableDate, minViewDate, enableRangeSelection = false, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader = false, enableWeekSwipe = false, weekNavigationVariant = "default", closeCalendarOnSelect = false, availabilityDates }, ref) => {
|
|
19
|
+
const SelectDate = ({ currentDate, detail, currentDateChange, onVisibleDateRangeChange, setSurplusDisabledChange, cutTime, setCutTime, showCalendarPopup, showStatusLegend = true, showDateStatusBar = true, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), showHeader = true, showDisabledStatus = true, ignoreAvailabilityDisabled = false, minSelectableDate, minViewDate, enableRangeSelection = false, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader = false, enableWeekSwipe = false, weekNavigationVariant = "default", closeCalendarOnSelect = false, availabilityDates }, ref) => {
|
|
20
20
|
const [dateLimitData, setDateLimitData] = (0, react.useState)(require_mock.mock.availability_calendar.limitData);
|
|
21
21
|
/**
|
|
22
22
|
* UBS 日期结果只负责状态展示,不伪造旧事件预约的 times/库存结构。
|
|
@@ -80,6 +80,7 @@ const SelectDate = ({ currentDate, detail, currentDateChange, setSurplusDisabled
|
|
|
80
80
|
productId: detail === null || detail === void 0 ? void 0 : detail.id,
|
|
81
81
|
cutTime,
|
|
82
82
|
dateLimitData: resolvedDateLimitData,
|
|
83
|
+
onVisibleDateRangeChange,
|
|
83
84
|
showStatusBar: showDateStatusBar,
|
|
84
85
|
showDisabledStatus,
|
|
85
86
|
ignoreAvailabilityDisabled,
|
|
@@ -101,6 +102,7 @@ const SelectDate = ({ currentDate, detail, currentDateChange, setSurplusDisabled
|
|
|
101
102
|
},
|
|
102
103
|
cutTime,
|
|
103
104
|
dateLimitData: resolvedDateLimitData,
|
|
105
|
+
onVisibleDateRangeChange,
|
|
104
106
|
disableCallToBook: usesExternalAvailability,
|
|
105
107
|
enforceAvailabilitySelection: usesExternalAvailability,
|
|
106
108
|
ignoreAvailabilityDisabled,
|
|
@@ -25,6 +25,11 @@ interface BookingAvailabilityCalendarProps {
|
|
|
25
25
|
currentDate?: string;
|
|
26
26
|
cutTime?: any;
|
|
27
27
|
onCurrentDateChange?: (date: string) => void;
|
|
28
|
+
/** 周历或月历切换后,通知外层当前可视日期范围。 */
|
|
29
|
+
onVisibleDateRangeChange?: (range: {
|
|
30
|
+
startDate: string;
|
|
31
|
+
endDate: string;
|
|
32
|
+
}) => void;
|
|
28
33
|
onCutTimeChange?: (date: string) => void;
|
|
29
34
|
onSurplusDisabledChange?: (date: boolean) => void;
|
|
30
35
|
showStatusLegend?: boolean;
|
|
@@ -21,7 +21,7 @@ const BookingAvailabilityCalendar = (0, react.forwardRef)((props, ref) => {
|
|
|
21
21
|
* 日历挂载后日期图例、Add Note、Cancel 等文案又闪回英文。
|
|
22
22
|
*/
|
|
23
23
|
_pisell_utils.locales.init(require_locales.default, _pisell_utils.locales.getLocale() || "en");
|
|
24
|
-
const { showCalendarPopup, onDateChange, detail = (_mock$availability_ca = require_mock.mock.availability_calendar) === null || _mock$availability_ca === void 0 ? void 0 : _mock$availability_ca.detail, currentDate = (_mock$availability_ca2 = require_mock.mock.availability_calendar) === null || _mock$availability_ca2 === void 0 ? void 0 : _mock$availability_ca2.currentDate, cutTime = (_mock$availability_ca3 = require_mock.mock.availability_calendar) === null || _mock$availability_ca3 === void 0 ? void 0 : _mock$availability_ca3.cutTime, onCurrentDateChange, onCutTimeChange, onSurplusDisabledChange, showStatusLegend = true, showDateStatusBar = true, theme = "light", className, title, showHeader, showDisabledStatus, ignoreAvailabilityDisabled, minSelectableDate, minViewDate, enableRangeSelection, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader, enableWeekSwipe, weekNavigationVariant, closeCalendarOnSelect, availabilityDates } = props;
|
|
24
|
+
const { showCalendarPopup, onDateChange, detail = (_mock$availability_ca = require_mock.mock.availability_calendar) === null || _mock$availability_ca === void 0 ? void 0 : _mock$availability_ca.detail, currentDate = (_mock$availability_ca2 = require_mock.mock.availability_calendar) === null || _mock$availability_ca2 === void 0 ? void 0 : _mock$availability_ca2.currentDate, cutTime = (_mock$availability_ca3 = require_mock.mock.availability_calendar) === null || _mock$availability_ca3 === void 0 ? void 0 : _mock$availability_ca3.cutTime, onCurrentDateChange, onVisibleDateRangeChange, onCutTimeChange, onSurplusDisabledChange, showStatusLegend = true, showDateStatusBar = true, theme = "light", className, title, showHeader, showDisabledStatus, ignoreAvailabilityDisabled, minSelectableDate, minViewDate, enableRangeSelection, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader, enableWeekSwipe, weekNavigationVariant, closeCalendarOnSelect, availabilityDates } = props;
|
|
25
25
|
const selectDateRef = (0, react.useRef)(null);
|
|
26
26
|
(0, react.useImperativeHandle)(ref, () => ({ openCalendarPopup: () => {
|
|
27
27
|
var _selectDateRef$curren;
|
|
@@ -37,6 +37,7 @@ const BookingAvailabilityCalendar = (0, react.forwardRef)((props, ref) => {
|
|
|
37
37
|
onCurrentDateChange(date);
|
|
38
38
|
if (currentDate !== date) onDateChange(date);
|
|
39
39
|
},
|
|
40
|
+
onVisibleDateRangeChange,
|
|
40
41
|
setSurplusDisabledChange: onSurplusDisabledChange,
|
|
41
42
|
cutTime,
|
|
42
43
|
setCutTime: onCutTimeChange,
|
|
@@ -80,17 +80,11 @@ function stripCalendarOnlyFlags(prev) {
|
|
|
80
80
|
delete nextValues.enable_remote_memory_cache;
|
|
81
81
|
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prev), {}, { filter: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prevFilter), {}, { values: nextValues }) });
|
|
82
82
|
}
|
|
83
|
-
/**
|
|
84
|
-
* 日历导航:按视口自然日范围扩展 `booking_time_start_between`。
|
|
85
|
-
*
|
|
86
|
-
* 后端只支持 start_time 过滤;为了让"开始早于视口、结束仍落在视口内"的跨日 booking 也被拉到,
|
|
87
|
-
* 这里把下界往前再外推 {@link RESERVATION_CALENDAR_VIEWPORT_LOOKBACK_DAYS} 天,
|
|
88
|
-
* 由前端 `getBookingSegmentForDate` / `clipBookingDaySpanToWindow` 在视图层做相交渲染。
|
|
89
|
-
*/
|
|
83
|
+
/** 日历导航:按当前视口自然日范围更新 `booking_time_start_between`。 */
|
|
90
84
|
function mergeSearchParamsBookingRange(prev, rangeStart, rangeEnd, operatingDayBoundary) {
|
|
91
85
|
const prevFilter = typeof prev.filter === "object" && prev.filter ? prev.filter : {};
|
|
92
86
|
const prevValues = typeof prevFilter.values === "object" && prevFilter.values ? prevFilter.values : {};
|
|
93
|
-
const window = require_usePisellReservationBookingData.bookingTimeWindowForCalendarRequest(
|
|
87
|
+
const window = require_usePisellReservationBookingData.bookingTimeWindowForCalendarRequest(rangeStart, rangeEnd, operatingDayBoundary);
|
|
94
88
|
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prev), {}, { filter: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prevFilter), {}, { values: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prevValues), {}, { booking_time_start_between: window }) }) });
|
|
95
89
|
}
|
|
96
90
|
/**
|
|
@@ -3,6 +3,7 @@ const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.12
|
|
|
3
3
|
const require_useEngineContext = require("../../hooks/useEngineContext.js");
|
|
4
4
|
const require_useInitLocalesOnce = require("../../hooks/useInitLocalesOnce.js");
|
|
5
5
|
const require_usePaymentMethodNameMap = require("../pisellSalesManagement/hooks/usePaymentMethodNameMap.js");
|
|
6
|
+
const require_paymentStatus = require("../saleDetail/utils/paymentStatus.js");
|
|
6
7
|
const require_locales = require("./locales.js");
|
|
7
8
|
let react = require("react");
|
|
8
9
|
react = require_runtime.__toESM(react);
|
|
@@ -183,7 +184,7 @@ function getPaidExclPaymentSurchargeLabel(paymentSurchargeText) {
|
|
|
183
184
|
return `${_pisell_utils.locales.getText("pisell2.sale-detail.pay.paid")} (${paymentSurchargeText})`;
|
|
184
185
|
}
|
|
185
186
|
function buildPaymentRows(payments, paymentMethodNameMap, symbol, options) {
|
|
186
|
-
return payments.filter((payment) => !isVoucherPaymentRecord(payment)).map((payment, index) => {
|
|
187
|
+
return payments.filter(require_paymentStatus.isAppliedPaymentRecord).filter((payment) => !isVoucherPaymentRecord(payment)).map((payment, index) => {
|
|
187
188
|
var _firstDefined;
|
|
188
189
|
const amount = getPaymentAmount(payment);
|
|
189
190
|
const isRefund = isRefundPaymentRecord(payment);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_useEngineContext = require("../../../../hooks/useEngineContext.js");
|
|
3
3
|
const require_usePaymentMethodNameMap = require("../../../pisellSalesManagement/hooks/usePaymentMethodNameMap.js");
|
|
4
|
+
const require_paymentStatus = require("../../utils/paymentStatus.js");
|
|
4
5
|
const require_useSalesSdk = require("../../../salesSdk/hooks/useSalesSdk.js");
|
|
5
6
|
const require_useSalesSdkCart = require("../../../salesSdk/hooks/useSalesSdkCart.js");
|
|
6
7
|
const require_useSalesSdkSummary = require("../../../salesSdk/hooks/useSalesSdkSummary.js");
|
|
@@ -145,8 +146,9 @@ const PaymentDetailsContent = (0, react.memo)(function PaymentDetailsContent({ s
|
|
|
145
146
|
const currentLocale = _pisell_utils.locales.getLocale();
|
|
146
147
|
const paymentMethodNameMap = require_usePaymentMethodNameMap.usePaymentMethodNameMap();
|
|
147
148
|
const entries = (0, react.useMemo)(() => {
|
|
148
|
-
const
|
|
149
|
-
|
|
149
|
+
const appliedPayments = payments.filter(require_paymentStatus.isAppliedPaymentRecord);
|
|
150
|
+
const nextEntries = appliedPayments.filter((payment) => !isVoucherPaymentRecord(payment)).map((payment, index) => buildPaymentDetailEntry(payment, `payment-${index}`, paymentMethodNameMap));
|
|
151
|
+
if (!appliedPayments.length) {
|
|
150
152
|
if (isNonZeroAmount(summary.order_paid_amount)) nextEntries.push({
|
|
151
153
|
key: "paid-summary",
|
|
152
154
|
title: _pisell_utils.locales.getText("pisell2.sale-detail.pay.payment"),
|
|
@@ -247,7 +249,8 @@ const PaymentDetailsSectionView = (0, react.memo)(function PaymentDetailsSection
|
|
|
247
249
|
const totalRefundAmount = summary === null || summary === void 0 ? void 0 : summary.total_refund_amount;
|
|
248
250
|
if (!(0, react.useMemo)(() => {
|
|
249
251
|
if (!hasSummary) return false;
|
|
250
|
-
|
|
252
|
+
const appliedPayments = payments.filter(require_paymentStatus.isAppliedPaymentRecord);
|
|
253
|
+
return appliedPayments.some((payment) => !isVoucherPaymentRecord(payment)) || !appliedPayments.length && (isNonZeroAmount(orderPaidAmount) || isNonZeroAmount(totalRefundAmount));
|
|
251
254
|
}, [
|
|
252
255
|
hasSummary,
|
|
253
256
|
orderPaidAmount,
|
|
@@ -3,6 +3,7 @@ const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_
|
|
|
3
3
|
const require_asyncToGenerator = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
4
4
|
const require_useEngineContext = require("../../../../../../hooks/useEngineContext.js");
|
|
5
5
|
const require_usePaymentMethodNameMap = require("../../../../../pisellSalesManagement/hooks/usePaymentMethodNameMap.js");
|
|
6
|
+
const require_paymentStatus = require("../../../../utils/paymentStatus.js");
|
|
6
7
|
const require_index = require("../../../../../piPaymentUI/eftpos/contracts/index.js");
|
|
7
8
|
const require_index$1 = require("../../../../../piPaymentUI/contracts/index.js");
|
|
8
9
|
const require_PiPayment = require("../../../../../piPaymentUI/PiPayment.js");
|
|
@@ -712,7 +713,7 @@ function Pay({ context }) {
|
|
|
712
713
|
const tempOrder = context.sales.tempOrder;
|
|
713
714
|
const summary = (_ref14 = (_context$summary$summ2 = context.summary.summary) !== null && _context$summary$summ2 !== void 0 ? _context$summary$summ2 : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.summary) !== null && _ref14 !== void 0 ? _ref14 : null;
|
|
714
715
|
const symbol = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_symbol) || "$";
|
|
715
|
-
const payments = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.payments) ? tempOrder
|
|
716
|
+
const payments = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.payments) ? tempOrder.payments.filter(require_paymentStatus.isAppliedPaymentRecord) : [];
|
|
716
717
|
const overviewItems = [
|
|
717
718
|
{
|
|
718
719
|
key: "total",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/plus/saleDetail/utils/paymentStatus.ts
|
|
2
|
+
const APPLIED_PAYMENT_STATUSES = new Set(["paid"]);
|
|
3
|
+
/**
|
|
4
|
+
* Payment detail amounts must describe money that was actually applied to the
|
|
5
|
+
* order. The persisted order-payment contract uses `paid` for applied money;
|
|
6
|
+
* SDK/session success states and order-level refund states are not equivalent.
|
|
7
|
+
*/
|
|
8
|
+
function isAppliedPaymentRecord(record) {
|
|
9
|
+
var _status;
|
|
10
|
+
if (!record || typeof record !== "object") return false;
|
|
11
|
+
const status = String((_status = record.status) !== null && _status !== void 0 ? _status : "").trim().toLowerCase();
|
|
12
|
+
return APPLIED_PAYMENT_STATUSES.has(status);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.isAppliedPaymentRecord = isAppliedPaymentRecord;
|
|
@@ -21,6 +21,7 @@ const require_transformNormalProductConfirm = require("./transformNormalProductC
|
|
|
21
21
|
const require_resolveBookingCommitCount = require("./resolveBookingCommitCount.js");
|
|
22
22
|
const require_bookingSelectionPrice = require("./bookingSelectionPrice.js");
|
|
23
23
|
const require_buildBookingSelectionCacheItem = require("./buildBookingSelectionCacheItem.js");
|
|
24
|
+
const require_availabilityContextRouting = require("./availabilityContextRouting.js");
|
|
24
25
|
let dayjs = require("dayjs");
|
|
25
26
|
dayjs = require_runtime.__toESM(dayjs);
|
|
26
27
|
let react = require("react");
|
|
@@ -118,11 +119,14 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
118
119
|
tempOrderRef.current = tempOrder;
|
|
119
120
|
const handledDismissRevisionRef = (0, react.useRef)(dismissRevision);
|
|
120
121
|
const availabilityContextIdRef = (0, react.useRef)(null);
|
|
122
|
+
const availabilityContextsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
121
123
|
const releaseAvailabilityContext = (0, ahooks.useMemoizedFn)(() => {
|
|
122
|
-
const
|
|
123
|
-
if (!contextId) return;
|
|
124
|
+
const contextIds = Array.from(availabilityContextsRef.current.keys());
|
|
124
125
|
availabilityContextIdRef.current = null;
|
|
125
|
-
|
|
126
|
+
availabilityContextsRef.current.clear();
|
|
127
|
+
contextIds.forEach((contextId) => {
|
|
128
|
+
salesModule.releaseAvailabilityContext(contextId);
|
|
129
|
+
});
|
|
126
130
|
});
|
|
127
131
|
const commitAvailabilitySelection = (0, ahooks.useMemoizedFn)(function() {
|
|
128
132
|
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (orderProduct, selection, commit) {
|
|
@@ -217,7 +221,7 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
217
221
|
activePendingRef.current = null;
|
|
218
222
|
};
|
|
219
223
|
(function() {
|
|
220
|
-
var
|
|
224
|
+
var _ref19 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
221
225
|
var _bookingTicket$getBoo3, _bookingTicket$getBoo4;
|
|
222
226
|
const payload = capturedPending.payload;
|
|
223
227
|
const deferHolderUntilSubmit = payload.mode === "create" ? payload.requiresDetailPayload.deferHolderUntilSubmit === true : payload.mode === "booking-create" ? payload.requiresBookingEditPayload.deferHolderUntilSubmit === true : false;
|
|
@@ -253,12 +257,25 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
253
257
|
const prepareAvailability = (productId, date, editingProductLineUids) => {
|
|
254
258
|
const numericProductId = Number(productId);
|
|
255
259
|
if (!Number.isFinite(numericProductId)) throw new Error("预约商品缺少有效 product id。");
|
|
260
|
+
const initialScheduleDate = (0, dayjs.default)(date).format("YYYY-MM-DD");
|
|
261
|
+
const initialDateRange = {
|
|
262
|
+
startDate: initialScheduleDate,
|
|
263
|
+
endDate: (0, dayjs.default)(initialScheduleDate).add(31, "day").format("YYYY-MM-DD")
|
|
264
|
+
};
|
|
256
265
|
let availabilityReady;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
266
|
+
let dateAvailabilityContextId = null;
|
|
267
|
+
let latestDateRangeRequestId = 0;
|
|
268
|
+
const dateRangePrepareTasks = /* @__PURE__ */ new Map();
|
|
269
|
+
const getRegisteredContexts = () => Array.from(availabilityContextsRef.current.values());
|
|
270
|
+
const prepareDateRange = (dateRange) => {
|
|
271
|
+
const coveringContext = [...getRegisteredContexts()].reverse().find((item) => require_availabilityContextRouting.availabilityDateRangeContains(item.dateRange, dateRange));
|
|
272
|
+
if (coveringContext) return Promise.resolve(coveringContext.contextId);
|
|
273
|
+
const rangeKey = `${dateRange.startDate}:${dateRange.endDate}`;
|
|
274
|
+
const pendingRange = dateRangePrepareTasks.get(rangeKey);
|
|
275
|
+
if (pendingRange) return pendingRange;
|
|
276
|
+
const task = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
260
277
|
var _getProductCatalog;
|
|
261
|
-
const scheduleDate =
|
|
278
|
+
const scheduleDate = dateRange.startDate;
|
|
262
279
|
const availabilityProduct = yield salesModule.queryProductDetail({
|
|
263
280
|
product_id: numericProductId,
|
|
264
281
|
schedule_date: scheduleDate,
|
|
@@ -272,35 +289,78 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
272
289
|
catalogWithAvailabilityProduct.push(availabilityProduct);
|
|
273
290
|
const prepared = yield salesModule.prepareAvailabilityProjection(require_objectSpread2._objectSpread2({
|
|
274
291
|
productIds: [numericProductId],
|
|
292
|
+
dateRange,
|
|
275
293
|
rawProducts: catalogWithAvailabilityProduct
|
|
276
294
|
}, (editingProductLineUids === null || editingProductLineUids === void 0 ? void 0 : editingProductLineUids.length) ? { editingProductLineUids } : {}));
|
|
277
295
|
if (!isCurrentPending()) {
|
|
278
296
|
salesModule.releaseAvailabilityContext(prepared.contextId);
|
|
279
297
|
throw new Error("预约商品选择已取消。");
|
|
280
298
|
}
|
|
281
|
-
|
|
299
|
+
availabilityContextsRef.current.set(prepared.contextId, {
|
|
300
|
+
contextId: prepared.contextId,
|
|
301
|
+
dateRange
|
|
302
|
+
});
|
|
282
303
|
return prepared.contextId;
|
|
283
304
|
})();
|
|
305
|
+
dateRangePrepareTasks.set(rangeKey, task);
|
|
306
|
+
task.finally(() => {
|
|
307
|
+
if (dateRangePrepareTasks.get(rangeKey) === task) dateRangePrepareTasks.delete(rangeKey);
|
|
308
|
+
}).catch(() => void 0);
|
|
309
|
+
return task;
|
|
310
|
+
};
|
|
311
|
+
const getAvailabilityReady = () => {
|
|
312
|
+
if (availabilityReady) return availabilityReady;
|
|
313
|
+
availabilityReady = prepareDateRange(initialDateRange).then((contextId) => {
|
|
314
|
+
dateAvailabilityContextId = contextId;
|
|
315
|
+
availabilityContextIdRef.current = contextId;
|
|
316
|
+
return contextId;
|
|
317
|
+
});
|
|
284
318
|
availabilityReady.catch((error) => {
|
|
285
319
|
if (isCurrentPending()) console.warn("[SalesSdk] Availability context 初始化失败", error);
|
|
286
320
|
});
|
|
287
321
|
return availabilityReady;
|
|
288
322
|
};
|
|
323
|
+
const ensureDateRange = function() {
|
|
324
|
+
var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (dateRange) {
|
|
325
|
+
yield getAvailabilityReady();
|
|
326
|
+
const requestId = ++latestDateRangeRequestId;
|
|
327
|
+
const contextId = yield prepareDateRange(dateRange);
|
|
328
|
+
if (!isCurrentPending()) throw new Error("预约商品选择已取消。");
|
|
329
|
+
if (requestId === latestDateRangeRequestId) dateAvailabilityContextId = contextId;
|
|
330
|
+
});
|
|
331
|
+
return function ensureDateRange(_x6) {
|
|
332
|
+
return _ref4.apply(this, arguments);
|
|
333
|
+
};
|
|
334
|
+
}();
|
|
335
|
+
const resolveContextId = function() {
|
|
336
|
+
var _ref5 = require_asyncToGenerator._asyncToGenerator(function* (request, target) {
|
|
337
|
+
const initialContextId = yield getAvailabilityReady();
|
|
338
|
+
if (target === "date") return dateAvailabilityContextId || initialContextId;
|
|
339
|
+
const contextId = require_availabilityContextRouting.resolveAvailabilityRequestContextId(getRegisteredContexts(), request, dateAvailabilityContextId || initialContextId) || initialContextId;
|
|
340
|
+
availabilityContextIdRef.current = contextId;
|
|
341
|
+
return contextId;
|
|
342
|
+
});
|
|
343
|
+
return function resolveContextId(_x7, _x8) {
|
|
344
|
+
return _ref5.apply(this, arguments);
|
|
345
|
+
};
|
|
346
|
+
}();
|
|
289
347
|
let availabilityQuerySequence = 0;
|
|
290
348
|
selectionFlowServices = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, selectionFlowServices), {}, { availability: {
|
|
291
349
|
contextId: `pending:${numericProductId}`,
|
|
292
350
|
productId,
|
|
293
351
|
partySize: 1,
|
|
352
|
+
ensureDateRange,
|
|
294
353
|
getProductTimeRanges: function() {
|
|
295
|
-
var
|
|
296
|
-
|
|
354
|
+
var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (_contextId, request) {
|
|
355
|
+
const contextId = yield resolveContextId(request);
|
|
356
|
+
return salesModule.getProductTimeRanges(contextId, request);
|
|
297
357
|
});
|
|
298
|
-
return function getProductTimeRanges(
|
|
299
|
-
return
|
|
358
|
+
return function getProductTimeRanges(_x9, _x10) {
|
|
359
|
+
return _ref6.apply(this, arguments);
|
|
300
360
|
};
|
|
301
361
|
}(),
|
|
302
362
|
queryBookingAvailability: function() {
|
|
303
|
-
var
|
|
363
|
+
var _ref7 = require_asyncToGenerator._asyncToGenerator(function* (_contextId, request) {
|
|
304
364
|
availabilityQuerySequence += 1;
|
|
305
365
|
const callId = `${numericProductId}-${availabilityQuerySequence}`;
|
|
306
366
|
console.info("[SelectionFlowAvailability][queryBookingAvailability][input]", {
|
|
@@ -309,7 +369,7 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
309
369
|
request
|
|
310
370
|
});
|
|
311
371
|
try {
|
|
312
|
-
const contextId = yield
|
|
372
|
+
const contextId = yield resolveContextId(request, request.target);
|
|
313
373
|
const result = yield salesModule.queryBookingAvailability(contextId, request);
|
|
314
374
|
console.info("[SelectionFlowAvailability][queryBookingAvailability][output]", {
|
|
315
375
|
callId,
|
|
@@ -328,14 +388,14 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
328
388
|
throw error;
|
|
329
389
|
}
|
|
330
390
|
});
|
|
331
|
-
return function queryBookingAvailability(
|
|
332
|
-
return
|
|
391
|
+
return function queryBookingAvailability(_x11, _x12) {
|
|
392
|
+
return _ref7.apply(this, arguments);
|
|
333
393
|
};
|
|
334
394
|
}()
|
|
335
395
|
} });
|
|
336
396
|
};
|
|
337
397
|
const refreshHolderContextFromHydratedProduct = function() {
|
|
338
|
-
var
|
|
398
|
+
var _ref8 = require_asyncToGenerator._asyncToGenerator(function* ({ productData }) {
|
|
339
399
|
holderSource = productData;
|
|
340
400
|
if (deferHolderUntilSubmit) holderOptions = getHolderOptionsForSource(productData);
|
|
341
401
|
else try {
|
|
@@ -365,14 +425,14 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
365
425
|
holderSource: productData
|
|
366
426
|
});
|
|
367
427
|
});
|
|
368
|
-
return function refreshHolderContextFromHydratedProduct(
|
|
369
|
-
return
|
|
428
|
+
return function refreshHolderContextFromHydratedProduct(_x13) {
|
|
429
|
+
return _ref8.apply(this, arguments);
|
|
370
430
|
};
|
|
371
431
|
}();
|
|
372
432
|
if (payload.mode === "create") {
|
|
373
|
-
var
|
|
433
|
+
var _ref9, _detailPayload$produc;
|
|
374
434
|
const detailPayload = payload.requiresDetailPayload;
|
|
375
|
-
const item = require_resolveCatalogProductId.normalizeCatalogProduct((
|
|
435
|
+
const item = require_resolveCatalogProductId.normalizeCatalogProduct((_ref9 = (_detailPayload$produc = detailPayload.productData) !== null && _detailPayload$produc !== void 0 ? _detailPayload$produc : detailPayload.item) !== null && _ref9 !== void 0 ? _ref9 : {});
|
|
376
436
|
const detailProductData = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { is_eject: detailPayload.isEject });
|
|
377
437
|
const productId = require_resolveCatalogProductId.resolveCatalogProductId(item);
|
|
378
438
|
const rawDate = detailPayload.date;
|
|
@@ -384,26 +444,26 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
384
444
|
const liveTempOrder = (_bookingTicket$getTem = bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getTem2 = bookingTicket.getTempOrder) === null || _bookingTicket$getTem2 === void 0 ? void 0 : _bookingTicket$getTem2.call(bookingTicket)) !== null && _bookingTicket$getTem !== void 0 ? _bookingTicket$getTem : tempOrderRef.current;
|
|
385
445
|
if (usesUnifiedBookingSales) {
|
|
386
446
|
if (!bookingConfig && typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.initBookingContext) === "function") {
|
|
387
|
-
var
|
|
447
|
+
var _ref10, _result$bookingConfig, _bookingTicket$getBoo5;
|
|
388
448
|
const bookingIds = require_buildDefaultLoadProductsParams.collectBookingIdsFromTempOrder(liveTempOrder);
|
|
389
449
|
const result = yield bookingTicket.initBookingContext(require_buildDefaultLoadProductsParams.buildInitBookingContextParams(bookingConfigParams, {
|
|
390
450
|
date: (0, dayjs.default)(date),
|
|
391
451
|
bookingIds: bookingIds.length ? bookingIds : void 0,
|
|
392
452
|
loadResources: initializeFullBookingContext
|
|
393
453
|
}));
|
|
394
|
-
bookingConfig = (
|
|
454
|
+
bookingConfig = (_ref10 = (_result$bookingConfig = result === null || result === void 0 ? void 0 : result.bookingConfig) !== null && _result$bookingConfig !== void 0 ? _result$bookingConfig : (_bookingTicket$getBoo5 = bookingTicket.getBookingConfig) === null || _bookingTicket$getBoo5 === void 0 ? void 0 : _bookingTicket$getBoo5.call(bookingTicket)) !== null && _ref10 !== void 0 ? _ref10 : null;
|
|
395
455
|
}
|
|
396
456
|
} else if (typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.initBookingContext) !== "function") {
|
|
397
457
|
if (!bookingConfig) throw new Error("当前 SalesSdk 运行时不支持初始化 BookingContext。");
|
|
398
458
|
} else {
|
|
399
|
-
var
|
|
459
|
+
var _ref11, _result$bookingConfig2, _bookingTicket$getBoo6;
|
|
400
460
|
const bookingIds = require_buildDefaultLoadProductsParams.collectBookingIdsFromTempOrder(liveTempOrder);
|
|
401
461
|
const result = yield bookingTicket.initBookingContext(require_buildDefaultLoadProductsParams.buildInitBookingContextParams(bookingConfigParams, {
|
|
402
462
|
date: (0, dayjs.default)(date),
|
|
403
463
|
bookingIds: bookingIds.length ? bookingIds : void 0,
|
|
404
464
|
loadResources: true
|
|
405
465
|
}));
|
|
406
|
-
bookingConfig = (
|
|
466
|
+
bookingConfig = (_ref11 = (_result$bookingConfig2 = result === null || result === void 0 ? void 0 : result.bookingConfig) !== null && _result$bookingConfig2 !== void 0 ? _result$bookingConfig2 : (_bookingTicket$getBoo6 = bookingTicket.getBookingConfig) === null || _bookingTicket$getBoo6 === void 0 ? void 0 : _bookingTicket$getBoo6.call(bookingTicket)) !== null && _ref11 !== void 0 ? _ref11 : null;
|
|
407
467
|
}
|
|
408
468
|
if (!usesUnifiedBookingSales && !bookingConfig) throw new Error("BookingContext 初始化完成后仍缺少 bookingConfig。");
|
|
409
469
|
const customerId = require_buildBookingEditDrawerState.resolveBookingEditCustomerId(liveTempOrder, detailPayload.customerId, bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getOrd2 = bookingTicket.getOrderCustomerSnapshot) === null || _bookingTicket$getOrd2 === void 0 || (_bookingTicket$getOrd2 = _bookingTicket$getOrd2.call(bookingTicket)) === null || _bookingTicket$getOrd2 === void 0 ? void 0 : _bookingTicket$getOrd2.id);
|
|
@@ -455,14 +515,14 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
455
515
|
return true;
|
|
456
516
|
} } : {}), {}, { skuDetailConfig });
|
|
457
517
|
} else if (payload.mode === "booking-create" || payload.mode === "booking-edit") {
|
|
458
|
-
var
|
|
518
|
+
var _ref12, _ref13, _ref14, _ref15, _bookingPayload$date, _bookingPayload$cache, _bookingTicket$getTem3, _bookingTicket$getTem4, _bookingTicket$getOrd3, _ref17, _bookingTicket$getRes3, _bookingTicket$getRes4, _initialCacheItem$_da, _ref18, _bookingPayload$catal, _initialCacheItem$_ex, _bookingTicket$getOth3, _initialCacheItem$_ex2;
|
|
459
519
|
const isBookingEdit = payload.mode === "booking-edit";
|
|
460
520
|
const bookingPayload = isBookingEdit ? payload.bookingEditPayload : payload.requiresBookingEditPayload;
|
|
461
521
|
selectionFlowServices = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, selectionFlowServices), {}, {
|
|
462
522
|
selectionFlowMode: isBookingEdit ? "edit" : "create",
|
|
463
523
|
deferAvailabilityCommit: Boolean(isBookingEdit && bookingPayload.deferCommit)
|
|
464
524
|
});
|
|
465
|
-
const item = require_resolveCatalogProductId.normalizeCatalogProduct((
|
|
525
|
+
const item = require_resolveCatalogProductId.normalizeCatalogProduct((_ref12 = (_ref13 = (_ref14 = (_ref15 = isBookingEdit ? bookingPayload.catalogProduct : null) !== null && _ref15 !== void 0 ? _ref15 : bookingPayload.catalogProduct) !== null && _ref14 !== void 0 ? _ref14 : bookingPayload.sourceProduct) !== null && _ref13 !== void 0 ? _ref13 : bookingPayload.cacheItem) !== null && _ref12 !== void 0 ? _ref12 : {});
|
|
466
526
|
const skuDetailConfig = mergeSkuDetailConfig(item === null || item === void 0 ? void 0 : item.skuDetailConfig, defaultSkuDetailConfig);
|
|
467
527
|
if (!(Array.isArray(skuDetailConfig.steps) || typeof skuDetailConfig.resolveSteps === "function") || require_index.getUnsupportedBookingFlowReason(item) && !require_utils.isMultiDayProduct(item) || !bookingTicket) {
|
|
468
528
|
completeCaptured({ mode: "booking-fallback" });
|
|
@@ -478,13 +538,13 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
478
538
|
const liveTempOrder = (_bookingTicket$getTem3 = (_bookingTicket$getTem4 = bookingTicket.getTempOrder) === null || _bookingTicket$getTem4 === void 0 ? void 0 : _bookingTicket$getTem4.call(bookingTicket)) !== null && _bookingTicket$getTem3 !== void 0 ? _bookingTicket$getTem3 : tempOrderRef.current;
|
|
479
539
|
const bookingIds = require_buildDefaultLoadProductsParams.collectBookingIdsFromTempOrder(liveTempOrder);
|
|
480
540
|
if (typeof bookingTicket.initBookingContext === "function") {
|
|
481
|
-
var
|
|
541
|
+
var _ref16, _result$bookingConfig3, _bookingTicket$getBoo7;
|
|
482
542
|
const result = yield bookingTicket.initBookingContext(require_buildDefaultLoadProductsParams.buildInitBookingContextParams(bookingConfigParams, {
|
|
483
543
|
date: (0, dayjs.default)(date),
|
|
484
544
|
bookingIds: bookingIds.length ? bookingIds : void 0,
|
|
485
545
|
loadResources: !usesUnifiedBookingSales || initializeFullBookingContext
|
|
486
546
|
}));
|
|
487
|
-
bookingConfig = (
|
|
547
|
+
bookingConfig = (_ref16 = (_result$bookingConfig3 = result === null || result === void 0 ? void 0 : result.bookingConfig) !== null && _result$bookingConfig3 !== void 0 ? _result$bookingConfig3 : (_bookingTicket$getBoo7 = bookingTicket.getBookingConfig) === null || _bookingTicket$getBoo7 === void 0 ? void 0 : _bookingTicket$getBoo7.call(bookingTicket)) !== null && _ref16 !== void 0 ? _ref16 : null;
|
|
488
548
|
}
|
|
489
549
|
if (!usesUnifiedBookingSales && !bookingConfig) throw new Error("预约 Selection Flow 初始化后仍缺少 bookingConfig。");
|
|
490
550
|
let initialCacheItem = bookingPayload.cacheItem;
|
|
@@ -496,10 +556,10 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
496
556
|
initialCacheItem = require_prepareCacheItemForBookingEdit.prepareCacheItemForBookingEdit(initialCacheItem);
|
|
497
557
|
if (isBookingEdit && bookingPayload.orderProduct) initialCacheItem = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, initialCacheItem), {}, { discount_list: Array.isArray(bookingPayload.orderProduct.discount_list) ? [...bookingPayload.orderProduct.discount_list] : [] });
|
|
498
558
|
const customerId = require_buildBookingEditDrawerState.resolveBookingEditCustomerId(liveTempOrder, bookingPayload.customerId, (_bookingTicket$getOrd3 = bookingTicket.getOrderCustomerSnapshot) === null || _bookingTicket$getOrd3 === void 0 || (_bookingTicket$getOrd3 = _bookingTicket$getOrd3.call(bookingTicket)) === null || _bookingTicket$getOrd3 === void 0 ? void 0 : _bookingTicket$getOrd3.id);
|
|
499
|
-
const resourcesOrigin = (
|
|
559
|
+
const resourcesOrigin = (_ref17 = (_bookingTicket$getRes3 = (_bookingTicket$getRes4 = bookingTicket.getResourcesOrigin) === null || _bookingTicket$getRes4 === void 0 ? void 0 : _bookingTicket$getRes4.call(bookingTicket)) !== null && _bookingTicket$getRes3 !== void 0 ? _bookingTicket$getRes3 : initialCacheItem === null || initialCacheItem === void 0 || (_initialCacheItem$_da = initialCacheItem._data) === null || _initialCacheItem$_da === void 0 ? void 0 : _initialCacheItem$_da.resourcesOrigin) !== null && _ref17 !== void 0 ? _ref17 : [];
|
|
500
560
|
initialCacheItem = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, initialCacheItem), {}, { _data: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, (initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem._data) || {}), {}, { resourcesOrigin }) });
|
|
501
561
|
bookingInitialCacheItem = initialCacheItem;
|
|
502
|
-
holderSource = (
|
|
562
|
+
holderSource = (_ref18 = (_bookingPayload$catal = bookingPayload.catalogProduct) !== null && _bookingPayload$catal !== void 0 ? _bookingPayload$catal : bookingPayload.sourceProduct) !== null && _ref18 !== void 0 ? _ref18 : initialCacheItem;
|
|
503
563
|
if (usesUnifiedBookingSales) holderOptions = getHolderOptionsForSource(holderSource);
|
|
504
564
|
else try {
|
|
505
565
|
holderOptions = yield ensureHolderOptionsForSource(holderSource);
|
|
@@ -585,7 +645,7 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
585
645
|
});
|
|
586
646
|
});
|
|
587
647
|
return function prepareOpen() {
|
|
588
|
-
return
|
|
648
|
+
return _ref19.apply(this, arguments);
|
|
589
649
|
};
|
|
590
650
|
})()().catch((error) => {
|
|
591
651
|
if (!isCurrentPending()) return;
|
|
@@ -635,7 +695,7 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
635
695
|
showHostError
|
|
636
696
|
]);
|
|
637
697
|
const handleConfirm = (0, ahooks.useMemoizedFn)(function() {
|
|
638
|
-
var
|
|
698
|
+
var _ref30 = require_asyncToGenerator._asyncToGenerator(function* (data) {
|
|
639
699
|
const activePending = activePendingRef.current;
|
|
640
700
|
if (!activePending || bridge.getSnapshot() !== activePending) return false;
|
|
641
701
|
const completeActive = (result) => {
|
|
@@ -646,9 +706,9 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
646
706
|
return true;
|
|
647
707
|
};
|
|
648
708
|
if (activePending.payload.mode === "create") {
|
|
649
|
-
var
|
|
709
|
+
var _ref20, _detailPayload$produc2;
|
|
650
710
|
const detailPayload = activePending.payload.requiresDetailPayload;
|
|
651
|
-
const item = require_resolveCatalogProductId.normalizeCatalogProduct((
|
|
711
|
+
const item = require_resolveCatalogProductId.normalizeCatalogProduct((_ref20 = (_detailPayload$produc2 = detailPayload.productData) !== null && _detailPayload$produc2 !== void 0 ? _detailPayload$produc2 : detailPayload.item) !== null && _ref20 !== void 0 ? _ref20 : {});
|
|
652
712
|
const productId = require_resolveCatalogProductId.resolveCatalogProductId(item);
|
|
653
713
|
if (!productId) {
|
|
654
714
|
console.warn("[SalesSdk] openNormalProductDetail: 商品缺少有效 id/product_id");
|
|
@@ -662,13 +722,13 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
662
722
|
let detailResult = require_transformNormalProductConfirm.transformNormalProductCreateConfirm(productId, data);
|
|
663
723
|
const holderIds = (_detailResult$detail = detailResult.detail) === null || _detailResult$detail === void 0 || (_detailResult$detail = _detailResult$detail._extend) === null || _detailResult$detail === void 0 ? void 0 : _detailResult$detail.holder_id;
|
|
664
724
|
if (Array.isArray(holderIds) && holderIds.length > 0 && activeBookingState) {
|
|
665
|
-
var _activeBookingState$b, _activeBookingState$c,
|
|
725
|
+
var _activeBookingState$b, _activeBookingState$c, _ref21, _ref22, _ref23;
|
|
666
726
|
detailResult = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, detailResult), {}, { detail: require_applyHolderToCacheItem.applyHolderToCacheItem(detailResult.detail, holderIds, {
|
|
667
727
|
bookingConfig: (_activeBookingState$b = activeBookingState.bookingConfig) !== null && _activeBookingState$b !== void 0 ? _activeBookingState$b : preparedOpen === null || preparedOpen === void 0 ? void 0 : preparedOpen.bookingConfig,
|
|
668
728
|
customerId: (_activeBookingState$c = activeBookingState.client) === null || _activeBookingState$c === void 0 || (_activeBookingState$c = _activeBookingState$c.value) === null || _activeBookingState$c === void 0 ? void 0 : _activeBookingState$c.id,
|
|
669
729
|
isFranchisee: activeBookingState.isFranchisee,
|
|
670
730
|
holderOptions: activeHolderOptions,
|
|
671
|
-
productSource: (
|
|
731
|
+
productSource: (_ref21 = (_ref22 = (_ref23 = data !== null && data !== void 0 ? data : detailResult.detail) !== null && _ref23 !== void 0 ? _ref23 : hydratedContext === null || hydratedContext === void 0 ? void 0 : hydratedContext.holderSource) !== null && _ref22 !== void 0 ? _ref22 : preparedOpen === null || preparedOpen === void 0 ? void 0 : preparedOpen.holderSource) !== null && _ref21 !== void 0 ? _ref21 : item
|
|
672
732
|
}) });
|
|
673
733
|
}
|
|
674
734
|
const allergyPreparation = yield prepareAllergyBeforeCommit({
|
|
@@ -699,11 +759,11 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
699
759
|
const isBookingEdit = activePending.payload.mode === "booking-edit";
|
|
700
760
|
const bookingPayload = isBookingEdit ? activePending.payload.bookingEditPayload : activePending.payload.requiresBookingEditPayload;
|
|
701
761
|
try {
|
|
702
|
-
var _hydratedContext$book2,
|
|
762
|
+
var _hydratedContext$book2, _ref24, _hydratedContext$hold2, _bookingState$booking, _bookingState$client, _ref25, _ref26, _ref27, _ref28, _cacheItem$_extend3;
|
|
703
763
|
if (isBookingEdit && !bookingPayload.deferCommit) require_resolveBookingCommitCount.assertBookingEditQuantityUnchanged(data);
|
|
704
764
|
const hydratedContext = (hydratedHolderContext === null || hydratedHolderContext === void 0 ? void 0 : hydratedHolderContext.pending) === activePending ? hydratedHolderContext : null;
|
|
705
765
|
const bookingState = (_hydratedContext$book2 = hydratedContext === null || hydratedContext === void 0 ? void 0 : hydratedContext.bookingState) !== null && _hydratedContext$book2 !== void 0 ? _hydratedContext$book2 : preparedOpen === null || preparedOpen === void 0 ? void 0 : preparedOpen.bookingState;
|
|
706
|
-
const holderOptions = (
|
|
766
|
+
const holderOptions = (_ref24 = (_hydratedContext$hold2 = hydratedContext === null || hydratedContext === void 0 ? void 0 : hydratedContext.holderOptions) !== null && _hydratedContext$hold2 !== void 0 ? _hydratedContext$hold2 : preparedOpen === null || preparedOpen === void 0 ? void 0 : preparedOpen.holderOptions) !== null && _ref24 !== void 0 ? _ref24 : [];
|
|
707
767
|
const cacheItem = require_buildBookingSelectionCacheItem.buildBookingSelectionCacheItem(data, {
|
|
708
768
|
bookingConfig: (_bookingState$booking = bookingState === null || bookingState === void 0 ? void 0 : bookingState.bookingConfig) !== null && _bookingState$booking !== void 0 ? _bookingState$booking : preparedOpen === null || preparedOpen === void 0 ? void 0 : preparedOpen.bookingConfig,
|
|
709
769
|
customerId: bookingState === null || bookingState === void 0 || (_bookingState$client = bookingState.client) === null || _bookingState$client === void 0 || (_bookingState$client = _bookingState$client.value) === null || _bookingState$client === void 0 ? void 0 : _bookingState$client.id,
|
|
@@ -711,14 +771,14 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
711
771
|
isPriceIncludeTax: data === null || data === void 0 ? void 0 : data.is_price_include_tax,
|
|
712
772
|
holderOptions,
|
|
713
773
|
initialCacheItem: preparedOpen === null || preparedOpen === void 0 ? void 0 : preparedOpen.initialCacheItem,
|
|
714
|
-
productSource: (
|
|
774
|
+
productSource: (_ref25 = (_ref26 = (_ref27 = (_ref28 = data !== null && data !== void 0 ? data : hydratedContext === null || hydratedContext === void 0 ? void 0 : hydratedContext.holderSource) !== null && _ref28 !== void 0 ? _ref28 : preparedOpen === null || preparedOpen === void 0 ? void 0 : preparedOpen.holderSource) !== null && _ref27 !== void 0 ? _ref27 : bookingPayload.catalogProduct) !== null && _ref26 !== void 0 ? _ref26 : bookingPayload.sourceProduct) !== null && _ref25 !== void 0 ? _ref25 : bookingPayload.cacheItem
|
|
715
775
|
});
|
|
716
776
|
cacheItem._holderOptionsSnapshot = holderOptions;
|
|
717
777
|
let allergyNoteDraft;
|
|
718
778
|
if (!isBookingEdit) {
|
|
719
|
-
var
|
|
779
|
+
var _ref29, _bookingPayload$catal2;
|
|
720
780
|
const allergyPreparation = yield prepareAllergyBeforeCommit({
|
|
721
|
-
product: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, (
|
|
781
|
+
product: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, (_ref29 = (_bookingPayload$catal2 = bookingPayload.catalogProduct) !== null && _bookingPayload$catal2 !== void 0 ? _bookingPayload$catal2 : bookingPayload.sourceProduct) !== null && _ref29 !== void 0 ? _ref29 : {}), cacheItem),
|
|
722
782
|
flowId: bookingPayload._allergyFlowId
|
|
723
783
|
});
|
|
724
784
|
if (!allergyPreparation.allowed) return false;
|
|
@@ -772,8 +832,8 @@ const NormalProductDetailHostRenderer = ({ defaultSkuDetailConfig }) => {
|
|
|
772
832
|
return false;
|
|
773
833
|
}
|
|
774
834
|
});
|
|
775
|
-
return function(
|
|
776
|
-
return
|
|
835
|
+
return function(_x14) {
|
|
836
|
+
return _ref30.apply(this, arguments);
|
|
777
837
|
};
|
|
778
838
|
}());
|
|
779
839
|
const handleClose = (0, ahooks.useMemoizedFn)(() => {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let dayjs = require("dayjs");
|
|
3
|
+
dayjs = require_runtime.__toESM(dayjs);
|
|
4
|
+
//#region src/plus/salesSdk/normalProductDetail/availabilityContextRouting.ts
|
|
5
|
+
const normalizeDate = (value) => {
|
|
6
|
+
if (value == null || value === "") return void 0;
|
|
7
|
+
const parsed = (0, dayjs.default)(value);
|
|
8
|
+
return parsed.isValid() ? parsed.format("YYYY-MM-DD") : void 0;
|
|
9
|
+
};
|
|
10
|
+
const availabilityDateRangeContains = (coverage, requested) => !(0, dayjs.default)(requested.startDate).isBefore((0, dayjs.default)(coverage.startDate), "day") && !(0, dayjs.default)(requested.endDate).isAfter((0, dayjs.default)(coverage.endDate), "day");
|
|
11
|
+
const resolveAvailabilityRequestContextId = (contexts, request, preferredContextId) => {
|
|
12
|
+
var _rangeCandidates$find, _rawDateRange$endDate, _contexts;
|
|
13
|
+
const candidateContextId = (_rangeCandidates$find = [...Array.isArray(request.candidates) ? request.candidates : [], ...Array.isArray(request.selectedRanges) ? request.selectedRanges : []].find((item) => typeof (item === null || item === void 0 ? void 0 : item.availabilityContextId) === "string")) === null || _rangeCandidates$find === void 0 ? void 0 : _rangeCandidates$find.availabilityContextId;
|
|
14
|
+
if (candidateContextId && contexts.some((item) => item.contextId === candidateContextId)) return candidateContextId;
|
|
15
|
+
const rawDateRange = request.dateRange;
|
|
16
|
+
const startDate = normalizeDate(rawDateRange === null || rawDateRange === void 0 ? void 0 : rawDateRange.startDate);
|
|
17
|
+
const endDate = normalizeDate((_rawDateRange$endDate = rawDateRange === null || rawDateRange === void 0 ? void 0 : rawDateRange.endDate) !== null && _rawDateRange$endDate !== void 0 ? _rawDateRange$endDate : rawDateRange === null || rawDateRange === void 0 ? void 0 : rawDateRange.startDate);
|
|
18
|
+
if (startDate && endDate) {
|
|
19
|
+
var _reverse$find;
|
|
20
|
+
const requestedRange = {
|
|
21
|
+
startDate,
|
|
22
|
+
endDate
|
|
23
|
+
};
|
|
24
|
+
const preferred = contexts.find((item) => item.contextId === preferredContextId && availabilityDateRangeContains(item.dateRange, requestedRange));
|
|
25
|
+
if (preferred) return preferred.contextId;
|
|
26
|
+
return (_reverse$find = [...contexts].reverse().find((item) => availabilityDateRangeContains(item.dateRange, requestedRange))) === null || _reverse$find === void 0 ? void 0 : _reverse$find.contextId;
|
|
27
|
+
}
|
|
28
|
+
return contexts.some((item) => item.contextId === preferredContextId) ? preferredContextId || void 0 : (_contexts = contexts[contexts.length - 1]) === null || _contexts === void 0 ? void 0 : _contexts.contextId;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.availabilityDateRangeContains = availabilityDateRangeContains;
|
|
32
|
+
exports.resolveAvailabilityRequestContextId = resolveAvailabilityRequestContextId;
|