@lookiero/checkout 0.4.0-beta.2 → 0.4.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/model/checkout.d.ts +3 -2
- package/dist/domain/checkout/model/checkout.js +1 -1
- package/dist/domain/checkoutBooking/command/blockCheckoutBooking.d.ts +13 -0
- package/dist/domain/checkoutBooking/command/blockCheckoutBooking.js +4 -0
- package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +5 -1
- package/dist/domain/checkoutBooking/model/checkoutBooking.js +17 -1
- package/dist/domain/checkoutBooking/model/checkoutBookingBlocked.d.ts +13 -0
- package/dist/domain/checkoutBooking/model/checkoutBookingBlocked.js +4 -0
- package/dist/domain/checkoutBooking/model/checkoutBookingExpired.d.ts +13 -0
- package/dist/domain/checkoutBooking/model/checkoutBookingExpired.js +4 -0
- package/dist/domain/checkoutItem/command/replaceCheckoutItem.d.ts +1 -1
- package/dist/domain/checkoutItem/model/checkoutItem.d.ts +1 -1
- package/dist/domain/checkoutItem/model/checkoutItem.js +2 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -4
- package/dist/infrastructure/delivery/baseBootstrap.d.ts +2 -0
- package/dist/infrastructure/delivery/baseBootstrap.js +8 -2
- package/dist/infrastructure/delivery/bootstrap.d.ts +1 -1
- package/dist/infrastructure/delivery/bootstrap.js +5 -3
- package/dist/infrastructure/delivery/http/fetchHttpClient.d.ts +1 -1
- package/dist/infrastructure/delivery/http/fetchHttpClient.js +4 -4
- package/dist/infrastructure/delivery/mock/dataSourceCheckoutBookings.js +5 -1
- package/dist/infrastructure/delivery/mock/dataSourceCheckoutItems.js +2 -0
- package/dist/infrastructure/delivery/mock/dataSourceCheckouts.js +2 -2
- package/dist/infrastructure/domain/checkout/model/httpCheckouts.js +1 -1
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +1 -1
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +1 -1
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +9 -2
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBlock.d.ts +5 -0
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBlock.js +15 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +13 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +12 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.d.ts +14 -0
- package/dist/infrastructure/domain/checkoutBooking/react/{useBookCheckouBookingForCheckoutItem.js → useBookCheckoutBookingForCheckoutItem.js} +4 -4
- package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItems.js +1 -1
- package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsReplace.js +2 -2
- package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.d.ts +1 -1
- package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.js +2 -2
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +1 -1
- package/dist/infrastructure/projection/checkout/checkout.d.ts +1 -1
- package/dist/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +3 -0
- package/dist/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +9 -1
- package/dist/infrastructure/ui/Root.d.ts +1 -1
- package/dist/infrastructure/ui/Root.js +2 -2
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +11 -11
- package/dist/infrastructure/ui/routing/Routing.d.ts +1 -1
- package/dist/infrastructure/ui/routing/Routing.js +2 -2
- package/dist/infrastructure/ui/views/App.style.d.ts +1 -0
- package/dist/infrastructure/ui/views/App.style.js +1 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.d.ts +1 -1
- package/dist/infrastructure/ui/views/checkout/Checkout.js +23 -10
- package/dist/infrastructure/ui/views/feedback/Feedback.js +6 -1
- package/dist/infrastructure/ui/views/item/Item.js +77 -33
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +7 -4
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +2 -2
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -1
- package/dist/projection/checkout/checkout.d.ts +1 -1
- package/dist/projection/checkoutBooking/checkoutBooking.d.ts +2 -0
- package/dist/projection/checkoutItem/checkoutItem.d.ts +1 -1
- package/dist/projection/pricing/pricing.d.ts +3 -3
- package/package.json +1 -1
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
package/dist/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
|
|
2
3
|
import { viewIsCheckoutAccessibleByCustomerId, } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
3
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
|
|
4
6
|
const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
|
|
5
7
|
query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
|
|
6
8
|
contextId: MESSAGING_CONTEXT_ID,
|
|
9
|
+
invalidation: isCheckoutFeedbackGiven,
|
|
7
10
|
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
11
|
});
|
|
9
12
|
export { useViewIsCheckoutAccessibleByCustomerId };
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
|
|
3
|
+
import { CHECKOUT_ITEM_REPLACED, } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
|
|
4
|
+
import { CHECKOUT_ITEM_RETURNED, } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
|
|
2
5
|
import { viewPricingByCheckoutId } from "../../../../projection/pricing/viewPricingByCheckoutId";
|
|
3
6
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
+
const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
|
|
8
|
+
const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
|
|
9
|
+
const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
|
|
10
|
+
const shouldInvalidate = (event) => isCheckoutItemKept(event) || isCheckoutItemReplaced(event) || isCheckoutItemReturned(event);
|
|
4
11
|
const useViewPricingByCheckoutId = ({ checkoutId }) => useQuery({
|
|
5
12
|
query: viewPricingByCheckoutId({ checkoutId }),
|
|
6
13
|
contextId: MESSAGING_CONTEXT_ID,
|
|
7
|
-
|
|
14
|
+
invalidation: shouldInvalidate,
|
|
15
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false, refetchOnMount: "always" },
|
|
8
16
|
});
|
|
9
17
|
export { useViewPricingByCheckoutId };
|
|
@@ -8,7 +8,7 @@ interface RootFunctionArgs {
|
|
|
8
8
|
readonly Notifications: NotificationsRoot;
|
|
9
9
|
readonly I18n: I18n;
|
|
10
10
|
readonly development?: boolean;
|
|
11
|
-
readonly
|
|
11
|
+
readonly getAuthToken: () => Promise<string>;
|
|
12
12
|
}
|
|
13
13
|
interface RootFunction {
|
|
14
14
|
(args: RootFunctionArgs): FC<RootProps>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
3
|
import { Routing } from "./routing/Routing";
|
|
4
|
-
const root = ({ Messaging, I18n, Notifications,
|
|
4
|
+
const root = ({ Messaging, I18n, Notifications, getAuthToken, development }) =>
|
|
5
5
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
6
6
|
({ basePath, locale = "en", customerId, menu, onNotAccessible, useRedirect }) => {
|
|
7
7
|
const handleOnI18nError = useCallback(() => void 0, []);
|
|
8
8
|
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
9
9
|
React.createElement(Notifications, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
10
|
-
React.createElement(Routing, { I18n: I18n,
|
|
10
|
+
React.createElement(Routing, { I18n: I18n, basePath: basePath, customerId: customerId, getAuthToken: getAuthToken, locale: locale, menu: menu, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible }))));
|
|
11
11
|
};
|
|
12
12
|
export { root };
|
|
@@ -12,6 +12,7 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
|
|
|
12
12
|
const basePath = useBasePath();
|
|
13
13
|
const introShown = useRef(false);
|
|
14
14
|
const [shouldIntroBeShown, shouldIntroBeShownStatus] = useShouldIntroBeShown();
|
|
15
|
+
const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
|
|
15
16
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
16
17
|
const firstItemWithoutCustomerDecision = checkout?.items.find((item) => [CheckoutItemStatus.EXPIRED, CheckoutItemStatus.INITIAL].includes(item.status));
|
|
17
18
|
const introRouteMatch = useMatch(`${basePath}/${Routes.INTRO}`);
|
|
@@ -20,24 +21,20 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
|
|
|
20
21
|
const summaryRouteMatch = useMatch(`${basePath}/${Routes.SUMMARY}`);
|
|
21
22
|
const checkoutRouteMatch = useMatch(`${basePath}/${Routes.CHECKOUT}`);
|
|
22
23
|
const feedbackRouteMatch = useMatch(`${basePath}/${Routes.FEEDBACK}`);
|
|
23
|
-
const notFoundRouteMatch = useMatch(`${basePath}/${Routes.NOT_FOUND}`);
|
|
24
24
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
25
25
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(shouldIntroBeShownStatus) &&
|
|
26
|
-
dependenciesLoadedStatuses.includes(checkoutStatus);
|
|
26
|
+
(dependenciesLoadedStatuses.includes(checkoutStatus) || checkout);
|
|
27
27
|
if (!dependenciesLoaded) {
|
|
28
28
|
return loader;
|
|
29
29
|
}
|
|
30
|
-
/* Navigate to NotFound if checkout is completed */
|
|
31
|
-
if (checkout?.status === CheckoutStatus.COMPLETED && !notFoundRouteMatch) {
|
|
32
|
-
return React.createElement(Navigate, { to: `${basePath}/${Routes.NOT_FOUND}`, replace: true });
|
|
33
|
-
}
|
|
34
30
|
/* Navigate to the feedback if checkout is paid */
|
|
35
|
-
if (checkout?.status === CheckoutStatus.PAID && !feedbackRouteMatch) {
|
|
31
|
+
if (checkout?.status === CheckoutStatus.PAID && !(feedbackRouteMatch || checkoutRouteMatch)) {
|
|
36
32
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.FEEDBACK}`, replace: true });
|
|
37
33
|
}
|
|
38
34
|
/* Navigate to the summary if required */
|
|
39
|
-
if (checkout?.status
|
|
40
|
-
checkout?.status
|
|
35
|
+
if ((checkout?.status === CheckoutStatus.AVAILABLE ||
|
|
36
|
+
checkout?.status === CheckoutStatus.STARTED ||
|
|
37
|
+
checkout?.status === CheckoutStatus.NOTIFIED) &&
|
|
41
38
|
firstItemWithoutCustomerDecision === undefined &&
|
|
42
39
|
!(summaryRouteMatch || itemDetailRouteMatch || checkoutRouteMatch)) {
|
|
43
40
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.SUMMARY}`, replace: true });
|
|
@@ -60,8 +57,11 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
|
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
/* Navigate to the first item without customer's decission */
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
navigatedToFirstItemWithoutCustomerDecision.current =
|
|
61
|
+
navigatedToFirstItemWithoutCustomerDecision.current ||
|
|
62
|
+
Boolean(itemRouteMatch && itemRouteMatch.params.id === firstItemWithoutCustomerDecision?.id);
|
|
63
|
+
if (firstItemWithoutCustomerDecision && !navigatedToFirstItemWithoutCustomerDecision.current) {
|
|
64
|
+
navigatedToFirstItemWithoutCustomerDecision.current = true;
|
|
65
65
|
return (React.createElement(Navigate, { to: generatePath(`${basePath}/${Routes.ITEM}`, { id: firstItemWithoutCustomerDecision.id }), replace: true }));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -6,7 +6,7 @@ interface RoutingProps {
|
|
|
6
6
|
readonly customerId: string | undefined;
|
|
7
7
|
readonly locale: string;
|
|
8
8
|
readonly I18n: I18n;
|
|
9
|
-
readonly
|
|
9
|
+
readonly getAuthToken: () => Promise<string>;
|
|
10
10
|
readonly menu: Menu;
|
|
11
11
|
readonly onNotAccessible: () => void;
|
|
12
12
|
readonly onI18nError?: (err: Error) => void;
|
|
@@ -11,7 +11,7 @@ const Item = lazy(() => import("../views/item/Item").then((module) => ({ default
|
|
|
11
11
|
const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
|
|
12
12
|
const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
|
|
13
13
|
const Feedback = lazy(() => import("../views/feedback/Feedback").then((module) => ({ default: module.Feedback })));
|
|
14
|
-
const Routing = ({ basePath = "", customerId, locale, I18n,
|
|
14
|
+
const Routing = ({ basePath = "", customerId, locale, I18n, getAuthToken, menu, onI18nError, onNotAccessible, useRedirect, }) => {
|
|
15
15
|
const routes = useRoutes([
|
|
16
16
|
{
|
|
17
17
|
path: "",
|
|
@@ -45,7 +45,7 @@ const Routing = ({ basePath = "", customerId, locale, I18n, authToken, menu, onI
|
|
|
45
45
|
{
|
|
46
46
|
path: Routes.CHECKOUT,
|
|
47
47
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
48
|
-
React.createElement(Checkout, {
|
|
48
|
+
React.createElement(Checkout, { customerId: customerId, getAuthToken: getAuthToken, useRedirect: useRedirect }))),
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
path: Routes.FEEDBACK,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
interface CheckoutProps {
|
|
3
3
|
readonly customerId: string;
|
|
4
|
-
readonly
|
|
4
|
+
readonly getAuthToken: () => Promise<string>;
|
|
5
5
|
readonly useRedirect: () => Record<string, string>;
|
|
6
6
|
}
|
|
7
7
|
declare const Checkout: FC<CheckoutProps>;
|
|
@@ -3,7 +3,7 @@ import { useI18nMessage } from "@lookiero/i18n-react";
|
|
|
3
3
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
4
4
|
import { PaymentFlow, PaymentInstrumentSelect, PaymentMethod, Section } from "@lookiero/payments-front";
|
|
5
5
|
import { ChargeStatus } from "@lookiero/payments-front/build/infrastructure/CheckoutAPI";
|
|
6
|
-
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { View } from "react-native";
|
|
8
8
|
import { useNavigate } from "react-router-native";
|
|
9
9
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
@@ -24,10 +24,15 @@ import { Pricing } from "../summary/components/pricing/Pricing";
|
|
|
24
24
|
import { style } from "./Checkout.style";
|
|
25
25
|
import { CheckoutSuccessModal } from "./components/checkoutSuccessModal/CheckoutSuccessModal";
|
|
26
26
|
import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
|
|
27
|
-
const Checkout = ({ customerId,
|
|
27
|
+
const Checkout = ({ customerId, getAuthToken, useRedirect }) => {
|
|
28
28
|
const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_TITLE });
|
|
29
29
|
const paymentInstrumentSelectRef = useRef(null);
|
|
30
30
|
const paymentFlowRef = useRef(null);
|
|
31
|
+
const [authToken, setAuthToken] = useState();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const loadAuthToken = async () => setAuthToken(await getAuthToken());
|
|
34
|
+
loadAuthToken();
|
|
35
|
+
}, [getAuthToken]);
|
|
31
36
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
32
37
|
const [pricing, pricingStatus] = useViewPricingByCheckoutId({ checkoutId: checkout?.id });
|
|
33
38
|
const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
|
|
@@ -35,21 +40,21 @@ const Checkout = ({ customerId, authToken, useRedirect }) => {
|
|
|
35
40
|
});
|
|
36
41
|
const [markAsPaid, markAsPaidStatus] = useMarkCheckoutAsPaid({ checkoutId: checkout?.id });
|
|
37
42
|
const [createNotification] = useCreateNotification();
|
|
43
|
+
const [success, setSuccess] = useState(false);
|
|
38
44
|
const [processingCheckout, setProcessingCheckout] = useState(false);
|
|
39
45
|
const navigate = useNavigate();
|
|
40
46
|
const basePath = useBasePath();
|
|
41
47
|
const { returnUrl } = useRedirect();
|
|
42
48
|
const handleOnSubmitCheckout = useCallback(() => {
|
|
43
|
-
console.log("onSubmit checkout");
|
|
44
49
|
if (!paymentFlowRef.current) {
|
|
45
50
|
return;
|
|
46
51
|
}
|
|
47
52
|
setProcessingCheckout(true);
|
|
53
|
+
setSuccess(false);
|
|
48
54
|
paymentFlowRef.current.startLegacyBoxCheckout(
|
|
49
55
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
56
|
// @ts-ignore
|
|
51
|
-
paymentFlowPayload, async ({ status, final
|
|
52
|
-
console.log("Checkout flow event", status, final, rest);
|
|
57
|
+
paymentFlowPayload, async ({ status, final }) => {
|
|
53
58
|
if (status === ChargeStatus.REJECTED) {
|
|
54
59
|
createNotification({ level: NotificationLevel.ERROR, bodyI18nKey: I18nMessages.CHECKOUT_TOAST_REJECTED });
|
|
55
60
|
}
|
|
@@ -57,22 +62,30 @@ const Checkout = ({ customerId, authToken, useRedirect }) => {
|
|
|
57
62
|
createNotification({ level: NotificationLevel.ERROR, bodyI18nKey: I18nMessages.CHECKOUT_TOAST_ERROR });
|
|
58
63
|
}
|
|
59
64
|
else if (status === ChargeStatus.EXECUTED) {
|
|
60
|
-
|
|
65
|
+
try {
|
|
66
|
+
await markAsPaid();
|
|
67
|
+
setSuccess(true);
|
|
68
|
+
}
|
|
69
|
+
catch (e) { }
|
|
61
70
|
}
|
|
62
71
|
if (final) {
|
|
63
72
|
setProcessingCheckout(false);
|
|
64
73
|
}
|
|
65
74
|
});
|
|
66
75
|
}, [createNotification, markAsPaid, paymentFlowPayload]);
|
|
67
|
-
const handleOnSuccessModalDismiss = useCallback(() =>
|
|
76
|
+
const handleOnSuccessModalDismiss = useCallback(() => {
|
|
77
|
+
setSuccess(false);
|
|
78
|
+
navigate(`${basePath}/${Routes.FEEDBACK}`);
|
|
79
|
+
}, [basePath, navigate]);
|
|
68
80
|
const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
69
81
|
const hasReplacedCheckoutItem = useMemo(() => checkout?.items.some((checkoutItem) => checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
70
82
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
71
|
-
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus)
|
|
83
|
+
const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) &&
|
|
84
|
+
dependenciesLoadedStatuses.includes(pricingStatus);
|
|
72
85
|
if (!dependenciesLoaded)
|
|
73
86
|
return React.createElement(Spinner, null);
|
|
74
87
|
return (React.createElement(React.Fragment, null,
|
|
75
|
-
React.createElement(CheckoutSuccessModal, { visible:
|
|
88
|
+
React.createElement(CheckoutSuccessModal, { visible: success, onDismiss: handleOnSuccessModalDismiss }),
|
|
76
89
|
React.createElement(SafeAreaScrollView, null,
|
|
77
90
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
78
91
|
hasReplacedCheckoutItem && (React.createElement(View, { style: style.deliveryBannerContainer },
|
|
@@ -83,6 +96,6 @@ const Checkout = ({ customerId, authToken, useRedirect }) => {
|
|
|
83
96
|
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 })))),
|
|
84
97
|
pricing && (React.createElement(View, { style: style.pricingContainer },
|
|
85
98
|
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, busy: processingCheckout || markAsPaidStatus === CommandStatus.LOADING, collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage, orderTotal: pricing.orderTotal, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onSubmit: handleOnSubmitCheckout }))))),
|
|
86
|
-
React.createElement(PaymentFlow, { ref: paymentFlowRef, token: authToken })));
|
|
99
|
+
authToken && React.createElement(PaymentFlow, { ref: paymentFlowRef, token: authToken })));
|
|
87
100
|
};
|
|
88
101
|
export { Checkout };
|
|
@@ -17,7 +17,12 @@ const Feedback = ({ customerId }) => {
|
|
|
17
17
|
const [giveCheckoutFeedback, giveCheckoutFeedbackStatus] = useGiveCheckoutFeedback({
|
|
18
18
|
checkoutId: checkout?.id,
|
|
19
19
|
});
|
|
20
|
-
const handleOnSubmit = useCallback((feedbacks) =>
|
|
20
|
+
const handleOnSubmit = useCallback(async (feedbacks) => {
|
|
21
|
+
try {
|
|
22
|
+
await giveCheckoutFeedback({ feedbacks });
|
|
23
|
+
}
|
|
24
|
+
catch (e) { }
|
|
25
|
+
}, [giveCheckoutFeedback]);
|
|
21
26
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
22
27
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus) && dependenciesLoadedStatuses.includes(checkoutQuestionsStatus);
|
|
23
28
|
if (!dependenciesLoaded)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
|
-
import { useParams } from "react-router-native";
|
|
4
|
+
import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
6
|
import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
7
7
|
import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
|
|
8
|
-
import {
|
|
8
|
+
import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
|
|
9
9
|
import { useKeepCheckoutItem } from "../../../domain/checkoutItem/react/useKeepCheckoutItem";
|
|
10
10
|
import { useReplaceCheckoutItem } from "../../../domain/checkoutItem/react/useReplaceCheckoutItem";
|
|
11
11
|
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
@@ -15,6 +15,8 @@ import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/retu
|
|
|
15
15
|
import { Body } from "../../components/layouts/body/Body";
|
|
16
16
|
import { ReturnQuestionFeedbackProvider } from "../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
|
|
17
17
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
18
|
+
import { Routes } from "../../routing/routes";
|
|
19
|
+
import { useBasePath } from "../../routing/useBasePath";
|
|
18
20
|
import { style } from "./Item.style";
|
|
19
21
|
import { CustomerDecissionBanner } from "./components/banner/CustomerDecissionBanner";
|
|
20
22
|
import { ItemActions } from "./components/itemActions/ItemActions";
|
|
@@ -28,60 +30,102 @@ const Item = ({ customerId }) => {
|
|
|
28
30
|
const { id } = useParams();
|
|
29
31
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
30
32
|
const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
+
const basePath = useBasePath();
|
|
34
|
+
const itemRouteMatch = useMatch(`${basePath}/${Routes.ITEM}`);
|
|
35
|
+
const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
|
|
36
|
+
const navigate = useNavigate();
|
|
37
|
+
const navigateToNextView = useCallback(() => {
|
|
38
|
+
if (itemRouteMatch) {
|
|
39
|
+
const nextItemWithoutCustomerDecision = checkout?.items
|
|
40
|
+
.filter((item) => item.id !== id)
|
|
41
|
+
.find((item) => [CheckoutItemStatus.EXPIRED, CheckoutItemStatus.INITIAL].includes(item.status));
|
|
42
|
+
if (nextItemWithoutCustomerDecision) {
|
|
43
|
+
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: nextItemWithoutCustomerDecision.id }));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (itemDetailRouteMatch) {
|
|
47
|
+
navigate(`${basePath}/${Routes.SUMMARY}`);
|
|
48
|
+
}
|
|
49
|
+
}, [itemRouteMatch, itemDetailRouteMatch, checkout?.items, id, navigate, basePath]);
|
|
50
|
+
const [customerDecissionMade, setCustomerDecissionMade] = useState();
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
setCustomerDecissionMade(checkoutItem.status !== CheckoutItemStatus.INITIAL && checkoutItem.status !== CheckoutItemStatus.EXPIRED);
|
|
53
|
+
}, [checkoutItem.status, id]);
|
|
54
|
+
const handleOnBannerPress = useCallback(() => setCustomerDecissionMade(false), []);
|
|
55
|
+
const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id });
|
|
56
|
+
const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
|
|
57
|
+
checkoutItemId: checkoutItem.id,
|
|
58
|
+
});
|
|
59
|
+
const [replaceCheckoutItem, replaceCheckoutItemStatus] = useReplaceCheckoutItem({
|
|
60
|
+
checkoutItemId: checkoutItem.id,
|
|
61
|
+
});
|
|
33
62
|
const [sizeWithoutStockModalVisible, setSizeWithoutStockModalVisible] = useState(false);
|
|
34
63
|
const handleOnShowSizeWithoutStockModal = useCallback(() => setSizeWithoutStockModalVisible(true), []);
|
|
35
64
|
const handleOnHideSizeWithoutStockModal = useCallback(() => setSizeWithoutStockModalVisible(false), []);
|
|
36
65
|
const [sizeChangeModalVisible, setSizeChangeModalVisible] = useState(false);
|
|
37
66
|
const handleOnShowSizeChangeModal = useCallback(() => setSizeChangeModalVisible(true), []);
|
|
38
|
-
const handleOnHideSizeChangeModal = useCallback(() =>
|
|
67
|
+
const handleOnHideSizeChangeModal = useCallback(() => {
|
|
68
|
+
setSizeChangeModalVisible(false);
|
|
69
|
+
if (replaceCheckoutItemStatus === CommandStatus.SUCCESS) {
|
|
70
|
+
navigateToNextView();
|
|
71
|
+
}
|
|
72
|
+
}, [navigateToNextView, replaceCheckoutItemStatus]);
|
|
39
73
|
const [bookedSizeChangeProductsVariants, bookedSizeChangeProductsVariantsStatus] = useViewBookedSizeChangeProductsVariantsForCheckoutItem({
|
|
40
74
|
checkoutItemId: checkoutItem.id,
|
|
41
75
|
});
|
|
42
|
-
const [
|
|
76
|
+
const [bookCheckoutBooking] = useBookCheckoutBookingForCheckoutItem({
|
|
43
77
|
checkoutItemId: checkoutItem.id,
|
|
78
|
+
checkoutBookingId: checkout?.checkoutBookingId,
|
|
44
79
|
});
|
|
45
80
|
useEffect(() => {
|
|
46
|
-
bookedSizeChangeProductsVariants === null &&
|
|
47
|
-
}, [
|
|
81
|
+
checkout && bookedSizeChangeProductsVariants === null && bookCheckoutBooking();
|
|
82
|
+
}, [bookCheckoutBooking, bookedSizeChangeProductsVariants, checkout]);
|
|
48
83
|
const [returnQuestions, returnQuestionsStatus] = useListReturnQuestionsByCheckoutItemId({
|
|
49
84
|
checkoutItemId: checkoutItem.id,
|
|
50
85
|
});
|
|
51
|
-
const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id });
|
|
52
|
-
const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
|
|
53
|
-
checkoutItemId: checkoutItem.id,
|
|
54
|
-
});
|
|
55
|
-
const [replaceCheckoutItem, replaceCheckoutItemStatus] = useReplaceCheckoutItem({
|
|
56
|
-
checkoutItemId: checkoutItem.id,
|
|
57
|
-
});
|
|
58
86
|
const [stickyHeight, setStickyHeight] = useState(0);
|
|
59
87
|
const handleOnStickyLayout = useCallback(({ height }) => setStickyHeight(height), []);
|
|
60
88
|
const [returnQuestionsVisible, setReturnQuestionsVisible] = useState(false);
|
|
61
89
|
const handleOnShowReturnQuestions = useCallback(() => setReturnQuestionsVisible(true), []);
|
|
62
90
|
const handleOnHideReturnQuestions = useCallback(() => setReturnQuestionsVisible(false), []);
|
|
63
91
|
const handleOnEditFeedback = useCallback(() => handleOnShowReturnQuestions(), [handleOnShowReturnQuestions]);
|
|
64
|
-
const handleOnSubmit = useCallback((feedbacks) => {
|
|
92
|
+
const handleOnSubmit = useCallback(async (feedbacks) => {
|
|
65
93
|
handleOnHideReturnQuestions();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
94
|
+
try {
|
|
95
|
+
await returnCheckoutItem({ feedbacks });
|
|
96
|
+
navigateToNextView();
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
// TODO show an error Notification?
|
|
100
|
+
}
|
|
101
|
+
}, [handleOnHideReturnQuestions, navigateToNextView, returnCheckoutItem]);
|
|
102
|
+
const handleOnKeep = useCallback(async () => {
|
|
103
|
+
try {
|
|
104
|
+
await keepCheckoutItem();
|
|
105
|
+
navigateToNextView();
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
// TODO show an error Notification?
|
|
109
|
+
}
|
|
110
|
+
}, [keepCheckoutItem, navigateToNextView]);
|
|
111
|
+
const handleOnReplace = useCallback(async (replacedForId) => {
|
|
112
|
+
try {
|
|
113
|
+
await replaceCheckoutItem({ replacedForId });
|
|
114
|
+
handleOnShowSizeChangeModal();
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
// TODO show an error Notification?
|
|
118
|
+
}
|
|
71
119
|
}, [handleOnShowSizeChangeModal, replaceCheckoutItem]);
|
|
72
120
|
const handleOnReturn = useCallback(() => handleOnShowReturnQuestions(), [handleOnShowReturnQuestions]);
|
|
73
|
-
const productVariantSelected = useMemo(() => checkoutItem.replacedFor
|
|
74
|
-
?
|
|
75
|
-
: { id: checkoutItem.productVariant.id, size: checkoutItem.productVariant.size }, [
|
|
76
|
-
bookedSizeChangeProductsVariants?.productVariants,
|
|
77
|
-
checkoutItem.productVariant.id,
|
|
78
|
-
checkoutItem.productVariant.size,
|
|
79
|
-
checkoutItem.replacedFor,
|
|
80
|
-
]);
|
|
121
|
+
const productVariantSelected = useMemo(() => checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
122
|
+
? { id: checkoutItem.replacedFor.id, size: checkoutItem.replacedFor.size }
|
|
123
|
+
: { id: checkoutItem.productVariant.id, size: checkoutItem.productVariant.size }, [checkoutItem.productVariant.id, checkoutItem.productVariant.size, checkoutItem.replacedFor, checkoutItem.status]);
|
|
81
124
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
82
125
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(returnQuestionsStatus) &&
|
|
83
|
-
dependenciesLoadedStatuses.includes(checkoutStatus) &&
|
|
84
|
-
dependenciesLoadedStatuses.includes(bookedSizeChangeProductsVariantsStatus)
|
|
126
|
+
(dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) &&
|
|
127
|
+
dependenciesLoadedStatuses.includes(bookedSizeChangeProductsVariantsStatus) &&
|
|
128
|
+
bookedSizeChangeProductsVariants;
|
|
85
129
|
if (!dependenciesLoaded)
|
|
86
130
|
return React.createElement(Spinner, null);
|
|
87
131
|
const { price } = checkoutItem;
|
|
@@ -91,14 +135,14 @@ const Item = ({ customerId }) => {
|
|
|
91
135
|
React.createElement(SizeChangeModal, { visible: sizeChangeModalVisible, onDismiss: handleOnHideSizeChangeModal }),
|
|
92
136
|
React.createElement(SafeAreaScrollView, null,
|
|
93
137
|
React.createElement(Body, null,
|
|
94
|
-
|
|
138
|
+
customerDecissionMade && (React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: handleOnBannerPress })),
|
|
95
139
|
React.createElement(View, { style: [style.container, { paddingBottom: stickyHeight }] },
|
|
96
140
|
React.createElement(View, { style: style.sliderContainer },
|
|
97
141
|
React.createElement(ProductVariantSlider, { producVariantMedia: media })),
|
|
98
142
|
React.createElement(ProductVariantDescription, { brand: brand, color: color, name: name, price: price, size: productVariantSelected.size }),
|
|
99
143
|
checkoutItem.status === CheckoutItemStatus.RETURNED && (React.createElement(View, { style: style.feedbackContainer },
|
|
100
144
|
React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions || [], onEditFeedback: handleOnEditFeedback })))))),
|
|
101
|
-
customerDecissionMade && (React.createElement(ItemActions, { keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedSizeChangeProductsVariants?.productVariants || [], returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep:
|
|
145
|
+
!customerDecissionMade && (React.createElement(ItemActions, { keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedSizeChangeProductsVariants?.productVariants || [], returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })),
|
|
102
146
|
React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions || [], visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
|
|
103
147
|
};
|
|
104
148
|
export { Item };
|
package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js
CHANGED
|
@@ -2,12 +2,13 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
|
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
+
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
5
6
|
import { Tabs } from "../../../../components/layouts/tabs/Tabs";
|
|
6
7
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
7
8
|
import { ProductVariant } from "../../../item/components/productVariant/ProductVariant";
|
|
8
9
|
import { style } from "./CheckoutItemsTabs.style";
|
|
9
|
-
const CheckoutItem = ({
|
|
10
|
-
React.createElement(ProductVariant, { brand:
|
|
10
|
+
const CheckoutItem = ({ checkoutItemStatus, checkoutItemProductVariant, checkoutItemPrice, discarded = false, testID, style: customStyle, onPress, }) => (React.createElement(View, { style: style.checkoutItem, testID: testID },
|
|
11
|
+
React.createElement(ProductVariant, { brand: checkoutItemProductVariant.brand, color: checkoutItemProductVariant.color, discarded: discarded, media: checkoutItemProductVariant.media, name: checkoutItemProductVariant.name, price: checkoutItemPrice, size: checkoutItemProductVariant.size, status: checkoutItemStatus, style: customStyle, onPress: onPress })));
|
|
11
12
|
const CheckoutItemsTabs = ({ checkoutItemsKept, checkoutItemsReturned, onPressItem }) => {
|
|
12
13
|
const keepTabText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_TAB });
|
|
13
14
|
const returnTabText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_TAB });
|
|
@@ -15,7 +16,9 @@ const CheckoutItemsTabs = ({ checkoutItemsKept, checkoutItemsReturned, onPressIt
|
|
|
15
16
|
const returnEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_EMPTY });
|
|
16
17
|
const handleOnPressItem = useCallback((checkoutItemId) => onPressItem(checkoutItemId), [onPressItem]);
|
|
17
18
|
return (React.createElement(Tabs, { style: { sliderContainer: style.sliderContainer }, tabLabels: [`${keepTabText} (${checkoutItemsKept.length})`, `${returnTabText} (${checkoutItemsReturned.length})`] },
|
|
18
|
-
React.createElement(React.Fragment, null, checkoutItemsKept.length === 0 ? (React.createElement(Text, null, keepEmptyText)) : (checkoutItemsKept.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItem: checkoutItem, testID: "keep-checkout-item",
|
|
19
|
-
|
|
19
|
+
React.createElement(React.Fragment, null, checkoutItemsKept.length === 0 ? (React.createElement(Text, null, keepEmptyText)) : (checkoutItemsKept.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemStatus: checkoutItem.status, testID: "keep-checkout-item", checkoutItemProductVariant: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
20
|
+
? checkoutItem.replacedFor
|
|
21
|
+
: checkoutItem.productVariant, onPress: () => handleOnPressItem(checkoutItem.id) }))))),
|
|
22
|
+
React.createElement(React.Fragment, null, checkoutItemsReturned.length === 0 ? (React.createElement(Text, null, returnEmptyText)) : (checkoutItemsReturned.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemProductVariant: checkoutItem.productVariant, checkoutItemStatus: checkoutItem.status, style: { image: style.returnCheckoutItem }, testID: "return-checkout-item", discarded: true, onPress: () => handleOnPressItem(checkoutItem.id) })))))));
|
|
20
23
|
};
|
|
21
24
|
export { CheckoutItemsTabs };
|
|
@@ -44,9 +44,9 @@ const Pricing = ({ orderTotal, subtotal, balanceDiscount, discount, discountPerc
|
|
|
44
44
|
React.createElement(Button, { busy: busy, small: true, onPress: onSubmit }, submitButtonText)))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
|
|
45
45
|
React.createElement(Row, { text: `${subtotalText} ${totalCheckoutItemsKeptText}` },
|
|
46
46
|
React.createElement(Price, { price: subtotal, variant: "subtotal" })),
|
|
47
|
-
discount && (React.createElement(Row, { text: discountText },
|
|
47
|
+
discount && discount.amount !== 0 && (React.createElement(Row, { text: discountText },
|
|
48
48
|
React.createElement(Price, { price: discount, variant: "subtotal" }))),
|
|
49
|
-
balanceDiscount && (React.createElement(Row, { text: creditText },
|
|
49
|
+
balanceDiscount && balanceDiscount.amount !== 0 && (React.createElement(Row, { text: creditText },
|
|
50
50
|
React.createElement(Price, { price: balanceDiscount, variant: "subtotal" }))),
|
|
51
51
|
React.createElement(Row, { text: feeText }, isPSServiceFree ? (React.createElement(Text, { level: 3, style: style.uppercase, action: true }, freeText)) : (React.createElement(Price, { price: service.finalPrice, variant: "subtotal" }))),
|
|
52
52
|
React.createElement(View, { style: style.divider }),
|
package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ interface ProductVariantProjection {
|
|
|
4
4
|
readonly size: SizeProjection;
|
|
5
5
|
}
|
|
6
6
|
interface BookedSizeChangeProductsVariantsProjection {
|
|
7
|
-
readonly bookingId: string;
|
|
8
7
|
readonly productVariants: ProductVariantProjection[];
|
|
9
8
|
}
|
|
10
9
|
export type { BookedSizeChangeProductsVariantsProjection, ProductVariantProjection };
|
|
@@ -4,7 +4,7 @@ interface CheckoutProjection {
|
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly customerId: string;
|
|
6
6
|
readonly boxId: string;
|
|
7
|
-
readonly
|
|
7
|
+
readonly checkoutBookingId: string;
|
|
8
8
|
readonly status: CheckoutStatus;
|
|
9
9
|
readonly expiresOn: Date;
|
|
10
10
|
readonly items: CheckoutItemProjection[];
|
|
@@ -37,7 +37,7 @@ interface CheckoutItemProjection {
|
|
|
37
37
|
readonly id: string;
|
|
38
38
|
readonly status: CheckoutItemStatus;
|
|
39
39
|
readonly price: PriceProjection;
|
|
40
|
-
readonly replacedFor
|
|
40
|
+
readonly replacedFor: CheckoutItemProductVariantProjection | null;
|
|
41
41
|
readonly productVariant: CheckoutItemProductVariantProjection;
|
|
42
42
|
readonly feedbacks: FeedbackProjection;
|
|
43
43
|
}
|
|
@@ -9,9 +9,9 @@ interface ServiceProjection {
|
|
|
9
9
|
interface PricingProjection {
|
|
10
10
|
readonly orderTotal: PriceProjection;
|
|
11
11
|
readonly subtotal: PriceProjection;
|
|
12
|
-
readonly balanceDiscount
|
|
13
|
-
readonly discount
|
|
14
|
-
readonly discountPercentage
|
|
12
|
+
readonly balanceDiscount: PriceProjection;
|
|
13
|
+
readonly discount: PriceProjection;
|
|
14
|
+
readonly discountPercentage: number;
|
|
15
15
|
readonly service: ServiceProjection;
|
|
16
16
|
}
|
|
17
17
|
export type { PricingProjection, ServiceProjection };
|
package/package.json
CHANGED
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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 };
|