@pisell/private-materials 6.11.655 → 6.11.657
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.js +18 -18
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +0 -1
- package/es/components/bigSale/components/TimeBar/index.js +0 -1
- package/es/components/bigSale/dialog.js +0 -1
- package/es/components/bigSale/hooks/useBigSaleContext.js +0 -1
- package/es/components/bigSale/hooks/useBigSaleProductListConfig.js +1 -0
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +0 -1
- package/es/components/bigSale/index.js +0 -1
- package/es/components/bigSale/templates/Kiosk/index.js +0 -1
- package/es/components/booking/utils.js +1 -1
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
- package/es/components/ticketBooking/components/ProductDisplayAdapter/index.js +3 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
- package/es/index.js +0 -2
- 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/saleDetail/Base.js +0 -1
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
- package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
- package/es/plus/saleDetail/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/index.js +0 -1
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +1 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/es/pro/skuDetailModal/flow/modules/time/index.js +15 -10
- package/es/pro/skuDetailModal/flow/modules/time/posCustomTime.js +13 -6
- package/es/pro/skuDetailModal/flow/types.d.ts +1 -0
- package/lib/components/booking/utils.js +0 -1
- package/lib/pro/skuDetailModal/flow/modules/time/index.js +13 -8
- package/lib/pro/skuDetailModal/flow/modules/time/posCustomTime.js +13 -5
- package/lib/pro/skuDetailModal/flow/types.d.ts +1 -0
- package/package.json +5 -5
- package/es/plus/pisellReservation/index.js +0 -17
- package/es/plus/salesSdk/index.js +0 -51
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
2
2
|
import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
|
|
3
|
-
import "../../../../plus/salesSdk/index.js";
|
|
4
3
|
import dayjs from "dayjs";
|
|
5
4
|
import { useCallback, useEffect, useState } from "react";
|
|
6
5
|
//#region src/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.ts
|
|
@@ -4,7 +4,6 @@ import withResponsive from "../../../../responsive/withResponsive.js";
|
|
|
4
4
|
import useInitLocalesOnce from "../../../../hooks/useInitLocalesOnce.js";
|
|
5
5
|
import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
|
|
6
6
|
import { useSalesSdkBookingContext } from "../../../../plus/salesSdk/context/SalesSdkBookingContext.js";
|
|
7
|
-
import "../../../../plus/salesSdk/index.js";
|
|
8
7
|
import locales_default from "../../locales/index.js";
|
|
9
8
|
import dayjs from "dayjs";
|
|
10
9
|
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
@@ -5,7 +5,6 @@ import { buildInitBookingContextParams, collectBookingIdsFromTempOrder } from ".
|
|
|
5
5
|
import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
6
6
|
import { useSalesSdkCart } from "../../plus/salesSdk/hooks/useSalesSdkCart.js";
|
|
7
7
|
import { SalesSdkPrepareOrderSwitchContext, SalesSdkRootRefreshContext } from "../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
8
|
-
import "../../plus/salesSdk/index.js";
|
|
9
8
|
import { seedDineInReservationToCart } from "../../plus/pisellReservation/utils/seedDineInReservationToCart.js";
|
|
10
9
|
import { isPersistedBigSaleOrderId } from "./utils/orderIdentity.js";
|
|
11
10
|
import BigSale from "./index.js";
|
|
@@ -4,7 +4,6 @@ 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";
|
|
8
7
|
import { useMemo } from "react";
|
|
9
8
|
//#region src/components/bigSale/hooks/useBigSaleContext.ts
|
|
10
9
|
/**
|
|
@@ -2,6 +2,7 @@ import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/
|
|
|
2
2
|
import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
|
|
3
3
|
import { generateProductTabs, sortProductsByTabOrder } from "../../ticketBooking/components/ProductDisplayAdapter/utils.js";
|
|
4
4
|
import { ProductDisplayPresets } from "../../ticketBooking/components/ProductDisplayAdapter/types.js";
|
|
5
|
+
import "../../ticketBooking/components/ProductDisplayAdapter/index.js";
|
|
5
6
|
import { mergeBigSaleProductListPreferences } from "../utils/productListPreferences.js";
|
|
6
7
|
import { useMemo, useRef } from "react";
|
|
7
8
|
import isEqual from "lodash/isEqual";
|
|
@@ -3,7 +3,6 @@ import useEngineContext from "../../../hooks/useEngineContext.js";
|
|
|
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";
|
|
7
6
|
import { resolveOrderIdForHostActions } from "../../../plus/pisellReservation/components/bookingDetailModal/bookingDetailHostActions.js";
|
|
8
7
|
import { usePicoCodingOpenData } from "../../../plus/pisellReservation/hooks/usePicoCodingOpenData.js";
|
|
9
8
|
import { buildReplacementBookingResourcesFromReservationRow } from "../../../plus/pisellReservation/utils/reservationTicketBookingHostParams.js";
|
|
@@ -8,7 +8,6 @@ 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";
|
|
12
11
|
import { ResponsiveBigSaleBase } from "./Base.js";
|
|
13
12
|
import { isBigSaleProductSelectionFlowScene, resolveBigSaleSelectionFlowConfig } from "./selectionFlowConfig.js";
|
|
14
13
|
import dayjs from "dayjs";
|
|
@@ -6,7 +6,6 @@ import useSalesUserLogin, { isRequireLoginChannel } from "../../../../hooks/useS
|
|
|
6
6
|
import { resolvePaymentResultToastV2ViewModel } from "../../../checkout/components/PaymentResultToastV2/resolve.js";
|
|
7
7
|
import PaymentResultToastV2_default from "../../../checkout/components/PaymentResultToastV2/index.js";
|
|
8
8
|
import { useSalesSdk } from "../../../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
9
|
-
import "../../../../plus/salesSdk/index.js";
|
|
10
9
|
import { usePickSaleDetailContext } from "../../hooks/usePickSaleDetailContext.js";
|
|
11
10
|
import { resolveBigSaleAutoProductListPreferences } from "../../utils/productListPreferences.js";
|
|
12
11
|
import { resolveBigSaleProductDisplayConfig } from "../../hooks/useBigSaleProductListConfig.js";
|
|
@@ -619,4 +619,4 @@ function showDiscountScanFailMessage(val, scene = "goodpass", locales) {
|
|
|
619
619
|
return scene === "goodpass" ? locales.getText("pisell2.text.goodpass.code-invalid-cart") : locales.getText("pisell2.voucher.code-invalid-cart");
|
|
620
620
|
}
|
|
621
621
|
//#endregion
|
|
622
|
-
export { deleteCacheParams, findNextDuration, flexibleObj, formatProductListByCategory, formatResource, getCacheParams, getDays, getDiscountTime, getDiscountTimeByDayMinutes, getDuration, getEndDate, getErrorList, getIsEdit, getIsEject, getIsOnlySession, getLastServer, getMainPrice, getNowTime, getProductTotalPrice, getServeStartTime, getServerItemExtend, getServiceTime, getServiceTimes,
|
|
622
|
+
export { deleteCacheParams, findNextDuration, flexibleObj, formatProductListByCategory, formatResource, getCacheParams, getDays, getDiscountTime, getDiscountTimeByDayMinutes, getDuration, getEndDate, getErrorList, getIsEdit, getIsEject, getIsOnlySession, getLastServer, getMainPrice, getNowTime, getProductTotalPrice, getServeStartTime, getServerItemExtend, getServiceTime, getServiceTimes, isNowTime, isSessionProduct, isWalkIn, request, showDiscountScanFailMessage, sliceDayIntoFiveMinutes };
|
|
@@ -2,7 +2,6 @@ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/
|
|
|
2
2
|
import useEngineContext from "../../hooks/useEngineContext.js";
|
|
3
3
|
import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
4
4
|
import { getTempOrderSyncPayload, shouldApplySharedTempOrderPayload } from "../../plus/salesSdk/tempOrderSync.js";
|
|
5
|
-
import "../../plus/salesSdk/index.js";
|
|
6
5
|
import { useEffect, useRef } from "react";
|
|
7
6
|
import { useMemoizedFn } from "ahooks";
|
|
8
7
|
//#region src/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.tsx
|
|
@@ -19,6 +19,7 @@ import { useProducts } from "../../hooks/pisellos/useProducts.js";
|
|
|
19
19
|
import { useService } from "../../../booking/info/service/serviceManager/index.js";
|
|
20
20
|
import ProductDisplayAdapter_default from "../ProductDisplayAdapter/ProductDisplayAdapter.js";
|
|
21
21
|
import { resolveProductDisplayConfig } from "../ProductDisplayAdapter/types.js";
|
|
22
|
+
import "../ProductDisplayAdapter/index.js";
|
|
22
23
|
import notAvailable_default from "../notAvailable/index.js";
|
|
23
24
|
import MultiDayTimeSelectModal from "./MultiDayTimeSelectModal.js";
|
|
24
25
|
import dayjs from "dayjs";
|
package/es/index.js
CHANGED
|
@@ -85,7 +85,6 @@ import { useSalesSdkProducts } from "./plus/salesSdk/hooks/useSalesSdkProducts.j
|
|
|
85
85
|
import SalesSdkDemo from "./plus/salesSdk/demo/index.js";
|
|
86
86
|
import { useSalesSdkDish } from "./plus/salesSdk/hooks/useSalesSdkDish.js";
|
|
87
87
|
import { useSyncOsModule } from "./plus/salesSdk/hooks/useSyncOsModule.js";
|
|
88
|
-
import "./plus/salesSdk/index.js";
|
|
89
88
|
import BigSaleRightActionPanel from "./components/BigSaleRightActionPanel/index.js";
|
|
90
89
|
import { resolveBigSaleSelectionFlowConfig } from "./components/bigSale/selectionFlowConfig.js";
|
|
91
90
|
import BigSale from "./components/bigSale/index.js";
|
|
@@ -138,7 +137,6 @@ import PisellVenueControlPage from "./plus/pisellReservation/PisellVenueControlP
|
|
|
138
137
|
import PisellVenueWallPage from "./plus/pisellReservation/PisellVenueWallPage.js";
|
|
139
138
|
import PisellReservationTablePage from "./plus/pisellReservation/PisellReservationTablePage.js";
|
|
140
139
|
import SelectFloorMapResourceDialog from "./plus/pisellReservation/components/SelectFloorMapResourceDialog.js";
|
|
141
|
-
import "./plus/pisellReservation/index.js";
|
|
142
140
|
import { PisellTopology, PisellTopologyCore } from "./plus/pisellTopology/PisellTopology.js";
|
|
143
141
|
import cupProject_default from "./components/ecocup/cupProject/index.js";
|
|
144
142
|
import CupList from "./components/ecocup/cupList/index.js";
|
|
@@ -259,4 +259,4 @@ function bookingListToReservationTableRows(bookings) {
|
|
|
259
259
|
return rows;
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
|
-
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds,
|
|
262
|
+
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds, 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,
|
|
81
|
+
export { PISELL_RESERVATION_FLOOR_PLAN_CODE, ensureShopFloorPlanByCode, 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,
|
|
930
|
+
export { RESERVATION_BOUND_ROUND_TABLE_ELEMENT_KIND, RESERVATION_BOUND_TABLE_ELEMENT_KIND, applyReservationFloorMapLiveLabels, defaultReservationTableRows, getDefaultReservationFloorMapConfig, getReservationDataSourceFormColumns, getReservationFloorMapShellConfig, mergeFloorMapElementKindCategoriesWithDefaults, mergeFloorMapElementKindsWithDefaults };
|
|
@@ -11,7 +11,6 @@ import { useSalesSdkCart } from "../salesSdk/hooks/useSalesSdkCart.js";
|
|
|
11
11
|
import { useSalesSdkCustomer } from "../salesSdk/hooks/useSalesSdkCustomer.js";
|
|
12
12
|
import { useSalesSdkBookingContext } from "../salesSdk/context/SalesSdkBookingContext.js";
|
|
13
13
|
import { useSalesSdkSummary } from "../salesSdk/hooks/useSalesSdkSummary.js";
|
|
14
|
-
import "../salesSdk/index.js";
|
|
15
14
|
import locales_default from "./locales.js";
|
|
16
15
|
import locales_default$1 from "./components/LineItem/locales.js";
|
|
17
16
|
import { SaleOrderActionBoundary } from "./actions/index.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import useEngineContext from "../../../../../hooks/useEngineContext.js";
|
|
3
3
|
import { useSalesSdkBookingContext } from "../../../../salesSdk/context/SalesSdkBookingContext.js";
|
|
4
|
-
import "../../../../salesSdk/index.js";
|
|
5
4
|
import { useMemo } from "react";
|
|
6
5
|
import { useMemoizedFn } from "ahooks";
|
|
7
6
|
//#region src/plus/saleDetail/components/Client/hooks/useClientSelectorProps.ts
|
|
@@ -9,7 +9,6 @@ import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
|
|
|
9
9
|
import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
|
|
10
10
|
import { useSalesSdkGlobalScanActivity } from "../../../salesSdk/context/SalesSdkGlobalScanActivityContext.js";
|
|
11
11
|
import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
|
|
12
|
-
import "../../../salesSdk/index.js";
|
|
13
12
|
import { getNumericAmount, getSalesHostModule, resolveSaleDetailOrderIdFromSales, resolveSaleDetailOrderIdFromSalesResult, shouldCloseDialogAfterCheckout, updateLocalOrder } from "./utils.js";
|
|
14
13
|
import { getRemotePrintActions, getWristbandList } from "../../serve.js";
|
|
15
14
|
import { deriveSaleOrderSubmitState } from "../../actions/state.js";
|
|
@@ -3,7 +3,6 @@ import { resolvePaymentMethodName, usePaymentMethodNameMap } from "../../../pise
|
|
|
3
3
|
import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
|
|
4
4
|
import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
|
|
5
5
|
import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
|
|
6
|
-
import "../../../salesSdk/index.js";
|
|
7
6
|
import React, { memo, useMemo } from "react";
|
|
8
7
|
import { formatAmount, locales } from "@pisell/utils";
|
|
9
8
|
import Decimal from "decimal.js";
|
|
@@ -4,7 +4,6 @@ import { useSalesSdk } from "../salesSdk/hooks/useSalesSdk.js";
|
|
|
4
4
|
import { SalesSdkProvider } from "../salesSdk/context/SalesSdkProvider.js";
|
|
5
5
|
import { SalesSdkDishProvider } from "../salesSdk/context/SalesSdkDishContext.js";
|
|
6
6
|
import { SalesSdkBookingContextProvider } from "../salesSdk/context/SalesSdkBookingContext.js";
|
|
7
|
-
import "../salesSdk/index.js";
|
|
8
7
|
import Base_default from "./Base.js";
|
|
9
8
|
import React, { forwardRef, useImperativeHandle } from "react";
|
|
10
9
|
//#region src/plus/saleDetail/index.tsx
|
|
@@ -1,7 +1,6 @@
|
|
|
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";
|
|
5
4
|
import { SaleDetailStatusOverview } from "../shared/StatusOverview.js";
|
|
6
5
|
import { DishGroupView } from "./DishGroupView.js";
|
|
7
6
|
import dayjs from "dayjs";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
3
3
|
import { useCurrentSalesSdkDish } from "../../../salesSdk/hooks/useCurrentSalesSdkDish.js";
|
|
4
|
-
import "../../../salesSdk/index.js";
|
|
5
4
|
import { getInternalNotesByScheduleEvent } from "../../serve.js";
|
|
6
5
|
import { TEMPLATE_B_PAY_ACTIONS, TEMPLATE_B_SUMMARY_ACTIONS } from "../../components/DetailActions/configs/index.js";
|
|
7
6
|
import { DetailActions } from "../../components/DetailActions/index.js";
|
|
@@ -31,4 +31,4 @@ function subscribeBookingDateChange(bookingTicket, callback) {
|
|
|
31
31
|
return typeof off === "function" ? off : () => {};
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
-
export {
|
|
34
|
+
export { formatBookingDateTime, subscribeBookingDateChange };
|
|
@@ -62,4 +62,4 @@ function normalizeCustomerAuthCustomer(value) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
//#endregion
|
|
65
|
-
export {
|
|
65
|
+
export { isValidOrderCustomerId, normalizeCustomerAuthCustomer, resolveCustomerAuthCurrentCustomerId, shouldPromptCustomerAuthForProduct };
|
|
@@ -71,4 +71,4 @@ function buildHolderListRequestKey(params) {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
//#endregion
|
|
74
|
-
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay,
|
|
74
|
+
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, resolveHolderDisplayConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
|
|
2
1
|
import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
|
|
3
2
|
import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
|
|
4
|
-
import { AuthModal } from "./AuthModal.js";
|
|
3
|
+
import { AuthModal, AuthModalProps } from "./AuthModal.js";
|
|
@@ -226,4 +226,4 @@ interface RegisterFormData {
|
|
|
226
226
|
verification_token?: string;
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
|
-
export { AuthMethodType, EmailAuthConfig,
|
|
229
|
+
export { AuthMethodType, EmailAuthConfig, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig };
|
|
@@ -2,7 +2,7 @@ import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.
|
|
|
2
2
|
import { _asyncToGenerator } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import { getDurationProps, getTimeObj } from "../../../../../components/booking/info2/service/addService/utils.js";
|
|
4
4
|
import { isNormalProductByDurationSchedule } from "../../../../../components/booking/info/service2/utils.js";
|
|
5
|
-
import { getDiscountTime, getServiceTimes,
|
|
5
|
+
import { getDiscountTime, getServiceTimes, isSessionProduct } from "../../../../../components/booking/utils.js";
|
|
6
6
|
import Duration from "../../../../../components/booking/materiels/duration/index.js";
|
|
7
7
|
import SkuDetailLoadingPanel from "../../../LoadingPanel.js";
|
|
8
8
|
import { selectionFlowText } from "../../i18n.js";
|
|
@@ -10,7 +10,7 @@ import { buildDraftCacheItem, getModuleOptions, getUnsupportedBookingFlowReason,
|
|
|
10
10
|
import TimeResourceSelector from "../../../../../components/eventBooking/components/timeResourceSelector/index.js";
|
|
11
11
|
import { resolveAvailabilityStatus } from "../../../../../components/eventBooking/components/bookingAvailabilityCalendar/utils.js";
|
|
12
12
|
import { validateAvailabilityTimeAutoResolution } from "../autoResolution.js";
|
|
13
|
-
import { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleBusinessDurationMinutes, resolvePosFlexibleDurationInitialCandidate, shouldShowPosCustomTimeCandidateCards } from "./posCustomTime.js";
|
|
13
|
+
import { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleBusinessDurationMinutes, resolvePosFlexibleDurationInitialCandidate, shouldResetPosFlexibleTimeForDate, shouldShowPosCustomTimeCandidateCards } from "./posCustomTime.js";
|
|
14
14
|
import dayjs from "dayjs";
|
|
15
15
|
import React, { useEffect, useMemo } from "react";
|
|
16
16
|
import { Alert, Space } from "antd";
|
|
@@ -174,6 +174,7 @@ const refreshAvailabilityTimes = function() {
|
|
|
174
174
|
const requestedStartTime = getAvailabilityStartTimeOverride(context, startTimeOverride);
|
|
175
175
|
const selectedDate = context.draft.booking.startDate.format("YYYY-MM-DD");
|
|
176
176
|
const requestId = Date.now() + Math.random();
|
|
177
|
+
const previousTimeData = context.getModuleData(module.key);
|
|
177
178
|
const posCustomTimeHydrationKey = posCustomTimeAvailability && requestedDuration && requestedStartTime ? `${selectedDate}|${requestedStartTime}|${requestedDuration}` : void 0;
|
|
178
179
|
context.setModuleData(module.key, {
|
|
179
180
|
requestId,
|
|
@@ -191,13 +192,14 @@ const refreshAvailabilityTimes = function() {
|
|
|
191
192
|
const candidates = (group === null || group === void 0 ? void 0 : group.ranges) || [];
|
|
192
193
|
const product = context.draft.productData;
|
|
193
194
|
if (posDurationAvailability && selectionIntent === "restore" && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration)) {
|
|
194
|
-
var _context$hostContext, _moduleOptions$slice, _normalizeDurationMin3;
|
|
195
|
+
var _context$hostContext, _moduleOptions$slice, _context$draft$bookin2, _normalizeDurationMin3;
|
|
195
196
|
const moduleOptions = getModuleOptions(module);
|
|
196
197
|
const configuredSlice = (_context$hostContext = context.hostContext) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.bookingConfig) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.config) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.basic) === null || _context$hostContext === void 0 ? void 0 : _context$hostContext.service_time;
|
|
197
198
|
const fallbackSlice = (_moduleOptions$slice = moduleOptions.slice) !== null && _moduleOptions$slice !== void 0 ? _moduleOptions$slice : typeof configuredSlice === "object" ? configuredSlice === null || configuredSlice === void 0 ? void 0 : configuredSlice.value : configuredSlice;
|
|
198
199
|
const baseDurationMinutes = resolvePosCustomTimeBaseMinutes(group === null || group === void 0 ? void 0 : group.slotStepMinutes, fallbackSlice);
|
|
199
|
-
const
|
|
200
|
-
const
|
|
200
|
+
const resetForSelectedDate = shouldResetPosFlexibleTimeForDate((_context$draft$bookin2 = context.draft.booking.selectedCandidate) !== null && _context$draft$bookin2 !== void 0 ? _context$draft$bookin2 : previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.selectedCandidate, selectedDate);
|
|
201
|
+
const nextStartTime = resolvePosCustomTimeDefaultStartTime(resetForSelectedDate ? null : context.draft.booking.startTime, baseDurationMinutes);
|
|
202
|
+
const nextDuration = resolvePosCustomTimeDefaultDurationMinutes(resetForSelectedDate ? product === null || product === void 0 ? void 0 : product.duration : (_normalizeDurationMin3 = normalizeDurationMinutesValue(context.draft.booking.duration)) !== null && _normalizeDurationMin3 !== void 0 ? _normalizeDurationMin3 : context.draft.booking.duration, baseDurationMinutes, context.services.selectionFlowMode === "edit" ? void 0 : resolvePosFlexibleBusinessDurationMinutes(nextStartTime, (group === null || group === void 0 ? void 0 : group.operatingEndAt) ? dayjs(group.operatingEndAt).format("HH:mm") : void 0));
|
|
201
203
|
const changedFields = [];
|
|
202
204
|
if (nextStartTime !== context.draft.booking.startTime) changedFields.push("booking.startTime");
|
|
203
205
|
if (nextDuration !== context.draft.booking.duration) changedFields.push("booking.duration");
|
|
@@ -264,6 +266,7 @@ const refreshAvailabilityTimes = function() {
|
|
|
264
266
|
durationMinutes: requestedPosDuration
|
|
265
267
|
}) : isSameCandidateStart(candidate, selectedDate, requestedPosStartTime)) : void 0;
|
|
266
268
|
const customSelectionIntent = posCustomTimeAvailability && selectionIntent === "custom";
|
|
269
|
+
const fallbackSelectionIntent = posCustomTimeAvailability && selectionIntent === "fallback";
|
|
267
270
|
const requestedCustomRange = requestedPosStartTime && requestedPosDuration ? {
|
|
268
271
|
date: selectedDate,
|
|
269
272
|
startTime: requestedPosStartTime,
|
|
@@ -272,7 +275,8 @@ const refreshAvailabilityTimes = function() {
|
|
|
272
275
|
const restoredCandidate = resolvePosCustomTimeCandidate({
|
|
273
276
|
candidates: times.filter((candidate) => isAvailabilityCandidateSelectable(candidate, allowUnavailable)),
|
|
274
277
|
customSelectionIntent,
|
|
275
|
-
|
|
278
|
+
fallbackSelectionIntent,
|
|
279
|
+
requestedCustomRange: customSelectionIntent || fallbackSelectionIntent ? requestedCustomRange : void 0,
|
|
276
280
|
restoredDraftCandidate,
|
|
277
281
|
restoredExistingCandidate,
|
|
278
282
|
fallbackCandidate: fallbackOsCandidate
|
|
@@ -280,14 +284,15 @@ const refreshAvailabilityTimes = function() {
|
|
|
280
284
|
const normallySelectableCandidates = times.filter((candidate) => isAvailabilityCandidateSelectable(candidate));
|
|
281
285
|
const selectableCandidates = normallySelectableCandidates.length > 0 || !allowUnavailable ? normallySelectableCandidates : times;
|
|
282
286
|
const shouldPreserveRequestedPosStart = posCustomTimeAvailability && Boolean(requestedPosStartTime && requestedPosDuration);
|
|
283
|
-
const displayCandidates = posSessionAvailability ? getSessionPresetCandidates(times) : posDurationAvailability && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) ? getPosFlexibleDurationPresetCandidates(times, requestedCustomRange, customSelectionIntent) : times;
|
|
287
|
+
const displayCandidates = posSessionAvailability ? getSessionPresetCandidates(times) : posDurationAvailability && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) ? getPosFlexibleDurationPresetCandidates(times, requestedCustomRange, customSelectionIntent, Boolean(!customSelectionIntent && existingCandidate && existingCandidate.date === selectedDate && (previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.timeSlots.some((slot) => String(slot.id) === String(existingCandidate.key))))) : times;
|
|
284
288
|
const fallbackCandidate = shouldPreserveRequestedPosStart ? void 0 : selectableCandidates[0];
|
|
285
289
|
const preferPosFlexiblePreset = posDurationAvailability && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && !customSelectionIntent && context.services.selectionFlowMode !== "edit" && (selectionIntent === "fallback" || !existingCandidate || existingCandidate.date !== selectedDate);
|
|
286
290
|
const initialCandidate = posDurationAvailability && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) ? resolvePosFlexibleDurationInitialCandidate({
|
|
287
291
|
presetCandidates: displayCandidates,
|
|
288
292
|
restoredCandidate,
|
|
289
293
|
fallbackCandidate,
|
|
290
|
-
preferPreset: preferPosFlexiblePreset
|
|
294
|
+
preferPreset: preferPosFlexiblePreset,
|
|
295
|
+
minimumPresetStartAt: preferPosFlexiblePreset ? dayjs().toISOString() : void 0
|
|
291
296
|
}) : restoredCandidate || fallbackCandidate;
|
|
292
297
|
context.setModuleData(module.key, {
|
|
293
298
|
requestId,
|
|
@@ -594,12 +599,12 @@ const TimeFlowModuleComponent = ({ context, module, registerHandle }) => {
|
|
|
594
599
|
return () => registerHandle === null || registerHandle === void 0 ? void 0 : registerHandle(null);
|
|
595
600
|
}, [handle, registerHandle]);
|
|
596
601
|
useEffect(() => {
|
|
597
|
-
var _context$draft$
|
|
602
|
+
var _context$draft$bookin3;
|
|
598
603
|
if (!usePosCustomTimeAvailability || !availability) return;
|
|
599
604
|
if (!startTime || !hasDurationValue(duration)) return;
|
|
600
605
|
if (availabilityData === null || availabilityData === void 0 ? void 0 : availabilityData.selectedCandidate) return;
|
|
601
606
|
if (moduleStatus === "loading") return;
|
|
602
|
-
const selectedDate = (_context$draft$
|
|
607
|
+
const selectedDate = (_context$draft$bookin3 = context.draft.booking.startDate) === null || _context$draft$bookin3 === void 0 ? void 0 : _context$draft$bookin3.format("YYYY-MM-DD");
|
|
603
608
|
const requestedDuration = getAvailabilityDurationOverride(context);
|
|
604
609
|
const requestedStartTime = getAvailabilityStartTimeOverride(context);
|
|
605
610
|
if (!selectedDate || !requestedDuration || !requestedStartTime) return;
|
|
@@ -41,6 +41,7 @@ const resolvePosFlexibleBusinessDurationMinutes = (startTime, closingTime) => {
|
|
|
41
41
|
const duration = closingMinute > startMinute ? closingMinute - startMinute : closingMinute < startMinute ? closingMinute + 1440 - startMinute : 0;
|
|
42
42
|
return duration > 0 ? duration : null;
|
|
43
43
|
};
|
|
44
|
+
const shouldResetPosFlexibleTimeForDate = (candidate, selectedDate) => Boolean(candidate && candidate.date !== selectedDate);
|
|
44
45
|
const resolvePosCustomTimeDefaultDurationMinutes = (currentValue, baseDurationMinutes, flexibleDefaultMinutes) => {
|
|
45
46
|
if (isFlexibleDurationValue(currentValue)) {
|
|
46
47
|
const flexibleMinutes = Number(flexibleDefaultMinutes);
|
|
@@ -65,22 +66,28 @@ const getAvailabilityCandidateDurationMinutes = (candidate) => {
|
|
|
65
66
|
const isSameAvailabilityCandidateRange = (candidate, params) => Boolean(params.startTime) && candidate.date === params.date && candidate.startTime.slice(0, 5) === params.startTime && Boolean(params.durationMinutes) && getAvailabilityCandidateDurationMinutes(candidate) === params.durationMinutes;
|
|
66
67
|
const resolvePosCustomTimeCandidate = (params) => {
|
|
67
68
|
const requestedCustomRange = params.requestedCustomRange;
|
|
68
|
-
if (params.customSelectionIntent) {
|
|
69
|
+
if (params.customSelectionIntent || params.fallbackSelectionIntent) {
|
|
69
70
|
if (!requestedCustomRange) return void 0;
|
|
70
71
|
return params.candidates.find((candidate) => candidate.source === "duration_window" && isSameAvailabilityCandidateRange(candidate, requestedCustomRange));
|
|
71
72
|
}
|
|
72
73
|
return params.restoredDraftCandidate || params.restoredExistingCandidate || params.fallbackCandidate;
|
|
73
74
|
};
|
|
74
75
|
const getSessionPresetCandidates = (candidates) => candidates.filter((candidate) => candidate.source === "session_schedule");
|
|
75
|
-
const getPosFlexibleDurationPresetCandidates = (candidates, requestedCustomRange, customSelectionIntent = false) => {
|
|
76
|
+
const getPosFlexibleDurationPresetCandidates = (candidates, requestedCustomRange, customSelectionIntent = false, preserveRequestedRange = false) => {
|
|
76
77
|
if (!requestedCustomRange) return [...candidates];
|
|
77
|
-
|
|
78
|
-
return
|
|
78
|
+
if (preserveRequestedRange && !customSelectionIntent) return [...candidates];
|
|
79
|
+
return candidates.filter((candidate) => !isSameAvailabilityCandidateRange(candidate, requestedCustomRange));
|
|
79
80
|
};
|
|
80
81
|
const resolvePosFlexibleDurationInitialCandidate = (params) => {
|
|
81
|
-
const
|
|
82
|
+
const minimumPresetStartAt = params.minimumPresetStartAt === void 0 ? null : dayjs(params.minimumPresetStartAt);
|
|
83
|
+
const firstAvailablePreset = params.presetCandidates.find((candidate) => {
|
|
84
|
+
if (!((!candidate.status || candidate.status === "available" || candidate.status === "limited") && !(typeof candidate.maxPartySize === "number" && candidate.maxPartySize <= 0))) return false;
|
|
85
|
+
if (!(minimumPresetStartAt === null || minimumPresetStartAt === void 0 ? void 0 : minimumPresetStartAt.isValid())) return true;
|
|
86
|
+
const candidateStartAt = dayjs(candidate.startAt);
|
|
87
|
+
return candidateStartAt.isValid() && !candidateStartAt.isBefore(minimumPresetStartAt);
|
|
88
|
+
});
|
|
82
89
|
if (params.preferPreset && firstAvailablePreset) return firstAvailablePreset;
|
|
83
90
|
return params.restoredCandidate || params.fallbackCandidate;
|
|
84
91
|
};
|
|
85
92
|
//#endregion
|
|
86
|
-
export { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleBusinessDurationMinutes, resolvePosFlexibleDurationInitialCandidate, shouldShowPosCustomTimeCandidateCards };
|
|
93
|
+
export { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleBusinessDurationMinutes, resolvePosFlexibleDurationInitialCandidate, shouldResetPosFlexibleTimeForDate, shouldShowPosCustomTimeCandidateCards };
|
|
@@ -168,6 +168,7 @@ interface SelectionFlowAvailabilityService {
|
|
|
168
168
|
title?: string;
|
|
169
169
|
kind: 'normal' | 'duration' | 'session' | 'venue_slot';
|
|
170
170
|
slotStepMinutes?: number;
|
|
171
|
+
operatingEndAt?: string;
|
|
171
172
|
ranges: SelectionFlowAvailabilityCandidate[];
|
|
172
173
|
}>>;
|
|
173
174
|
queryBookingAvailability: (contextId: string, request: Record<string, unknown>) => Promise<{
|
|
@@ -645,7 +645,6 @@ exports.getServeStartTime = getServeStartTime;
|
|
|
645
645
|
exports.getServerItemExtend = getServerItemExtend;
|
|
646
646
|
exports.getServiceTime = getServiceTime;
|
|
647
647
|
exports.getServiceTimes = getServiceTimes;
|
|
648
|
-
exports.getShopOpeningHours = getShopOpeningHours;
|
|
649
648
|
exports.isNowTime = isNowTime;
|
|
650
649
|
exports.isSessionProduct = isSessionProduct;
|
|
651
650
|
exports.isWalkIn = isWalkIn;
|
|
@@ -178,6 +178,7 @@ const refreshAvailabilityTimes = function() {
|
|
|
178
178
|
const requestedStartTime = getAvailabilityStartTimeOverride(context, startTimeOverride);
|
|
179
179
|
const selectedDate = context.draft.booking.startDate.format("YYYY-MM-DD");
|
|
180
180
|
const requestId = Date.now() + Math.random();
|
|
181
|
+
const previousTimeData = context.getModuleData(module.key);
|
|
181
182
|
const posCustomTimeHydrationKey = posCustomTimeAvailability && requestedDuration && requestedStartTime ? `${selectedDate}|${requestedStartTime}|${requestedDuration}` : void 0;
|
|
182
183
|
context.setModuleData(module.key, {
|
|
183
184
|
requestId,
|
|
@@ -195,13 +196,14 @@ const refreshAvailabilityTimes = function() {
|
|
|
195
196
|
const candidates = (group === null || group === void 0 ? void 0 : group.ranges) || [];
|
|
196
197
|
const product = context.draft.productData;
|
|
197
198
|
if (posDurationAvailability && selectionIntent === "restore" && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration)) {
|
|
198
|
-
var _context$hostContext, _moduleOptions$slice, _normalizeDurationMin3;
|
|
199
|
+
var _context$hostContext, _moduleOptions$slice, _context$draft$bookin2, _normalizeDurationMin3;
|
|
199
200
|
const moduleOptions = require_index$1.getModuleOptions(module);
|
|
200
201
|
const configuredSlice = (_context$hostContext = context.hostContext) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.bookingConfig) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.config) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.basic) === null || _context$hostContext === void 0 ? void 0 : _context$hostContext.service_time;
|
|
201
202
|
const fallbackSlice = (_moduleOptions$slice = moduleOptions.slice) !== null && _moduleOptions$slice !== void 0 ? _moduleOptions$slice : typeof configuredSlice === "object" ? configuredSlice === null || configuredSlice === void 0 ? void 0 : configuredSlice.value : configuredSlice;
|
|
202
203
|
const baseDurationMinutes = require_posCustomTime.resolvePosCustomTimeBaseMinutes(group === null || group === void 0 ? void 0 : group.slotStepMinutes, fallbackSlice);
|
|
203
|
-
const
|
|
204
|
-
const
|
|
204
|
+
const resetForSelectedDate = require_posCustomTime.shouldResetPosFlexibleTimeForDate((_context$draft$bookin2 = context.draft.booking.selectedCandidate) !== null && _context$draft$bookin2 !== void 0 ? _context$draft$bookin2 : previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.selectedCandidate, selectedDate);
|
|
205
|
+
const nextStartTime = require_posCustomTime.resolvePosCustomTimeDefaultStartTime(resetForSelectedDate ? null : context.draft.booking.startTime, baseDurationMinutes);
|
|
206
|
+
const nextDuration = require_posCustomTime.resolvePosCustomTimeDefaultDurationMinutes(resetForSelectedDate ? product === null || product === void 0 ? void 0 : product.duration : (_normalizeDurationMin3 = normalizeDurationMinutesValue(context.draft.booking.duration)) !== null && _normalizeDurationMin3 !== void 0 ? _normalizeDurationMin3 : context.draft.booking.duration, baseDurationMinutes, context.services.selectionFlowMode === "edit" ? void 0 : require_posCustomTime.resolvePosFlexibleBusinessDurationMinutes(nextStartTime, (group === null || group === void 0 ? void 0 : group.operatingEndAt) ? (0, dayjs.default)(group.operatingEndAt).format("HH:mm") : void 0));
|
|
205
207
|
const changedFields = [];
|
|
206
208
|
if (nextStartTime !== context.draft.booking.startTime) changedFields.push("booking.startTime");
|
|
207
209
|
if (nextDuration !== context.draft.booking.duration) changedFields.push("booking.duration");
|
|
@@ -268,6 +270,7 @@ const refreshAvailabilityTimes = function() {
|
|
|
268
270
|
durationMinutes: requestedPosDuration
|
|
269
271
|
}) : isSameCandidateStart(candidate, selectedDate, requestedPosStartTime)) : void 0;
|
|
270
272
|
const customSelectionIntent = posCustomTimeAvailability && selectionIntent === "custom";
|
|
273
|
+
const fallbackSelectionIntent = posCustomTimeAvailability && selectionIntent === "fallback";
|
|
271
274
|
const requestedCustomRange = requestedPosStartTime && requestedPosDuration ? {
|
|
272
275
|
date: selectedDate,
|
|
273
276
|
startTime: requestedPosStartTime,
|
|
@@ -276,7 +279,8 @@ const refreshAvailabilityTimes = function() {
|
|
|
276
279
|
const restoredCandidate = require_posCustomTime.resolvePosCustomTimeCandidate({
|
|
277
280
|
candidates: times.filter((candidate) => isAvailabilityCandidateSelectable(candidate, allowUnavailable)),
|
|
278
281
|
customSelectionIntent,
|
|
279
|
-
|
|
282
|
+
fallbackSelectionIntent,
|
|
283
|
+
requestedCustomRange: customSelectionIntent || fallbackSelectionIntent ? requestedCustomRange : void 0,
|
|
280
284
|
restoredDraftCandidate,
|
|
281
285
|
restoredExistingCandidate,
|
|
282
286
|
fallbackCandidate: fallbackOsCandidate
|
|
@@ -284,14 +288,15 @@ const refreshAvailabilityTimes = function() {
|
|
|
284
288
|
const normallySelectableCandidates = times.filter((candidate) => isAvailabilityCandidateSelectable(candidate));
|
|
285
289
|
const selectableCandidates = normallySelectableCandidates.length > 0 || !allowUnavailable ? normallySelectableCandidates : times;
|
|
286
290
|
const shouldPreserveRequestedPosStart = posCustomTimeAvailability && Boolean(requestedPosStartTime && requestedPosDuration);
|
|
287
|
-
const displayCandidates = posSessionAvailability ? require_posCustomTime.getSessionPresetCandidates(times) : posDurationAvailability && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) ? require_posCustomTime.getPosFlexibleDurationPresetCandidates(times, requestedCustomRange, customSelectionIntent) : times;
|
|
291
|
+
const displayCandidates = posSessionAvailability ? require_posCustomTime.getSessionPresetCandidates(times) : posDurationAvailability && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) ? require_posCustomTime.getPosFlexibleDurationPresetCandidates(times, requestedCustomRange, customSelectionIntent, Boolean(!customSelectionIntent && existingCandidate && existingCandidate.date === selectedDate && (previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.timeSlots.some((slot) => String(slot.id) === String(existingCandidate.key))))) : times;
|
|
288
292
|
const fallbackCandidate = shouldPreserveRequestedPosStart ? void 0 : selectableCandidates[0];
|
|
289
293
|
const preferPosFlexiblePreset = posDurationAvailability && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && !customSelectionIntent && context.services.selectionFlowMode !== "edit" && (selectionIntent === "fallback" || !existingCandidate || existingCandidate.date !== selectedDate);
|
|
290
294
|
const initialCandidate = posDurationAvailability && require_posCustomTime.isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) ? require_posCustomTime.resolvePosFlexibleDurationInitialCandidate({
|
|
291
295
|
presetCandidates: displayCandidates,
|
|
292
296
|
restoredCandidate,
|
|
293
297
|
fallbackCandidate,
|
|
294
|
-
preferPreset: preferPosFlexiblePreset
|
|
298
|
+
preferPreset: preferPosFlexiblePreset,
|
|
299
|
+
minimumPresetStartAt: preferPosFlexiblePreset ? (0, dayjs.default)().toISOString() : void 0
|
|
295
300
|
}) : restoredCandidate || fallbackCandidate;
|
|
296
301
|
context.setModuleData(module.key, {
|
|
297
302
|
requestId,
|
|
@@ -598,12 +603,12 @@ const TimeFlowModuleComponent = ({ context, module, registerHandle }) => {
|
|
|
598
603
|
return () => registerHandle === null || registerHandle === void 0 ? void 0 : registerHandle(null);
|
|
599
604
|
}, [handle, registerHandle]);
|
|
600
605
|
(0, react.useEffect)(() => {
|
|
601
|
-
var _context$draft$
|
|
606
|
+
var _context$draft$bookin3;
|
|
602
607
|
if (!usePosCustomTimeAvailability || !availability) return;
|
|
603
608
|
if (!startTime || !hasDurationValue(duration)) return;
|
|
604
609
|
if (availabilityData === null || availabilityData === void 0 ? void 0 : availabilityData.selectedCandidate) return;
|
|
605
610
|
if (moduleStatus === "loading") return;
|
|
606
|
-
const selectedDate = (_context$draft$
|
|
611
|
+
const selectedDate = (_context$draft$bookin3 = context.draft.booking.startDate) === null || _context$draft$bookin3 === void 0 ? void 0 : _context$draft$bookin3.format("YYYY-MM-DD");
|
|
607
612
|
const requestedDuration = getAvailabilityDurationOverride(context);
|
|
608
613
|
const requestedStartTime = getAvailabilityStartTimeOverride(context);
|
|
609
614
|
if (!selectedDate || !requestedDuration || !requestedStartTime) return;
|
|
@@ -43,6 +43,7 @@ const resolvePosFlexibleBusinessDurationMinutes = (startTime, closingTime) => {
|
|
|
43
43
|
const duration = closingMinute > startMinute ? closingMinute - startMinute : closingMinute < startMinute ? closingMinute + 1440 - startMinute : 0;
|
|
44
44
|
return duration > 0 ? duration : null;
|
|
45
45
|
};
|
|
46
|
+
const shouldResetPosFlexibleTimeForDate = (candidate, selectedDate) => Boolean(candidate && candidate.date !== selectedDate);
|
|
46
47
|
const resolvePosCustomTimeDefaultDurationMinutes = (currentValue, baseDurationMinutes, flexibleDefaultMinutes) => {
|
|
47
48
|
if (isFlexibleDurationValue(currentValue)) {
|
|
48
49
|
const flexibleMinutes = Number(flexibleDefaultMinutes);
|
|
@@ -67,20 +68,26 @@ const getAvailabilityCandidateDurationMinutes = (candidate) => {
|
|
|
67
68
|
const isSameAvailabilityCandidateRange = (candidate, params) => Boolean(params.startTime) && candidate.date === params.date && candidate.startTime.slice(0, 5) === params.startTime && Boolean(params.durationMinutes) && getAvailabilityCandidateDurationMinutes(candidate) === params.durationMinutes;
|
|
68
69
|
const resolvePosCustomTimeCandidate = (params) => {
|
|
69
70
|
const requestedCustomRange = params.requestedCustomRange;
|
|
70
|
-
if (params.customSelectionIntent) {
|
|
71
|
+
if (params.customSelectionIntent || params.fallbackSelectionIntent) {
|
|
71
72
|
if (!requestedCustomRange) return void 0;
|
|
72
73
|
return params.candidates.find((candidate) => candidate.source === "duration_window" && isSameAvailabilityCandidateRange(candidate, requestedCustomRange));
|
|
73
74
|
}
|
|
74
75
|
return params.restoredDraftCandidate || params.restoredExistingCandidate || params.fallbackCandidate;
|
|
75
76
|
};
|
|
76
77
|
const getSessionPresetCandidates = (candidates) => candidates.filter((candidate) => candidate.source === "session_schedule");
|
|
77
|
-
const getPosFlexibleDurationPresetCandidates = (candidates, requestedCustomRange, customSelectionIntent = false) => {
|
|
78
|
+
const getPosFlexibleDurationPresetCandidates = (candidates, requestedCustomRange, customSelectionIntent = false, preserveRequestedRange = false) => {
|
|
78
79
|
if (!requestedCustomRange) return [...candidates];
|
|
79
|
-
|
|
80
|
-
return
|
|
80
|
+
if (preserveRequestedRange && !customSelectionIntent) return [...candidates];
|
|
81
|
+
return candidates.filter((candidate) => !isSameAvailabilityCandidateRange(candidate, requestedCustomRange));
|
|
81
82
|
};
|
|
82
83
|
const resolvePosFlexibleDurationInitialCandidate = (params) => {
|
|
83
|
-
const
|
|
84
|
+
const minimumPresetStartAt = params.minimumPresetStartAt === void 0 ? null : (0, dayjs.default)(params.minimumPresetStartAt);
|
|
85
|
+
const firstAvailablePreset = params.presetCandidates.find((candidate) => {
|
|
86
|
+
if (!((!candidate.status || candidate.status === "available" || candidate.status === "limited") && !(typeof candidate.maxPartySize === "number" && candidate.maxPartySize <= 0))) return false;
|
|
87
|
+
if (!(minimumPresetStartAt === null || minimumPresetStartAt === void 0 ? void 0 : minimumPresetStartAt.isValid())) return true;
|
|
88
|
+
const candidateStartAt = (0, dayjs.default)(candidate.startAt);
|
|
89
|
+
return candidateStartAt.isValid() && !candidateStartAt.isBefore(minimumPresetStartAt);
|
|
90
|
+
});
|
|
84
91
|
if (params.preferPreset && firstAvailablePreset) return firstAvailablePreset;
|
|
85
92
|
return params.restoredCandidate || params.fallbackCandidate;
|
|
86
93
|
};
|
|
@@ -96,4 +103,5 @@ exports.resolvePosCustomTimeDefaultDurationMinutes = resolvePosCustomTimeDefault
|
|
|
96
103
|
exports.resolvePosCustomTimeDefaultStartTime = resolvePosCustomTimeDefaultStartTime;
|
|
97
104
|
exports.resolvePosFlexibleBusinessDurationMinutes = resolvePosFlexibleBusinessDurationMinutes;
|
|
98
105
|
exports.resolvePosFlexibleDurationInitialCandidate = resolvePosFlexibleDurationInitialCandidate;
|
|
106
|
+
exports.shouldResetPosFlexibleTimeForDate = shouldResetPosFlexibleTimeForDate;
|
|
99
107
|
exports.shouldShowPosCustomTimeCandidateCards = shouldShowPosCustomTimeCandidateCards;
|
|
@@ -168,6 +168,7 @@ interface SelectionFlowAvailabilityService {
|
|
|
168
168
|
title?: string;
|
|
169
169
|
kind: 'normal' | 'duration' | 'session' | 'venue_slot';
|
|
170
170
|
slotStepMinutes?: number;
|
|
171
|
+
operatingEndAt?: string;
|
|
171
172
|
ranges: SelectionFlowAvailabilityCandidate[];
|
|
172
173
|
}>>;
|
|
173
174
|
queryBookingAvailability: (contextId: string, request: Record<string, unknown>) => Promise<{
|