@lookiero/checkout 0.4.10 → 0.5.0-beta.0
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/domain/checkout/command/markCheckoutAsPaid.d.ts +13 -0
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +4 -0
- package/dist/domain/checkout/model/checkoutPaid.d.ts +13 -0
- package/dist/domain/checkout/model/checkoutPaid.js +4 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +5 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +16 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +13 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +14 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +12 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +9 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +10 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +9 -0
- package/dist/infrastructure/ui/Root.d.ts +3 -3
- package/dist/infrastructure/ui/Root.js +2 -2
- package/dist/infrastructure/ui/routing/Routing.d.ts +4 -4
- package/dist/infrastructure/ui/routing/Routing.js +11 -11
- package/dist/infrastructure/ui/views/App.d.ts +2 -1
- package/dist/infrastructure/ui/views/App.js +4 -5
- package/dist/infrastructure/ui/views/checkout/Checkout.d.ts +0 -2
- package/dist/infrastructure/ui/views/checkout/Checkout.js +3 -3
- package/dist/infrastructure/ui/views/feedback/Feedback.js +1 -1
- package/dist/infrastructure/ui/views/header/Header.js +3 -4
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +1 -1
- package/dist/infrastructure/ui/views/header/Header.style.js +1 -1
- package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
- package/dist/infrastructure/ui/views/item/Item.d.ts +0 -2
- package/dist/infrastructure/ui/views/item/Item.js +5 -5
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +0 -2
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -6
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +0 -2
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +2 -3
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +0 -2
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -5
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -2
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +2 -2
- package/dist/infrastructure/ui/views/navigation/Navigation.d.ts +20 -0
- package/dist/infrastructure/ui/views/navigation/Navigation.js +16 -0
- package/dist/infrastructure/ui/views/navigation/Navigation.style.d.ts +5 -0
- package/dist/infrastructure/ui/views/navigation/Navigation.style.js +30 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.d.ts +13 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.js +88 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +35 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +38 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.d.ts +7 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.js +11 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.d.ts +7 -0
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.js +8 -0
- package/dist/infrastructure/ui/views/summary/Summary.d.ts +0 -2
- package/dist/infrastructure/ui/views/summary/Summary.js +3 -3
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +0 -2
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +10 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +25 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +8 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +25 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +8 -0
- package/dist/projection/shared/size.d.ts +0 -10
- package/dist/projection/shared/size.js +1 -3
- package/package.json +1 -1
- package/dist/projection/shared/country.d.ts +0 -13
- package/dist/projection/shared/country.js +0 -14
- package/dist/projection/shared/customer.d.ts +0 -6
- /package/dist/projection/{shared/customer.js → bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
|
|
3
|
+
interface MarkCheckoutAsPaidPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface MarkCheckoutAsPaid extends Command<typeof MARK_CHECKOUT_AS_PAID>, MarkCheckoutAsPaidPayload {
|
|
7
|
+
}
|
|
8
|
+
interface MarkCheckoutAsPaidFunction {
|
|
9
|
+
(payload: MarkCheckoutAsPaidPayload): MarkCheckoutAsPaid;
|
|
10
|
+
}
|
|
11
|
+
declare const markCheckoutAsPaid: MarkCheckoutAsPaidFunction;
|
|
12
|
+
export type { MarkCheckoutAsPaid };
|
|
13
|
+
export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_PAID = "checkout_paid";
|
|
3
|
+
interface CheckoutPaidPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutPaid extends DomainEvent<typeof CHECKOUT_PAID>, CheckoutPaidPayload {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutPaidFunction {
|
|
9
|
+
(payload: CheckoutPaidPayload): CheckoutPaid;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutPaid: CheckoutPaidFunction;
|
|
12
|
+
export type { CheckoutPaid };
|
|
13
|
+
export { CHECKOUT_PAID, checkoutPaid };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
|
|
2
|
+
const isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
|
|
3
|
+
const httpCheckoutsMarkAsPaid = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
+
const checkoutPaid = domainEvents.find(isCheckoutPaid);
|
|
5
|
+
if (!checkoutPaid) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
await httpPost({
|
|
9
|
+
endpoint: "/mark-checkout-as-paid",
|
|
10
|
+
body: { checkoutId: aggregateId },
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { httpCheckoutsMarkAsPaid };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface MarkAsPaidFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
type UseMarkCheckoutAsPaid = [markAsPaid: MarkAsPaidFunction, status: CommandStatus];
|
|
6
|
+
interface UseMarkCheckoutAsPaidFunctionArgs {
|
|
7
|
+
readonly checkoutId?: string;
|
|
8
|
+
}
|
|
9
|
+
interface UseMarkCheckoutAsPaidFunction {
|
|
10
|
+
(args: UseMarkCheckoutAsPaidFunctionArgs): UseMarkCheckoutAsPaid;
|
|
11
|
+
}
|
|
12
|
+
declare const useMarkCheckoutAsPaid: UseMarkCheckoutAsPaidFunction;
|
|
13
|
+
export { useMarkCheckoutAsPaid };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import invariant from "tiny-invariant";
|
|
4
|
+
import { markCheckoutAsPaid } from "../../../../domain/checkout/command/markCheckoutAsPaid";
|
|
5
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
+
const useMarkCheckoutAsPaid = ({ checkoutId }) => {
|
|
7
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
+
const markAsPaid = useCallback(() => {
|
|
9
|
+
invariant(checkoutId, "CheckoutId must be defined in order to mark the checkout as paid");
|
|
10
|
+
return commandBus(markCheckoutAsPaid({
|
|
11
|
+
aggregateId: checkoutId,
|
|
12
|
+
}));
|
|
13
|
+
}, [checkoutId, commandBus]);
|
|
14
|
+
return [markAsPaid, status];
|
|
15
|
+
};
|
|
16
|
+
export { useMarkCheckoutAsPaid };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface BookFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
|
|
6
|
+
interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
|
|
7
|
+
readonly checkoutItemId: string;
|
|
8
|
+
}
|
|
9
|
+
interface UseBookCheckouBookingForCheckoutItemFunction {
|
|
10
|
+
(args: UseBookCheckouBookingForCheckoutItemFunctionArgs): UseBookCheckouBookingForCheckoutItem;
|
|
11
|
+
}
|
|
12
|
+
declare const useBookCheckouBookingForCheckoutItem: UseBookCheckouBookingForCheckoutItemFunction;
|
|
13
|
+
export { useBookCheckouBookingForCheckoutItem };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { v4 as uuid } from "uuid";
|
|
4
|
+
import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
+
const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId }) => {
|
|
7
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
+
const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
|
|
9
|
+
aggregateId: uuid(),
|
|
10
|
+
checkoutItemId,
|
|
11
|
+
})), [checkoutItemId, commandBus]);
|
|
12
|
+
return [book, status];
|
|
13
|
+
};
|
|
14
|
+
export { useBookCheckouBookingForCheckoutItem };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BookedSizeChangeProductsVariantsForCheckoutItemView } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
+
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemView extends BookedSizeChangeProductsVariantsForCheckoutItemView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction {
|
|
9
|
+
(args: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpBookedSizeChangeProductsVariantsForCheckoutItemView: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction;
|
|
12
|
+
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
|
|
4
|
+
body: { checkoutItemId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
9
|
+
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { BookedSizeChangeProductsVariantsProjection } from "../../../../projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants";
|
|
3
|
+
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs {
|
|
4
|
+
readonly checkoutItemId: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
|
|
7
|
+
(args: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeChangeProductsVariantsProjection>;
|
|
8
|
+
}
|
|
9
|
+
declare const useViewBookedSizeChangeProductsVariantsForCheckoutItem: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
|
|
10
|
+
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
|
|
3
|
+
import { viewBookedSizeChangeProductsVariantsForCheckoutItem } from "../../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
6
|
+
const useViewBookedSizeChangeProductsVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
|
|
7
|
+
query: viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId }),
|
|
8
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
9
|
+
invalidation: isCheckoutBookingBooked,
|
|
10
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
11
|
+
});
|
|
12
|
+
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckoutFeedbackByCheckoutIdView } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
+
interface HttpCheckoutFeebackByCheckoutIdView extends CheckoutFeedbackByCheckoutIdView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpCheckoutFeebackByCheckoutIdViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpCheckoutFeebackByCheckoutIdViewFunction {
|
|
9
|
+
(args: HttpCheckoutFeebackByCheckoutIdViewFunctionArgs): HttpCheckoutFeebackByCheckoutIdView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpCheckoutFeebackByCheckoutIdView: HttpCheckoutFeebackByCheckoutIdViewFunction;
|
|
12
|
+
export { httpCheckoutFeebackByCheckoutIdView };
|
package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const httpCheckoutFeebackByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-checkout-feedback-by-checkout-id",
|
|
4
|
+
body: { checkoutId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
9
|
+
export { httpCheckoutFeebackByCheckoutIdView };
|
|
@@ -1,8 +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 {
|
|
5
|
-
import { Menu } from "./views/header/Header";
|
|
4
|
+
import { Menu, TabBar } from "./views/navigation/Navigation";
|
|
6
5
|
interface RootFunctionArgs {
|
|
7
6
|
readonly Messaging: MessagingRoot;
|
|
8
7
|
readonly I18n: I18n;
|
|
@@ -15,8 +14,9 @@ interface RootFunction {
|
|
|
15
14
|
interface RootProps {
|
|
16
15
|
readonly basePath: string;
|
|
17
16
|
readonly locale?: string;
|
|
18
|
-
readonly
|
|
17
|
+
readonly customerId: string | undefined;
|
|
19
18
|
readonly menu: Menu;
|
|
19
|
+
readonly tabBar: TabBar;
|
|
20
20
|
readonly onNotAccessible: () => void;
|
|
21
21
|
readonly useRedirect: () => Record<string, string>;
|
|
22
22
|
}
|
|
@@ -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", customerId, 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, customerId: customerId, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
|
|
10
10
|
};
|
|
11
11
|
export { root };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { I18n } from "@lookiero/i18n-react";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { Menu } from "../views/header/Header";
|
|
3
|
+
import { Menu, TabBar } from "../views/navigation/Navigation";
|
|
5
4
|
interface RoutingProps {
|
|
6
5
|
readonly basePath?: string;
|
|
7
|
-
readonly
|
|
6
|
+
readonly customerId: string | undefined;
|
|
8
7
|
readonly locale: string;
|
|
9
8
|
readonly I18n: I18n;
|
|
10
|
-
readonly getAuthToken: () => Promise<string>;
|
|
11
9
|
readonly menu: Menu;
|
|
10
|
+
readonly tabBar: TabBar;
|
|
11
|
+
readonly getAuthToken: () => Promise<string>;
|
|
12
12
|
readonly onNotAccessible: () => void;
|
|
13
13
|
readonly onI18nError?: (err: Error) => void;
|
|
14
14
|
readonly useRedirect: () => Record<string, 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 = "",
|
|
15
|
+
const Routing = ({ basePath = "", customerId, locale, I18n, menu, tabBar, getAuthToken, 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:
|
|
20
|
+
React.createElement(CheckoutAccessibilityMiddleware, { customerId: customerId, onNotAccessible: onNotAccessible },
|
|
21
21
|
React.createElement(I18n, { loader: React.createElement(Spinner, null), locale: locale, onError: onI18nError },
|
|
22
|
-
React.createElement(CheckoutMiddleware, { customerId:
|
|
23
|
-
React.createElement(App, { customerId:
|
|
22
|
+
React.createElement(CheckoutMiddleware, { customerId: customerId },
|
|
23
|
+
React.createElement(App, { customerId: customerId, menu: menu, tabBar: tabBar },
|
|
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:
|
|
29
|
+
React.createElement(Intro, { customerId: 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, {
|
|
34
|
+
React.createElement(Item, { customerId: 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, {
|
|
39
|
+
React.createElement(Item, { customerId: 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, {
|
|
44
|
+
React.createElement(Summary, { customerId: 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, {
|
|
49
|
+
React.createElement(Checkout, { customerId: 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:
|
|
54
|
+
element: React.createElement(CheckoutPaymentModal, { customerId: 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:
|
|
61
|
+
React.createElement(Feedback, { customerId: customerId }))),
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
path: "*",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { Menu } from "./
|
|
2
|
+
import { Menu, TabBar } from "./navigation/Navigation";
|
|
3
3
|
interface AppProps {
|
|
4
4
|
readonly customerId: string;
|
|
5
5
|
readonly menu: Menu;
|
|
6
|
+
readonly tabBar: TabBar;
|
|
6
7
|
readonly children: JSX.Element;
|
|
7
8
|
}
|
|
8
9
|
declare const App: FC<AppProps>;
|
|
@@ -3,10 +3,9 @@ import React from "react";
|
|
|
3
3
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
4
|
import { Notifications } from "../../../shared/notifications/infrastructure/ui/views/Notifications";
|
|
5
5
|
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const App = ({ customerId, menu, children }) => (React.createElement(SafeAreaProvider, null,
|
|
9
|
-
React.createElement(Header, { customerId: customerId, menu: menu, style: style.header }),
|
|
6
|
+
import { Navigation } from "./navigation/Navigation";
|
|
7
|
+
const App = ({ customerId, menu, tabBar, children }) => (React.createElement(SafeAreaProvider, null,
|
|
10
8
|
React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
|
|
11
|
-
React.createElement(
|
|
9
|
+
React.createElement(Navigation, { customerId: customerId, menu: menu, tabBar: tabBar },
|
|
10
|
+
React.createElement(PortalProvider, null, children))));
|
|
12
11
|
export { App };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
-
import { Country } from "../../../../projection/shared/country";
|
|
3
2
|
interface CheckoutProps {
|
|
4
3
|
readonly children?: ReactNode;
|
|
5
4
|
readonly customerId: string;
|
|
6
|
-
readonly country: Country;
|
|
7
5
|
readonly useRedirect: () => Record<string, string>;
|
|
8
6
|
}
|
|
9
7
|
declare const Checkout: FC<CheckoutProps>;
|
|
@@ -14,12 +14,12 @@ import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollVie
|
|
|
14
14
|
import { I18nMessages } from "../../i18n/i18n";
|
|
15
15
|
import { Routes } from "../../routing/routes";
|
|
16
16
|
import { useBasePath } from "../../routing/useBasePath";
|
|
17
|
-
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
17
|
+
import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
18
18
|
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,
|
|
22
|
+
const Checkout = ({ children, customerId, 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, country, 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,
|
|
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 })))),
|
|
49
49
|
pricing && (React.createElement(View, { style: style.pricingContainer },
|
|
50
50
|
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount,
|
|
51
51
|
// busy={submitCheckoutStatus === "loading"}
|
|
@@ -8,7 +8,7 @@ import { useListCheckoutQuestionsByCheckoutId } from "../../../projection/checko
|
|
|
8
8
|
import { Body } from "../../components/layouts/body/Body";
|
|
9
9
|
import { CheckoutQuestionFeedbackProvider } from "../../components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionFeedback";
|
|
10
10
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
11
|
-
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
11
|
+
import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
12
12
|
import { style } from "./Feedback.style";
|
|
13
13
|
import { CheckoutQuestionsForm } from "./components/checkoutQuestionsForm/CheckoutQuestionsForm";
|
|
14
14
|
const Feedback = ({ customerId }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback, useState } from "react";
|
|
4
|
-
import { View } from "react-native";
|
|
4
|
+
import { Platform, StatusBar, View } from "react-native";
|
|
5
5
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
6
6
|
import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
|
|
7
7
|
import { ButtonIcon } from "../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
@@ -65,7 +65,6 @@ const Header = ({ customerId, menu: Menu, style: customStyle }) => {
|
|
|
65
65
|
const itemRouteMatch = useMatch(`${basePath}/${Routes.ITEM}`);
|
|
66
66
|
const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
|
|
67
67
|
const checkoutRouteMatch = useMatch(`${basePath}/${Routes.CHECKOUT}`);
|
|
68
|
-
const checkoutPaymentRouteMatch = useMatch(`${basePath}/${Routes.CHECKOUT}/${Routes.CHECKOUT_PAYMENT}`);
|
|
69
68
|
const [menuVisible, setMenuVisible] = useState(false);
|
|
70
69
|
const handleOnOpenMenu = useCallback(() => setMenuVisible(true), []);
|
|
71
70
|
const handleOnCloseMenu = useCallback(() => setMenuVisible(false), []);
|
|
@@ -78,14 +77,14 @@ const Header = ({ customerId, menu: Menu, style: customStyle }) => {
|
|
|
78
77
|
header = React.createElement(ItemDetailHeader, null);
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
else if (checkoutRouteMatch
|
|
80
|
+
else if (checkoutRouteMatch) {
|
|
82
81
|
header = React.createElement(CheckoutHeader, null);
|
|
83
82
|
}
|
|
84
83
|
else {
|
|
85
84
|
header = React.createElement(DefaultHeader, { onOpenMenu: handleOnOpenMenu });
|
|
86
85
|
}
|
|
87
86
|
return (React.createElement(React.Fragment, null,
|
|
88
|
-
React.createElement(SafeAreaView, { edges: ["top"], style: [style.container, customStyle] }, header),
|
|
87
|
+
React.createElement(SafeAreaView, { edges: ["top"], style: [style.container, Platform.OS === "android" && { paddingTop: StatusBar.currentHeight }, customStyle] }, header),
|
|
89
88
|
React.createElement(Menu, { isVisible: menuVisible, onClose: handleOnCloseMenu })));
|
|
90
89
|
};
|
|
91
90
|
export { Header };
|
|
@@ -6,6 +6,7 @@ declare const style: {
|
|
|
6
6
|
width: number;
|
|
7
7
|
};
|
|
8
8
|
container: {
|
|
9
|
+
backgroundColor: string;
|
|
9
10
|
flexDirection: "row";
|
|
10
11
|
flexGrow: number;
|
|
11
12
|
height: number;
|
|
@@ -13,7 +14,6 @@ declare const style: {
|
|
|
13
14
|
};
|
|
14
15
|
header: {
|
|
15
16
|
alignItems: "center";
|
|
16
|
-
backgroundColor: string;
|
|
17
17
|
flexDirection: "row";
|
|
18
18
|
flexGrow: number;
|
|
19
19
|
flexWrap: "nowrap";
|
|
@@ -9,6 +9,7 @@ const style = StyleSheet.create({
|
|
|
9
9
|
width: spaceXXL,
|
|
10
10
|
},
|
|
11
11
|
container: {
|
|
12
|
+
backgroundColor: colorBase,
|
|
12
13
|
flexDirection: "row",
|
|
13
14
|
flexGrow: 0,
|
|
14
15
|
height: HEADER_HEIGHT,
|
|
@@ -16,7 +17,6 @@ const style = StyleSheet.create({
|
|
|
16
17
|
},
|
|
17
18
|
header: {
|
|
18
19
|
alignItems: "center",
|
|
19
|
-
backgroundColor: colorBase,
|
|
20
20
|
flexDirection: "row",
|
|
21
21
|
flexGrow: 0,
|
|
22
22
|
flexWrap: "nowrap",
|
|
@@ -11,7 +11,7 @@ import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checko
|
|
|
11
11
|
import { Body } from "../../components/layouts/body/Body";
|
|
12
12
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
13
13
|
import { I18nMessages } from "../../i18n/i18n";
|
|
14
|
-
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
14
|
+
import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
15
15
|
import { style } from "./Intro.style";
|
|
16
16
|
const Bullet = ({ text }) => (React.createElement(View, { style: style.bullet },
|
|
17
17
|
React.createElement(Icon, { name: "rounded-tick", style: style.tickIcon }),
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
3
|
-
import { Country } from "../../../../projection/shared/country";
|
|
4
3
|
interface ItemProps {
|
|
5
4
|
readonly customerId: string;
|
|
6
|
-
readonly country: Country;
|
|
7
5
|
}
|
|
8
6
|
declare const Item: FC<ItemProps>;
|
|
9
7
|
export { Item };
|
|
@@ -18,7 +18,7 @@ import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollVie
|
|
|
18
18
|
import { Routes } from "../../routing/routes";
|
|
19
19
|
import { useBasePath } from "../../routing/useBasePath";
|
|
20
20
|
import { theme } from "../../theme/theme";
|
|
21
|
-
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
21
|
+
import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
22
22
|
import { style } from "./Item.style";
|
|
23
23
|
import { CustomerDecissionBanner } from "./components/banner/CustomerDecissionBanner";
|
|
24
24
|
import { ItemActions } from "./components/itemActions/ItemActions";
|
|
@@ -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 }) => {
|
|
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, 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, footer: !customerDecissionMade && (React.createElement(ItemActions, {
|
|
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 })) },
|
|
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,
|
|
145
|
+
React.createElement(ProductVariantDescription, { brand: brand, color: color, 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,
|
|
148
|
+
React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions || [], visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
|
|
149
149
|
};
|
|
150
150
|
export { Item };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
|
|
3
|
-
import { Country } from "../../../../../../projection/shared/country";
|
|
4
3
|
import { Layout } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
|
|
5
4
|
interface ItemActionsProps {
|
|
6
5
|
readonly productVariants: ProductVariantProjection[];
|
|
@@ -8,7 +7,6 @@ interface ItemActionsProps {
|
|
|
8
7
|
readonly keepButtonLoading?: boolean;
|
|
9
8
|
readonly returnButtonLoading?: boolean;
|
|
10
9
|
readonly sizeSelectorDisabled?: boolean;
|
|
11
|
-
readonly country: Country;
|
|
12
10
|
readonly onSizeSelectorPress?: () => void;
|
|
13
11
|
readonly onKeep: () => void;
|
|
14
12
|
readonly onReturn: () => void;
|
|
@@ -3,20 +3,16 @@ 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";
|
|
7
6
|
import { Sticky } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
|
|
8
7
|
import { SelectField } from "../../../../../../shared/ui/components/molecules/selectField/SelectField";
|
|
9
8
|
import { Body } from "../../../../components/layouts/body/Body";
|
|
10
9
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
11
10
|
import { style } from "./ItemActions.style";
|
|
12
|
-
const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoading = false, returnButtonLoading = false, sizeSelectorDisabled = false,
|
|
11
|
+
const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoading = false, returnButtonLoading = false, sizeSelectorDisabled = false, onSizeSelectorPress = () => void 0, onKeep, onReplace, onReturn, onLayout, }) => {
|
|
13
12
|
const sizeSelectorLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
|
|
14
13
|
const keepButtonText = useI18nMessage({ id: I18nMessages.ITEM_KEEP_BUTTON });
|
|
15
14
|
const returnButtonText = useI18nMessage({ id: I18nMessages.ITEM_RETURN_BUTTON });
|
|
16
|
-
const sizeSelectorOptions = useMemo(() => productVariants.map((productVariant) => ({
|
|
17
|
-
label: size({ size: productVariant.size, country }),
|
|
18
|
-
value: productVariant.id,
|
|
19
|
-
})), [country, productVariants]);
|
|
15
|
+
const sizeSelectorOptions = useMemo(() => productVariants.map((productVariant) => ({ label: productVariant.size.lookiero, value: productVariant.id })), [productVariants]);
|
|
20
16
|
const disabledSizeSelector = useMemo(() => sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === productVariantSelected.id, [sizeSelectorOptions, productVariantSelected.id]);
|
|
21
17
|
const handleOnPressSizeSelector = useCallback(() => onSizeSelectorPress(), [onSizeSelectorPress]);
|
|
22
18
|
return (React.createElement(Sticky, { onLayout: onLayout },
|
|
@@ -2,7 +2,6 @@ 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";
|
|
6
5
|
import { PriceProjection } from "../../../../../../projection/shared/price";
|
|
7
6
|
import { SizeProjection } from "../../../../../../projection/shared/size";
|
|
8
7
|
interface ProductVariantStyle {
|
|
@@ -17,7 +16,6 @@ interface ProductVariantProps {
|
|
|
17
16
|
readonly color: ColorProjection;
|
|
18
17
|
readonly status?: CheckoutItemStatus;
|
|
19
18
|
readonly discarded?: boolean;
|
|
20
|
-
readonly country: Country;
|
|
21
19
|
readonly style?: Partial<ProductVariantStyle>;
|
|
22
20
|
readonly onPress?: () => void;
|
|
23
21
|
}
|
|
@@ -4,7 +4,6 @@ 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";
|
|
8
7
|
import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
9
8
|
import { Price } from "../../../../components/atoms/price/Price";
|
|
10
9
|
import { useMediaImage } from "../../../../hooks/useMediaImage";
|
|
@@ -12,7 +11,7 @@ import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
|
|
|
12
11
|
import { theme } from "../../../../theme/theme";
|
|
13
12
|
import { IMAGE_WIDTH, style } from "./ProductVariant.style";
|
|
14
13
|
const { colorContent } = theme();
|
|
15
|
-
const ProductVariant = ({ media, brand, name, price, size
|
|
14
|
+
const ProductVariant = ({ media, brand, name, price, size, color, status, discarded, style: customStyle, onPress, }) => {
|
|
16
15
|
const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
|
|
17
16
|
const colorLabel = useI18nMessage({ id: color.label, prefix: COLOR_I18N_PREFIX });
|
|
18
17
|
const sizeChangeText = useI18nMessage({ id: I18nMessages.PRODUCT_VARIANT_SIZE_CHANGE });
|
|
@@ -33,7 +32,7 @@ const ProductVariant = ({ media, brand, name, price, size: sizeProjection, color
|
|
|
33
32
|
React.createElement(Text, { level: 2, style: style.brand, detail: true }, brand),
|
|
34
33
|
React.createElement(Text, { level: 2, detail: true }, name),
|
|
35
34
|
React.createElement(Text, { level: 2, style: style.priceAndColor, detail: true },
|
|
36
|
-
|
|
35
|
+
size.unique ? uniqueText : size.lookiero,
|
|
37
36
|
" / ",
|
|
38
37
|
colorLabel),
|
|
39
38
|
status === CheckoutItemStatus.REPLACED && (React.createElement(View, { style: style.sizeChange },
|