@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.
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +2 -1
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +6 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +7 -0
- package/dist/infrastructure/ui/i18n/i18n.d.ts +3 -1
- package/dist/infrastructure/ui/i18n/i18n.js +2 -0
- package/dist/infrastructure/ui/routing/Routing.js +7 -1
- package/dist/infrastructure/ui/views/checkout/Checkout.js +5 -5
- package/dist/infrastructure/ui/views/checkout/Checkout.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/checkout/Checkout.style.js +0 -3
- package/dist/infrastructure/ui/views/feedback/Feedback.js +1 -1
- package/dist/infrastructure/ui/views/feedback/Feedback.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/feedback/Feedback.style.js +0 -3
- package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -3
- package/dist/infrastructure/ui/views/item/Item.js +1 -1
- package/dist/infrastructure/ui/views/item/Item.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/item/Item.style.js +0 -3
- package/dist/infrastructure/ui/views/notFound/NotFound.d.ts +3 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.js +26 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.style.d.ts +16 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.style.js +19 -0
- package/dist/infrastructure/ui/views/summary/Summary.js +1 -1
- package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/summary/Summary.style.js +0 -3
- 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,
|
|
@@ -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.
|
|
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
|
|
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,
|
|
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 };
|
|
@@ -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
|
|
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
|
};
|
|
@@ -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
|
|
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 },
|
|
@@ -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,
|
|
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 }] },
|
|
@@ -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,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,
|
|
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 },
|