@lookiero/checkout 0.4.10 → 0.5.0-beta.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/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 +4 -4
- package/dist/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
- package/dist/infrastructure/ui/views/feedback/Feedback.js +2 -2
- package/dist/infrastructure/ui/views/feedback/Feedback.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/feedback/Feedback.style.js +3 -0
- 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 +3 -3
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +4 -1
- package/dist/infrastructure/ui/views/intro/Intro.style.js +4 -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/Item.style.d.ts +1 -0
- package/dist/infrastructure/ui/views/item/Item.style.js +1 -0
- 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";
|
|
18
17
|
import { ProductVariant } from "../item/components/productVariant/ProductVariant";
|
|
18
|
+
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,
|
|
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 });
|
|
@@ -38,14 +38,14 @@ 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, style: { safeAreaView: style.container } },
|
|
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,
|
|
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 }) => {
|
|
@@ -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, style: { safeAreaView: style.container } },
|
|
34
34
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
35
35
|
React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit })))));
|
|
36
36
|
};
|
|
@@ -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 }),
|
|
@@ -30,9 +30,9 @@ 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, style: { safeAreaView: style.container } },
|
|
34
34
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
35
|
-
React.createElement(View, { style: style.
|
|
35
|
+
React.createElement(View, { style: style.intro },
|
|
36
36
|
React.createElement(View, { style: style.content },
|
|
37
37
|
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
38
38
|
React.createElement(Text, { level: 3, style: style.subtitle, body: true }, subTitleText),
|
|
@@ -9,7 +9,6 @@ declare const style: {
|
|
|
9
9
|
};
|
|
10
10
|
container: {
|
|
11
11
|
flex: number;
|
|
12
|
-
justifyContent: "space-between";
|
|
13
12
|
};
|
|
14
13
|
content: {
|
|
15
14
|
alignItems: "center";
|
|
@@ -34,6 +33,10 @@ declare const style: {
|
|
|
34
33
|
textAlign: "center";
|
|
35
34
|
width: string;
|
|
36
35
|
};
|
|
36
|
+
intro: {
|
|
37
|
+
flex: number;
|
|
38
|
+
justifyContent: "space-between";
|
|
39
|
+
};
|
|
37
40
|
percentage: {
|
|
38
41
|
marginLeft: number;
|
|
39
42
|
};
|
|
@@ -12,7 +12,6 @@ const style = StyleSheet.create({
|
|
|
12
12
|
},
|
|
13
13
|
container: {
|
|
14
14
|
flex: 1,
|
|
15
|
-
justifyContent: "space-between",
|
|
16
15
|
},
|
|
17
16
|
content: {
|
|
18
17
|
alignItems: "center",
|
|
@@ -37,6 +36,10 @@ const style = StyleSheet.create({
|
|
|
37
36
|
textAlign: "center",
|
|
38
37
|
width: "100%",
|
|
39
38
|
},
|
|
39
|
+
intro: {
|
|
40
|
+
flex: 1,
|
|
41
|
+
justifyContent: "space-between",
|
|
42
|
+
},
|
|
40
43
|
percentage: {
|
|
41
44
|
marginLeft: spaceXS,
|
|
42
45
|
},
|
|
@@ -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 };
|