@pisell/private-materials 6.12.408 → 6.12.410
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 +12 -12
- package/build/lowcode/view.js +12 -12
- package/es/components/bigSale/components/ProductList/index.js +179 -26
- package/es/components/bigSale/components/ProductListSettingsModal/index.js +5 -3
- package/es/components/bigSale/templates/Kiosk/payment/index.js +16 -0
- package/es/components/bigSale/utils/productListPreferences.js +5 -2
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +9 -3
- package/es/components/checkout/components/PaymentOptionsModule/index.js +10 -2
- package/es/components/vendingMachine/README.md +1 -1
- package/es/components/venueBookingSales/BookingComposer.js +44 -8
- package/es/components/venueBookingSales/VenueBookingShared.js +1 -1
- package/es/components/venueBookingSales/VenueExitButton.js +22 -11
- package/es/components/venueBookingSales/availability/BookingSelectionPanel.js +12 -1
- package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +6 -1
- package/es/components/venueBookingSales/checkout/useVenueReviewAccess.js +111 -0
- package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -1
- package/es/components/venueBookingSales/useVenueBookingSteps.js +60 -11
- package/es/pro/bookingProductDetailModal/index.js +7 -7
- package/lib/components/bigSale/components/ProductList/index.js +179 -26
- package/lib/components/bigSale/components/ProductListSettingsModal/index.js +5 -3
- package/lib/components/bigSale/templates/Kiosk/payment/index.js +16 -0
- package/lib/components/bigSale/utils/productListPreferences.js +5 -2
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +9 -3
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +10 -2
- package/lib/components/vendingMachine/README.md +1 -1
- package/lib/components/venueBookingSales/BookingComposer.js +43 -7
- package/lib/components/venueBookingSales/VenueBookingShared.js +1 -1
- package/lib/components/venueBookingSales/VenueExitButton.js +21 -10
- package/lib/components/venueBookingSales/availability/BookingSelectionPanel.js +12 -1
- package/lib/components/venueBookingSales/checkout/VenueBookingHolderStep.js +6 -1
- package/lib/components/venueBookingSales/checkout/useVenueReviewAccess.js +112 -0
- package/lib/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -1
- package/lib/components/venueBookingSales/useVenueBookingSteps.js +60 -11
- package/lib/pro/bookingProductDetailModal/index.js +7 -7
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
2
|
import { Dialog } from "../../plus/venueBookingDesign/Dialog.js";
|
|
3
3
|
import React, { useEffect, useRef, useState } from "react";
|
|
4
|
-
import { X } from "@phosphor-icons/react";
|
|
4
|
+
import { ArrowLeft, X } from "@phosphor-icons/react";
|
|
5
5
|
//#region src/components/venueBookingSales/VenueExitButton.tsx
|
|
6
|
-
/**
|
|
7
|
-
function VenueExitButton({ runtime: r }) {
|
|
6
|
+
/** Later steps navigate back; only the entry step offers to abandon the draft. */
|
|
7
|
+
function VenueExitButton({ runtime: r, onBack, disabled = false }) {
|
|
8
8
|
const [open, setOpen] = useState(false);
|
|
9
9
|
const [leaving, setLeaving] = useState(false);
|
|
10
10
|
const pending = useRef(false);
|
|
@@ -15,11 +15,15 @@ function VenueExitButton({ runtime: r }) {
|
|
|
15
15
|
mounted.current = false;
|
|
16
16
|
};
|
|
17
17
|
}, []);
|
|
18
|
+
const hasBack = Boolean(onBack);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (hasBack) setOpen(false);
|
|
21
|
+
}, [hasBack]);
|
|
18
22
|
const current = useRef(r);
|
|
19
23
|
current.current = r;
|
|
20
24
|
const leave = function() {
|
|
21
25
|
var _ref = _asyncToGenerator(function* () {
|
|
22
|
-
if (pending.current || r.disabled) return;
|
|
26
|
+
if (pending.current || r.disabled || disabled) return;
|
|
23
27
|
const sessionId = r.session.sessionId;
|
|
24
28
|
pending.current = true;
|
|
25
29
|
setLeaving(true);
|
|
@@ -45,17 +49,24 @@ function VenueExitButton({ runtime: r }) {
|
|
|
45
49
|
return _ref.apply(this, arguments);
|
|
46
50
|
};
|
|
47
51
|
}();
|
|
52
|
+
const label = hasBack ? r.text("Previous step", "上一步") : r.text("Close booking", "关闭预订");
|
|
48
53
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", {
|
|
49
54
|
type: "button",
|
|
50
55
|
className: "venue-booking-exit icon-button",
|
|
51
|
-
"aria-label":
|
|
52
|
-
title:
|
|
53
|
-
disabled: r.disabled || leaving,
|
|
54
|
-
onClick: () =>
|
|
55
|
-
|
|
56
|
+
"aria-label": label,
|
|
57
|
+
title: label,
|
|
58
|
+
disabled: disabled || r.disabled || leaving,
|
|
59
|
+
onClick: () => {
|
|
60
|
+
if (onBack) onBack();
|
|
61
|
+
else setOpen(true);
|
|
62
|
+
}
|
|
63
|
+
}, hasBack ? /* @__PURE__ */ React.createElement(ArrowLeft, {
|
|
64
|
+
size: 22,
|
|
65
|
+
"aria-hidden": "true"
|
|
66
|
+
}) : /* @__PURE__ */ React.createElement(X, {
|
|
56
67
|
size: 22,
|
|
57
68
|
"aria-hidden": "true"
|
|
58
|
-
})), open && /* @__PURE__ */ React.createElement(Dialog, {
|
|
69
|
+
})), open && !hasBack && /* @__PURE__ */ React.createElement(Dialog, {
|
|
59
70
|
title: r.text("Leave this booking?", "退出本次预订?"),
|
|
60
71
|
closeLabel: r.text("Close", "关闭"),
|
|
61
72
|
onClose: () => setOpen(false),
|
|
@@ -71,7 +82,7 @@ function VenueExitButton({ runtime: r }) {
|
|
|
71
82
|
}, r.text("Keep booking", "继续预订")), /* @__PURE__ */ React.createElement("button", {
|
|
72
83
|
type: "button",
|
|
73
84
|
className: "button",
|
|
74
|
-
disabled: leaving || r.disabled,
|
|
85
|
+
disabled: disabled || leaving || r.disabled,
|
|
75
86
|
onClick: () => {
|
|
76
87
|
leave();
|
|
77
88
|
}
|
|
@@ -31,6 +31,7 @@ const BookingSelectionPanel = forwardRef((props, ref) => {
|
|
|
31
31
|
const [dateError, setDateError] = useState(false);
|
|
32
32
|
const rootRef = useRef(null);
|
|
33
33
|
const resourcesRef = useRef(null);
|
|
34
|
+
const resolvedResourceTimeRef = useRef();
|
|
34
35
|
const timeRef = useRef(null);
|
|
35
36
|
const dateDetailsRef = useRef(null);
|
|
36
37
|
const mounted = useRef(true);
|
|
@@ -125,6 +126,16 @@ const BookingSelectionPanel = forwardRef((props, ref) => {
|
|
|
125
126
|
const timeGroups = groupBookingTimes(state.times, (state.partySize || 0) * state.bookingCount);
|
|
126
127
|
const currentTime = state.times.find((candidate) => sameBookingTime(candidate, state.candidate));
|
|
127
128
|
const selectedTime = currentTime && selectable(currentTime, (state.partySize || 0) * state.bookingCount) ? state.candidate : void 0;
|
|
129
|
+
const resourceTimeKey = selectedTime ? `${state.contextId || ""}:${bookingTimeIntervalKey(selectedTime)}` : void 0;
|
|
130
|
+
const resourcesResolved = !!resourceTimeKey && !dateChanging && (state.status === "selecting" || state.status === "ready" || resolvedResourceTimeRef.current === resourceTimeKey);
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (!resourceTimeKey || dateChanging) resolvedResourceTimeRef.current = void 0;
|
|
133
|
+
else if (state.status === "selecting" || state.status === "ready") resolvedResourceTimeRef.current = resourceTimeKey;
|
|
134
|
+
}, [
|
|
135
|
+
resourceTimeKey,
|
|
136
|
+
state.status,
|
|
137
|
+
dateChanging
|
|
138
|
+
]);
|
|
128
139
|
const timeValue = state.status === "loading" || dateChanging ? t("timeLoading") : state.status === "error" ? t("timeLoadFailed") : selectedTime ? `${candidateClock(selectedTime.bookingStartAt || selectedTime.startAt, selectedTime.startTime)}–${candidateClock(selectedTime.bookingEndAt || selectedTime.endAt, selectedTime.endTime)}` : t(timeGroups.some(({ candidate }) => selectable(candidate, (state.partySize || 0) * state.bookingCount)) ? "timeNotSelected" : "timeUnavailable");
|
|
129
140
|
const localTimePending = props.mode === "party" && !state.times.length && (state.status === "idle" || state.status === "loading" || dateChanging);
|
|
130
141
|
const localTimeFailure = props.mode === "party" && !state.times.length && state.status === "error" && !state.requiresOrderReconciliation;
|
|
@@ -266,7 +277,7 @@ const BookingSelectionPanel = forwardRef((props, ref) => {
|
|
|
266
277
|
].includes(code));
|
|
267
278
|
const showFailure = !busy && (state.status === "error" || state.status === "blocked" || state.requiresOrderReconciliation || failureCodes.length > 0);
|
|
268
279
|
const reasonLabels = showFailure ? Array.from(new Set(failureCodes.map(reason))) : [];
|
|
269
|
-
const showResources = props.mode === "party" || visibleGroups(state).length > 0 || !state.resourceGroups.length && Object.keys(configured).length > 0;
|
|
280
|
+
const showResources = props.mode === "party" || resourcesResolved && (visibleGroups(state).length > 0 || !state.resourceGroups.length && Object.keys(configured).length > 0);
|
|
270
281
|
const statusPanel = /* @__PURE__ */ React.createElement(React.Fragment, null, (showFailure || dateError) && /* @__PURE__ */ React.createElement("div", {
|
|
271
282
|
className: "venue-booking-availability__status",
|
|
272
283
|
role: "alert"
|
|
@@ -369,6 +369,7 @@ const VenueBookingHolderStep = forwardRef((props, ref) => {
|
|
|
369
369
|
const renderAssignments = (line, ordinalOffset = 0) => Array.from({ length: line.quantity }, (_, index) => {
|
|
370
370
|
var _line$orderLine$metad2;
|
|
371
371
|
const options = holder.getHolderOptionsForSource(line.cacheItem);
|
|
372
|
+
const noProfiles = options.length === 0;
|
|
372
373
|
const value = (draftFor(line) || line.ids)[index];
|
|
373
374
|
const selected = value == null ? void 0 : options.find((option) => String(option.id) === String(value));
|
|
374
375
|
const fieldId = `${id}-${line.uid}-${index}`;
|
|
@@ -398,7 +399,11 @@ const VenueBookingHolderStep = forwardRef((props, ref) => {
|
|
|
398
399
|
}, /* @__PURE__ */ React.createElement("span", null, text("Choose a holder profile", "选择持票人档案")), /* @__PURE__ */ React.createElement("select", {
|
|
399
400
|
id: fieldId,
|
|
400
401
|
value: value == null ? "" : String(value),
|
|
401
|
-
disabled: disabled || !!busy || !!creating || state.blocked,
|
|
402
|
+
disabled: disabled || !!busy || !!creating || state.blocked || noProfiles,
|
|
403
|
+
style: noProfiles ? {
|
|
404
|
+
opacity: .5,
|
|
405
|
+
cursor: "not-allowed"
|
|
406
|
+
} : void 0,
|
|
402
407
|
"aria-invalid": invalid || void 0,
|
|
403
408
|
"aria-describedby": invalid ? `${fieldId}-error` : void 0,
|
|
404
409
|
onChange: (event) => {
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
import useSalesUserLogin from "../../../hooks/useSalesUserLogin.js";
|
|
3
|
+
import { orderIdentity } from "../presentation.js";
|
|
4
|
+
import { confirmationErrorMessage } from "./errorMessage.js";
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { useMemoizedFn } from "ahooks";
|
|
7
|
+
//#region src/components/venueBookingSales/checkout/useVenueReviewAccess.ts
|
|
8
|
+
const ownerOf = (r) => {
|
|
9
|
+
var _r$os$getTempOrder, _r$os$getTempOrder2, _r$os;
|
|
10
|
+
return {
|
|
11
|
+
os: r.os,
|
|
12
|
+
scopeKey: r.scopeKey,
|
|
13
|
+
sessionId: r.session.sessionId,
|
|
14
|
+
identity: orderIdentity((_r$os$getTempOrder = (_r$os$getTempOrder2 = (_r$os = r.os).getTempOrder) === null || _r$os$getTempOrder2 === void 0 ? void 0 : _r$os$getTempOrder2.call(_r$os)) !== null && _r$os$getTempOrder !== void 0 ? _r$os$getTempOrder : r.order)
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const sameOwner = (left, right) => left.os === right.os && left.scopeKey === right.scopeKey && left.sessionId === right.sessionId && left.identity === right.identity;
|
|
18
|
+
const customerOf = (r) => {
|
|
19
|
+
var _ref, _r$os$getTempOrder3, _r$os$getTempOrder4, _r$os2;
|
|
20
|
+
return String(((_ref = (_r$os$getTempOrder3 = (_r$os$getTempOrder4 = (_r$os2 = r.os).getTempOrder) === null || _r$os$getTempOrder4 === void 0 ? void 0 : _r$os$getTempOrder4.call(_r$os2)) !== null && _r$os$getTempOrder3 !== void 0 ? _r$os$getTempOrder3 : r.order) === null || _ref === void 0 ? void 0 : _ref.customer_id) || "");
|
|
21
|
+
};
|
|
22
|
+
/** Review mounts only after login and the existing OS customer/contact synchronization settle. */
|
|
23
|
+
function useVenueReviewAccess(runtime) {
|
|
24
|
+
const login = useSalesUserLogin();
|
|
25
|
+
const latest = useRef(runtime);
|
|
26
|
+
latest.current = runtime;
|
|
27
|
+
const mounted = useRef(true);
|
|
28
|
+
const request = useRef();
|
|
29
|
+
const [pending, setPending] = useState(false);
|
|
30
|
+
const [approved, setApproved] = useState();
|
|
31
|
+
const owner = ownerOf(runtime);
|
|
32
|
+
const loggedIn = login.isLoggedIn();
|
|
33
|
+
const ready = loggedIn && !!approved && sameOwner(approved.owner, owner) && approved.customer === customerOf(runtime);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
mounted.current = true;
|
|
36
|
+
return () => {
|
|
37
|
+
var _request$current, _request$current$canc;
|
|
38
|
+
mounted.current = false;
|
|
39
|
+
(_request$current = request.current) === null || _request$current === void 0 || (_request$current$canc = _request$current.cancelLogin) === null || _request$current$canc === void 0 || _request$current$canc.call(_request$current);
|
|
40
|
+
request.current = void 0;
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (request.current && !sameOwner(request.current.owner, owner)) {
|
|
45
|
+
var _request$current$canc2, _request$current2;
|
|
46
|
+
(_request$current$canc2 = (_request$current2 = request.current).cancelLogin) === null || _request$current$canc2 === void 0 || _request$current$canc2.call(_request$current2);
|
|
47
|
+
request.current = void 0;
|
|
48
|
+
setPending(false);
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
owner.os,
|
|
52
|
+
owner.scopeKey,
|
|
53
|
+
owner.sessionId,
|
|
54
|
+
owner.identity
|
|
55
|
+
]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!loggedIn) setApproved(void 0);
|
|
58
|
+
}, [loggedIn]);
|
|
59
|
+
return {
|
|
60
|
+
ready,
|
|
61
|
+
pending,
|
|
62
|
+
ensure: useMemoizedFn(() => {
|
|
63
|
+
const started = latest.current;
|
|
64
|
+
const captured = ownerOf(started);
|
|
65
|
+
if (!mounted.current || !started.ready || started.props.isActive === false) return Promise.resolve(false);
|
|
66
|
+
if (login.isLoggedIn() && approved && sameOwner(approved.owner, captured) && approved.customer === customerOf(started)) return Promise.resolve(true);
|
|
67
|
+
if (request.current && sameOwner(request.current.owner, captured)) return request.current.promise;
|
|
68
|
+
const own = { owner: captured };
|
|
69
|
+
request.current = own;
|
|
70
|
+
const current = () => mounted.current && request.current === own && latest.current.props.isActive !== false && sameOwner(captured, ownerOf(latest.current));
|
|
71
|
+
own.promise = Promise.resolve().then(_asyncToGenerator(function* () {
|
|
72
|
+
try {
|
|
73
|
+
if (!current()) return false;
|
|
74
|
+
if (!login.isLoggedIn()) {
|
|
75
|
+
if (!(yield new Promise((resolve) => {
|
|
76
|
+
own.cancelLogin = () => resolve(false);
|
|
77
|
+
if (!login.openLoginModal({ callback: (status) => {
|
|
78
|
+
own.cancelLogin = void 0;
|
|
79
|
+
resolve(status === "success");
|
|
80
|
+
} })) {
|
|
81
|
+
own.cancelLogin = void 0;
|
|
82
|
+
throw new Error(started.text("Login is unavailable. Please try again.", "登录暂不可用,请重试。"));
|
|
83
|
+
}
|
|
84
|
+
})) || !current() || !login.isLoggedIn()) return false;
|
|
85
|
+
}
|
|
86
|
+
if (!current()) return false;
|
|
87
|
+
if (typeof captured.os.syncAuthenticatedOrderCustomer !== "function" || (yield captured.os.syncAuthenticatedOrderCustomer()) !== true) throw new Error(started.text("Could not load your account details. Please try again.", "无法读取账号信息,请重试。"));
|
|
88
|
+
if (!current() || !login.isLoggedIn()) return false;
|
|
89
|
+
latest.current.cart.refreshCartSnapshot();
|
|
90
|
+
setApproved({
|
|
91
|
+
owner: captured,
|
|
92
|
+
customer: customerOf(latest.current)
|
|
93
|
+
});
|
|
94
|
+
return true;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (current()) latest.current.setError(confirmationErrorMessage(error, started.text("Could not prepare checkout. Please try again.", "无法进入确认页面,请重试。")));
|
|
97
|
+
return false;
|
|
98
|
+
} finally {
|
|
99
|
+
if (request.current === own) {
|
|
100
|
+
request.current = void 0;
|
|
101
|
+
if (mounted.current) setPending(false);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
setPending(true);
|
|
106
|
+
return own.promise;
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { useVenueReviewAccess };
|
|
@@ -9,9 +9,9 @@ import SKUOptionsSelection from "../../../plus/skuOptionsSelection/index.js";
|
|
|
9
9
|
import immersive from "../../../pro/skuDetailModal/appearances/immersive/index.js";
|
|
10
10
|
import { resolveEffectiveHolderConfig } from "../../../plus/salesSdk/utils/productHolderConfig.js";
|
|
11
11
|
import { descriptionText, localizedText } from "../presentation.js";
|
|
12
|
+
import { usePartyConfigurationPrice } from "../usePartyConfigurationPrice.js";
|
|
12
13
|
import { getVenueExtraHolderSource } from "./holder.js";
|
|
13
14
|
import { confirmationErrorMessage } from "../checkout/errorMessage.js";
|
|
14
|
-
import { usePartyConfigurationPrice } from "../usePartyConfigurationPrice.js";
|
|
15
15
|
import { VenueExtraHolderField } from "./VenueExtraHolderField.js";
|
|
16
16
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
17
|
import { ConfigProvider } from "antd";
|
|
@@ -11,13 +11,16 @@ import VenueBookingConfirmation from "./checkout/VenueBookingConfirmation.js";
|
|
|
11
11
|
import VenueBookingHolderReview from "./checkout/VenueBookingHolderReview.js";
|
|
12
12
|
import { VenueExtras, VenueOrderAmounts, VenueOrderItems } from "./VenueBookingShared.js";
|
|
13
13
|
import VenueExitButton from "./VenueExitButton.js";
|
|
14
|
+
import { useVenueReviewAccess } from "./checkout/useVenueReviewAccess.js";
|
|
14
15
|
import React, { useEffect, useRef } from "react";
|
|
16
|
+
import { Spin } from "antd";
|
|
15
17
|
import { ArrowRight, Plus } from "@phosphor-icons/react";
|
|
16
18
|
//#region src/components/venueBookingSales/useVenueBookingSteps.tsx
|
|
17
19
|
/** Both independent templates share the guarded later stages; session remains the state owner. */
|
|
18
20
|
function useVenueBookingSteps(runtime) {
|
|
19
21
|
var _definitions, _r$order;
|
|
20
22
|
const r = runtime;
|
|
23
|
+
const reviewAccess = useVenueReviewAccess(r);
|
|
21
24
|
const progress = useBookingProgress();
|
|
22
25
|
const holderRef = useRef(null);
|
|
23
26
|
const latestRuntime = useRef(runtime);
|
|
@@ -29,12 +32,14 @@ function useVenueBookingSteps(runtime) {
|
|
|
29
32
|
mode: r.mode,
|
|
30
33
|
date: r.date,
|
|
31
34
|
customerId: r.customerId,
|
|
35
|
+
sessionId: r.session.sessionId,
|
|
32
36
|
os: r.os,
|
|
33
37
|
order: orderIdentity(r.order)
|
|
34
38
|
};
|
|
35
39
|
const ownerRef = useRef(owner);
|
|
36
40
|
if (Object.keys(owner).some((key) => owner[key] !== ownerRef.current[key])) ownerRef.current = owner;
|
|
37
41
|
const renderedOwner = ownerRef.current;
|
|
42
|
+
const sameSessionOwner = (left, right) => left.scopeKey === right.scopeKey && left.mode === right.mode && left.date === right.date && left.sessionId === right.sessionId && left.os === right.os && left.order === right.order;
|
|
38
43
|
useEffect(() => {
|
|
39
44
|
mounted.current = true;
|
|
40
45
|
return () => {
|
|
@@ -67,14 +72,16 @@ function useVenueBookingSteps(runtime) {
|
|
|
67
72
|
const started = latestRuntime.current;
|
|
68
73
|
if (target === "extras" && !started.hasExtras) target = "review";
|
|
69
74
|
if (target === "review" && started.hasExtras && (started.extrasCatalog.loading || started.extrasCatalog.error)) target = "extras";
|
|
70
|
-
if (!mounted.current || renderedOwner !== ownerRef.current || started.step !== r.step || started.isExtraQuantityPending()) return;
|
|
75
|
+
if (!mounted.current || reviewAccess.pending || renderedOwner !== ownerRef.current || started.step !== r.step || started.isExtraQuantityPending()) return;
|
|
76
|
+
const targetIndex = definitions.findIndex((item) => item.id === target);
|
|
77
|
+
const goingBack = targetIndex >= 0 && targetIndex < currentIndex;
|
|
71
78
|
const sequence = ++navigationSequence.current;
|
|
72
|
-
const isCurrent = () => {
|
|
79
|
+
const isCurrent = (afterLogin = false) => {
|
|
73
80
|
const current = latestRuntime.current;
|
|
74
|
-
return mounted.current && sequence === navigationSequence.current && renderedOwner === ownerRef.current && current.props.isActive !== false && current.step === started.step && !current.disabled && !current.isExtraQuantityPending() && !current.composer && !current.configurationModal && (target === "select" || current.hasBookings && current.mainDateMatches && !current.mainCatalogBlocked);
|
|
81
|
+
return mounted.current && sequence === navigationSequence.current && (afterLogin ? sameSessionOwner(renderedOwner, ownerRef.current) : renderedOwner === ownerRef.current) && current.props.isActive !== false && current.step === started.step && !current.disabled && !current.isExtraQuantityPending() && !current.composer && !current.configurationModal && (target === "select" || goingBack || current.hasBookings && current.mainDateMatches && (afterLogin ? !current.mainPoolEmpty && !current.main.error : !current.mainCatalogBlocked));
|
|
75
82
|
};
|
|
76
83
|
if (!isCurrent()) return;
|
|
77
|
-
if (target === "extras" || target === "review") {
|
|
84
|
+
if (!goingBack && (target === "extras" || target === "review")) {
|
|
78
85
|
if (started.step === "holder") {
|
|
79
86
|
var _holderRef$current;
|
|
80
87
|
const valid = yield (_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.validate();
|
|
@@ -90,6 +97,15 @@ function useVenueBookingSteps(runtime) {
|
|
|
90
97
|
if (target === "review" && !current.checkExtraHolders()) return;
|
|
91
98
|
}
|
|
92
99
|
if (!isCurrent()) return;
|
|
100
|
+
if (target === "review") {
|
|
101
|
+
if (!(yield reviewAccess.ensure()) || !isCurrent(true)) return;
|
|
102
|
+
const current = latestRuntime.current;
|
|
103
|
+
if (!inspectVenueHolderState(current.context, current.scopeKey).complete) {
|
|
104
|
+
current.setStep("holder");
|
|
105
|
+
progress("[data-booking-stage=\"holder\"]");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
93
109
|
const current = latestRuntime.current;
|
|
94
110
|
if (target === "select" && expandProducts) current.setExpandedSection("product");
|
|
95
111
|
current.setError(void 0);
|
|
@@ -102,8 +118,32 @@ function useVenueBookingSteps(runtime) {
|
|
|
102
118
|
};
|
|
103
119
|
}();
|
|
104
120
|
const back = () => {
|
|
105
|
-
if (previous && !r.disabled) goTo(previous);
|
|
121
|
+
if (previous && !r.disabled && !reviewAccess.pending) goTo(previous);
|
|
106
122
|
};
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (r.step !== "review" || !r.ready || reviewAccess.ready) return;
|
|
125
|
+
let active = true;
|
|
126
|
+
const captured = renderedOwner;
|
|
127
|
+
reviewAccess.ensure().then((allowed) => {
|
|
128
|
+
const current = latestRuntime.current;
|
|
129
|
+
if (!allowed && active && mounted.current && current.step === "review" && sameSessionOwner(captured, ownerRef.current)) current.setStep(previous || "select");
|
|
130
|
+
});
|
|
131
|
+
return () => {
|
|
132
|
+
active = false;
|
|
133
|
+
};
|
|
134
|
+
}, [
|
|
135
|
+
r.step,
|
|
136
|
+
r.ready,
|
|
137
|
+
reviewAccess.ready,
|
|
138
|
+
reviewAccess.ensure,
|
|
139
|
+
renderedOwner.scopeKey,
|
|
140
|
+
renderedOwner.mode,
|
|
141
|
+
renderedOwner.date,
|
|
142
|
+
renderedOwner.sessionId,
|
|
143
|
+
renderedOwner.os,
|
|
144
|
+
renderedOwner.order,
|
|
145
|
+
previous
|
|
146
|
+
]);
|
|
107
147
|
const nextAfterSelect = () => inspectVenueHolderState(r.context, r.scopeKey).required ? "holder" : r.nextAfterHolder;
|
|
108
148
|
const nextStep = r.step === "select" ? r.nextAfterSelect : r.step === "holder" ? r.nextAfterHolder : "review";
|
|
109
149
|
const nextLabel = r.step === "review" ? r.text("Confirm & pay", "确认并支付") : nextStep === "holder" ? r.text("Next: holder details", "下一步:持票人") : nextStep === "extras" ? r.text("Next: add extras", "下一步:附加商品") : r.step === "extras" && !r.extras.rows.some((line) => Number(line.num) > 0) ? translate(r.locale, "skipExtras") : r.text("Next: review & pay", "下一步:确认订单");
|
|
@@ -113,12 +153,13 @@ function useVenueBookingSteps(runtime) {
|
|
|
113
153
|
"aria-hidden": "true"
|
|
114
154
|
})),
|
|
115
155
|
compactLabel: nextLabel,
|
|
116
|
-
disabled: r.disabled || !r.hasBookings || !r.mainDateMatches || r.mainCatalogBlocked || !!r.composer || !!r.configurationModal || (r.step === "extras" || r.step === "review") && r.hasExtras && (r.extrasCatalog.loading || !!r.extrasCatalog.error),
|
|
117
|
-
busy: r.checkout.submitting || r.busy && !r.pendingExtraProductId || r.holderBusy,
|
|
156
|
+
disabled: r.disabled || reviewAccess.pending || r.step === "review" && !reviewAccess.ready || !r.hasBookings || !r.mainDateMatches || r.mainCatalogBlocked || !!r.composer || !!r.configurationModal || (r.step === "extras" || r.step === "review") && r.hasExtras && (r.extrasCatalog.loading || !!r.extrasCatalog.error),
|
|
157
|
+
busy: reviewAccess.pending || r.checkout.submitting || r.busy && !r.pendingExtraProductId || r.holderBusy,
|
|
118
158
|
onClick: function() {
|
|
119
159
|
var _ref2 = _asyncToGenerator(function* () {
|
|
120
|
-
if (r.disabled || r.isExtraQuantityPending()) return;
|
|
160
|
+
if (r.disabled || reviewAccess.pending || r.isExtraQuantityPending()) return;
|
|
121
161
|
if (r.step === "review") {
|
|
162
|
+
if (!(yield reviewAccess.ensure())) return;
|
|
122
163
|
if (yield r.checkout.checkout()) r.setHandoff(true);
|
|
123
164
|
} else if (r.step === "select") yield goTo(nextAfterSelect());
|
|
124
165
|
else if (r.step === "holder") yield goTo(r.nextAfterHolder);
|
|
@@ -139,12 +180,16 @@ function useVenueBookingSteps(runtime) {
|
|
|
139
180
|
onStateChange: (state) => r.setHolderBusy(state.pending),
|
|
140
181
|
onRemoveTicket: r.mode === "tickets" ? r.removeTicket : void 0
|
|
141
182
|
};
|
|
142
|
-
const navigation = /* @__PURE__ */ React.createElement("div", { className: "venue-booking-navigation" }, /* @__PURE__ */ React.createElement(VenueExitButton, {
|
|
183
|
+
const navigation = /* @__PURE__ */ React.createElement("div", { className: "venue-booking-navigation" }, /* @__PURE__ */ React.createElement(VenueExitButton, {
|
|
184
|
+
runtime: r,
|
|
185
|
+
onBack: previous ? back : void 0,
|
|
186
|
+
disabled: reviewAccess.pending
|
|
187
|
+
}), /* @__PURE__ */ React.createElement(ConfigurableBookingSteps, {
|
|
143
188
|
current: currentIndex,
|
|
144
189
|
label: r.text("Booking steps", "预订步骤"),
|
|
145
190
|
currentLabel: r.text("Current step", "当前步骤"),
|
|
146
191
|
steps: definitions.map((item) => _objectSpread2(_objectSpread2({}, item), {}, {
|
|
147
|
-
status: (item.id === "select" || r.hasBookings && r.mainDateMatches && !r.mainCatalogBlocked && (item.id === "holder" || r.holderState.complete)) && !r.disabled ? "available" : "locked",
|
|
192
|
+
status: (item.id === "select" || r.hasBookings && r.mainDateMatches && !r.mainCatalogBlocked && (item.id === "holder" || r.holderState.complete)) && !r.disabled && !reviewAccess.pending ? "available" : "locked",
|
|
148
193
|
onClick: () => {
|
|
149
194
|
goTo(item.id);
|
|
150
195
|
}
|
|
@@ -192,7 +237,11 @@ function useVenueBookingSteps(runtime) {
|
|
|
192
237
|
back,
|
|
193
238
|
previous,
|
|
194
239
|
holderRef,
|
|
195
|
-
renderStage: /* @__PURE__ */ React.createElement(React.Fragment, null, r.step === "holder" && /* @__PURE__ */ React.createElement(VenueBookingHolderStep, _objectSpread2(_objectSpread2({ ref: holderRef }, holderProps), {}, { afterAssignments: addMoreTickets })), r.step === "extras" && /* @__PURE__ */ React.createElement(VenueExtras, { runtime: r }), r.step === "review" && /* @__PURE__ */ React.createElement(
|
|
240
|
+
renderStage: /* @__PURE__ */ React.createElement(React.Fragment, null, r.step === "holder" && /* @__PURE__ */ React.createElement(VenueBookingHolderStep, _objectSpread2(_objectSpread2({ ref: holderRef }, holderProps), {}, { afterAssignments: addMoreTickets })), r.step === "extras" && /* @__PURE__ */ React.createElement(VenueExtras, { runtime: r }), r.step === "review" && !reviewAccess.ready && /* @__PURE__ */ React.createElement("div", {
|
|
241
|
+
className: "venue-booking-sales__loading",
|
|
242
|
+
role: "status",
|
|
243
|
+
"aria-label": r.text("Loading checkout", "正在加载确认页面")
|
|
244
|
+
}, /* @__PURE__ */ React.createElement(Spin, null)), r.step === "review" && reviewAccess.ready && /* @__PURE__ */ React.createElement(VenueBookingConfirmation, {
|
|
196
245
|
ref: r.confirmation,
|
|
197
246
|
context: r.context,
|
|
198
247
|
scopeKey: r.scopeKey,
|
|
@@ -62,7 +62,7 @@ function BookingProductDetailModal(props) {
|
|
|
62
62
|
return ui ? session : /* @__PURE__ */ React.createElement(VenueBookingDesignProvider, { lang: props.locale || "en" }, session);
|
|
63
63
|
}
|
|
64
64
|
function DetailSession(props) {
|
|
65
|
-
var _props$configuration$, _props$skuOptions, _props$skuOptions2, _bookingActionAmount, _props$labels$confirm, _props$labels, _configurationFooter
|
|
65
|
+
var _props$configuration$, _props$skuOptions, _props$skuOptions2, _bookingActionAmount, _configurationFooter$, _props$labels$confirm, _props$labels, _configurationFooter$2, _skuPresentation$moda, _getAppearance, _skuPresentation$moda2, _props$skuOptions3, _props$skuOptions4, _props$skuOptions5;
|
|
66
66
|
const ui = useOptionalBookingUI();
|
|
67
67
|
const brandTokens = ui === null || ui === void 0 ? void 0 : ui.brandTokens;
|
|
68
68
|
const [plan] = useState(() => props.plan);
|
|
@@ -203,7 +203,7 @@ function DetailSession(props) {
|
|
|
203
203
|
busy
|
|
204
204
|
};
|
|
205
205
|
const footerContent = typeof props.footerContent === "function" ? props.footerContent(footerContext) : props.footerContent;
|
|
206
|
-
const configurationFooter =
|
|
206
|
+
const configurationFooter = step === "configuration" ? props.configurationFooter : void 0;
|
|
207
207
|
const actionLabel = step === "configuration" ? isTicket ? labels.next : labels.confirmConfiguration : labels.confirmBooking;
|
|
208
208
|
const error = invalid ? labels.invalidPlan : message || props.error;
|
|
209
209
|
const skuType = ((_props$skuOptions = props.skuOptions) === null || _props$skuOptions === void 0 ? void 0 : _props$skuOptions.type) || "flat";
|
|
@@ -232,7 +232,7 @@ function DetailSession(props) {
|
|
|
232
232
|
wide: true,
|
|
233
233
|
className: `${isTicket ? "reservation-modal" : "party-package-dialog"} pisell-booking-product-detail-modal ${props.className || ""}`,
|
|
234
234
|
bodyClassName: `${isTicket ? "reservation-content" : "package-config-body"} pisell-booking-product-detail-body`,
|
|
235
|
-
footerClassName: `${isTicket ? "booking-config-dialog-footer" : "package-config-footer"} pisell-booking-product-detail-footer${isTicket && step === "configuration" ? " pisell-booking-product-detail-options-footer" : ""}${configurationFooter ? " pisell-booking-product-detail-configuration-footer" : ""}`,
|
|
235
|
+
footerClassName: `${isTicket ? "booking-config-dialog-footer" : "package-config-footer"} pisell-booking-product-detail-footer${isTicket && step === "configuration" && !configurationFooter ? " pisell-booking-product-detail-options-footer" : ""}${!isTicket && configurationFooter ? " pisell-booking-product-detail-configuration-footer" : ""}`,
|
|
236
236
|
mobile: "fullscreen",
|
|
237
237
|
bodyRef: setScrollContainer,
|
|
238
238
|
portal,
|
|
@@ -241,9 +241,9 @@ function DetailSession(props) {
|
|
|
241
241
|
style: _objectSpread2(_objectSpread2({}, props.width ? { width: props.width } : {}), props.style),
|
|
242
242
|
intro: steps,
|
|
243
243
|
footer: isTicket ? /* @__PURE__ */ React.createElement(ConfigurationFooter, {
|
|
244
|
-
leading: step === "booking" ? footerContent : void 0,
|
|
245
|
-
label: step === "booking" ? translate(locale, "subtotal") : void 0,
|
|
246
|
-
amount: step === "booking" ? (_bookingActionAmount = props.bookingActionAmount) !== null && _bookingActionAmount !== void 0 ? _bookingActionAmount : "—" : null,
|
|
244
|
+
leading: step === "booking" || configurationFooter ? footerContent : void 0,
|
|
245
|
+
label: step === "booking" ? translate(locale, "subtotal") : configurationFooter === null || configurationFooter === void 0 ? void 0 : configurationFooter.label,
|
|
246
|
+
amount: step === "booking" ? (_bookingActionAmount = props.bookingActionAmount) !== null && _bookingActionAmount !== void 0 ? _bookingActionAmount : "—" : (_configurationFooter$ = configurationFooter === null || configurationFooter === void 0 ? void 0 : configurationFooter.amount) !== null && _configurationFooter$ !== void 0 ? _configurationFooter$ : null,
|
|
247
247
|
action: {
|
|
248
248
|
label: completed ? labels.working : actionLabel,
|
|
249
249
|
compactLabel: completed ? labels.working : step === "booking" ? (_props$labels$confirm = (_props$labels = props.labels) === null || _props$labels === void 0 ? void 0 : _props$labels.confirmBooking) !== null && _props$labels$confirm !== void 0 ? _props$labels$confirm : translate(locale, editing ? "saveTicketsCompact" : "addTicketsCompact") : actionLabel,
|
|
@@ -257,7 +257,7 @@ function DetailSession(props) {
|
|
|
257
257
|
}, error)
|
|
258
258
|
}) : configurationFooter ? /* @__PURE__ */ React.createElement(ConfigurationFooter, {
|
|
259
259
|
leading: footerContent,
|
|
260
|
-
label: (_configurationFooter$ = configurationFooter.label) !== null && _configurationFooter$ !== void 0 ? _configurationFooter$ : translate(locale, "subtotal"),
|
|
260
|
+
label: (_configurationFooter$2 = configurationFooter.label) !== null && _configurationFooter$2 !== void 0 ? _configurationFooter$2 : translate(locale, "subtotal"),
|
|
261
261
|
amount: configurationFooter.amount,
|
|
262
262
|
action: {
|
|
263
263
|
label: completed ? labels.working : actionLabel,
|