@lookiero/checkout 0.2.8 → 0.2.9

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 (82) 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 +1 -0
  14. package/dist/index.js +1 -0
  15. package/dist/infrastructure/delivery/bootstrap.js +13 -4
  16. package/dist/infrastructure/delivery/{_mock/bootstrap.mock.js → bootstrap.mock.js} +14 -13
  17. package/dist/infrastructure/domain/checkout/model/httpCheckouts.d.ts +16 -0
  18. package/dist/infrastructure/domain/checkout/model/httpCheckouts.js +21 -0
  19. package/dist/infrastructure/domain/checkout/model/httpCheckoutsStart.d.ts +5 -0
  20. package/dist/infrastructure/domain/checkout/model/httpCheckoutsStart.js +14 -0
  21. package/dist/infrastructure/domain/checkout/react/useStartCheckout.d.ts +13 -0
  22. package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +10 -0
  23. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +2 -2
  24. package/dist/infrastructure/domain/{react → checkoutBooking/react}/useBookSizeReplaceableProductVariantsForCheckoutItem.js +2 -3
  25. package/dist/infrastructure/domain/{react → uiSetting/react}/useSetCheckoutIntroShown.js +1 -1
  26. package/dist/infrastructure/domain/{react → uiSetting/react}/useUpdateUiSetting.js +2 -2
  27. package/dist/infrastructure/projection/{httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts → bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts} +2 -2
  28. package/dist/infrastructure/projection/{react → bookedSizeReplaceableProductVariants/react}/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +1 -1
  29. package/dist/infrastructure/projection/{react → bookedSizeReplaceableProductVariants/react}/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +2 -2
  30. package/dist/infrastructure/projection/checkout/checkout.d.ts +53 -0
  31. package/dist/infrastructure/projection/{httpFirstAvailableCheckoutByCustomerIdView.js → checkout/checkout.js} +1 -8
  32. package/dist/infrastructure/projection/checkout/checkout.mock.d.ts +17 -0
  33. package/dist/infrastructure/{delivery/_mock → projection/checkout}/checkout.mock.js +13 -10
  34. package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.d.ts +12 -0
  35. package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +9 -0
  36. package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.d.ts +12 -0
  37. package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +9 -0
  38. package/dist/infrastructure/projection/{httpFiveItemsDiscountByCustomerIdView.d.ts → checkout/httpFiveItemsDiscountByCustomerIdView.d.ts} +2 -2
  39. package/dist/infrastructure/projection/{httpIsCheckoutEnabledByCustomerIdView.d.ts → checkout/httpIsCheckoutEnabledByCustomerIdView.d.ts} +2 -2
  40. package/dist/infrastructure/projection/{react → checkout/react}/useViewFirstAvailableCheckoutByCustomerId.d.ts +1 -1
  41. package/dist/infrastructure/projection/{react → checkout/react}/useViewFirstAvailableCheckoutByCustomerId.js +2 -2
  42. package/dist/infrastructure/projection/{react → checkout/react}/useViewFiveItemsDiscountByCustomerId.d.ts +1 -1
  43. package/dist/infrastructure/projection/{react → checkout/react}/useViewFiveItemsDiscountByCustomerId.js +2 -2
  44. package/dist/infrastructure/projection/{react → checkout/react}/useViewIsCheckoutAccessibleByCustomerId.d.ts +1 -1
  45. package/dist/infrastructure/projection/{react → checkout/react}/useViewIsCheckoutAccessibleByCustomerId.js +2 -2
  46. package/dist/infrastructure/projection/uiSetting/react/useViewCheckoutIntroShown.d.ts +2 -0
  47. package/dist/infrastructure/projection/{react → uiSetting/react}/useViewCheckoutIntroShown.js +1 -1
  48. package/dist/infrastructure/projection/{react → uiSetting/react}/useViewUiSettingByKey.d.ts +1 -1
  49. package/dist/infrastructure/projection/{react → uiSetting/react}/useViewUiSettingByKey.js +3 -3
  50. package/dist/infrastructure/projection/{storageUiSettingByKeyView.d.ts → uiSetting/storageUiSettingByKeyView.d.ts} +3 -3
  51. package/dist/infrastructure/ui/Root.js +1 -1
  52. package/dist/infrastructure/ui/components/atoms/price/Price.d.ts +1 -1
  53. package/dist/infrastructure/ui/components/atoms/price/Price.js +2 -2
  54. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -1
  55. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +2 -3
  56. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +3 -3
  57. package/dist/infrastructure/ui/views/intro/Intro.js +6 -6
  58. package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.d.ts +1 -1
  59. package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
  60. package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.d.ts +1 -1
  61. package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.js +2 -2
  62. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +1 -1
  63. package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -3
  64. package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.d.ts +1 -1
  65. package/dist/projection/checkout/checkout.d.ts +78 -0
  66. package/dist/projection/checkout/checkout.js +29 -0
  67. package/dist/projection/checkout/viewCheckoutById.d.ts +25 -0
  68. package/dist/projection/checkout/viewCheckoutById.js +8 -0
  69. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +3 -83
  70. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.js +1 -36
  71. package/package.json +3 -1
  72. package/dist/infrastructure/delivery/_mock/checkout.mock.d.ts +0 -9
  73. package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.d.ts +0 -60
  74. package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.d.ts +0 -2
  75. /package/dist/infrastructure/delivery/{_mock/bootstrap.mock.d.ts → bootstrap.mock.d.ts} +0 -0
  76. /package/dist/infrastructure/domain/{react → checkoutBooking/react}/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -0
  77. /package/dist/infrastructure/domain/{react → uiSetting/react}/useSetCheckoutIntroShown.d.ts +0 -0
  78. /package/dist/infrastructure/domain/{react → uiSetting/react}/useUpdateUiSetting.d.ts +0 -0
  79. /package/dist/infrastructure/projection/{httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js → bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js} +0 -0
  80. /package/dist/infrastructure/projection/{httpFiveItemsDiscountByCustomerIdView.js → checkout/httpFiveItemsDiscountByCustomerIdView.js} +0 -0
  81. /package/dist/infrastructure/projection/{httpIsCheckoutEnabledByCustomerIdView.js → checkout/httpIsCheckoutEnabledByCustomerIdView.js} +0 -0
  82. /package/dist/infrastructure/projection/{storageUiSettingByKeyView.js → uiSetting/storageUiSettingByKeyView.js} +0 -0
@@ -1,6 +1,6 @@
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 { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
4
4
  const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
6
6
  contextId: CHECKOUT_MESSAGING_REACT_ID,
@@ -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,6 +1,6 @@
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 { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
4
4
  const useViewFiveItemsDiscountByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewFiveItemsDiscountByCustomerId({ customerId }),
6
6
  contextId: CHECKOUT_MESSAGING_REACT_ID,
@@ -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,6 +1,6 @@
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 { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
4
4
  const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
6
6
  contextId: CHECKOUT_MESSAGING_REACT_ID,
@@ -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,7 +1,7 @@
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 { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
5
5
  const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
6
6
  const useViewUiSettingByKey = ({ key }) => useQuery({
7
7
  query: viewUiSettingByKey({ key }),
@@ -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) }) => {
@@ -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,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 };
@@ -0,0 +1,25 @@
1
+ import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
2
+ import { CheckoutProjection } from "./checkout";
3
+ declare const VIEW_CHECKOUT_BY_ID = "view_checkout_by_id";
4
+ interface ViewCheckoutByIdPayload {
5
+ readonly checkoutId: string;
6
+ }
7
+ interface ViewCheckoutById extends Query<typeof VIEW_CHECKOUT_BY_ID>, ViewCheckoutByIdPayload {
8
+ }
9
+ interface ViewCheckoutByIdFunction {
10
+ (payload: ViewCheckoutByIdPayload): ViewCheckoutById;
11
+ }
12
+ declare const viewCheckoutById: ViewCheckoutByIdFunction;
13
+ declare type ViewCheckoutByIdResult = CheckoutProjection | undefined;
14
+ interface CheckoutByIdViewArgs {
15
+ readonly checkoutId: string;
16
+ }
17
+ interface CheckoutByIdView {
18
+ (args: CheckoutByIdViewArgs): Promise<ViewCheckoutByIdResult>;
19
+ }
20
+ interface ViewCheckoutByIdHandlerFunctionArgs extends QueryHandlerFunctionArgs {
21
+ readonly view: CheckoutByIdView;
22
+ }
23
+ declare const viewCheckoutByIdHandler: QueryHandlerFunction<ViewCheckoutById, ViewCheckoutByIdResult, ViewCheckoutByIdHandlerFunctionArgs>;
24
+ export type { ViewCheckoutById, CheckoutByIdView, ViewCheckoutByIdResult };
25
+ export { VIEW_CHECKOUT_BY_ID, viewCheckoutById, viewCheckoutByIdHandler };
@@ -0,0 +1,8 @@
1
+ import { query } from "@lookiero/messaging";
2
+ const VIEW_CHECKOUT_BY_ID = "view_checkout_by_id";
3
+ const viewCheckoutById = (payload) => ({
4
+ ...query({ name: VIEW_CHECKOUT_BY_ID }),
5
+ ...payload,
6
+ });
7
+ const viewCheckoutByIdHandler = ({ view }) => async ({ checkoutId }) => view({ checkoutId });
8
+ export { VIEW_CHECKOUT_BY_ID, viewCheckoutById, viewCheckoutByIdHandler };
@@ -1,85 +1,5 @@
1
1
  import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
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
- declare enum CheckoutStatus {
69
- AVAILABLE = "AVAILABLE",
70
- NOTIFIED = "NOTIFIED",
71
- STARTED = "STARTED",
72
- COMPLETED = "COMPLETED"
73
- }
74
- interface CheckoutProjection {
75
- readonly id: string;
76
- readonly customerId: string;
77
- readonly boxId: string;
78
- readonly bookingId: string;
79
- readonly status: CheckoutStatus;
80
- readonly expiresOn: Date;
81
- readonly items: CheckoutItemProjection[];
82
- }
2
+ import { CheckoutProjection } from "./checkout";
83
3
  declare const VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID = "view_first_available_checkout_by_customer_id";
84
4
  interface ViewFirstAvailableCheckoutByCustomerIdPayload {
85
5
  readonly customerId: string;
@@ -101,5 +21,5 @@ interface ViewFirstAvailableCheckoutByCustomerIdHandlerFunctionArgs extends Quer
101
21
  readonly view: FirstAvailableCheckoutByCustomerIdView;
102
22
  }
103
23
  declare const viewFirstAvailableCheckoutByCustomerIdHandler: QueryHandlerFunction<ViewFirstAvailableCheckoutByCustomerId, ViewFirstAvailableCheckoutByCustomerIdResult, ViewFirstAvailableCheckoutByCustomerIdHandlerFunctionArgs>;
104
- export type { CheckoutItemProjection, CheckoutProjection, ColorProjection, FirstAvailableCheckoutByCustomerIdView, MediaProjection, PriceProjection, SizeProjection, };
105
- export { CheckoutStatus, CheckoutItemStatus, MediaPerspective, Currency, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerId, viewFirstAvailableCheckoutByCustomerIdHandler, };
24
+ export type { FirstAvailableCheckoutByCustomerIdView };
25
+ export { VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerId, viewFirstAvailableCheckoutByCustomerIdHandler, };
@@ -1,43 +1,8 @@
1
1
  import { query } from "@lookiero/messaging";
2
- var MediaPerspective;
3
- (function (MediaPerspective) {
4
- MediaPerspective["BACK"] = "BACK";
5
- MediaPerspective["BOTTOM_UP"] = "BOTTOM_UP";
6
- MediaPerspective["COLLAGE"] = "COLLAGE";
7
- MediaPerspective["DETAIL"] = "DETAIL";
8
- MediaPerspective["FLAT_BACK"] = "FLAT_BACK";
9
- MediaPerspective["FRONT"] = "FRONT";
10
- MediaPerspective["FRONT_FAR"] = "FRONT_FAR";
11
- MediaPerspective["LABEL"] = "LABEL";
12
- MediaPerspective["MAIN"] = "MAIN";
13
- MediaPerspective["MAIN_TRANSPARENT"] = "MAIN_TRANSPARENT";
14
- MediaPerspective["OTHER"] = "OTHER";
15
- MediaPerspective["SIDE"] = "SIDE";
16
- })(MediaPerspective || (MediaPerspective = {}));
17
- var Currency;
18
- (function (Currency) {
19
- Currency["EUR"] = "EUR";
20
- Currency["GBP"] = "GBP";
21
- })(Currency || (Currency = {}));
22
- var CheckoutItemStatus;
23
- (function (CheckoutItemStatus) {
24
- CheckoutItemStatus["INITIAL"] = "INITIAL";
25
- CheckoutItemStatus["KEPT"] = "KEPT";
26
- CheckoutItemStatus["RETURNED"] = "RETURNED";
27
- CheckoutItemStatus["REPLACED"] = "REPLACED";
28
- CheckoutItemStatus["EXPIRED"] = "EXPIRED";
29
- })(CheckoutItemStatus || (CheckoutItemStatus = {}));
30
- var CheckoutStatus;
31
- (function (CheckoutStatus) {
32
- CheckoutStatus["AVAILABLE"] = "AVAILABLE";
33
- CheckoutStatus["NOTIFIED"] = "NOTIFIED";
34
- CheckoutStatus["STARTED"] = "STARTED";
35
- CheckoutStatus["COMPLETED"] = "COMPLETED";
36
- })(CheckoutStatus || (CheckoutStatus = {}));
37
2
  const VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID = "view_first_available_checkout_by_customer_id";
38
3
  const viewFirstAvailableCheckoutByCustomerId = (payload) => ({
39
4
  ...query({ name: VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID }),
40
5
  ...payload,
41
6
  });
42
7
  const viewFirstAvailableCheckoutByCustomerIdHandler = ({ view }) => async ({ customerId }) => view({ customerId });
43
- export { CheckoutStatus, CheckoutItemStatus, MediaPerspective, Currency, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerId, viewFirstAvailableCheckoutByCustomerIdHandler, };
8
+ export { VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerId, viewFirstAvailableCheckoutByCustomerIdHandler, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -29,6 +29,7 @@
29
29
  "react-native-get-random-values": "^1.8.0",
30
30
  "react-router-dom": "^6.3.0",
31
31
  "react-router-native": "^6.3.0",
32
+ "tiny-invariant": "^1.2.0",
32
33
  "uuid": "^9.0.0"
33
34
  },
34
35
  "peerDependencies": {
@@ -47,6 +48,7 @@
47
48
  "@testing-library/react": "^13.3.0",
48
49
  "@testing-library/react-hooks": "^8.0.1",
49
50
  "@testing-library/react-native": "^11.0.0",
51
+ "@trivago/prettier-plugin-sort-imports": "^3.3.0",
50
52
  "@types/jest": "^28.1.7",
51
53
  "@types/react": "~18.0.0",
52
54
  "@types/react-dom": "~18.0.0",
@@ -1,9 +0,0 @@
1
- import { CheckoutItemStatus, CheckoutProjection } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
- interface StartedCheckoutWithStatusFunctionArgs {
3
- readonly status: CheckoutItemStatus[];
4
- }
5
- interface StartedCheckoutWithStatusFunction {
6
- (args: StartedCheckoutWithStatusFunctionArgs): CheckoutProjection;
7
- }
8
- declare const startedCheckoutWithItems: StartedCheckoutWithStatusFunction;
9
- export { startedCheckoutWithItems };
@@ -1,60 +0,0 @@
1
- import { CheckoutItemStatus, CheckoutProjection, CheckoutStatus, Currency, FirstAvailableCheckoutByCustomerIdView, MediaPerspective } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
- import { HttpPostFunction } from "../delivery/http/httpClient";
3
- interface CheckoutDto {
4
- readonly id: string;
5
- readonly customer_id: string;
6
- readonly box_id: string;
7
- readonly booking_id: string;
8
- readonly status: CheckoutStatus;
9
- readonly expires_on: string;
10
- readonly items: {
11
- readonly id: string;
12
- readonly status: CheckoutItemStatus;
13
- readonly product_variant: {
14
- readonly id: string;
15
- readonly media: {
16
- readonly id: string;
17
- readonly url: string;
18
- readonly perspective: MediaPerspective;
19
- }[];
20
- readonly brand: string;
21
- readonly name: string;
22
- readonly price: {
23
- readonly amount: number;
24
- readonly currency: Currency;
25
- readonly discounted_price?: {
26
- readonly amount: number;
27
- readonly percentage: number;
28
- };
29
- };
30
- readonly size: {
31
- readonly id: string;
32
- readonly lookiero: string;
33
- readonly uk: string;
34
- readonly it: string;
35
- readonly europe: string;
36
- readonly unique: boolean;
37
- readonly visual_order?: number;
38
- };
39
- readonly color: {
40
- readonly id: string;
41
- readonly label: string;
42
- };
43
- };
44
- readonly replaced_for?: string;
45
- }[];
46
- }
47
- interface ToCheckoutProjectionFunction {
48
- (checkoutDto: CheckoutDto): CheckoutProjection;
49
- }
50
- declare const toCheckoutProjection: ToCheckoutProjectionFunction;
51
- interface HttpFirstAvailableCheckoutByCustomerIdView extends FirstAvailableCheckoutByCustomerIdView {
52
- }
53
- interface HttpFirstAvailableCheckoutByCustomerIdViewFunctionArgs {
54
- readonly httpPost: HttpPostFunction;
55
- }
56
- interface HttpFirstAvailableCheckoutByCustomerIdViewFunction {
57
- (args: HttpFirstAvailableCheckoutByCustomerIdViewFunctionArgs): HttpFirstAvailableCheckoutByCustomerIdView;
58
- }
59
- declare const httpFirstAvailableCheckoutByCustomerIdView: HttpFirstAvailableCheckoutByCustomerIdViewFunction;
60
- export { CheckoutDto, toCheckoutProjection, httpFirstAvailableCheckoutByCustomerIdView };