@lookiero/checkout 0.8.9-beta.0 → 0.8.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 (73) hide show
  1. package/dist/domain/checkoutItem/command/resetCheckoutItem.d.ts +13 -0
  2. package/dist/domain/checkoutItem/command/resetCheckoutItem.js +4 -0
  3. package/dist/domain/checkoutItem/model/checkoutItem.d.ts +3 -1
  4. package/dist/domain/checkoutItem/model/checkoutItem.js +9 -1
  5. package/dist/domain/checkoutItem/model/checkoutItemReset.d.ts +13 -0
  6. package/dist/domain/checkoutItem/model/checkoutItemReset.js +4 -0
  7. package/dist/infrastructure/delivery/baseBootstrap.js +3 -1
  8. package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItems.js +2 -0
  9. package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsReset.d.ts +5 -0
  10. package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsReset.js +13 -0
  11. package/dist/infrastructure/domain/checkoutItem/react/useResetCheckoutItem.d.ts +15 -0
  12. package/dist/infrastructure/domain/checkoutItem/react/useResetCheckoutItem.js +27 -0
  13. package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +3 -0
  14. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +1 -7
  15. package/dist/infrastructure/ui/views/item/Item.js +9 -1
  16. package/dist/shared/ui/components/layouts/modal/Modal.js +2 -3
  17. package/dist/shared/ui/components/layouts/modal/Modal.style.d.ts +0 -1
  18. package/dist/shared/ui/components/layouts/modal/Modal.style.js +0 -1
  19. package/package.json +1 -2
  20. package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
  21. package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
  22. package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
  23. package/dist/domain/checkout/model/checkoutPaid.js +0 -4
  24. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
  25. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
  26. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +0 -13
  27. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +0 -16
  28. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
  29. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +0 -14
  30. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
  31. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
  32. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +0 -12
  33. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +0 -9
  34. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +0 -10
  35. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +0 -12
  36. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +0 -12
  37. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +0 -9
  38. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +0 -6
  39. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +0 -7
  40. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +0 -6
  41. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +0 -9
  42. package/dist/infrastructure/ui/views/App.style.d.ts +0 -4
  43. package/dist/infrastructure/ui/views/App.style.js +0 -16
  44. package/dist/infrastructure/ui/views/header/Header.d.ts +0 -15
  45. package/dist/infrastructure/ui/views/header/Header.js +0 -90
  46. package/dist/infrastructure/ui/views/header/Header.style.d.ts +0 -35
  47. package/dist/infrastructure/ui/views/header/Header.style.js +0 -38
  48. package/dist/infrastructure/ui/views/header/components/Logo.d.ts +0 -7
  49. package/dist/infrastructure/ui/views/header/components/Logo.js +0 -11
  50. package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +0 -7
  51. package/dist/infrastructure/ui/views/header/components/Logo.style.js +0 -8
  52. package/dist/infrastructure/ui/views/intro/Intro.d.ts +0 -6
  53. package/dist/infrastructure/ui/views/intro/Intro.js +0 -52
  54. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -55
  55. package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -58
  56. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -10
  57. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +0 -1
  58. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +0 -25
  59. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +0 -8
  60. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +0 -25
  61. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +0 -8
  62. package/dist/shared/logging/location.d.ts +0 -3
  63. package/dist/shared/logging/location.js +0 -5
  64. package/dist/shared/logging/matchRoutes.d.ts +0 -3
  65. package/dist/shared/logging/matchRoutes.js +0 -7
  66. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +0 -29
  67. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +0 -134
  68. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +0 -22
  69. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +0 -15
  70. package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +0 -27
  71. package/dist/shared/logging/reactRouterV6Instrumentation.native.js +0 -115
  72. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +0 -1
  73. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +0 -9
@@ -0,0 +1,13 @@
1
+ import { Command } from "@lookiero/messaging";
2
+ declare const RESET_CHECKOUT_ITEM = "reset_checkout_item";
3
+ interface ResetCheckoutItemPayload {
4
+ readonly aggregateId: string;
5
+ }
6
+ interface ResetCheckoutItem extends Command<typeof RESET_CHECKOUT_ITEM>, ResetCheckoutItemPayload {
7
+ }
8
+ interface ResetCheckoutItemFunction {
9
+ (payload: ResetCheckoutItemPayload): ResetCheckoutItem;
10
+ }
11
+ declare const resetCheckoutItem: ResetCheckoutItemFunction;
12
+ export type { ResetCheckoutItem };
13
+ export { RESET_CHECKOUT_ITEM, resetCheckoutItem };
@@ -0,0 +1,4 @@
1
+ import { command } from "@lookiero/messaging";
2
+ const RESET_CHECKOUT_ITEM = "reset_checkout_item";
3
+ const resetCheckoutItem = ({ aggregateId }) => command({ aggregateId, name: RESET_CHECKOUT_ITEM });
4
+ export { RESET_CHECKOUT_ITEM, resetCheckoutItem };
@@ -1,6 +1,7 @@
1
1
  import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
2
2
  import { KeepCheckoutItem } from "../command/keepCheckoutItem";
3
3
  import { ReplaceCheckoutItem } from "../command/replaceCheckoutItem";
4
+ import { ResetCheckoutItem } from "../command/resetCheckoutItem";
4
5
  import { ReturnCheckoutItem } from "../command/returnCheckoutItem";
5
6
  import { Feedbacks } from "./feedbacks";
6
7
  import { Price } from "./price";
@@ -19,5 +20,6 @@ interface CheckoutItem extends AggregateRoot {
19
20
  declare const keepCheckoutItemHandler: CommandHandlerFunction<KeepCheckoutItem, CheckoutItem>;
20
21
  declare const returnCheckoutItemHandler: CommandHandlerFunction<ReturnCheckoutItem, CheckoutItem>;
21
22
  declare const replaceCheckoutItemHandler: CommandHandlerFunction<ReplaceCheckoutItem, CheckoutItem>;
23
+ declare const resetCheckoutItemHandler: CommandHandlerFunction<ResetCheckoutItem, CheckoutItem>;
22
24
  export type { CheckoutItem };
23
- export { CheckoutItemStatus, keepCheckoutItemHandler, returnCheckoutItemHandler, replaceCheckoutItemHandler };
25
+ export { CheckoutItemStatus, keepCheckoutItemHandler, returnCheckoutItemHandler, replaceCheckoutItemHandler, resetCheckoutItemHandler, };
@@ -1,5 +1,6 @@
1
1
  import { checkoutItemKept } from "./checkoutItemKept";
2
2
  import { checkoutItemReplaced } from "./checkoutItemReplaced";
3
+ import { checkoutItemReset } from "./checkoutItemReset";
3
4
  import { checkoutItemReturned } from "./checkoutItemReturned";
4
5
  var CheckoutItemStatus;
5
6
  (function (CheckoutItemStatus) {
@@ -34,4 +35,11 @@ const replaceCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
34
35
  domainEvents: [checkoutItemReplaced({ aggregateId })],
35
36
  };
36
37
  };
37
- export { CheckoutItemStatus, keepCheckoutItemHandler, returnCheckoutItemHandler, replaceCheckoutItemHandler };
38
+ const resetCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
39
+ const { aggregateId } = command;
40
+ return {
41
+ ...aggregateRoot,
42
+ domainEvents: [checkoutItemReset({ aggregateId })],
43
+ };
44
+ };
45
+ export { CheckoutItemStatus, keepCheckoutItemHandler, returnCheckoutItemHandler, replaceCheckoutItemHandler, resetCheckoutItemHandler, };
@@ -0,0 +1,13 @@
1
+ import { DomainEvent } from "@lookiero/messaging";
2
+ declare const CHECKOUT_ITEM_RESET = "checkout_item_reset";
3
+ interface CheckoutItemResetPayload {
4
+ readonly aggregateId: string;
5
+ }
6
+ interface CheckoutItemReset extends DomainEvent<typeof CHECKOUT_ITEM_RESET>, CheckoutItemResetPayload {
7
+ }
8
+ interface CheckoutItemResetFunction {
9
+ (payload: CheckoutItemResetPayload): CheckoutItemReset;
10
+ }
11
+ declare const checkoutItemReset: CheckoutItemResetFunction;
12
+ export type { CheckoutItemReset };
13
+ export { CHECKOUT_ITEM_RESET, checkoutItemReset };
@@ -0,0 +1,4 @@
1
+ import { domainEvent } from "@lookiero/messaging";
2
+ const CHECKOUT_ITEM_RESET = "checkout_item_reset";
3
+ const checkoutItemReset = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_ITEM_RESET });
4
+ export { CHECKOUT_ITEM_RESET, checkoutItemReset };
@@ -11,8 +11,9 @@ import { GIVE_CHECKOUT_FEEDBACK } from "../../domain/checkoutFeedback/command/gi
11
11
  import { giveCheckoutFeedbackHandler } from "../../domain/checkoutFeedback/model/checkoutFeedback";
12
12
  import { KEEP_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/keepCheckoutItem";
13
13
  import { REPLACE_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/replaceCheckoutItem";
14
+ import { RESET_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/resetCheckoutItem";
14
15
  import { RETURN_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/returnCheckoutItem";
15
- import { keepCheckoutItemHandler, replaceCheckoutItemHandler, returnCheckoutItemHandler, } from "../../domain/checkoutItem/model/checkoutItem";
16
+ import { keepCheckoutItemHandler, replaceCheckoutItemHandler, resetCheckoutItemHandler, returnCheckoutItemHandler, } from "../../domain/checkoutItem/model/checkoutItem";
16
17
  import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
17
18
  import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
18
19
  import { viewBookedProductsVariantsForCheckoutItemHandler, VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, } from "../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
@@ -57,6 +58,7 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
57
58
  .command(KEEP_CHECKOUT_ITEM, keepCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
58
59
  .command(RETURN_CHECKOUT_ITEM, returnCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
59
60
  .command(REPLACE_CHECKOUT_ITEM, replaceCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
61
+ .command(RESET_CHECKOUT_ITEM, resetCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
60
62
  .query(VIEW_PRICING_BY_CHECKOUT_ID, viewPricingByCheckoutIdHandler, {
61
63
  view: pricingByCheckoutIdView,
62
64
  })
@@ -2,6 +2,7 @@ import invariant from "tiny-invariant";
2
2
  import { viewCheckoutItemById, } from "../../../../projection/checkoutItem/viewCheckoutItemById";
3
3
  import { httpCheckoutItemsKeep } from "./httpCheckoutItemsKeep";
4
4
  import { httpCheckoutItemsReplace } from "./httpCheckoutItemsReplace";
5
+ import { httpCheckoutItemsReset } from "./httpCheckoutItemsReset";
5
6
  import { httpCheckoutItemsReturn } from "./httpCheckoutItemsReturn";
6
7
  const toDomain = (checkoutItem) => {
7
8
  invariant(checkoutItem, "No checkoutItem found!");
@@ -21,6 +22,7 @@ const saveCheckoutItem = ({ httpPost }) => async (aggregateRoot) => {
21
22
  httpCheckoutItemsKeep({ httpPost })(aggregateRoot),
22
23
  httpCheckoutItemsReturn({ httpPost })(aggregateRoot),
23
24
  httpCheckoutItemsReplace({ httpPost })(aggregateRoot),
25
+ httpCheckoutItemsReset({ httpPost })(aggregateRoot),
24
26
  ]);
25
27
  };
26
28
  export { getCheckoutItem, saveCheckoutItem };
@@ -0,0 +1,5 @@
1
+ import { HttpCheckoutItemsSaveFunction } from "./httpCheckoutItems";
2
+ interface HttpCheckoutItemsResetFunction extends HttpCheckoutItemsSaveFunction {
3
+ }
4
+ declare const httpCheckoutItemsReset: HttpCheckoutItemsResetFunction;
5
+ export { httpCheckoutItemsReset };
@@ -0,0 +1,13 @@
1
+ import { CHECKOUT_ITEM_RESET } from "../../../../domain/checkoutItem/model/checkoutItemReset";
2
+ const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
3
+ const httpCheckoutItemsReset = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
4
+ const checkoutItemReset = domainEvents.find(isCheckoutItemReset);
5
+ if (!checkoutItemReset) {
6
+ return;
7
+ }
8
+ await httpPost({
9
+ endpoint: "/reset-checkout-item",
10
+ body: { checkoutItemId: aggregateId },
11
+ });
12
+ };
13
+ export { httpCheckoutItemsReset };
@@ -0,0 +1,15 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ import { Logger } from "../../../../shared/logging/Logger";
3
+ interface ResetCheckoutItemFunction {
4
+ (): Promise<void>;
5
+ }
6
+ interface UseResetCheckoutItemFunctionArgs {
7
+ readonly checkoutItemId: string;
8
+ readonly logger: Logger;
9
+ }
10
+ type UseResetCheckoutItemResult = [reset: ResetCheckoutItemFunction, status: CommandStatus];
11
+ interface UseResetCheckoutItemFunction {
12
+ (args: UseResetCheckoutItemFunctionArgs): UseResetCheckoutItemResult;
13
+ }
14
+ declare const useResetCheckoutItem: UseResetCheckoutItemFunction;
15
+ export { useResetCheckoutItem };
@@ -0,0 +1,27 @@
1
+ import { useCommand } from "@lookiero/messaging-react";
2
+ import { useCallback } from "react";
3
+ import { resetCheckoutItem } from "../../../../domain/checkoutItem/command/resetCheckoutItem";
4
+ import { useCreateNotification } from "../../../../shared/notifications";
5
+ import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
6
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
7
+ import { I18nMessages } from "../../../ui/i18n/i18n";
8
+ const useResetCheckoutItem = ({ checkoutItemId, logger }) => {
9
+ const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
10
+ const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
11
+ const reset = useCallback(async () => {
12
+ try {
13
+ await commandBus(resetCheckoutItem({
14
+ aggregateId: checkoutItemId,
15
+ }));
16
+ }
17
+ catch (error) {
18
+ logger.captureException(error);
19
+ createNotification({
20
+ level: NotificationLevel.ERROR,
21
+ bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
22
+ });
23
+ }
24
+ }, [checkoutItemId, commandBus, createNotification, logger]);
25
+ return [reset, status];
26
+ };
27
+ export { useResetCheckoutItem };
@@ -6,12 +6,14 @@ import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/mo
6
6
  import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
7
7
  import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
8
8
  import { CHECKOUT_ITEM_REPLACED, } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
9
+ import { CHECKOUT_ITEM_RESET } from "../../../../domain/checkoutItem/model/checkoutItemReset";
9
10
  import { CHECKOUT_ITEM_RETURNED, } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
10
11
  import { viewFirstAvailableCheckoutByCustomerId } from "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
11
12
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
12
13
  const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
13
14
  const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
14
15
  const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
16
+ const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
15
17
  const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
16
18
  const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
17
19
  const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
@@ -20,6 +22,7 @@ const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPI
20
22
  const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
21
23
  isCheckoutItemReplaced(event) ||
22
24
  isCheckoutItemReturned(event) ||
25
+ isCheckoutItemReset(event) ||
23
26
  isCheckoutStarted(event) ||
24
27
  isCheckoutSubmitted(event) ||
25
28
  isCheckoutFeedbackGiven(event) ||
@@ -12,7 +12,6 @@ import { useBasePath } from "./useBasePath";
12
12
  const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null), children }) => {
13
13
  const logger = useLogger();
14
14
  const basePath = useBasePath();
15
- const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
16
15
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
17
16
  const firstItemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
18
17
  const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id, logger });
@@ -58,12 +57,7 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
58
57
  return React.createElement(Navigate, { to: `${basePath}/${Routes.HOME}`, replace: true });
59
58
  }
60
59
  }
61
- /* Navigate to the first item without customer's decission */
62
- navigatedToFirstItemWithoutCustomerDecision.current =
63
- navigatedToFirstItemWithoutCustomerDecision.current ||
64
- Boolean(itemRouteMatch && itemRouteMatch.params.id === firstItemWithoutCustomerDecision?.id);
65
- if (firstItemWithoutCustomerDecision && !navigatedToFirstItemWithoutCustomerDecision.current) {
66
- navigatedToFirstItemWithoutCustomerDecision.current = true;
60
+ if (firstItemWithoutCustomerDecision && !itemRouteMatch) {
67
61
  return (React.createElement(Navigate, { to: generatePath(`${basePath}/${Routes.ITEM}`, { id: firstItemWithoutCustomerDecision.id }), replace: true }));
68
62
  }
69
63
  return children;
@@ -10,6 +10,7 @@ import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner"
10
10
  import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
11
11
  import { useKeepCheckoutItem } from "../../../domain/checkoutItem/react/useKeepCheckoutItem";
12
12
  import { useReplaceCheckoutItem } from "../../../domain/checkoutItem/react/useReplaceCheckoutItem";
13
+ import { useResetCheckoutItem } from "../../../domain/checkoutItem/react/useResetCheckoutItem";
13
14
  import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
14
15
  import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
15
16
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
@@ -64,7 +65,14 @@ const Item = ({ customerId, country }) => {
64
65
  useEffect(() => {
65
66
  setCustomerDecissionMade(checkoutItem.status !== CheckoutItemStatus.INITIAL);
66
67
  }, [checkoutItem.status, id]);
67
- const handleOnBannerPress = useCallback(() => setCustomerDecissionMade(false), []);
68
+ const [resetCheckoutItem] = useResetCheckoutItem({
69
+ checkoutItemId: checkoutItem.id,
70
+ logger,
71
+ });
72
+ const handleOnBannerPress = useCallback(() => {
73
+ resetCheckoutItem();
74
+ setCustomerDecissionMade(false);
75
+ }, [resetCheckoutItem]);
68
76
  const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id, logger });
69
77
  const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
70
78
  checkoutItemId: checkoutItem.id,
@@ -2,8 +2,7 @@ import { Portal } from "@gorhom/portal";
2
2
  import { useBack } from "@lookiero/aurora-next/build/hooks/useBack/useBack";
3
3
  import { animated, useTransition } from "@react-spring/native";
4
4
  import React, { useCallback, useMemo, useState } from "react";
5
- import { Dimensions, Platform, TouchableWithoutFeedback, View, } from "react-native";
6
- import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
5
+ import { Dimensions, Platform, ScrollView, TouchableWithoutFeedback, View, } from "react-native";
7
6
  import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
8
7
  import { theme } from "../../../../../infrastructure/ui/theme/theme";
9
8
  import { useScreenSize } from "../../../hooks/useScreenSize";
@@ -56,7 +55,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
56
55
  : { modalOpacity: 0, overlayOpacity: 0, modalTranslateY: 0, modalScale: TRANSITION_MODAL_SCALE },
57
56
  unique: true,
58
57
  });
59
- const ModalContentView = useMemo(() => (scroll ? KeyboardAwareScrollView : View), [scroll]);
58
+ const ModalContentView = useMemo(() => (scroll ? ScrollView : View), [scroll]);
60
59
  return (React.createElement(Portal, { hostName: portalHostName }, transitions(({ modalOpacity, overlayOpacity, modalTranslateY, modalScale }, item) => item && (React.createElement(View, { pointerEvents: visible ? "auto" : "none", style: style.container, testID: "modal" },
61
60
  React.createElement(TouchableWithoutFeedback, { onPress: visible ? onClose : undefined },
62
61
  React.createElement(animated.View, { style: [style.overlay, { opacity: overlayOpacity }, customStyle?.overlay] })),
@@ -22,7 +22,6 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
22
22
  };
23
23
  stickyFooter: {
24
24
  paddingHorizontal: number;
25
- zIndex: number;
26
25
  };
27
26
  "1/4": ViewStyle;
28
27
  "1/3": ViewStyle;
@@ -66,7 +66,6 @@ const style = StyleSheet.create({
66
66
  },
67
67
  stickyFooter: {
68
68
  paddingHorizontal: spaceXL,
69
- zIndex: 3,
70
69
  },
71
70
  });
72
71
  export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.8.9-beta.0",
3
+ "version": "0.8.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -35,7 +35,6 @@
35
35
  "@react-spring/native": "^9.5.5",
36
36
  "@sentry/react-native": "^4.13.0",
37
37
  "inline-style-prefixer": "6.0.1",
38
- "react-native-keyboard-aware-scroll-view": "^0.9.5",
39
38
  "react-native-safe-area-context": "^4.4.1",
40
39
  "react-native-svg": "^12.1.1",
41
40
  "tiny-invariant": "^1.3.1",
@@ -1,13 +0,0 @@
1
- import { Command } from "@lookiero/messaging";
2
- declare const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
3
- interface MarkCheckoutAsPaidPayload {
4
- readonly aggregateId: string;
5
- }
6
- interface MarkCheckoutAsPaid extends Command<typeof MARK_CHECKOUT_AS_PAID>, MarkCheckoutAsPaidPayload {
7
- }
8
- interface MarkCheckoutAsPaidFunction {
9
- (payload: MarkCheckoutAsPaidPayload): MarkCheckoutAsPaid;
10
- }
11
- declare const markCheckoutAsPaid: MarkCheckoutAsPaidFunction;
12
- export type { MarkCheckoutAsPaid };
13
- export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
@@ -1,4 +0,0 @@
1
- import { command } from "@lookiero/messaging";
2
- const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
3
- const markCheckoutAsPaid = ({ aggregateId }) => command({ aggregateId, name: MARK_CHECKOUT_AS_PAID });
4
- export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
@@ -1,13 +0,0 @@
1
- import { DomainEvent } from "@lookiero/messaging";
2
- declare const CHECKOUT_PAID = "checkout_paid";
3
- interface CheckoutPaidPayload {
4
- readonly aggregateId: string;
5
- }
6
- interface CheckoutPaid extends DomainEvent<typeof CHECKOUT_PAID>, CheckoutPaidPayload {
7
- }
8
- interface CheckoutPaidFunction {
9
- (payload: CheckoutPaidPayload): CheckoutPaid;
10
- }
11
- declare const checkoutPaid: CheckoutPaidFunction;
12
- export type { CheckoutPaid };
13
- export { CHECKOUT_PAID, checkoutPaid };
@@ -1,4 +0,0 @@
1
- import { domainEvent } from "@lookiero/messaging";
2
- const CHECKOUT_PAID = "checkout_paid";
3
- const checkoutPaid = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_PAID });
4
- export { CHECKOUT_PAID, checkoutPaid };
@@ -1,5 +0,0 @@
1
- import { HttpCheckoutsSaveFunction } from "./httpCheckouts";
2
- interface HttpCheckoutsMarkAsPaidFunction extends HttpCheckoutsSaveFunction {
3
- }
4
- declare const httpCheckoutsMarkAsPaid: HttpCheckoutsMarkAsPaidFunction;
5
- export { httpCheckoutsMarkAsPaid };
@@ -1,13 +0,0 @@
1
- import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
2
- const isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
3
- const httpCheckoutsMarkAsPaid = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
4
- const checkoutPaid = domainEvents.find(isCheckoutPaid);
5
- if (!checkoutPaid) {
6
- return;
7
- }
8
- await httpPost({
9
- endpoint: "/mark-checkout-as-paid",
10
- body: { checkoutId: aggregateId },
11
- });
12
- };
13
- export { httpCheckoutsMarkAsPaid };
@@ -1,13 +0,0 @@
1
- import { CommandStatus } from "@lookiero/messaging-react";
2
- interface MarkAsPaidFunction {
3
- (): Promise<void>;
4
- }
5
- type UseMarkCheckoutAsPaid = [markAsPaid: MarkAsPaidFunction, status: CommandStatus];
6
- interface UseMarkCheckoutAsPaidFunctionArgs {
7
- readonly checkoutId?: string;
8
- }
9
- interface UseMarkCheckoutAsPaidFunction {
10
- (args: UseMarkCheckoutAsPaidFunctionArgs): UseMarkCheckoutAsPaid;
11
- }
12
- declare const useMarkCheckoutAsPaid: UseMarkCheckoutAsPaidFunction;
13
- export { useMarkCheckoutAsPaid };
@@ -1,16 +0,0 @@
1
- import { useCommand } from "@lookiero/messaging-react";
2
- import { useCallback } from "react";
3
- import invariant from "tiny-invariant";
4
- import { markCheckoutAsPaid } from "../../../../domain/checkout/command/markCheckoutAsPaid";
5
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const useMarkCheckoutAsPaid = ({ checkoutId }) => {
7
- const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
- const markAsPaid = useCallback(() => {
9
- invariant(checkoutId, "CheckoutId must be defined in order to mark the checkout as paid");
10
- return commandBus(markCheckoutAsPaid({
11
- aggregateId: checkoutId,
12
- }));
13
- }, [checkoutId, commandBus]);
14
- return [markAsPaid, status];
15
- };
16
- export { useMarkCheckoutAsPaid };
@@ -1,13 +0,0 @@
1
- import { CommandStatus } from "@lookiero/messaging-react";
2
- interface BookFunction {
3
- (): Promise<void>;
4
- }
5
- type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
6
- interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
7
- readonly checkoutItemId: string;
8
- }
9
- interface UseBookCheckouBookingForCheckoutItemFunction {
10
- (args: UseBookCheckouBookingForCheckoutItemFunctionArgs): UseBookCheckouBookingForCheckoutItem;
11
- }
12
- declare const useBookCheckouBookingForCheckoutItem: UseBookCheckouBookingForCheckoutItemFunction;
13
- export { useBookCheckouBookingForCheckoutItem };
@@ -1,14 +0,0 @@
1
- import { useCommand } from "@lookiero/messaging-react";
2
- import { useCallback } from "react";
3
- import { v4 as uuid } from "uuid";
4
- import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
5
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId }) => {
7
- const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
- const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
9
- aggregateId: uuid(),
10
- checkoutItemId,
11
- })), [checkoutItemId, commandBus]);
12
- return [book, status];
13
- };
14
- export { useBookCheckouBookingForCheckoutItem };
@@ -1,10 +0,0 @@
1
- import { CommandStatus } from "@lookiero/messaging-react";
2
- interface IncrementIntroShownCountFunction {
3
- (): Promise<void>;
4
- }
5
- type UseIncrementIntroShownCount = [incrementIntroShownCount: IncrementIntroShownCountFunction, status: CommandStatus];
6
- interface UseIncrementIntroShownCountFunction {
7
- (): UseIncrementIntroShownCount;
8
- }
9
- declare const useIncrementIntroShownCount: UseIncrementIntroShownCountFunction;
10
- export { useIncrementIntroShownCount };
@@ -1,11 +0,0 @@
1
- import { useCallback } from "react";
2
- import { useViewIntroShownCount } from "../../../projection/uiSetting/react/useViewIntroShownCount";
3
- import { UISettings } from "../../../ui/settings/UISettings";
4
- import { useUpdateUiSetting } from "./useUpdateUiSetting";
5
- const useIncrementIntroShownCount = () => {
6
- const [update, status] = useUpdateUiSetting();
7
- const [introShownCount] = useViewIntroShownCount();
8
- const incrementIntroShownCount = useCallback(() => update({ key: UISettings.INTRO_SHOWN_COUNT, value: introShownCount + 1 }), [introShownCount, update]);
9
- return [incrementIntroShownCount, status];
10
- };
11
- export { useIncrementIntroShownCount };
@@ -1,12 +0,0 @@
1
- import { BookedSizeChangeProductsVariantsForCheckoutItemView } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
2
- import { HttpPostFunction } from "../../delivery/http/httpClient";
3
- interface HttpBookedSizeChangeProductsVariantsForCheckoutItemView extends BookedSizeChangeProductsVariantsForCheckoutItemView {
4
- }
5
- interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs {
6
- readonly httpPost: HttpPostFunction;
7
- }
8
- interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction {
9
- (args: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeChangeProductsVariantsForCheckoutItemView;
10
- }
11
- declare const httpBookedSizeChangeProductsVariantsForCheckoutItemView: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction;
12
- export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
@@ -1,9 +0,0 @@
1
- const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
2
- const response = await httpPost({
3
- endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
4
- body: { checkoutItemId },
5
- signal,
6
- });
7
- return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
- };
9
- export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
@@ -1,10 +0,0 @@
1
- import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
- import { BookedSizeChangeProductsVariantsProjection } from "../../../../projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants";
3
- interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs {
4
- readonly checkoutItemId: string;
5
- }
6
- interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
7
- (args: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeChangeProductsVariantsProjection>;
8
- }
9
- declare const useViewBookedSizeChangeProductsVariantsForCheckoutItem: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
10
- export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
@@ -1,12 +0,0 @@
1
- import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
3
- import { viewBookedSizeChangeProductsVariantsForCheckoutItem } from "../../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
4
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
- const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
6
- const useViewBookedSizeChangeProductsVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
7
- query: viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId }),
8
- contextId: MESSAGING_CONTEXT_ID,
9
- invalidation: isCheckoutBookingBooked,
10
- options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
11
- });
12
- export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
@@ -1,12 +0,0 @@
1
- import { CheckoutFeedbackByCheckoutIdView } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId";
2
- import { HttpPostFunction } from "../../delivery/http/httpClient";
3
- interface HttpCheckoutFeebackByCheckoutIdView extends CheckoutFeedbackByCheckoutIdView {
4
- }
5
- interface HttpCheckoutFeebackByCheckoutIdViewFunctionArgs {
6
- readonly httpPost: HttpPostFunction;
7
- }
8
- interface HttpCheckoutFeebackByCheckoutIdViewFunction {
9
- (args: HttpCheckoutFeebackByCheckoutIdViewFunctionArgs): HttpCheckoutFeebackByCheckoutIdView;
10
- }
11
- declare const httpCheckoutFeebackByCheckoutIdView: HttpCheckoutFeebackByCheckoutIdViewFunction;
12
- export { httpCheckoutFeebackByCheckoutIdView };
@@ -1,9 +0,0 @@
1
- const httpCheckoutFeebackByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
2
- const response = await httpPost({
3
- endpoint: "/view-checkout-feedback-by-checkout-id",
4
- body: { checkoutId },
5
- signal,
6
- });
7
- return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
- };
9
- export { httpCheckoutFeebackByCheckoutIdView };
@@ -1,6 +0,0 @@
1
- import { QueryStatus } from "@lookiero/messaging-react";
2
- interface UseShouldIntroBeShownFunction {
3
- (): [boolean, QueryStatus];
4
- }
5
- declare const useShouldIntroBeShown: UseShouldIntroBeShownFunction;
6
- export { useShouldIntroBeShown };
@@ -1,7 +0,0 @@
1
- import { useViewIntroShownCount } from "./useViewIntroShownCount";
2
- const MAX_INTRO_SHOWN_COUNT = 2;
3
- const useShouldIntroBeShown = () => {
4
- const [introShownCount, introShownCountStatus] = useViewIntroShownCount();
5
- return [introShownCount < MAX_INTRO_SHOWN_COUNT, introShownCountStatus];
6
- };
7
- export { useShouldIntroBeShown };
@@ -1,6 +0,0 @@
1
- import { QueryStatus } from "@lookiero/messaging-react";
2
- interface UseViewIntroShownCountFunction {
3
- (): [number, QueryStatus];
4
- }
5
- declare const useViewIntroShownCount: UseViewIntroShownCountFunction;
6
- export { useViewIntroShownCount };
@@ -1,9 +0,0 @@
1
- import { UISettings } from "../../../ui/settings/UISettings";
2
- import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
3
- const useViewIntroShownCount = () => {
4
- const [introShownCount, introShownCountStatus] = useViewUiSettingByKey({
5
- key: UISettings.INTRO_SHOWN_COUNT,
6
- });
7
- return [introShownCount?.value || 0, introShownCountStatus];
8
- };
9
- export { useViewIntroShownCount };
@@ -1,4 +0,0 @@
1
- declare const style: {
2
- header: {};
3
- };
4
- export { style };
@@ -1,16 +0,0 @@
1
- import { Platform, StyleSheet } from "react-native";
2
- const style = StyleSheet.create({
3
- header: {
4
- ...Platform.select({
5
- web: {
6
- position: "fixed",
7
- zIndex: 1,
8
- },
9
- native: {
10
- position: "absolute",
11
- zIndex: 1,
12
- },
13
- }),
14
- },
15
- });
16
- export { style };
@@ -1,15 +0,0 @@
1
- import { FC } from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
- interface MenuProps {
4
- readonly isVisible: boolean;
5
- readonly onClose: () => void;
6
- }
7
- type Menu = FC<MenuProps>;
8
- interface HeaderProps {
9
- readonly customerId: string;
10
- readonly menu: Menu;
11
- readonly style?: StyleProp<ViewStyle>;
12
- }
13
- declare const Header: FC<HeaderProps>;
14
- export type { Menu };
15
- export { Header };