@lookiero/checkout 0.2.10 → 0.2.12

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.
Files changed (81) hide show
  1. package/README.md +3 -1
  2. package/dist/domain/checkout/command/startCheckout.d.ts +2 -1
  3. package/dist/domain/checkout/model/checkout.d.ts +2 -1
  4. package/dist/domain/checkout/model/checkout.js +1 -1
  5. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +2 -1
  6. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js +1 -1
  7. package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +2 -1
  8. package/dist/domain/checkoutBooking/model/checkoutBooking.js +7 -5
  9. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +2 -1
  10. package/dist/domain/checkoutBooking/model/checkoutBookings.d.ts +1 -1
  11. package/dist/domain/checkoutItem/command/keepCheckoutItem.d.ts +13 -0
  12. package/dist/domain/checkoutItem/command/keepCheckoutItem.js +4 -0
  13. package/dist/domain/checkoutItem/model/checkoutItem.d.ts +15 -0
  14. package/dist/domain/checkoutItem/model/checkoutItem.js +20 -0
  15. package/dist/domain/checkoutItem/model/checkoutItemKept.d.ts +13 -0
  16. package/dist/domain/checkoutItem/model/checkoutItemKept.js +4 -0
  17. package/dist/domain/checkoutItem/model/checkoutItems.d.ts +7 -0
  18. package/dist/domain/checkoutItem/model/checkoutItems.js +1 -0
  19. package/dist/domain/uiSetting/command/updateUiSetting.d.ts +2 -1
  20. package/dist/domain/uiSetting/model/uiSetting.d.ts +2 -1
  21. package/dist/domain/uiSetting/model/uiSetting.js +1 -1
  22. package/dist/domain/uiSetting/model/uiSettingUpdated.d.ts +2 -1
  23. package/dist/domain/uiSetting/model/uiSettings.d.ts +1 -1
  24. package/dist/infrastructure/delivery/baseBootstrap.d.ts +18 -4
  25. package/dist/infrastructure/delivery/baseBootstrap.js +13 -6
  26. package/dist/infrastructure/delivery/bootstrap.js +8 -2
  27. package/dist/infrastructure/delivery/bootstrap.mock.js +21 -39
  28. package/dist/infrastructure/delivery/http/fetchHttpClient.js +4 -2
  29. package/dist/infrastructure/delivery/http/httpClient.d.ts +2 -0
  30. package/dist/infrastructure/delivery/mock/checkoutDataSource.d.ts +17 -0
  31. package/dist/infrastructure/delivery/mock/checkoutDataSource.js +18 -0
  32. package/dist/infrastructure/delivery/mock/dataSourceCheckoutItems.d.ts +14 -0
  33. package/dist/infrastructure/delivery/mock/dataSourceCheckoutItems.js +21 -0
  34. package/dist/infrastructure/delivery/mock/dataSourceCheckouts.d.ts +11 -0
  35. package/dist/infrastructure/delivery/mock/dataSourceCheckouts.js +27 -0
  36. package/dist/infrastructure/domain/checkout/model/httpCheckoutsStart.js +1 -2
  37. package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItems.d.ts +16 -0
  38. package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItems.js +17 -0
  39. package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsKeep.d.ts +5 -0
  40. package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsKeep.js +13 -0
  41. package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.d.ts +13 -0
  42. package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.js +12 -0
  43. package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js +9 -13
  44. package/dist/infrastructure/projection/checkout/checkout.d.ts +3 -38
  45. package/dist/infrastructure/projection/checkout/checkout.mock.d.ts +2 -1
  46. package/dist/infrastructure/projection/checkout/checkout.mock.js +1 -33
  47. package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +2 -1
  48. package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +2 -1
  49. package/dist/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.js +2 -1
  50. package/dist/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.js +2 -1
  51. package/dist/infrastructure/projection/checkoutItem/checkoutItem.d.ts +44 -0
  52. package/dist/infrastructure/projection/checkoutItem/checkoutItem.js +39 -0
  53. package/dist/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +18 -0
  54. package/dist/infrastructure/projection/checkoutItem/checkoutItem.mock.js +37 -0
  55. package/dist/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.d.ts +12 -0
  56. package/dist/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.js +12 -0
  57. package/dist/infrastructure/ui/components/atoms/price/Price.d.ts +1 -1
  58. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +1 -1
  59. package/dist/infrastructure/ui/views/item/Item.js +1 -3
  60. package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.d.ts +1 -1
  61. package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +1 -1
  62. package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.d.ts +1 -1
  63. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +1 -1
  64. package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.d.ts +1 -1
  65. package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +2 -2
  66. package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.js +2 -2
  67. package/dist/projection/checkout/checkout.d.ts +2 -68
  68. package/dist/projection/checkout/checkout.js +1 -29
  69. package/dist/projection/checkout/viewCheckoutById.d.ts +2 -2
  70. package/dist/projection/checkout/viewCheckoutById.js +2 -2
  71. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +2 -2
  72. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.js +2 -2
  73. package/dist/projection/checkout/viewFiveItemsDiscountByCustomerId.d.ts +2 -2
  74. package/dist/projection/checkout/viewFiveItemsDiscountByCustomerId.js +2 -2
  75. package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.d.ts +2 -2
  76. package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.js +2 -2
  77. package/dist/projection/checkoutItem/checkoutItem.d.ts +62 -0
  78. package/dist/projection/checkoutItem/checkoutItem.js +21 -0
  79. package/dist/projection/checkoutItem/viewCheckoutItemById.d.ts +25 -0
  80. package/dist/projection/checkoutItem/viewCheckoutItemById.js +8 -0
  81. package/package.json +9 -8
@@ -0,0 +1,16 @@
1
+ import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
2
+ import { CheckoutItemsGetFunction, CheckoutItemsSaveFunction } from "../../../../domain/checkoutItem/model/checkoutItems";
3
+ import { HttpPostFunction } from "../../../delivery/http/httpClient";
4
+ interface HttpCheckoutItemsGetFunctionArgs extends RepositoryGetFunctionArgs {
5
+ }
6
+ interface HttpCheckoutItemsGetFunction extends CheckoutItemsGetFunction<HttpCheckoutItemsGetFunctionArgs> {
7
+ }
8
+ declare const getCheckoutItem: HttpCheckoutItemsGetFunction;
9
+ interface HttpCheckoutItemsSaveFunctionArgs extends RepositorySaveFunctionArgs {
10
+ readonly httpPost: HttpPostFunction;
11
+ }
12
+ interface HttpCheckoutItemsSaveFunction extends CheckoutItemsSaveFunction<HttpCheckoutItemsSaveFunctionArgs> {
13
+ }
14
+ declare const saveCheckoutItem: HttpCheckoutItemsSaveFunction;
15
+ export type { HttpCheckoutItemsSaveFunction };
16
+ export { getCheckoutItem, saveCheckoutItem };
@@ -0,0 +1,17 @@
1
+ import invariant from "tiny-invariant";
2
+ import { viewCheckoutItemById, } from "../../../../projection/checkoutItem/viewCheckoutItemById";
3
+ import { httpCheckoutItemsKeep } from "./httpCheckoutItemsKeep";
4
+ const toDomain = (checkoutItem) => {
5
+ invariant(checkoutItem, "No checkoutItem found!");
6
+ return {
7
+ id: checkoutItem.id,
8
+ status: checkoutItem.status,
9
+ aggregateId: checkoutItem.id,
10
+ domainEvents: [],
11
+ };
12
+ };
13
+ const getCheckoutItem = ({ queryBus }) => async (aggregateId) => toDomain(await queryBus(viewCheckoutItemById({ checkoutItemId: aggregateId })));
14
+ const saveCheckoutItem = ({ httpPost }) => async (aggregateRoot) => {
15
+ await httpCheckoutItemsKeep({ httpPost })(aggregateRoot);
16
+ };
17
+ export { getCheckoutItem, saveCheckoutItem };
@@ -0,0 +1,5 @@
1
+ import { HttpCheckoutItemsSaveFunction } from "./httpCheckoutItems";
2
+ interface HttpCheckoutItemsKeepFunction extends HttpCheckoutItemsSaveFunction {
3
+ }
4
+ declare const httpCheckoutItemsKeep: HttpCheckoutItemsKeepFunction;
5
+ export { httpCheckoutItemsKeep };
@@ -0,0 +1,13 @@
1
+ import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
2
+ const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
3
+ const httpCheckoutItemsKeep = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
4
+ const checkoutItemKept = domainEvents.find(isCheckoutItemKept);
5
+ if (!checkoutItemKept) {
6
+ return;
7
+ }
8
+ httpPost({
9
+ endpoint: "/keep-checkout-item",
10
+ body: { checkout_item_id: aggregateId },
11
+ });
12
+ };
13
+ export { httpCheckoutItemsKeep };
@@ -0,0 +1,13 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ interface KeepCheckoutItemFunction {
3
+ (): Promise<void>;
4
+ }
5
+ interface UseKeepCheckoutItemFunctionArgs {
6
+ readonly checkoutItemId: string;
7
+ }
8
+ declare type UseKeepCheckoutItemResult = [keep: KeepCheckoutItemFunction, status: CommandStatus];
9
+ interface UseKeepCheckoutItemFunction {
10
+ (args: UseKeepCheckoutItemFunctionArgs): UseKeepCheckoutItemResult;
11
+ }
12
+ declare const useKeepCheckoutItem: UseKeepCheckoutItemFunction;
13
+ export { useKeepCheckoutItem };
@@ -0,0 +1,12 @@
1
+ import { useCommand } from "@lookiero/messaging-react";
2
+ import { useCallback } from "react";
3
+ import { keepCheckoutItem } from "../../../../domain/checkoutItem/command/keepCheckoutItem";
4
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
+ const useKeepCheckoutItem = ({ checkoutItemId }) => {
6
+ const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
7
+ const keep = useCallback(async () => await commandBus(keepCheckoutItem({
8
+ aggregateId: checkoutItemId,
9
+ })), [checkoutItemId, commandBus]);
10
+ return [keep, status];
11
+ };
12
+ export { useKeepCheckoutItem };
@@ -13,18 +13,14 @@ const toBookedSizeReplaceableProductVariants = (bookedSizeReplaceableProductVari
13
13
  booking: bookedSizeReplaceableProductVariants.booking,
14
14
  productVariants: bookedSizeReplaceableProductVariants.product_variants.map(toProductVariant),
15
15
  });
16
- const httpBookedSizeReplaceableProductVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId }) => {
17
- try {
18
- const response = await httpPost({
19
- endpoint: "/view-booked-size-replaceable-product-variants-for-checkout-item",
20
- body: { checkout_item_id: checkoutItemId },
21
- });
22
- return response.status === 404
23
- ? undefined
24
- : toBookedSizeReplaceableProductVariants((await response.json()).result);
25
- }
26
- catch (ignored) {
27
- throw new Error("Could not fetch BookedSizeReplaceableProductVariantsForCheckoutItem");
28
- }
16
+ const httpBookedSizeReplaceableProductVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
17
+ const response = await httpPost({
18
+ endpoint: "/view-booked-size-replaceable-product-variants-for-checkout-item",
19
+ body: { checkout_item_id: checkoutItemId },
20
+ signal,
21
+ });
22
+ return response.status === 404
23
+ ? undefined
24
+ : toBookedSizeReplaceableProductVariants((await response.json()).result);
29
25
  };
30
26
  export { toBookedSizeReplaceableProductVariants, httpBookedSizeReplaceableProductVariantsForCheckoutItemView, };
@@ -1,41 +1,6 @@
1
1
  import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
2
- import { CheckoutItemStatus, CheckoutProjection, Currency, MediaPerspective } from "../../../projection/checkout/checkout";
3
- interface CheckoutItemDto {
4
- readonly id: string;
5
- readonly status: CheckoutItemStatus;
6
- readonly product_variant: {
7
- readonly id: string;
8
- readonly media: {
9
- readonly id: string;
10
- readonly url: string;
11
- readonly perspective: MediaPerspective;
12
- }[];
13
- readonly brand: string;
14
- readonly name: string;
15
- readonly price: {
16
- readonly amount: number;
17
- readonly currency: Currency;
18
- readonly discounted_price?: {
19
- readonly amount: number;
20
- readonly percentage: number;
21
- };
22
- };
23
- readonly size: {
24
- readonly id: string;
25
- readonly lookiero: string;
26
- readonly uk: string;
27
- readonly it: string;
28
- readonly europe: string;
29
- readonly unique: boolean;
30
- readonly visual_order?: number;
31
- };
32
- readonly color: {
33
- readonly id: string;
34
- readonly label: string;
35
- };
36
- };
37
- readonly replaced_for?: string;
38
- }
2
+ import { CheckoutProjection } from "../../../projection/checkout/checkout";
3
+ import { CheckoutItemDto } from "../checkoutItem/checkoutItem";
39
4
  interface CheckoutDto {
40
5
  readonly id: string;
41
6
  readonly customer_id: string;
@@ -49,5 +14,5 @@ interface ToCheckoutProjectionFunction {
49
14
  (checkoutDto: CheckoutDto): CheckoutProjection;
50
15
  }
51
16
  declare const toCheckoutProjection: ToCheckoutProjectionFunction;
52
- export type { CheckoutDto, CheckoutItemDto };
17
+ export type { CheckoutDto };
53
18
  export { toCheckoutProjection };
@@ -1,4 +1,5 @@
1
- import { CheckoutItemStatus, CheckoutProjection } from "../../../projection/checkout/checkout";
1
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
2
+ import { CheckoutProjection } from "../../../projection/checkout/checkout";
2
3
  import { CheckoutDto } from "./checkout";
3
4
  interface StartedCheckoutWithStatusDtoFunctionArgs {
4
5
  readonly status: CheckoutItemStatus[];
@@ -1,39 +1,7 @@
1
1
  import { v4 as uuid } from "uuid";
2
2
  import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
3
- import { Currency, MediaPerspective, } from "../../../projection/checkout/checkout";
3
+ import { checkoutItemDto } from "../checkoutItem/checkoutItem.mock";
4
4
  import { toCheckoutProjection } from "./checkout";
5
- const checkoutItemDto = ({ status }) => ({
6
- id: uuid(),
7
- status,
8
- product_variant: {
9
- id: uuid(),
10
- media: [
11
- {
12
- id: uuid(),
13
- url: "https://cdn-catalog-back-prod.envs.lookiero.tech/d2/65/d2655b80-7745-4537-bb17-eb38f960a8de.jpg",
14
- perspective: MediaPerspective.FRONT,
15
- },
16
- ],
17
- brand: "CKS",
18
- name: "Sari Tshirt lines",
19
- price: {
20
- amount: 3999,
21
- currency: Currency.EUR,
22
- },
23
- size: {
24
- id: uuid(),
25
- lookiero: "M",
26
- uk: "M",
27
- it: "M",
28
- europe: "M",
29
- unique: false,
30
- },
31
- color: {
32
- id: uuid(),
33
- label: "black_C2",
34
- },
35
- },
36
- });
37
5
  const checkoutWithItemsDto = ({ items }) => ({
38
6
  id: uuid(),
39
7
  status: CheckoutStatus.STARTED,
@@ -1,8 +1,9 @@
1
1
  import { toCheckoutProjection } from "./checkout";
2
- const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId }) => {
2
+ const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
3
3
  const response = await httpPost({
4
4
  endpoint: "/view-checkout-by-id",
5
5
  body: { checkout_id: checkoutId },
6
+ signal,
6
7
  });
7
8
  return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
8
9
  };
@@ -1,8 +1,9 @@
1
1
  import { toCheckoutProjection } from "./checkout";
2
- const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId }) => {
2
+ const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId, signal }) => {
3
3
  const response = await httpPost({
4
4
  endpoint: "/view-first-available-checkout-by-customer-id",
5
5
  body: { customer_id: customerId },
6
+ signal,
6
7
  });
7
8
  return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
8
9
  };
@@ -1,6 +1,7 @@
1
- const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId }) => {
1
+ const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
2
2
  const response = await httpGet({
3
3
  endpoint: `/view-five-items-discount-by-customer-id/${customerId}`,
4
+ signal,
4
5
  });
5
6
  return !response.ok ? 0 : await response.json();
6
7
  };
@@ -1,6 +1,7 @@
1
- const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId }) => {
1
+ const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
2
2
  const response = await httpGet({
3
3
  endpoint: `/is-new-checkout-enabled/${customerId}`,
4
+ signal,
4
5
  });
5
6
  return !response.ok ? false : await response.json();
6
7
  };
@@ -0,0 +1,44 @@
1
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
2
+ import { CheckoutItemProjection, Currency, MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
3
+ interface CheckoutItemDto {
4
+ readonly id: string;
5
+ readonly status: CheckoutItemStatus;
6
+ readonly product_variant: {
7
+ readonly id: string;
8
+ readonly media: {
9
+ readonly id: string;
10
+ readonly url: string;
11
+ readonly perspective: MediaPerspective;
12
+ }[];
13
+ readonly brand: string;
14
+ readonly name: string;
15
+ readonly price: {
16
+ readonly amount: number;
17
+ readonly currency: Currency;
18
+ readonly discounted_price?: {
19
+ readonly amount: number;
20
+ readonly percentage: number;
21
+ };
22
+ };
23
+ readonly size: {
24
+ readonly id: string;
25
+ readonly lookiero: string;
26
+ readonly uk: string;
27
+ readonly it: string;
28
+ readonly europe: string;
29
+ readonly unique: boolean;
30
+ readonly visual_order?: number;
31
+ };
32
+ readonly color: {
33
+ readonly id: string;
34
+ readonly label: string;
35
+ };
36
+ };
37
+ readonly replaced_for?: string;
38
+ }
39
+ interface ToCheckoutItemProjectionFunction {
40
+ (checkoutItemDto: CheckoutItemDto): CheckoutItemProjection;
41
+ }
42
+ declare const toCheckoutItemProjection: ToCheckoutItemProjectionFunction;
43
+ export type { CheckoutItemDto };
44
+ export { toCheckoutItemProjection };
@@ -0,0 +1,39 @@
1
+ const toCheckoutItemProjection = (checkoutItemDto) => ({
2
+ id: checkoutItemDto.id,
3
+ status: checkoutItemDto.status,
4
+ replacedFor: checkoutItemDto.replaced_for,
5
+ productVariant: {
6
+ id: checkoutItemDto.product_variant.id,
7
+ media: checkoutItemDto.product_variant.media.map((media) => ({
8
+ id: media.id,
9
+ url: media.url,
10
+ perspective: media.perspective,
11
+ })),
12
+ brand: checkoutItemDto.product_variant.brand,
13
+ name: checkoutItemDto.product_variant.name,
14
+ price: {
15
+ amount: checkoutItemDto.product_variant.price.amount,
16
+ currency: checkoutItemDto.product_variant.price.currency,
17
+ discountedPrice: checkoutItemDto.product_variant.price.discounted_price
18
+ ? {
19
+ amount: checkoutItemDto.product_variant.price.discounted_price.amount,
20
+ percentage: checkoutItemDto.product_variant.price.discounted_price.percentage,
21
+ }
22
+ : undefined,
23
+ },
24
+ size: {
25
+ id: checkoutItemDto.product_variant.size.id,
26
+ lookiero: checkoutItemDto.product_variant.size.lookiero,
27
+ uk: checkoutItemDto.product_variant.size.uk,
28
+ it: checkoutItemDto.product_variant.size.it,
29
+ europe: checkoutItemDto.product_variant.size.europe,
30
+ unique: checkoutItemDto.product_variant.size.unique,
31
+ visualOrder: checkoutItemDto.product_variant.size.visual_order,
32
+ },
33
+ color: {
34
+ id: checkoutItemDto.product_variant.color.id,
35
+ label: checkoutItemDto.product_variant.color.label,
36
+ },
37
+ },
38
+ });
39
+ export { toCheckoutItemProjection };
@@ -0,0 +1,18 @@
1
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
2
+ import { CheckoutItemProjection } from "../../../projection/checkoutItem/checkoutItem";
3
+ import { CheckoutItemDto } from "./checkoutItem";
4
+ interface CheckoutItemDtoFunctionArgs {
5
+ readonly status: CheckoutItemStatus;
6
+ }
7
+ interface CheckoutItemDtoFunction {
8
+ (args: CheckoutItemDtoFunctionArgs): CheckoutItemDto;
9
+ }
10
+ declare const checkoutItemDto: CheckoutItemDtoFunction;
11
+ interface CheckoutItemProjectionFunctionArgs {
12
+ readonly status: CheckoutItemStatus;
13
+ }
14
+ interface CheckoutItemProjectionFunction {
15
+ (args: CheckoutItemProjectionFunctionArgs): CheckoutItemProjection;
16
+ }
17
+ declare const checkoutItemProjection: CheckoutItemProjectionFunction;
18
+ export { checkoutItemDto, checkoutItemProjection };
@@ -0,0 +1,37 @@
1
+ import { v4 as uuid } from "uuid";
2
+ import { Currency, MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
3
+ import { toCheckoutItemProjection } from "./checkoutItem";
4
+ const checkoutItemDto = ({ status }) => ({
5
+ id: uuid(),
6
+ status,
7
+ product_variant: {
8
+ id: uuid(),
9
+ media: [
10
+ {
11
+ id: uuid(),
12
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/d2/65/d2655b80-7745-4537-bb17-eb38f960a8de.jpg",
13
+ perspective: MediaPerspective.FRONT,
14
+ },
15
+ ],
16
+ brand: "CKS",
17
+ name: "Sari Tshirt lines",
18
+ price: {
19
+ amount: 3999,
20
+ currency: Currency.EUR,
21
+ },
22
+ size: {
23
+ id: uuid(),
24
+ lookiero: "M",
25
+ uk: "M",
26
+ it: "M",
27
+ europe: "M",
28
+ unique: false,
29
+ },
30
+ color: {
31
+ id: uuid(),
32
+ label: "black_C2",
33
+ },
34
+ },
35
+ });
36
+ const checkoutItemProjection = ({ status }) => toCheckoutItemProjection(checkoutItemDto({ status }));
37
+ export { checkoutItemDto, checkoutItemProjection };
@@ -0,0 +1,12 @@
1
+ import { CheckoutItemByIdView } from "../../../projection/checkoutItem/viewCheckoutItemById";
2
+ import { HttpPostFunction } from "../../delivery/http/httpClient";
3
+ interface HttpCheckoutItemByIdView extends CheckoutItemByIdView {
4
+ }
5
+ interface HttpCheckoutItemByIdViewFunctionArgs {
6
+ readonly httpPost: HttpPostFunction;
7
+ }
8
+ interface HttpCheckoutItemByIdViewFunction {
9
+ (args: HttpCheckoutItemByIdViewFunctionArgs): HttpCheckoutItemByIdView;
10
+ }
11
+ declare const httpCheckoutItemByIdView: HttpCheckoutItemByIdViewFunction;
12
+ export { httpCheckoutItemByIdView };
@@ -0,0 +1,12 @@
1
+ import { toCheckoutItemProjection } from "./checkoutItem";
2
+ const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
3
+ const response = await httpPost({
4
+ endpoint: "/view-checkout-item-by-id",
5
+ body: { checkout_item_id: checkoutItemId },
6
+ signal,
7
+ });
8
+ return !response.ok || response.status === 404
9
+ ? undefined
10
+ : toCheckoutItemProjection((await response.json()).result);
11
+ };
12
+ export { httpCheckoutItemByIdView };
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { PriceProjection } from "../../../../../projection/checkout/checkout";
2
+ import { PriceProjection } from "../../../../../projection/checkoutItem/checkoutItem";
3
3
  interface PriceProps {
4
4
  readonly price: PriceProjection;
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { QueryStatus } from "@lookiero/messaging-react";
2
2
  import React from "react";
3
3
  import { generatePath, Navigate, Outlet, useMatch } from "react-router";
4
- import { CheckoutItemStatus } from "../../../projection/checkout/checkout";
4
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
5
5
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
6
6
  import { useViewCheckoutIntroShown } from "../../projection/uiSetting/react/useViewCheckoutIntroShown";
7
7
  import { Spinner } from "../components/atoms/spinner/Spinner";
@@ -1,5 +1,4 @@
1
1
  import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
2
- import { useI18nMessage } from "@lookiero/i18n-react";
3
2
  import React from "react";
4
3
  import { StyleSheet, View } from "react-native";
5
4
  import { useParams } from "react-router-native";
@@ -8,9 +7,8 @@ const Item = ({ customerId }) => {
8
7
  const { id } = useParams();
9
8
  const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
10
9
  console.log(checkout);
11
- const itemText = useI18nMessage({ id: "item" });
12
10
  return (React.createElement(View, { style: styles.container },
13
- React.createElement(Text, { heading: true, level: 3 }, itemText),
11
+ React.createElement(Text, { heading: true, level: 3 }, "Item"),
14
12
  React.createElement(Text, { level: 2 }, id)));
15
13
  };
16
14
  const styles = StyleSheet.create({
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { CheckoutItemStatus } from "../../../../../../projection/checkout/checkout";
2
+ import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
3
3
  declare type Status = Exclude<CheckoutItemStatus, CheckoutItemStatus.INITIAL | CheckoutItemStatus.EXPIRED>;
4
4
  interface CustomerDecissionBannerProps {
5
5
  readonly checkoutItemStatus: Status;
@@ -2,7 +2,7 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
2
2
  import { useI18nMessage } from "@lookiero/i18n-react";
3
3
  import React from "react";
4
4
  import { Pressable, View } from "react-native";
5
- import { CheckoutItemStatus } from "../../../../../../projection/checkout/checkout";
5
+ import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
6
6
  import { I18nMessages } from "../../../../i18n/i18n";
7
7
  import { style } from "./CustomerDecissionBanner.style";
8
8
  const i18nMessageForCheckoutItemStatus = {
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { SizeProjection } from "../../../../../../projection/checkout/checkout";
2
+ import { SizeProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
3
  interface ProductVariantActionsProps {
4
4
  readonly sizes: SizeProjection[];
5
5
  readonly size: SizeProjection;
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { ColorProjection, PriceProjection, SizeProjection } from "../../../../../../projection/checkout/checkout";
2
+ import { ColorProjection, PriceProjection, SizeProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
3
  interface ProductVariantDescriptionProps {
4
4
  readonly brand: string;
5
5
  readonly name: string;
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { MediaProjection } from "../../../../../../projection/checkout/checkout";
2
+ import { MediaProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
3
3
  interface ProductVariantSlider {
4
4
  readonly producVariantMedia: MediaProjection[];
5
5
  }
@@ -1,4 +1,4 @@
1
- import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
1
+ import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
2
2
  interface SizeFormat {
3
3
  readonly format: string;
4
4
  readonly length?: string;
@@ -30,7 +30,7 @@ interface ViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction {
30
30
  }
31
31
  declare const viewBookedSizeReplaceableProductVariantsForCheckoutItem: ViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction;
32
32
  declare type ViewBookedSizeReplaceableProductVariantsForCheckoutItemResult = BookedSizeReplaceableProductVariantsProjection | undefined;
33
- interface BookedSizeReplaceableProductVariantsForCheckoutItemViewArgs {
33
+ interface BookedSizeReplaceableProductVariantsForCheckoutItemViewArgs extends CancelableQueryViewArgs {
34
34
  readonly checkoutItemId: string;
35
35
  }
36
36
  interface BookedSizeReplaceableProductVariantsForCheckoutItemView {
@@ -1,8 +1,8 @@
1
- import { query } from "@lookiero/messaging";
1
+ import { query, } from "@lookiero/messaging";
2
2
  const VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_replaceable_product_variants_for_checkout_item";
3
3
  const viewBookedSizeReplaceableProductVariantsForCheckoutItem = (payload) => ({
4
4
  ...query({ name: VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
5
5
  ...payload,
6
6
  });
7
- const viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler = ({ view }) => async ({ checkoutItemId }) => view({ checkoutItemId });
7
+ const viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler = ({ view, signal }) => async ({ checkoutItemId }) => view({ checkoutItemId, signal });
8
8
  export { VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeReplaceableProductVariantsForCheckoutItem, viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler, };
@@ -1,70 +1,5 @@
1
1
  import { CheckoutStatus } from "../../domain/checkout/model/checkout";
2
- declare enum MediaPerspective {
3
- BACK = "BACK",
4
- BOTTOM_UP = "BOTTOM_UP",
5
- COLLAGE = "COLLAGE",
6
- DETAIL = "DETAIL",
7
- FLAT_BACK = "FLAT_BACK",
8
- FRONT = "FRONT",
9
- FRONT_FAR = "FRONT_FAR",
10
- LABEL = "LABEL",
11
- MAIN = "MAIN",
12
- MAIN_TRANSPARENT = "MAIN_TRANSPARENT",
13
- OTHER = "OTHER",
14
- SIDE = "SIDE"
15
- }
16
- interface MediaProjection {
17
- readonly id: string;
18
- readonly url: string;
19
- readonly perspective: MediaPerspective;
20
- }
21
- declare enum Currency {
22
- EUR = "EUR",
23
- GBP = "GBP"
24
- }
25
- interface PriceProjection {
26
- readonly amount: number;
27
- readonly currency: Currency;
28
- readonly discountedPrice?: {
29
- readonly amount: number;
30
- readonly percentage: number;
31
- };
32
- }
33
- interface SizeProjection {
34
- readonly id: string;
35
- readonly lookiero: string;
36
- readonly uk: string;
37
- readonly it: string;
38
- readonly europe: string;
39
- readonly unique: boolean;
40
- readonly visualOrder?: number;
41
- }
42
- interface ColorProjection {
43
- readonly id: string;
44
- readonly label: string;
45
- }
46
- interface CheckoutItemProductVariantProjection {
47
- readonly id: string;
48
- readonly media: MediaProjection[];
49
- readonly brand: string;
50
- readonly name: string;
51
- readonly price: PriceProjection;
52
- readonly size: SizeProjection;
53
- readonly color: ColorProjection;
54
- }
55
- declare enum CheckoutItemStatus {
56
- INITIAL = "INITIAL",
57
- KEPT = "KEPT",
58
- RETURNED = "RETURNED",
59
- REPLACED = "REPLACED",
60
- EXPIRED = "EXPIRED"
61
- }
62
- interface CheckoutItemProjection {
63
- readonly id: string;
64
- readonly status: CheckoutItemStatus;
65
- readonly replacedFor?: string;
66
- readonly productVariant: CheckoutItemProductVariantProjection;
67
- }
2
+ import { CheckoutItemProjection } from "../checkoutItem/checkoutItem";
68
3
  interface CheckoutProjection {
69
4
  readonly id: string;
70
5
  readonly customerId: string;
@@ -74,5 +9,4 @@ interface CheckoutProjection {
74
9
  readonly expiresOn: Date;
75
10
  readonly items: CheckoutItemProjection[];
76
11
  }
77
- export type { CheckoutItemProjection, ColorProjection, MediaProjection, PriceProjection, SizeProjection, CheckoutProjection, };
78
- export { CheckoutItemStatus, MediaPerspective, Currency };
12
+ export type { CheckoutProjection };