@lookiero/checkout 0.5.0-beta.4 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/infrastructure/ui/Root.d.ts +2 -1
- package/dist/infrastructure/ui/Root.js +2 -2
- 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/{views/header/components/Logo.style.js → components/templates/SafeAreaScrollView.style.ts.js} +2 -3
- 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.d.ts +2 -1
- package/dist/infrastructure/ui/routing/Routing.js +18 -12
- package/dist/infrastructure/ui/views/checkout/Checkout.d.ts +2 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.js +3 -3
- 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.d.ts +2 -0
- package/dist/infrastructure/ui/views/item/Item.js +4 -4
- 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/item/components/itemActions/ItemActions.d.ts +2 -0
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +6 -2
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +2 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +3 -2
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +2 -0
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +5 -3
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +2 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +2 -2
- 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.d.ts +2 -0
- package/dist/infrastructure/ui/views/summary/Summary.js +3 -3
- package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/summary/Summary.style.js +0 -3
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +2 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
- package/dist/projection/shared/country.d.ts +13 -0
- package/dist/projection/shared/country.js +14 -0
- package/dist/projection/shared/customer.d.ts +6 -0
- package/dist/projection/shared/size.d.ts +10 -0
- package/dist/projection/shared/size.js +3 -1
- package/package.json +1 -1
- package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
- package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
- package/dist/domain/checkout/model/checkoutPaid.js +0 -4
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +0 -13
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +0 -16
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +0 -14
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +0 -12
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +0 -9
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +0 -10
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +0 -12
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +0 -12
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +0 -9
- package/dist/infrastructure/ui/views/App.style.d.ts +0 -4
- package/dist/infrastructure/ui/views/App.style.js +0 -16
- package/dist/infrastructure/ui/views/header/Header.d.ts +0 -15
- package/dist/infrastructure/ui/views/header/Header.js +0 -90
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +0 -35
- package/dist/infrastructure/ui/views/header/Header.style.js +0 -38
- package/dist/infrastructure/ui/views/header/components/Logo.d.ts +0 -7
- package/dist/infrastructure/ui/views/header/components/Logo.js +0 -11
- package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +0 -7
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -10
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +0 -25
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +0 -8
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +0 -25
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +0 -8
- /package/dist/projection/{bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js → shared/customer.js} +0 -0
|
@@ -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, TabBar } from "./views/navigation/Navigation";
|
|
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
|
|
18
|
+
readonly customer: Customer | undefined;
|
|
18
19
|
readonly menu: Menu;
|
|
19
20
|
readonly tabBar: TabBar;
|
|
20
21
|
readonly onNotAccessible: () => void;
|
|
@@ -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",
|
|
6
|
+
({ basePath, locale = "en", customer, menu, tabBar, 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,
|
|
9
|
+
React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
|
|
10
10
|
};
|
|
11
11
|
export { root };
|
|
@@ -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 };
|
|
@@ -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, TabBar } from "../views/navigation/Navigation";
|
|
4
5
|
interface RoutingProps {
|
|
5
6
|
readonly basePath?: string;
|
|
6
|
-
readonly
|
|
7
|
+
readonly customer: Customer | undefined;
|
|
7
8
|
readonly locale: string;
|
|
8
9
|
readonly I18n: I18n;
|
|
9
10
|
readonly menu: Menu;
|
|
@@ -12,57 +12,63 @@ 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
|
|
15
|
+
const NotFound = lazy(() => import("../views/notFound/NotFound").then((module) => ({ default: module.NotFound })));
|
|
16
|
+
const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, }) => {
|
|
16
17
|
const routes = useRoutes([
|
|
17
18
|
{
|
|
18
19
|
path: "",
|
|
19
20
|
element: (React.createElement(BasePathProvider, { basePath: basePath },
|
|
20
|
-
React.createElement(CheckoutAccessibilityMiddleware, { customerId: customerId, onNotAccessible: onNotAccessible },
|
|
21
|
+
React.createElement(CheckoutAccessibilityMiddleware, { customerId: customer?.customerId, onNotAccessible: onNotAccessible },
|
|
21
22
|
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, tabBar: tabBar },
|
|
23
|
+
React.createElement(CheckoutMiddleware, { customerId: customer?.customerId },
|
|
24
|
+
React.createElement(App, { customerId: customer?.customerId, menu: menu, tabBar: tabBar },
|
|
24
25
|
React.createElement(Outlet, null))))))),
|
|
25
26
|
children: [
|
|
26
27
|
{
|
|
27
28
|
path: Routes.INTRO,
|
|
28
29
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
29
|
-
React.createElement(Intro, { customerId: customerId }))),
|
|
30
|
+
React.createElement(Intro, { customerId: customer?.customerId }))),
|
|
30
31
|
},
|
|
31
32
|
{
|
|
32
33
|
path: Routes.ITEM,
|
|
33
34
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
34
|
-
React.createElement(Item, { customerId: customerId }))),
|
|
35
|
+
React.createElement(Item, { country: customer?.country, customerId: customer?.customerId }))),
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
path: Routes.ITEM_DETAIL,
|
|
38
39
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
39
|
-
React.createElement(Item, { customerId: customerId }))),
|
|
40
|
+
React.createElement(Item, { country: customer?.country, customerId: customer?.customerId }))),
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
path: Routes.SUMMARY,
|
|
43
44
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
44
|
-
React.createElement(Summary, { customerId: customerId }))),
|
|
45
|
+
React.createElement(Summary, { country: customer?.country, customerId: customer?.customerId }))),
|
|
45
46
|
},
|
|
46
47
|
{
|
|
47
48
|
path: Routes.CHECKOUT,
|
|
48
49
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
49
|
-
React.createElement(Checkout, { customerId: customerId, useRedirect: useRedirect },
|
|
50
|
+
React.createElement(Checkout, { country: customer?.country, customerId: customer?.customerId, useRedirect: useRedirect },
|
|
50
51
|
React.createElement(Outlet, null)))),
|
|
51
52
|
children: [
|
|
52
53
|
{
|
|
53
54
|
path: Routes.CHECKOUT_PAYMENT,
|
|
54
|
-
element: React.createElement(CheckoutPaymentModal, { customerId: customerId, getAuthToken: getAuthToken }),
|
|
55
|
+
element: React.createElement(CheckoutPaymentModal, { customerId: customer?.customerId, getAuthToken: getAuthToken }),
|
|
55
56
|
},
|
|
56
57
|
],
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
path: Routes.FEEDBACK,
|
|
60
61
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
61
|
-
React.createElement(Feedback, { customerId: customerId }))),
|
|
62
|
+
React.createElement(Feedback, { customerId: customer?.customerId }))),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
path: Routes.NOT_FOUND,
|
|
66
|
+
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
67
|
+
React.createElement(NotFound, null))),
|
|
62
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
|
},
|
|
@@ -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 { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
|
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 });
|
|
@@ -38,14 +38,14 @@ const Checkout = ({ children, customerId, 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, 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 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 },
|
|
@@ -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,
|
|
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 }] },
|
|
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) => ({
|
|
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
|
-
|
|
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
|
-
|
|
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
|
": ",
|
package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js
CHANGED
|
@@ -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 };
|
|
@@ -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 };
|