@lookiero/checkout 0.3.23 → 0.3.25
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/package.json +1 -1
- package/dist/src/domain/checkout/model/checkout.d.ts +2 -1
- package/dist/src/domain/checkout/model/checkout.js +1 -0
- package/dist/src/domain/checkoutBooking/command/blockCheckoutBooking.d.ts +13 -0
- package/dist/src/domain/checkoutBooking/command/blockCheckoutBooking.js +4 -0
- package/dist/src/domain/checkoutBooking/model/checkoutBooking.d.ts +5 -1
- package/dist/src/domain/checkoutBooking/model/checkoutBooking.js +17 -1
- package/dist/src/domain/checkoutBooking/model/checkoutBookingBlocked.d.ts +13 -0
- package/dist/src/domain/checkoutBooking/model/checkoutBookingBlocked.js +4 -0
- package/dist/src/domain/checkoutBooking/model/checkoutBookingExpired.d.ts +13 -0
- package/dist/src/domain/checkoutBooking/model/checkoutBookingExpired.js +4 -0
- package/dist/src/infrastructure/delivery/baseBootstrap.js +3 -1
- package/dist/src/infrastructure/delivery/mock/dataSourceCheckoutBookings.js +5 -1
- package/dist/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +9 -2
- package/dist/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBlock.d.ts +5 -0
- package/dist/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBlock.js +15 -0
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +13 -0
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +12 -0
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.d.ts +13 -0
- package/dist/src/infrastructure/domain/checkoutBooking/react/{useBookCheckouBookingForCheckoutItem.js → useBookCheckoutBookingForCheckoutItem.js} +2 -2
- package/dist/src/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +1 -1
- package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.js +2 -1
- package/dist/src/infrastructure/ui/views/item/Item.js +4 -4
- package/dist/src/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -1
- package/dist/src/projection/checkoutBooking/checkoutBooking.d.ts +2 -0
- package/package.json +1 -1
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
package/dist/package.json
CHANGED
|
@@ -8,6 +8,7 @@ var CheckoutStatus;
|
|
|
8
8
|
CheckoutStatus["STARTED"] = "STARTED";
|
|
9
9
|
CheckoutStatus["COMPLETED"] = "COMPLETED";
|
|
10
10
|
CheckoutStatus["PAID"] = "PAID";
|
|
11
|
+
CheckoutStatus["EXPIRED"] = "EXPIRED";
|
|
11
12
|
})(CheckoutStatus || (CheckoutStatus = {}));
|
|
12
13
|
const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
13
14
|
const { aggregateId } = command;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const BLOCK_CHECKOUT_BOOKING = "block_checkout_booking";
|
|
3
|
+
interface BlockCheckoutBookingPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface BlockCheckoutBooking extends Command<typeof BLOCK_CHECKOUT_BOOKING>, BlockCheckoutBookingPayload {
|
|
7
|
+
}
|
|
8
|
+
interface BlockCheckoutBookingFunction {
|
|
9
|
+
(payload: BlockCheckoutBookingPayload): BlockCheckoutBooking;
|
|
10
|
+
}
|
|
11
|
+
declare const blockCheckoutBooking: BlockCheckoutBookingFunction;
|
|
12
|
+
export type { BlockCheckoutBooking };
|
|
13
|
+
export { BLOCK_CHECKOUT_BOOKING, blockCheckoutBooking };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutStatus } from "../../checkout/model/checkout";
|
|
3
|
+
import { BlockCheckoutBooking } from "../command/blockCheckoutBooking";
|
|
2
4
|
import { BookCheckoutBookingForCheckoutItem } from "../command/bookCheckoutBookingForCheckoutItem";
|
|
3
5
|
interface CheckoutBooking extends AggregateRoot {
|
|
4
6
|
readonly checkoutItemIds: string[];
|
|
7
|
+
readonly checkoutStatus: CheckoutStatus;
|
|
5
8
|
}
|
|
6
9
|
declare const bookCheckoutBookingForCheckoutItemHandler: CommandHandlerFunction<BookCheckoutBookingForCheckoutItem, CheckoutBooking>;
|
|
10
|
+
declare const blockCheckoutBookingHandler: CommandHandlerFunction<BlockCheckoutBooking, CheckoutBooking>;
|
|
7
11
|
export type { CheckoutBooking };
|
|
8
|
-
export { bookCheckoutBookingForCheckoutItemHandler };
|
|
12
|
+
export { bookCheckoutBookingForCheckoutItemHandler, blockCheckoutBookingHandler };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { CheckoutStatus } from "../../checkout/model/checkout";
|
|
2
|
+
import { checkoutBookingBlocked } from "./checkoutBookingBlocked";
|
|
1
3
|
import { checkoutBookingBooked } from "./checkoutBookingBooked";
|
|
4
|
+
import { checkoutBookingExpired } from "./checkoutBookingExpired";
|
|
2
5
|
const bookCheckoutBookingForCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
|
|
3
6
|
const { aggregateId, checkoutItemId } = command;
|
|
4
7
|
return {
|
|
@@ -6,4 +9,17 @@ const bookCheckoutBookingForCheckoutItemHandler = () => async ({ aggregateRoot,
|
|
|
6
9
|
domainEvents: [checkoutBookingBooked({ aggregateId, checkoutItemId })],
|
|
7
10
|
};
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
const blockCheckoutBookingHandler = () => async ({ aggregateRoot, command }) => {
|
|
13
|
+
const { aggregateId } = command;
|
|
14
|
+
if (aggregateRoot.checkoutStatus === CheckoutStatus.EXPIRED) {
|
|
15
|
+
return {
|
|
16
|
+
...aggregateRoot,
|
|
17
|
+
domainEvents: [checkoutBookingExpired({ aggregateId })],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
...aggregateRoot,
|
|
22
|
+
domainEvents: [checkoutBookingBlocked({ aggregateId })],
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export { bookCheckoutBookingForCheckoutItemHandler, blockCheckoutBookingHandler };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_BOOKING_BLOCKED = "checkout_booking_blocked";
|
|
3
|
+
interface CheckoutBookingBlokedPaylcoad {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutBookingBlocked extends DomainEvent<typeof CHECKOUT_BOOKING_BLOCKED>, CheckoutBookingBlokedPaylcoad {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutBookingBlokedFunctcion {
|
|
9
|
+
(payload: CheckoutBookingBlokedPaylcoad): CheckoutBookingBlocked;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutBookingBlocked: CheckoutBookingBlokedFunctcion;
|
|
12
|
+
export type { CheckoutBookingBlocked };
|
|
13
|
+
export { CHECKOUT_BOOKING_BLOCKED, checkoutBookingBlocked };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { domainEvent } from "@lookiero/messaging";
|
|
2
|
+
const CHECKOUT_BOOKING_BLOCKED = "checkout_booking_blocked";
|
|
3
|
+
const checkoutBookingBlocked = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_BOOKING_BLOCKED });
|
|
4
|
+
export { CHECKOUT_BOOKING_BLOCKED, checkoutBookingBlocked };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_BOOKING_EXPIRED = "checkout_booking_expired";
|
|
3
|
+
interface CheckoutBookingExpiredPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutBookingExpired extends DomainEvent<typeof CHECKOUT_BOOKING_EXPIRED>, CheckoutBookingExpiredPayload {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutBookingExpiredFunction {
|
|
9
|
+
(payload: CheckoutBookingExpiredPayload): CheckoutBookingExpired;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutBookingExpired: CheckoutBookingExpiredFunction;
|
|
12
|
+
export type { CheckoutBookingExpired };
|
|
13
|
+
export { CHECKOUT_BOOKING_EXPIRED, checkoutBookingExpired };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { domainEvent } from "@lookiero/messaging";
|
|
2
|
+
const CHECKOUT_BOOKING_EXPIRED = "checkout_booking_expired";
|
|
3
|
+
const checkoutBookingExpired = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_BOOKING_EXPIRED });
|
|
4
|
+
export { CHECKOUT_BOOKING_EXPIRED, checkoutBookingExpired };
|
|
@@ -2,8 +2,9 @@ import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { MARK_CHECKOUT_AS_PAID } from "../../domain/checkout/command/markCheckoutAsPaid";
|
|
3
3
|
import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
4
4
|
import { markCheckoutAsPaidHandler, startCheckoutHandler } from "../../domain/checkout/model/checkout";
|
|
5
|
+
import { BLOCK_CHECKOUT_BOOKING } from "../../domain/checkoutBooking/command/blockCheckoutBooking";
|
|
5
6
|
import { BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM } from "../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
6
|
-
import { bookCheckoutBookingForCheckoutItemHandler, } from "../../domain/checkoutBooking/model/checkoutBooking";
|
|
7
|
+
import { blockCheckoutBookingHandler, bookCheckoutBookingForCheckoutItemHandler, } from "../../domain/checkoutBooking/model/checkoutBooking";
|
|
7
8
|
import { GIVE_CHECKOUT_FEEDBACK } from "../../domain/checkoutFeedback/command/giveCheckoutFeedback";
|
|
8
9
|
import { giveCheckoutFeedbackHandler } from "../../domain/checkoutFeedback/model/checkoutFeedback";
|
|
9
10
|
import { KEEP_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/keepCheckoutItem";
|
|
@@ -67,6 +68,7 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
67
68
|
view: bookedSizeChangeProductsVariantsForCheckoutItemView,
|
|
68
69
|
})
|
|
69
70
|
.command(BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM, bookCheckoutBookingForCheckoutItemHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
71
|
+
.command(BLOCK_CHECKOUT_BOOKING, blockCheckoutBookingHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
70
72
|
.command(GIVE_CHECKOUT_FEEDBACK, giveCheckoutFeedbackHandler)(getCheckoutFeedback, saveCheckoutFeedback, ...checkoutFeedbacksDependencies)
|
|
71
73
|
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
72
74
|
view: uiSettingByKeyView,
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import invariant from "tiny-invariant";
|
|
2
|
+
import { v4 as uuid } from "uuid";
|
|
3
|
+
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
2
4
|
import { viewBookedSizeChangeProductsVariantsForCheckoutItem, } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
3
5
|
const toCheckoutBookingDomain = (checkoutBooking) => {
|
|
4
6
|
invariant(checkoutBooking, "No checkoutBooking found!");
|
|
5
7
|
return {
|
|
6
|
-
aggregateId:
|
|
8
|
+
aggregateId: uuid(),
|
|
7
9
|
checkoutItemIds: checkoutBooking.productVariants.map((productVariant) => productVariant.id),
|
|
10
|
+
checkoutStatus: CheckoutStatus.AVAILABLE,
|
|
8
11
|
domainEvents: [],
|
|
9
12
|
};
|
|
10
13
|
};
|
|
11
14
|
const toCheckoutBookingProjection = (checkoutBooking) => ({
|
|
12
15
|
id: checkoutBooking.aggregateId,
|
|
13
16
|
checkoutItemIds: checkoutBooking.checkoutItemIds,
|
|
17
|
+
checkoutStatus: checkoutBooking.checkoutStatus,
|
|
14
18
|
});
|
|
15
19
|
const getCheckoutBooking = ({ queryBus }) => async (aggregateId) => toCheckoutBookingDomain(await queryBus(viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId: aggregateId })));
|
|
16
20
|
const saveCheckoutBooking = ({ dataSource }) => async (aggregateRoot) => {
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import invariant from "tiny-invariant";
|
|
2
2
|
import { viewCheckoutBookingById, } from "../../../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
3
|
+
import { httpCheckoutBookingsBlock } from "./httpCheckoutBookingsBlock";
|
|
3
4
|
import { httpCheckoutBookingsBook } from "./httpCheckoutBookingsBook";
|
|
4
5
|
const toDomain = (checkoutBooking) => {
|
|
5
6
|
invariant(checkoutBooking, "No checkout booking found!");
|
|
6
7
|
return {
|
|
7
|
-
checkoutItemIds: checkoutBooking.checkoutItemIds,
|
|
8
8
|
aggregateId: checkoutBooking.id,
|
|
9
|
+
checkoutItemIds: checkoutBooking.checkoutItemIds,
|
|
10
|
+
checkoutStatus: checkoutBooking.checkoutStatus,
|
|
9
11
|
domainEvents: [],
|
|
10
12
|
};
|
|
11
13
|
};
|
|
12
14
|
const getCheckoutBooking = ({ queryBus }) => async (aggregateId) => toDomain(await queryBus(viewCheckoutBookingById({ checkoutBookingId: aggregateId })));
|
|
13
|
-
const saveCheckoutBooking = ({ httpPost }) => async (aggregateRoot) =>
|
|
15
|
+
const saveCheckoutBooking = ({ httpPost }) => async (aggregateRoot) => {
|
|
16
|
+
await Promise.all([
|
|
17
|
+
httpCheckoutBookingsBook({ httpPost })(aggregateRoot),
|
|
18
|
+
httpCheckoutBookingsBlock({ httpPost })(aggregateRoot),
|
|
19
|
+
]);
|
|
20
|
+
};
|
|
14
21
|
export { getCheckoutBooking, saveCheckoutBooking };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HttpCheckoutBookingsSaveFunction } from "./httpCheckoutBookings";
|
|
2
|
+
interface HttpCheckoutBookingsBlockFunction extends HttpCheckoutBookingsSaveFunction {
|
|
3
|
+
}
|
|
4
|
+
declare const httpCheckoutBookingsBlock: HttpCheckoutBookingsBlockFunction;
|
|
5
|
+
export { httpCheckoutBookingsBlock };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CHECKOUT_BOOKING_BLOCKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBlocked";
|
|
2
|
+
const isCheckoutBookingBlocked = (event) => event.name === CHECKOUT_BOOKING_BLOCKED;
|
|
3
|
+
const httpCheckoutBookingsBlock = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
+
const checkoutBookingBlocked = domainEvents.find(isCheckoutBookingBlocked);
|
|
5
|
+
if (!checkoutBookingBlocked) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
await httpPost({
|
|
9
|
+
endpoint: "/block-checkout-booking",
|
|
10
|
+
body: {
|
|
11
|
+
checkoutBookingId: aggregateId,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { httpCheckoutBookingsBlock };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface BlockCheckoutBookingFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
type UseBlockCheckoutBooking = [blockCheckoutBooking: BlockCheckoutBookingFunction, status: CommandStatus];
|
|
6
|
+
interface UseBlockCheckoutBookingFunctionArgs {
|
|
7
|
+
readonly checkoutBookingId: string;
|
|
8
|
+
}
|
|
9
|
+
interface UseBlockCheckoutBookingFunction {
|
|
10
|
+
(args: UseBlockCheckoutBookingFunctionArgs): UseBlockCheckoutBooking;
|
|
11
|
+
}
|
|
12
|
+
declare const useBlockCheckoutBooking: UseBlockCheckoutBookingFunction;
|
|
13
|
+
export { useBlockCheckoutBooking };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { blockCheckoutBooking as blockCheckoutBookingCommand } from "../../../../domain/checkoutBooking/command/blockCheckoutBooking";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
const useBlockCheckoutBooking = ({ checkoutBookingId }) => {
|
|
6
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
7
|
+
const blockCheckoutBooking = useCallback(() => commandBus(blockCheckoutBookingCommand({
|
|
8
|
+
aggregateId: checkoutBookingId,
|
|
9
|
+
})), [checkoutBookingId, commandBus]);
|
|
10
|
+
return [blockCheckoutBooking, status];
|
|
11
|
+
};
|
|
12
|
+
export { useBlockCheckoutBooking };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface BookFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
type UseBookCheckoutBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
|
|
6
|
+
interface UseBookCheckoutBookingForCheckoutItemFunctionArgs {
|
|
7
|
+
readonly checkoutItemId: string;
|
|
8
|
+
}
|
|
9
|
+
interface UseBookCheckoutBookingForCheckoutItemFunction {
|
|
10
|
+
(args: UseBookCheckoutBookingForCheckoutItemFunctionArgs): UseBookCheckoutBookingForCheckoutItem;
|
|
11
|
+
}
|
|
12
|
+
declare const useBookCheckoutBookingForCheckoutItem: UseBookCheckoutBookingForCheckoutItemFunction;
|
|
13
|
+
export { useBookCheckoutBookingForCheckoutItem };
|
|
@@ -3,7 +3,7 @@ import { useCallback } from "react";
|
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
4
|
import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
5
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const
|
|
6
|
+
const useBookCheckoutBookingForCheckoutItem = ({ checkoutItemId }) => {
|
|
7
7
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
8
|
const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
|
|
9
9
|
aggregateId: uuid(),
|
|
@@ -11,4 +11,4 @@ const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId }) => {
|
|
|
11
11
|
})), [checkoutItemId, commandBus]);
|
|
12
12
|
return [book, status];
|
|
13
13
|
};
|
|
14
|
-
export {
|
|
14
|
+
export { useBookCheckoutBookingForCheckoutItem };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
2
|
const response = await httpPost({
|
|
3
|
-
endpoint: "/view-booked-
|
|
3
|
+
endpoint: "/view-booked-product-variants-for-checkout-item",
|
|
4
4
|
body: { checkoutItemId },
|
|
5
5
|
signal,
|
|
6
6
|
});
|
|
@@ -58,7 +58,8 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
|
|
|
58
58
|
}
|
|
59
59
|
/* Navigate to the summary if required */
|
|
60
60
|
if (firstItemWithoutCustomerDecision === undefined &&
|
|
61
|
-
!(summaryRouteMatch || itemDetailRouteMatch || checkoutRouteMatch)
|
|
61
|
+
!(summaryRouteMatch || itemDetailRouteMatch || checkoutRouteMatch) &&
|
|
62
|
+
checkout?.status !== CheckoutStatus.PAID) {
|
|
62
63
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.SUMMARY}`, replace: true });
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -5,7 +5,7 @@ import { generatePath, useMatch, useNavigate, useParams } from "react-router-nat
|
|
|
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";
|
|
@@ -75,12 +75,12 @@ const Item = ({ customerId }) => {
|
|
|
75
75
|
const [bookedSizeChangeProductsVariants, bookedSizeChangeProductsVariantsStatus] = useViewBookedSizeChangeProductsVariantsForCheckoutItem({
|
|
76
76
|
checkoutItemId: checkoutItem.id,
|
|
77
77
|
});
|
|
78
|
-
const [bookCheckouBooking] =
|
|
78
|
+
const [bookCheckouBooking] = useBookCheckoutBookingForCheckoutItem({
|
|
79
79
|
checkoutItemId: checkoutItem.id,
|
|
80
80
|
});
|
|
81
81
|
useEffect(() => {
|
|
82
|
-
|
|
83
|
-
}, [bookCheckouBooking,
|
|
82
|
+
checkout && !checkout?.checkoutBookingId && bookCheckouBooking();
|
|
83
|
+
}, [bookCheckouBooking, checkout]);
|
|
84
84
|
const [returnQuestions, returnQuestionsStatus] = useListReturnQuestionsByCheckoutItemId({
|
|
85
85
|
checkoutItemId: checkoutItem.id,
|
|
86
86
|
});
|
package/dist/src/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 };
|
package/package.json
CHANGED
|
@@ -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 };
|