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