@lookiero/checkout 3.0.0-beta.2 → 3.0.0-beta.5
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/components/layouts/layout/Layout.d.ts +4 -2
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +2 -2
- package/dist/infrastructure/ui/components/templates/header/Header.js +7 -3
- package/dist/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -11
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +4 -1
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +2 -2
- package/dist/infrastructure/ui/views/checkout/Checkout.js +8 -5
- package/dist/infrastructure/ui/views/item/Item.js +2 -1
- package/dist/infrastructure/ui/views/summary/Summary.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FC, ReactNode } from "react";
|
|
2
|
-
import { LayoutChangeEvent, StyleProp, ViewStyle } from "react-native";
|
|
1
|
+
import { FC, ReactNode, RefObject } from "react";
|
|
2
|
+
import { LayoutChangeEvent, ScrollView, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
interface LayoutStyle {
|
|
4
4
|
readonly safeAreaView: StyleProp<ViewStyle>;
|
|
5
5
|
readonly scrollView: StyleProp<ViewStyle>;
|
|
@@ -11,6 +11,8 @@ interface LayoutProps {
|
|
|
11
11
|
readonly panel?: JSX.Element | null;
|
|
12
12
|
readonly stickyHeader?: boolean;
|
|
13
13
|
readonly stickyHeaderHiddenOnScroll?: boolean;
|
|
14
|
+
readonly scrollRef?: RefObject<ScrollView>;
|
|
15
|
+
readonly scrollEnabled?: boolean;
|
|
14
16
|
readonly style?: Partial<LayoutStyle>;
|
|
15
17
|
readonly onLayout?: (event: LayoutChangeEvent) => void;
|
|
16
18
|
}
|
|
@@ -7,8 +7,8 @@ import { DefaultHeader } from "../../../templates/header/defaultHeader/DefaultHe
|
|
|
7
7
|
import { Footer } from "../components/footer/Footer";
|
|
8
8
|
import { Header } from "../components/header/Header";
|
|
9
9
|
import { style } from "./DummyLayout.style";
|
|
10
|
-
const DummyLayout = ({ children, header = React.createElement(DefaultHeader, null), footer = React.createElement(DefaultFooter, null), panel, style: customStyle, onLayout, }) => (React.createElement(SafeAreaView, { style: [style.safeAreaView, customStyle?.safeAreaView] },
|
|
11
|
-
React.createElement(ScrollView, { contentContainerStyle: [style.scrollView, customStyle?.scrollView], scrollEventThrottle: 16, showsVerticalScrollIndicator: false, stickyHeaderIndices: [0] },
|
|
10
|
+
const DummyLayout = ({ children, header = React.createElement(DefaultHeader, null), footer = React.createElement(DefaultFooter, null), panel, style: customStyle, scrollEnabled, onLayout, }) => (React.createElement(SafeAreaView, { style: [style.safeAreaView, customStyle?.safeAreaView] },
|
|
11
|
+
React.createElement(ScrollView, { contentContainerStyle: [style.scrollView, customStyle?.scrollView], scrollEnabled: scrollEnabled, scrollEventThrottle: 16, showsVerticalScrollIndicator: false, stickyHeaderIndices: [0] },
|
|
12
12
|
React.createElement(Header, null, header),
|
|
13
13
|
panel,
|
|
14
14
|
React.createElement(View, { style: style.children, onLayout: onLayout }, children)),
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Platform, View } from "react-native";
|
|
3
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
3
4
|
import { style } from "./Header.style";
|
|
4
|
-
const Header = ({ children, style: customStyle, ...props }) =>
|
|
5
|
+
const Header = ({ children, style: customStyle, ...props }) => {
|
|
6
|
+
const Component = useMemo(() => (Platform.OS === "android" ? SafeAreaView : View), []);
|
|
7
|
+
return (React.createElement(Component, { ...props, style: [style.header, customStyle] }, children));
|
|
8
|
+
};
|
|
5
9
|
export { Header };
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
-
import React
|
|
4
|
-
import { useNavigate } from "react-router-native";
|
|
3
|
+
import React from "react";
|
|
5
4
|
import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
6
5
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
7
|
-
import { Routes } from "../../../../routing/routes";
|
|
8
|
-
import { useBasePath } from "../../../../routing/useBasePath";
|
|
9
6
|
import { Header } from "../Header";
|
|
10
7
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
11
8
|
const CheckoutHeader = ({ onBack }) => {
|
|
12
9
|
const title = useI18nMessage({ id: I18nMessages.HEADER_COMPLETE_CHECKOUT_TITLE });
|
|
13
|
-
const basePath = useBasePath();
|
|
14
|
-
const navigate = useNavigate();
|
|
15
|
-
const handleOnBack = useCallback(() => {
|
|
16
|
-
onBack?.();
|
|
17
|
-
navigate(`${basePath}/${Routes.SUMMARY}`);
|
|
18
|
-
}, [basePath, navigate, onBack]);
|
|
19
10
|
return (React.createElement(Header, { testID: "checkout-header" },
|
|
20
|
-
React.createElement(ButtonIcon, { name: "arrow-left", testID: "arrow-left-button-icon", onPress:
|
|
11
|
+
React.createElement(ButtonIcon, { name: "arrow-left", testID: "arrow-left-button-icon", onPress: onBack }),
|
|
21
12
|
React.createElement(Text, { level: 3, detail: true, upperCase: true }, title),
|
|
22
13
|
React.createElement(ButtonIconPlaceholder, null)));
|
|
23
14
|
};
|
|
@@ -4,8 +4,8 @@ import { Header } from "../Header";
|
|
|
4
4
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
5
5
|
import { Logo } from "../logo/Logo";
|
|
6
6
|
import { style } from "./DefaultHeader.style";
|
|
7
|
-
const DefaultHeader = () => (React.createElement(Header, { testID: "default-header" },
|
|
7
|
+
const DefaultHeader = ({ onPressMenu }) => (React.createElement(Header, { testID: "default-header" },
|
|
8
8
|
React.createElement(Logo, { style: style.logo }),
|
|
9
9
|
React.createElement(ButtonIconPlaceholder, null),
|
|
10
|
-
React.createElement(ButtonIcon, { name: "menu", testID: "menu-button-icon", onPress:
|
|
10
|
+
React.createElement(ButtonIcon, { name: "menu", testID: "menu-button-icon", onPress: onPressMenu })));
|
|
11
11
|
export { DefaultHeader };
|
|
@@ -45,11 +45,14 @@ const Checkout = ({ children, customerId, country, layout: Layout, useRedirect }
|
|
|
45
45
|
const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
46
46
|
const hasReplacedCheckoutItem = useMemo(() => checkout?.items.some((checkoutItem) => checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
47
47
|
const trackPressBack = useTrackPressBack();
|
|
48
|
-
const handleOnBack = useCallback(() =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
const handleOnBack = useCallback(() => {
|
|
49
|
+
trackPressBack({
|
|
50
|
+
page: TrackingPage.CHECKOUT,
|
|
51
|
+
country,
|
|
52
|
+
checkoutId: checkout?.id,
|
|
53
|
+
});
|
|
54
|
+
navigate(`${basePath}/${Routes.SUMMARY}`);
|
|
55
|
+
}, [basePath, checkout?.id, country, navigate, trackPressBack]);
|
|
53
56
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
54
57
|
const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) &&
|
|
55
58
|
dependenciesLoadedStatuses.includes(pricingStatus);
|
|
@@ -128,6 +128,7 @@ const Item = ({ customerId, country, layout: Layout }) => {
|
|
|
128
128
|
const header = useMemo(() => itemDetailRouteMatch ? (React.createElement(ItemDetailHeader, { onBack: handleOnBack })) : (React.createElement(ItemHeader, { item: checkoutItem, items: checkout?.items, onNext: handleOnNext, onPrevious: handleOnPrevious })), [checkout?.items, checkoutItem, handleOnBack, handleOnNext, handleOnPrevious, itemDetailRouteMatch]);
|
|
129
129
|
const [height, setHeight] = useState(0);
|
|
130
130
|
const handleOnLayout = useCallback((event) => setHeight(event.nativeEvent.layout.height), []);
|
|
131
|
+
const itemWithoutCustomerDecission = checkoutItem.status === CheckoutItemStatus.INITIAL;
|
|
131
132
|
const dependenciesLoaded = checkoutStatus !== QueryStatus.LOADING &&
|
|
132
133
|
checkout &&
|
|
133
134
|
checkoutItem &&
|
|
@@ -141,7 +142,7 @@ const Item = ({ customerId, country, layout: Layout }) => {
|
|
|
141
142
|
return React.createElement(Spinner, null);
|
|
142
143
|
}
|
|
143
144
|
return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
|
|
144
|
-
React.createElement(Layout, { header: header, style: { scrollView: { height:
|
|
145
|
+
React.createElement(Layout, { header: header, scrollEnabled: !itemWithoutCustomerDecission, style: { scrollView: { height: itemWithoutCustomerDecission ? height : "auto" } }, onLayout: handleOnLayout }, itemWithoutCustomerDecission ? (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 }))),
|
|
145
146
|
React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem })));
|
|
146
147
|
};
|
|
147
148
|
export { Item };
|
|
@@ -85,7 +85,7 @@ const Summary = ({ customerId, country, layout: Layout }) => {
|
|
|
85
85
|
dependenciesLoadedStatuses.includes(fiveItemsDiscountStatus);
|
|
86
86
|
if (!dependenciesLoaded)
|
|
87
87
|
return React.createElement(Spinner, null);
|
|
88
|
-
return (React.createElement(Layout, { style: { scrollView: { height } }, onLayout: handleOnLayout },
|
|
88
|
+
return (React.createElement(Layout, { scrollEnabled: false, style: { scrollView: { height } }, onLayout: handleOnLayout },
|
|
89
89
|
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
90
90
|
React.createElement(Body, { style: { row: { paddingBottom: pricingHeight + spaceXXL } } },
|
|
91
91
|
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|