@lookiero/checkout 3.0.0-beta.0 → 3.0.0-beta.1

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.
Files changed (23) hide show
  1. package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +3 -43
  2. package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +3 -13
  3. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +2 -2
  4. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +3 -0
  5. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +3 -0
  6. package/dist/infrastructure/ui/components/templates/header/Header.d.ts +5 -0
  7. package/dist/infrastructure/ui/components/templates/header/Header.js +5 -0
  8. package/dist/infrastructure/ui/components/templates/header/Header.style.d.ts +14 -0
  9. package/dist/infrastructure/ui/components/templates/header/Header.style.js +17 -0
  10. package/dist/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -1
  11. package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +3 -0
  12. package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +11 -0
  13. package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +9 -0
  14. package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
  15. package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.d.ts +1 -1
  16. package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +4 -9
  17. package/dist/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +2 -1
  18. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts +13 -0
  19. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js +19 -0
  20. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.d.ts +6 -0
  21. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.js +7 -0
  22. package/dist/infrastructure/ui/views/item/Item.js +12 -9
  23. package/package.json +1 -1
@@ -1,45 +1,5 @@
1
- import { StyleSheet } from "react-native";
2
1
  declare const HEADER_HEIGHT: number;
3
- declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
4
- header: {
5
- alignItems: "center";
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 { colorBase, spaceXXXL, spaceS } = theme();
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
  },
@@ -2,14 +2,14 @@ import React from "react";
2
2
  import { View } from "react-native";
3
3
  import { SafeAreaView } from "react-native-safe-area-context";
4
4
  import { Footer as DefaultFooter } from "../../../templates/footer/Footer";
5
- import { Header as DefaultHeader } from "../../../templates/header/header/Header";
5
+ import { DefaultHeader } from "../../../templates/header/defaultHeader/DefaultHeader";
6
6
  import { Footer } from "../components/footer/Footer";
7
7
  import { Header } from "../components/header/Header";
8
8
  import { style } from "./DummyLayout.style";
9
9
  // eslint-disable-next-line react/prop-types
10
10
  const DummyLayout = ({ children, header = React.createElement(DefaultHeader, null), footer = React.createElement(DefaultFooter, null), panel }) => (React.createElement(SafeAreaView, { style: style.safeAreaView },
11
11
  React.createElement(Header, null, header),
12
- React.createElement(View, { style: { flex: 1 } }, children),
12
+ React.createElement(View, { style: style.children }, children),
13
13
  React.createElement(Footer, null, footer),
14
14
  panel));
15
15
  export { DummyLayout };
@@ -1,4 +1,7 @@
1
1
  declare const style: {
2
+ children: {
3
+ flex: number;
4
+ };
2
5
  safeAreaView: {
3
6
  flex: number;
4
7
  };
@@ -1,5 +1,8 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  const style = StyleSheet.create({
3
+ children: {
4
+ flex: 1,
5
+ },
3
6
  safeAreaView: {
4
7
  flex: 1,
5
8
  },
@@ -0,0 +1,5 @@
1
+ import { FC } from "react";
2
+ import { ViewProps } from "react-native";
3
+ type HeaderProps = ViewProps;
4
+ declare const Header: FC<HeaderProps>;
5
+ export { Header };
@@ -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(React.Fragment, null,
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,3 @@
1
+ import { FC } from "react";
2
+ declare const DefaultHeader: FC;
3
+ export { DefaultHeader };
@@ -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 };
@@ -0,0 +1,9 @@
1
+ declare const HEADER_HEIGHT: number;
2
+ declare const style: {
3
+ logo: {
4
+ left: number;
5
+ position: "absolute";
6
+ top: number;
7
+ };
8
+ };
9
+ export { style, HEADER_HEIGHT };
@@ -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 };
@@ -1,6 +1,6 @@
1
1
  import { FC } from "react";
2
2
  interface ItemDetailHeaderProps {
3
- readonly onBack?: () => void;
3
+ readonly onBack: () => void;
4
4
  }
5
5
  declare const ItemDetailHeader: FC<ItemDetailHeaderProps>;
6
6
  export { ItemDetailHeader };
@@ -1,20 +1,15 @@
1
1
  import { Text } from "@lookiero/aurora";
2
2
  import { useI18nMessage } from "@lookiero/i18n-react";
3
- import React, { useCallback } from "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
- const navigate = useNavigate();
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: handleOnBack })));
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(React.Fragment, null,
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))));
@@ -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 };
@@ -0,0 +1,6 @@
1
+ declare const style: {
2
+ safeAreaView: {
3
+ flex: number;
4
+ };
5
+ };
6
+ export { style };
@@ -0,0 +1,7 @@
1
+ import { StyleSheet } from "react-native";
2
+ const style = StyleSheet.create({
3
+ safeAreaView: {
4
+ flex: 1,
5
+ },
6
+ });
7
+ export { style };
@@ -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,11 +114,15 @@ const Item = ({ customerId, country, layout: Layout }) => {
114
114
  to,
115
115
  }), [checkout?.id, country, trackPressPrevious]);
116
116
  const trackPressBack = useTrackPressBack();
117
- const handleOnBack = useCallback(() => trackPressBack({
118
- page: TrackingPage.ITEM,
119
- country,
120
- checkoutId: checkout?.id,
121
- }), [checkout?.id, country, trackPressBack]);
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]);
@@ -135,8 +139,7 @@ const Item = ({ customerId, country, layout: Layout }) => {
135
139
  return React.createElement(Spinner, null);
136
140
  }
137
141
  return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
138
- React.createElement(Layout, { header: header },
139
- 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 })),
140
- React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem }))));
142
+ React.createElement(Layout, { header: header }, 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 }))),
143
+ React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem })));
141
144
  };
142
145
  export { Item };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "3.0.0-beta.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [