@lookiero/checkout 0.8.4-beta.10 → 0.8.4-beta.2

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 (110) hide show
  1. package/dist/domain/checkout/model/checkout.js +0 -1
  2. package/dist/infrastructure/delivery/http/fetchHttpClient.js +19 -36
  3. package/dist/infrastructure/delivery/http/httpClient.d.ts +3 -9
  4. package/dist/infrastructure/domain/checkout/react/useStartCheckout.d.ts +1 -3
  5. package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +4 -11
  6. package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.d.ts +1 -3
  7. package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.js +6 -19
  8. package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +0 -2
  9. package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +4 -19
  10. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.d.ts +0 -2
  11. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.js +5 -20
  12. package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.d.ts +0 -2
  13. package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.js +5 -20
  14. package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.d.ts +0 -2
  15. package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.js +4 -19
  16. package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.d.ts +0 -2
  17. package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.js +5 -20
  18. package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.d.ts +0 -2
  19. package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.js +5 -20
  20. package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +1 -5
  21. package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +6 -13
  22. package/dist/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.js +8 -9
  23. package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +8 -9
  24. package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +8 -9
  25. package/dist/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.js +7 -8
  26. package/dist/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.js +7 -8
  27. package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +4 -1
  28. package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.js +8 -9
  29. package/dist/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.js +8 -9
  30. package/dist/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +8 -9
  31. package/dist/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.js +8 -9
  32. package/dist/infrastructure/projection/pricing/httpPricingByCheckoutIdView.js +8 -9
  33. package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +8 -9
  34. package/dist/infrastructure/ui/Root.js +1 -2
  35. package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +1 -8
  36. package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +2 -2
  37. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +2 -0
  38. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +28 -0
  39. package/dist/infrastructure/ui/hooks/useSubmitCheckout.d.ts +0 -2
  40. package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +13 -7
  41. package/dist/infrastructure/ui/i18n/i18n.d.ts +0 -1
  42. package/dist/infrastructure/ui/i18n/i18n.js +0 -1
  43. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +1 -3
  44. package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +0 -3
  45. package/dist/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +1 -3
  46. package/dist/infrastructure/ui/views/feedback/Feedback.js +0 -3
  47. package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
  48. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -3
  49. package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -3
  50. package/dist/infrastructure/ui/views/item/Item.js +1 -6
  51. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +2 -2
  52. package/dist/shared/logging/SentryLogger.d.ts +8 -3
  53. package/dist/shared/logging/SentryLogger.js +33 -27
  54. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +0 -2
  55. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +7 -14
  56. package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.d.ts +0 -2
  57. package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.js +2 -9
  58. package/dist/shared/notifications/infrastructure/ui/views/Notifications.js +1 -3
  59. package/dist/shared/ui/components/layouts/slider/Slider.js +47 -12
  60. package/package.json +1 -2
  61. package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
  62. package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
  63. package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
  64. package/dist/domain/checkout/model/checkoutPaid.js +0 -4
  65. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
  66. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
  67. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +0 -13
  68. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +0 -16
  69. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
  70. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +0 -14
  71. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +0 -12
  72. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +0 -9
  73. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +0 -10
  74. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +0 -12
  75. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +0 -12
  76. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +0 -9
  77. package/dist/infrastructure/ui/views/App.style.d.ts +0 -4
  78. package/dist/infrastructure/ui/views/App.style.js +0 -16
  79. package/dist/infrastructure/ui/views/header/Header.d.ts +0 -15
  80. package/dist/infrastructure/ui/views/header/Header.js +0 -90
  81. package/dist/infrastructure/ui/views/header/Header.style.d.ts +0 -35
  82. package/dist/infrastructure/ui/views/header/Header.style.js +0 -38
  83. package/dist/infrastructure/ui/views/header/components/Logo.d.ts +0 -7
  84. package/dist/infrastructure/ui/views/header/components/Logo.js +0 -11
  85. package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +0 -7
  86. package/dist/infrastructure/ui/views/header/components/Logo.style.js +0 -8
  87. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -10
  88. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +0 -1
  89. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +0 -25
  90. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +0 -8
  91. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +0 -25
  92. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +0 -8
  93. package/dist/shared/logging/Logger.d.ts +0 -7
  94. package/dist/shared/logging/Logger.js +0 -1
  95. package/dist/shared/logging/SentryLoggerHOC.d.ts +0 -15
  96. package/dist/shared/logging/SentryLoggerHOC.js +0 -24
  97. package/dist/shared/logging/location.d.ts +0 -3
  98. package/dist/shared/logging/location.js +0 -5
  99. package/dist/shared/logging/matchRoutes.d.ts +0 -3
  100. package/dist/shared/logging/matchRoutes.js +0 -7
  101. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +0 -29
  102. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +0 -134
  103. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +0 -22
  104. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +0 -15
  105. package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +0 -27
  106. package/dist/shared/logging/reactRouterV6Instrumentation.native.js +0 -115
  107. package/dist/shared/logging/useLogger.d.ts +0 -12
  108. package/dist/shared/logging/useLogger.js +0 -10
  109. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +0 -1
  110. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +0 -9
@@ -1,6 +1,7 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
2
  import { CHECKOUT_STARTED } from "../../../../domain/checkout/model/checkoutStarted";
3
3
  import { CHECKOUT_SUBMITTED } from "../../../../domain/checkout/model/checkoutSubmitted";
4
+ import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
4
5
  import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
5
6
  import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
6
7
  import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
@@ -15,13 +16,15 @@ const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
15
16
  const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
16
17
  const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
17
18
  const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
19
+ const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
18
20
  const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
19
21
  isCheckoutItemReplaced(event) ||
20
22
  isCheckoutItemReturned(event) ||
21
23
  isCheckoutStarted(event) ||
22
24
  isCheckoutSubmitted(event) ||
23
25
  isCheckoutFeedbackGiven(event) ||
24
- isCheckoutBookingExpired(event);
26
+ isCheckoutBookingExpired(event) ||
27
+ isCheckoutBookingBooked(event);
25
28
  const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
26
29
  query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
27
30
  contextId: MESSAGING_CONTEXT_ID,
@@ -1,10 +1,9 @@
1
- const httpCheckoutBookingByIdView = ({ httpPost }) => async ({ checkoutBookingId, signal }) => await httpPost({
2
- endpoint: "/view-checkout-booking-by-id",
3
- body: { checkoutBookingId },
4
- signal,
5
- result: {
6
- error: null,
7
- success: (response) => response.result,
8
- },
9
- });
1
+ const httpCheckoutBookingByIdView = ({ httpPost }) => async ({ checkoutBookingId, signal }) => {
2
+ const response = await httpPost({
3
+ endpoint: "/view-checkout-booking-by-id",
4
+ body: { checkoutBookingId },
5
+ signal,
6
+ });
7
+ return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
+ };
10
9
  export { httpCheckoutBookingByIdView };
@@ -1,10 +1,9 @@
1
- const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => await httpPost({
2
- endpoint: "/view-checkout-item-by-id",
3
- body: { checkoutItemId },
4
- signal,
5
- result: {
6
- error: null,
7
- success: (response) => response.result,
8
- },
9
- });
1
+ const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
2
+ const response = await httpPost({
3
+ endpoint: "/view-checkout-item-by-id",
4
+ body: { checkoutItemId },
5
+ signal,
6
+ });
7
+ return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
+ };
10
9
  export { httpCheckoutItemByIdView };
@@ -1,10 +1,9 @@
1
- const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
2
- endpoint: "/list-checkout-questions-by-checkout-id",
3
- body: { checkoutId },
4
- signal,
5
- result: {
6
- error: null,
7
- success: (response) => response.result,
8
- },
9
- });
1
+ const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
2
+ const response = await httpPost({
3
+ endpoint: "/list-checkout-questions-by-checkout-id",
4
+ body: { checkoutId },
5
+ signal,
6
+ });
7
+ return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
+ };
10
9
  export { httpCheckoutQuestionsByCheckoutIdView };
@@ -1,10 +1,9 @@
1
- const httpPaymentFlowPayloadByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
2
- endpoint: "/view-payment-flow-payload-by-checkout-id",
3
- body: { checkoutId },
4
- signal,
5
- result: {
6
- error: null,
7
- success: (response) => response.result,
8
- },
9
- });
1
+ const httpPaymentFlowPayloadByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
2
+ const response = await httpPost({
3
+ endpoint: "/view-payment-flow-payload-by-checkout-id",
4
+ body: { checkoutId },
5
+ signal,
6
+ });
7
+ return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
+ };
10
9
  export { httpPaymentFlowPayloadByCheckoutIdView };
@@ -1,10 +1,9 @@
1
- const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
2
- endpoint: "/view-pricing-by-checkout-id",
3
- body: { checkoutId },
4
- signal,
5
- result: {
6
- error: null,
7
- success: (response) => response.result,
8
- },
9
- });
1
+ const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
2
+ const response = await httpPost({
3
+ endpoint: "/view-pricing-by-checkout-id",
4
+ body: { checkoutId },
5
+ signal,
6
+ });
7
+ return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
+ };
10
9
  export { httpPricingByCheckoutIdView };
@@ -1,10 +1,9 @@
1
- const httpReturnQuestionsByCheckoutItemIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => await httpPost({
2
- endpoint: "/list-return-questions-by-checkout-item-id",
3
- body: { checkoutItemId },
4
- signal,
5
- result: {
6
- error: null,
7
- success: (response) => response.result,
8
- },
9
- });
1
+ const httpReturnQuestionsByCheckoutItemIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
2
+ const response = await httpPost({
3
+ endpoint: "/list-return-questions-by-checkout-item-id",
4
+ body: { checkoutItemId },
5
+ signal,
6
+ });
7
+ return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
+ };
10
9
  export { httpReturnQuestionsByCheckoutItemIdView };
@@ -2,7 +2,6 @@ import React, { useCallback } from "react";
2
2
  import { Platform } from "react-native";
3
3
  import { useRoutes as reactRouterUseRoutes } from "react-router-native";
4
4
  import { sentryLogger } from "../../shared/logging/SentryLogger";
5
- import { sentryLoggerHOC } from "../../shared/logging/SentryLoggerHOC";
6
5
  import { Routing } from "./routing/Routing";
7
6
  const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
8
7
  // eslint-disable-next-line react/display-name, react/prop-types
@@ -11,6 +10,6 @@ const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
11
10
  return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
12
11
  React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, useRoutes: useRoutes, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
13
12
  };
14
- return sentryLoggerHOC({ logger: sentryLogger(sentry) })(Root);
13
+ return sentryLogger(sentry)(Root);
15
14
  };
16
15
  export { root };
@@ -1,9 +1,2 @@
1
- import { Logger } from "../../../shared/logging/Logger";
2
- interface UsePaymentInstrumentEventsFunctionArgs {
3
- readonly logger: Logger;
4
- }
5
- interface UsePaymentInstrumentEventsFunction {
6
- (args: UsePaymentInstrumentEventsFunctionArgs): void;
7
- }
8
- declare const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction;
1
+ declare const usePaymentInstrumentEvents: () => void;
9
2
  export { usePaymentInstrumentEvents };
@@ -6,10 +6,10 @@ import { I18nMessages } from "../i18n/i18n";
6
6
  import { useToast } from "./useToast";
7
7
  const PAYMENT_ERROR = "ERROR";
8
8
  const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
9
- const usePaymentInstrumentEvents = ({ logger }) => {
9
+ const usePaymentInstrumentEvents = () => {
10
10
  const { subscribe, unsubscribe } = useEvent();
11
11
  const { showError, showSuccess } = useToast();
12
- const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
12
+ const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
13
13
  const onSuccess = useCallback(({ message }) => showSuccess({ message: message.id }), [showSuccess]);
14
14
  const onError = useCallback(({ error }) => {
15
15
  if (error.toaster) {
@@ -0,0 +1,2 @@
1
+ declare const usePaymentInstrumentUpdateEvents: () => void;
2
+ export { usePaymentInstrumentUpdateEvents };
@@ -0,0 +1,28 @@
1
+ import { useEvent } from "@lookiero/event";
2
+ import { useCallback, useEffect } from "react";
3
+ import { useCreateNotification } from "../../../shared/notifications";
4
+ import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
5
+ import { I18nMessages } from "../i18n/i18n";
6
+ import { useToast } from "./useToast";
7
+ const PAYMENT_ERROR = "ERROR";
8
+ const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
9
+ const usePaymentInstrumentUpdateEvents = () => {
10
+ const { subscribe, unsubscribe } = useEvent();
11
+ const { showError, showSuccess } = useToast();
12
+ const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
13
+ const onSuccess = useCallback(({ message }) => showSuccess({ message: message.id }), [showSuccess]);
14
+ const onError = useCallback(({ error }) => {
15
+ if (error.toaster) {
16
+ showError({ message: error.toaster.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR });
17
+ }
18
+ }, [showError]);
19
+ useEffect(() => {
20
+ subscribe({ event: PAYMENT_ERROR }, onError);
21
+ subscribe({ event: PAYMENT_SUCCESS }, onSuccess);
22
+ return () => {
23
+ unsubscribe({ event: PAYMENT_ERROR }, onError);
24
+ unsubscribe({ event: PAYMENT_SUCCESS }, onSuccess);
25
+ };
26
+ }, [subscribe, unsubscribe, createNotification, onError, onSuccess]);
27
+ };
28
+ export { usePaymentInstrumentUpdateEvents };
@@ -1,7 +1,6 @@
1
1
  import { PaymentFlowRef } from "@lookiero/payments-front";
2
2
  import { RefObject } from "react";
3
3
  import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
4
- import { Logger } from "../../../shared/logging/Logger";
5
4
  type Status = "idle" | "loading" | "success" | "error";
6
5
  interface SubmitCheckoutFunctionArgs {
7
6
  readonly paymentFlowPayload: PaymentFlowPayloadProjection;
@@ -15,7 +14,6 @@ interface UseSubmitCheckoutFunctionArgs {
15
14
  readonly checkoutBookingId: string;
16
15
  readonly paymentFlowRef: RefObject<PaymentFlowRef>;
17
16
  readonly onError: () => void;
18
- readonly logger: Logger;
19
17
  }
20
18
  interface UseSubmitCheckoutFunction {
21
19
  (args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckoutResult;
@@ -7,13 +7,16 @@ import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
7
7
  import { useSubmitCheckout as useSubmitCheckoutCommand } from "../../domain/checkout/react/useSubmitCheckout";
8
8
  import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
9
9
  import { I18nMessages } from "../i18n/i18n";
10
- const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onError, logger, }) => {
11
- const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId, logger });
12
- const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId, logger });
13
- const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
10
+ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onError }) => {
11
+ const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId });
12
+ const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId });
13
+ const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
14
14
  const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState("idle");
15
15
  const submitCheckout = useCallback(async ({ paymentFlowPayload }) => {
16
- await blockCheckoutBooking();
16
+ try {
17
+ await blockCheckoutBooking();
18
+ }
19
+ catch (error) { }
17
20
  paymentFlowRef.current?.startLegacyBoxCheckout(
18
21
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
19
22
  // @ts-ignore
@@ -22,7 +25,10 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
22
25
  if (final) {
23
26
  if (status === ChargeStatus.EXECUTED) {
24
27
  setStartLegacyBoxCheckoutStatus("success");
25
- await submitCheckoutCommand();
28
+ try {
29
+ await submitCheckoutCommand();
30
+ }
31
+ catch (error) { }
26
32
  }
27
33
  else {
28
34
  createNotification({
@@ -33,7 +39,7 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
33
39
  }
34
40
  }
35
41
  });
36
- }, [paymentFlowRef, blockCheckoutBooking, createNotification, submitCheckoutCommand]);
42
+ }, [blockCheckoutBooking, createNotification, submitCheckoutCommand, paymentFlowRef]);
37
43
  const status = useMemo(() => {
38
44
  if (blockCheckoutBookingStatus === CommandStatus.LOADING ||
39
45
  startLegacyBoxCheckoutStatus === "loading" ||
@@ -1,6 +1,5 @@
1
1
  declare const COLOR_I18N_PREFIX = "color.";
2
2
  declare enum I18nMessages {
3
- TOAST_GENERIC_ERROR = "toast_generic_error",
4
3
  ITEM_SIZE = "item.size",
5
4
  ITEM_COLOR = "item.color",
6
5
  ITEM_UNIQUE = "item.unique",
@@ -1,7 +1,6 @@
1
1
  const COLOR_I18N_PREFIX = "color.";
2
2
  var I18nMessages;
3
3
  (function (I18nMessages) {
4
- I18nMessages["TOAST_GENERIC_ERROR"] = "toast_generic_error";
5
4
  I18nMessages["ITEM_SIZE"] = "item.size";
6
5
  I18nMessages["ITEM_COLOR"] = "item.color";
7
6
  I18nMessages["ITEM_UNIQUE"] = "item.unique";
@@ -3,19 +3,17 @@ import React, { useEffect, useRef } from "react";
3
3
  import { generatePath, Navigate, useMatch } from "react-router-native";
4
4
  import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
5
5
  import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
6
- import { useLogger } from "../../../shared/logging/useLogger";
7
6
  import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
8
7
  import { useStartCheckout } from "../../domain/checkout/react/useStartCheckout";
9
8
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
10
9
  import { Routes } from "./routes";
11
10
  import { useBasePath } from "./useBasePath";
12
11
  const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null), children }) => {
13
- const logger = useLogger();
14
12
  const basePath = useBasePath();
15
13
  const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
16
14
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
17
15
  const firstItemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
18
- const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id, logger });
16
+ const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id });
19
17
  useEffect(() => {
20
18
  if (checkout?.id) {
21
19
  startCheckout();
@@ -2,7 +2,6 @@ import { QueryStatus } from "@lookiero/messaging-react";
2
2
  import { PaymentFlow } from "@lookiero/payments-front";
3
3
  import React, { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { useNavigate } from "react-router-native";
5
- import { useLogger } from "../../../../../../shared/logging/useLogger";
6
5
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
7
6
  import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
8
7
  import { useSubmitCheckout } from "../../../../hooks/useSubmitCheckout";
@@ -11,7 +10,6 @@ import { useBasePath } from "../../../../routing/useBasePath";
11
10
  import { CheckoutSuccessModal } from "../checkoutSuccessModal/CheckoutSuccessModal";
12
11
  const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
13
12
  const paymentFlowRef = useRef(null);
14
- const logger = useLogger();
15
13
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
16
14
  const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
17
15
  checkoutId: checkout?.id,
@@ -30,7 +28,6 @@ const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
30
28
  checkoutBookingId: checkout?.checkoutBookingId,
31
29
  paymentFlowRef,
32
30
  onError: handleOnErrorSubmitCheckout,
33
- logger,
34
31
  });
35
32
  useEffect(() => {
36
33
  if (paymentFlowPayload) {
@@ -1,12 +1,10 @@
1
1
  import { PaymentInstrumentSelect, PaymentMethod, Section } from "@lookiero/payments-front";
2
2
  import React, { useRef } from "react";
3
- import { useLogger } from "../../../../../../shared/logging/useLogger";
4
3
  import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
5
4
  const PaymentInstrument = ({ useRedirect }) => {
6
5
  const paymentInstrumentSelectRef = useRef(null);
7
6
  const { returnUrl } = useRedirect();
8
- const logger = useLogger();
9
- usePaymentInstrumentEvents({ logger });
7
+ usePaymentInstrumentEvents();
10
8
  return (React.createElement(PaymentInstrumentSelect, { ref: paymentInstrumentSelectRef, beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, hidePaymentMethods: [PaymentMethod.GOOGLE_PAY], section: Section.BOX_CHECKOUT }));
11
9
  };
12
10
  export { PaymentInstrument };
@@ -1,7 +1,6 @@
1
1
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
2
2
  import React, { useCallback } from "react";
3
3
  import { Platform } from "react-native";
4
- import { useLogger } from "../../../../shared/logging/useLogger";
5
4
  import { usePageView } from "../../../../shared/tracking/infrastructure/usePageView";
6
5
  import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
7
6
  import { useGiveCheckoutFeedback } from "../../../domain/checkoutFeedback/react/useGiveCheckoutFeedback";
@@ -15,14 +14,12 @@ import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
15
14
  import { style } from "./Feedback.style";
16
15
  import { CheckoutQuestionsForm } from "./components/checkoutQuestionsForm/CheckoutQuestionsForm";
17
16
  const Feedback = ({ customerId, country }) => {
18
- const logger = useLogger();
19
17
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
20
18
  const [checkoutQuestions, checkoutQuestionsStatus] = useListCheckoutQuestionsByCheckoutId({
21
19
  checkoutId: checkout?.id,
22
20
  });
23
21
  const [giveCheckoutFeedback, giveCheckoutFeedbackStatus] = useGiveCheckoutFeedback({
24
22
  checkoutId: checkout?.id,
25
- logger,
26
23
  });
27
24
  const handleOnSubmit = useCallback(async (feedbacks) => {
28
25
  try {
@@ -30,7 +30,7 @@ const Intro = ({ customerId }) => {
30
30
  const [incrementIntroShownCount, incrementIntroShownCountStatus] = useIncrementIntroShownCount();
31
31
  if (fiveItemsDiscountStatus === QueryStatus.LOADING)
32
32
  return React.createElement(Spinner, null);
33
- return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0, style: { safeAreaView: style.container } },
33
+ return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
34
34
  React.createElement(Body, { style: { column: style.bodyColumn } },
35
35
  React.createElement(View, { style: style.intro },
36
36
  React.createElement(View, { style: style.content },
@@ -7,9 +7,6 @@ declare const style: {
7
7
  flexDirection: "row";
8
8
  marginVertical: number;
9
9
  };
10
- container: {
11
- flex: number;
12
- };
13
10
  content: {
14
11
  alignItems: "center";
15
12
  };
@@ -10,9 +10,6 @@ const style = StyleSheet.create({
10
10
  flexDirection: "row",
11
11
  marginVertical: spaceS,
12
12
  },
13
- container: {
14
- flex: 1,
15
- },
16
13
  content: {
17
14
  alignItems: "center",
18
15
  },
@@ -4,7 +4,6 @@ import { Platform, View } from "react-native";
4
4
  import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
5
5
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
6
6
  import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
7
- import { useLogger } from "../../../../shared/logging/useLogger";
8
7
  import { usePageView } from "../../../../shared/tracking/infrastructure/usePageView";
9
8
  import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
10
9
  import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
@@ -33,7 +32,6 @@ import { SizeChangeModal } from "./components/sizeChangeModal/SizeChangeModal";
33
32
  import { SizeWithoutStockModal } from "./components/sizeWithoutStockModal/SizeWithoutStockModal";
34
33
  const { spaceXL } = theme();
35
34
  const Item = ({ customerId, country }) => {
36
- const logger = useLogger();
37
35
  const { id } = useParams();
38
36
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
39
37
  const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
@@ -65,14 +63,12 @@ const Item = ({ customerId, country }) => {
65
63
  setCustomerDecissionMade(checkoutItem.status !== CheckoutItemStatus.INITIAL);
66
64
  }, [checkoutItem.status, id]);
67
65
  const handleOnBannerPress = useCallback(() => setCustomerDecissionMade(false), []);
68
- const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id, logger });
66
+ const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id });
69
67
  const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
70
68
  checkoutItemId: checkoutItem.id,
71
- logger,
72
69
  });
73
70
  const [replaceCheckoutItem, replaceCheckoutItemStatus] = useReplaceCheckoutItem({
74
71
  checkoutItemId: checkoutItem.id,
75
- logger,
76
72
  });
77
73
  const [sizeWithoutStockModalVisible, setSizeWithoutStockModalVisible] = useState(false);
78
74
  const handleOnShowSizeWithoutStockModal = useCallback(() => setSizeWithoutStockModalVisible(true), []);
@@ -91,7 +87,6 @@ const Item = ({ customerId, country }) => {
91
87
  const [bookCheckoutBooking] = useBookCheckoutBookingForCheckoutItem({
92
88
  checkoutItemId: checkoutItem.id,
93
89
  checkoutBookingId: checkout?.checkoutBookingId,
94
- logger,
95
90
  });
96
91
  useEffect(() => {
97
92
  checkout && bookedProductsVariants === null && bookCheckoutBooking();
@@ -5,7 +5,7 @@ import { Image, Pressable, View } from "react-native";
5
5
  import Svg, { Line } from "react-native-svg";
6
6
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
7
7
  import { size } from "../../../../../../projection/shared/size";
8
- import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
8
+ import { Icon } from "../../../../../../shared/ui/components/atoms/icon/Icon";
9
9
  import { Price } from "../../../../components/atoms/price/Price";
10
10
  import { useMediaImage } from "../../../../hooks/useMediaImage";
11
11
  import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
@@ -39,6 +39,6 @@ const ProductVariant = ({ media, brand, name, price, size: sizeProjection, color
39
39
  status === CheckoutItemStatus.REPLACED && (React.createElement(View, { style: style.sizeChange },
40
40
  React.createElement(Text, { level: 3, style: style.sizeChangeText, detail: true }, sizeChangeText)))),
41
41
  React.createElement(Price, { price: price, variant: "detail" }))),
42
- onPress && React.createElement(ButtonIcon, { name: "arrow-right" })));
42
+ onPress && React.createElement(Icon, { name: "arrow-right" })));
43
43
  };
44
44
  export { ProductVariant };
@@ -1,14 +1,19 @@
1
+ import { ComponentType } from "react";
1
2
  import { Platform } from "react-native";
2
- import { Logger } from "./Logger";
3
3
  interface SentryLoggerFunctionArgs {
4
4
  readonly publicKey: string;
5
5
  readonly environment: `${typeof Platform.OS}-${"DEV" | "PROD" | "EXPO"}`;
6
6
  readonly release: string;
7
7
  readonly project: string;
8
8
  }
9
+ interface SentryLoggerHOCProps {
10
+ readonly customer: {
11
+ readonly customerId: string;
12
+ } | undefined;
13
+ }
9
14
  interface SentryLoggerFunction {
10
- (args: SentryLoggerFunctionArgs): Logger;
15
+ (args: SentryLoggerFunctionArgs): <P extends SentryLoggerHOCProps>(Component: ComponentType<P>) => ComponentType<P & JSX.IntrinsicAttributes>;
11
16
  }
12
17
  declare const sentryLogger: SentryLoggerFunction;
13
- export type { SentryLoggerFunctionArgs };
18
+ export type { SentryLoggerFunctionArgs, SentryLoggerHOCProps };
14
19
  export { sentryLogger };
@@ -1,7 +1,9 @@
1
1
  import { defaultStackParser } from "@sentry/browser";
2
2
  import { makeMain } from "@sentry/core";
3
+ import React, { useEffect } from "react";
3
4
  import { Platform } from "react-native";
4
- import { Client, Hub, integrations, transport } from "./SentryDependencies";
5
+ import { useRoutes as reactRouterUseRoutes } from "react-router-native";
6
+ import { Client, Hub, transport, integrations, wrapUseRoutes, wrapComponent, ErrorBoundary, } from "./SentryDependencies";
5
7
  // This configuration is obtained from
6
8
  // https://docs.sentry.io/clients/javascript/tips/#decluttering-sentry
7
9
  const IGNORED_ERRORS = [
@@ -49,10 +51,10 @@ const DENIED_URLS = [
49
51
  /webappstoolbarba\.texthelp\.com\//i,
50
52
  /metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
51
53
  ];
52
- const sentryLogger = ({ environment, release, publicKey, project }) => {
54
+ const sentryLogger = ({ publicKey, environment, release, project }) => {
53
55
  let globalHub;
54
56
  let currentHub;
55
- const createHub = () => {
57
+ const initHub = () => {
56
58
  const client = new Client({
57
59
  environment,
58
60
  release,
@@ -70,30 +72,28 @@ const sentryLogger = ({ environment, release, publicKey, project }) => {
70
72
  });
71
73
  return new Hub(client);
72
74
  };
73
- const init = () => {
74
- /**
75
- * BrowserClient must be initialized before wrapUseRoutes is used.
76
- *
77
- * ReactNativeClient cannot be initialized until actual component is rendered.
78
- * Its initialization will trigger the native sdk setup with the provided settings,
79
- * but by the time an event will be sent to Sentry, the host project (UAF)
80
- * will have overridden its configuration (dsn, etc) after initializing it
81
- * so we have to initialize it after the component mount.
82
- */
83
- if (Platform.OS === "web") {
84
- currentHub = createHub();
85
- }
86
- };
75
+ /**
76
+ * BrowserClient must be initialized before wrapUseRoutes is used.
77
+ *
78
+ * ReactNativeClient cannot be initialized until actual component is rendered.
79
+ * Its initialization will trigger the native sdk setup with the provided settings,
80
+ * but by the time an event will be sent to Sentry, the host project (UAF)
81
+ * will have overridden its configuration (dsn, etc) after initializing it
82
+ * so we have to initialize it after the component mount.
83
+ */
84
+ if (Platform.OS === "web") {
85
+ currentHub = initHub();
86
+ }
87
87
  const onMount = (customerId) => {
88
88
  // currentHub won't be initialized in native until this time
89
- currentHub = currentHub ?? createHub();
89
+ currentHub = currentHub ?? initHub();
90
90
  currentHub.setUser({ id: customerId });
91
91
  currentHub.startSession();
92
92
  if (!globalHub) {
93
93
  globalHub = makeMain(currentHub);
94
94
  }
95
95
  };
96
- const onUnmount = () => {
96
+ const onUnMount = () => {
97
97
  if (currentHub) {
98
98
  currentHub.endSession();
99
99
  currentHub.setUser(null);
@@ -104,14 +104,20 @@ const sentryLogger = ({ environment, release, publicKey, project }) => {
104
104
  globalHub = null;
105
105
  }
106
106
  };
107
- const captureException = (error) => {
108
- currentHub?.captureException(error);
109
- };
110
- return {
111
- init,
112
- onMount,
113
- onUnmount,
114
- captureException,
107
+ const useRoutes = wrapUseRoutes(reactRouterUseRoutes);
108
+ return (Component) => {
109
+ const WrappedComponent = wrapComponent(Component);
110
+ const SentryLogger = (props) => {
111
+ const { customer } = props;
112
+ useEffect(() => {
113
+ onMount(customer?.customerId);
114
+ return onUnMount;
115
+ // eslint-disable-next-line react-hooks/exhaustive-deps
116
+ }, []);
117
+ return (React.createElement(ErrorBoundary, null,
118
+ React.createElement(WrappedComponent, { ...props, useRoutes: useRoutes })));
119
+ };
120
+ return SentryLogger;
115
121
  };
116
122
  };
117
123
  export { sentryLogger };
@@ -1,5 +1,4 @@
1
1
  import { CommandStatus } from "@lookiero/messaging-react";
2
- import { Logger } from "../../../../../logging/Logger";
3
2
  import { NotificationLevel } from "../../../../domain/notification/model/notification";
4
3
  interface CreateNotificationFunctionArgs {
5
4
  readonly aggregateId?: string;
@@ -12,7 +11,6 @@ interface CreateNotificationFunction {
12
11
  }
13
12
  interface UseCreateNotificationFunctionArgs {
14
13
  readonly contextId: string;
15
- readonly logger: Logger;
16
14
  }
17
15
  interface UseCreateNotificationFunction {
18
16
  (args: UseCreateNotificationFunctionArgs): [create: CreateNotificationFunction, status: CommandStatus];