@lookiero/checkout 0.5.6 → 0.6.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/README.md +0 -9
- 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/index.d.ts +2 -2
- 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 +4 -2
- package/dist/infrastructure/ui/Root.js +16 -6
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +1 -2
- package/dist/infrastructure/ui/i18n/i18n.d.ts +1 -3
- package/dist/infrastructure/ui/i18n/i18n.js +0 -2
- package/dist/infrastructure/ui/routing/Routing.js +3 -11
- package/dist/infrastructure/ui/views/App.style.d.ts +4 -0
- package/dist/infrastructure/ui/views/App.style.js +16 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.js +5 -5
- 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 +1 -1
- 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.d.ts +15 -0
- package/dist/infrastructure/ui/views/header/Header.js +90 -0
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +35 -0
- package/dist/infrastructure/ui/views/header/Header.style.js +38 -0
- package/dist/infrastructure/ui/views/header/components/Logo.d.ts +7 -0
- package/dist/infrastructure/ui/views/header/components/Logo.js +11 -0
- package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +7 -0
- package/dist/infrastructure/ui/{components/templates/SafeAreaScrollView.style.ts.js → views/header/components/Logo.style.js} +3 -2
- package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/intro/Intro.style.js +3 -0
- package/dist/infrastructure/ui/views/item/Item.js +1 -1
- package/dist/infrastructure/ui/views/item/Item.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/Item.style.js +3 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +0 -1
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +1 -6
- package/dist/infrastructure/ui/views/summary/Summary.js +1 -1
- package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/summary/Summary.style.js +3 -0
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +10 -0
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +1 -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/shared/logging/SentryLogger.d.ts +15 -0
- package/dist/shared/logging/SentryLogger.js +39 -0
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +1 -0
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +9 -0
- package/dist/shared/ui/components/atoms/field/Field.js +5 -13
- package/dist/shared/ui/components/atoms/field/Field.style.js +2 -2
- package/dist/shared/ui/components/molecules/inputField/InputField.js +2 -2
- package/dist/shared/ui/components/molecules/inputField/InputField.style.d.ts +1 -0
- package/dist/shared/ui/components/molecules/inputField/InputField.style.js +1 -0
- package/package.json +9 -13
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +0 -6
- package/dist/infrastructure/ui/views/notFound/NotFound.d.ts +0 -3
- package/dist/infrastructure/ui/views/notFound/NotFound.js +0 -28
- package/dist/infrastructure/ui/views/notFound/NotFound.style.d.ts +0 -16
- package/dist/infrastructure/ui/views/notFound/NotFound.style.js +0 -19
- package/dist/public/images/not-found.png +0 -0
- package/dist/shared/tracking/infrastructure/useEmitUserEvent.d.ts +0 -6
- package/dist/shared/tracking/infrastructure/useEmitUserEvent.js +0 -7
- package/dist/shared/tracking/infrastructure/usePageView.d.ts +0 -13
- package/dist/shared/tracking/infrastructure/usePageView.js +0 -20
- package/dist/shared/tracking/tracking.d.ts +0 -23
- package/dist/shared/tracking/tracking.js +0 -14
- package/dist/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +0 -12
- package/dist/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +0 -16
package/README.md
CHANGED
|
@@ -26,15 +26,6 @@ Once we can replace the build of Jenkins for NPM one, we are going to be able to
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
28
|
(...)
|
|
29
|
-
"scripts": {
|
|
30
|
-
(...)
|
|
31
|
-
// Remove
|
|
32
|
-
"build": "tsc -b tsconfig.build.json && cp -R ./src/public/ ./dist/public",
|
|
33
|
-
// Add
|
|
34
|
-
"build": "tsc -b tsconfig.build.json && npm run copy:assets",
|
|
35
|
-
"copy:assets": "cp -R ./src/public/ ./dist/public",
|
|
36
|
-
(...)
|
|
37
|
-
},
|
|
38
29
|
"dependencies": {
|
|
39
30
|
(...)
|
|
40
31
|
"@expo/dev-server": "0.1.120",
|
|
@@ -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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EndpointFunction } from "@lookiero/i18n";
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentType } from "react";
|
|
3
3
|
import { RootProps } from "./infrastructure/ui/Root";
|
|
4
4
|
import { IsCheckoutAccessibleByCustomerIdProjection } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
5
5
|
interface IsCheckoutAccessibleFunctionArgs {
|
|
@@ -14,7 +14,7 @@ interface BootstrapFunctionArgs {
|
|
|
14
14
|
readonly translations: EndpointFunction;
|
|
15
15
|
}
|
|
16
16
|
interface BootstrapFunctionReturn {
|
|
17
|
-
readonly Root:
|
|
17
|
+
readonly Root: ComponentType<RootProps>;
|
|
18
18
|
readonly isCheckoutAccessible: IsCheckoutAccessibleFunction;
|
|
19
19
|
}
|
|
20
20
|
interface BootstrapFunction {
|
|
@@ -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,16 +1,18 @@
|
|
|
1
1
|
import { I18n } from "@lookiero/i18n-react";
|
|
2
2
|
import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
|
|
3
|
-
import {
|
|
3
|
+
import { ComponentType } from "react";
|
|
4
4
|
import { Customer } from "../../projection/shared/customer";
|
|
5
|
+
import { SentryLoggerFunctionArgs } from "../../shared/logging/SentryLogger";
|
|
5
6
|
import { Menu, TabBar } from "./views/navigation/Navigation";
|
|
6
7
|
interface RootFunctionArgs {
|
|
7
8
|
readonly Messaging: MessagingRoot;
|
|
8
9
|
readonly I18n: I18n;
|
|
9
10
|
readonly development?: boolean;
|
|
11
|
+
readonly sentry?: SentryLoggerFunctionArgs;
|
|
10
12
|
readonly getAuthToken: () => Promise<string>;
|
|
11
13
|
}
|
|
12
14
|
interface RootFunction {
|
|
13
|
-
(args: RootFunctionArgs):
|
|
15
|
+
(args: RootFunctionArgs): ComponentType<RootProps>;
|
|
14
16
|
}
|
|
15
17
|
interface RootProps {
|
|
16
18
|
readonly basePath: string;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
+
import { sentryLogger } from "../../shared/logging/SentryLogger";
|
|
3
4
|
import { Routing } from "./routing/Routing";
|
|
4
|
-
const root = ({ Messaging, I18n, getAuthToken, development }) =>
|
|
5
|
-
// eslint-disable-next-line react/display-name, react/prop-types
|
|
6
|
-
({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
|
|
6
|
+
// eslint-disable-next-line react/display-name, react/prop-types
|
|
7
|
+
const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect }) => {
|
|
8
|
+
const handleOnI18nError = useCallback(() => void 0, []);
|
|
9
|
+
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
10
|
+
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 })));
|
|
11
|
+
};
|
|
12
|
+
return sentry
|
|
13
|
+
? sentryLogger({
|
|
14
|
+
publicKey: sentry.publicKey,
|
|
15
|
+
environment: sentry.environment,
|
|
16
|
+
release: sentry.release,
|
|
17
|
+
project: sentry.project,
|
|
18
|
+
})(Root)
|
|
19
|
+
: Root;
|
|
10
20
|
};
|
|
11
21
|
export { root };
|
|
@@ -2,11 +2,10 @@ 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";
|
|
6
5
|
const { spaceXXXL } = theme();
|
|
7
6
|
const SafeAreaScrollView = ({ children, footer, edges = ["top", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
|
|
8
7
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
9
|
-
return (React.createElement(SafeAreaView, { edges: edges, style:
|
|
8
|
+
return (React.createElement(SafeAreaView, { edges: edges, style: customStyle?.safeAreaView },
|
|
10
9
|
React.createElement(ScrollView, { contentContainerStyle: [
|
|
11
10
|
{
|
|
12
11
|
paddingTop: safeAreaInsetTop + scrollerPaddingTop,
|
|
@@ -58,8 +58,6 @@ 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"
|
|
62
|
-
NOT_FOUND_DESCRIPTION = "not_found.description",
|
|
63
|
-
NOT_FOUND_BUTTON = "not_found.button"
|
|
61
|
+
CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired"
|
|
64
62
|
}
|
|
65
63
|
export { I18nMessages, COLOR_I18N_PREFIX };
|
|
@@ -60,7 +60,5 @@ 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";
|
|
65
63
|
})(I18nMessages || (I18nMessages = {}));
|
|
66
64
|
export { I18nMessages, COLOR_I18N_PREFIX };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PaymentsQueryProvider } from "@lookiero/payments-front";
|
|
2
1
|
import React, { lazy, Suspense } from "react";
|
|
3
2
|
import { Navigate, Outlet, useRoutes } from "react-router-native";
|
|
4
3
|
import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
|
|
@@ -13,7 +12,6 @@ const Item = lazy(() => import("../views/item/Item").then((module) => ({ default
|
|
|
13
12
|
const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
|
|
14
13
|
const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
|
|
15
14
|
const Feedback = lazy(() => import("../views/feedback/Feedback").then((module) => ({ default: module.Feedback })));
|
|
16
|
-
const NotFound = lazy(() => import("../views/notFound/NotFound").then((module) => ({ default: module.NotFound })));
|
|
17
15
|
const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, }) => {
|
|
18
16
|
const routes = useRoutes([
|
|
19
17
|
{
|
|
@@ -48,9 +46,8 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
|
|
|
48
46
|
{
|
|
49
47
|
path: Routes.CHECKOUT,
|
|
50
48
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
51
|
-
React.createElement(
|
|
52
|
-
React.createElement(
|
|
53
|
-
React.createElement(Outlet, null))))),
|
|
49
|
+
React.createElement(Checkout, { country: customer?.country, customerId: customer?.customerId, useRedirect: useRedirect },
|
|
50
|
+
React.createElement(Outlet, null)))),
|
|
54
51
|
children: [
|
|
55
52
|
{
|
|
56
53
|
path: Routes.CHECKOUT_PAYMENT,
|
|
@@ -63,14 +60,9 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
|
|
|
63
60
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
64
61
|
React.createElement(Feedback, { customerId: customer?.customerId }))),
|
|
65
62
|
},
|
|
66
|
-
{
|
|
67
|
-
path: Routes.NOT_FOUND,
|
|
68
|
-
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
69
|
-
React.createElement(NotFound, null))),
|
|
70
|
-
},
|
|
71
63
|
{
|
|
72
64
|
path: "*",
|
|
73
|
-
element: React.createElement(Navigate, { to: `${Routes.
|
|
65
|
+
element: React.createElement(Navigate, { to: `${Routes.HOME}`, replace: true }),
|
|
74
66
|
},
|
|
75
67
|
],
|
|
76
68
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Platform, StyleSheet } from "react-native";
|
|
2
|
+
const style = StyleSheet.create({
|
|
3
|
+
header: {
|
|
4
|
+
...Platform.select({
|
|
5
|
+
web: {
|
|
6
|
+
position: "fixed",
|
|
7
|
+
zIndex: 1,
|
|
8
|
+
},
|
|
9
|
+
native: {
|
|
10
|
+
position: "absolute",
|
|
11
|
+
zIndex: 1,
|
|
12
|
+
},
|
|
13
|
+
}),
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export { style };
|
|
@@ -38,18 +38,18 @@ const Checkout = ({ children, customerId, country, useRedirect }) => {
|
|
|
38
38
|
if (!dependenciesLoaded)
|
|
39
39
|
return React.createElement(Spinner, null);
|
|
40
40
|
return (React.createElement(React.Fragment, null,
|
|
41
|
-
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
|
|
41
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, 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, country: country, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price,
|
|
49
|
-
? checkoutItem.replacedFor.size
|
|
50
|
-
: checkoutItem.productVariant.size })))),
|
|
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 })))),
|
|
51
49
|
pricing && (React.createElement(View, { style: style.pricingContainer },
|
|
52
|
-
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount,
|
|
50
|
+
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount,
|
|
51
|
+
// busy={submitCheckoutStatus === "loading"}
|
|
52
|
+
collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage, orderTotal: pricing.orderTotal, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onSubmit: handleOnSubmit }))))),
|
|
53
53
|
children));
|
|
54
54
|
};
|
|
55
55
|
export { Checkout };
|
|
@@ -30,7 +30,7 @@ const Feedback = ({ customerId }) => {
|
|
|
30
30
|
if (!dependenciesLoaded)
|
|
31
31
|
return React.createElement(Spinner, null);
|
|
32
32
|
return (React.createElement(CheckoutQuestionFeedbackProvider, { feedback: {} },
|
|
33
|
-
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
|
|
33
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, 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
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface MenuProps {
|
|
4
|
+
readonly isVisible: boolean;
|
|
5
|
+
readonly onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
type Menu = FC<MenuProps>;
|
|
8
|
+
interface HeaderProps {
|
|
9
|
+
readonly customerId: string;
|
|
10
|
+
readonly menu: Menu;
|
|
11
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
12
|
+
}
|
|
13
|
+
declare const Header: FC<HeaderProps>;
|
|
14
|
+
export type { Menu };
|
|
15
|
+
export { Header };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
+
import React, { useCallback, useState } from "react";
|
|
4
|
+
import { Platform, StatusBar, View } from "react-native";
|
|
5
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
6
|
+
import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
|
|
7
|
+
import { ButtonIcon } from "../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
8
|
+
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
9
|
+
import { I18nMessages } from "../../i18n/i18n";
|
|
10
|
+
import { Routes } from "../../routing/routes";
|
|
11
|
+
import { useBasePath } from "../../routing/useBasePath";
|
|
12
|
+
import { style } from "./Header.style";
|
|
13
|
+
import { Logo } from "./components/Logo";
|
|
14
|
+
const ButtonIconPlaceholder = () => React.createElement(View, { style: style.buttonIconPlaceholder });
|
|
15
|
+
const DefaultHeader = ({ onOpenMenu }) => (React.createElement(View, { style: style.header, testID: "default-header" },
|
|
16
|
+
React.createElement(Logo, { style: style.logo }),
|
|
17
|
+
React.createElement(ButtonIconPlaceholder, null),
|
|
18
|
+
React.createElement(ButtonIcon, { name: "menu", onPress: onOpenMenu })));
|
|
19
|
+
const ItemHeader = ({ items, item }) => {
|
|
20
|
+
const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
21
|
+
const itemIndex = items.indexOf(item);
|
|
22
|
+
const isFirstItem = itemIndex === 0;
|
|
23
|
+
const isLastItem = itemIndex === items.length - 1;
|
|
24
|
+
const basePath = useBasePath();
|
|
25
|
+
const navigate = useNavigate();
|
|
26
|
+
const navigateToPreviousItem = useCallback(() => {
|
|
27
|
+
const previousItemIndex = itemIndex === 0 ? items.length - 1 : itemIndex - 1;
|
|
28
|
+
const previousItem = items[previousItemIndex];
|
|
29
|
+
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: previousItem.id }));
|
|
30
|
+
}, [basePath, itemIndex, items, navigate]);
|
|
31
|
+
const navigateToNextItem = useCallback(() => {
|
|
32
|
+
const nextItemIndex = itemIndex === items.length - 1 ? 0 : itemIndex + 1;
|
|
33
|
+
const nextItem = items[nextItemIndex];
|
|
34
|
+
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: nextItem.id }));
|
|
35
|
+
}, [basePath, itemIndex, items, navigate]);
|
|
36
|
+
return (React.createElement(View, { style: style.header, testID: "item-header" },
|
|
37
|
+
!isFirstItem ? React.createElement(ButtonIcon, { name: "arrow-left", onPress: navigateToPreviousItem }) : React.createElement(ButtonIconPlaceholder, null),
|
|
38
|
+
React.createElement(Text, { level: 3, style: style.title, detail: true }, title),
|
|
39
|
+
!isLastItem ? React.createElement(ButtonIcon, { name: "arrow-right", onPress: navigateToNextItem }) : React.createElement(ButtonIconPlaceholder, null)));
|
|
40
|
+
};
|
|
41
|
+
const ItemDetailHeader = () => {
|
|
42
|
+
const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
43
|
+
const navigate = useNavigate();
|
|
44
|
+
const handleOnBack = useCallback(() => navigate(-1), [navigate]);
|
|
45
|
+
return (React.createElement(View, { style: style.header, testID: "item-detail-header" },
|
|
46
|
+
React.createElement(ButtonIconPlaceholder, null),
|
|
47
|
+
React.createElement(Text, { level: 3, style: style.title, detail: true }, title),
|
|
48
|
+
React.createElement(ButtonIcon, { name: "close", onPress: handleOnBack })));
|
|
49
|
+
};
|
|
50
|
+
const CheckoutHeader = () => {
|
|
51
|
+
const title = useI18nMessage({ id: I18nMessages.HEADER_COMPLETE_CHECKOUT_TITLE });
|
|
52
|
+
const basePath = useBasePath();
|
|
53
|
+
const navigate = useNavigate();
|
|
54
|
+
const handleOnBack = useCallback(() => navigate(`${basePath}/${Routes.SUMMARY}`), [basePath, navigate]);
|
|
55
|
+
return (React.createElement(View, { style: style.header, testID: "checkout-header" },
|
|
56
|
+
React.createElement(ButtonIcon, { name: "arrow-left", onPress: handleOnBack }),
|
|
57
|
+
React.createElement(Text, { level: 3, style: style.title, detail: true }, title),
|
|
58
|
+
React.createElement(ButtonIconPlaceholder, null)));
|
|
59
|
+
};
|
|
60
|
+
const Header = ({ customerId, menu: Menu, style: customStyle }) => {
|
|
61
|
+
const { id: itemId } = useParams();
|
|
62
|
+
const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
63
|
+
const currentItem = checkout?.items.find((item) => item.id === itemId);
|
|
64
|
+
const basePath = useBasePath();
|
|
65
|
+
const itemRouteMatch = useMatch(`${basePath}/${Routes.ITEM}`);
|
|
66
|
+
const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
|
|
67
|
+
const checkoutRouteMatch = useMatch(`${basePath}/${Routes.CHECKOUT}`);
|
|
68
|
+
const [menuVisible, setMenuVisible] = useState(false);
|
|
69
|
+
const handleOnOpenMenu = useCallback(() => setMenuVisible(true), []);
|
|
70
|
+
const handleOnCloseMenu = useCallback(() => setMenuVisible(false), []);
|
|
71
|
+
let header;
|
|
72
|
+
if (checkout?.items && currentItem) {
|
|
73
|
+
if (itemRouteMatch) {
|
|
74
|
+
header = React.createElement(ItemHeader, { item: currentItem, items: checkout.items });
|
|
75
|
+
}
|
|
76
|
+
else if (itemDetailRouteMatch) {
|
|
77
|
+
header = React.createElement(ItemDetailHeader, null);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (checkoutRouteMatch) {
|
|
81
|
+
header = React.createElement(CheckoutHeader, null);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
header = React.createElement(DefaultHeader, { onOpenMenu: handleOnOpenMenu });
|
|
85
|
+
}
|
|
86
|
+
return (React.createElement(React.Fragment, null,
|
|
87
|
+
React.createElement(SafeAreaView, { edges: ["top"], style: [style.container, Platform.OS === "android" && { paddingTop: StatusBar.currentHeight }, customStyle] }, header),
|
|
88
|
+
React.createElement(Menu, { isVisible: menuVisible, onClose: handleOnCloseMenu })));
|
|
89
|
+
};
|
|
90
|
+
export { Header };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const HEADER_HEIGHT: number;
|
|
2
|
+
declare const style: {
|
|
3
|
+
buttonIconPlaceholder: {
|
|
4
|
+
flexGrow: number;
|
|
5
|
+
height: number;
|
|
6
|
+
width: number;
|
|
7
|
+
};
|
|
8
|
+
container: {
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
flexDirection: "row";
|
|
11
|
+
flexGrow: number;
|
|
12
|
+
height: number;
|
|
13
|
+
width: string;
|
|
14
|
+
};
|
|
15
|
+
header: {
|
|
16
|
+
alignItems: "center";
|
|
17
|
+
flexDirection: "row";
|
|
18
|
+
flexGrow: number;
|
|
19
|
+
flexWrap: "nowrap";
|
|
20
|
+
height: number;
|
|
21
|
+
justifyContent: "space-between";
|
|
22
|
+
overflow: "visible";
|
|
23
|
+
paddingHorizontal: number;
|
|
24
|
+
width: string;
|
|
25
|
+
};
|
|
26
|
+
logo: {
|
|
27
|
+
left: number;
|
|
28
|
+
position: "absolute";
|
|
29
|
+
top: number;
|
|
30
|
+
};
|
|
31
|
+
title: {
|
|
32
|
+
textTransform: "uppercase";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export { style, HEADER_HEIGHT };
|