@lookiero/checkout 0.3.23 → 0.3.24

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,9 +1,10 @@
1
1
  import invariant from "tiny-invariant";
2
+ import { v4 as uuid } from "uuid";
2
3
  import { viewBookedSizeChangeProductsVariantsForCheckoutItem, } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
3
4
  const toCheckoutBookingDomain = (checkoutBooking) => {
4
5
  invariant(checkoutBooking, "No checkoutBooking found!");
5
6
  return {
6
- aggregateId: checkoutBooking.bookingId,
7
+ aggregateId: uuid(),
7
8
  checkoutItemIds: checkoutBooking.productVariants.map((productVariant) => productVariant.id),
8
9
  domainEvents: [],
9
10
  };
@@ -1,6 +1,6 @@
1
1
  const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
2
2
  const response = await httpPost({
3
- endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
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
  }
@@ -79,8 +79,8 @@ const Item = ({ customerId }) => {
79
79
  checkoutItemId: checkoutItem.id,
80
80
  });
81
81
  useEffect(() => {
82
- bookedSizeChangeProductsVariants === null && bookCheckouBooking();
83
- }, [bookCheckouBooking, bookedSizeChangeProductsVariants]);
82
+ checkout && !checkout?.checkoutBookingId && bookCheckouBooking();
83
+ }, [bookCheckouBooking, checkout]);
84
84
  const [returnQuestions, returnQuestionsStatus] = useListReturnQuestionsByCheckoutItemId({
85
85
  checkoutItemId: checkoutItem.id,
86
86
  });
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [