@lookiero/checkout 3.0.0-beta.0 → 3.0.0-beta.2
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 +7 -0
- package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +3 -43
- package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +3 -13
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +9 -8
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +6 -0
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +6 -0
- package/dist/infrastructure/ui/components/templates/header/Header.d.ts +5 -0
- package/dist/infrastructure/ui/components/templates/header/Header.js +5 -0
- package/dist/infrastructure/ui/components/templates/header/Header.style.d.ts +14 -0
- package/dist/infrastructure/ui/components/templates/header/Header.style.js +17 -0
- package/dist/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -1
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +3 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +11 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
- package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.d.ts +1 -1
- package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +4 -9
- package/dist/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +2 -1
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts +13 -0
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js +19 -0
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.d.ts +6 -0
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.js +7 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.js +13 -14
- package/dist/infrastructure/ui/views/feedback/Feedback.js +3 -5
- package/dist/infrastructure/ui/views/item/Item.js +14 -9
- package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +5 -6
- package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +2 -2
- package/dist/infrastructure/ui/views/notFound/NotFound.js +7 -8
- package/dist/infrastructure/ui/views/summary/Summary.js +7 -3
- package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/summary/Summary.style.js +1 -4
- package/package.json +1 -1
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
+
import { LayoutChangeEvent, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface LayoutStyle {
|
|
4
|
+
readonly safeAreaView: StyleProp<ViewStyle>;
|
|
5
|
+
readonly scrollView: StyleProp<ViewStyle>;
|
|
6
|
+
}
|
|
2
7
|
interface LayoutProps {
|
|
3
8
|
readonly children: ReactNode;
|
|
4
9
|
readonly header?: JSX.Element | null;
|
|
@@ -6,6 +11,8 @@ interface LayoutProps {
|
|
|
6
11
|
readonly panel?: JSX.Element | null;
|
|
7
12
|
readonly stickyHeader?: boolean;
|
|
8
13
|
readonly stickyHeaderHiddenOnScroll?: boolean;
|
|
14
|
+
readonly style?: Partial<LayoutStyle>;
|
|
15
|
+
readonly onLayout?: (event: LayoutChangeEvent) => void;
|
|
9
16
|
}
|
|
10
17
|
type Layout = FC<LayoutProps>;
|
|
11
18
|
export type { Layout };
|
package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
1
|
declare const HEADER_HEIGHT: number;
|
|
3
|
-
declare const style:
|
|
4
|
-
header: {
|
|
5
|
-
|
|
6
|
-
backgroundColor: string;
|
|
7
|
-
flexDirection: "row";
|
|
8
|
-
flexGrow: number;
|
|
9
|
-
flexWrap: "nowrap";
|
|
10
|
-
height: number;
|
|
11
|
-
justifyContent: "space-between";
|
|
12
|
-
overflow: "visible";
|
|
13
|
-
paddingHorizontal: number;
|
|
14
|
-
width: string;
|
|
15
|
-
} | {
|
|
16
|
-
position: "sticky";
|
|
17
|
-
top: number;
|
|
18
|
-
zIndex: number;
|
|
19
|
-
alignItems: "center";
|
|
20
|
-
backgroundColor: string;
|
|
21
|
-
flexDirection: "row";
|
|
22
|
-
flexGrow: number;
|
|
23
|
-
flexWrap: "nowrap";
|
|
24
|
-
height: number;
|
|
25
|
-
justifyContent: "space-between";
|
|
26
|
-
overflow: "visible";
|
|
27
|
-
paddingHorizontal: number;
|
|
28
|
-
width: string;
|
|
29
|
-
} | {
|
|
30
|
-
position: "relative";
|
|
31
|
-
top?: undefined;
|
|
32
|
-
zIndex?: undefined;
|
|
33
|
-
alignItems: "center";
|
|
34
|
-
backgroundColor: string;
|
|
35
|
-
flexDirection: "row";
|
|
36
|
-
flexGrow: number;
|
|
37
|
-
flexWrap: "nowrap";
|
|
38
|
-
height: number;
|
|
39
|
-
justifyContent: "space-between";
|
|
40
|
-
overflow: "visible";
|
|
41
|
-
paddingHorizontal: number;
|
|
42
|
-
width: string;
|
|
43
|
-
};
|
|
44
|
-
}>;
|
|
2
|
+
declare const style: {
|
|
3
|
+
header: {};
|
|
4
|
+
};
|
|
45
5
|
export { style, HEADER_HEIGHT };
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
import { Platform, StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../../theme/theme";
|
|
3
|
-
const {
|
|
3
|
+
const { spaceXXXL } = theme();
|
|
4
4
|
const HEADER_HEIGHT = spaceXXXL;
|
|
5
5
|
const style = StyleSheet.create({
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
-
// @ts-ignore
|
|
8
6
|
header: {
|
|
9
|
-
alignItems: "center",
|
|
10
|
-
backgroundColor: colorBase,
|
|
11
|
-
flexDirection: "row",
|
|
12
|
-
flexGrow: 0,
|
|
13
|
-
flexWrap: "nowrap",
|
|
14
|
-
height: HEADER_HEIGHT,
|
|
15
|
-
justifyContent: "space-between",
|
|
16
|
-
overflow: "visible",
|
|
17
|
-
paddingHorizontal: spaceS,
|
|
18
|
-
width: "100%",
|
|
19
7
|
...Platform.select({
|
|
20
8
|
web: {
|
|
21
9
|
position: "sticky",
|
|
22
10
|
top: 0,
|
|
23
11
|
zIndex: 10,
|
|
12
|
+
height: HEADER_HEIGHT,
|
|
24
13
|
},
|
|
25
14
|
native: {
|
|
26
15
|
position: "relative",
|
|
16
|
+
height: HEADER_HEIGHT,
|
|
27
17
|
},
|
|
28
18
|
}),
|
|
29
19
|
},
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
+
import { ScrollView, View } from "react-native";
|
|
3
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
5
|
import { Footer as DefaultFooter } from "../../../templates/footer/Footer";
|
|
5
|
-
import {
|
|
6
|
+
import { DefaultHeader } from "../../../templates/header/defaultHeader/DefaultHeader";
|
|
6
7
|
import { Footer } from "../components/footer/Footer";
|
|
7
8
|
import { Header } from "../components/header/Header";
|
|
8
9
|
import { style } from "./DummyLayout.style";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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] },
|
|
12
|
+
React.createElement(Header, null, header),
|
|
13
|
+
panel,
|
|
14
|
+
React.createElement(View, { style: style.children, onLayout: onLayout }, children)),
|
|
15
|
+
React.createElement(Footer, null, footer)));
|
|
15
16
|
export { DummyLayout };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { style } from "./Header.style";
|
|
4
|
+
const Header = ({ children, style: customStyle, ...props }) => (React.createElement(View, { ...props, style: [style.header, customStyle] }, children));
|
|
5
|
+
export { Header };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
header: {
|
|
3
|
+
alignItems: "center";
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
flexDirection: "row";
|
|
6
|
+
flexGrow: number;
|
|
7
|
+
flexWrap: "nowrap";
|
|
8
|
+
justifyContent: "space-between";
|
|
9
|
+
overflow: "visible";
|
|
10
|
+
paddingHorizontal: number;
|
|
11
|
+
width: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export { style };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../theme/theme";
|
|
3
|
+
const { colorBase, spaceS } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
header: {
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
backgroundColor: colorBase,
|
|
8
|
+
flexDirection: "row",
|
|
9
|
+
flexGrow: 0,
|
|
10
|
+
flexWrap: "nowrap",
|
|
11
|
+
justifyContent: "space-between",
|
|
12
|
+
overflow: "visible",
|
|
13
|
+
paddingHorizontal: spaceS,
|
|
14
|
+
width: "100%",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export { style };
|
|
@@ -6,6 +6,7 @@ import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/but
|
|
|
6
6
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
7
7
|
import { Routes } from "../../../../routing/routes";
|
|
8
8
|
import { useBasePath } from "../../../../routing/useBasePath";
|
|
9
|
+
import { Header } from "../Header";
|
|
9
10
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
10
11
|
const CheckoutHeader = ({ onBack }) => {
|
|
11
12
|
const title = useI18nMessage({ id: I18nMessages.HEADER_COMPLETE_CHECKOUT_TITLE });
|
|
@@ -15,7 +16,7 @@ const CheckoutHeader = ({ onBack }) => {
|
|
|
15
16
|
onBack?.();
|
|
16
17
|
navigate(`${basePath}/${Routes.SUMMARY}`);
|
|
17
18
|
}, [basePath, navigate, onBack]);
|
|
18
|
-
return (React.createElement(
|
|
19
|
+
return (React.createElement(Header, { testID: "checkout-header" },
|
|
19
20
|
React.createElement(ButtonIcon, { name: "arrow-left", testID: "arrow-left-button-icon", onPress: handleOnBack }),
|
|
20
21
|
React.createElement(Text, { level: 3, detail: true, upperCase: true }, title),
|
|
21
22
|
React.createElement(ButtonIconPlaceholder, null)));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
3
|
+
import { Header } from "../Header";
|
|
4
|
+
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
5
|
+
import { Logo } from "../logo/Logo";
|
|
6
|
+
import { style } from "./DefaultHeader.style";
|
|
7
|
+
const DefaultHeader = () => (React.createElement(Header, { testID: "default-header" },
|
|
8
|
+
React.createElement(Logo, { style: style.logo }),
|
|
9
|
+
React.createElement(ButtonIconPlaceholder, null),
|
|
10
|
+
React.createElement(ButtonIcon, { name: "menu", testID: "menu-button-icon", onPress: () => void 0 })));
|
|
11
|
+
export { DefaultHeader };
|
package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { spaceXXXL } = theme();
|
|
4
|
+
const HEADER_HEIGHT = spaceXXXL;
|
|
5
|
+
const style = StyleSheet.create({
|
|
6
|
+
logo: {
|
|
7
|
+
left: 0,
|
|
8
|
+
position: "absolute",
|
|
9
|
+
top: 0,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export { style, HEADER_HEIGHT };
|
package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
-
import React
|
|
4
|
-
import { useNavigate } from "react-router";
|
|
3
|
+
import React from "react";
|
|
5
4
|
import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
6
5
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
6
|
+
import { Header } from "../Header";
|
|
7
7
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
8
8
|
const ItemDetailHeader = ({ onBack }) => {
|
|
9
9
|
const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
10
|
-
|
|
11
|
-
const handleOnBack = useCallback(() => {
|
|
12
|
-
onBack?.();
|
|
13
|
-
navigate(-1);
|
|
14
|
-
}, [navigate, onBack]);
|
|
15
|
-
return (React.createElement(React.Fragment, null,
|
|
10
|
+
return (React.createElement(Header, { testID: "item-detail-header" },
|
|
16
11
|
React.createElement(ButtonIconPlaceholder, null),
|
|
17
12
|
React.createElement(Text, { level: 3, detail: true, upperCase: true }, title),
|
|
18
|
-
React.createElement(ButtonIcon, { name: "close", testID: "close-button-icon", onPress:
|
|
13
|
+
React.createElement(ButtonIcon, { name: "close", testID: "close-button-icon", onPress: onBack })));
|
|
19
14
|
};
|
|
20
15
|
export { ItemDetailHeader };
|
|
@@ -6,6 +6,7 @@ import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/but
|
|
|
6
6
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
7
7
|
import { Routes } from "../../../../routing/routes";
|
|
8
8
|
import { useBasePath } from "../../../../routing/useBasePath";
|
|
9
|
+
import { Header } from "../Header";
|
|
9
10
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
10
11
|
const ItemHeader = ({ items, item, onNext, onPrevious }) => {
|
|
11
12
|
const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
@@ -26,7 +27,7 @@ const ItemHeader = ({ items, item, onNext, onPrevious }) => {
|
|
|
26
27
|
onNext?.({ from: item.id, to: nextItem.id });
|
|
27
28
|
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: nextItem.id }));
|
|
28
29
|
}, [basePath, item.id, itemIndex, items, navigate, onNext]);
|
|
29
|
-
return (React.createElement(
|
|
30
|
+
return (React.createElement(Header, { testID: "item-header" },
|
|
30
31
|
!isFirstItem ? (React.createElement(ButtonIcon, { name: "arrow-left", testID: "arrow-left-button-icon", onPress: navigateToPreviousItem })) : (React.createElement(ButtonIconPlaceholder, null)),
|
|
31
32
|
React.createElement(Text, { level: 3, detail: true, upperCase: true }, title),
|
|
32
33
|
!isLastItem ? (React.createElement(ButtonIcon, { name: "arrow-right", testID: "arrow-right-button-icon", onPress: navigateToNextItem })) : (React.createElement(ButtonIconPlaceholder, null))));
|
package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { Edge } from "react-native-safe-area-context";
|
|
4
|
+
type SafeAreaScrollViewStyle = "safeAreaView" | "scrollView";
|
|
5
|
+
interface SafeAreaScrollViewProps {
|
|
6
|
+
readonly children: ReactNode;
|
|
7
|
+
readonly footer?: ReactNode;
|
|
8
|
+
readonly scrollerPaddingTop?: number;
|
|
9
|
+
readonly edges?: Edge[];
|
|
10
|
+
readonly style?: Partial<Record<SafeAreaScrollViewStyle, StyleProp<ViewStyle>>>;
|
|
11
|
+
}
|
|
12
|
+
declare const SafeAreaScrollView: FC<SafeAreaScrollViewProps>;
|
|
13
|
+
export { SafeAreaScrollView };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ScrollView } from "react-native";
|
|
3
|
+
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
+
import { theme } from "../../../theme/theme.js";
|
|
5
|
+
import { style } from "./SafeAreaScrollView.style.ts";
|
|
6
|
+
const { spaceXXL } = theme();
|
|
7
|
+
const SafeAreaScrollView = ({ children, footer, edges = ["top", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
|
|
8
|
+
const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
9
|
+
return (React.createElement(SafeAreaView, { edges: edges, style: [style.safeAreaView, customStyle?.safeAreaView] },
|
|
10
|
+
React.createElement(ScrollView, { contentContainerStyle: [
|
|
11
|
+
{
|
|
12
|
+
paddingTop: scrollerPaddingTop,
|
|
13
|
+
paddingBottom: safeAreaInsetBottom + spaceXXL,
|
|
14
|
+
},
|
|
15
|
+
customStyle?.scrollView,
|
|
16
|
+
] }, children),
|
|
17
|
+
footer));
|
|
18
|
+
};
|
|
19
|
+
export { SafeAreaScrollView };
|
|
@@ -2,7 +2,7 @@ import { Text } from "@lookiero/aurora";
|
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
4
|
import React, { useCallback, useMemo } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { View } from "react-native";
|
|
6
6
|
import { useNavigate } from "react-router-native";
|
|
7
7
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
8
8
|
import { useTrackPageView } from "../../../../shared/tracking/infrastructure/useTrackPageView";
|
|
@@ -55,19 +55,18 @@ const Checkout = ({ children, customerId, country, layout: Layout, useRedirect }
|
|
|
55
55
|
dependenciesLoadedStatuses.includes(pricingStatus);
|
|
56
56
|
if (!dependenciesLoaded)
|
|
57
57
|
return React.createElement(Spinner, null);
|
|
58
|
-
return (React.createElement(Layout, { header: React.createElement(CheckoutHeader, { onBack: handleOnBack }) },
|
|
59
|
-
React.createElement(
|
|
60
|
-
React.createElement(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage, pendingToPay: pricing.pendingToPay, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onSubmit: handleOnSubmit }))))),
|
|
58
|
+
return (React.createElement(Layout, { header: React.createElement(CheckoutHeader, { onBack: handleOnBack }), style: { scrollView: style.container } },
|
|
59
|
+
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
60
|
+
hasReplacedCheckoutItem && (React.createElement(View, { style: style.deliveryBannerContainer },
|
|
61
|
+
React.createElement(DeliveryBanner, null))),
|
|
62
|
+
React.createElement(PaymentInstrument, { useRedirect: useRedirect }),
|
|
63
|
+
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
64
|
+
checkoutItemsKept?.map((checkoutItem) => (React.createElement(View, { key: checkoutItem.id, style: style.checkoutItemKept, testID: "checkout-items-kept" },
|
|
65
|
+
React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, country: country, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, status: checkoutItem.status, size: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
66
|
+
? checkoutItem.replacedFor.size
|
|
67
|
+
: checkoutItem.productVariant.size })))),
|
|
68
|
+
pricing && (React.createElement(View, { style: style.pricingContainer },
|
|
69
|
+
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage, pendingToPay: pricing.pendingToPay, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onSubmit: handleOnSubmit })))),
|
|
71
70
|
children));
|
|
72
71
|
};
|
|
73
72
|
export { Checkout };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
3
|
-
import { ScrollView } from "react-native";
|
|
4
3
|
import { CheckoutQuestionType } from "../../../../projection/checkoutQuestion/checkoutQuestion";
|
|
5
4
|
import { useLogger } from "../../../../shared/logging/useLogger";
|
|
6
5
|
import { useTrackChangeFeedback } from "../../../../shared/tracking/infrastructure/useTrackChangeFeedback";
|
|
@@ -74,9 +73,8 @@ const Feedback = ({ customerId, country, layout: Layout }) => {
|
|
|
74
73
|
if (!dependenciesLoaded)
|
|
75
74
|
return React.createElement(Spinner, null);
|
|
76
75
|
return (React.createElement(CheckoutQuestionFeedbackProvider, { feedback: {}, onChanged: handleOnChangedFeedback },
|
|
77
|
-
React.createElement(Layout,
|
|
78
|
-
React.createElement(
|
|
79
|
-
React.createElement(
|
|
80
|
-
React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit }))))));
|
|
76
|
+
React.createElement(Layout, { style: { scrollView: style.container } },
|
|
77
|
+
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
78
|
+
React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit })))));
|
|
81
79
|
};
|
|
82
80
|
export { Feedback };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { useMatch, useParams } from "react-router-native";
|
|
3
|
+
import { useMatch, useNavigate, useParams } from "react-router-native";
|
|
4
4
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
5
5
|
import { useLogger } from "../../../../shared/logging/useLogger";
|
|
6
6
|
import { useTrackItemPageView } from "../../../../shared/tracking/infrastructure/useTrackItemPageView";
|
|
@@ -114,14 +114,20 @@ const Item = ({ customerId, country, layout: Layout }) => {
|
|
|
114
114
|
to,
|
|
115
115
|
}), [checkout?.id, country, trackPressPrevious]);
|
|
116
116
|
const trackPressBack = useTrackPressBack();
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
const navigate = useNavigate();
|
|
118
|
+
const handleOnBack = useCallback(() => {
|
|
119
|
+
trackPressBack({
|
|
120
|
+
page: TrackingPage.ITEM,
|
|
121
|
+
country,
|
|
122
|
+
checkoutId: checkout?.id,
|
|
123
|
+
});
|
|
124
|
+
navigate(-1);
|
|
125
|
+
}, [checkout?.id, country, navigate, trackPressBack]);
|
|
122
126
|
const basePath = useBasePath();
|
|
123
127
|
const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
|
|
124
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
|
+
const [height, setHeight] = useState(0);
|
|
130
|
+
const handleOnLayout = useCallback((event) => setHeight(event.nativeEvent.layout.height), []);
|
|
125
131
|
const dependenciesLoaded = checkoutStatus !== QueryStatus.LOADING &&
|
|
126
132
|
checkout &&
|
|
127
133
|
checkoutItem &&
|
|
@@ -135,8 +141,7 @@ const Item = ({ customerId, country, layout: Layout }) => {
|
|
|
135
141
|
return React.createElement(Spinner, null);
|
|
136
142
|
}
|
|
137
143
|
return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
|
|
138
|
-
React.createElement(Layout, { header: header },
|
|
139
|
-
|
|
140
|
-
React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem }))));
|
|
144
|
+
React.createElement(Layout, { header: header, style: { scrollView: { height: checkoutItem.status === CheckoutItemStatus.INITIAL ? height : "auto" } }, onLayout: handleOnLayout }, 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 }))),
|
|
145
|
+
React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem })));
|
|
141
146
|
};
|
|
142
147
|
export { Item };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import React, { useCallback } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { View } from "react-native";
|
|
4
4
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
5
5
|
import { useLogger } from "../../../../../../shared/logging/useLogger";
|
|
6
6
|
import { useTrackResetItem } from "../../../../../../shared/tracking/infrastructure/useTrackResetItem";
|
|
@@ -34,10 +34,9 @@ const ItemWithCustomerDecission = ({ country, checkoutId, checkoutItem, returnQu
|
|
|
34
34
|
if (!dependenciesLoaded) {
|
|
35
35
|
return React.createElement(Spinner, null);
|
|
36
36
|
}
|
|
37
|
-
return (React.createElement(
|
|
38
|
-
React.createElement(
|
|
39
|
-
|
|
40
|
-
React.createElement(
|
|
41
|
-
React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions, onEditFeedback: onEditFeedback })))))));
|
|
37
|
+
return (React.createElement(Body, { style: { row: style.container } },
|
|
38
|
+
React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: resetItem }),
|
|
39
|
+
React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant }, checkoutItem.status === CheckoutItemStatus.RETURNED && (React.createElement(View, { style: style.feedbackContainer },
|
|
40
|
+
React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions, onEditFeedback: onEditFeedback }))))));
|
|
42
41
|
};
|
|
43
42
|
export { ItemWithCustomerDecission };
|
|
@@ -57,8 +57,8 @@ const ItemWithoutCustomerDecission = ({ country, checkoutId, checkoutItem, booke
|
|
|
57
57
|
}
|
|
58
58
|
return (React.createElement(React.Fragment, null,
|
|
59
59
|
React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
|
|
60
|
-
React.createElement(ScrollView, {
|
|
61
|
-
React.createElement(Body,
|
|
60
|
+
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
61
|
+
React.createElement(Body, { style: { row: style.container } },
|
|
62
62
|
React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, style: { content: { paddingBottom: Platform.OS === "web" ? 0 : stickyHeight } } }))),
|
|
63
63
|
React.createElement(ItemActions, { country: country, currentProductVariant: currentProductVariant, productVariants: bookedProductsVariants?.productVariants, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: onReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })));
|
|
64
64
|
};
|
|
@@ -2,7 +2,7 @@ import { Button, Text } from "@lookiero/aurora";
|
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
4
|
import React, { useCallback } from "react";
|
|
5
|
-
import { Image
|
|
5
|
+
import { Image } from "react-native";
|
|
6
6
|
import { useNavigate } from "react-router-native";
|
|
7
7
|
import { useTrackPageView } from "../../../../shared/tracking/infrastructure/useTrackPageView";
|
|
8
8
|
import { AspectRatioView } from "../../../../shared/ui/components/atoms/aspectRatioView/AspectRatioView";
|
|
@@ -30,12 +30,11 @@ const NotFound = ({ customerId, country, layout: Layout }) => {
|
|
|
30
30
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus);
|
|
31
31
|
if (!dependenciesLoaded)
|
|
32
32
|
return React.createElement(Spinner, null);
|
|
33
|
-
return (React.createElement(Layout,
|
|
34
|
-
React.createElement(
|
|
35
|
-
React.createElement(
|
|
36
|
-
React.createElement(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
React.createElement(Button, { onPress: handleOnPress }, buttonText)))));
|
|
33
|
+
return (React.createElement(Layout, { style: { scrollView: style.container } },
|
|
34
|
+
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
35
|
+
React.createElement(AspectRatioView, { aspectRatio: 1.25 },
|
|
36
|
+
React.createElement(Image, { resizeMode: "contain", source: require("../../../../public/images/not-found.png"), style: style.image, testID: "not-found-image" })),
|
|
37
|
+
React.createElement(Text, { level: 1, style: style.description }, descriptionText),
|
|
38
|
+
React.createElement(Button, { onPress: handleOnPress }, buttonText))));
|
|
40
39
|
};
|
|
41
40
|
export { NotFound };
|
|
@@ -19,10 +19,12 @@ import { Body } from "../../components/layouts/body/Body";
|
|
|
19
19
|
import { I18nMessages } from "../../i18n/i18n";
|
|
20
20
|
import { Routes } from "../../routing/routes";
|
|
21
21
|
import { useBasePath } from "../../routing/useBasePath";
|
|
22
|
+
import { theme } from "../../theme/theme";
|
|
22
23
|
import { style } from "./Summary.style";
|
|
23
24
|
import { CheckoutItemsTabs } from "./components/checkoutItemsTabs/CheckoutItemsTabs";
|
|
24
25
|
import { FiveItemsDiscountBanner } from "./components/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
25
26
|
import { StickyPricing } from "./components/stickyPricing/StickyPricing";
|
|
27
|
+
const { spaceXXL } = theme();
|
|
26
28
|
const Summary = ({ customerId, country, layout: Layout }) => {
|
|
27
29
|
const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
|
|
28
30
|
const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
|
|
@@ -75,15 +77,17 @@ const Summary = ({ customerId, country, layout: Layout }) => {
|
|
|
75
77
|
const handleOnChangedTab = useCallback((active) => trackTabView({ tab: active === 0 ? "keep" : "return" }), [trackTabView]);
|
|
76
78
|
const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
77
79
|
const checkoutItemsReturned = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.RETURNED || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
80
|
+
const [height, setHeight] = useState(0);
|
|
81
|
+
const handleOnLayout = useCallback((event) => setHeight(event.nativeEvent.layout.height), []);
|
|
78
82
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
79
83
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus) &&
|
|
80
84
|
dependenciesLoadedStatuses.includes(pricingStatus) &&
|
|
81
85
|
dependenciesLoadedStatuses.includes(fiveItemsDiscountStatus);
|
|
82
86
|
if (!dependenciesLoaded)
|
|
83
87
|
return React.createElement(Spinner, null);
|
|
84
|
-
return (React.createElement(Layout,
|
|
85
|
-
React.createElement(ScrollView, {
|
|
86
|
-
React.createElement(Body, { style: { row: { paddingBottom: pricingHeight } } },
|
|
88
|
+
return (React.createElement(Layout, { style: { scrollView: { height } }, onLayout: handleOnLayout },
|
|
89
|
+
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
90
|
+
React.createElement(Body, { style: { row: { paddingBottom: pricingHeight + spaceXXL } } },
|
|
87
91
|
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
88
92
|
React.createElement(View, { style: style.content },
|
|
89
93
|
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../theme/theme";
|
|
3
|
-
const { spaceM, spaceL, spaceXL
|
|
3
|
+
const { spaceM, spaceL, spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
-
container: {
|
|
6
|
-
paddingBottom: spaceXXL,
|
|
7
|
-
},
|
|
8
5
|
content: {
|
|
9
6
|
paddingHorizontal: spaceXL,
|
|
10
7
|
},
|