@lookiero/checkout 0.2.50 → 0.2.51

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.
@@ -2,7 +2,6 @@ import { Command } from "@lookiero/messaging";
2
2
  declare const BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM = "book_checkout_booking_for_checkout_item";
3
3
  interface BookCheckoutBookingForCheckoutItemPayload {
4
4
  readonly aggregateId: string;
5
- readonly checkoutId: string;
6
5
  readonly checkoutItemId: string;
7
6
  }
8
7
  interface BookCheckoutBookingForCheckoutItem extends Command<typeof BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM>, BookCheckoutBookingForCheckoutItemPayload {
@@ -1,7 +1,6 @@
1
1
  import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
2
2
  import { BookCheckoutBookingForCheckoutItem } from "../command/bookCheckoutBookingForCheckoutItem";
3
3
  interface CheckoutBooking extends AggregateRoot {
4
- readonly checkoutId: string;
5
4
  readonly checkoutItemIds: string[];
6
5
  }
7
6
  declare const bookCheckoutBookingForCheckoutItemHandler: CommandHandlerFunction<BookCheckoutBookingForCheckoutItem, CheckoutBooking>;
@@ -11,7 +11,6 @@ const toCheckoutBookingDomain = (checkoutBooking) => {
11
11
  };
12
12
  const toCheckoutBookingProjection = (checkoutBooking) => ({
13
13
  id: checkoutBooking.aggregateId,
14
- checkoutId: checkoutBooking.checkoutId,
15
14
  checkoutItemIds: checkoutBooking.checkoutItemIds,
16
15
  });
17
16
  const getCheckoutBooking = ({ queryBus }) => async (aggregateId) => toCheckoutBookingDomain(await queryBus(viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId: aggregateId })));
@@ -4,7 +4,6 @@ import { httpCheckoutBookingsBook } from "./httpCheckoutBookingsBook";
4
4
  const toDomain = (checkoutBooking) => {
5
5
  invariant(checkoutBooking, "No checkout booking found!");
6
6
  return {
7
- checkoutId: checkoutBooking.checkoutId,
8
7
  checkoutItemIds: checkoutBooking.checkoutItemIds,
9
8
  aggregateId: checkoutBooking.id,
10
9
  domainEvents: [],
@@ -1,15 +1,14 @@
1
1
  import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
2
2
  const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
3
- const httpCheckoutBookingsBook = ({ httpPost }) => async ({ aggregateId, checkoutId, domainEvents }) => {
3
+ const httpCheckoutBookingsBook = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
4
4
  const checkoutBookingBooked = domainEvents.find(isCheckoutBookingBooked);
5
5
  if (!checkoutBookingBooked) {
6
6
  return;
7
7
  }
8
8
  const { checkoutItemId } = checkoutBookingBooked;
9
9
  await httpPost({
10
- endpoint: "/book-size-change-product-variants-for-checkout-item",
10
+ endpoint: "/book-checkout-booking-for-checkout-item",
11
11
  body: {
12
- checkoutId,
13
12
  checkoutItemId,
14
13
  checkoutBookingId: aggregateId,
15
14
  },
@@ -4,7 +4,6 @@ interface BookFunction {
4
4
  }
5
5
  declare type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
6
6
  interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
7
- readonly checkoutId: string;
8
7
  readonly checkoutItemId: string;
9
8
  readonly checkoutBookingId: string | undefined;
10
9
  }
@@ -3,13 +3,12 @@ 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 useBookCheckouBookingForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId, }) => {
6
+ const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId, checkoutBookingId, }) => {
7
7
  const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
8
  const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
9
9
  aggregateId: checkoutBookingId || uuid(),
10
- checkoutId,
11
10
  checkoutItemId,
12
- })), [checkoutBookingId, checkoutId, checkoutItemId, commandBus]);
11
+ })), [checkoutBookingId, checkoutItemId, commandBus]);
13
12
  return [book, status];
14
13
  };
15
14
  export { useBookCheckouBookingForCheckoutItem };
@@ -40,7 +40,6 @@ const Item = ({ customerId }) => {
40
40
  });
41
41
  const [bookCheckouBooking] = useBookCheckouBookingForCheckoutItem({
42
42
  checkoutBookingId: bookedSizeChangeProductsVariants?.id,
43
- checkoutId: checkout?.id,
44
43
  checkoutItemId: checkoutItem.id,
45
44
  });
46
45
  const [returnQuestions, returnQuestionsStatus] = useListReturnQuestionsByCheckoutItemId({
@@ -1,6 +1,5 @@
1
1
  interface CheckoutBookingProjection {
2
2
  readonly id: string;
3
- readonly checkoutId: string;
4
3
  readonly checkoutItemIds: string[];
5
4
  }
6
5
  export type { CheckoutBookingProjection };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.2.50",
3
+ "version": "0.2.51",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [