@lookiero/checkout 0.2.29 → 0.2.31

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 (50) hide show
  1. package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/bookedSizeReplaceableProductVariants.mock.d.ts +3 -0
  2. package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/bookedSizeReplaceableProductVariants.mock.js +17 -0
  3. package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts +6 -9
  4. package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js +4 -2
  5. package/dist/infrastructure/ui/components/atoms/price/Price.d.ts +5 -0
  6. package/dist/infrastructure/ui/components/atoms/price/Price.js +9 -3
  7. package/dist/infrastructure/ui/components/layouts/body/Body.d.ts +3 -0
  8. package/dist/infrastructure/ui/components/layouts/body/Body.js +2 -2
  9. package/dist/infrastructure/ui/components/layouts/body/Body.style.d.ts +0 -3
  10. package/dist/infrastructure/ui/components/layouts/body/Body.style.js +0 -5
  11. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -1
  12. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +5 -6
  13. package/dist/infrastructure/ui/i18n/i18n.d.ts +3 -1
  14. package/dist/infrastructure/ui/i18n/i18n.js +2 -0
  15. package/dist/infrastructure/ui/shared/components/atoms/input/Input.js +0 -1
  16. package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.d.ts +1 -0
  17. package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.js +6 -2
  18. package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.style.d.ts +3 -0
  19. package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.style.js +4 -1
  20. package/dist/infrastructure/ui/shared/components/layouts/sticky/Sticky.d.ts +14 -0
  21. package/dist/infrastructure/ui/shared/components/layouts/sticky/Sticky.js +12 -0
  22. package/dist/infrastructure/ui/shared/components/layouts/sticky/Sticky.style.d.ts +46 -0
  23. package/dist/infrastructure/ui/shared/components/layouts/sticky/Sticky.style.js +33 -0
  24. package/dist/infrastructure/ui/views/intro/Intro.js +2 -2
  25. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +2 -1
  26. package/dist/infrastructure/ui/views/intro/Intro.style.js +2 -1
  27. package/dist/infrastructure/ui/views/item/Item.js +27 -9
  28. package/dist/infrastructure/ui/views/item/Item.style.d.ts +3 -0
  29. package/dist/infrastructure/ui/views/item/Item.style.js +3 -0
  30. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +13 -0
  31. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +25 -0
  32. package/dist/infrastructure/ui/views/item/components/{productVariantActions/ProductVariantActions.style.d.ts → itemActions/ItemActions.style.d.ts} +1 -1
  33. package/dist/infrastructure/ui/views/item/components/{productVariantActions/ProductVariantActions.style.js → itemActions/ItemActions.style.js} +2 -2
  34. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +13 -0
  35. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +30 -0
  36. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +23 -0
  37. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +27 -0
  38. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +2 -1
  39. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
  40. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +4 -0
  41. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +21 -6
  42. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +4 -0
  43. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +4 -0
  44. package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +3 -14
  45. package/dist/projection/checkoutItem/checkoutItem.d.ts +2 -10
  46. package/dist/projection/shared/size.d.ts +10 -0
  47. package/dist/projection/shared/size.js +1 -0
  48. package/package.json +1 -1
  49. package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.d.ts +0 -11
  50. package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.js +0 -22
@@ -0,0 +1,3 @@
1
+ import { BookedSizeReplaceableProductVariantsProjection } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
2
+ declare const bookedSizeReplaceableProductVariants: BookedSizeReplaceableProductVariantsProjection;
3
+ export { bookedSizeReplaceableProductVariants };
@@ -0,0 +1,17 @@
1
+ const bookedSizeReplaceableProductVariants = {
2
+ booking: "b00e2c2d-7d9c-4808-88a4-e1c845ae6889",
3
+ productVariants: [
4
+ {
5
+ id: "383fab95-56eb-4639-bb18-530ab792b4d3",
6
+ size: {
7
+ id: "4f8a26b8-8d2d-4012-b49a-7d2820095598",
8
+ europe: "S",
9
+ lookiero: "S",
10
+ uk: "S",
11
+ it: "S",
12
+ unique: false,
13
+ },
14
+ },
15
+ ],
16
+ };
17
+ export { bookedSizeReplaceableProductVariants };
@@ -1,16 +1,13 @@
1
1
  import { BookedSizeReplaceableProductVariantsForCheckoutItemView, BookedSizeReplaceableProductVariantsProjection } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
2
2
  import { HttpPostFunction } from "../../delivery/http/httpClient";
3
- interface SizeFormatDto {
4
- readonly size: string;
5
- readonly format: string;
6
- readonly length?: string;
7
- }
8
3
  interface SizeDto {
9
4
  readonly id: string;
10
- readonly europe: SizeFormatDto;
11
- readonly it: SizeFormatDto;
12
- readonly lookiero: SizeFormatDto;
13
- readonly uk: SizeFormatDto;
5
+ readonly lookiero: string;
6
+ readonly uk: string;
7
+ readonly it: string;
8
+ readonly europe: string;
9
+ readonly unique: boolean;
10
+ readonly visual_order?: number;
14
11
  }
15
12
  interface ProductVariantDto {
16
13
  readonly id: string;
@@ -1,9 +1,11 @@
1
1
  const toSize = (size) => ({
2
2
  id: size.id,
3
- europe: size.europe,
4
- it: size.it,
5
3
  lookiero: size.lookiero,
6
4
  uk: size.uk,
5
+ it: size.it,
6
+ europe: size.europe,
7
+ unique: size.unique,
8
+ visualOrder: size.visual_order,
7
9
  });
8
10
  const toProductVariant = (productVariant) => ({
9
11
  id: productVariant.id,
@@ -1,7 +1,12 @@
1
1
  import { FC } from "react";
2
+ import { TextProps } from "react-native";
2
3
  import { PriceProjection } from "../../../../../projection/checkoutItem/checkoutItem";
4
+ declare type PriceStyle = "priceText" | "discountedText";
5
+ declare type PriceVariant = "default" | "detail" | "subtotal" | "total";
3
6
  interface PriceProps {
4
7
  readonly price: PriceProjection;
8
+ readonly variant?: PriceVariant;
9
+ readonly style?: Partial<Record<PriceStyle, TextProps>>;
5
10
  }
6
11
  declare const Price: FC<PriceProps>;
7
12
  export { Price };
@@ -3,7 +3,13 @@ import { useI18nNumber } from "@lookiero/i18n-react";
3
3
  import React from "react";
4
4
  import { View } from "react-native";
5
5
  import { style } from "./Price.style";
6
- const Price = ({ price }) => {
6
+ const PRICE_VARIANT = {
7
+ default: { body: true, level: 3 },
8
+ detail: { detail: true, level: 2 },
9
+ subtotal: { action: true, level: 3 },
10
+ total: { action: true, level: 2 },
11
+ };
12
+ const Price = ({ price, variant = "default", style: customStyle }) => {
7
13
  const isDiscounted = price.discountedPrice && price.discountedPrice.percentage !== 0;
8
14
  const productPrice = useI18nNumber({
9
15
  value: price.amount / 100,
@@ -16,7 +22,7 @@ const Price = ({ price }) => {
16
22
  currency: price.currency,
17
23
  });
18
24
  return (React.createElement(View, { style: style.price, testID: "price" },
19
- React.createElement(Text, { level: 3, style: isDiscounted && style.priceTextDiscounted, testID: "price-text", body: true }, productPrice),
20
- isDiscounted && (React.createElement(Text, { level: 3, style: style.discountedPriceText, testID: "discounted-price-text", body: true }, productDiscountedPrice))));
25
+ React.createElement(Text, { ...PRICE_VARIANT[variant], style: [isDiscounted && style.priceTextDiscounted, customStyle?.priceText], testID: "price-text" }, productPrice),
26
+ isDiscounted && (React.createElement(Text, { ...PRICE_VARIANT[variant], style: [style.discountedPriceText, customStyle?.discountedText], testID: "discounted-price-text" }, productDiscountedPrice))));
21
27
  };
22
28
  export { Price };
@@ -1,6 +1,9 @@
1
1
  import { FC, ReactNode } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ declare type BodyStyle = "row" | "column";
2
4
  interface BodyProps {
3
5
  readonly children: ReactNode;
6
+ readonly style?: Partial<Record<BodyStyle, StyleProp<ViewStyle>>>;
4
7
  }
5
8
  declare const Body: FC<BodyProps>;
6
9
  export { Body };
@@ -2,6 +2,6 @@ import React from "react";
2
2
  import { Column } from "../../../shared/components/layouts/column/Column";
3
3
  import { Row } from "../../../shared/components/layouts/row/Row";
4
4
  import { style } from "./Body.style";
5
- const Body = ({ children }) => (React.createElement(Row, { style: style.row },
6
- React.createElement(Column, { style: style.column }, children)));
5
+ const Body = ({ children, style: customStyle }) => (React.createElement(Row, { style: [style.row, customStyle?.row] },
6
+ React.createElement(Column, { style: customStyle?.column }, children)));
7
7
  export { Body };
@@ -1,7 +1,4 @@
1
1
  declare const style: {
2
- column: {
3
- paddingHorizontal: number;
4
- };
5
2
  row: {
6
3
  flex: number;
7
4
  justifyContent: "center";
@@ -1,10 +1,5 @@
1
1
  import { StyleSheet } from "react-native";
2
- import { theme } from "../../../theme/theme";
3
- const { spaceXL } = theme();
4
2
  const style = StyleSheet.create({
5
- column: {
6
- paddingHorizontal: spaceXL,
7
- },
8
3
  row: {
9
4
  flex: 1,
10
5
  justifyContent: "center",
@@ -6,7 +6,7 @@ import { style } from "./HostDefaultReturnQuestionItem.style";
6
6
  const HostDefaultReturnQuestionItem = ({ returnQuestion, children }) => {
7
7
  const titleText = useI18nMessage({ id: returnQuestion.name, prefix: RETURN_QUESTIONS_PREFIX });
8
8
  return (React.createElement(React.Fragment, null,
9
- React.createElement(Text, { level: 2, style: style.title }, titleText),
9
+ React.createElement(Text, { level: 3, style: style.title }, titleText),
10
10
  children));
11
11
  };
12
12
  export { HostDefaultReturnQuestionItem };
@@ -1,15 +1,14 @@
1
1
  import React from "react";
2
- import { ScrollView, View } from "react-native";
2
+ import { ScrollView } from "react-native";
3
3
  import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
4
4
  import { theme } from "../../theme/theme";
5
5
  const { spaceXL } = theme();
6
6
  const SafeAreaScrollView = ({ children, edges = ["top", "bottom", "left", "right"] }) => {
7
7
  const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
8
8
  return (React.createElement(SafeAreaView, { edges: edges },
9
- React.createElement(ScrollView, null,
10
- React.createElement(View, { style: {
11
- paddingTop: !safeAreaInsetTop ? spaceXL : 0,
12
- paddingBottom: !safeAreaInsetBottom ? spaceXL : 0,
13
- } }, children))));
9
+ React.createElement(ScrollView, { contentContainerStyle: {
10
+ paddingTop: !safeAreaInsetTop ? spaceXL : 0,
11
+ paddingBottom: !safeAreaInsetBottom ? spaceXL : 0,
12
+ } }, children)));
14
13
  };
15
14
  export { SafeAreaScrollView };
@@ -30,6 +30,8 @@ declare enum I18nMessages {
30
30
  GET_OUT_OF_CHECKOUT_MODAL_DISMISS_BUTTON = "get_out_of_checkout_modal.dismiss_button",
31
31
  GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON = "get_out_of_checkout_modal.confirm_button",
32
32
  FEEDBACK_TITLE = "feedback.title",
33
- FEEDBACK_UNANSWERED = "feedback.unanswered"
33
+ FEEDBACK_UNANSWERED = "feedback.unanswered",
34
+ RETURN_QUESTIONS_TITLE = "return_questions.title",
35
+ RETURN_QUESTIONS_SUBMIT_BUTTON = "return_questions.submit_button"
34
36
  }
35
37
  export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
@@ -32,5 +32,7 @@ var I18nMessages;
32
32
  I18nMessages["GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON"] = "get_out_of_checkout_modal.confirm_button";
33
33
  I18nMessages["FEEDBACK_TITLE"] = "feedback.title";
34
34
  I18nMessages["FEEDBACK_UNANSWERED"] = "feedback.unanswered";
35
+ I18nMessages["RETURN_QUESTIONS_TITLE"] = "return_questions.title";
36
+ I18nMessages["RETURN_QUESTIONS_SUBMIT_BUTTON"] = "return_questions.submit_button";
35
37
  })(I18nMessages || (I18nMessages = {}));
36
38
  export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
@@ -11,7 +11,6 @@ const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customSt
11
11
  // When content height has became smaller the onContentSizeChange does in fact triggered but the internal height is incorrect.
12
12
  const handleOnContentSizeChange = useCallback((event) => {
13
13
  onContentSizeChange?.(event);
14
- console.log("onContentSizeChange");
15
14
  if (!multiline || Platform.OS === "web") {
16
15
  return;
17
16
  }
@@ -9,6 +9,7 @@ interface ModalProps {
9
9
  readonly onClose: () => void;
10
10
  readonly showCloseButton?: boolean;
11
11
  readonly header?: ReactNode;
12
+ readonly footer?: ReactNode;
12
13
  readonly portalHostName?: string;
13
14
  readonly scroll?: boolean;
14
15
  readonly size?: Partial<Record<ScreenSize, ColumnSize>>;
@@ -8,11 +8,12 @@ import { theme } from "../../../../theme/theme";
8
8
  import { useScreenSize } from "../../../hooks/useScreenSize";
9
9
  import { ButtonIcon } from "../../molecules/buttonIcon/ButtonIcon";
10
10
  import { Row } from "../row/Row";
11
+ import { Sticky } from "../sticky/Sticky";
11
12
  import { style } from "./Modal.style";
12
13
  const { spaceXXL } = theme();
13
14
  const TRANSITION_MODAL_SCALE = 0.9;
14
15
  const DEFAULT_SAFEAREA_INSET_TOP = spaceXXL;
15
- const Modal = ({ children, visible, header, portalHostName, onClose, showCloseButton = false, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, }) => {
16
+ const Modal = ({ children, visible, header, footer, portalHostName, onClose, showCloseButton = false, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, }) => {
16
17
  const { height: screenHeight } = Dimensions.get(Platform.OS === "web" ? "window" : "screen");
17
18
  const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
18
19
  // On Android safeAreaInsetTop won't return the actual value.
@@ -30,6 +31,8 @@ const Modal = ({ children, visible, header, portalHostName, onClose, showCloseBu
30
31
  useBack(handleHardwareBackPress);
31
32
  const [modalHeight, setModalHeight] = useState();
32
33
  const handleOnModalLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => setModalHeight(height), []);
34
+ const [footerHeight, setFooterHeight] = useState(0);
35
+ const handleOnFooterLayout = useCallback(({ height }) => setFooterHeight(height), []);
33
36
  const transitions = useTransition(visible, {
34
37
  from: isSmallDevice
35
38
  ? {
@@ -70,6 +73,7 @@ const Modal = ({ children, visible, header, portalHostName, onClose, showCloseBu
70
73
  React.createElement(View, null, header),
71
74
  showCloseButton && (React.createElement(ButtonIcon, { name: "close", style: { button: customStyle?.closeButton }, onPress: onClose })))),
72
75
  React.createElement(ModalContentView, null,
73
- React.createElement(View, { style: { paddingBottom: safeAreaInsetBottom } }, children))))))))));
76
+ React.createElement(View, { style: { paddingBottom: safeAreaInsetBottom + footerHeight } }, children)),
77
+ footer && (React.createElement(Sticky, { style: style.stickyFooter, onLayout: handleOnFooterLayout }, footer))))))))));
74
78
  };
75
79
  export { Modal };
@@ -20,6 +20,9 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
20
20
  flex: number;
21
21
  zIndex: number;
22
22
  };
23
+ stickyFooter: {
24
+ paddingHorizontal: number;
25
+ };
23
26
  "1/4": ViewStyle;
24
27
  "1/3": ViewStyle;
25
28
  "1/2": ViewStyle;
@@ -1,6 +1,6 @@
1
1
  import { Platform, StyleSheet } from "react-native";
2
2
  import { theme } from "../../../../theme/theme";
3
- const { spaceM, colorBase, colorOverlay } = theme();
3
+ const { colorBase, colorOverlay, spaceM, spaceXL } = theme();
4
4
  const modalStylesForColumSize = {
5
5
  ["1/4"]: {
6
6
  maxWidth: `${100 * (1 / 4)}%`,
@@ -63,5 +63,8 @@ const style = StyleSheet.create({
63
63
  flex: 1,
64
64
  zIndex: 2,
65
65
  },
66
+ stickyFooter: {
67
+ paddingHorizontal: spaceXL,
68
+ },
66
69
  });
67
70
  export { style };
@@ -0,0 +1,14 @@
1
+ import { FC, ReactNode } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ interface Layout {
4
+ readonly width: number;
5
+ readonly height: number;
6
+ }
7
+ interface StickyProps {
8
+ readonly children: ReactNode;
9
+ readonly style?: StyleProp<ViewStyle>;
10
+ readonly onLayout?: ({ width, height }: Layout) => void;
11
+ }
12
+ declare const Sticky: FC<StickyProps>;
13
+ export type { Layout };
14
+ export { Sticky };
@@ -0,0 +1,12 @@
1
+ import React, { useCallback } from "react";
2
+ import { View } from "react-native";
3
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
4
+ import { theme } from "../../../../theme/theme";
5
+ import { style } from "./Sticky.style";
6
+ const { spaceL } = theme();
7
+ const Sticky = ({ children, style: customStyle, onLayout }) => {
8
+ const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
9
+ const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => onLayout?.({ width, height }), [onLayout]);
10
+ return (React.createElement(View, { style: [style.sticky, { paddingBottom: safeAreaInsetBottom + spaceL }, customStyle], onLayout: handleOnLayout }, children));
11
+ };
12
+ export { Sticky };
@@ -0,0 +1,46 @@
1
+ import { StyleSheet } from "react-native";
2
+ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
3
+ sticky: {
4
+ backgroundColor: string;
5
+ bottom: number;
6
+ elevation: number;
7
+ paddingTop: number;
8
+ shadowColor: string;
9
+ shadowOffset: {
10
+ height: number;
11
+ width: number;
12
+ };
13
+ shadowOpacity: number;
14
+ shadowRadius: number;
15
+ width: string;
16
+ } | {
17
+ position: "sticky";
18
+ backgroundColor: string;
19
+ bottom: number;
20
+ elevation: number;
21
+ paddingTop: number;
22
+ shadowColor: string;
23
+ shadowOffset: {
24
+ height: number;
25
+ width: number;
26
+ };
27
+ shadowOpacity: number;
28
+ shadowRadius: number;
29
+ width: string;
30
+ } | {
31
+ position: "absolute";
32
+ backgroundColor: string;
33
+ bottom: number;
34
+ elevation: number;
35
+ paddingTop: number;
36
+ shadowColor: string;
37
+ shadowOffset: {
38
+ height: number;
39
+ width: number;
40
+ };
41
+ shadowOpacity: number;
42
+ shadowRadius: number;
43
+ width: string;
44
+ };
45
+ }>;
46
+ export { style };
@@ -0,0 +1,33 @@
1
+ import { Platform, StyleSheet } from "react-native";
2
+ import { theme } from "../../../../theme/theme";
3
+ const { colorBase, elevationLayerL, elevationRadius, spaceL } = theme();
4
+ const style = StyleSheet.create({
5
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
+ // @ts-ignore
7
+ sticky: {
8
+ backgroundColor: colorBase,
9
+ bottom: 0,
10
+ elevation: elevationLayerL,
11
+ paddingTop: spaceL,
12
+ shadowColor: colorBase,
13
+ shadowOffset: {
14
+ height: -40,
15
+ width: 0,
16
+ },
17
+ shadowOpacity: 1,
18
+ shadowRadius: elevationRadius,
19
+ width: "100%",
20
+ ...Platform.select({
21
+ web: {
22
+ position: "sticky",
23
+ },
24
+ ios: {
25
+ position: "absolute",
26
+ },
27
+ android: {
28
+ position: "absolute",
29
+ },
30
+ }),
31
+ },
32
+ });
33
+ export { style };
@@ -36,13 +36,13 @@ const Intro = ({ customerId }) => {
36
36
  React.createElement(View, { style: style.content },
37
37
  React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
38
38
  React.createElement(Text, { level: 3, style: style.subtitle, body: true }, subTitleText),
39
- React.createElement(View, { style: style.discountContainer },
39
+ fiveItemsDiscount !== 0 && (React.createElement(View, { style: style.discountContainer },
40
40
  React.createElement(View, { style: style.discount },
41
41
  React.createElement(Text, { level: 2, heading: true },
42
42
  "- ",
43
43
  fiveItemsDiscount),
44
44
  React.createElement(Text, { level: 3, style: style.percentage, heading: true }, "%")),
45
- React.createElement(Text, { level: 3, body: true }, discountText)),
45
+ React.createElement(Text, { level: 3, body: true }, discountText))),
46
46
  React.createElement(View, { style: style.description },
47
47
  React.createElement(Bullet, { text: bulletOneText }),
48
48
  React.createElement(Bullet, { text: bulletTwoText }),
@@ -26,7 +26,7 @@ declare const style: {
26
26
  discountContainer: {
27
27
  alignItems: "center";
28
28
  backgroundColor: string;
29
- marginVertical: number;
29
+ marginBottom: number;
30
30
  padding: number;
31
31
  textAlign: "center";
32
32
  width: string;
@@ -35,6 +35,7 @@ declare const style: {
35
35
  marginLeft: number;
36
36
  };
37
37
  subtitle: {
38
+ marginBottom: number;
38
39
  textAlign: "center";
39
40
  };
40
41
  tickIcon: {
@@ -29,7 +29,7 @@ const style = StyleSheet.create({
29
29
  discountContainer: {
30
30
  alignItems: "center",
31
31
  backgroundColor: colorAccent,
32
- marginVertical: spaceL,
32
+ marginBottom: spaceL,
33
33
  padding: spaceM,
34
34
  textAlign: "center",
35
35
  width: "100%",
@@ -38,6 +38,7 @@ const style = StyleSheet.create({
38
38
  marginLeft: spaceXS,
39
39
  },
40
40
  subtitle: {
41
+ marginBottom: spaceXL,
41
42
  textAlign: "center",
42
43
  },
43
44
  tickIcon: {
@@ -2,7 +2,9 @@ import { QueryStatus } from "@lookiero/messaging-react";
2
2
  import React, { useCallback, useState } from "react";
3
3
  import { Text, TouchableHighlight, View } from "react-native";
4
4
  import { useParams } from "react-router-native";
5
+ import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
5
6
  import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
7
+ import { bookedSizeReplaceableProductVariants as bookedSizeReplaceableProductVariantsMock } from "../../../projection/bookedSizeReplaceableProductVariants/bookedSizeReplaceableProductVariants.mock";
6
8
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
7
9
  import { feedback as feedbackMock } from "../../../projection/feedback/feedback.mock";
8
10
  import { returnQuestions as returnQuestionsMock } from "../../../projection/returnQuestion/returnQuestions.mock";
@@ -10,6 +12,8 @@ import { Body } from "../../components/layouts/body/Body";
10
12
  import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
11
13
  import { Spinner } from "../../shared/components/atoms/spinner/Spinner";
12
14
  import { style } from "./Item.style";
15
+ import { CustomerDecissionBanner } from "./components/banner/CustomerDecissionBanner";
16
+ import { ItemActions } from "./components/itemActions/ItemActions";
13
17
  import { ProductVariantDescription } from "./components/productVariantDescription/ProductVariantDescription";
14
18
  import { ProductVariantSlider } from "./components/productVariantSlider/ProductVariantSlider";
15
19
  import { ReturnQuestionsFeedback } from "./components/returnQuestionsFeedback/ReturnQuestionsFeedback";
@@ -18,27 +22,41 @@ const Item = ({ customerId }) => {
18
22
  const { id } = useParams();
19
23
  const [checkout, status] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
20
24
  const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
25
+ const [stickyHeight, setStickyHeight] = useState(0);
26
+ const handleOnStickyLayout = useCallback(({ height }) => setStickyHeight(height), []);
21
27
  const [returnQuestionsVisible, setReturnQuestionsVisible] = useState(false);
22
28
  const handleOnShowReturnQuestions = useCallback(() => setReturnQuestionsVisible(true), []);
23
29
  const handleOnHideReturnQuestions = useCallback(() => setReturnQuestionsVisible(false), []);
24
30
  const handleOnEditFeedback = useCallback(() => void 0, []);
31
+ const handleOnSubmit = useCallback(() => handleOnHideReturnQuestions(), [handleOnHideReturnQuestions]);
32
+ const handleOnKeep = useCallback(() => void 0, []);
33
+ const handleOnReplace = useCallback(() => void 0, []);
34
+ const handleOnReturn = useCallback(() => void 0, []);
35
+ const handleOnBannerPress = useCallback(() => void 0, []);
25
36
  if (status === QueryStatus.LOADING)
26
37
  return React.createElement(Spinner, null);
27
38
  const { price } = checkoutItem;
28
39
  const { media, brand, name, size, color } = checkoutItem.productVariant;
40
+ const customerDecissionMade = checkoutItem.status === CheckoutItemStatus.INITIAL || checkoutItem.status === CheckoutItemStatus.EXPIRED;
29
41
  const returnQuestions = returnQuestionsMock;
30
42
  const feedback = feedbackMock;
43
+ const sizes = bookedSizeReplaceableProductVariantsMock.productVariants
44
+ .map((productVariant) => productVariant.size)
45
+ .concat(checkoutItem.productVariant.size);
31
46
  return (React.createElement(React.Fragment, null,
32
47
  React.createElement(SafeAreaScrollView, null,
33
48
  React.createElement(Body, null,
34
- React.createElement(View, { style: style.sliderContainer },
35
- React.createElement(ProductVariantSlider, { producVariantMedia: media })),
36
- React.createElement(ProductVariantDescription, { brand: brand, color: color, name: name, price: price, size: size }),
37
- Object.entries(feedback).length !== 0 && (React.createElement(View, { style: style.feedbackContainer },
38
- React.createElement(ReturnQuestionsFeedback, { feedback: feedback, returnQuestions: returnQuestions, onEditFeedback: handleOnEditFeedback }))),
39
- React.createElement(View, { style: { flexDirection: "row", justifyContent: "center" } },
40
- React.createElement(TouchableHighlight, { onPress: handleOnShowReturnQuestions },
41
- React.createElement(Text, { style: { padding: 16 } }, "show return questions"))))),
42
- React.createElement(ReturnQuestionsForm, { feedback: feedback, returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions })));
49
+ !customerDecissionMade && (React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: handleOnBannerPress })),
50
+ React.createElement(View, { style: [style.container, { paddingBottom: stickyHeight }] },
51
+ React.createElement(View, { style: style.sliderContainer },
52
+ React.createElement(ProductVariantSlider, { producVariantMedia: media })),
53
+ React.createElement(ProductVariantDescription, { brand: brand, color: color, name: name, price: price, size: size }),
54
+ Object.entries(feedback).length !== 0 && (React.createElement(View, { style: style.feedbackContainer },
55
+ React.createElement(ReturnQuestionsFeedback, { feedback: feedback, returnQuestions: returnQuestions, onEditFeedback: handleOnEditFeedback }))),
56
+ React.createElement(View, { style: { flexDirection: "row", justifyContent: "center" } },
57
+ React.createElement(TouchableHighlight, { onPress: handleOnShowReturnQuestions },
58
+ React.createElement(Text, { style: { padding: 16 } }, "show return questions")))))),
59
+ customerDecissionMade && (React.createElement(ItemActions, { size: checkoutItem.productVariant.size, sizes: sizes, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn })),
60
+ React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, feedback: feedback, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
43
61
  };
44
62
  export { Item };
@@ -1,4 +1,7 @@
1
1
  declare const style: {
2
+ container: {
3
+ paddingHorizontal: number;
4
+ };
2
5
  feedbackContainer: {
3
6
  borderTopColor: string;
4
7
  borderTopWidth: number;
@@ -2,6 +2,9 @@ import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../theme/theme";
3
3
  const { borderSize, colorGrayscaleM, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
+ container: {
6
+ paddingHorizontal: spaceXL,
7
+ },
5
8
  feedbackContainer: {
6
9
  borderTopColor: colorGrayscaleM,
7
10
  borderTopWidth: borderSize,
@@ -0,0 +1,13 @@
1
+ import { FC } from "react";
2
+ import { SizeProjection } from "../../../../../../projection/shared/size";
3
+ import { Layout } from "../../../../shared/components/layouts/sticky/Sticky";
4
+ interface ItemActionsProps {
5
+ readonly sizes: SizeProjection[];
6
+ readonly size: SizeProjection;
7
+ readonly onKeep: (value: string) => void;
8
+ readonly onReturn: () => void;
9
+ readonly onReplace: () => void;
10
+ readonly onLayout?: ({ width, height }: Layout) => void;
11
+ }
12
+ declare const ItemActions: FC<ItemActionsProps>;
13
+ export { ItemActions };
@@ -0,0 +1,25 @@
1
+ import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
+ import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
3
+ import { useI18nMessage } from "@lookiero/i18n-react";
4
+ import React, { useMemo } from "react";
5
+ import { View } from "react-native";
6
+ import { Body } from "../../../../components/layouts/body/Body";
7
+ import { I18nMessages } from "../../../../i18n/i18n";
8
+ import { Sticky } from "../../../../shared/components/layouts/sticky/Sticky";
9
+ import { SelectField } from "../../../../shared/components/molecules/selectField/SelectField";
10
+ import { style } from "./ItemActions.style";
11
+ const ItemActions = ({ sizes, size, onKeep, onReplace, onReturn, onLayout }) => {
12
+ const sizeSelectorLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
13
+ const keepButtonText = useI18nMessage({ id: I18nMessages.ITEM_KEEP_BUTTON });
14
+ const returnButtonText = useI18nMessage({ id: I18nMessages.ITEM_RETURN_BUTTON });
15
+ const sizeSelectorOptions = useMemo(() => sizes.map((size) => ({ label: size.lookiero, value: size.id })), [sizes]);
16
+ const disabledSizeSelector = useMemo(() => sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === size.id, [sizeSelectorOptions, size.id]);
17
+ return (React.createElement(Sticky, { onLayout: onLayout },
18
+ React.createElement(Body, { style: { column: style.container } },
19
+ React.createElement(Button, { onPress: onKeep }, keepButtonText),
20
+ React.createElement(View, { style: style.row },
21
+ !size.unique && (React.createElement(SelectField, { disabled: disabledSizeSelector, options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", style: { selectField: style.sizeSelector }, testID: "size-selector", value: size.id, onChange: onReplace })),
22
+ React.createElement(View, { style: style.returnButtonContainer },
23
+ React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn }, returnButtonText))))));
24
+ };
25
+ export { ItemActions };
@@ -1,6 +1,6 @@
1
1
  declare const style: {
2
2
  container: {
3
- width: string;
3
+ paddingHorizontal: number;
4
4
  };
5
5
  returnButtonContainer: {
6
6
  flex: number;
@@ -1,9 +1,9 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../../../theme/theme";
3
- const { spaceL } = theme();
3
+ const { spaceL, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
5
  container: {
6
- width: "100%",
6
+ paddingHorizontal: spaceXL,
7
7
  },
8
8
  returnButtonContainer: {
9
9
  flex: 1,
@@ -0,0 +1,13 @@
1
+ import { FC } from "react";
2
+ import { ColorProjection, MediaProjection, PriceProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
+ import { SizeProjection } from "../../../../../../projection/shared/size";
4
+ interface ProductVariantProps {
5
+ readonly media: MediaProjection[];
6
+ readonly brand: string;
7
+ readonly name: string;
8
+ readonly price: PriceProjection;
9
+ readonly size: SizeProjection;
10
+ readonly color: ColorProjection;
11
+ }
12
+ declare const ProductVariant: FC<ProductVariantProps>;
13
+ export { ProductVariant };
@@ -0,0 +1,30 @@
1
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
2
+ import { useI18nMessage } from "@lookiero/i18n-react";
3
+ import React from "react";
4
+ import { Image, View } from "react-native";
5
+ import { Price } from "../../../../components/atoms/price/Price";
6
+ import { useMediaImage } from "../../../../hooks/useMediaImage";
7
+ import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
8
+ import { IMAGE_WIDTH, style } from "./ProductVariant.style";
9
+ const ProductVariant = ({ media, brand, name, price, size, color }) => {
10
+ const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
11
+ const colorLabel = useI18nMessage({ id: color.label, prefix: COLOR_I18N_PREFIX });
12
+ const cdnImageUrl = useMediaImage();
13
+ return (React.createElement(View, { style: style.container },
14
+ React.createElement(Image, { resizeMode: "contain", style: style.media, testID: "product-variant-media", source: {
15
+ uri: cdnImageUrl({
16
+ url: media[0]?.url,
17
+ width: IMAGE_WIDTH,
18
+ }),
19
+ } }),
20
+ React.createElement(View, { style: style.descriptionContainer },
21
+ React.createElement(View, null,
22
+ React.createElement(Text, { level: 2, style: style.brand, detail: true }, brand),
23
+ React.createElement(Text, { level: 2, detail: true }, name),
24
+ React.createElement(Text, { level: 2, style: style.priceAndColor, detail: true },
25
+ size.unique ? uniqueText : size.lookiero,
26
+ " / ",
27
+ colorLabel)),
28
+ React.createElement(Price, { price: price, variant: "detail" }))));
29
+ };
30
+ export { ProductVariant };
@@ -0,0 +1,23 @@
1
+ declare const IMAGE_WIDTH = 96;
2
+ declare const style: {
3
+ brand: {
4
+ color: string;
5
+ };
6
+ container: {
7
+ flexDirection: "row";
8
+ };
9
+ descriptionContainer: {
10
+ justifyContent: "space-between";
11
+ marginLeft: number;
12
+ };
13
+ media: {
14
+ borderColor: string;
15
+ borderWidth: number;
16
+ height: number;
17
+ width: number;
18
+ };
19
+ priceAndColor: {
20
+ color: string;
21
+ };
22
+ };
23
+ export { style, IMAGE_WIDTH };
@@ -0,0 +1,27 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../theme/theme";
3
+ const { borderSize, colorGrayscaleL, spaceS } = theme();
4
+ const IMAGE_WIDTH = 96;
5
+ const IMAGE_HEIGHT = 120;
6
+ const style = StyleSheet.create({
7
+ brand: {
8
+ color: colorGrayscaleL,
9
+ },
10
+ container: {
11
+ flexDirection: "row",
12
+ },
13
+ descriptionContainer: {
14
+ justifyContent: "space-between",
15
+ marginLeft: spaceS,
16
+ },
17
+ media: {
18
+ borderColor: colorGrayscaleL,
19
+ borderWidth: borderSize,
20
+ height: IMAGE_HEIGHT,
21
+ width: IMAGE_WIDTH,
22
+ },
23
+ priceAndColor: {
24
+ color: colorGrayscaleL,
25
+ },
26
+ });
27
+ export { style, IMAGE_WIDTH };
@@ -1,5 +1,6 @@
1
1
  import { FC } from "react";
2
- import { ColorProjection, PriceProjection, SizeProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
2
+ import { ColorProjection, PriceProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
+ import { SizeProjection } from "../../../../../../projection/shared/size";
3
4
  interface ProductVariantDescriptionProps {
4
5
  readonly brand: string;
5
6
  readonly name: string;
@@ -8,7 +8,7 @@ import { ReturnQuestionFeedbackProvider } from "../../../../components/organisms
8
8
  import { ReturnQuestionItemProvider, } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
9
9
  import { HostDefaultReturnQuestionFeedbackItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem";
10
10
  import { ReturnQuestionFeedbackItem } from "../../../../components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem";
11
- import { I18nMessages, RETURN_QUESTIONS_PREFIX } from "../../../../i18n/i18n";
11
+ import { I18nMessages, RETURN_QUESTIONS_FEEDBACK_PREFIX } from "../../../../i18n/i18n";
12
12
  import { ButtonIcon } from "../../../../shared/components/molecules/buttonIcon/ButtonIcon";
13
13
  import { style } from "./ReturnQuestionsFeedback.style";
14
14
  const returnQuestionItems = {
@@ -20,7 +20,7 @@ const returnQuestionItems = {
20
20
  [ReturnQuestionType.OPTION]: ReturnQuestionFeedbackItem,
21
21
  };
22
22
  const ReturnQuestionsFeedback = ({ feedback, returnQuestions, onEditFeedback }) => {
23
- const titleText = useI18nMessage({ id: I18nMessages.FEEDBACK_TITLE, prefix: RETURN_QUESTIONS_PREFIX });
23
+ const titleText = useI18nMessage({ id: I18nMessages.FEEDBACK_TITLE, prefix: RETURN_QUESTIONS_FEEDBACK_PREFIX });
24
24
  return (React.createElement(View, null,
25
25
  React.createElement(View, { style: style.titleContainer },
26
26
  React.createElement(Text, { level: 2, style: style.title }, titleText),
@@ -1,10 +1,14 @@
1
1
  import { FC } from "react";
2
+ import { CheckoutItemProductVariantProjection, PriceProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
2
3
  import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
3
4
  import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
4
5
  interface ReturnQuestionsFormProps {
5
6
  readonly visible: boolean;
6
7
  readonly feedback: FeedbackProjection;
7
8
  readonly returnQuestions: ReturnQuestionProjection[];
9
+ readonly checkoutItemPrice: PriceProjection;
10
+ readonly productVariant: CheckoutItemProductVariantProjection;
11
+ readonly onSubmit: () => void;
8
12
  readonly onClose: () => void;
9
13
  }
10
14
  declare const ReturnQuestionsForm: FC<ReturnQuestionsFormProps>;
@@ -1,4 +1,7 @@
1
1
  import { PortalHost } from "@gorhom/portal";
2
+ import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
3
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
4
+ import { useI18nMessage } from "@lookiero/i18n-react";
2
5
  import React from "react";
3
6
  import { View } from "react-native";
4
7
  import { ReturnQuestionType, } from "../../../../../../projection/returnQuestion/returnQuestion";
@@ -10,7 +13,9 @@ import { HostSelectReturnQuestionItem } from "../../../../components/organisms/r
10
13
  import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem";
11
14
  import { OptionReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem";
12
15
  import { TextareaReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
16
+ import { I18nMessages, RETURN_QUESTIONS_PREFIX } from "../../../../i18n/i18n";
13
17
  import { Modal } from "../../../../shared/components/layouts/modal/Modal";
18
+ import { ProductVariant } from "../productVariant/ProductVariant";
14
19
  import { style } from "./ReturnQuestionsForm.style";
15
20
  const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
16
21
  const returnQuestionItems = {
@@ -21,10 +26,20 @@ const returnQuestionItems = {
21
26
  [ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
22
27
  [ReturnQuestionType.OPTION]: OptionReturnQuestionItem,
23
28
  };
24
- const ReturnQuestionsForm = ({ feedback, returnQuestions, onClose, visible }) => (React.createElement(ReturnQuestionFeedbackProvider, { feedback: feedback },
25
- React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
26
- React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
27
- React.createElement(Modal, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, visible: visible, scroll: true, showCloseButton: true, onClose: onClose },
28
- React.createElement(View, { style: style.returnQuestionsContainer },
29
- React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }))))));
29
+ const ReturnQuestionsForm = ({ feedback, returnQuestions, checkoutItemPrice, productVariant, visible, onSubmit, onClose, }) => {
30
+ const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE, prefix: RETURN_QUESTIONS_PREFIX });
31
+ const submitButtonText = useI18nMessage({
32
+ id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON,
33
+ prefix: RETURN_QUESTIONS_PREFIX,
34
+ });
35
+ const { media, brand, name, size, color } = productVariant;
36
+ return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: feedback },
37
+ React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
38
+ React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
39
+ React.createElement(Modal, { footer: React.createElement(Button, { onPress: onSubmit }, submitButtonText), portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, visible: visible, scroll: true, showCloseButton: true, onClose: onClose },
40
+ React.createElement(View, { style: style.returnQuestionsContainer },
41
+ React.createElement(Text, { level: 2, style: style.title }, titleText),
42
+ React.createElement(ProductVariant, { brand: brand, color: color, media: media, name: name, price: checkoutItemPrice, size: size }),
43
+ React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }))))));
44
+ };
30
45
  export { ReturnQuestionsForm };
@@ -3,5 +3,9 @@ declare const style: {
3
3
  paddingBottom: number;
4
4
  paddingHorizontal: number;
5
5
  };
6
+ title: {
7
+ marginBottom: number;
8
+ textAlign: "center";
9
+ };
6
10
  };
7
11
  export { style };
@@ -6,5 +6,9 @@ const style = StyleSheet.create({
6
6
  paddingBottom: spaceXL,
7
7
  paddingHorizontal: spaceXL,
8
8
  },
9
+ title: {
10
+ marginBottom: spaceXL,
11
+ textAlign: "center",
12
+ },
9
13
  });
10
14
  export { style };
@@ -1,19 +1,8 @@
1
1
  import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
2
- interface SizeFormat {
3
- readonly format: string;
4
- readonly length?: string;
5
- readonly size: string;
6
- }
7
- interface Size {
8
- readonly id: string;
9
- readonly europe: SizeFormat;
10
- readonly it: SizeFormat;
11
- readonly lookiero: SizeFormat;
12
- readonly uk: SizeFormat;
13
- }
2
+ import { SizeProjection } from "../shared/size";
14
3
  interface ProductVariant {
15
4
  readonly id: string;
16
- readonly size: Size;
5
+ readonly size: SizeProjection;
17
6
  }
18
7
  interface BookedSizeReplaceableProductVariantsProjection {
19
8
  readonly booking: string | null;
@@ -40,5 +29,5 @@ interface ViewBookedSizeReplaceableProductVariantsForCheckoutItemHandlerFunction
40
29
  readonly view: BookedSizeReplaceableProductVariantsForCheckoutItemView;
41
30
  }
42
31
  declare const viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler: QueryHandlerFunction<ViewBookedSizeReplaceableProductVariantsForCheckoutItem, ViewBookedSizeReplaceableProductVariantsForCheckoutItemResult, ViewBookedSizeReplaceableProductVariantsForCheckoutItemHandlerFunctionArgs>;
43
- export type { Size, ProductVariant, BookedSizeReplaceableProductVariantsProjection, BookedSizeReplaceableProductVariantsForCheckoutItemView, };
32
+ export type { ProductVariant, BookedSizeReplaceableProductVariantsProjection, BookedSizeReplaceableProductVariantsForCheckoutItemView, };
44
33
  export { VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeReplaceableProductVariantsForCheckoutItem, viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler, };
@@ -1,6 +1,7 @@
1
1
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
2
2
  import { Currency } from "../../domain/checkoutItem/model/currency";
3
3
  import { FeedbackProjection } from "../feedback/feedback";
4
+ import { SizeProjection } from "../shared/size";
4
5
  declare enum MediaPerspective {
5
6
  BACK = "BACK",
6
7
  BOTTOM_UP = "BOTTOM_UP",
@@ -28,15 +29,6 @@ interface PriceProjection {
28
29
  readonly percentage: number;
29
30
  };
30
31
  }
31
- interface SizeProjection {
32
- readonly id: string;
33
- readonly lookiero: string;
34
- readonly uk: string;
35
- readonly it: string;
36
- readonly europe: string;
37
- readonly unique: boolean;
38
- readonly visualOrder?: number;
39
- }
40
32
  interface ColorProjection {
41
33
  readonly id: string;
42
34
  readonly label: string;
@@ -57,5 +49,5 @@ interface CheckoutItemProjection {
57
49
  readonly productVariant: CheckoutItemProductVariantProjection;
58
50
  readonly feedback: FeedbackProjection | undefined;
59
51
  }
60
- export type { CheckoutItemProjection, CheckoutItemProductVariantProjection, ColorProjection, MediaProjection, PriceProjection, SizeProjection, };
52
+ export type { CheckoutItemProjection, CheckoutItemProductVariantProjection, ColorProjection, MediaProjection, PriceProjection, };
61
53
  export { Currency, MediaPerspective };
@@ -0,0 +1,10 @@
1
+ interface SizeProjection {
2
+ readonly id: string;
3
+ readonly lookiero: string;
4
+ readonly uk: string;
5
+ readonly it: string;
6
+ readonly europe: string;
7
+ readonly unique: boolean;
8
+ readonly visualOrder?: number;
9
+ }
10
+ export type { SizeProjection };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,11 +0,0 @@
1
- import { FC } from "react";
2
- import { SizeProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
- interface ProductVariantActionsProps {
4
- readonly sizes: SizeProjection[];
5
- readonly size: SizeProjection;
6
- readonly onKeep: (value: string) => void;
7
- readonly onReturn: () => void;
8
- readonly onReplace: () => void;
9
- }
10
- declare const ProductVariantActions: FC<ProductVariantActionsProps>;
11
- export { ProductVariantActions };
@@ -1,22 +0,0 @@
1
- import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
- import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
3
- import { useI18nMessage } from "@lookiero/i18n-react";
4
- import React, { useMemo } from "react";
5
- import { View } from "react-native";
6
- import { I18nMessages } from "../../../../i18n/i18n";
7
- import { SelectField } from "../../../../shared/components/molecules/selectField/SelectField";
8
- import { style } from "./ProductVariantActions.style";
9
- const ProductVariantActions = ({ sizes, size, onKeep, onReplace, onReturn }) => {
10
- const sizeSelectorLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
11
- const keepButtonText = useI18nMessage({ id: I18nMessages.ITEM_KEEP_BUTTON });
12
- const returnButtonText = useI18nMessage({ id: I18nMessages.ITEM_RETURN_BUTTON });
13
- const sizeSelectorOptions = useMemo(() => sizes.map((size) => ({ label: size.lookiero, value: size.id })), [sizes]);
14
- const disabledSizeSelector = useMemo(() => sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === size.id, [sizeSelectorOptions, size.id]);
15
- return (React.createElement(View, { style: style.container },
16
- React.createElement(Button, { onPress: onKeep }, keepButtonText),
17
- React.createElement(View, { style: style.row },
18
- !size.unique && (React.createElement(SelectField, { disabled: disabledSizeSelector, options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", style: { selectField: style.sizeSelector }, testID: "size-selector", value: size.id, onChange: onReplace })),
19
- React.createElement(View, { style: style.returnButtonContainer },
20
- React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn }, returnButtonText)))));
21
- };
22
- export { ProductVariantActions };