@lookiero/checkout 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +2 -1
  2. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +6 -0
  3. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +7 -0
  4. package/dist/infrastructure/ui/i18n/i18n.d.ts +3 -1
  5. package/dist/infrastructure/ui/i18n/i18n.js +2 -0
  6. package/dist/infrastructure/ui/routing/Routing.js +7 -1
  7. package/dist/infrastructure/ui/views/checkout/Checkout.js +5 -5
  8. package/dist/infrastructure/ui/views/checkout/Checkout.style.d.ts +0 -3
  9. package/dist/infrastructure/ui/views/checkout/Checkout.style.js +0 -3
  10. package/dist/infrastructure/ui/views/feedback/Feedback.js +1 -1
  11. package/dist/infrastructure/ui/views/feedback/Feedback.style.d.ts +0 -3
  12. package/dist/infrastructure/ui/views/feedback/Feedback.style.js +0 -3
  13. package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
  14. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -3
  15. package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -3
  16. package/dist/infrastructure/ui/views/item/Item.js +1 -1
  17. package/dist/infrastructure/ui/views/item/Item.style.d.ts +0 -3
  18. package/dist/infrastructure/ui/views/item/Item.style.js +0 -3
  19. package/dist/infrastructure/ui/views/notFound/NotFound.d.ts +3 -0
  20. package/dist/infrastructure/ui/views/notFound/NotFound.js +26 -0
  21. package/dist/infrastructure/ui/views/notFound/NotFound.style.d.ts +16 -0
  22. package/dist/infrastructure/ui/views/notFound/NotFound.style.js +19 -0
  23. package/dist/infrastructure/ui/views/summary/Summary.js +1 -1
  24. package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +0 -3
  25. package/dist/infrastructure/ui/views/summary/Summary.style.js +0 -3
  26. package/package.json +1 -1
@@ -2,10 +2,11 @@ import React from "react";
2
2
  import { Platform, ScrollView } from "react-native";
3
3
  import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
4
4
  import { theme } from "../../theme/theme";
5
+ import { style } from "./SafeAreaScrollView.style.ts";
5
6
  const { spaceXXXL } = theme();
6
7
  const SafeAreaScrollView = ({ children, footer, edges = ["top", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
7
8
  const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
8
- return (React.createElement(SafeAreaView, { edges: edges, style: customStyle?.safeAreaView },
9
+ return (React.createElement(SafeAreaView, { edges: edges, style: [style.safeAreaView, customStyle?.safeAreaView] },
9
10
  React.createElement(ScrollView, { contentContainerStyle: [
10
11
  {
11
12
  paddingTop: safeAreaInsetTop + scrollerPaddingTop,
@@ -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 };
@@ -58,6 +58,8 @@ declare enum I18nMessages {
58
58
  HEADER_CHECKOUT_TITLE = "header.checkout_title",
59
59
  HEADER_COMPLETE_CHECKOUT_TITLE = "header.complete_checkout_title",
60
60
  FEEDBACK_BUTTON = "feedback.button",
61
- CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired"
61
+ CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired",
62
+ NOT_FOUND_DESCRIPTION = "not_found.description",
63
+ NOT_FOUND_BUTTON = "not_found.button"
62
64
  }
63
65
  export { I18nMessages, COLOR_I18N_PREFIX };
@@ -60,5 +60,7 @@ var I18nMessages;
60
60
  I18nMessages["HEADER_COMPLETE_CHECKOUT_TITLE"] = "header.complete_checkout_title";
61
61
  I18nMessages["FEEDBACK_BUTTON"] = "feedback.button";
62
62
  I18nMessages["CHECKOUT_TOAST_BOOKING_EXPIRED"] = "checkout.toast_booking_expired";
63
+ I18nMessages["NOT_FOUND_DESCRIPTION"] = "not_found.description";
64
+ I18nMessages["NOT_FOUND_BUTTON"] = "not_found.button";
63
65
  })(I18nMessages || (I18nMessages = {}));
64
66
  export { I18nMessages, COLOR_I18N_PREFIX };
@@ -12,6 +12,7 @@ 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 NotFound = lazy(() => import("../views/notFound/NotFound").then((module) => ({ default: module.NotFound })));
15
16
  const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, }) => {
16
17
  const routes = useRoutes([
17
18
  {
@@ -60,9 +61,14 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
60
61
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
61
62
  React.createElement(Feedback, { customerId: customer?.customerId }))),
62
63
  },
64
+ {
65
+ path: Routes.NOT_FOUND,
66
+ element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
67
+ React.createElement(NotFound, null))),
68
+ },
63
69
  {
64
70
  path: "*",
65
- element: React.createElement(Navigate, { to: `${Routes.HOME}`, replace: true }),
71
+ element: React.createElement(Navigate, { to: `${Routes.NOT_FOUND}`, replace: true }),
66
72
  },
67
73
  ],
68
74
  },
@@ -38,18 +38,18 @@ const Checkout = ({ children, customerId, country, useRedirect }) => {
38
38
  if (!dependenciesLoaded)
39
39
  return React.createElement(Spinner, null);
40
40
  return (React.createElement(React.Fragment, null,
41
- React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, style: { safeAreaView: style.container } },
41
+ React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
42
42
  React.createElement(Body, { style: { column: style.bodyColumn } },
43
43
  hasReplacedCheckoutItem && (React.createElement(View, { style: style.deliveryBannerContainer },
44
44
  React.createElement(DeliveryBanner, null))),
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, country: country, 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, status: checkoutItem.status, size: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
49
+ ? checkoutItem.replacedFor.size
50
+ : checkoutItem.productVariant.size })))),
49
51
  pricing && (React.createElement(View, { style: style.pricingContainer },
50
- React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount,
51
- // busy={submitCheckoutStatus === "loading"}
52
- collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage, orderTotal: pricing.orderTotal, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onSubmit: handleOnSubmit }))))),
52
+ React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage, orderTotal: pricing.orderTotal, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onSubmit: handleOnSubmit }))))),
53
53
  children));
54
54
  };
55
55
  export { Checkout };
@@ -5,9 +5,6 @@ declare const style: {
5
5
  checkoutItemKept: {
6
6
  paddingVertical: number;
7
7
  };
8
- container: {
9
- flex: number;
10
- };
11
8
  deliveryBannerContainer: {
12
9
  marginBottom: number;
13
10
  };
@@ -8,9 +8,6 @@ const style = StyleSheet.create({
8
8
  checkoutItemKept: {
9
9
  paddingVertical: spaceM,
10
10
  },
11
- container: {
12
- flex: 1,
13
- },
14
11
  deliveryBannerContainer: {
15
12
  marginBottom: spaceXXL,
16
13
  },
@@ -30,7 +30,7 @@ const Feedback = ({ customerId }) => {
30
30
  if (!dependenciesLoaded)
31
31
  return React.createElement(Spinner, null);
32
32
  return (React.createElement(CheckoutQuestionFeedbackProvider, { feedback: {} },
33
- React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, style: { safeAreaView: style.container } },
33
+ 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(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit })))));
36
36
  };
@@ -2,8 +2,5 @@ declare const style: {
2
2
  bodyColumn: {
3
3
  paddingHorizontal: number;
4
4
  };
5
- container: {
6
- flex: number;
7
- };
8
5
  };
9
6
  export { style };
@@ -5,8 +5,5 @@ const style = StyleSheet.create({
5
5
  bodyColumn: {
6
6
  paddingHorizontal: spaceXL,
7
7
  },
8
- container: {
9
- flex: 1,
10
- },
11
8
  });
12
9
  export { style };
@@ -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" || Platform.OS === "android" ? HEADER_HEIGHT : 0, style: { safeAreaView: style.container } },
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.intro },
36
36
  React.createElement(View, { style: style.content },
@@ -7,9 +7,6 @@ declare const style: {
7
7
  flexDirection: "row";
8
8
  marginVertical: number;
9
9
  };
10
- container: {
11
- flex: number;
12
- };
13
10
  content: {
14
11
  alignItems: "center";
15
12
  };
@@ -10,9 +10,6 @@ const style = StyleSheet.create({
10
10
  flexDirection: "row",
11
11
  marginVertical: spaceS,
12
12
  },
13
- container: {
14
- flex: 1,
15
- },
16
13
  content: {
17
14
  alignItems: "center",
18
15
  },
@@ -136,7 +136,7 @@ const Item = ({ customerId, country }) => {
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, style: { safeAreaView: style.container }, 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 })) },
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.content, { paddingBottom: Platform.OS === "web" ? spaceXL : stickyHeight }] },
@@ -1,7 +1,4 @@
1
1
  declare const style: {
2
- container: {
3
- flex: number;
4
- };
5
2
  content: {
6
3
  paddingHorizontal: number;
7
4
  };
@@ -2,9 +2,6 @@ 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
- flex: 1,
7
- },
8
5
  content: {
9
6
  paddingHorizontal: spaceXL,
10
7
  },
@@ -0,0 +1,3 @@
1
+ import { FC } from "react";
2
+ declare const NotFound: FC;
3
+ export { NotFound };
@@ -0,0 +1,26 @@
1
+ import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
3
+ import { useI18nMessage } from "@lookiero/i18n-react";
4
+ import React, { useCallback } from "react";
5
+ import { Image, Platform } from "react-native";
6
+ import { useNavigate } from "react-router-native";
7
+ import { Body } from "../../components/layouts/body/Body";
8
+ import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
9
+ import { I18nMessages } from "../../i18n/i18n";
10
+ import { Routes } from "../../routing/routes";
11
+ import { useBasePath } from "../../routing/useBasePath";
12
+ import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
13
+ import { style } from "./NotFound.style";
14
+ const NotFound = () => {
15
+ const descriptionText = useI18nMessage({ id: I18nMessages.NOT_FOUND_DESCRIPTION });
16
+ const buttonText = useI18nMessage({ id: I18nMessages.NOT_FOUND_BUTTON });
17
+ const navigate = useNavigate();
18
+ const basePath = useBasePath();
19
+ const handleOnPress = useCallback(() => navigate(`${basePath}/${Routes.HOME}`), [basePath, navigate]);
20
+ return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, style: { scrollView: style.container } },
21
+ React.createElement(Body, { style: { column: style.bodyColumn } },
22
+ React.createElement(Image, { resizeMode: "contain", source: require("./images/not-found.png"), style: style.image, testID: "not-found-image" }),
23
+ React.createElement(Text, { level: 1, style: style.description, body: true }, descriptionText),
24
+ React.createElement(Button, { onPress: handleOnPress }, buttonText))));
25
+ };
26
+ export { NotFound };
@@ -0,0 +1,16 @@
1
+ declare const style: {
2
+ bodyColumn: {
3
+ paddingHorizontal: number;
4
+ };
5
+ container: {
6
+ flex: number;
7
+ };
8
+ description: {
9
+ marginBottom: number;
10
+ textAlign: "center";
11
+ };
12
+ image: {
13
+ flex: number;
14
+ };
15
+ };
16
+ export { style };
@@ -0,0 +1,19 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../theme/theme";
3
+ const { spaceXL } = theme();
4
+ const style = StyleSheet.create({
5
+ bodyColumn: {
6
+ paddingHorizontal: spaceXL,
7
+ },
8
+ container: {
9
+ flex: 1,
10
+ },
11
+ description: {
12
+ marginBottom: spaceXL,
13
+ textAlign: "center",
14
+ },
15
+ image: {
16
+ flex: 0.5,
17
+ },
18
+ });
19
+ export { style };
@@ -43,7 +43,7 @@ const Summary = ({ customerId, country }) => {
43
43
  dependenciesLoadedStatuses.includes(fiveItemsDiscountStatus);
44
44
  if (!dependenciesLoaded)
45
45
  return React.createElement(Spinner, null);
46
- return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, style: { safeAreaView: style.container }, footer: pricing && (React.createElement(StickyPricing, { collapsed: pricingCollapsed, pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined, onPress: handleOnPressPricing, onSubmit: handleOnSubmit })) },
46
+ return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, footer: pricing && (React.createElement(StickyPricing, { collapsed: pricingCollapsed, pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined, onPress: handleOnPressPricing, onSubmit: handleOnSubmit })) },
47
47
  React.createElement(Body, { style: { row: { paddingBottom: pricingHeight || spaceXL } } },
48
48
  fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
49
49
  React.createElement(View, { style: style.content },
@@ -1,7 +1,4 @@
1
1
  declare const style: {
2
- container: {
3
- flex: number;
4
- };
5
2
  content: {
6
3
  paddingHorizontal: number;
7
4
  };
@@ -2,9 +2,6 @@ import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../theme/theme";
3
3
  const { spaceM, spaceL, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
- container: {
6
- flex: 1,
7
- },
8
5
  content: {
9
6
  paddingHorizontal: spaceXL,
10
7
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [