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

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 (109) hide show
  1. package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +13 -0
  2. package/dist/domain/checkout/command/markCheckoutAsPaid.js +4 -0
  3. package/dist/domain/checkout/model/checkout.js +1 -0
  4. package/dist/domain/checkout/model/checkoutPaid.d.ts +13 -0
  5. package/dist/domain/checkout/model/checkoutPaid.js +4 -0
  6. package/dist/infrastructure/delivery/http/fetchHttpClient.js +36 -19
  7. package/dist/infrastructure/delivery/http/httpClient.d.ts +9 -3
  8. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +5 -0
  9. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +13 -0
  10. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +13 -0
  11. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +16 -0
  12. package/dist/infrastructure/domain/checkout/react/useStartCheckout.d.ts +3 -1
  13. package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +11 -4
  14. package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.d.ts +3 -1
  15. package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.js +19 -6
  16. package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +2 -0
  17. package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +19 -4
  18. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +13 -0
  19. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +14 -0
  20. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.d.ts +2 -0
  21. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.js +20 -5
  22. package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.d.ts +2 -0
  23. package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.js +20 -5
  24. package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.d.ts +2 -0
  25. package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.js +19 -4
  26. package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.d.ts +2 -0
  27. package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.js +20 -5
  28. package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.d.ts +2 -0
  29. package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.js +20 -5
  30. package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +5 -1
  31. package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +13 -6
  32. package/dist/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.js +9 -8
  33. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +12 -0
  34. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +9 -0
  35. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +10 -0
  36. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +12 -0
  37. package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +9 -8
  38. package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +9 -8
  39. package/dist/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.js +8 -7
  40. package/dist/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.js +8 -7
  41. package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +1 -4
  42. package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.js +9 -8
  43. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +12 -0
  44. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +9 -0
  45. package/dist/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.js +9 -8
  46. package/dist/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +9 -8
  47. package/dist/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.js +9 -8
  48. package/dist/infrastructure/projection/pricing/httpPricingByCheckoutIdView.js +9 -8
  49. package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +9 -8
  50. package/dist/infrastructure/ui/Root.js +2 -1
  51. package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +8 -1
  52. package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +2 -2
  53. package/dist/infrastructure/ui/hooks/useSubmitCheckout.d.ts +2 -0
  54. package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +7 -13
  55. package/dist/infrastructure/ui/i18n/i18n.d.ts +1 -0
  56. package/dist/infrastructure/ui/i18n/i18n.js +1 -0
  57. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +3 -1
  58. package/dist/infrastructure/ui/views/App.style.d.ts +4 -0
  59. package/dist/infrastructure/ui/views/App.style.js +16 -0
  60. package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +3 -0
  61. package/dist/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +3 -1
  62. package/dist/infrastructure/ui/views/feedback/Feedback.js +3 -0
  63. package/dist/infrastructure/ui/views/header/Header.d.ts +15 -0
  64. package/dist/infrastructure/ui/views/header/Header.js +90 -0
  65. package/dist/infrastructure/ui/views/header/Header.style.d.ts +35 -0
  66. package/dist/infrastructure/ui/views/header/Header.style.js +38 -0
  67. package/dist/infrastructure/ui/views/header/components/Logo.d.ts +7 -0
  68. package/dist/infrastructure/ui/views/header/components/Logo.js +11 -0
  69. package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +7 -0
  70. package/dist/infrastructure/ui/views/header/components/Logo.style.js +8 -0
  71. package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
  72. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +3 -0
  73. package/dist/infrastructure/ui/views/intro/Intro.style.js +3 -0
  74. package/dist/infrastructure/ui/views/item/Item.js +6 -1
  75. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +2 -2
  76. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +10 -0
  77. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +1 -0
  78. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +25 -0
  79. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +8 -0
  80. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +25 -0
  81. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +8 -0
  82. package/dist/shared/logging/Logger.d.ts +7 -0
  83. package/dist/shared/logging/Logger.js +1 -0
  84. package/dist/shared/logging/SentryLogger.d.ts +3 -8
  85. package/dist/shared/logging/SentryLogger.js +27 -33
  86. package/dist/shared/logging/SentryLoggerHOC.d.ts +15 -0
  87. package/dist/shared/logging/SentryLoggerHOC.js +24 -0
  88. package/dist/shared/logging/location.d.ts +3 -0
  89. package/dist/shared/logging/location.js +5 -0
  90. package/dist/shared/logging/matchRoutes.d.ts +3 -0
  91. package/dist/shared/logging/matchRoutes.js +7 -0
  92. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +29 -0
  93. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +134 -0
  94. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +22 -0
  95. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +15 -0
  96. package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +27 -0
  97. package/dist/shared/logging/reactRouterV6Instrumentation.native.js +115 -0
  98. package/dist/shared/logging/useLogger.d.ts +12 -0
  99. package/dist/shared/logging/useLogger.js +10 -0
  100. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +1 -0
  101. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +9 -0
  102. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +2 -0
  103. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +14 -7
  104. package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.d.ts +2 -0
  105. package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.js +9 -2
  106. package/dist/shared/notifications/infrastructure/ui/views/Notifications.js +3 -1
  107. package/package.json +2 -1
  108. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +0 -2
  109. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +0 -28
@@ -3,13 +3,20 @@ import { useCallback } from "react";
3
3
  import { v4 as uuid } from "uuid";
4
4
  import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
5
5
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const useUpdateUiSetting = () => {
6
+ const useUpdateUiSetting = ({ logger }) => {
7
7
  const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
- const update = useCallback(({ key, value }) => commandBus(updateUiSetting({
9
- aggregateId: uuid(),
10
- key,
11
- value,
12
- })), [commandBus]);
8
+ const update = useCallback(async ({ key, value }) => {
9
+ try {
10
+ await commandBus(updateUiSetting({
11
+ aggregateId: uuid(),
12
+ key,
13
+ value,
14
+ }));
15
+ }
16
+ catch (error) {
17
+ logger.captureException(error);
18
+ }
19
+ }, [commandBus, logger]);
13
20
  return [update, status];
14
21
  };
15
22
  export { useUpdateUiSetting };
@@ -1,9 +1,10 @@
1
- const httpBookedProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
2
- const response = await httpPost({
3
- endpoint: "/view-booked-product-variants-for-checkout-item",
4
- body: { checkoutItemId },
5
- signal,
6
- });
7
- return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
- };
1
+ const httpBookedProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => await httpPost({
2
+ endpoint: "/view-booked-product-variants-for-checkout-item",
3
+ body: { checkoutItemId },
4
+ signal,
5
+ result: {
6
+ error: null,
7
+ success: (response) => response.result,
8
+ },
9
+ });
9
10
  export { httpBookedProductsVariantsForCheckoutItemView };
@@ -0,0 +1,12 @@
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 };
@@ -0,0 +1,9 @@
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 };
@@ -0,0 +1,10 @@
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 };
@@ -0,0 +1,12 @@
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,10 +1,11 @@
1
1
  import { toCheckoutProjection } from "./checkout";
2
- const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
3
- const response = await httpPost({
4
- endpoint: "/view-checkout-by-id",
5
- body: { checkoutId },
6
- signal,
7
- });
8
- return !response.ok || response.status === 404 ? null : toCheckoutProjection((await response.json()).result);
9
- };
2
+ const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
3
+ endpoint: "/view-checkout-by-id",
4
+ body: { checkoutId },
5
+ signal,
6
+ result: {
7
+ error: null,
8
+ success: (response) => toCheckoutProjection(response.result),
9
+ },
10
+ });
10
11
  export { httpCheckoutByIdView };
@@ -1,10 +1,11 @@
1
1
  import { toCheckoutProjection } from "./checkout";
2
- const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId, signal }) => {
3
- const response = await httpPost({
4
- endpoint: "/view-first-available-checkout-by-customer-id",
5
- body: { customerId },
6
- signal,
7
- });
8
- return !response.ok || response.status === 404 ? null : toCheckoutProjection((await response.json()).result);
9
- };
2
+ const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId, signal }) => await httpPost({
3
+ endpoint: "/view-first-available-checkout-by-customer-id",
4
+ body: { customerId },
5
+ signal,
6
+ result: {
7
+ error: null,
8
+ success: (response) => toCheckoutProjection(response.result),
9
+ },
10
+ });
10
11
  export { httpFirstAvailableCheckoutByCustomerIdView };
@@ -1,8 +1,9 @@
1
- const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
2
- const response = await httpGet({
3
- endpoint: `/view-five-items-discount-by-customer-id/${customerId}`,
4
- signal,
5
- });
6
- return !response.ok ? 0 : await response.json();
7
- };
1
+ const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => await httpGet({
2
+ endpoint: `/view-five-items-discount-by-customer-id/${customerId}`,
3
+ signal,
4
+ result: {
5
+ error: 0,
6
+ success: (response) => response,
7
+ },
8
+ });
8
9
  export { httpFiveItemsDiscountByCustomerIdView };
@@ -1,8 +1,9 @@
1
- const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
2
- const response = await httpGet({
3
- endpoint: `/is-new-checkout-enabled/${customerId}`,
4
- signal,
5
- });
6
- return !response.ok ? false : await response.json();
7
- };
1
+ const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => await httpGet({
2
+ endpoint: `/is-new-checkout-enabled/${customerId}`,
3
+ signal,
4
+ result: {
5
+ error: false,
6
+ success: (response) => response,
7
+ },
8
+ });
8
9
  export { httpIsCheckoutEnabledByCustomerIdView };
@@ -1,7 +1,6 @@
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";
5
4
  import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
6
5
  import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
7
6
  import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
@@ -16,15 +15,13 @@ const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
16
15
  const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
17
16
  const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
18
17
  const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
19
- const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
20
18
  const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
21
19
  isCheckoutItemReplaced(event) ||
22
20
  isCheckoutItemReturned(event) ||
23
21
  isCheckoutStarted(event) ||
24
22
  isCheckoutSubmitted(event) ||
25
23
  isCheckoutFeedbackGiven(event) ||
26
- isCheckoutBookingExpired(event) ||
27
- isCheckoutBookingBooked(event);
24
+ isCheckoutBookingExpired(event);
28
25
  const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
29
26
  query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
30
27
  contextId: MESSAGING_CONTEXT_ID,
@@ -1,9 +1,10 @@
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
- };
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
+ });
9
10
  export { httpCheckoutBookingByIdView };
@@ -0,0 +1,12 @@
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 };
@@ -0,0 +1,9 @@
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,9 +1,10 @@
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
- };
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
+ });
9
10
  export { httpCheckoutItemByIdView };
@@ -1,9 +1,10 @@
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
- };
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
+ });
9
10
  export { httpCheckoutQuestionsByCheckoutIdView };
@@ -1,9 +1,10 @@
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
- };
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
+ });
9
10
  export { httpPaymentFlowPayloadByCheckoutIdView };
@@ -1,9 +1,10 @@
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
- };
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
+ });
9
10
  export { httpPricingByCheckoutIdView };
@@ -1,9 +1,10 @@
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
- };
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
+ });
9
10
  export { httpReturnQuestionsByCheckoutItemIdView };
@@ -2,6 +2,7 @@ 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";
5
6
  import { Routing } from "./routing/Routing";
6
7
  const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
7
8
  // eslint-disable-next-line react/display-name, react/prop-types
@@ -10,6 +11,6 @@ const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
10
11
  return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
11
12
  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 })));
12
13
  };
13
- return sentryLogger(sentry)(Root);
14
+ return sentryLoggerHOC({ logger: sentryLogger(sentry) })(Root);
14
15
  };
15
16
  export { root };
@@ -1,2 +1,9 @@
1
- declare const usePaymentInstrumentEvents: () => void;
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;
2
9
  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 = () => {
9
+ const usePaymentInstrumentEvents = ({ logger }) => {
10
10
  const { subscribe, unsubscribe } = useEvent();
11
11
  const { showError, showSuccess } = useToast();
12
- const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
12
+ const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
13
13
  const onSuccess = useCallback(({ message }) => showSuccess({ message: message.id }), [showSuccess]);
14
14
  const onError = useCallback(({ error }) => {
15
15
  if (error.toaster) {
@@ -1,6 +1,7 @@
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";
4
5
  type Status = "idle" | "loading" | "success" | "error";
5
6
  interface SubmitCheckoutFunctionArgs {
6
7
  readonly paymentFlowPayload: PaymentFlowPayloadProjection;
@@ -14,6 +15,7 @@ interface UseSubmitCheckoutFunctionArgs {
14
15
  readonly checkoutBookingId: string;
15
16
  readonly paymentFlowRef: RefObject<PaymentFlowRef>;
16
17
  readonly onError: () => void;
18
+ readonly logger: Logger;
17
19
  }
18
20
  interface UseSubmitCheckoutFunction {
19
21
  (args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckoutResult;
@@ -7,16 +7,13 @@ 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 }) => {
11
- const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId });
12
- const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId });
13
- const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
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 });
14
14
  const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState("idle");
15
15
  const submitCheckout = useCallback(async ({ paymentFlowPayload }) => {
16
- try {
17
- await blockCheckoutBooking();
18
- }
19
- catch (error) { }
16
+ await blockCheckoutBooking();
20
17
  paymentFlowRef.current?.startLegacyBoxCheckout(
21
18
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
22
19
  // @ts-ignore
@@ -25,10 +22,7 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
25
22
  if (final) {
26
23
  if (status === ChargeStatus.EXECUTED) {
27
24
  setStartLegacyBoxCheckoutStatus("success");
28
- try {
29
- await submitCheckoutCommand();
30
- }
31
- catch (error) { }
25
+ await submitCheckoutCommand();
32
26
  }
33
27
  else {
34
28
  createNotification({
@@ -39,7 +33,7 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
39
33
  }
40
34
  }
41
35
  });
42
- }, [blockCheckoutBooking, createNotification, submitCheckoutCommand, paymentFlowRef]);
36
+ }, [paymentFlowRef, blockCheckoutBooking, createNotification, submitCheckoutCommand]);
43
37
  const status = useMemo(() => {
44
38
  if (blockCheckoutBookingStatus === CommandStatus.LOADING ||
45
39
  startLegacyBoxCheckoutStatus === "loading" ||
@@ -1,5 +1,6 @@
1
1
  declare const COLOR_I18N_PREFIX = "color.";
2
2
  declare enum I18nMessages {
3
+ TOAST_GENERIC_ERROR = "toast_generic_error",
3
4
  ITEM_SIZE = "item.size",
4
5
  ITEM_COLOR = "item.color",
5
6
  ITEM_UNIQUE = "item.unique",
@@ -1,6 +1,7 @@
1
1
  const COLOR_I18N_PREFIX = "color.";
2
2
  var I18nMessages;
3
3
  (function (I18nMessages) {
4
+ I18nMessages["TOAST_GENERIC_ERROR"] = "toast_generic_error";
4
5
  I18nMessages["ITEM_SIZE"] = "item.size";
5
6
  I18nMessages["ITEM_COLOR"] = "item.color";
6
7
  I18nMessages["ITEM_UNIQUE"] = "item.unique";
@@ -3,17 +3,19 @@ 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";
6
7
  import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
7
8
  import { useStartCheckout } from "../../domain/checkout/react/useStartCheckout";
8
9
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
9
10
  import { Routes } from "./routes";
10
11
  import { useBasePath } from "./useBasePath";
11
12
  const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null), children }) => {
13
+ const logger = useLogger();
12
14
  const basePath = useBasePath();
13
15
  const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
14
16
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
15
17
  const firstItemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
16
- const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id });
18
+ const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id, logger });
17
19
  useEffect(() => {
18
20
  if (checkout?.id) {
19
21
  startCheckout();
@@ -0,0 +1,4 @@
1
+ declare const style: {
2
+ header: {};
3
+ };
4
+ export { style };
@@ -0,0 +1,16 @@
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 };
@@ -2,6 +2,7 @@ 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";
5
6
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
6
7
  import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
7
8
  import { useSubmitCheckout } from "../../../../hooks/useSubmitCheckout";
@@ -10,6 +11,7 @@ import { useBasePath } from "../../../../routing/useBasePath";
10
11
  import { CheckoutSuccessModal } from "../checkoutSuccessModal/CheckoutSuccessModal";
11
12
  const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
12
13
  const paymentFlowRef = useRef(null);
14
+ const logger = useLogger();
13
15
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
14
16
  const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
15
17
  checkoutId: checkout?.id,
@@ -28,6 +30,7 @@ const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
28
30
  checkoutBookingId: checkout?.checkoutBookingId,
29
31
  paymentFlowRef,
30
32
  onError: handleOnErrorSubmitCheckout,
33
+ logger,
31
34
  });
32
35
  useEffect(() => {
33
36
  if (paymentFlowPayload) {
@@ -1,10 +1,12 @@
1
1
  import { PaymentInstrumentSelect, PaymentMethod, Section } from "@lookiero/payments-front";
2
2
  import React, { useRef } from "react";
3
+ import { useLogger } from "../../../../../../shared/logging/useLogger";
3
4
  import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
4
5
  const PaymentInstrument = ({ useRedirect }) => {
5
6
  const paymentInstrumentSelectRef = useRef(null);
6
7
  const { returnUrl } = useRedirect();
7
- usePaymentInstrumentEvents();
8
+ const logger = useLogger();
9
+ usePaymentInstrumentEvents({ logger });
8
10
  return (React.createElement(PaymentInstrumentSelect, { ref: paymentInstrumentSelectRef, beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, hidePaymentMethods: [PaymentMethod.GOOGLE_PAY], section: Section.BOX_CHECKOUT }));
9
11
  };
10
12
  export { PaymentInstrument };
@@ -1,6 +1,7 @@
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";
4
5
  import { usePageView } from "../../../../shared/tracking/infrastructure/usePageView";
5
6
  import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
6
7
  import { useGiveCheckoutFeedback } from "../../../domain/checkoutFeedback/react/useGiveCheckoutFeedback";
@@ -14,12 +15,14 @@ import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
14
15
  import { style } from "./Feedback.style";
15
16
  import { CheckoutQuestionsForm } from "./components/checkoutQuestionsForm/CheckoutQuestionsForm";
16
17
  const Feedback = ({ customerId, country }) => {
18
+ const logger = useLogger();
17
19
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
18
20
  const [checkoutQuestions, checkoutQuestionsStatus] = useListCheckoutQuestionsByCheckoutId({
19
21
  checkoutId: checkout?.id,
20
22
  });
21
23
  const [giveCheckoutFeedback, giveCheckoutFeedbackStatus] = useGiveCheckoutFeedback({
22
24
  checkoutId: checkout?.id,
25
+ logger,
23
26
  });
24
27
  const handleOnSubmit = useCallback(async (feedbacks) => {
25
28
  try {
@@ -0,0 +1,15 @@
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 };