@lookiero/checkout 0.2.8 → 0.2.10

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 (92) hide show
  1. package/dist/domain/checkout/command/startCheckout.d.ts +12 -0
  2. package/dist/domain/checkout/command/startCheckout.js +4 -0
  3. package/dist/domain/checkout/model/checkout.d.ts +17 -0
  4. package/dist/domain/checkout/model/checkout.js +20 -0
  5. package/dist/domain/checkout/model/checkoutStarted.d.ts +13 -0
  6. package/dist/domain/checkout/model/checkoutStarted.js +4 -0
  7. package/dist/domain/checkout/model/checkouts.d.ts +7 -0
  8. package/dist/domain/checkout/model/checkouts.js +1 -0
  9. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -1
  10. package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +0 -1
  11. package/dist/domain/checkoutBooking/model/checkoutBooking.js +1 -3
  12. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +0 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +1 -0
  15. package/dist/infrastructure/delivery/baseBootstrap.d.ts +31 -0
  16. package/dist/infrastructure/delivery/baseBootstrap.js +33 -0
  17. package/dist/infrastructure/delivery/bootstrap.d.ts +2 -3
  18. package/dist/infrastructure/delivery/bootstrap.js +21 -30
  19. package/dist/infrastructure/delivery/bootstrap.mock.d.ts +3 -0
  20. package/dist/infrastructure/delivery/bootstrap.mock.js +63 -0
  21. package/dist/infrastructure/delivery/http/fetchHttpClient.d.ts +1 -1
  22. package/dist/infrastructure/delivery/http/fetchHttpClient.js +2 -2
  23. package/dist/infrastructure/domain/checkout/model/httpCheckouts.d.ts +16 -0
  24. package/dist/infrastructure/domain/checkout/model/httpCheckouts.js +21 -0
  25. package/dist/infrastructure/domain/checkout/model/httpCheckoutsStart.d.ts +5 -0
  26. package/dist/infrastructure/domain/checkout/model/httpCheckoutsStart.js +14 -0
  27. package/dist/infrastructure/domain/checkout/react/useStartCheckout.d.ts +13 -0
  28. package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +10 -0
  29. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +2 -2
  30. package/dist/infrastructure/domain/{react → checkoutBooking/react}/useBookSizeReplaceableProductVariantsForCheckoutItem.js +2 -3
  31. package/dist/infrastructure/domain/{react → uiSetting/react}/useSetCheckoutIntroShown.js +1 -1
  32. package/dist/infrastructure/domain/{react → uiSetting/react}/useUpdateUiSetting.js +3 -3
  33. package/dist/infrastructure/projection/{httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts → bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts} +2 -2
  34. package/dist/infrastructure/projection/{react → bookedSizeReplaceableProductVariants/react}/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +1 -1
  35. package/dist/infrastructure/projection/{react → bookedSizeReplaceableProductVariants/react}/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +3 -3
  36. package/dist/infrastructure/projection/checkout/checkout.d.ts +53 -0
  37. package/dist/infrastructure/projection/{httpFirstAvailableCheckoutByCustomerIdView.js → checkout/checkout.js} +1 -8
  38. package/dist/infrastructure/projection/checkout/checkout.mock.d.ts +17 -0
  39. package/dist/infrastructure/{delivery/_mock → projection/checkout}/checkout.mock.js +13 -10
  40. package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.d.ts +12 -0
  41. package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +9 -0
  42. package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.d.ts +12 -0
  43. package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +9 -0
  44. package/dist/infrastructure/projection/{httpFiveItemsDiscountByCustomerIdView.d.ts → checkout/httpFiveItemsDiscountByCustomerIdView.d.ts} +2 -2
  45. package/dist/infrastructure/projection/{httpIsCheckoutEnabledByCustomerIdView.d.ts → checkout/httpIsCheckoutEnabledByCustomerIdView.d.ts} +2 -2
  46. package/dist/infrastructure/projection/{react → checkout/react}/useViewFirstAvailableCheckoutByCustomerId.d.ts +1 -1
  47. package/dist/infrastructure/projection/{react → checkout/react}/useViewFirstAvailableCheckoutByCustomerId.js +3 -3
  48. package/dist/infrastructure/projection/{react → checkout/react}/useViewFiveItemsDiscountByCustomerId.d.ts +1 -1
  49. package/dist/infrastructure/projection/{react → checkout/react}/useViewFiveItemsDiscountByCustomerId.js +3 -3
  50. package/dist/infrastructure/projection/{react → checkout/react}/useViewIsCheckoutAccessibleByCustomerId.d.ts +1 -1
  51. package/dist/infrastructure/projection/{react → checkout/react}/useViewIsCheckoutAccessibleByCustomerId.js +3 -3
  52. package/dist/infrastructure/projection/uiSetting/react/useViewCheckoutIntroShown.d.ts +2 -0
  53. package/dist/infrastructure/projection/{react → uiSetting/react}/useViewCheckoutIntroShown.js +1 -1
  54. package/dist/infrastructure/projection/{react → uiSetting/react}/useViewUiSettingByKey.d.ts +1 -1
  55. package/dist/infrastructure/projection/{react → uiSetting/react}/useViewUiSettingByKey.js +4 -4
  56. package/dist/infrastructure/projection/{storageUiSettingByKeyView.d.ts → uiSetting/storageUiSettingByKeyView.d.ts} +3 -3
  57. package/dist/infrastructure/ui/Root.js +1 -1
  58. package/dist/infrastructure/ui/components/atoms/price/Price.d.ts +1 -1
  59. package/dist/infrastructure/ui/components/atoms/price/Price.js +2 -2
  60. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -1
  61. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +2 -3
  62. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +3 -3
  63. package/dist/infrastructure/ui/routing/Routing.js +1 -1
  64. package/dist/infrastructure/ui/views/intro/Intro.js +6 -6
  65. package/dist/infrastructure/ui/views/item/Item.d.ts +4 -1
  66. package/dist/infrastructure/ui/views/item/Item.js +4 -1
  67. package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.d.ts +1 -1
  68. package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
  69. package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.d.ts +1 -1
  70. package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.js +2 -2
  71. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +1 -1
  72. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -3
  73. package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.d.ts +1 -1
  74. package/dist/projection/checkout/checkout.d.ts +78 -0
  75. package/dist/projection/checkout/checkout.js +29 -0
  76. package/dist/projection/checkout/viewCheckoutById.d.ts +25 -0
  77. package/dist/projection/checkout/viewCheckoutById.js +8 -0
  78. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +3 -83
  79. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.js +1 -36
  80. package/package.json +3 -1
  81. package/dist/infrastructure/delivery/_mock/bootstrap.mock.d.ts +0 -6
  82. package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +0 -33
  83. package/dist/infrastructure/delivery/_mock/checkout.mock.d.ts +0 -9
  84. package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.d.ts +0 -60
  85. package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.d.ts +0 -2
  86. /package/dist/infrastructure/domain/{react → checkoutBooking/react}/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -0
  87. /package/dist/infrastructure/domain/{react → uiSetting/react}/useSetCheckoutIntroShown.d.ts +0 -0
  88. /package/dist/infrastructure/domain/{react → uiSetting/react}/useUpdateUiSetting.d.ts +0 -0
  89. /package/dist/infrastructure/projection/{httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js → bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js} +0 -0
  90. /package/dist/infrastructure/projection/{httpFiveItemsDiscountByCustomerIdView.js → checkout/httpFiveItemsDiscountByCustomerIdView.js} +0 -0
  91. /package/dist/infrastructure/projection/{httpIsCheckoutEnabledByCustomerIdView.js → checkout/httpIsCheckoutEnabledByCustomerIdView.js} +0 -0
  92. /package/dist/infrastructure/projection/{storageUiSettingByKeyView.js → uiSetting/storageUiSettingByKeyView.js} +0 -0
@@ -0,0 +1,53 @@
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
+ }
39
+ interface CheckoutDto {
40
+ readonly id: string;
41
+ readonly customer_id: string;
42
+ readonly box_id: string;
43
+ readonly booking_id: string;
44
+ readonly status: CheckoutStatus;
45
+ readonly expires_on: string;
46
+ readonly items: CheckoutItemDto[];
47
+ }
48
+ interface ToCheckoutProjectionFunction {
49
+ (checkoutDto: CheckoutDto): CheckoutProjection;
50
+ }
51
+ declare const toCheckoutProjection: ToCheckoutProjectionFunction;
52
+ export type { CheckoutDto, CheckoutItemDto };
53
+ export { toCheckoutProjection };
@@ -44,11 +44,4 @@ const toCheckoutProjection = (checkoutDto) => ({
44
44
  },
45
45
  })),
46
46
  });
47
- const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId }) => {
48
- const response = await httpPost({
49
- endpoint: "/view-first-available-checkout-by-customer-id",
50
- body: { customer_id: customerId },
51
- });
52
- return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
53
- };
54
- export { toCheckoutProjection, httpFirstAvailableCheckoutByCustomerIdView };
47
+ export { toCheckoutProjection };
@@ -0,0 +1,17 @@
1
+ import { CheckoutItemStatus, CheckoutProjection } from "../../../projection/checkout/checkout";
2
+ import { CheckoutDto } from "./checkout";
3
+ interface StartedCheckoutWithStatusDtoFunctionArgs {
4
+ readonly status: CheckoutItemStatus[];
5
+ }
6
+ interface StartedCheckoutWithStatusDtoFunction {
7
+ (args: StartedCheckoutWithStatusDtoFunctionArgs): CheckoutDto;
8
+ }
9
+ declare const startedCheckoutWithStatusDto: StartedCheckoutWithStatusDtoFunction;
10
+ interface StartedCheckoutWithStatusProjectionFunctionArgs {
11
+ readonly status: CheckoutItemStatus[];
12
+ }
13
+ interface StartedCheckoutWithStatusProjectionFunction {
14
+ (args: StartedCheckoutWithStatusProjectionFunctionArgs): CheckoutProjection;
15
+ }
16
+ declare const startedCheckoutWithStatusProjection: StartedCheckoutWithStatusProjectionFunction;
17
+ export { startedCheckoutWithStatusDto, startedCheckoutWithStatusProjection };
@@ -1,9 +1,11 @@
1
1
  import { v4 as uuid } from "uuid";
2
- import { CheckoutStatus, Currency, MediaPerspective, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
- const checkoutItem = ({ status }) => ({
2
+ import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
3
+ import { Currency, MediaPerspective, } from "../../../projection/checkout/checkout";
4
+ import { toCheckoutProjection } from "./checkout";
5
+ const checkoutItemDto = ({ status }) => ({
4
6
  id: uuid(),
5
7
  status,
6
- productVariant: {
8
+ product_variant: {
7
9
  id: uuid(),
8
10
  media: [
9
11
  {
@@ -32,14 +34,15 @@ const checkoutItem = ({ status }) => ({
32
34
  },
33
35
  },
34
36
  });
35
- const checkoutWithItems = ({ items }) => ({
37
+ const checkoutWithItemsDto = ({ items }) => ({
36
38
  id: uuid(),
37
39
  status: CheckoutStatus.STARTED,
38
- customerId: uuid(),
39
- boxId: uuid(),
40
- bookingId: uuid(),
41
- expiresOn: new Date("2022-09-20"),
40
+ customer_id: uuid(),
41
+ box_id: uuid(),
42
+ booking_id: uuid(),
43
+ expires_on: "2022-09-20",
42
44
  items,
43
45
  });
44
- const startedCheckoutWithItems = ({ status }) => checkoutWithItems({ items: status.map((status) => checkoutItem({ status })) });
45
- export { startedCheckoutWithItems };
46
+ const startedCheckoutWithStatusDto = ({ status }) => checkoutWithItemsDto({ items: status.map((status) => checkoutItemDto({ status })) });
47
+ const startedCheckoutWithStatusProjection = ({ status }) => toCheckoutProjection(startedCheckoutWithStatusDto({ status }));
48
+ export { startedCheckoutWithStatusDto, startedCheckoutWithStatusProjection };
@@ -0,0 +1,12 @@
1
+ import { CheckoutByIdView } from "../../../projection/checkout/viewCheckoutById";
2
+ import { HttpPostFunction } from "../../delivery/http/httpClient";
3
+ interface HttpCheckoutByIdView extends CheckoutByIdView {
4
+ }
5
+ interface HttpCheckoutByIdViewFunctionArgs {
6
+ readonly httpPost: HttpPostFunction;
7
+ }
8
+ interface HttpCheckoutByIdViewFunction {
9
+ (args: HttpCheckoutByIdViewFunctionArgs): HttpCheckoutByIdView;
10
+ }
11
+ declare const httpCheckoutByIdView: HttpCheckoutByIdViewFunction;
12
+ export { httpCheckoutByIdView };
@@ -0,0 +1,9 @@
1
+ import { toCheckoutProjection } from "./checkout";
2
+ const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId }) => {
3
+ const response = await httpPost({
4
+ endpoint: "/view-checkout-by-id",
5
+ body: { checkout_id: checkoutId },
6
+ });
7
+ return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
8
+ };
9
+ export { httpCheckoutByIdView };
@@ -0,0 +1,12 @@
1
+ import { FirstAvailableCheckoutByCustomerIdView } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { HttpPostFunction } from "../../delivery/http/httpClient";
3
+ interface HttpFirstAvailableCheckoutByCustomerIdView extends FirstAvailableCheckoutByCustomerIdView {
4
+ }
5
+ interface HttpFirstAvailableCheckoutByCustomerIdViewFunctionArgs {
6
+ readonly httpPost: HttpPostFunction;
7
+ }
8
+ interface HttpFirstAvailableCheckoutByCustomerIdViewFunction {
9
+ (args: HttpFirstAvailableCheckoutByCustomerIdViewFunctionArgs): HttpFirstAvailableCheckoutByCustomerIdView;
10
+ }
11
+ declare const httpFirstAvailableCheckoutByCustomerIdView: HttpFirstAvailableCheckoutByCustomerIdViewFunction;
12
+ export { httpFirstAvailableCheckoutByCustomerIdView };
@@ -0,0 +1,9 @@
1
+ import { toCheckoutProjection } from "./checkout";
2
+ const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId }) => {
3
+ const response = await httpPost({
4
+ endpoint: "/view-first-available-checkout-by-customer-id",
5
+ body: { customer_id: customerId },
6
+ });
7
+ return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
8
+ };
9
+ export { httpFirstAvailableCheckoutByCustomerIdView };
@@ -1,5 +1,5 @@
1
- import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
2
- import { HttpGetFunction } from "../delivery/http/httpClient";
1
+ import { FiveItemsDiscountByCustomerIdView } from "../../../projection/checkout/viewFiveItemsDiscountByCustomerId";
2
+ import { HttpGetFunction } from "../../delivery/http/httpClient";
3
3
  interface HttpFiveItemsDiscountByCustomerIdView extends FiveItemsDiscountByCustomerIdView {
4
4
  }
5
5
  interface HttpFiveItemsDiscountByCustomerIdViewFunctionArgs {
@@ -1,5 +1,5 @@
1
- import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
2
- import { HttpGetFunction } from "../delivery/http/httpClient";
1
+ import { IsCheckoutEnabledByCustomerIdView } from "../../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
2
+ import { HttpGetFunction } from "../../delivery/http/httpClient";
3
3
  interface HttpIsCheckoutEnabledByCustomerIdView extends IsCheckoutEnabledByCustomerIdView {
4
4
  }
5
5
  interface HttpIsCheckoutEnabledByCustomerIdViewFunctionArgs {
@@ -1,5 +1,5 @@
1
1
  import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
- import { CheckoutProjection } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { CheckoutProjection } from "../../../../projection/checkout/checkout";
3
3
  interface UseViewFirstAvailableCheckoutByCustomerIdFunctionArgs {
4
4
  readonly customerId: string;
5
5
  }
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { viewFirstAvailableCheckoutByCustomerId, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
2
+ import { viewFirstAvailableCheckoutByCustomerId } from "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
4
  const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
6
- contextId: CHECKOUT_MESSAGING_REACT_ID,
6
+ contextId: MESSAGING_CONTEXT_ID,
7
7
  options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
8
8
  });
9
9
  export { useViewFirstAvailableCheckoutByCustomerId };
@@ -1,5 +1,5 @@
1
1
  import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
- import { FiveItemsDiscountByCustomerIdProjection } from "../../../projection/checkout/viewFiveItemsDiscountByCustomerId";
2
+ import { FiveItemsDiscountByCustomerIdProjection } from "../../../../projection/checkout/viewFiveItemsDiscountByCustomerId";
3
3
  interface UseViewFiveItemsDiscountByCustomerIdFunctionArgs {
4
4
  readonly customerId: string;
5
5
  }
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { viewFiveItemsDiscountByCustomerId, } from "../../../projection/checkout/viewFiveItemsDiscountByCustomerId";
3
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
2
+ import { viewFiveItemsDiscountByCustomerId, } from "../../../../projection/checkout/viewFiveItemsDiscountByCustomerId";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
4
  const useViewFiveItemsDiscountByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewFiveItemsDiscountByCustomerId({ customerId }),
6
- contextId: CHECKOUT_MESSAGING_REACT_ID,
6
+ contextId: MESSAGING_CONTEXT_ID,
7
7
  options: { staleTime: Infinity },
8
8
  });
9
9
  export { useViewFiveItemsDiscountByCustomerId };
@@ -1,5 +1,5 @@
1
1
  import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
- import { IsCheckoutAccessibleByCustomerIdProjection } from "../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
2
+ import { IsCheckoutAccessibleByCustomerIdProjection } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
3
3
  interface UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs {
4
4
  readonly customerId: string | undefined;
5
5
  }
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { viewIsCheckoutAccessibleByCustomerId, } from "../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
3
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
2
+ import { viewIsCheckoutAccessibleByCustomerId, } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
4
  const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
6
- contextId: CHECKOUT_MESSAGING_REACT_ID,
6
+ contextId: MESSAGING_CONTEXT_ID,
7
7
  options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
8
8
  });
9
9
  export { useViewIsCheckoutAccessibleByCustomerId };
@@ -0,0 +1,2 @@
1
+ declare const useViewCheckoutIntroShown: () => import("@lookiero/messaging-react").UseQueryFunctionResult<import("../../../../projection/uiSetting/viewUiSettingByKey").UiSettingProjection>;
2
+ export { useViewCheckoutIntroShown };
@@ -1,4 +1,4 @@
1
- import { UISettings } from "../../ui/settings/UISettings";
1
+ import { UISettings } from "../../../ui/settings/UISettings";
2
2
  import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
3
3
  const useViewCheckoutIntroShown = () => useViewUiSettingByKey({
4
4
  key: UISettings.CHECKOUT_INTRO_SHOWN,
@@ -1,5 +1,5 @@
1
1
  import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
- import { UiSettingProjection } from "../../../projection/uiSetting/viewUiSettingByKey";
2
+ import { UiSettingProjection } from "../../../../projection/uiSetting/viewUiSettingByKey";
3
3
  interface UseViewUiSettingByKeyFunctionArgs {
4
4
  readonly key: string;
5
5
  }
@@ -1,11 +1,11 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { UI_SETTING_UPDATED } from "../../../domain/uiSetting/model/uiSettingUpdated";
3
- import { viewUiSettingByKey } from "../../../projection/uiSetting/viewUiSettingByKey";
4
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
2
+ import { UI_SETTING_UPDATED } from "../../../../domain/uiSetting/model/uiSettingUpdated";
3
+ import { viewUiSettingByKey } from "../../../../projection/uiSetting/viewUiSettingByKey";
4
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
5
  const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
6
6
  const useViewUiSettingByKey = ({ key }) => useQuery({
7
7
  query: viewUiSettingByKey({ key }),
8
- contextId: CHECKOUT_MESSAGING_REACT_ID,
8
+ contextId: MESSAGING_CONTEXT_ID,
9
9
  invalidation: isUiSettingUpdated,
10
10
  options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
11
11
  });
@@ -1,6 +1,6 @@
1
- import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKey";
2
- import { ReadFunction } from "../persistence/storage";
3
- import { UiSettingDto } from "../persistence/uiSettingData";
1
+ import { UiSettingByKeyView } from "../../../projection/uiSetting/viewUiSettingByKey";
2
+ import { ReadFunction } from "../../persistence/storage";
3
+ import { UiSettingDto } from "../../persistence/uiSettingData";
4
4
  interface StorageUiSettingByKeyView extends UiSettingByKeyView {
5
5
  }
6
6
  interface StorageUiSettingByKeyViewFunctionArgs {
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback } from "react";
2
2
  import { Platform } from "react-native";
3
- import { Router } from "./routing/router/Router";
4
3
  import { Routing } from "./routing/Routing";
4
+ import { Router } from "./routing/router/Router";
5
5
  const root = ({ Messaging, I18n, development }) =>
6
6
  // eslint-disable-next-line react/display-name, react/prop-types
7
7
  ({ locale = "en", customerId, onNotAccessible }) => {
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { PriceProjection } from "../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { PriceProjection } from "../../../../../projection/checkout/checkout";
3
3
  interface PriceProps {
4
4
  readonly price: PriceProjection;
5
5
  }
@@ -1,7 +1,7 @@
1
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
2
+ import { useI18nNumber } from "@lookiero/i18n-react";
1
3
  import React from "react";
2
4
  import { View } from "react-native";
3
- import { useI18nNumber } from "@lookiero/i18n-react";
4
- import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
5
5
  import { style } from "./Price.style";
6
6
  const Price = ({ price }) => {
7
7
  const isDiscounted = price.discountedPrice && price.discountedPrice.percentage !== 0;
@@ -1,4 +1,3 @@
1
- import "react-native-get-random-values";
2
1
  import { FC } from "react";
3
2
  interface CheckoutAccessibilityMiddlewareProps {
4
3
  readonly customerId: string | undefined;
@@ -1,9 +1,8 @@
1
- import "react-native-get-random-values";
1
+ import { QueryStatus } from "@lookiero/messaging-react";
2
2
  import React, { useEffect, useRef } from "react";
3
3
  import { Outlet } from "react-router-native";
4
- import { useViewIsCheckoutAccessibleByCustomerId } from "../../projection/react/useViewIsCheckoutAccessibleByCustomerId";
4
+ import { useViewIsCheckoutAccessibleByCustomerId } from "../../projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId";
5
5
  import { Spinner } from "../components/atoms/spinner/Spinner";
6
- import { QueryStatus } from "@lookiero/messaging-react";
7
6
  const CheckoutAccessibilityMiddleware = ({ customerId, onNotAccessible, loader = React.createElement(Spinner, null), }) => {
8
7
  const [accessible, status] = useViewIsCheckoutAccessibleByCustomerId({ customerId });
9
8
  const onNotAccessibleRef = useRef(onNotAccessible);
@@ -1,9 +1,9 @@
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/viewFirstAvailableCheckoutByCustomerId";
5
- import { useViewCheckoutIntroShown } from "../../projection/react/useViewCheckoutIntroShown";
6
- import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/react/useViewFirstAvailableCheckoutByCustomerId";
4
+ import { CheckoutItemStatus } from "../../../projection/checkout/checkout";
5
+ import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
6
+ import { useViewCheckoutIntroShown } from "../../projection/uiSetting/react/useViewCheckoutIntroShown";
7
7
  import { Spinner } from "../components/atoms/spinner/Spinner";
8
8
  import { Routes } from "./routes";
9
9
  const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null) }) => {
@@ -30,7 +30,7 @@ const Routing = ({ onNotAccessible, customerId, locale, I18n, onI18nError }) =>
30
30
  {
31
31
  path: Routes.ITEM,
32
32
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
33
- React.createElement(Item, null))),
33
+ React.createElement(Item, { customerId: customerId }))),
34
34
  },
35
35
  {
36
36
  path: Routes.SUMMARY,
@@ -1,15 +1,15 @@
1
1
  import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
- import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
3
- import { I18nMessages } from "../../i18n/i18n";
4
2
  import { Icon } from "@lookiero/aurora-next/build/components/primitives/Icon/Icon";
5
- import { Spinner } from "../../components/atoms/spinner/Spinner";
6
3
  import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
7
4
  import { useI18nMessage } from "@lookiero/i18n-react";
8
- import { useSetCheckoutIntroShown } from "../../../domain/react/useSetCheckoutIntroShown";
9
- import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/react/useViewFiveItemsDiscountByCustomerId";
10
- import { View } from "react-native";
5
+ import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
11
6
  import React, { useCallback } from "react";
7
+ import { View } from "react-native";
8
+ import { useSetCheckoutIntroShown } from "../../../domain/uiSetting/react/useSetCheckoutIntroShown";
9
+ import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
10
+ import { Spinner } from "../../components/atoms/spinner/Spinner";
12
11
  import { Body } from "../../components/layouts/body/Body";
12
+ import { I18nMessages } from "../../i18n/i18n";
13
13
  import { style } from "./Intro.style";
14
14
  const Bullet = ({ text }) => (React.createElement(View, { style: style.bullet },
15
15
  React.createElement(Icon, { name: "rounded-tick", style: style.tickIcon }),
@@ -1,3 +1,6 @@
1
1
  import { FC } from "react";
2
- declare const Item: FC;
2
+ interface ItemProps {
3
+ readonly customerId: string;
4
+ }
5
+ declare const Item: FC<ItemProps>;
3
6
  export { Item };
@@ -3,8 +3,11 @@ import { useI18nMessage } from "@lookiero/i18n-react";
3
3
  import React from "react";
4
4
  import { StyleSheet, View } from "react-native";
5
5
  import { useParams } from "react-router-native";
6
- const Item = () => {
6
+ import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
7
+ const Item = ({ customerId }) => {
7
8
  const { id } = useParams();
9
+ const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
10
+ console.log(checkout);
8
11
  const itemText = useI18nMessage({ id: "item" });
9
12
  return (React.createElement(View, { style: styles.container },
10
13
  React.createElement(Text, { heading: true, level: 3 }, itemText),
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { CheckoutItemStatus } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { CheckoutItemStatus } from "../../../../../../projection/checkout/checkout";
3
3
  declare type Status = Exclude<CheckoutItemStatus, CheckoutItemStatus.INITIAL | CheckoutItemStatus.EXPIRED>;
4
4
  interface CustomerDecissionBannerProps {
5
5
  readonly checkoutItemStatus: Status;
@@ -1,9 +1,9 @@
1
- import React from "react";
2
- import { Pressable, View } from "react-native";
3
1
  import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
4
2
  import { useI18nMessage } from "@lookiero/i18n-react";
3
+ import React from "react";
4
+ import { Pressable, View } from "react-native";
5
+ import { CheckoutItemStatus } from "../../../../../../projection/checkout/checkout";
5
6
  import { I18nMessages } from "../../../../i18n/i18n";
6
- import { CheckoutItemStatus } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
7
7
  import { style } from "./CustomerDecissionBanner.style";
8
8
  const i18nMessageForCheckoutItemStatus = {
9
9
  [CheckoutItemStatus.KEPT]: I18nMessages.ITEM_BANNER_CUSTOMER_KEPT_DECISSION,
@@ -1,5 +1,5 @@
1
- import { SizeProjection } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
1
  import { FC } from "react";
2
+ import { SizeProjection } from "../../../../../../projection/checkout/checkout";
3
3
  interface ProductVariantActionsProps {
4
4
  readonly sizes: SizeProjection[];
5
5
  readonly size: SizeProjection;
@@ -1,10 +1,10 @@
1
1
  import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
2
  import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
3
3
  import { InputField } from "@lookiero/aurora-next/build/components/atoms/InputField/InputField";
4
- import { I18nMessages } from "../../../../i18n/i18n";
5
4
  import { useI18nMessage } from "@lookiero/i18n-react";
6
- import { View } from "react-native";
7
5
  import React, { useMemo } from "react";
6
+ import { View } from "react-native";
7
+ import { I18nMessages } from "../../../../i18n/i18n";
8
8
  import { style } from "./ProductVariantActions.style";
9
9
  const ProductVariantActions = ({ sizes, size, onKeep, onReplace, onReturn }) => {
10
10
  const sizeSelectorLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { ColorProjection, PriceProjection, SizeProjection } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { ColorProjection, PriceProjection, SizeProjection } from "../../../../../../projection/checkout/checkout";
3
3
  interface ProductVariantDescriptionProps {
4
4
  readonly brand: string;
5
5
  readonly name: string;
@@ -1,9 +1,9 @@
1
- import React from "react";
2
- import { View } from "react-native";
3
1
  import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
4
2
  import { useI18nMessage } from "@lookiero/i18n-react";
5
- import { I18nMessages } from "../../../../i18n/i18n";
3
+ import React from "react";
4
+ import { View } from "react-native";
6
5
  import { Price } from "../../../../components/atoms/price/Price";
6
+ import { I18nMessages } from "../../../../i18n/i18n";
7
7
  import { style } from "./ProductVariantDescription.style";
8
8
  const ProductVariantDescription = ({ brand, name, price, size, color }) => {
9
9
  const sizeText = useI18nMessage({ id: I18nMessages.ITEM_SIZE });
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { MediaProjection } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { MediaProjection } from "../../../../../../projection/checkout/checkout";
3
3
  interface ProductVariantSlider {
4
4
  readonly producVariantMedia: MediaProjection[];
5
5
  }
@@ -0,0 +1,78 @@
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
+ }
68
+ interface CheckoutProjection {
69
+ readonly id: string;
70
+ readonly customerId: string;
71
+ readonly boxId: string;
72
+ readonly bookingId: string;
73
+ readonly status: CheckoutStatus;
74
+ readonly expiresOn: Date;
75
+ readonly items: CheckoutItemProjection[];
76
+ }
77
+ export type { CheckoutItemProjection, ColorProjection, MediaProjection, PriceProjection, SizeProjection, CheckoutProjection, };
78
+ export { CheckoutItemStatus, MediaPerspective, Currency };
@@ -0,0 +1,29 @@
1
+ var MediaPerspective;
2
+ (function (MediaPerspective) {
3
+ MediaPerspective["BACK"] = "BACK";
4
+ MediaPerspective["BOTTOM_UP"] = "BOTTOM_UP";
5
+ MediaPerspective["COLLAGE"] = "COLLAGE";
6
+ MediaPerspective["DETAIL"] = "DETAIL";
7
+ MediaPerspective["FLAT_BACK"] = "FLAT_BACK";
8
+ MediaPerspective["FRONT"] = "FRONT";
9
+ MediaPerspective["FRONT_FAR"] = "FRONT_FAR";
10
+ MediaPerspective["LABEL"] = "LABEL";
11
+ MediaPerspective["MAIN"] = "MAIN";
12
+ MediaPerspective["MAIN_TRANSPARENT"] = "MAIN_TRANSPARENT";
13
+ MediaPerspective["OTHER"] = "OTHER";
14
+ MediaPerspective["SIDE"] = "SIDE";
15
+ })(MediaPerspective || (MediaPerspective = {}));
16
+ var Currency;
17
+ (function (Currency) {
18
+ Currency["EUR"] = "EUR";
19
+ Currency["GBP"] = "GBP";
20
+ })(Currency || (Currency = {}));
21
+ var CheckoutItemStatus;
22
+ (function (CheckoutItemStatus) {
23
+ CheckoutItemStatus["INITIAL"] = "INITIAL";
24
+ CheckoutItemStatus["KEPT"] = "KEPT";
25
+ CheckoutItemStatus["RETURNED"] = "RETURNED";
26
+ CheckoutItemStatus["REPLACED"] = "REPLACED";
27
+ CheckoutItemStatus["EXPIRED"] = "EXPIRED";
28
+ })(CheckoutItemStatus || (CheckoutItemStatus = {}));
29
+ export { CheckoutItemStatus, MediaPerspective, Currency };