@lookiero/checkout 0.4.8 → 0.4.10

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 (28) hide show
  1. package/dist/infrastructure/ui/Root.d.ts +2 -1
  2. package/dist/infrastructure/ui/Root.js +2 -2
  3. package/dist/infrastructure/ui/routing/Routing.d.ts +2 -1
  4. package/dist/infrastructure/ui/routing/Routing.js +11 -11
  5. package/dist/infrastructure/ui/views/checkout/Checkout.d.ts +2 -0
  6. package/dist/infrastructure/ui/views/checkout/Checkout.js +2 -2
  7. package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
  8. package/dist/infrastructure/ui/views/item/Item.d.ts +2 -0
  9. package/dist/infrastructure/ui/views/item/Item.js +4 -4
  10. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +2 -0
  11. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +6 -2
  12. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +2 -0
  13. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +3 -2
  14. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +2 -0
  15. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +5 -3
  16. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +2 -0
  17. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +2 -2
  18. package/dist/infrastructure/ui/views/summary/Summary.d.ts +2 -0
  19. package/dist/infrastructure/ui/views/summary/Summary.js +2 -2
  20. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +2 -0
  21. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
  22. package/dist/projection/shared/country.d.ts +13 -0
  23. package/dist/projection/shared/country.js +14 -0
  24. package/dist/projection/shared/customer.d.ts +6 -0
  25. package/dist/projection/shared/customer.js +1 -0
  26. package/dist/projection/shared/size.d.ts +10 -0
  27. package/dist/projection/shared/size.js +3 -1
  28. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { I18n } from "@lookiero/i18n-react";
2
2
  import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
3
3
  import { FC } from "react";
4
+ import { Customer } from "../../projection/shared/customer";
4
5
  import { Menu } from "./views/header/Header";
5
6
  interface RootFunctionArgs {
6
7
  readonly Messaging: MessagingRoot;
@@ -14,7 +15,7 @@ interface RootFunction {
14
15
  interface RootProps {
15
16
  readonly basePath: string;
16
17
  readonly locale?: string;
17
- readonly customerId: string | undefined;
18
+ readonly customer: Customer | undefined;
18
19
  readonly menu: Menu;
19
20
  readonly onNotAccessible: () => void;
20
21
  readonly useRedirect: () => Record<string, string>;
@@ -3,9 +3,9 @@ import { Platform } from "react-native";
3
3
  import { Routing } from "./routing/Routing";
4
4
  const root = ({ Messaging, I18n, getAuthToken, development }) =>
5
5
  // eslint-disable-next-line react/display-name, react/prop-types
6
- ({ basePath, locale = "en", customerId, menu, onNotAccessible, useRedirect }) => {
6
+ ({ basePath, locale = "en", customer, menu, onNotAccessible, useRedirect }) => {
7
7
  const handleOnI18nError = useCallback(() => void 0, []);
8
8
  return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
9
- React.createElement(Routing, { I18n: I18n, basePath: basePath, customerId: customerId, getAuthToken: getAuthToken, locale: locale, menu: menu, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
9
+ React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
10
10
  };
11
11
  export { root };
@@ -1,9 +1,10 @@
1
1
  import { I18n } from "@lookiero/i18n-react";
2
2
  import { FC } from "react";
3
+ import { Customer } from "../../../projection/shared/customer";
3
4
  import { Menu } from "../views/header/Header";
4
5
  interface RoutingProps {
5
6
  readonly basePath?: string;
6
- readonly customerId: string | undefined;
7
+ readonly customer: Customer | undefined;
7
8
  readonly locale: string;
8
9
  readonly I18n: I18n;
9
10
  readonly getAuthToken: () => Promise<string>;
@@ -12,53 +12,53 @@ const Item = lazy(() => import("../views/item/Item").then((module) => ({ default
12
12
  const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
13
13
  const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
14
14
  const Feedback = lazy(() => import("../views/feedback/Feedback").then((module) => ({ default: module.Feedback })));
15
- const Routing = ({ basePath = "", customerId, locale, I18n, getAuthToken, menu, onI18nError, onNotAccessible, useRedirect, }) => {
15
+ const Routing = ({ basePath = "", customer, locale, I18n, getAuthToken, menu, onI18nError, onNotAccessible, useRedirect, }) => {
16
16
  const routes = useRoutes([
17
17
  {
18
18
  path: "",
19
19
  element: (React.createElement(BasePathProvider, { basePath: basePath },
20
- React.createElement(CheckoutAccessibilityMiddleware, { customerId: customerId, onNotAccessible: onNotAccessible },
20
+ React.createElement(CheckoutAccessibilityMiddleware, { customerId: customer?.customerId, onNotAccessible: onNotAccessible },
21
21
  React.createElement(I18n, { loader: React.createElement(Spinner, null), locale: locale, onError: onI18nError },
22
- React.createElement(CheckoutMiddleware, { customerId: customerId },
23
- React.createElement(App, { customerId: customerId, menu: menu },
22
+ React.createElement(CheckoutMiddleware, { customerId: customer?.customerId },
23
+ React.createElement(App, { customerId: customer?.customerId, menu: menu },
24
24
  React.createElement(Outlet, null))))))),
25
25
  children: [
26
26
  {
27
27
  path: Routes.INTRO,
28
28
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
29
- React.createElement(Intro, { customerId: customerId }))),
29
+ React.createElement(Intro, { customerId: customer?.customerId }))),
30
30
  },
31
31
  {
32
32
  path: Routes.ITEM,
33
33
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
34
- React.createElement(Item, { customerId: customerId }))),
34
+ React.createElement(Item, { country: customer?.country, customerId: customer?.customerId }))),
35
35
  },
36
36
  {
37
37
  path: Routes.ITEM_DETAIL,
38
38
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
39
- React.createElement(Item, { customerId: customerId }))),
39
+ React.createElement(Item, { country: customer?.country, customerId: customer?.customerId }))),
40
40
  },
41
41
  {
42
42
  path: Routes.SUMMARY,
43
43
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
44
- React.createElement(Summary, { customerId: customerId }))),
44
+ React.createElement(Summary, { country: customer?.country, customerId: customer?.customerId }))),
45
45
  },
46
46
  {
47
47
  path: Routes.CHECKOUT,
48
48
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
49
- React.createElement(Checkout, { customerId: customerId, useRedirect: useRedirect },
49
+ React.createElement(Checkout, { country: customer?.country, customerId: customer?.customerId, useRedirect: useRedirect },
50
50
  React.createElement(Outlet, null)))),
51
51
  children: [
52
52
  {
53
53
  path: Routes.CHECKOUT_PAYMENT,
54
- element: React.createElement(CheckoutPaymentModal, { customerId: customerId, getAuthToken: getAuthToken }),
54
+ element: React.createElement(CheckoutPaymentModal, { customerId: customer?.customerId, getAuthToken: getAuthToken }),
55
55
  },
56
56
  ],
57
57
  },
58
58
  {
59
59
  path: Routes.FEEDBACK,
60
60
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
61
- React.createElement(Feedback, { customerId: customerId }))),
61
+ React.createElement(Feedback, { customerId: customer?.customerId }))),
62
62
  },
63
63
  {
64
64
  path: "*",
@@ -1,7 +1,9 @@
1
1
  import { FC, ReactNode } from "react";
2
+ import { Country } from "../../../../projection/shared/country";
2
3
  interface CheckoutProps {
3
4
  readonly children?: ReactNode;
4
5
  readonly customerId: string;
6
+ readonly country: Country;
5
7
  readonly useRedirect: () => Record<string, string>;
6
8
  }
7
9
  declare const Checkout: FC<CheckoutProps>;
@@ -19,7 +19,7 @@ import { ProductVariant } from "../item/components/productVariant/ProductVariant
19
19
  import { Pricing } from "../summary/components/pricing/Pricing";
20
20
  import { style } from "./Checkout.style";
21
21
  import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
22
- const Checkout = ({ children, customerId, useRedirect }) => {
22
+ const Checkout = ({ children, customerId, country, useRedirect }) => {
23
23
  const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_TITLE });
24
24
  const paymentInstrumentSelectRef = useRef(null);
25
25
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
@@ -45,7 +45,7 @@ const Checkout = ({ children, customerId, useRedirect }) => {
45
45
  React.createElement(PaymentInstrumentSelect, { ref: paymentInstrumentSelectRef, beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, hidePaymentMethods: [PaymentMethod.GOOGLE_PAY], section: Section.BOX_CHECKOUT }),
46
46
  React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
47
47
  checkoutItemsKept?.map((checkoutItem) => (React.createElement(View, { key: checkoutItem.id, style: style.checkoutItemKept, testID: "checkout-items-kept" },
48
- React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, size: checkoutItem.productVariant.size, status: checkoutItem.status })))),
48
+ React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, country: country, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, size: checkoutItem.productVariant.size, status: checkoutItem.status })))),
49
49
  pricing && (React.createElement(View, { style: style.pricingContainer },
50
50
  React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount,
51
51
  // busy={submitCheckoutStatus === "loading"}
@@ -30,7 +30,7 @@ const Intro = ({ customerId }) => {
30
30
  const [incrementIntroShownCount, incrementIntroShownCountStatus] = useIncrementIntroShownCount();
31
31
  if (fiveItemsDiscountStatus === QueryStatus.LOADING)
32
32
  return React.createElement(Spinner, null);
33
- return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" ? HEADER_HEIGHT : 0 },
33
+ return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
34
34
  React.createElement(Body, { style: { column: style.bodyColumn } },
35
35
  React.createElement(View, { style: style.container },
36
36
  React.createElement(View, { style: style.content },
@@ -1,7 +1,9 @@
1
1
  import { FC } from "react";
2
2
  import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ import { Country } from "../../../../projection/shared/country";
3
4
  interface ItemProps {
4
5
  readonly customerId: string;
6
+ readonly country: Country;
5
7
  }
6
8
  declare const Item: FC<ItemProps>;
7
9
  export { Item };
@@ -29,7 +29,7 @@ import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQues
29
29
  import { SizeChangeModal } from "./components/sizeChangeModal/SizeChangeModal";
30
30
  import { SizeWithoutStockModal } from "./components/sizeWithoutStockModal/SizeWithoutStockModal";
31
31
  const { spaceXL } = theme();
32
- const Item = ({ customerId }) => {
32
+ const Item = ({ customerId, country }) => {
33
33
  const { id } = useParams();
34
34
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
35
35
  const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
@@ -136,15 +136,15 @@ const Item = ({ customerId }) => {
136
136
  return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
137
137
  React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
138
138
  React.createElement(SizeChangeModal, { visible: sizeChangeModalVisible, onDismiss: handleOnHideSizeChangeModal }),
139
- React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, footer: !customerDecissionMade && (React.createElement(ItemActions, { keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedProductsVariants?.productVariants || [], returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })) },
139
+ React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, footer: !customerDecissionMade && (React.createElement(ItemActions, { country: country, keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedProductsVariants?.productVariants || [], returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })) },
140
140
  React.createElement(Body, null,
141
141
  customerDecissionMade && (React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: handleOnBannerPress })),
142
142
  React.createElement(View, { style: [style.container, { paddingBottom: Platform.OS === "web" ? spaceXL : stickyHeight }] },
143
143
  React.createElement(View, { style: style.sliderContainer },
144
144
  React.createElement(ProductVariantSlider, { producVariantMedia: media })),
145
- React.createElement(ProductVariantDescription, { brand: brand, color: color, name: name, price: price, size: productVariantSelected.size }),
145
+ React.createElement(ProductVariantDescription, { brand: brand, color: color, country: country, name: name, price: price, size: productVariantSelected.size }),
146
146
  checkoutItem.status === CheckoutItemStatus.RETURNED && (React.createElement(View, { style: style.feedbackContainer },
147
147
  React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions || [], onEditFeedback: handleOnEditFeedback })))))),
148
- React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions || [], visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
148
+ React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, country: country, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions || [], visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
149
149
  };
150
150
  export { Item };
@@ -1,5 +1,6 @@
1
1
  import { FC } from "react";
2
2
  import { ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
3
+ import { Country } from "../../../../../../projection/shared/country";
3
4
  import { Layout } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
4
5
  interface ItemActionsProps {
5
6
  readonly productVariants: ProductVariantProjection[];
@@ -7,6 +8,7 @@ interface ItemActionsProps {
7
8
  readonly keepButtonLoading?: boolean;
8
9
  readonly returnButtonLoading?: boolean;
9
10
  readonly sizeSelectorDisabled?: boolean;
11
+ readonly country: Country;
10
12
  readonly onSizeSelectorPress?: () => void;
11
13
  readonly onKeep: () => void;
12
14
  readonly onReturn: () => void;
@@ -3,16 +3,20 @@ import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/But
3
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
4
  import React, { useCallback, useMemo } from "react";
5
5
  import { View } from "react-native";
6
+ import { size } from "../../../../../../projection/shared/size";
6
7
  import { Sticky } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
7
8
  import { SelectField } from "../../../../../../shared/ui/components/molecules/selectField/SelectField";
8
9
  import { Body } from "../../../../components/layouts/body/Body";
9
10
  import { I18nMessages } from "../../../../i18n/i18n";
10
11
  import { style } from "./ItemActions.style";
11
- const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoading = false, returnButtonLoading = false, sizeSelectorDisabled = false, onSizeSelectorPress = () => void 0, onKeep, onReplace, onReturn, onLayout, }) => {
12
+ const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoading = false, returnButtonLoading = false, sizeSelectorDisabled = false, country, onSizeSelectorPress = () => void 0, onKeep, onReplace, onReturn, onLayout, }) => {
12
13
  const sizeSelectorLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
13
14
  const keepButtonText = useI18nMessage({ id: I18nMessages.ITEM_KEEP_BUTTON });
14
15
  const returnButtonText = useI18nMessage({ id: I18nMessages.ITEM_RETURN_BUTTON });
15
- const sizeSelectorOptions = useMemo(() => productVariants.map((productVariant) => ({ label: productVariant.size.lookiero, value: productVariant.id })), [productVariants]);
16
+ const sizeSelectorOptions = useMemo(() => productVariants.map((productVariant) => ({
17
+ label: size({ size: productVariant.size, country }),
18
+ value: productVariant.id,
19
+ })), [country, productVariants]);
16
20
  const disabledSizeSelector = useMemo(() => sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === productVariantSelected.id, [sizeSelectorOptions, productVariantSelected.id]);
17
21
  const handleOnPressSizeSelector = useCallback(() => onSizeSelectorPress(), [onSizeSelectorPress]);
18
22
  return (React.createElement(Sticky, { onLayout: onLayout },
@@ -2,6 +2,7 @@ import { FC } from "react";
2
2
  import { ImageStyle, StyleProp } from "react-native";
3
3
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
4
4
  import { ColorProjection, MediaProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
5
+ import { Country } from "../../../../../../projection/shared/country";
5
6
  import { PriceProjection } from "../../../../../../projection/shared/price";
6
7
  import { SizeProjection } from "../../../../../../projection/shared/size";
7
8
  interface ProductVariantStyle {
@@ -16,6 +17,7 @@ interface ProductVariantProps {
16
17
  readonly color: ColorProjection;
17
18
  readonly status?: CheckoutItemStatus;
18
19
  readonly discarded?: boolean;
20
+ readonly country: Country;
19
21
  readonly style?: Partial<ProductVariantStyle>;
20
22
  readonly onPress?: () => void;
21
23
  }
@@ -4,6 +4,7 @@ import React from "react";
4
4
  import { Image, Pressable, View } from "react-native";
5
5
  import Svg, { Line } from "react-native-svg";
6
6
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
7
+ import { size } from "../../../../../../projection/shared/size";
7
8
  import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
8
9
  import { Price } from "../../../../components/atoms/price/Price";
9
10
  import { useMediaImage } from "../../../../hooks/useMediaImage";
@@ -11,7 +12,7 @@ import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
11
12
  import { theme } from "../../../../theme/theme";
12
13
  import { IMAGE_WIDTH, style } from "./ProductVariant.style";
13
14
  const { colorContent } = theme();
14
- const ProductVariant = ({ media, brand, name, price, size, color, status, discarded, style: customStyle, onPress, }) => {
15
+ const ProductVariant = ({ media, brand, name, price, size: sizeProjection, color, status, discarded, country, style: customStyle, onPress, }) => {
15
16
  const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
16
17
  const colorLabel = useI18nMessage({ id: color.label, prefix: COLOR_I18N_PREFIX });
17
18
  const sizeChangeText = useI18nMessage({ id: I18nMessages.PRODUCT_VARIANT_SIZE_CHANGE });
@@ -32,7 +33,7 @@ const ProductVariant = ({ media, brand, name, price, size, color, status, discar
32
33
  React.createElement(Text, { level: 2, style: style.brand, detail: true }, brand),
33
34
  React.createElement(Text, { level: 2, detail: true }, name),
34
35
  React.createElement(Text, { level: 2, style: style.priceAndColor, detail: true },
35
- size.unique ? uniqueText : size.lookiero,
36
+ sizeProjection.unique ? uniqueText : size({ size: sizeProjection, country }),
36
37
  " / ",
37
38
  colorLabel),
38
39
  status === CheckoutItemStatus.REPLACED && (React.createElement(View, { style: style.sizeChange },
@@ -1,5 +1,6 @@
1
1
  import { FC } from "react";
2
2
  import { ColorProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
+ import { Country } from "../../../../../../projection/shared/country";
3
4
  import { PriceProjection } from "../../../../../../projection/shared/price";
4
5
  import { SizeProjection } from "../../../../../../projection/shared/size";
5
6
  interface ProductVariantDescriptionProps {
@@ -8,6 +9,7 @@ interface ProductVariantDescriptionProps {
8
9
  readonly price: PriceProjection;
9
10
  readonly size: SizeProjection;
10
11
  readonly color: ColorProjection;
12
+ readonly country: Country;
11
13
  }
12
14
  declare const ProductVariantDescription: FC<ProductVariantDescriptionProps>;
13
15
  export { ProductVariantDescription };
@@ -2,10 +2,11 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
2
2
  import { useI18nMessage } from "@lookiero/i18n-react";
3
3
  import React from "react";
4
4
  import { View } from "react-native";
5
+ import { size } from "../../../../../../projection/shared/size";
5
6
  import { Price } from "../../../../components/atoms/price/Price";
6
7
  import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
7
8
  import { style } from "./ProductVariantDescription.style";
8
- const ProductVariantDescription = ({ brand, name, price, size, color }) => {
9
+ const ProductVariantDescription = ({ brand, name, price, size: sizeProjection, color, country, }) => {
9
10
  const sizeText = useI18nMessage({ id: I18nMessages.ITEM_SIZE });
10
11
  const colorText = useI18nMessage({ id: I18nMessages.ITEM_COLOR });
11
12
  const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
@@ -16,8 +17,9 @@ const ProductVariantDescription = ({ brand, name, price, size, color }) => {
16
17
  React.createElement(Price, { price: price }),
17
18
  React.createElement(Text, { level: 2, style: style.size, detail: true },
18
19
  sizeText,
19
- ": ",
20
- React.createElement(Text, { style: style.text }, size.unique ? uniqueText : size.lookiero)),
20
+ ":",
21
+ " ",
22
+ React.createElement(Text, { style: style.text }, sizeProjection.unique ? uniqueText : size({ size: sizeProjection, country }))),
21
23
  React.createElement(Text, { level: 2, detail: true },
22
24
  colorText,
23
25
  ": ",
@@ -2,12 +2,14 @@ import { FC } from "react";
2
2
  import { CheckoutItemProductVariantProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
3
  import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
4
4
  import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
5
+ import { Country } from "../../../../../../projection/shared/country";
5
6
  import { PriceProjection } from "../../../../../../projection/shared/price";
6
7
  interface ReturnQuestionsFormProps {
7
8
  readonly visible: boolean;
8
9
  readonly returnQuestions: ReturnQuestionProjection[];
9
10
  readonly checkoutItemPrice: PriceProjection;
10
11
  readonly productVariant: CheckoutItemProductVariantProjection;
12
+ readonly country: Country;
11
13
  readonly onSubmit: (feedback: FeedbackProjection) => void;
12
14
  readonly onClose: () => void;
13
15
  }
@@ -26,7 +26,7 @@ const returnQuestionItems = {
26
26
  [ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
27
27
  [ReturnQuestionType.OPTION]: OptionReturnQuestionItem,
28
28
  };
29
- const ReturnQuestionsForm = ({ returnQuestions, checkoutItemPrice, productVariant, visible, onSubmit, onClose, }) => {
29
+ const ReturnQuestionsForm = ({ returnQuestions, checkoutItemPrice, productVariant, visible, country, onSubmit, onClose, }) => {
30
30
  const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE });
31
31
  const submitButtonText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON });
32
32
  const { media, brand, name, size, color } = productVariant;
@@ -37,7 +37,7 @@ const ReturnQuestionsForm = ({ returnQuestions, checkoutItemPrice, productVarian
37
37
  React.createElement(Modal, { footer: React.createElement(Button, { onPress: handleOnSubmit }, submitButtonText), portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, visible: visible, scroll: true, showCloseButton: true, onClose: onClose },
38
38
  React.createElement(View, { style: style.returnQuestionsContainer },
39
39
  React.createElement(Text, { level: 2, style: style.title }, titleText),
40
- React.createElement(ProductVariant, { brand: brand, color: color, media: media, name: name, price: checkoutItemPrice, size: size }),
40
+ React.createElement(ProductVariant, { brand: brand, color: color, country: country, media: media, name: name, price: checkoutItemPrice, size: size }),
41
41
  React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions })))));
42
42
  };
43
43
  export { ReturnQuestionsForm };
@@ -1,6 +1,8 @@
1
1
  import { FC } from "react";
2
+ import { Country } from "../../../../projection/shared/country";
2
3
  interface SummaryProps {
3
4
  readonly customerId: string;
5
+ readonly country: Country;
4
6
  }
5
7
  declare const Summary: FC<SummaryProps>;
6
8
  export { Summary };
@@ -21,7 +21,7 @@ import { CheckoutItemsTabs } from "./components/checkoutItemsTabs/CheckoutItemsT
21
21
  import { FiveItemsDiscountBanner } from "./components/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
22
22
  import { StickyPricing } from "./components/stickyPricing/StickyPricing";
23
23
  const { spaceXL } = theme();
24
- const Summary = ({ customerId }) => {
24
+ const Summary = ({ customerId, country }) => {
25
25
  const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
26
26
  const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
27
27
  const [pricingHeight, setPricingHeight] = useState(0);
@@ -49,6 +49,6 @@ const Summary = ({ customerId }) => {
49
49
  React.createElement(View, { style: style.content },
50
50
  React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
51
51
  React.createElement(Text, { level: 3, style: style.description, body: true }, descriptionText)),
52
- React.createElement(CheckoutItemsTabs, { checkoutItemsKept: checkoutItemsKept || [], checkoutItemsReturned: checkoutItemsReturned || [], onPressItem: handleOnPressItem }))));
52
+ React.createElement(CheckoutItemsTabs, { checkoutItemsKept: checkoutItemsKept || [], checkoutItemsReturned: checkoutItemsReturned || [], country: country, onPressItem: handleOnPressItem }))));
53
53
  };
54
54
  export { Summary };
@@ -1,8 +1,10 @@
1
1
  import { FC } from "react";
2
2
  import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
+ import { Country } from "../../../../../../projection/shared/country";
3
4
  interface CheckoutItemsTabsProps {
4
5
  readonly checkoutItemsKept: CheckoutItemProjection[];
5
6
  readonly checkoutItemsReturned: CheckoutItemProjection[];
7
+ readonly country: Country;
6
8
  readonly onPressItem: (checkoutItemId: string) => void;
7
9
  }
8
10
  declare const CheckoutItemsTabs: FC<CheckoutItemsTabsProps>;
@@ -7,18 +7,18 @@ import { Tabs } from "../../../../components/layouts/tabs/Tabs";
7
7
  import { I18nMessages } from "../../../../i18n/i18n";
8
8
  import { ProductVariant } from "../../../item/components/productVariant/ProductVariant";
9
9
  import { style } from "./CheckoutItemsTabs.style";
10
- const CheckoutItem = ({ checkoutItemStatus, checkoutItemProductVariant, checkoutItemPrice, discarded = false, testID, style: customStyle, onPress, }) => (React.createElement(View, { style: style.checkoutItem, testID: testID },
11
- React.createElement(ProductVariant, { brand: checkoutItemProductVariant.brand, color: checkoutItemProductVariant.color, discarded: discarded, media: checkoutItemProductVariant.media, name: checkoutItemProductVariant.name, price: checkoutItemPrice, size: checkoutItemProductVariant.size, status: checkoutItemStatus, style: customStyle, onPress: onPress })));
12
- const CheckoutItemsTabs = ({ checkoutItemsKept, checkoutItemsReturned, onPressItem }) => {
10
+ const CheckoutItem = ({ checkoutItemStatus, checkoutItemProductVariant, checkoutItemPrice, country, discarded = false, testID, style: customStyle, onPress, }) => (React.createElement(View, { style: style.checkoutItem, testID: testID },
11
+ React.createElement(ProductVariant, { brand: checkoutItemProductVariant.brand, color: checkoutItemProductVariant.color, country: country, discarded: discarded, media: checkoutItemProductVariant.media, name: checkoutItemProductVariant.name, price: checkoutItemPrice, size: checkoutItemProductVariant.size, status: checkoutItemStatus, style: customStyle, onPress: onPress })));
12
+ const CheckoutItemsTabs = ({ checkoutItemsKept, checkoutItemsReturned, country, onPressItem, }) => {
13
13
  const keepTabText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_TAB });
14
14
  const returnTabText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_TAB });
15
15
  const keepEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_EMPTY });
16
16
  const returnEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_EMPTY });
17
17
  const handleOnPressItem = useCallback((checkoutItemId) => onPressItem(checkoutItemId), [onPressItem]);
18
18
  return (React.createElement(Tabs, { style: { sliderContainer: style.sliderContainer }, tabLabels: [`${keepTabText} (${checkoutItemsKept.length})`, `${returnTabText} (${checkoutItemsReturned.length})`] },
19
- React.createElement(React.Fragment, null, checkoutItemsKept.length === 0 ? (React.createElement(Text, { style: style.emptyText }, keepEmptyText)) : (checkoutItemsKept.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemStatus: checkoutItem.status, testID: "keep-checkout-item", checkoutItemProductVariant: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
19
+ React.createElement(React.Fragment, null, checkoutItemsKept.length === 0 ? (React.createElement(Text, { style: style.emptyText }, keepEmptyText)) : (checkoutItemsKept.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemStatus: checkoutItem.status, country: country, testID: "keep-checkout-item", checkoutItemProductVariant: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
20
20
  ? checkoutItem.replacedFor
21
21
  : checkoutItem.productVariant, onPress: () => handleOnPressItem(checkoutItem.id) }))))),
22
- React.createElement(React.Fragment, null, checkoutItemsReturned.length === 0 ? (React.createElement(Text, { style: style.emptyText }, returnEmptyText)) : (checkoutItemsReturned.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemProductVariant: checkoutItem.productVariant, checkoutItemStatus: checkoutItem.status, style: { image: style.returnCheckoutItem }, testID: "return-checkout-item", discarded: true, onPress: () => handleOnPressItem(checkoutItem.id) })))))));
22
+ React.createElement(React.Fragment, null, checkoutItemsReturned.length === 0 ? (React.createElement(Text, { style: style.emptyText }, returnEmptyText)) : (checkoutItemsReturned.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemProductVariant: checkoutItem.productVariant, checkoutItemStatus: checkoutItem.status, country: country, style: { image: style.returnCheckoutItem }, testID: "return-checkout-item", discarded: true, onPress: () => handleOnPressItem(checkoutItem.id) })))))));
23
23
  };
24
24
  export { CheckoutItemsTabs };
@@ -0,0 +1,13 @@
1
+ declare enum Country {
2
+ "ES" = "ES",
3
+ "FR" = "FR",
4
+ "GB" = "GB",
5
+ "BE" = "BE",
6
+ "LU" = "LU",
7
+ "IT" = "IT",
8
+ "PT" = "PT",
9
+ "DE" = "DE",
10
+ "AT" = "AT",
11
+ "NL" = "NL"
12
+ }
13
+ export { Country };
@@ -0,0 +1,14 @@
1
+ var Country;
2
+ (function (Country) {
3
+ Country["ES"] = "ES";
4
+ Country["FR"] = "FR";
5
+ Country["GB"] = "GB";
6
+ Country["BE"] = "BE";
7
+ Country["LU"] = "LU";
8
+ Country["IT"] = "IT";
9
+ Country["PT"] = "PT";
10
+ Country["DE"] = "DE";
11
+ Country["AT"] = "AT";
12
+ Country["NL"] = "NL";
13
+ })(Country || (Country = {}));
14
+ export { Country };
@@ -0,0 +1,6 @@
1
+ import { Country } from "./country";
2
+ interface Customer {
3
+ readonly customerId: string;
4
+ readonly country: Country;
5
+ }
6
+ export type { Customer };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import { Country } from "./country";
1
2
  interface SizeProjection {
2
3
  readonly id: string;
3
4
  readonly lookiero: string;
@@ -7,4 +8,13 @@ interface SizeProjection {
7
8
  readonly unique: boolean;
8
9
  readonly visualOrder?: number;
9
10
  }
11
+ interface SizeFunctionArgs {
12
+ readonly size: SizeProjection;
13
+ readonly country: Country;
14
+ }
15
+ interface SizeFunction {
16
+ (args: SizeFunctionArgs): string;
17
+ }
18
+ declare const size: SizeFunction;
10
19
  export type { SizeProjection };
20
+ export { size };
@@ -1 +1,3 @@
1
- export {};
1
+ import { Country } from "./country";
2
+ const size = ({ size, country }) => (country === Country.GB ? size.uk : size.lookiero);
3
+ export { size };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [