@lookiero/checkout 2.3.0 → 2.4.0

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 (41) hide show
  1. package/dist/domain/checkout/model/checkoutStarted.d.ts +3 -2
  2. package/dist/domain/checkout/model/checkoutStarted.js +2 -1
  3. package/dist/domain/checkout/model/checkoutSubmitted.d.ts +3 -2
  4. package/dist/domain/checkout/model/checkoutSubmitted.js +2 -1
  5. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +3 -2
  6. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.js +2 -1
  7. package/dist/domain/checkoutBooking/model/checkoutBookingExpired.d.ts +3 -2
  8. package/dist/domain/checkoutBooking/model/checkoutBookingExpired.js +2 -1
  9. package/dist/domain/checkoutFeedback/model/checkoutFeedbackGiven.d.ts +3 -2
  10. package/dist/domain/checkoutFeedback/model/checkoutFeedbackGiven.js +2 -1
  11. package/dist/domain/checkoutItem/model/checkoutItemKept.d.ts +3 -2
  12. package/dist/domain/checkoutItem/model/checkoutItemKept.js +2 -1
  13. package/dist/domain/checkoutItem/model/checkoutItemReplaced.d.ts +3 -2
  14. package/dist/domain/checkoutItem/model/checkoutItemReplaced.js +2 -1
  15. package/dist/domain/checkoutItem/model/checkoutItemReset.d.ts +3 -2
  16. package/dist/domain/checkoutItem/model/checkoutItemReset.js +2 -1
  17. package/dist/domain/checkoutItem/model/checkoutItemReturned.d.ts +3 -2
  18. package/dist/domain/checkoutItem/model/checkoutItemReturned.js +2 -1
  19. package/dist/domain/uiSetting/model/uiSettingUpdated.d.ts +3 -2
  20. package/dist/domain/uiSetting/model/uiSettingUpdated.js +2 -1
  21. package/dist/infrastructure/projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem.js +2 -4
  22. package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +9 -18
  23. package/dist/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +1 -2
  24. package/dist/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +4 -8
  25. package/dist/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +4 -8
  26. package/dist/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +1 -2
  27. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +3 -3
  28. package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +7 -5
  29. package/dist/infrastructure/ui/views/App.js +3 -1
  30. package/dist/infrastructure/ui/views/checkout/Checkout.style.d.ts +0 -1
  31. package/dist/infrastructure/ui/views/checkout/Checkout.style.js +0 -1
  32. package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +1 -3
  33. package/dist/infrastructure/ui/views/summary/Summary.js +1 -3
  34. package/dist/shared/notifications/domain/notification/model/notificationCreated.d.ts +3 -2
  35. package/dist/shared/notifications/domain/notification/model/notificationCreated.js +2 -1
  36. package/dist/shared/notifications/domain/notification/model/notificationRemoved.d.ts +3 -2
  37. package/dist/shared/notifications/domain/notification/model/notificationRemoved.js +2 -1
  38. package/dist/shared/notifications/projection/notification/react/useListNotifications.js +2 -4
  39. package/package.json +3 -3
  40. package/dist/infrastructure/ui/hooks/useToast.d.ts +0 -11
  41. package/dist/infrastructure/ui/hooks/useToast.js +0 -49
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_STARTED = "checkout_started";
3
3
  interface CheckoutStartedPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface CheckoutStartedFunction {
9
9
  (payload: CheckoutStartedPayload): CheckoutStarted;
10
10
  }
11
11
  declare const checkoutStarted: CheckoutStartedFunction;
12
+ declare const isCheckoutStarted: (event: DomainEvent<MessageName>) => event is CheckoutStarted;
12
13
  export type { CheckoutStarted };
13
- export { CHECKOUT_STARTED, checkoutStarted };
14
+ export { CHECKOUT_STARTED, checkoutStarted, isCheckoutStarted };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const CHECKOUT_STARTED = "checkout_started";
3
3
  const checkoutStarted = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_STARTED });
4
- export { CHECKOUT_STARTED, checkoutStarted };
4
+ const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
5
+ export { CHECKOUT_STARTED, checkoutStarted, isCheckoutStarted };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_SUBMITTED = "checkout_submitted";
3
3
  interface CheckoutSubmittedPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface CheckoutSubmittedFunction {
9
9
  (payload: CheckoutSubmittedPayload): CheckoutSubmitted;
10
10
  }
11
11
  declare const checkoutSubmitted: CheckoutSubmittedFunction;
12
+ declare const isCheckoutSubmitted: (event: DomainEvent<MessageName>) => event is CheckoutSubmitted;
12
13
  export type { CheckoutSubmitted };
13
- export { CHECKOUT_SUBMITTED, checkoutSubmitted };
14
+ export { CHECKOUT_SUBMITTED, checkoutSubmitted, isCheckoutSubmitted };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const CHECKOUT_SUBMITTED = "checkout_submitted";
3
3
  const checkoutSubmitted = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_SUBMITTED });
4
- export { CHECKOUT_SUBMITTED, checkoutSubmitted };
4
+ const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
5
+ export { CHECKOUT_SUBMITTED, checkoutSubmitted, isCheckoutSubmitted };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
3
3
  interface CheckoutBookingBookedPayload {
4
4
  readonly aggregateId: string;
@@ -10,5 +10,6 @@ interface CheckoutBookingBookedFunction {
10
10
  (payload: CheckoutBookingBookedPayload): CheckoutBookingBooked;
11
11
  }
12
12
  declare const checkoutBookingBooked: CheckoutBookingBookedFunction;
13
+ declare const isCheckoutBookingBooked: (event: DomainEvent<MessageName>) => event is CheckoutBookingBooked;
13
14
  export type { CheckoutBookingBooked };
14
- export { CHECKOUT_BOOKING_BOOKED, checkoutBookingBooked };
15
+ export { CHECKOUT_BOOKING_BOOKED, checkoutBookingBooked, isCheckoutBookingBooked };
@@ -4,4 +4,5 @@ const checkoutBookingBooked = ({ aggregateId, ...payload }) => ({
4
4
  ...domainEvent({ aggregateId, name: CHECKOUT_BOOKING_BOOKED }),
5
5
  ...payload,
6
6
  });
7
- export { CHECKOUT_BOOKING_BOOKED, checkoutBookingBooked };
7
+ const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
8
+ export { CHECKOUT_BOOKING_BOOKED, checkoutBookingBooked, isCheckoutBookingBooked };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_BOOKING_EXPIRED = "checkout_booking_expired";
3
3
  interface CheckoutBookingExpiredPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface CheckoutBookingExpiredFunction {
9
9
  (payload: CheckoutBookingExpiredPayload): CheckoutBookingExpired;
10
10
  }
11
11
  declare const checkoutBookingExpired: CheckoutBookingExpiredFunction;
12
+ declare const isCheckoutBookingExpired: (event: DomainEvent<MessageName>) => event is CheckoutBookingExpired;
12
13
  export type { CheckoutBookingExpired };
13
- export { CHECKOUT_BOOKING_EXPIRED, checkoutBookingExpired };
14
+ export { CHECKOUT_BOOKING_EXPIRED, checkoutBookingExpired, isCheckoutBookingExpired };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const CHECKOUT_BOOKING_EXPIRED = "checkout_booking_expired";
3
3
  const checkoutBookingExpired = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_BOOKING_EXPIRED });
4
- export { CHECKOUT_BOOKING_EXPIRED, checkoutBookingExpired };
4
+ const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
5
+ export { CHECKOUT_BOOKING_EXPIRED, checkoutBookingExpired, isCheckoutBookingExpired };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_FEEDBACK_GIVEN = "checkout_feedback_given";
3
3
  interface CheckoutFeedbackGivenPayload {
4
4
  readonly aggregateId: string;
@@ -10,5 +10,6 @@ interface CheckoutFeedbackGivenFunction {
10
10
  (payload: CheckoutFeedbackGivenPayload): CheckoutFeedbackGiven;
11
11
  }
12
12
  declare const checkoutFeedbackGiven: CheckoutFeedbackGivenFunction;
13
+ declare const isCheckoutFeedbackGiven: (event: DomainEvent<MessageName>) => event is CheckoutFeedbackGiven;
13
14
  export type { CheckoutFeedbackGiven };
14
- export { CHECKOUT_FEEDBACK_GIVEN, checkoutFeedbackGiven };
15
+ export { CHECKOUT_FEEDBACK_GIVEN, checkoutFeedbackGiven, isCheckoutFeedbackGiven };
@@ -4,4 +4,5 @@ const checkoutFeedbackGiven = ({ aggregateId, ...payload }) => ({
4
4
  ...domainEvent({ aggregateId, name: CHECKOUT_FEEDBACK_GIVEN }),
5
5
  ...payload,
6
6
  });
7
- export { CHECKOUT_FEEDBACK_GIVEN, checkoutFeedbackGiven };
7
+ const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
8
+ export { CHECKOUT_FEEDBACK_GIVEN, checkoutFeedbackGiven, isCheckoutFeedbackGiven };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_ITEM_KEPT = "checkout_item_kept";
3
3
  interface CheckoutItemKeptPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface CheckoutItemKeptFunction {
9
9
  (payload: CheckoutItemKeptPayload): CheckoutItemKept;
10
10
  }
11
11
  declare const checkoutItemKept: CheckoutItemKeptFunction;
12
+ declare const isCheckoutItemKept: (event: DomainEvent<MessageName>) => event is CheckoutItemKept;
12
13
  export type { CheckoutItemKept };
13
- export { CHECKOUT_ITEM_KEPT, checkoutItemKept };
14
+ export { CHECKOUT_ITEM_KEPT, checkoutItemKept, isCheckoutItemKept };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const CHECKOUT_ITEM_KEPT = "checkout_item_kept";
3
3
  const checkoutItemKept = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_ITEM_KEPT });
4
- export { CHECKOUT_ITEM_KEPT, checkoutItemKept };
4
+ const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
5
+ export { CHECKOUT_ITEM_KEPT, checkoutItemKept, isCheckoutItemKept };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_ITEM_REPLACED = "checkout_item_replaced";
3
3
  interface CheckoutItemReplacedPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface CheckoutItemReplacedFunction {
9
9
  (payload: CheckoutItemReplacedPayload): CheckoutItemReplaced;
10
10
  }
11
11
  declare const checkoutItemReplaced: CheckoutItemReplacedFunction;
12
+ declare const isCheckoutItemReplaced: (event: DomainEvent<MessageName>) => event is CheckoutItemReplaced;
12
13
  export type { CheckoutItemReplaced };
13
- export { CHECKOUT_ITEM_REPLACED, checkoutItemReplaced };
14
+ export { CHECKOUT_ITEM_REPLACED, checkoutItemReplaced, isCheckoutItemReplaced };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const CHECKOUT_ITEM_REPLACED = "checkout_item_replaced";
3
3
  const checkoutItemReplaced = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_ITEM_REPLACED });
4
- export { CHECKOUT_ITEM_REPLACED, checkoutItemReplaced };
4
+ const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
5
+ export { CHECKOUT_ITEM_REPLACED, checkoutItemReplaced, isCheckoutItemReplaced };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_ITEM_RESET = "checkout_item_reset";
3
3
  interface CheckoutItemResetPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface CheckoutItemResetFunction {
9
9
  (payload: CheckoutItemResetPayload): CheckoutItemReset;
10
10
  }
11
11
  declare const checkoutItemReset: CheckoutItemResetFunction;
12
+ declare const isCheckoutItemReset: (event: DomainEvent<MessageName>) => event is CheckoutItemReset;
12
13
  export type { CheckoutItemReset };
13
- export { CHECKOUT_ITEM_RESET, checkoutItemReset };
14
+ export { CHECKOUT_ITEM_RESET, checkoutItemReset, isCheckoutItemReset };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const CHECKOUT_ITEM_RESET = "checkout_item_reset";
3
3
  const checkoutItemReset = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_ITEM_RESET });
4
- export { CHECKOUT_ITEM_RESET, checkoutItemReset };
4
+ const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
5
+ export { CHECKOUT_ITEM_RESET, checkoutItemReset, isCheckoutItemReset };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const CHECKOUT_ITEM_RETURNED = "checkout_item_returned";
3
3
  interface CheckoutItemReturnedPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface CheckoutItemReturnedFunction {
9
9
  (payload: CheckoutItemReturnedPayload): CheckoutItemReturned;
10
10
  }
11
11
  declare const checkoutItemReturned: CheckoutItemReturnedFunction;
12
+ declare const isCheckoutItemReturned: (event: DomainEvent<MessageName>) => event is CheckoutItemReturned;
12
13
  export type { CheckoutItemReturned };
13
- export { CHECKOUT_ITEM_RETURNED, checkoutItemReturned };
14
+ export { CHECKOUT_ITEM_RETURNED, checkoutItemReturned, isCheckoutItemReturned };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const CHECKOUT_ITEM_RETURNED = "checkout_item_returned";
3
3
  const checkoutItemReturned = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_ITEM_RETURNED });
4
- export { CHECKOUT_ITEM_RETURNED, checkoutItemReturned };
4
+ const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
5
+ export { CHECKOUT_ITEM_RETURNED, checkoutItemReturned, isCheckoutItemReturned };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const UI_SETTING_UPDATED = "ui_setting_updated";
3
3
  interface UiSettingUpdatedPayload {
4
4
  readonly aggregateId: string;
@@ -10,5 +10,6 @@ interface UiSettingUpdatedFunction {
10
10
  (payload: UiSettingUpdatedPayload): UiSettingUpdated;
11
11
  }
12
12
  declare const uiSettingUpdated: UiSettingUpdatedFunction;
13
+ declare const isUiSettingUpdated: (event: DomainEvent<MessageName>) => event is UiSettingUpdated;
13
14
  export type { UiSettingUpdated };
14
- export { UI_SETTING_UPDATED, uiSettingUpdated };
15
+ export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
@@ -4,4 +4,5 @@ const uiSettingUpdated = ({ aggregateId, key }) => ({
4
4
  ...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
5
5
  key,
6
6
  });
7
- export { UI_SETTING_UPDATED, uiSettingUpdated };
7
+ const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
8
+ export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
@@ -1,10 +1,8 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
3
- import { CHECKOUT_BOOKING_EXPIRED } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
2
+ import { isCheckoutBookingBooked } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
3
+ import { isCheckoutBookingExpired } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
4
4
  import { viewBookedProductsVariantsForCheckoutItem } from "../../../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
5
5
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
7
- const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
8
6
  const shouldInvalidate = (event) => isCheckoutBookingBooked(event) || isCheckoutBookingExpired(event);
9
7
  const useViewBookedProductsVariantsForCheckoutItem = ({ checkoutItemId, }) => useQuery({
10
8
  query: viewBookedProductsVariantsForCheckoutItem({ checkoutItemId }),
@@ -1,24 +1,15 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_STARTED } from "../../../../domain/checkout/model/checkoutStarted";
3
- import { CHECKOUT_SUBMITTED } from "../../../../domain/checkout/model/checkoutSubmitted";
4
- import { CHECKOUT_BOOKING_BOOKED } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
5
- import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
6
- import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
7
- import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
8
- import { CHECKOUT_ITEM_REPLACED, } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
9
- import { CHECKOUT_ITEM_RESET } from "../../../../domain/checkoutItem/model/checkoutItemReset";
10
- import { CHECKOUT_ITEM_RETURNED, } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
2
+ import { isCheckoutStarted } from "../../../../domain/checkout/model/checkoutStarted";
3
+ import { isCheckoutSubmitted } from "../../../../domain/checkout/model/checkoutSubmitted";
4
+ import { isCheckoutBookingBooked } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
5
+ import { isCheckoutBookingExpired } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
6
+ import { isCheckoutFeedbackGiven } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
7
+ import { isCheckoutItemKept } from "../../../../domain/checkoutItem/model/checkoutItemKept";
8
+ import { isCheckoutItemReplaced } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
9
+ import { isCheckoutItemReset } from "../../../../domain/checkoutItem/model/checkoutItemReset";
10
+ import { isCheckoutItemReturned } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
11
11
  import { viewFirstAvailableCheckoutByCustomerId } from "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
12
12
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
13
- const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
14
- const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
15
- const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
16
- const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
17
- const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
18
- const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
19
- const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
20
- const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
21
- const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
22
13
  const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
23
14
  isCheckoutItemReplaced(event) ||
24
15
  isCheckoutItemReturned(event) ||
@@ -1,8 +1,7 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
2
+ import { isCheckoutFeedbackGiven } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
3
3
  import { viewIsCheckoutAccessibleByCustomerId, } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
4
4
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
- const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
6
5
  const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
7
6
  query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
8
7
  contextId: MESSAGING_CONTEXT_ID,
@@ -1,14 +1,10 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
3
- import { CHECKOUT_ITEM_REPLACED, } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
4
- import { CHECKOUT_ITEM_RESET } from "../../../../domain/checkoutItem/model/checkoutItemReset";
5
- import { CHECKOUT_ITEM_RETURNED, } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
2
+ import { isCheckoutItemKept } from "../../../../domain/checkoutItem/model/checkoutItemKept";
3
+ import { isCheckoutItemReplaced } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
4
+ import { isCheckoutItemReset } from "../../../../domain/checkoutItem/model/checkoutItemReset";
5
+ import { isCheckoutItemReturned } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
6
6
  import { viewPaymentFlowPayloadByCheckoutId } from "../../../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
7
7
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
8
- const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
9
- const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
10
- const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
11
- const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
12
8
  const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
13
9
  isCheckoutItemReplaced(event) ||
14
10
  isCheckoutItemReturned(event) ||
@@ -1,14 +1,10 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
3
- import { CHECKOUT_ITEM_REPLACED, } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
4
- import { CHECKOUT_ITEM_RESET } from "../../../../domain/checkoutItem/model/checkoutItemReset";
5
- import { CHECKOUT_ITEM_RETURNED, } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
2
+ import { isCheckoutItemKept } from "../../../../domain/checkoutItem/model/checkoutItemKept";
3
+ import { isCheckoutItemReplaced } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
4
+ import { isCheckoutItemReset } from "../../../../domain/checkoutItem/model/checkoutItemReset";
5
+ import { isCheckoutItemReturned } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
6
6
  import { viewPricingByCheckoutId } from "../../../../projection/pricing/viewPricingByCheckoutId";
7
7
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
8
- const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
9
- const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
10
- const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
11
- const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
12
8
  const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
13
9
  isCheckoutItemReplaced(event) ||
14
10
  isCheckoutItemReturned(event) ||
@@ -1,8 +1,7 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { UI_SETTING_UPDATED } from "../../../../domain/uiSetting/model/uiSettingUpdated";
2
+ import { isUiSettingUpdated } from "../../../../domain/uiSetting/model/uiSettingUpdated";
3
3
  import { viewUiSettingByKey } from "../../../../projection/uiSetting/viewUiSettingByKey";
4
4
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
- const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
6
5
  const useViewUiSettingByKey = ({ key }) => useQuery({
7
6
  query: viewUiSettingByKey({ key }),
8
7
  contextId: MESSAGING_CONTEXT_ID,
@@ -1,16 +1,16 @@
1
1
  import React from "react";
2
- import { Platform, ScrollView } from "react-native";
2
+ import { ScrollView } from "react-native";
3
3
  import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
4
4
  import { theme } from "../../theme/theme";
5
5
  import { style } from "./SafeAreaScrollView.style.ts";
6
- const { spaceXXXL } = theme();
6
+ const { spaceXXL } = theme();
7
7
  const SafeAreaScrollView = ({ children, footer, edges = ["top", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
8
8
  const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
9
9
  return (React.createElement(SafeAreaView, { edges: edges, style: [style.safeAreaView, customStyle?.safeAreaView] },
10
10
  React.createElement(ScrollView, { contentContainerStyle: [
11
11
  {
12
12
  paddingTop: scrollerPaddingTop,
13
- paddingBottom: safeAreaInsetBottom + (Platform.OS === "android" ? spaceXXXL : 0),
13
+ paddingBottom: safeAreaInsetBottom + spaceXXL,
14
14
  },
15
15
  customStyle?.scrollView,
16
16
  ] }, children),
@@ -1,21 +1,23 @@
1
1
  import { useEvent } from "@lookiero/event";
2
2
  import { useCallback, useEffect } from "react";
3
3
  import { useCreateToastNotification } from "../../../shared/notifications";
4
+ import { NotificationLevel } from "../../../shared/notifications/domain/notification/model/notification";
4
5
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
5
6
  import { I18nMessages } from "../i18n/i18n";
6
- import { useToast } from "./useToast";
7
7
  const PAYMENT_ERROR = "ERROR";
8
8
  const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
9
9
  const usePaymentInstrumentEvents = ({ logger }) => {
10
10
  const { subscribe, unsubscribe } = useEvent();
11
- const { showError, showSuccess } = useToast();
12
11
  const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
13
- const onSuccess = useCallback(({ message }) => showSuccess({ message: message.id }), [showSuccess]);
12
+ const onSuccess = useCallback(({ message }) => createNotification({ bodyI18nKey: message.id, level: NotificationLevel.SUCCESS }), [createNotification]);
14
13
  const onError = useCallback(({ error }) => {
15
14
  if (error.toaster) {
16
- showError({ message: error.toaster.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR });
15
+ createNotification({
16
+ bodyI18nKey: error.toaster.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
17
+ level: NotificationLevel.ERROR,
18
+ });
17
19
  }
18
- }, [showError]);
20
+ }, [createNotification]);
19
21
  useEffect(() => {
20
22
  subscribe({ event: PAYMENT_ERROR }, onError);
21
23
  subscribe({ event: PAYMENT_SUCCESS }, onSuccess);
@@ -1,4 +1,5 @@
1
1
  import { PortalProvider } from "@gorhom/portal";
2
+ import { PortalProvider as AuroraPortalProvider } from "@lookiero/aurora";
2
3
  import React from "react";
3
4
  import { StatusBar } from "react-native";
4
5
  import { SafeAreaProvider } from "react-native-safe-area-context";
@@ -11,5 +12,6 @@ const App = ({ children, customerId, country, onOpenMenu }) => (React.createElem
11
12
  React.createElement(PortalProvider, null,
12
13
  React.createElement(StatusBar, { backgroundColor: colorBase, barStyle: "dark-content", translucent: true }),
13
14
  React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
14
- React.createElement(Navigation, { country: country, customerId: customerId, onOpenMenu: onOpenMenu }, children))));
15
+ React.createElement(Navigation, { country: country, customerId: customerId, onOpenMenu: onOpenMenu },
16
+ React.createElement(AuroraPortalProvider, null, children)))));
15
17
  export { App };
@@ -10,7 +10,6 @@ declare const style: {
10
10
  };
11
11
  pricingContainer: {
12
12
  marginTop: number;
13
- paddingBottom: number;
14
13
  };
15
14
  title: {
16
15
  marginBottom: number;
@@ -13,7 +13,6 @@ const style = StyleSheet.create({
13
13
  },
14
14
  pricingContainer: {
15
15
  marginTop: spaceXL,
16
- paddingBottom: spaceXL,
17
16
  },
18
17
  title: {
19
18
  marginBottom: spaceM,
@@ -11,12 +11,10 @@ import { useReplaceCheckoutItem } from "../../../../../domain/checkoutItem/react
11
11
  import { TrackingPage } from "../../../../../tracking/tracking";
12
12
  import { Body } from "../../../../components/layouts/body/Body";
13
13
  import { SafeAreaScrollView } from "../../../../components/templates/SafeAreaScrollView";
14
- import { theme } from "../../../../theme/theme";
15
14
  import { HEADER_HEIGHT } from "../../../navigation/components/header/Header.style";
16
15
  import { ItemActions } from "../../components/itemActions/ItemActions";
17
16
  import { SizeWithoutStockModal } from "../../components/sizeWithoutStockModal/SizeWithoutStockModal";
18
17
  import { ProductVariant } from "../productVariant/ProductVariant";
19
- const { spaceXL } = theme();
20
18
  const ItemWithoutCustomerDecission = ({ country, checkoutId, checkoutItem, bookedProductsVariants, currentProductVariant, onReturn, }) => {
21
19
  const logger = useLogger();
22
20
  /* KeepCheckoutItem */
@@ -62,6 +60,6 @@ const ItemWithoutCustomerDecission = ({ country, checkoutId, checkoutItem, booke
62
60
  React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
63
61
  React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT, footer: React.createElement(ItemActions, { country: country, currentProductVariant: currentProductVariant, productVariants: bookedProductsVariants?.productVariants, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: onReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal }) },
64
62
  React.createElement(Body, null,
65
- React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, style: { content: { paddingBottom: Platform.OS === "web" ? spaceXL : stickyHeight } } })))));
63
+ React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, style: { content: { paddingBottom: Platform.OS === "web" ? 0 : stickyHeight } } })))));
66
64
  };
67
65
  export { ItemWithoutCustomerDecission };
@@ -20,13 +20,11 @@ import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollVie
20
20
  import { I18nMessages } from "../../i18n/i18n";
21
21
  import { Routes } from "../../routing/routes";
22
22
  import { useBasePath } from "../../routing/useBasePath";
23
- import { theme } from "../../theme/theme";
24
23
  import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
25
24
  import { style } from "./Summary.style";
26
25
  import { CheckoutItemsTabs } from "./components/checkoutItemsTabs/CheckoutItemsTabs";
27
26
  import { FiveItemsDiscountBanner } from "./components/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
28
27
  import { StickyPricing } from "./components/stickyPricing/StickyPricing";
29
- const { spaceXL } = theme();
30
28
  const Summary = ({ customerId, country }) => {
31
29
  const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
32
30
  const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
@@ -86,7 +84,7 @@ const Summary = ({ customerId, country }) => {
86
84
  if (!dependenciesLoaded)
87
85
  return React.createElement(Spinner, null);
88
86
  return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT, footer: pricing && (React.createElement(StickyPricing, { collapsed: pricingCollapsed, pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined, onPress: handleOnPressPricing, onSubmit: handleOnSubmit })) },
89
- React.createElement(Body, { style: { row: { paddingBottom: pricingHeight || spaceXL } } },
87
+ React.createElement(Body, { style: { row: { paddingBottom: pricingHeight } } },
90
88
  fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
91
89
  React.createElement(View, { style: style.content },
92
90
  React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const NOTIFICATION_CREATED = "notification_created";
3
3
  interface NotificationCreatedPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface NotificationCreatedFunction {
9
9
  (payload: NotificationCreatedPayload): NotificationCreated;
10
10
  }
11
11
  declare const notificationCreated: NotificationCreatedFunction;
12
+ declare const isNotificationCreated: (event: DomainEvent<MessageName>) => event is NotificationCreated;
12
13
  export type { NotificationCreated };
13
- export { NOTIFICATION_CREATED, notificationCreated };
14
+ export { NOTIFICATION_CREATED, notificationCreated, isNotificationCreated };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const NOTIFICATION_CREATED = "notification_created";
3
3
  const notificationCreated = ({ aggregateId }) => domainEvent({ aggregateId, name: NOTIFICATION_CREATED });
4
- export { NOTIFICATION_CREATED, notificationCreated };
4
+ const isNotificationCreated = (event) => event.name === NOTIFICATION_CREATED;
5
+ export { NOTIFICATION_CREATED, notificationCreated, isNotificationCreated };
@@ -1,4 +1,4 @@
1
- import { DomainEvent } from "@lookiero/messaging";
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
2
  declare const NOTIFICATION_REMOVED = "notification_removed";
3
3
  interface NotificationRemovedPayload {
4
4
  readonly aggregateId: string;
@@ -9,5 +9,6 @@ interface NotificationRemovedFunction {
9
9
  (payload: NotificationRemovedPayload): NotificationRemoved;
10
10
  }
11
11
  declare const notificationRemoved: NotificationRemovedFunction;
12
+ declare const isNotificationRemoved: (event: DomainEvent<MessageName>) => event is NotificationRemoved;
12
13
  export type { NotificationRemoved };
13
- export { NOTIFICATION_REMOVED, notificationRemoved };
14
+ export { NOTIFICATION_REMOVED, notificationRemoved, isNotificationRemoved };
@@ -1,4 +1,5 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
2
  const NOTIFICATION_REMOVED = "notification_removed";
3
3
  const notificationRemoved = ({ aggregateId }) => domainEvent({ aggregateId, name: NOTIFICATION_REMOVED });
4
- export { NOTIFICATION_REMOVED, notificationRemoved };
4
+ const isNotificationRemoved = (event) => event.name === NOTIFICATION_REMOVED;
5
+ export { NOTIFICATION_REMOVED, notificationRemoved, isNotificationRemoved };
@@ -1,9 +1,7 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { NOTIFICATION_CREATED } from "../../../domain/notification/model/notificationCreated";
3
- import { NOTIFICATION_REMOVED } from "../../../domain/notification/model/notificationRemoved";
2
+ import { isNotificationCreated } from "../../../domain/notification/model/notificationCreated";
3
+ import { isNotificationRemoved } from "../../../domain/notification/model/notificationRemoved";
4
4
  import { listNotifications } from "../listNotifications";
5
- const isNotificationCreated = (event) => event.name === NOTIFICATION_CREATED;
6
- const isNotificationRemoved = (event) => event.name === NOTIFICATION_REMOVED;
7
5
  const shouldInvalidate = (event) => isNotificationCreated(event) || isNotificationRemoved(event);
8
6
  const useListNotifications = ({ contextId }) => useQuery({
9
7
  query: listNotifications(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -49,7 +49,7 @@
49
49
  "@lookiero/data-sources": "^0.3",
50
50
  "@lookiero/event": "^0.3",
51
51
  "@lookiero/locale": "^0.3",
52
- "@lookiero/payments-front": "^1.0.2",
52
+ "@lookiero/payments-front": "^1.1.1",
53
53
  "@lookiero/user-tracking-front": "0.0.37",
54
54
  "apollo-boost": "0.4.4",
55
55
  "graphql": "16.6.0",
@@ -71,7 +71,7 @@
71
71
  "@lookiero/data-sources": "^0.3",
72
72
  "@lookiero/event": "^0.3",
73
73
  "@lookiero/locale": "^0.3",
74
- "@lookiero/payments-front": "^1.0.2",
74
+ "@lookiero/payments-front": "^1.1.1",
75
75
  "@lookiero/user-tracking-front": "0.0.37",
76
76
  "@pact-foundation/pact": "^10.1.4",
77
77
  "@pact-foundation/pact-node": "^10.17.6",
@@ -1,11 +0,0 @@
1
- interface ShowErrorFunctionArgs {
2
- readonly message: string;
3
- }
4
- interface ShowErrorFunction {
5
- (args: ShowErrorFunctionArgs): void;
6
- }
7
- declare const useToast: () => {
8
- showError: ShowErrorFunction;
9
- showSuccess: ShowErrorFunction;
10
- };
11
- export { useToast };
@@ -1,49 +0,0 @@
1
- import { Notification, useStack } from "@lookiero/aurora";
2
- import { useIntl } from "@lookiero/i18n-react";
3
- import { useCallback } from "react";
4
- import { StyleSheet } from "react-native";
5
- import { v4 as uuid } from "uuid";
6
- import { theme } from "../theme/theme";
7
- const { layoutXXS, elevationColor, elevationOffset, elevationOpacityM, elevationRadius } = theme();
8
- const style = StyleSheet.create({
9
- container: {
10
- marginHorizontal: layoutXXS,
11
- marginTop: layoutXXS,
12
- shadowColor: elevationColor,
13
- shadowOffset: elevationOffset,
14
- shadowOpacity: elevationOpacityM,
15
- shadowRadius: elevationRadius,
16
- },
17
- inAppContainer: {
18
- top: 75,
19
- },
20
- });
21
- const NOTIFICATION_DEFAULTS = {
22
- motion: "top",
23
- timeoutClose: 10000,
24
- style: style.container,
25
- };
26
- const IN_APP_NOTIFICATION_DEFAULTS = {
27
- ...NOTIFICATION_DEFAULTS,
28
- style: [style.container, style.inAppContainer],
29
- };
30
- const iOSInAppBrowser = window.screen?.height > 667 && /FBIOS/.test(navigator.userAgent);
31
- const getNotificationDefaults = () => (iOSInAppBrowser ? IN_APP_NOTIFICATION_DEFAULTS : NOTIFICATION_DEFAULTS);
32
- const useToast = () => {
33
- const Stack = useStack();
34
- const intl = useIntl();
35
- const translate = useCallback((message) => intl.formatMessage({ id: message, defaultMessage: message }), [intl]);
36
- const showError = useCallback(({ message }) => Stack.alert(uuid(),
37
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
38
- // @ts-ignore
39
- Notification, { ...getNotificationDefaults(), text: translate(message) }), [Stack, translate]);
40
- const showSuccess = useCallback(({ message }) => Stack.success(uuid(),
41
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
- // @ts-ignore
43
- Notification, { ...getNotificationDefaults(), text: translate(message) }), [Stack, translate]);
44
- return {
45
- showError,
46
- showSuccess,
47
- };
48
- };
49
- export { useToast };