@lookiero/checkout 6.0.0 → 6.0.1-beta.1

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.
@@ -5,13 +5,20 @@ import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
5
5
  import { I18nMessages } from "../i18n/i18n";
6
6
  const PAYMENT_ERROR = "ERROR";
7
7
  const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
8
+ const PAYMENT_ERROR_TOAST_ID = "8228c0dd-5c7c-4040-8240-a6f642202b96";
9
+ const PAYMENT_SUCCESS_TOAST_ID = "7486a0fa-1080-4690-9494-1c3ff58ef50d";
8
10
  const usePaymentInstrumentEvents = ({ logger }) => {
9
11
  const { subscribe, unsubscribe } = useEvent();
10
12
  const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
11
- const onSuccess = useCallback(({ message }) => createNotification({ bodyI18nKey: message.id, level: NotificationLevel.SUCCESS }), [createNotification]);
13
+ const onSuccess = useCallback(({ message }) => createNotification({
14
+ aggregateId: PAYMENT_SUCCESS_TOAST_ID,
15
+ bodyI18nKey: message.id,
16
+ level: NotificationLevel.SUCCESS,
17
+ }), [createNotification]);
12
18
  const onError = useCallback(({ error }) => {
13
19
  if (error.toaster) {
14
20
  createNotification({
21
+ aggregateId: PAYMENT_ERROR_TOAST_ID,
15
22
  bodyI18nKey: error.toaster.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
16
23
  level: NotificationLevel.ERROR,
17
24
  });
@@ -3,8 +3,10 @@ import { generatePath, useMatch, useNavigate, useParams } from "react-router-nat
3
3
  import { Box, Spinner } from "@lookiero/aurora";
4
4
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
5
5
  import { useLogger } from "@lookiero/sty-psp-logging";
6
+ import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
6
7
  import { useScreenSize } from "@lookiero/sty-psp-ui";
7
8
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
9
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
8
10
  import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
9
11
  import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
10
12
  import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
@@ -37,6 +39,14 @@ const Item = ({ layout: Layout }) => {
37
39
  const basePath = useBasePath();
38
40
  const { customer: { customerId, country, segment }, } = useStaticInfo();
39
41
  const isDesktopScreen = screenSize !== "S";
42
+ const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
43
+ useEffect(() => {
44
+ createNotification({
45
+ aggregateId: "8228c0dd-5c7c-4040-8240-a6f642202b96",
46
+ bodyI18nKey: "whatever",
47
+ level: NotificationLevel.ERROR,
48
+ });
49
+ }, [createNotification]);
40
50
  const { id } = useParams();
41
51
  const [fiveItemsDiscount = 0, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({ customerId });
42
52
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
@@ -1 +1 @@
1
- export declare const VERSION = "6.0.0";
1
+ export declare const VERSION = "6.0.1-beta.1";
@@ -1 +1 @@
1
- export const VERSION = "6.0.0";
1
+ export const VERSION = "6.0.1-beta.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "6.0.0",
3
+ "version": "6.0.1-beta.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -21,7 +21,7 @@
21
21
  "@lookiero/sty-psp-i18n": "^0.1.7",
22
22
  "@lookiero/sty-psp-locale": "^0.2.1",
23
23
  "@lookiero/sty-psp-logging": "^0.2.2",
24
- "@lookiero/sty-psp-notifications": "^0.5.4",
24
+ "@lookiero/sty-psp-notifications": "0.5.5-beta.12",
25
25
  "@lookiero/sty-psp-react-native": "^0.2.0",
26
26
  "@lookiero/sty-psp-segment": "^0.1.1",
27
27
  "@lookiero/sty-psp-storage": "^0.1.3",
@@ -7,6 +7,8 @@ import { I18nMessages } from "../i18n/i18n";
7
7
 
8
8
  const PAYMENT_ERROR = "ERROR";
9
9
  const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
10
+ const PAYMENT_ERROR_TOAST_ID = "8228c0dd-5c7c-4040-8240-a6f642202b96";
11
+ const PAYMENT_SUCCESS_TOAST_ID = "7486a0fa-1080-4690-9494-1c3ff58ef50d";
10
12
 
11
13
  interface Message {
12
14
  readonly id: string;
@@ -45,7 +47,12 @@ const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction = ({ logger
45
47
  const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
46
48
 
47
49
  const onSuccess: OnSuccessFunction = useCallback(
48
- ({ message }) => createNotification({ bodyI18nKey: message.id, level: NotificationLevel.SUCCESS }),
50
+ ({ message }) =>
51
+ createNotification({
52
+ aggregateId: PAYMENT_SUCCESS_TOAST_ID,
53
+ bodyI18nKey: message.id,
54
+ level: NotificationLevel.SUCCESS,
55
+ }),
49
56
  [createNotification],
50
57
  );
51
58
 
@@ -53,6 +60,7 @@ const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction = ({ logger
53
60
  ({ error }) => {
54
61
  if (error.toaster) {
55
62
  createNotification({
63
+ aggregateId: PAYMENT_ERROR_TOAST_ID,
56
64
  bodyI18nKey: error.toaster.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
57
65
  level: NotificationLevel.ERROR,
58
66
  });
@@ -3,6 +3,7 @@ import { generatePath, useMatch, useNavigate, useParams } from "react-router-nat
3
3
  import { Box, Spinner } from "@lookiero/aurora";
4
4
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
5
5
  import { useLogger } from "@lookiero/sty-psp-logging";
6
+ import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
6
7
  import { useScreenSize } from "@lookiero/sty-psp-ui";
7
8
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
8
9
  import {
@@ -11,6 +12,7 @@ import {
11
12
  } from "../../../../projection/bookedProductsVariants/bookedProductsVariants";
12
13
  import { CheckoutItemProjection } from "../../../../projection/checkoutItem/checkoutItem";
13
14
  import { FeedbackProjection } from "../../../../projection/feedback/feedback";
15
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
14
16
  import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
15
17
  import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
16
18
  import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
@@ -73,6 +75,15 @@ const Item: FC<ItemProps> = ({ layout: Layout }) => {
73
75
  } = useStaticInfo();
74
76
  const isDesktopScreen = screenSize !== "S";
75
77
 
78
+ const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
79
+ useEffect(() => {
80
+ createNotification({
81
+ aggregateId: "8228c0dd-5c7c-4040-8240-a6f642202b96",
82
+ bodyI18nKey: "whatever",
83
+ level: NotificationLevel.ERROR,
84
+ });
85
+ }, [createNotification]);
86
+
76
87
  const { id } = useParams();
77
88
  const [fiveItemsDiscount = 0, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({ customerId });
78
89
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });