@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
|
@@ -259,4 +259,4 @@ function bookingListToReservationTableRows(bookings) {
|
|
|
259
259
|
return rows;
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
|
-
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds, hostBookingUiPatchFromRecord, mergeBookingsForResourceRecord };
|
|
262
|
+
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds, hostBookingStatusToCardStatus, hostBookingUiPatchFromRecord, mergeBookingsForResourceRecord };
|
|
@@ -78,4 +78,4 @@ function toastFloorPlanLoadError(err) {
|
|
|
78
78
|
PisellToast({ content: err instanceof Error ? err.message : String(err) });
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
-
export { PISELL_RESERVATION_FLOOR_PLAN_CODE, ensureShopFloorPlanByCode, saveViewConfigToShopFloorPlan, shopLayoutToSceneElements$1 as shopLayoutToSceneElements, toastFloorPlanLoadError, toastFloorPlanSaveError, unsubscribeShopFloorPlanCodeQuery };
|
|
81
|
+
export { PISELL_RESERVATION_FLOOR_PLAN_CODE, buildDefaultReservationFloorPlanPostBody, ensureShopFloorPlanByCode, putShopFloorPlan, saveViewConfigToShopFloorPlan, shopLayoutToSceneElements$1 as shopLayoutToSceneElements, toastFloorPlanLoadError, toastFloorPlanSaveError, unsubscribeShopFloorPlanCodeQuery };
|
|
@@ -927,4 +927,4 @@ function getReservationDataSourceFormColumns() {
|
|
|
927
927
|
];
|
|
928
928
|
}
|
|
929
929
|
//#endregion
|
|
930
|
-
export { RESERVATION_BOUND_ROUND_TABLE_ELEMENT_KIND, RESERVATION_BOUND_TABLE_ELEMENT_KIND, applyReservationFloorMapLiveLabels, defaultReservationTableRows, getDefaultReservationFloorMapConfig, getReservationDataSourceFormColumns, getReservationFloorMapShellConfig, mergeFloorMapElementKindCategoriesWithDefaults, mergeFloorMapElementKindsWithDefaults };
|
|
930
|
+
export { RESERVATION_BOUND_ROUND_TABLE_ELEMENT_KIND, RESERVATION_BOUND_TABLE_ELEMENT_KIND, applyReservationFloorMapLiveLabels, defaultReservationSceneElements, defaultReservationTableRows, getDefaultReservationFloorMapConfig, getReservationDataSourceFormColumns, getReservationFloorMapShellConfig, mergeFloorMapElementKindCategoriesWithDefaults, mergeFloorMapElementKindsWithDefaults };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./serve/formResourcePage.js";
|
|
2
|
+
import "./floorRoomCard/mapRowToFloorRoomCardData.js";
|
|
3
|
+
import "./floorRoomCard/ReservationFloorRoomCard.js";
|
|
4
|
+
import "./floorMap/reservationMock.js";
|
|
5
|
+
import "./floorMap/floorPlanApi.js";
|
|
6
|
+
import "./reservationConstants.js";
|
|
7
|
+
import "./data/bookingToReservationTables.js";
|
|
8
|
+
import "./data/formResourceToReservationTables.js";
|
|
9
|
+
import "./data/salesEmbeddedResourceToTableRows.js";
|
|
10
|
+
import "./floorMap/reservationCards.js";
|
|
11
|
+
import "./PisellReservation.js";
|
|
12
|
+
import "./PisellReservationBookingPage.js";
|
|
13
|
+
import "./PisellVenueControlPage.js";
|
|
14
|
+
import "./PisellVenueWallPage.js";
|
|
15
|
+
import "./PisellReservationTablePage.js";
|
|
16
|
+
import "./components/SelectFloorMapResourceDialog.js";
|
|
17
|
+
export {};
|
|
@@ -13,6 +13,7 @@ import { useSalesSdkCustomer } from "../salesSdk/hooks/useSalesSdkCustomer.js";
|
|
|
13
13
|
import locales_default from "./locales.js";
|
|
14
14
|
import { useSalesSdkBookingContext } from "../salesSdk/context/SalesSdkBookingContext.js";
|
|
15
15
|
import { useSalesSdkSummary } from "../salesSdk/hooks/useSalesSdkSummary.js";
|
|
16
|
+
import "../salesSdk/index.js";
|
|
16
17
|
import locales_default$1 from "./components/LineItem/locales.js";
|
|
17
18
|
import { SaleOrderActionBoundary } from "./actions/index.js";
|
|
18
19
|
import { SaleDetailTemplateRenderer } from "./tmpl/index.js";
|
|
@@ -2,6 +2,7 @@ import useEngineContext from "../../../../../hooks/useEngineContext.js";
|
|
|
2
2
|
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
3
3
|
import { resolveContactsInfo } from "../utils.js";
|
|
4
4
|
import { useSalesSdkBookingContext } from "../../../../salesSdk/context/SalesSdkBookingContext.js";
|
|
5
|
+
import "../../../../salesSdk/index.js";
|
|
5
6
|
import { useMemo } from "react";
|
|
6
7
|
import { useMemoizedFn } from "ahooks";
|
|
7
8
|
//#region src/plus/saleDetail/components/Client/hooks/useClientSelectorProps.ts
|
|
@@ -4,6 +4,7 @@ import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.
|
|
|
4
4
|
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
|
|
5
5
|
import useLogger from "../../../../hooks/useLogger.js";
|
|
6
6
|
import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
|
|
7
|
+
import "../../../salesSdk/index.js";
|
|
7
8
|
import { invokeLocalReceiptPrint, resolveLocalReceiptPrintModule, resolveSaleDetailOrderIdFromSales } from "./utils.js";
|
|
8
9
|
import { getRemotePrintActions, getWristbandList } from "../../serve.js";
|
|
9
10
|
import { EBizPrintType } from "./types.js";
|
|
@@ -10,6 +10,7 @@ import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
|
|
|
10
10
|
import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
|
|
11
11
|
import { useSalesSdkGlobalScanActivity } from "../../../salesSdk/context/SalesSdkGlobalScanActivityContext.js";
|
|
12
12
|
import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
|
|
13
|
+
import "../../../salesSdk/index.js";
|
|
13
14
|
import { resolveSaleDetailTempOrder } from "../../utils.js";
|
|
14
15
|
import { getNumericAmount, getSalesHostModule, resolveSaleDetailOrderIdFromSales, resolveSaleDetailOrderIdFromSalesResult, shouldCloseDialogAfterCheckout, updateLocalOrder } from "./utils.js";
|
|
15
16
|
import { deriveSaleOrderSubmitState } from "../../actions/state.js";
|
|
@@ -5,6 +5,7 @@ import { isAppliedPaymentRecord } from "../../../salesSdk/utils/paymentStatus.js
|
|
|
5
5
|
import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
|
|
6
6
|
import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
|
|
7
7
|
import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
|
|
8
|
+
import "../../../salesSdk/index.js";
|
|
8
9
|
import { resolveSaleDetailTempOrder } from "../../utils.js";
|
|
9
10
|
import React, { memo, useMemo } from "react";
|
|
10
11
|
import { formatAmount, locales } from "@pisell/utils";
|
|
@@ -5,6 +5,7 @@ import { useSalesSdk } from "../salesSdk/hooks/useSalesSdk.js";
|
|
|
5
5
|
import { SalesSdkProvider } from "../salesSdk/context/SalesSdkProvider.js";
|
|
6
6
|
import { SalesSdkDishProvider } from "../salesSdk/context/SalesSdkDishContext.js";
|
|
7
7
|
import { SalesSdkBookingContextProvider } from "../salesSdk/context/SalesSdkBookingContext.js";
|
|
8
|
+
import "../salesSdk/index.js";
|
|
8
9
|
import Base_default from "./Base.js";
|
|
9
10
|
import { resolveSaleDetailOsProps } from "./osProps.js";
|
|
10
11
|
import React, { forwardRef, useImperativeHandle } from "react";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import useStableInstanceId from "../../../../../../hooks/useStableInstanceId.js";
|
|
2
2
|
import { useSalesSdkDish } from "../../../../../salesSdk/hooks/useSalesSdkDish.js";
|
|
3
3
|
import { useCurrentSalesSdkDish } from "../../../../../salesSdk/hooks/useCurrentSalesSdkDish.js";
|
|
4
|
+
import "../../../../../salesSdk/index.js";
|
|
4
5
|
import { SaleDetailStatusOverview } from "../shared/StatusOverview.js";
|
|
5
6
|
import { DishGroupView } from "./DishGroupView.js";
|
|
6
7
|
import dayjs from "dayjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
2
2
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
3
3
|
import { useCurrentSalesSdkDish } from "../../../salesSdk/hooks/useCurrentSalesSdkDish.js";
|
|
4
|
+
import "../../../salesSdk/index.js";
|
|
4
5
|
import { getInternalNotesByScheduleEvent } from "../../serve.js";
|
|
5
6
|
import { TEMPLATE_B_PAY_ACTIONS, TEMPLATE_B_SUMMARY_ACTIONS } from "../../components/DetailActions/configs/index.js";
|
|
6
7
|
import { DetailActions } from "../../components/DetailActions/index.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import "./hosts/createInstanceHostBridge.js";
|
|
2
|
+
import "./holderConfirm/createHolderConfirmBridge.js";
|
|
3
|
+
import "./giftSelect/createGiftSelectBridge.js";
|
|
4
|
+
import "./context/SalesSdkHostBridgesContext.js";
|
|
5
|
+
import "./utils/formatHolderOptions.js";
|
|
6
|
+
import "./utils/enrichCartLineHolderDisplay.js";
|
|
7
|
+
import "./context/SalesSdkHolderContext.js";
|
|
8
|
+
import "../multiCurrencySettlement/index.js";
|
|
9
|
+
import "./utils/customerAuthGate.js";
|
|
10
|
+
import "./context/SalesSdkBusinessAvailabilityContext.js";
|
|
11
|
+
import "./utils/appendPromotionTags.js";
|
|
12
|
+
import "./utils/productSkuOptions.js";
|
|
13
|
+
import "./context/SalesSdkUIHostsContext.js";
|
|
14
|
+
import "./utils/runAddProductFlow.js";
|
|
15
|
+
import "./components/showAddToCartToast.js";
|
|
16
|
+
import "./utils/resolveAddProductDebounceKey.js";
|
|
17
|
+
import "./utils/identity.js";
|
|
18
|
+
import "./utils/resolveInCartQuantityForAddToast.js";
|
|
19
|
+
import "./utils/addProductWithFlowDebounced.js";
|
|
20
|
+
import "./utils/bookingDate.js";
|
|
21
|
+
import "./utils/holderSubmitValidation.js";
|
|
22
|
+
import "./utils/removeOrderProducts.js";
|
|
23
|
+
import "./selectors.js";
|
|
24
|
+
import "./utils/enrich.js";
|
|
25
|
+
import "./giftSelect/createOpenGiftSelectHost.js";
|
|
26
|
+
import "./utils/ensureHoldersBeforeSubmit.js";
|
|
27
|
+
import "./hooks/useSalesSdk.js";
|
|
28
|
+
import "./bookingEditService/BookingEditServiceDrawer.js";
|
|
29
|
+
import "./hosts/BookingEditHostRenderer.js";
|
|
30
|
+
import "./hosts/CustomerAuthHostRenderer.js";
|
|
31
|
+
import "./hooks/useSalesSdkCart.js";
|
|
32
|
+
import "./hooks/useSalesSdkCustomer.js";
|
|
33
|
+
import "./normalProductDetail/NormalProductDetailHostRenderer.js";
|
|
34
|
+
import "./hosts/createOpenBookingEditHost.js";
|
|
35
|
+
import "./hosts/createOpenMultiDaySelectHost.js";
|
|
36
|
+
import "./hosts/createOpenHolderSelectHost.js";
|
|
37
|
+
import "./hosts/createOpenCustomerAuthHost.js";
|
|
38
|
+
import "./demo/hosts/legacyOpenProductDetail.js";
|
|
39
|
+
import "./hosts/createCompositeOpenProductDetailHost.js";
|
|
40
|
+
import "./normalProductDetail/createOpenNormalProductDetailHost.js";
|
|
41
|
+
import "./normalProductDetail/createOpenBookingSelectionFlowHost.js";
|
|
42
|
+
import "./giftSelect/GiftSelectModal.js";
|
|
43
|
+
import "./giftSelect/GiftSelectHostRenderer.js";
|
|
44
|
+
import "./allergy/AllergySelectionModal.js";
|
|
45
|
+
import "./context/SalesSdkProvider.js";
|
|
46
|
+
import "./context/SalesSdkDishContext.js";
|
|
47
|
+
import "./context/SalesSdkBookingContext.js";
|
|
48
|
+
import "./hooks/useSalesSdkSummary.js";
|
|
49
|
+
import "./hooks/useSalesSdkProducts.js";
|
|
50
|
+
import "./demo/index.js";
|
|
51
|
+
import "./hooks/useSalesSdkDish.js";
|
|
52
|
+
import "./hooks/useCurrentSalesSdkDish.js";
|
|
53
|
+
import "./hooks/useSyncOsModule.js";
|
|
54
|
+
export {};
|
|
@@ -31,4 +31,4 @@ function subscribeBookingDateChange(bookingTicket, callback) {
|
|
|
31
31
|
return typeof off === "function" ? off : () => {};
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
-
export { formatBookingDateTime, subscribeBookingDateChange };
|
|
34
|
+
export { BOOKING_CONTEXT_DATE_EVENT, formatBookingDateTime, subscribeBookingDateChange };
|
|
@@ -102,4 +102,4 @@ function buildHolderListRequestKey(params) {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
//#endregion
|
|
105
|
-
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, resolveHolderDisplayConfig };
|
|
105
|
+
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, pickHolderIdFromBooking, resolveHolderDisplayConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthMethodType, VerificationMethod } from "./shared/types.js";
|
|
1
|
+
import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
|
|
2
2
|
import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
|
|
3
3
|
import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
|
|
4
|
-
import { AuthModal
|
|
4
|
+
import { AuthModal } from "./AuthModal.js";
|
|
@@ -226,4 +226,4 @@ interface RegisterFormData {
|
|
|
226
226
|
verification_token?: string;
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
|
-
export { AuthMethodType, EmailAuthConfig, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
|
|
229
|
+
export { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
|
|
@@ -38,6 +38,8 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
38
38
|
const normalizedChannel = String(channel || "").trim().toLowerCase();
|
|
39
39
|
const toast = (0, _pisell_materials.useToast)();
|
|
40
40
|
const runtimeRef = (0, react.useRef)(null);
|
|
41
|
+
const paymentOptionsRef = (0, react.useRef)(null);
|
|
42
|
+
const autoPaymentAttemptedRef = (0, react.useRef)(false);
|
|
41
43
|
const preparationRef = (0, react.useRef)(checkoutPreparation);
|
|
42
44
|
const mountedRef = (0, react.useRef)(true);
|
|
43
45
|
const stateRef = (0, react.useRef)(require_transaction.hasUnresolvedDevicePayment(baseSales) ? "uncertain" : "idle");
|
|
@@ -141,6 +143,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
141
143
|
if (stateRef.current !== "idle" || !runtimeRef.current) return;
|
|
142
144
|
const method = methods.find((item) => String(item.id) === String(selected.id));
|
|
143
145
|
if (!method) return;
|
|
146
|
+
autoPaymentAttemptedRef.current = true;
|
|
144
147
|
transition("paying");
|
|
145
148
|
try {
|
|
146
149
|
var _utils$businessUtils2, _utils$businessUtils3;
|
|
@@ -178,6 +181,17 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
178
181
|
return _ref2.apply(this, arguments);
|
|
179
182
|
};
|
|
180
183
|
}());
|
|
184
|
+
(0, react.useEffect)(() => {
|
|
185
|
+
if (!["vending", "kiosk"].includes(normalizedChannel) || !ready || amount === void 0 || amount <= 0 || methods.length !== 1 || state !== "idle" || autoPaymentAttemptedRef.current || !paymentOptionsRef.current) return;
|
|
186
|
+
autoPaymentAttemptedRef.current = true;
|
|
187
|
+
paymentOptionsRef.current.activateSinglePaymentMethod();
|
|
188
|
+
}, [
|
|
189
|
+
normalizedChannel,
|
|
190
|
+
ready,
|
|
191
|
+
amount,
|
|
192
|
+
methods,
|
|
193
|
+
state
|
|
194
|
+
]);
|
|
181
195
|
const retrySync = (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
182
196
|
if (stateRef.current !== "sync-failed" || !retryRef.current) return;
|
|
183
197
|
const retry = retryRef.current;
|
|
@@ -205,6 +219,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
205
219
|
const beginAuthorization = (0, ahooks.useMemoizedFn)((_source) => {
|
|
206
220
|
var _globalThis$crypto, _globalThis$crypto$ra;
|
|
207
221
|
if (stateRef.current !== "idle") return null;
|
|
222
|
+
autoPaymentAttemptedRef.current = true;
|
|
208
223
|
if (!authorizationAvailableRef.current) {
|
|
209
224
|
toast.fail(_pisell_utils.locales.getText("pisell2.checkout.self-service.empty"));
|
|
210
225
|
return null;
|
|
@@ -318,6 +333,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
318
333
|
}
|
|
319
334
|
}
|
|
320
335
|
}, /* @__PURE__ */ react.default.createElement(require_index$1.default, {
|
|
336
|
+
ref: paymentOptionsRef,
|
|
321
337
|
appearance: "self-service",
|
|
322
338
|
orderInfo: { remainingAmount: String(amount !== null && amount !== void 0 ? amount : 0) },
|
|
323
339
|
paymentMethods: methods,
|
|
@@ -16,7 +16,7 @@ let classnames = require("classnames");
|
|
|
16
16
|
classnames = require_runtime.__toESM(classnames);
|
|
17
17
|
require("./index.less");
|
|
18
18
|
//#region src/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.tsx
|
|
19
|
-
const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, customAmount, disabled = false, onClick, getText, size = "default", surchargeDisplay, directCustomPayment = false, beginKioskPaymentActivity, currentBaseSales })
|
|
19
|
+
const PaymentMethodItem = react.default.forwardRef(function PaymentMethodItem({ appearance = "default", method, amountSymbol, customAmount, disabled = false, onClick, getText, size = "default", surchargeDisplay, directCustomPayment = false, beginKioskPaymentActivity, currentBaseSales }, ref) {
|
|
20
20
|
var _context$appHelper;
|
|
21
21
|
const context = require_useEngineContext.default();
|
|
22
22
|
const { getData, getApp } = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
@@ -165,6 +165,12 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
165
165
|
return _ref.apply(this, arguments);
|
|
166
166
|
};
|
|
167
167
|
}();
|
|
168
|
+
const activate = () => {
|
|
169
|
+
if (disabled) return;
|
|
170
|
+
if (appearance === "self-service" && isEftpos) submitCurrentAmount();
|
|
171
|
+
else showKeyboard();
|
|
172
|
+
};
|
|
173
|
+
react.default.useImperativeHandle(ref, () => ({ activate }));
|
|
168
174
|
const renderLeftContent = () => /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-method-left") }, appearance === "self-service" ? renderPaymentIcon(method) : /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-icon-container") }, renderPaymentIcon(method)), /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-info") }, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-info-inner") }, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-name") }, method.name), /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-info-inner-surcharge") }, !!(displaySurchargeConfig === null || displaySurchargeConfig === void 0 ? void 0 : displaySurchargeConfig.is_surcharge) && calculateSurcharge(displaySurchargeConfig) !== 0 && /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-surcharge-text") }, (getText === null || getText === void 0 ? void 0 : getText("pisell2.payment-options.surcharge-label", "Surcharge")) || "Surcharge", ":", (0, _pisell_utils.formatAmount)(calculateSurcharge(displaySurchargeConfig), 2, amountSymbol)), false))));
|
|
169
175
|
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("button", {
|
|
170
176
|
className: (0, classnames.default)("payment-options-module-payment-method-item", {
|
|
@@ -172,7 +178,7 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
172
178
|
"payment-options-module-disabled": disabled
|
|
173
179
|
}),
|
|
174
180
|
style: appearance === "self-service" ? void 0 : { height: size === "large" ? "82px" : "62px" },
|
|
175
|
-
onClick:
|
|
181
|
+
onClick: activate,
|
|
176
182
|
type: "button",
|
|
177
183
|
disabled
|
|
178
184
|
}, renderLeftContent(), appearance === "self-service" ? /* @__PURE__ */ react.default.createElement("span", {
|
|
@@ -224,6 +230,6 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
224
230
|
}
|
|
225
231
|
}
|
|
226
232
|
}));
|
|
227
|
-
};
|
|
233
|
+
});
|
|
228
234
|
//#endregion
|
|
229
235
|
exports.default = PaymentMethodItem;
|
|
@@ -13,7 +13,7 @@ classnames = require_runtime.__toESM(classnames);
|
|
|
13
13
|
let ahooks = require("ahooks");
|
|
14
14
|
require("./index.less");
|
|
15
15
|
//#region src/components/checkout/components/PaymentOptionsModule/index.tsx
|
|
16
|
-
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 }) {
|
|
16
|
+
const PaymentOptionsModule = react.default.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) {
|
|
17
17
|
var _context$appHelper, _context$appHelper$ge, _context$appHelper$ge2, _context$appHelper$ut;
|
|
18
18
|
const context = require_useEngineContext.default();
|
|
19
19
|
require_useInitLocalesOnce.default(require_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");
|
|
@@ -27,6 +27,13 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
27
27
|
const normalizedChannel = String(channel || "pos").trim().toLowerCase();
|
|
28
28
|
const resolvedColumnCount = columnCount !== null && columnCount !== void 0 ? columnCount : showCashPayment ? 1 : 2;
|
|
29
29
|
const filteredPaymentMethods = react.default.useMemo(() => require_paymentMethodPolicy.filterPaymentMethodsForChannel(paymentMethods, normalizedChannel), [normalizedChannel, paymentMethods]);
|
|
30
|
+
const singleMethodRef = react.default.useRef(null);
|
|
31
|
+
react.default.useImperativeHandle(ref, () => ({ activateSinglePaymentMethod: () => {
|
|
32
|
+
if (!disabled && filteredPaymentMethods.length === 1) {
|
|
33
|
+
var _singleMethodRef$curr;
|
|
34
|
+
(_singleMethodRef$curr = singleMethodRef.current) === null || _singleMethodRef$curr === void 0 || _singleMethodRef$curr.activate();
|
|
35
|
+
}
|
|
36
|
+
} }));
|
|
30
37
|
const { run: handlePaymentClick } = (0, ahooks.useDebounceFn)((method) => {
|
|
31
38
|
if (disabled) return;
|
|
32
39
|
if (typeof onClick === "function") onClick(method);
|
|
@@ -62,6 +69,7 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
62
69
|
paymentMethodsReady
|
|
63
70
|
]);
|
|
64
71
|
const methodItems = filteredPaymentMethods.map((method) => /* @__PURE__ */ react.default.createElement(require_PaymentMethodItem.default, {
|
|
72
|
+
ref: filteredPaymentMethods.length === 1 ? singleMethodRef : void 0,
|
|
65
73
|
appearance,
|
|
66
74
|
size: filteredPaymentMethods.length === 2 ? "large" : "default",
|
|
67
75
|
key: method.id,
|
|
@@ -93,6 +101,6 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
93
101
|
paddingBottom: 8
|
|
94
102
|
}
|
|
95
103
|
}, methodItems)));
|
|
96
|
-
}
|
|
104
|
+
});
|
|
97
105
|
//#endregion
|
|
98
106
|
exports.default = PaymentOptionsModule;
|
|
@@ -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 的金额展示规则。
|
|
@@ -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
|
}
|
|
@@ -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;
|