@pisell/private-materials 6.12.409 → 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 +11 -11
- package/build/lowcode/view.js +11 -11
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
- package/es/components/bigSale/components/ProductList/index.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/index.js +1 -0
- package/es/components/bigSale/templates/Kiosk/index.js +1 -0
- package/es/components/bigSale/templates/Kiosk/payment/index.js +16 -0
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +9 -3
- package/es/components/checkout/components/PaymentOptionsModule/index.js +10 -2
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
- package/es/components/vendingMachine/README.md +1 -1
- package/es/components/venueBookingSales/VenueExitButton.js +22 -11
- package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +6 -1
- package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +1 -0
- package/es/components/venueBookingSales/checkout/useVenueReviewAccess.js +111 -0
- package/es/components/venueBookingSales/useVenueBookingSteps.js +60 -11
- package/es/index.js +2 -0
- package/es/plus/multiCurrencySettlement/index.js +1 -1
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- 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/saleDetail/Base.js +1 -0
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
- 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/index.js +1 -0
- package/es/plus/salesSdk/index.js +54 -0
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.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 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/bigSale/templates/Kiosk/payment/index.js +16 -0
- 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/VenueExitButton.js +21 -10
- package/lib/components/venueBookingSales/checkout/VenueBookingHolderStep.js +6 -1
- package/lib/components/venueBookingSales/checkout/useVenueReviewAccess.js +112 -0
- package/lib/components/venueBookingSales/useVenueBookingSteps.js +60 -11
- package/package.json +3 -3
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
2
2
|
import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
|
|
3
|
+
import "../../../../plus/salesSdk/index.js";
|
|
3
4
|
import dayjs from "dayjs";
|
|
4
5
|
import { useCallback, useEffect, useState } from "react";
|
|
5
6
|
//#region src/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.ts
|
|
@@ -20,6 +20,7 @@ import { showAddToCartToast } from "../../../../plus/salesSdk/components/showAdd
|
|
|
20
20
|
import { mergeBookingsForDisplay } from "../../../../plus/salesSdk/utils/mergeBookingsForDisplay.js";
|
|
21
21
|
import useSalesSdkGlobalScanHandler from "../../../../plus/salesSdk/hooks/useSalesSdkGlobalScanHandler.js";
|
|
22
22
|
import { useSalesSdkGlobalScanActivity } from "../../../../plus/salesSdk/context/SalesSdkGlobalScanActivityContext.js";
|
|
23
|
+
import "../../../../plus/salesSdk/index.js";
|
|
23
24
|
import { buildBigSaleProductListPreferencesKey, readBigSaleProductListPreferences, readStoredBigSaleProductListPreferences, removeBigSaleProductListPreferences, resolveBigSaleAutoProductListPreferences, writeBigSaleProductListPreferences } from "../../utils/productListPreferences.js";
|
|
24
25
|
import { resolveBigSaleProductDisplayConfig, useBigSaleProductListConfig } from "../../hooks/useBigSaleProductListConfig.js";
|
|
25
26
|
import { showSalesGuardErrorToast } from "../../../../plus/salesSdk/utils/salesGuard.js";
|
|
@@ -5,6 +5,7 @@ import useInitLocalesOnce from "../../../../hooks/useInitLocalesOnce.js";
|
|
|
5
5
|
import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
|
|
6
6
|
import { setBookingTimeSelectionIntent } from "../../../../plus/salesSdk/utils/bookingTimeSelection.js";
|
|
7
7
|
import { useSalesSdkBookingContext } from "../../../../plus/salesSdk/context/SalesSdkBookingContext.js";
|
|
8
|
+
import "../../../../plus/salesSdk/index.js";
|
|
8
9
|
import locales_default from "../../locales/index.js";
|
|
9
10
|
import { getPosWeekStartsOn, resolvePosCountryCode } from "../../../../utils/posDateLocale.js";
|
|
10
11
|
import dayjs from "dayjs";
|
|
@@ -6,6 +6,7 @@ import { buildInitBookingContextParams, collectBookingIdsFromTempOrder } from ".
|
|
|
6
6
|
import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
7
7
|
import { useSalesSdkCart } from "../../plus/salesSdk/hooks/useSalesSdkCart.js";
|
|
8
8
|
import { SalesSdkPrepareOrderSwitchContext, SalesSdkRootRefreshContext } from "../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
9
|
+
import "../../plus/salesSdk/index.js";
|
|
9
10
|
import { isPersistedBigSaleOrderId } from "./utils/orderIdentity.js";
|
|
10
11
|
import { seedDineInReservationToCart } from "../../plus/pisellReservation/utils/seedDineInReservationToCart.js";
|
|
11
12
|
import BigSale from "./index.js";
|
|
@@ -4,6 +4,7 @@ import { useSalesSdkCustomer } from "../../../plus/salesSdk/hooks/useSalesSdkCus
|
|
|
4
4
|
import { useSalesSdkBookingContext } from "../../../plus/salesSdk/context/SalesSdkBookingContext.js";
|
|
5
5
|
import { useSalesSdkSummary } from "../../../plus/salesSdk/hooks/useSalesSdkSummary.js";
|
|
6
6
|
import { useSalesSdkProducts } from "../../../plus/salesSdk/hooks/useSalesSdkProducts.js";
|
|
7
|
+
import "../../../plus/salesSdk/index.js";
|
|
7
8
|
import { useMemo } from "react";
|
|
8
9
|
//#region src/components/bigSale/hooks/useBigSaleContext.ts
|
|
9
10
|
/**
|
|
@@ -3,6 +3,7 @@ import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122
|
|
|
3
3
|
import { buildInitBookingContextParams, collectBookingIdsFromTempOrder } from "../../../plus/salesSdk/utils/buildDefaultLoadProductsParams.js";
|
|
4
4
|
import { useSalesSdkUIHosts } from "../../../plus/salesSdk/context/SalesSdkUIHostsContext.js";
|
|
5
5
|
import { SalesSdkRootRefreshContext } from "../../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
6
|
+
import "../../../plus/salesSdk/index.js";
|
|
6
7
|
import { isPersistedBigSaleOrderId } from "../utils/orderIdentity.js";
|
|
7
8
|
import { resolveOrderIdForHostActions } from "../../../plus/pisellReservation/components/bookingDetailModal/bookingDetailHostActions.js";
|
|
8
9
|
import { usePicoCodingOpenData } from "../../../plus/pisellReservation/hooks/usePicoCodingOpenData.js";
|
|
@@ -8,6 +8,7 @@ import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
|
8
8
|
import { useSalesSdkCustomer } from "../../plus/salesSdk/hooks/useSalesSdkCustomer.js";
|
|
9
9
|
import { SalesSdkProvider } from "../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
10
10
|
import { SalesSdkBookingContextProvider } from "../../plus/salesSdk/context/SalesSdkBookingContext.js";
|
|
11
|
+
import "../../plus/salesSdk/index.js";
|
|
11
12
|
import { resolveKioskPlatformSource, resolveKioskPresentation } from "../kioskSale/resolveKioskPresentation.js";
|
|
12
13
|
import { resolveCustomerDetailAppearance } from "../../pro/skuDetailModal/customerDetailPolicy.js";
|
|
13
14
|
import { ResponsiveBigSaleBase } from "./Base.js";
|
|
@@ -13,6 +13,7 @@ import { useSalesSdkBusinessAvailability } from "../../../../plus/salesSdk/conte
|
|
|
13
13
|
import { collectUnassignedHolderLines } from "../../../../plus/salesSdk/utils/holderSubmitValidation.js";
|
|
14
14
|
import { isFulfillmentTimingBooking } from "../../../../plus/salesSdk/utils/fulfillmentTimingBooking.js";
|
|
15
15
|
import { useSalesSdkGlobalScanActivity } from "../../../../plus/salesSdk/context/SalesSdkGlobalScanActivityContext.js";
|
|
16
|
+
import "../../../../plus/salesSdk/index.js";
|
|
16
17
|
import { usePickSaleDetailContext } from "../../hooks/usePickSaleDetailContext.js";
|
|
17
18
|
import { resolveBigSaleAutoProductListPreferences } from "../../utils/productListPreferences.js";
|
|
18
19
|
import { resolveBigSaleProductDisplayConfig } from "../../hooks/useBigSaleProductListConfig.js";
|
|
@@ -36,6 +36,8 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
36
36
|
const normalizedChannel = String(channel || "").trim().toLowerCase();
|
|
37
37
|
const toast = useToast();
|
|
38
38
|
const runtimeRef = useRef(null);
|
|
39
|
+
const paymentOptionsRef = useRef(null);
|
|
40
|
+
const autoPaymentAttemptedRef = useRef(false);
|
|
39
41
|
const preparationRef = useRef(checkoutPreparation);
|
|
40
42
|
const mountedRef = useRef(true);
|
|
41
43
|
const stateRef = useRef(hasUnresolvedDevicePayment(baseSales) ? "uncertain" : "idle");
|
|
@@ -139,6 +141,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
139
141
|
if (stateRef.current !== "idle" || !runtimeRef.current) return;
|
|
140
142
|
const method = methods.find((item) => String(item.id) === String(selected.id));
|
|
141
143
|
if (!method) return;
|
|
144
|
+
autoPaymentAttemptedRef.current = true;
|
|
142
145
|
transition("paying");
|
|
143
146
|
try {
|
|
144
147
|
var _utils$businessUtils2, _utils$businessUtils3;
|
|
@@ -176,6 +179,17 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
176
179
|
return _ref2.apply(this, arguments);
|
|
177
180
|
};
|
|
178
181
|
}());
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (!["vending", "kiosk"].includes(normalizedChannel) || !ready || amount === void 0 || amount <= 0 || methods.length !== 1 || state !== "idle" || autoPaymentAttemptedRef.current || !paymentOptionsRef.current) return;
|
|
184
|
+
autoPaymentAttemptedRef.current = true;
|
|
185
|
+
paymentOptionsRef.current.activateSinglePaymentMethod();
|
|
186
|
+
}, [
|
|
187
|
+
normalizedChannel,
|
|
188
|
+
ready,
|
|
189
|
+
amount,
|
|
190
|
+
methods,
|
|
191
|
+
state
|
|
192
|
+
]);
|
|
179
193
|
const retrySync = useMemoizedFn(_asyncToGenerator(function* () {
|
|
180
194
|
if (stateRef.current !== "sync-failed" || !retryRef.current) return;
|
|
181
195
|
const retry = retryRef.current;
|
|
@@ -203,6 +217,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
203
217
|
const beginAuthorization = useMemoizedFn((_source) => {
|
|
204
218
|
var _globalThis$crypto, _globalThis$crypto$ra;
|
|
205
219
|
if (stateRef.current !== "idle") return null;
|
|
220
|
+
autoPaymentAttemptedRef.current = true;
|
|
206
221
|
if (!authorizationAvailableRef.current) {
|
|
207
222
|
toast.fail(locales.getText("pisell2.checkout.self-service.empty"));
|
|
208
223
|
return null;
|
|
@@ -316,6 +331,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
316
331
|
}
|
|
317
332
|
}
|
|
318
333
|
}, /* @__PURE__ */ React.createElement(PaymentOptionsModule, {
|
|
334
|
+
ref: paymentOptionsRef,
|
|
319
335
|
appearance: "self-service",
|
|
320
336
|
orderInfo: { remainingAmount: String(amount !== null && amount !== void 0 ? amount : 0) },
|
|
321
337
|
paymentMethods: methods,
|
|
@@ -13,7 +13,7 @@ import { Iconfont } from "@pisell/materials";
|
|
|
13
13
|
import classNames from "classnames";
|
|
14
14
|
import "./index.less";
|
|
15
15
|
//#region src/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.tsx
|
|
16
|
-
const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, customAmount, disabled = false, onClick, getText, size = "default", surchargeDisplay, directCustomPayment = false, beginKioskPaymentActivity, currentBaseSales })
|
|
16
|
+
const PaymentMethodItem = React.forwardRef(function PaymentMethodItem({ appearance = "default", method, amountSymbol, customAmount, disabled = false, onClick, getText, size = "default", surchargeDisplay, directCustomPayment = false, beginKioskPaymentActivity, currentBaseSales }, ref) {
|
|
17
17
|
var _context$appHelper;
|
|
18
18
|
const context = useEngineContext();
|
|
19
19
|
const { getData, getApp } = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
@@ -162,6 +162,12 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
162
162
|
return _ref.apply(this, arguments);
|
|
163
163
|
};
|
|
164
164
|
}();
|
|
165
|
+
const activate = () => {
|
|
166
|
+
if (disabled) return;
|
|
167
|
+
if (appearance === "self-service" && isEftpos) submitCurrentAmount();
|
|
168
|
+
else showKeyboard();
|
|
169
|
+
};
|
|
170
|
+
React.useImperativeHandle(ref, () => ({ activate }));
|
|
165
171
|
const renderLeftContent = () => /* @__PURE__ */ React.createElement("div", { className: classNames("payment-options-module-payment-method-left") }, appearance === "self-service" ? renderPaymentIcon(method) : /* @__PURE__ */ React.createElement("div", { className: classNames("payment-options-module-icon-container") }, renderPaymentIcon(method)), /* @__PURE__ */ React.createElement("div", { className: classNames("payment-options-module-payment-info") }, /* @__PURE__ */ React.createElement("div", { className: classNames("payment-options-module-payment-info-inner") }, /* @__PURE__ */ React.createElement("div", { className: classNames("payment-options-module-payment-name") }, method.name), /* @__PURE__ */ React.createElement("div", { className: classNames("payment-options-module-payment-info-inner-surcharge") }, !!(displaySurchargeConfig === null || displaySurchargeConfig === void 0 ? void 0 : displaySurchargeConfig.is_surcharge) && calculateSurcharge(displaySurchargeConfig) !== 0 && /* @__PURE__ */ React.createElement("div", { className: classNames("payment-options-module-surcharge-text") }, (getText === null || getText === void 0 ? void 0 : getText("pisell2.payment-options.surcharge-label", "Surcharge")) || "Surcharge", ":", formatAmount(calculateSurcharge(displaySurchargeConfig), 2, amountSymbol)), false))));
|
|
166
172
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", {
|
|
167
173
|
className: classNames("payment-options-module-payment-method-item", {
|
|
@@ -169,7 +175,7 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
169
175
|
"payment-options-module-disabled": disabled
|
|
170
176
|
}),
|
|
171
177
|
style: appearance === "self-service" ? void 0 : { height: size === "large" ? "82px" : "62px" },
|
|
172
|
-
onClick:
|
|
178
|
+
onClick: activate,
|
|
173
179
|
type: "button",
|
|
174
180
|
disabled
|
|
175
181
|
}, renderLeftContent(), appearance === "self-service" ? /* @__PURE__ */ React.createElement("span", {
|
|
@@ -221,6 +227,6 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
229
|
}));
|
|
224
|
-
};
|
|
230
|
+
});
|
|
225
231
|
//#endregion
|
|
226
232
|
export { PaymentMethodItem as default };
|
|
@@ -10,7 +10,7 @@ import classNames from "classnames";
|
|
|
10
10
|
import { useDebounceFn } from "ahooks";
|
|
11
11
|
import "./index.less";
|
|
12
12
|
//#region src/components/checkout/components/PaymentOptionsModule/index.tsx
|
|
13
|
-
function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo, onClick, paymentMethods = [], customAmount, title, disabled = false, showCashPayment = false, channel = "pos", columnCount, sciSurchargeDisplayMap = {}, directCustomPayment = false, isModalOpen = false, paymentMethodsReady = false, autoTriggerSinglePaymentOption = false, beginKioskPaymentActivity, currentBaseSales }) {
|
|
13
|
+
const PaymentOptionsModule = React.forwardRef(function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo, onClick, paymentMethods = [], customAmount, title, disabled = false, showCashPayment = false, channel = "pos", columnCount, sciSurchargeDisplayMap = {}, directCustomPayment = false, isModalOpen = false, paymentMethodsReady = false, autoTriggerSinglePaymentOption = false, beginKioskPaymentActivity, currentBaseSales }, ref) {
|
|
14
14
|
var _context$appHelper, _context$appHelper$ge, _context$appHelper$ge2, _context$appHelper$ut;
|
|
15
15
|
const context = useEngineContext();
|
|
16
16
|
useInitLocalesOnce(locales_default, ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getApp) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.call(_context$appHelper)) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.locales) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge2 = _context$appHelper$ge.getLocale) === null || _context$appHelper$ge2 === void 0 ? void 0 : _context$appHelper$ge2.call(_context$appHelper$ge)) || ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get("umi_locale")) || "en");
|
|
@@ -24,6 +24,13 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
24
24
|
const normalizedChannel = String(channel || "pos").trim().toLowerCase();
|
|
25
25
|
const resolvedColumnCount = columnCount !== null && columnCount !== void 0 ? columnCount : showCashPayment ? 1 : 2;
|
|
26
26
|
const filteredPaymentMethods = React.useMemo(() => filterPaymentMethodsForChannel(paymentMethods, normalizedChannel), [normalizedChannel, paymentMethods]);
|
|
27
|
+
const singleMethodRef = React.useRef(null);
|
|
28
|
+
React.useImperativeHandle(ref, () => ({ activateSinglePaymentMethod: () => {
|
|
29
|
+
if (!disabled && filteredPaymentMethods.length === 1) {
|
|
30
|
+
var _singleMethodRef$curr;
|
|
31
|
+
(_singleMethodRef$curr = singleMethodRef.current) === null || _singleMethodRef$curr === void 0 || _singleMethodRef$curr.activate();
|
|
32
|
+
}
|
|
33
|
+
} }));
|
|
27
34
|
const { run: handlePaymentClick } = useDebounceFn((method) => {
|
|
28
35
|
if (disabled) return;
|
|
29
36
|
if (typeof onClick === "function") onClick(method);
|
|
@@ -59,6 +66,7 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
59
66
|
paymentMethodsReady
|
|
60
67
|
]);
|
|
61
68
|
const methodItems = filteredPaymentMethods.map((method) => /* @__PURE__ */ React.createElement(PaymentMethodItem, {
|
|
69
|
+
ref: filteredPaymentMethods.length === 1 ? singleMethodRef : void 0,
|
|
62
70
|
appearance,
|
|
63
71
|
size: filteredPaymentMethods.length === 2 ? "large" : "default",
|
|
64
72
|
key: method.id,
|
|
@@ -90,6 +98,6 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
90
98
|
paddingBottom: 8
|
|
91
99
|
}
|
|
92
100
|
}, methodItems)));
|
|
93
|
-
}
|
|
101
|
+
});
|
|
94
102
|
//#endregion
|
|
95
103
|
export { PaymentOptionsModule as default };
|
|
@@ -2,6 +2,7 @@ import useEngineContext from "../../hooks/useEngineContext.js";
|
|
|
2
2
|
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
4
4
|
import { TEMP_ORDER_SYNC_REQUEST_MESSAGE_TYPE, getTempOrderSyncPayload, shouldApplySharedTempOrderPayload } from "../../plus/salesSdk/tempOrderSync.js";
|
|
5
|
+
import "../../plus/salesSdk/index.js";
|
|
5
6
|
import { useEffect, useRef, useState } from "react";
|
|
6
7
|
//#region src/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.tsx
|
|
7
8
|
function createRequestId() {
|
|
@@ -78,7 +78,7 @@ Home 的 Redeem Socks 入口打开独立 `RedeemPage`,展示扫码指引、扫
|
|
|
78
78
|
- 购物车在 Order 的通用 `onBeforeCartCommit` 入口校验原始规则算出的草稿,不维护另一套订单合并规则;库存异常时允许减少/删除,禁止增加。未注入扩展的业务沿用既有库存与销售规则。
|
|
79
79
|
- 普通与 0 元结账都经过 SalesSdk `prepareCheckout`。本次准备凭据携带不可变 `checkoutSnapshot` 并校验提交前购物车是否变化;正常支付完成或确认完成的 0 元订单再通过 `onPaidCheckout` 交给宿主。库存请求与设备规则不写入 Kiosk 模板。
|
|
80
80
|
- 设备端购物车与支付页共用 `resolveKioskPresentation` 的 `self-service` 外观。Kiosk/Vending 待付金额大于 0 时进入 Kiosk 自身的 `payment` 页面,由 `Kiosk/payment` 负责控制,不经过 SalesSdk `openCheckout`、宿主 PaymentModalPlugin 或 PaymentModal。H5、PC 和 POS 继续使用既有支付入口;设备页的外观不再跨 SDK/宿主透传。
|
|
81
|
-
- 独立页复用公共 `PaymentMethodRuntime`、pending 支付生命周期和 BaseSales 订单 API,直接使用当前购物车/钱包。支付方式按实际 `channel` 和宿主终端偏好筛选,Vending
|
|
81
|
+
- 独立页复用公共 `PaymentMethodRuntime`、pending 支付生命周期和 BaseSales 订单 API,直接使用当前购物车/钱包。支付方式按实际 `channel` 和宿主终端偏好筛选,Vending 排除标准及自定义现金方式,也不开钱箱。Vending 与 Kiosk 支付页在方式加载及筛选完成、待付金额大于 0 且只有一种可用方式时,自动执行一次该支付卡片的操作;取消、失败或部分支付后不再次自动触发,可手动重试,退出后重新进入支付页可再次自动触发。付款结果待确认时锁定操作,已收款后的失败只重试订单同步。Kiosk 自定义支付的自动和手动入口均请求主屏授权并等候结果,不在本机直接记为已付。
|
|
82
82
|
- 仅 Vending 支付页优先复用首页初始化销售模块时已准备的支付方式;读取的是 BaseSales 当前镜像,由其原有配置变更事件更新。镜像缺失/为空时保留异步加载兜底,宿主显示偏好、排序及禁用现金规则仍每次应用。普通 Kiosk 保留原有支付方式加载路径。设备配置缓存及其失效由宿主管理,结账库存刷新和设备状态预检保持实时执行。
|
|
83
83
|
- 付款页面期间锁住销售扫码并暂停屏保,返回购物车保留原订单与券;只有明确足额支付并同步成功后,才冻结订单及原 checkoutSnapshot,再进入现有成功/出货交接。0 元仍使用原有直接确认流程,不进入支付方式页。
|
|
84
84
|
- 隐藏零元金额和显示 Confirm 由 Vending 平台决定,不依赖 `renderCatalog` 是否存在;自定义列表本身不改变其它 Kiosk/H5/PC 的金额展示规则。
|
|
@@ -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
|
}
|
|
@@ -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) => {
|
|
@@ -7,6 +7,7 @@ import { useSalesSdkHostBridges } from "../../../plus/salesSdk/context/SalesSdkH
|
|
|
7
7
|
import { isVirtualSettlementTempOrder } from "../../../plus/multiCurrencySettlement/index.js";
|
|
8
8
|
import { freePayApi } from "../../Sales/Checkout/serve.js";
|
|
9
9
|
import { useSalesSdkBusinessAvailability } from "../../../plus/salesSdk/context/SalesSdkBusinessAvailabilityContext.js";
|
|
10
|
+
import "../../../plus/salesSdk/index.js";
|
|
10
11
|
import { isSalesOrderSubmitSuccess } from "../../../plus/saleDetail/components/DetailActions/utils.js";
|
|
11
12
|
import { isH5ZeroAmountValue, resolveKioskSubmittedPayableAmount, toFiniteKioskAmount } from "../../bigSale/templates/Kiosk/zeroAmountCheckout.js";
|
|
12
13
|
import { resolveKioskDeferredSubmission } from "../../bigSale/templates/Kiosk/deferredCheckout.js";
|
|
@@ -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 };
|
|
@@ -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,
|
package/es/index.js
CHANGED
|
@@ -90,6 +90,7 @@ import { useSalesSdkProducts } from "./plus/salesSdk/hooks/useSalesSdkProducts.j
|
|
|
90
90
|
import SalesSdkDemo from "./plus/salesSdk/demo/index.js";
|
|
91
91
|
import { useSalesSdkDish } from "./plus/salesSdk/hooks/useSalesSdkDish.js";
|
|
92
92
|
import { useSyncOsModule } from "./plus/salesSdk/hooks/useSyncOsModule.js";
|
|
93
|
+
import "./plus/salesSdk/index.js";
|
|
93
94
|
import BigSaleRightActionPanel from "./components/BigSaleRightActionPanel/index.js";
|
|
94
95
|
import ResponsiveWrapper from "./components/list/ResponsiveWrapper.js";
|
|
95
96
|
import { resolveBigSaleSelectionFlowConfig } from "./components/bigSale/selectionFlowConfig.js";
|
|
@@ -153,6 +154,7 @@ import PisellVenueControlPage from "./plus/pisellReservation/PisellVenueControlP
|
|
|
153
154
|
import PisellVenueWallPage from "./plus/pisellReservation/PisellVenueWallPage.js";
|
|
154
155
|
import PisellReservationTablePage from "./plus/pisellReservation/PisellReservationTablePage.js";
|
|
155
156
|
import SelectFloorMapResourceDialog from "./plus/pisellReservation/components/SelectFloorMapResourceDialog.js";
|
|
157
|
+
import "./plus/pisellReservation/index.js";
|
|
156
158
|
import { PisellTopology, PisellTopologyCore } from "./plus/pisellTopology/PisellTopology.js";
|
|
157
159
|
import cupProject_default from "./components/ecocup/cupProject/index.js";
|
|
158
160
|
import CupList from "./components/ecocup/cupList/index.js";
|
|
@@ -280,4 +280,4 @@ function attachSelectedSettlement(item, selectedSettlement) {
|
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
|
-
export { attachSelectedSettlement, buildSettlementPriceRows, createVirtualOnlySkuDisplayProduct, formatSettlementAmount, formatSettlementSelectionTotal, formatTempOrderSettlementAmount, getSettlementKey, getSettlementOptions, hasSettlementOptions, hasSufficientVirtualCurrencyBalance, isVirtualOnlySettlementProduct, isVirtualSettlementTempOrder, resolveConfiguredUnavailableReason, resolveLegalSettlementAddOnUnitPrice, resolveSettlementOptionEntries, resolveVirtualSettlementErrorMessage, showVirtualSettlementErrorToast };
|
|
283
|
+
export { attachSelectedSettlement, buildSettlementPriceRows, createVirtualOnlySkuDisplayProduct, findFirstVirtualCurrencyAsset, formatSettlementAmount, formatSettlementSelectionTotal, formatTempOrderSettlementAmount, getReservedVirtualSettlementAmount, getSettlementKey, getSettlementOptions, hasSettlementOptions, hasSufficientVirtualCurrencyBalance, isVirtualOnlySettlementProduct, isVirtualSettlementTempOrder, resolveConfiguredUnavailableReason, resolveLegalSettlementAddOnUnitPrice, resolveSettlementOptionEntries, resolveVirtualSettlementErrorMessage, showVirtualSettlementErrorToast };
|