@lookiero/checkout 0.8.22 → 0.8.23
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/dist/infrastructure/delivery/baseBootstrap.d.ts +2 -0
- package/dist/infrastructure/delivery/baseBootstrap.js +5 -1
- package/dist/infrastructure/delivery/bootstrap.js +2 -0
- package/dist/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.d.ts +2 -2
- package/dist/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.js +3 -4
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -0
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +3 -3
- package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +5 -3
- package/dist/infrastructure/ui/views/item/Item.js +13 -8
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +1 -1
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -2
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import { CheckoutByIdView } from "../../projection/checkout/viewCheckoutById";
|
|
|
15
15
|
import { FirstAvailableCheckoutByCustomerIdView } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
16
16
|
import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
17
17
|
import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
18
|
+
import { IsSizeChangeEnabledByCheckoutIdView } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
|
|
18
19
|
import { CheckoutBookingByIdView } from "../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
19
20
|
import { CheckoutItemByIdView } from "../../projection/checkoutItem/viewCheckoutItemById";
|
|
20
21
|
import { CheckoutQuestionsByCheckoutIdView } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
@@ -29,6 +30,7 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
29
30
|
readonly checkoutByIdView: CheckoutByIdView;
|
|
30
31
|
readonly firstAvailableCheckoutByCustomerIdView: FirstAvailableCheckoutByCustomerIdView;
|
|
31
32
|
readonly isCheckoutEnabledByCustomerIdView: IsCheckoutEnabledByCustomerIdView;
|
|
33
|
+
readonly isSizeChangeEnabledByCheckoutIdView: IsSizeChangeEnabledByCheckoutIdView;
|
|
32
34
|
readonly fiveItemsDiscountByCustomerIdView: FiveItemsDiscountByCustomerIdView;
|
|
33
35
|
readonly uiSettingByKeyView: UiSettingByKeyView;
|
|
34
36
|
readonly checkoutItemByIdView: CheckoutItemByIdView;
|
|
@@ -26,6 +26,7 @@ import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHE
|
|
|
26
26
|
import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
27
27
|
import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
28
28
|
import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
29
|
+
import { viewIsSizeChangeEnabledByCheckoutIdHandler, VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID, } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
|
|
29
30
|
import { viewCheckoutBookingByIdHandler, VIEW_CHECKOUT_BOOKING_BY_ID, } from "../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
30
31
|
import { viewCheckoutItemByIdHandler, VIEW_CHECKOUT_ITEM_BY_ID, } from "../../projection/checkoutItem/viewCheckoutItemById";
|
|
31
32
|
import { listCheckoutQuestionsByCheckoutIdHandler, LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
|
|
@@ -36,7 +37,7 @@ import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projec
|
|
|
36
37
|
import { bootstrapWithBuilder as bootstrapNotifications } from "../../shared/notifications/infrastructure/delivery/bootstrap";
|
|
37
38
|
import { inMemoryStorageNotifications } from "../../shared/notifications/infrastructure/persistence/inMemoryStorageNotifications";
|
|
38
39
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
39
|
-
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView, uiSettingByKeyView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => {
|
|
40
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, isSizeChangeEnabledByCheckoutIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView, uiSettingByKeyView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => {
|
|
40
41
|
let messaging = messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
41
42
|
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
42
43
|
view: fiveItemsDiscountByCustomerIdView,
|
|
@@ -49,6 +50,9 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
49
50
|
})
|
|
50
51
|
.query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
|
|
51
52
|
view: isCheckoutEnabledByCustomerIdView,
|
|
53
|
+
})
|
|
54
|
+
.query(VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID, viewIsSizeChangeEnabledByCheckoutIdHandler, {
|
|
55
|
+
view: isSizeChangeEnabledByCheckoutIdView,
|
|
52
56
|
})
|
|
53
57
|
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler)
|
|
54
58
|
.command(START_CHECKOUT, startCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
@@ -9,6 +9,7 @@ import { httpCheckoutByIdView } from "../projection/checkout/httpCheckoutByIdVie
|
|
|
9
9
|
import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checkout/httpFirstAvailableCheckoutByCustomerIdView";
|
|
10
10
|
import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/httpFiveItemsDiscountByCustomerIdView";
|
|
11
11
|
import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/checkout/httpIsCheckoutEnabledByCustomerIdView";
|
|
12
|
+
import { httpIsSizeChangeEnabledByCheckoutIdView } from "../projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView";
|
|
12
13
|
import { httpCheckoutBookingByIdView } from "../projection/checkoutBooking/httpCheckoutBookingByIdView";
|
|
13
14
|
import { httpCheckoutItemByIdView } from "../projection/checkoutItem/httpCheckoutItemByIdView";
|
|
14
15
|
import { httpCheckoutQuestionsByCheckoutIdView } from "../projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView";
|
|
@@ -25,6 +26,7 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
25
26
|
checkoutByIdView: httpCheckoutByIdView({ httpPost }),
|
|
26
27
|
firstAvailableCheckoutByCustomerIdView: httpFirstAvailableCheckoutByCustomerIdView({ httpPost }),
|
|
27
28
|
isCheckoutEnabledByCustomerIdView: httpIsCheckoutEnabledByCustomerIdView({ httpGet }),
|
|
29
|
+
isSizeChangeEnabledByCheckoutIdView: httpIsSizeChangeEnabledByCheckoutIdView({ httpGet }),
|
|
28
30
|
fiveItemsDiscountByCustomerIdView: httpFiveItemsDiscountByCustomerIdView({ httpGet }),
|
|
29
31
|
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
30
32
|
checkoutItemByIdView: httpCheckoutItemByIdView({ httpPost }),
|
package/dist/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IsSizeChangeEnabledByCheckoutIdView } from "../../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
|
|
2
|
-
import {
|
|
2
|
+
import { HttpGetFunction } from "../../delivery/http/httpClient";
|
|
3
3
|
interface HttpIsSizeChangeEnabledByCheckoutIdView extends IsSizeChangeEnabledByCheckoutIdView {
|
|
4
4
|
}
|
|
5
5
|
interface HttpIsSizeChangeEnabledByCheckoutIdViewFunctionArgs {
|
|
6
|
-
readonly
|
|
6
|
+
readonly httpGet: HttpGetFunction;
|
|
7
7
|
}
|
|
8
8
|
interface HttpIsSizeChangeEnabledByCheckoutIdViewFunction {
|
|
9
9
|
(args: HttpIsSizeChangeEnabledByCheckoutIdViewFunctionArgs): HttpIsSizeChangeEnabledByCheckoutIdView;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpIsSizeChangeEnabledByCheckoutIdView = ({
|
|
2
|
-
endpoint:
|
|
1
|
+
const httpIsSizeChangeEnabledByCheckoutIdView = ({ httpGet }) => async ({ checkoutId, signal }) => await httpGet({
|
|
2
|
+
endpoint: `/is-size-change-enabled-by-checkout-id/${checkoutId}`,
|
|
3
3
|
signal,
|
|
4
|
-
body: { checkoutId },
|
|
5
4
|
result: {
|
|
6
5
|
error: false,
|
|
7
|
-
success: (response) => response
|
|
6
|
+
success: (response) => response,
|
|
8
7
|
},
|
|
9
8
|
});
|
|
10
9
|
export { httpIsSizeChangeEnabledByCheckoutIdView };
|
|
@@ -5,6 +5,7 @@ import { Logger } from "../../../shared/logging/Logger";
|
|
|
5
5
|
type Status = "idle" | "loading" | "success" | "error";
|
|
6
6
|
interface SubmitCheckoutFunctionArgs {
|
|
7
7
|
readonly paymentFlowPayload: PaymentFlowPayloadProjection;
|
|
8
|
+
readonly sizeChangeEnabled: boolean;
|
|
8
9
|
}
|
|
9
10
|
interface SubmitCheckoutFunction {
|
|
10
11
|
(args: SubmitCheckoutFunctionArgs): Promise<void>;
|
|
@@ -12,9 +12,9 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
|
|
|
12
12
|
const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId, logger });
|
|
13
13
|
const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
14
14
|
const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState("idle");
|
|
15
|
-
const submitCheckout = useCallback(async ({ paymentFlowPayload }) => {
|
|
15
|
+
const submitCheckout = useCallback(async ({ paymentFlowPayload, sizeChangeEnabled }) => {
|
|
16
16
|
try {
|
|
17
|
-
await blockCheckoutBooking();
|
|
17
|
+
sizeChangeEnabled && (await blockCheckoutBooking());
|
|
18
18
|
}
|
|
19
19
|
catch (error) {
|
|
20
20
|
return;
|
|
@@ -38,7 +38,7 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
}, [paymentFlowRef, blockCheckoutBooking,
|
|
41
|
+
}, [paymentFlowRef, blockCheckoutBooking, submitCheckoutCommand, createNotification]);
|
|
42
42
|
const status = useMemo(() => {
|
|
43
43
|
if (blockCheckoutBookingStatus === CommandStatus.LOADING ||
|
|
44
44
|
startLegacyBoxCheckoutStatus === "loading" ||
|
|
@@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
4
4
|
import { useNavigate } from "react-router-native";
|
|
5
5
|
import { useLogger } from "../../../../../../shared/logging/useLogger";
|
|
6
6
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
7
|
+
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
7
8
|
import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
8
9
|
import { useSubmitCheckout } from "../../../../hooks/useSubmitCheckout";
|
|
9
10
|
import { Routes } from "../../../../routing/routes";
|
|
@@ -15,6 +16,7 @@ const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
|
|
|
15
16
|
const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
|
|
16
17
|
checkoutId: checkout?.id,
|
|
17
18
|
});
|
|
19
|
+
const [sizeChangeEnabled] = useViewIsSizeChangeEnabledByCheckoutId({ checkoutId: checkout?.id });
|
|
18
20
|
const [authToken, setAuthToken] = useState();
|
|
19
21
|
useEffect(() => {
|
|
20
22
|
const loadAuthToken = async () => setAuthToken(await getAuthToken());
|
|
@@ -31,10 +33,10 @@ const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
|
|
|
31
33
|
logger,
|
|
32
34
|
});
|
|
33
35
|
useEffect(() => {
|
|
34
|
-
if (paymentFlowPayload) {
|
|
35
|
-
submitCheckout({ paymentFlowPayload });
|
|
36
|
+
if (paymentFlowPayload && sizeChangeEnabled !== undefined) {
|
|
37
|
+
submitCheckout({ paymentFlowPayload, sizeChangeEnabled });
|
|
36
38
|
}
|
|
37
|
-
}, [paymentFlowPayload, submitCheckout]);
|
|
39
|
+
}, [paymentFlowPayload, sizeChangeEnabled, submitCheckout]);
|
|
38
40
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
39
41
|
const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) && authToken;
|
|
40
42
|
if (!dependenciesLoaded)
|
|
@@ -14,6 +14,7 @@ import { useResetCheckoutItem } from "../../../domain/checkoutItem/react/useRese
|
|
|
14
14
|
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
15
15
|
import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
|
|
16
16
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
17
|
+
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
17
18
|
import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
|
|
18
19
|
import { TrackingPage } from "../../../tracking/tracking";
|
|
19
20
|
import { Body } from "../../components/layouts/body/Body";
|
|
@@ -34,6 +35,9 @@ const Item = ({ customerId, country }) => {
|
|
|
34
35
|
const logger = useLogger();
|
|
35
36
|
const { id } = useParams();
|
|
36
37
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
38
|
+
const [isSizeChangeEnabled, sizeChangeEnabledStatus] = useViewIsSizeChangeEnabledByCheckoutId({
|
|
39
|
+
checkoutId: checkout?.id,
|
|
40
|
+
});
|
|
37
41
|
const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
|
|
38
42
|
usePageView({
|
|
39
43
|
page: TrackingPage.ITEM,
|
|
@@ -58,7 +62,7 @@ const Item = ({ customerId, country }) => {
|
|
|
58
62
|
const [sizeWithoutStockModalVisible, setSizeWithoutStockModalVisible] = useState(false);
|
|
59
63
|
const handleOnShowSizeWithoutStockModal = useCallback(() => setSizeWithoutStockModalVisible(true), []);
|
|
60
64
|
const handleOnHideSizeWithoutStockModal = useCallback(() => setSizeWithoutStockModalVisible(false), []);
|
|
61
|
-
const [bookedProductsVariants
|
|
65
|
+
const [bookedProductsVariants] = useViewBookedProductsVariantsForCheckoutItem({
|
|
62
66
|
checkoutItemId: checkoutItem.id,
|
|
63
67
|
});
|
|
64
68
|
const [bookCheckoutBooking] = useBookCheckoutBookingForCheckoutItem({
|
|
@@ -66,9 +70,10 @@ const Item = ({ customerId, country }) => {
|
|
|
66
70
|
checkoutBookingId: checkout?.checkoutBookingId,
|
|
67
71
|
logger,
|
|
68
72
|
});
|
|
73
|
+
const isBookingRequired = bookedProductsVariants === null && isSizeChangeEnabled;
|
|
69
74
|
useEffect(() => {
|
|
70
|
-
|
|
71
|
-
}, [bookCheckoutBooking,
|
|
75
|
+
isBookingRequired && bookCheckoutBooking();
|
|
76
|
+
}, [bookCheckoutBooking, isBookingRequired]);
|
|
72
77
|
const [returnQuestions, returnQuestionsStatus] = useListReturnQuestionsByCheckoutItemId({
|
|
73
78
|
checkoutItemId: checkoutItem.id,
|
|
74
79
|
});
|
|
@@ -89,17 +94,17 @@ const Item = ({ customerId, country }) => {
|
|
|
89
94
|
: { id: checkoutItem.productVariant.id, size: checkoutItem.productVariant.size }, [checkoutItem.productVariant.id, checkoutItem.productVariant.size, checkoutItem.replacedFor, checkoutItem.status]);
|
|
90
95
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
91
96
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(returnQuestionsStatus) &&
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
dependenciesLoadedStatuses.includes(sizeChangeEnabledStatus) &&
|
|
98
|
+
// This will ensure that the view is not shown until bookCheckoutBooking use-case is dispatched (if required)
|
|
99
|
+
(isBookingRequired ? checkout?.checkoutBookingId && bookedProductsVariants : true) &&
|
|
100
|
+
(dependenciesLoadedStatuses.includes(checkoutStatus) || checkout);
|
|
96
101
|
if (!dependenciesLoaded)
|
|
97
102
|
return React.createElement(Spinner, null);
|
|
98
103
|
const { price } = checkoutItem;
|
|
99
104
|
const { media, brand, name, color } = checkoutItem.productVariant;
|
|
100
105
|
return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
|
|
101
106
|
React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
|
|
102
|
-
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, footer: !customerDecissionMade && (React.createElement(ItemActions, { country: country, keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedProductsVariants?.productVariants
|
|
107
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, footer: !customerDecissionMade && (React.createElement(ItemActions, { country: country, keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedProductsVariants?.productVariants, returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep: keepCheckoutItem, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })) },
|
|
103
108
|
React.createElement(Body, null,
|
|
104
109
|
customerDecissionMade && (React.createElement(CustomerDecissionBanner, { changingDecission: resetCheckoutItemStatus === CommandStatus.LOADING, checkoutItemStatus: checkoutItem.status, onPress: resetCheckoutItem })),
|
|
105
110
|
React.createElement(View, { style: [style.content, { paddingBottom: Platform.OS === "web" ? spaceXL : stickyHeight }] },
|
|
@@ -3,7 +3,7 @@ import { ProductVariantProjection } from "../../../../../../projection/bookedPro
|
|
|
3
3
|
import { Country } from "../../../../../../projection/shared/country";
|
|
4
4
|
import { Layout } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
|
|
5
5
|
interface ItemActionsProps {
|
|
6
|
-
readonly productVariants
|
|
6
|
+
readonly productVariants?: ProductVariantProjection[];
|
|
7
7
|
readonly productVariantSelected: ProductVariantProjection;
|
|
8
8
|
readonly keepButtonLoading?: boolean;
|
|
9
9
|
readonly returnButtonLoading?: boolean;
|
|
@@ -13,7 +13,7 @@ const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoadin
|
|
|
13
13
|
const sizeSelectorLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
|
|
14
14
|
const keepButtonText = useI18nMessage({ id: I18nMessages.ITEM_KEEP_BUTTON });
|
|
15
15
|
const returnButtonText = useI18nMessage({ id: I18nMessages.ITEM_RETURN_BUTTON });
|
|
16
|
-
const sizeSelectorOptions = useMemo(() => productVariants.map((productVariant) => ({
|
|
16
|
+
const sizeSelectorOptions = useMemo(() => (productVariants || []).map((productVariant) => ({
|
|
17
17
|
label: size({ size: productVariant.size, country }),
|
|
18
18
|
value: productVariant.id,
|
|
19
19
|
})), [country, productVariants]);
|
|
@@ -23,7 +23,7 @@ const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoadin
|
|
|
23
23
|
React.createElement(Body, { style: { column: style.container } },
|
|
24
24
|
React.createElement(Button, { busy: keepButtonLoading, onPress: onKeep }, keepButtonText),
|
|
25
25
|
React.createElement(View, { style: style.row },
|
|
26
|
-
!productVariantSelected.size.unique && (React.createElement(SelectField, { ...(disabledSizeSelector && {
|
|
26
|
+
!productVariantSelected.size.unique && productVariants && (React.createElement(SelectField, { ...(disabledSizeSelector && {
|
|
27
27
|
onPress: onSizeSelectorPress,
|
|
28
28
|
}), disabled: sizeSelectorDisabled, options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", testID: "size-selector", title: sizeSelectorLabelText || "", value: productVariantSelected.id, style: {
|
|
29
29
|
selectField: style.sizeSelector,
|