@lookiero/checkout 1.1.4-beta.3 → 1.1.4-beta.4
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/ui/views/item/Item.js +9 -4
- package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.d.ts +2 -0
- package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +2 -5
- package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.d.ts +2 -1
- package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +2 -3
- package/dist/shared/tracking/infrastructure/useTrackItemPageView.d.ts +1 -1
- package/dist/shared/tracking/infrastructure/useTrackItemPageView.js +1 -1
- package/package.json +1 -1
|
@@ -68,20 +68,25 @@ const Item = ({ customerId, country }) => {
|
|
|
68
68
|
trackReturnItem();
|
|
69
69
|
}, [hideReturnQuestions, returnCheckoutItem, trackReturnItem]);
|
|
70
70
|
/* ReturnCheckoutItem */
|
|
71
|
+
const currentProductVariant = useMemo(() => checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
72
|
+
? { id: checkoutItem.replacedFor.id, size: checkoutItem.replacedFor.size }
|
|
73
|
+
: { id: checkoutItem.productVariant.id, size: checkoutItem.productVariant.size }, [checkoutItem.productVariant.id, checkoutItem.productVariant.size, checkoutItem.replacedFor, checkoutItem.status]);
|
|
71
74
|
const replaceableFor = useMemo(() => sizeChangeEnabledStatus === QueryStatus.SUCCESS
|
|
72
75
|
? isSizeChangeEnabled
|
|
73
76
|
? bookedProductsVariants
|
|
74
|
-
? bookedProductsVariants.productVariants
|
|
77
|
+
? bookedProductsVariants.productVariants
|
|
78
|
+
.filter(({ id }) => id !== currentProductVariant.id)
|
|
79
|
+
.map(({ size }) => size.lookiero)
|
|
75
80
|
: undefined
|
|
76
81
|
: []
|
|
77
|
-
: undefined, [bookedProductsVariants, isSizeChangeEnabled, sizeChangeEnabledStatus]);
|
|
82
|
+
: undefined, [bookedProductsVariants, currentProductVariant.id, isSizeChangeEnabled, sizeChangeEnabledStatus]);
|
|
78
83
|
useTrackItemPageView({
|
|
79
84
|
page: TrackingPage.ITEM,
|
|
80
85
|
country,
|
|
81
86
|
checkoutId: checkout?.id,
|
|
82
87
|
checkoutItemId: checkoutItem.id,
|
|
83
88
|
productVariantId: checkoutItem.productVariant.id,
|
|
84
|
-
replaceableFor
|
|
89
|
+
replaceableFor,
|
|
85
90
|
unique: checkoutItem.productVariant.size.unique,
|
|
86
91
|
});
|
|
87
92
|
const dependenciesLoaded = checkoutStatus !== QueryStatus.LOADING &&
|
|
@@ -97,7 +102,7 @@ const Item = ({ customerId, country }) => {
|
|
|
97
102
|
return React.createElement(Spinner, null);
|
|
98
103
|
}
|
|
99
104
|
return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
|
|
100
|
-
checkoutItem.status === CheckoutItemStatus.INITIAL ? (React.createElement(ItemWithoutCustomerDecission, { bookedProductsVariants: bookedProductsVariants, checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, onReturn: showReturnQuestions })) : (React.createElement(ItemWithCustomerDecission, { checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, returnQuestions: returnQuestions, onEditFeedback: showReturnQuestions })),
|
|
105
|
+
checkoutItem.status === CheckoutItemStatus.INITIAL ? (React.createElement(ItemWithoutCustomerDecission, { bookedProductsVariants: bookedProductsVariants, checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, onReturn: showReturnQuestions })) : (React.createElement(ItemWithCustomerDecission, { checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, returnQuestions: returnQuestions, onEditFeedback: showReturnQuestions })),
|
|
101
106
|
React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, country: country, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem })));
|
|
102
107
|
};
|
|
103
108
|
export { Item };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
3
|
+
import { ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
|
|
3
4
|
import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
4
5
|
import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
5
6
|
import { Country } from "../../../../../../projection/shared/country";
|
|
@@ -11,6 +12,7 @@ interface ItemWithCustomerDecissionProps {
|
|
|
11
12
|
readonly checkoutId: string;
|
|
12
13
|
readonly checkoutItem: CheckoutItemWithCustomerDecission;
|
|
13
14
|
readonly returnQuestions: ReturnQuestionProjection[];
|
|
15
|
+
readonly currentProductVariant: ProductVariantProjection;
|
|
14
16
|
readonly onEditFeedback: () => void;
|
|
15
17
|
}
|
|
16
18
|
declare const ItemWithCustomerDecission: FC<ItemWithCustomerDecissionProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import React, { useCallback
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
3
|
import { Platform, View } from "react-native";
|
|
4
4
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
5
5
|
import { useLogger } from "../../../../../../shared/logging/useLogger";
|
|
@@ -14,7 +14,7 @@ import { CustomerDecissionBanner, } from "../../components/banner/CustomerDeciss
|
|
|
14
14
|
import { ReturnQuestionsFeedback } from "../../components/returnQuestionsFeedback/ReturnQuestionsFeedback";
|
|
15
15
|
import { ProductVariant } from "../../views/productVariant/ProductVariant";
|
|
16
16
|
import { style } from "./ItemWithCustomerDecission.style";
|
|
17
|
-
const ItemWithCustomerDecission = ({ country, checkoutId, checkoutItem, returnQuestions, onEditFeedback, }) => {
|
|
17
|
+
const ItemWithCustomerDecission = ({ country, checkoutId, checkoutItem, returnQuestions, currentProductVariant, onEditFeedback, }) => {
|
|
18
18
|
const logger = useLogger();
|
|
19
19
|
/* ResetCheckoutItem */
|
|
20
20
|
const [resetCheckoutItem, resetCheckoutItemStatus] = useResetCheckoutItem({
|
|
@@ -32,9 +32,6 @@ const ItemWithCustomerDecission = ({ country, checkoutId, checkoutItem, returnQu
|
|
|
32
32
|
trackResetItem();
|
|
33
33
|
}, [resetCheckoutItem, trackResetItem]);
|
|
34
34
|
/* ResetCheckoutItem */
|
|
35
|
-
const currentProductVariant = useMemo(() => checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
36
|
-
? { id: checkoutItem.replacedFor.id, size: checkoutItem.replacedFor.size }
|
|
37
|
-
: { id: checkoutItem.productVariant.id, size: checkoutItem.productVariant.size }, [checkoutItem.productVariant.id, checkoutItem.productVariant.size, checkoutItem.replacedFor, checkoutItem.status]);
|
|
38
35
|
const dependenciesLoaded = resetCheckoutItemStatus !== CommandStatus.LOADING;
|
|
39
36
|
if (!dependenciesLoaded) {
|
|
40
37
|
return React.createElement(Spinner, null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
3
|
-
import { BookedProductsVariantsProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
|
|
3
|
+
import { BookedProductsVariantsProjection, ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
|
|
4
4
|
import "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
5
5
|
import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
6
6
|
import { Country } from "../../../../../../projection/shared/country";
|
|
@@ -12,6 +12,7 @@ interface ItemWithoutCustomerDecissionProps {
|
|
|
12
12
|
readonly checkoutId: string;
|
|
13
13
|
readonly checkoutItem: CheckoutItemWithoutCustomerDecission;
|
|
14
14
|
readonly bookedProductsVariants: BookedProductsVariantsProjection;
|
|
15
|
+
readonly currentProductVariant: ProductVariantProjection;
|
|
15
16
|
readonly onReturn: () => void;
|
|
16
17
|
}
|
|
17
18
|
declare const ItemWithoutCustomerDecission: FC<ItemWithoutCustomerDecissionProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import React, { useCallback,
|
|
2
|
+
import React, { useCallback, useState } from "react";
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
4
|
import "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
5
5
|
import { useLogger } from "../../../../../../shared/logging/useLogger";
|
|
@@ -17,7 +17,7 @@ import { ItemActions } from "../../components/itemActions/ItemActions";
|
|
|
17
17
|
import { SizeWithoutStockModal } from "../../components/sizeWithoutStockModal/SizeWithoutStockModal";
|
|
18
18
|
import { ProductVariant } from "../productVariant/ProductVariant";
|
|
19
19
|
const { spaceXL } = theme();
|
|
20
|
-
const ItemWithoutCustomerDecission = ({ country, checkoutId, checkoutItem, bookedProductsVariants, onReturn, }) => {
|
|
20
|
+
const ItemWithoutCustomerDecission = ({ country, checkoutId, checkoutItem, bookedProductsVariants, currentProductVariant, onReturn, }) => {
|
|
21
21
|
const logger = useLogger();
|
|
22
22
|
/* KeepCheckoutItem */
|
|
23
23
|
const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id, logger });
|
|
@@ -54,7 +54,6 @@ const ItemWithoutCustomerDecission = ({ country, checkoutId, checkoutItem, booke
|
|
|
54
54
|
const handleOnHideSizeWithoutStockModal = useCallback(() => setSizeWithoutStockModalVisible(false), []);
|
|
55
55
|
const [stickyHeight, setStickyHeight] = useState(0);
|
|
56
56
|
const handleOnStickyLayout = useCallback(({ height }) => setStickyHeight(height), []);
|
|
57
|
-
const currentProductVariant = useMemo(() => ({ id: checkoutItem.productVariant.id, size: checkoutItem.productVariant.size }), [checkoutItem.productVariant.id, checkoutItem.productVariant.size]);
|
|
58
57
|
const dependenciesLoaded = keepCheckoutItemStatus !== CommandStatus.LOADING && replaceCheckoutItemStatus !== CommandStatus.LOADING;
|
|
59
58
|
if (!dependenciesLoaded) {
|
|
60
59
|
return React.createElement(Spinner, null);
|
|
@@ -6,7 +6,7 @@ interface UseTrackItemPageViewFunctionArgs {
|
|
|
6
6
|
readonly checkoutId?: string;
|
|
7
7
|
readonly checkoutItemId: string;
|
|
8
8
|
readonly productVariantId: string;
|
|
9
|
-
readonly replaceableFor: string | undefined;
|
|
9
|
+
readonly replaceableFor: string[] | undefined;
|
|
10
10
|
readonly unique: boolean;
|
|
11
11
|
}
|
|
12
12
|
interface UseTrackItemPageViewFunction {
|
|
@@ -16,7 +16,7 @@ const useTrackItemPageView = ({ page, country, checkoutId, checkoutItemId, produ
|
|
|
16
16
|
checkoutId,
|
|
17
17
|
checkoutItemId,
|
|
18
18
|
productVariantId,
|
|
19
|
-
replaceableFor,
|
|
19
|
+
replaceableFor: replaceableFor.toString(),
|
|
20
20
|
unique,
|
|
21
21
|
};
|
|
22
22
|
emitUserEvent(itemPageViewTrackingEvent);
|