@lookiero/checkout 4.0.3 → 4.1.0--2024.2.5.151702
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/summary/components → components/atoms}/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +5 -3
- package/dist/infrastructure/ui/{views/summary/components → components/atoms}/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +1 -1
- package/dist/infrastructure/ui/components/layouts/banner/Banner.js +7 -3
- package/dist/infrastructure/ui/i18n/i18n.d.ts +1 -1
- package/dist/infrastructure/ui/i18n/i18n.js +1 -1
- package/dist/infrastructure/ui/views/item/Item.js +17 -1
- package/dist/infrastructure/ui/views/item/Item.style.d.ts +7 -0
- package/dist/infrastructure/ui/views/item/Item.style.js +8 -0
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -1
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.style.js +2 -2
- package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +4 -3
- package/dist/infrastructure/ui/views/summary/Summary.js +2 -2
- package/package.json +1 -1
- /package/dist/infrastructure/ui/{views/summary/components → components/atoms}/fiveItemsDiscountBanner/FiveItemsDiscountBanner.d.ts +0 -0
- /package/dist/infrastructure/ui/{views/summary/components → components/atoms}/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.d.ts +0 -0
|
@@ -2,14 +2,16 @@ import { Text } from "@lookiero/aurora";
|
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
-
import {
|
|
5
|
+
import { useScreenSize } from "../../../../../shared/ui/hooks/useScreenSize";
|
|
6
|
+
import { I18nMessages } from "../../../i18n/i18n";
|
|
6
7
|
import { style } from "./FiveItemsDiscountBanner.style";
|
|
7
8
|
const FiveItemsDiscountBanner = ({ fiveItemsDiscount }) => {
|
|
9
|
+
const screenSize = useScreenSize();
|
|
8
10
|
const bannerText = useI18nMessage({
|
|
9
|
-
id: I18nMessages.
|
|
11
|
+
id: I18nMessages.BANNER_DISCOUNT_TEXT,
|
|
10
12
|
values: { discount: fiveItemsDiscount.toString() },
|
|
11
13
|
});
|
|
12
14
|
return (React.createElement(View, { style: style.container },
|
|
13
|
-
React.createElement(Text, { level:
|
|
15
|
+
React.createElement(Text, { level: screenSize === "S" ? 2 : 1, detail: true }, bannerText)));
|
|
14
16
|
};
|
|
15
17
|
export { FiveItemsDiscountBanner };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ALIGN, Text } from "@lookiero/aurora";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
|
+
import { useScreenSize } from "../../../../../shared/ui/hooks/useScreenSize";
|
|
4
5
|
import { style } from "./Banner.style";
|
|
5
|
-
const Banner = ({ children, text }) =>
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const Banner = ({ children, text }) => {
|
|
7
|
+
const screenSize = useScreenSize();
|
|
8
|
+
return (React.createElement(View, { style: style.container },
|
|
9
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: screenSize === "S" ? 2 : 1, detail: true }, text),
|
|
10
|
+
children));
|
|
11
|
+
};
|
|
8
12
|
export { Banner };
|
|
@@ -27,7 +27,7 @@ declare enum I18nMessages {
|
|
|
27
27
|
RETURN_QUESTIONS_SUBMIT_BUTTON = "return_questions.submit_button",
|
|
28
28
|
SUMMARY_TITLE = "summary.title",
|
|
29
29
|
SUMMARY_DESCRIPTION = "summary.description",
|
|
30
|
-
|
|
30
|
+
BANNER_DISCOUNT_TEXT = "summary.banner",
|
|
31
31
|
SUMMARY_KEEP_TAB = "summary.keep_tab",
|
|
32
32
|
SUMMARY_RETURN_TAB = "summary.return_tab",
|
|
33
33
|
SUMMARY_KEEP_EMPTY = "summary.keep_empty",
|
|
@@ -28,7 +28,7 @@ var I18nMessages;
|
|
|
28
28
|
I18nMessages["RETURN_QUESTIONS_SUBMIT_BUTTON"] = "return_questions.submit_button";
|
|
29
29
|
I18nMessages["SUMMARY_TITLE"] = "summary.title";
|
|
30
30
|
I18nMessages["SUMMARY_DESCRIPTION"] = "summary.description";
|
|
31
|
-
I18nMessages["
|
|
31
|
+
I18nMessages["BANNER_DISCOUNT_TEXT"] = "summary.banner";
|
|
32
32
|
I18nMessages["SUMMARY_KEEP_TAB"] = "summary.keep_tab";
|
|
33
33
|
I18nMessages["SUMMARY_RETURN_TAB"] = "summary.return_tab";
|
|
34
34
|
I18nMessages["SUMMARY_KEEP_EMPTY"] = "summary.keep_empty";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Box } from "@lookiero/aurora";
|
|
1
2
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
4
|
import { useMatch, useNavigate, useParams } from "react-router-native";
|
|
@@ -13,20 +14,24 @@ import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutB
|
|
|
13
14
|
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
14
15
|
import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
|
|
15
16
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
17
|
+
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
|
|
16
18
|
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
17
19
|
import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
|
|
18
20
|
import { TrackingPage } from "../../../tracking/tracking";
|
|
21
|
+
import { FiveItemsDiscountBanner } from "../../components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
19
22
|
import { ReturnQuestionFeedbackProvider } from "../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
|
|
20
23
|
import { ItemDetailHeader } from "../../components/templates/header/itemDetailHeader/ItemDetailHeader";
|
|
21
24
|
import { ItemHeader } from "../../components/templates/header/itemHeader/ItemHeader";
|
|
22
25
|
import { Routes } from "../../routing/routes";
|
|
23
26
|
import { useBasePath } from "../../routing/useBasePath";
|
|
27
|
+
import { style } from "./Item.style";
|
|
24
28
|
import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQuestionsForm";
|
|
25
29
|
import { ItemWithCustomerDecission, } from "./views/itemWithCustomerDecission/ItemWithCustomerDecission";
|
|
26
30
|
import { ItemWithoutCustomerDecission, } from "./views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission";
|
|
27
31
|
const Item = ({ customerId, country, layout: Layout }) => {
|
|
28
32
|
const logger = useLogger();
|
|
29
33
|
const { id } = useParams();
|
|
34
|
+
const [fiveItemsDiscount = 0, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({ customerId });
|
|
30
35
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
31
36
|
const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
|
|
32
37
|
/* SizeChange and Booking */
|
|
@@ -125,7 +130,17 @@ const Item = ({ customerId, country, layout: Layout }) => {
|
|
|
125
130
|
}, [checkout?.id, country, navigate, trackPressBack]);
|
|
126
131
|
const basePath = useBasePath();
|
|
127
132
|
const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
|
|
128
|
-
const header = useMemo(() =>
|
|
133
|
+
const header = useMemo(() => (React.createElement(Box, { style: style.header },
|
|
134
|
+
itemDetailRouteMatch ? (React.createElement(ItemDetailHeader, { onBack: handleOnBack })) : (React.createElement(ItemHeader, { item: checkoutItem, items: checkout?.items, onNext: handleOnNext, onPrevious: handleOnPrevious })),
|
|
135
|
+
fiveItemsDiscount !== 0 ? React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }) : null)), [
|
|
136
|
+
checkout?.items,
|
|
137
|
+
checkoutItem,
|
|
138
|
+
fiveItemsDiscount,
|
|
139
|
+
handleOnBack,
|
|
140
|
+
handleOnNext,
|
|
141
|
+
handleOnPrevious,
|
|
142
|
+
itemDetailRouteMatch,
|
|
143
|
+
]);
|
|
129
144
|
const [height, setHeight] = useState(0);
|
|
130
145
|
const handleOnLayout = useCallback((event) => setHeight(event.nativeEvent.layout.height), []);
|
|
131
146
|
const itemWithoutCustomerDecission = checkoutItem.status === CheckoutItemStatus.INITIAL;
|
|
@@ -135,6 +150,7 @@ const Item = ({ customerId, country, layout: Layout }) => {
|
|
|
135
150
|
returnQuestions &&
|
|
136
151
|
// This will ensure that the view is not shown until bookCheckoutBooking use-case is dispatched (if required)
|
|
137
152
|
bookedProductsVariantsStatus !== QueryStatus.LOADING &&
|
|
153
|
+
fiveItemsDiscountStatus !== QueryStatus.LOADING &&
|
|
138
154
|
sizeChangeEnabledStatus !== QueryStatus.LOADING &&
|
|
139
155
|
(isBookingRequired ? checkout.checkoutBookingId && bookedProductsVariants : true) &&
|
|
140
156
|
returnCheckoutItemStatus !== CommandStatus.LOADING;
|
|
@@ -3,6 +3,7 @@ import { useI18nMessage } from "@lookiero/i18n-react";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Pressable } from "react-native";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
|
+
import { useScreenSize } from "../../../../../../shared/ui/hooks/useScreenSize";
|
|
6
7
|
import { Banner } from "../../../../components/layouts/banner/Banner";
|
|
7
8
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
9
|
import { style } from "./CustomerDecissionBanner.style";
|
|
@@ -14,8 +15,9 @@ const i18nMessageForCheckoutItemStatus = {
|
|
|
14
15
|
const CustomerDecissionBanner = ({ checkoutItemStatus, onPress }) => {
|
|
15
16
|
const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] });
|
|
16
17
|
const bannerButtonText = useI18nMessage({ id: I18nMessages.ITEM_BANNER_BUTTON });
|
|
18
|
+
const screenSize = useScreenSize();
|
|
17
19
|
return (React.createElement(Banner, { text: decissionText },
|
|
18
20
|
React.createElement(Pressable, { style: style.button, testID: "customer-decission-banner", onPress: onPress },
|
|
19
|
-
React.createElement(Text, { level: 2, style: style.buttonText, detail: true }, bannerButtonText))));
|
|
21
|
+
React.createElement(Text, { level: screenSize === "S" ? 2 : 1, style: style.buttonText, detail: true }, bannerButtonText))));
|
|
20
22
|
};
|
|
21
23
|
export { CustomerDecissionBanner };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { colorBase, colorGrayscaleL, colorContent, spaceM,
|
|
3
|
+
const { colorBase, colorGrayscaleL, colorContent, spaceM, spaceXXXL } = theme();
|
|
4
4
|
const PAGINATION_SIZE = 37;
|
|
5
5
|
const style = StyleSheet.create({
|
|
6
6
|
image: {
|
|
@@ -26,7 +26,7 @@ const style = StyleSheet.create({
|
|
|
26
26
|
position: "relative",
|
|
27
27
|
},
|
|
28
28
|
slide: {
|
|
29
|
-
paddingHorizontal:
|
|
29
|
+
paddingHorizontal: spaceXXXL,
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
export { style };
|
|
@@ -34,9 +34,10 @@ const ItemWithCustomerDecission = ({ country, checkoutId, checkoutItem, returnQu
|
|
|
34
34
|
if (!dependenciesLoaded) {
|
|
35
35
|
return React.createElement(Spinner, null);
|
|
36
36
|
}
|
|
37
|
-
return (React.createElement(
|
|
37
|
+
return (React.createElement(React.Fragment, null,
|
|
38
38
|
React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: resetItem }),
|
|
39
|
-
React.createElement(
|
|
40
|
-
React.createElement(
|
|
39
|
+
React.createElement(Body, { style: { row: style.container } },
|
|
40
|
+
React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant }, checkoutItem.status === CheckoutItemStatus.RETURNED && (React.createElement(View, { style: style.feedbackContainer },
|
|
41
|
+
React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions, onEditFeedback: onEditFeedback })))))));
|
|
41
42
|
};
|
|
42
43
|
export { ItemWithCustomerDecission };
|
|
@@ -13,13 +13,13 @@ import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/c
|
|
|
13
13
|
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
|
|
14
14
|
import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
15
15
|
import { TrackingPage } from "../../../tracking/tracking";
|
|
16
|
+
import { FiveItemsDiscountBanner } from "../../components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
16
17
|
import { Body } from "../../components/layouts/body/Body";
|
|
17
18
|
import { I18nMessages } from "../../i18n/i18n";
|
|
18
19
|
import { Routes } from "../../routing/routes";
|
|
19
20
|
import { useBasePath } from "../../routing/useBasePath";
|
|
20
21
|
import { theme } from "../../theme/theme";
|
|
21
22
|
import { style } from "./Summary.style";
|
|
22
|
-
import { FiveItemsDiscountBanner } from "./components/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
23
23
|
import { StickyPricing } from "./components/stickyPricing/StickyPricing";
|
|
24
24
|
const { spaceXXL } = theme();
|
|
25
25
|
const Summary = ({ customerId, country, layout: Layout, children }) => {
|
|
@@ -78,8 +78,8 @@ const Summary = ({ customerId, country, layout: Layout, children }) => {
|
|
|
78
78
|
return React.createElement(Spinner, null);
|
|
79
79
|
return (React.createElement(Layout, { ...layoutProps, onLayout: handleOnLayout },
|
|
80
80
|
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
81
|
+
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
81
82
|
React.createElement(Body, { style: { row: { paddingBottom: pricingHeight + spaceXXL } } },
|
|
82
|
-
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
83
83
|
React.createElement(View, { style: style.content },
|
|
84
84
|
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
85
85
|
React.createElement(Text, { level: 3, style: style.description }, descriptionText)),
|
package/package.json
CHANGED
|
File without changes
|