@lookiero/checkout 3.3.0-beta.0 → 3.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 (116) hide show
  1. package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +4 -3
  2. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +5 -4
  3. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.js +5 -4
  4. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +4 -3
  5. package/dist/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.js +1 -1
  6. package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +1 -1
  7. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +1 -1
  8. package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +4 -4
  9. package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotificationItem.js +5 -4
  10. package/package.json +3 -3
  11. package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
  12. package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
  13. package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
  14. package/dist/domain/checkout/model/checkoutPaid.js +0 -4
  15. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +0 -6
  16. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +0 -13
  17. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
  18. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
  19. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +0 -13
  20. package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +0 -16
  21. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
  22. package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +0 -14
  23. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
  24. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
  25. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +0 -12
  26. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +0 -9
  27. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +0 -10
  28. package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +0 -12
  29. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +0 -12
  30. package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +0 -9
  31. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +0 -6
  32. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +0 -7
  33. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +0 -6
  34. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +0 -9
  35. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +0 -13
  36. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +0 -19
  37. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +0 -6
  38. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +0 -7
  39. package/dist/infrastructure/ui/hooks/useToast.d.ts +0 -11
  40. package/dist/infrastructure/ui/hooks/useToast.js +0 -49
  41. package/dist/infrastructure/ui/views/App.style.d.ts +0 -4
  42. package/dist/infrastructure/ui/views/App.style.js +0 -16
  43. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +0 -7
  44. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +0 -25
  45. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +0 -16
  46. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +0 -19
  47. package/dist/infrastructure/ui/views/header/Header.d.ts +0 -15
  48. package/dist/infrastructure/ui/views/header/Header.js +0 -90
  49. package/dist/infrastructure/ui/views/header/Header.style.d.ts +0 -35
  50. package/dist/infrastructure/ui/views/header/Header.style.js +0 -38
  51. package/dist/infrastructure/ui/views/header/components/Logo.d.ts +0 -7
  52. package/dist/infrastructure/ui/views/header/components/Logo.js +0 -11
  53. package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +0 -7
  54. package/dist/infrastructure/ui/views/header/components/Logo.style.js +0 -8
  55. package/dist/infrastructure/ui/views/intro/Intro.d.ts +0 -6
  56. package/dist/infrastructure/ui/views/intro/Intro.js +0 -52
  57. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -55
  58. package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -58
  59. package/dist/infrastructure/ui/views/item/Item.style.d.ts +0 -15
  60. package/dist/infrastructure/ui/views/item/Item.style.js +0 -18
  61. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +0 -26
  62. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +0 -44
  63. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +0 -45
  64. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +0 -53
  65. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +0 -7
  66. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +0 -25
  67. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +0 -16
  68. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +0 -19
  69. package/dist/infrastructure/ui/views/navigation/Navigation.d.ts +0 -21
  70. package/dist/infrastructure/ui/views/navigation/Navigation.js +0 -45
  71. package/dist/infrastructure/ui/views/navigation/Navigation.style.d.ts +0 -5
  72. package/dist/infrastructure/ui/views/navigation/Navigation.style.js +0 -30
  73. package/dist/infrastructure/ui/views/navigation/components/header/Header.d.ts +0 -46
  74. package/dist/infrastructure/ui/views/navigation/components/header/Header.js +0 -120
  75. package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +0 -31
  76. package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +0 -34
  77. package/dist/infrastructure/ui/views/navigation/components/header/Logo.d.ts +0 -7
  78. package/dist/infrastructure/ui/views/navigation/components/header/Logo.js +0 -11
  79. package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.d.ts +0 -7
  80. package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.js +0 -8
  81. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +0 -12
  82. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +0 -24
  83. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +0 -15
  84. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +0 -18
  85. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -10
  86. package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +0 -1
  87. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +0 -25
  88. package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +0 -8
  89. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +0 -25
  90. package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +0 -8
  91. package/dist/shared/logging/location.d.ts +0 -3
  92. package/dist/shared/logging/location.js +0 -5
  93. package/dist/shared/logging/matchRoutes.d.ts +0 -3
  94. package/dist/shared/logging/matchRoutes.js +0 -7
  95. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +0 -29
  96. package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +0 -134
  97. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +0 -22
  98. package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +0 -15
  99. package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +0 -27
  100. package/dist/shared/logging/reactRouterV6Instrumentation.native.js +0 -115
  101. package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +0 -17
  102. package/dist/shared/notifications/domain/notification/command/createNotification.js +0 -7
  103. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +0 -1
  104. package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +0 -9
  105. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +0 -21
  106. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +0 -22
  107. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +0 -12
  108. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +0 -24
  109. package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +0 -9
  110. package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +0 -20
  111. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +0 -36
  112. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +0 -31
  113. package/dist/shared/tracking/infrastructure/usePageView.d.ts +0 -13
  114. package/dist/shared/tracking/infrastructure/usePageView.js +0 -27
  115. package/dist/shared/ui/components/atoms/error/Error.style.d.ts +0 -6
  116. package/dist/shared/ui/components/atoms/error/Error.style.js +0 -9
@@ -1,10 +1,11 @@
1
- import { useI18nMessage } from "@lookiero/i18n-react";
2
- import React, { useCallback } from "react";
1
+ import { useIntl } from "@lookiero/i18n-react";
2
+ import React, { useCallback, useMemo } from "react";
3
3
  import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
4
4
  import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
5
5
  const TEXTAREA_MIN_HEIGHT = 96;
6
6
  const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
7
- const placeholderText = useI18nMessage({ id: checkoutQuestion.placeholder });
7
+ const { formatMessage } = useIntl();
8
+ const placeholderText = useMemo(() => (checkoutQuestion.placeholder ? formatMessage({ id: checkoutQuestion.placeholder }) : ""), [formatMessage, checkoutQuestion.placeholder]);
8
9
  const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
9
10
  const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
10
11
  return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
@@ -1,5 +1,5 @@
1
- import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
2
- import React, { useCallback, useEffect, useState } from "react";
1
+ import { useIntl } from "@lookiero/i18n-react";
2
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
3
3
  import { TouchableHighlight, View } from "react-native";
4
4
  import { Modal } from "../../../../../../../shared/ui/components/layouts/modal/Modal";
5
5
  import { ButtonIcon } from "../../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
@@ -8,7 +8,8 @@ import { useReturnQuestionFeedback, useReturnQuestionFeedbackForId } from "../..
8
8
  import { deepestReturnQuestionWithFeedbackForReturnQuestion, feedbackForReturnQuestion, } from "../../util/returnQuestionFeedback";
9
9
  import { style, containerUnderlayColor } from "./HostSelectReturnQuestionItem.style";
10
10
  const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
11
- const placeholderText = useI18nMessage({ id: returnQuestion.placeholder });
11
+ const { formatMessage } = useIntl();
12
+ const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
12
13
  const [modalVisible, setModalVisible] = useState(false);
13
14
  const handleOnPress = useCallback(() => setModalVisible(true), []);
14
15
  const handleOnModalClose = useCallback(() => setModalVisible(false), []);
@@ -32,7 +33,7 @@ const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName
32
33
  return (React.createElement(React.Fragment, null,
33
34
  React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
34
35
  React.createElement(View, { pointerEvents: "none" },
35
- React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholderText || "", value: inputValue }))),
36
+ React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholderText, value: inputValue }))),
36
37
  React.createElement(Modal, { portalHostName: portalHostName, visible: modalVisible, header: deepestReturnQuestionWithFeedback && (React.createElement(ButtonIcon, { name: "arrow-left", testID: "modal-back-button", onPress: handleOnBackButtonPress })), scroll: true, showCloseButton: true, onClose: handleOnModalClose },
37
38
  React.createElement(View, { style: style.modalContent }, children))));
38
39
  };
@@ -1,18 +1,19 @@
1
1
  import { Text } from "@lookiero/aurora";
2
- import { useI18nMessage } from "@lookiero/i18n-react";
2
+ import { useIntl } from "@lookiero/i18n-react";
3
3
  import { animated, useSpring } from "@react-spring/native";
4
- import React, { useCallback, useState } from "react";
4
+ import React, { useCallback, useMemo, useState } from "react";
5
5
  import { View } from "react-native";
6
6
  import ReturnQuestion from "../../ReturnQuestion";
7
7
  import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
8
8
  import { style } from "./HostStackReturnQuestionItem.style";
9
9
  const HostStackReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
10
- const titleText = useI18nMessage({ id: returnQuestion.name });
10
+ const { formatMessage } = useIntl();
11
11
  const { feedback } = useReturnQuestionFeedbackForId({ id: returnQuestion.id });
12
12
  const feedbackReturnQuestion = feedback
13
13
  ? returnQuestion.children?.find((returnQuestion) => returnQuestion.id === feedback)
14
14
  : undefined;
15
- const feedbackText = useI18nMessage({ id: feedbackReturnQuestion?.name });
15
+ const titleText = useMemo(() => (returnQuestion.name ? formatMessage({ id: returnQuestion.name }) : undefined), [formatMessage, returnQuestion.name]);
16
+ const feedbackText = useMemo(() => (feedbackReturnQuestion ? formatMessage({ id: feedbackReturnQuestion.name }) : undefined), [feedbackReturnQuestion, formatMessage]);
16
17
  const [stackHeight, setStackHeight] = useState();
17
18
  const handleOnLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => setStackHeight(height), []);
18
19
  const stackSyle = useSpring({ height: stackHeight });
@@ -1,10 +1,11 @@
1
- import { useI18nMessage } from "@lookiero/i18n-react";
2
- import React, { useCallback } from "react";
1
+ import { useIntl } from "@lookiero/i18n-react";
2
+ import React, { useCallback, useMemo } from "react";
3
3
  import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
4
4
  import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
5
5
  const TEXTAREA_MIN_HEIGHT = 96;
6
6
  const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
7
- const placeholderText = useI18nMessage({ id: returnQuestion.placeholder });
7
+ const { formatMessage } = useIntl();
8
+ const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
8
9
  const { feedback, onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
9
10
  const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: value }), [onChange, returnQuestionParentId]);
10
11
  return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
@@ -3,7 +3,7 @@ import React from "react";
3
3
  import { Banner } from "../../../../components/layouts/banner/Banner";
4
4
  import { I18nMessages } from "../../../../i18n/i18n";
5
5
  const DeliveryBanner = () => {
6
- const deliveryBannerText = useI18nMessage({ id: I18nMessages.CHECKOUT_DELIVERY_BANNER }) || "";
6
+ const deliveryBannerText = useI18nMessage({ id: I18nMessages.CHECKOUT_DELIVERY_BANNER });
7
7
  return React.createElement(Banner, { text: deliveryBannerText });
8
8
  };
9
9
  export { DeliveryBanner };
@@ -12,7 +12,7 @@ const i18nMessageForCheckoutItemStatus = {
12
12
  [CheckoutItemStatus.RETURNED]: I18nMessages.ITEM_BANNER_CUSTOMER_RETURNED_DECISSION,
13
13
  };
14
14
  const CustomerDecissionBanner = ({ checkoutItemStatus, onPress }) => {
15
- const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] }) || "";
15
+ const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] });
16
16
  const bannerButtonText = useI18nMessage({ id: I18nMessages.ITEM_BANNER_BUTTON });
17
17
  return (React.createElement(Banner, { text: decissionText },
18
18
  React.createElement(Pressable, { style: style.button, testID: "customer-decission-banner", onPress: onPress },
@@ -24,7 +24,7 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onSizeSe
24
24
  React.createElement(View, { style: style.row },
25
25
  !currentProductVariant.size.unique && productVariants && (React.createElement(SelectField, { ...(disabledSizeSelector && {
26
26
  onPress: onSizeSelectorPress,
27
- }), options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", testID: "size-selector", title: sizeSelectorLabelText || "", value: currentProductVariant.id, style: {
27
+ }), options: sizeSelectorOptions, placeholder: sizeSelectorLabelText, testID: "size-selector", title: sizeSelectorLabelText, value: currentProductVariant.id, style: {
28
28
  selectField: style.sizeSelector,
29
29
  inputField: { input: disabledSizeSelector && style.inputDisabled },
30
30
  }, onChange: onReplace })),
@@ -14,7 +14,7 @@ const Row = ({ text, level = 3, children }) => (React.createElement(View, { styl
14
14
  React.createElement(Text, { level: level, action: true, upperCase: true }, text),
15
15
  children));
16
16
  const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPercentage = 0, totalCheckoutItemsKept, service, collapsible = true, collapsed = false, busy = false, onPress = () => void 0, onSubmit, }) => {
17
- const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL }) || "";
17
+ const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL });
18
18
  const totalCheckoutItemsKeptText = useI18nMessage({
19
19
  id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
20
20
  values: { items: totalCheckoutItemsKept.toString() },
@@ -25,9 +25,9 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
25
25
  const discountText = useI18nMessage({
26
26
  id: I18nMessages.SUMMARY_DISCOUNT,
27
27
  values: { discount: discountPercentage?.toString() },
28
- }) || "";
29
- const creditText = useI18nMessage({ id: I18nMessages.SUMMARY_CREDIT }) || "";
30
- const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE }) || "";
28
+ });
29
+ const creditText = useI18nMessage({ id: I18nMessages.SUMMARY_CREDIT });
30
+ const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE });
31
31
  const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
32
32
  const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
33
33
  return (React.createElement(Pressable, { testID: "pricing", onPress: collapsible ? onPress : null },
@@ -1,5 +1,5 @@
1
- import { useI18nMessage } from "@lookiero/i18n-react";
2
- import React from "react";
1
+ import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
2
+ import React, { useMemo } from "react";
3
3
  import { useCallback, useEffect } from "react";
4
4
  import { Toast, ToastVariant } from "../../../../../ui/components/molecules/toast/Toast";
5
5
  import { NotificationLevel } from "../../../../domain/notification/model/notification";
@@ -9,8 +9,9 @@ const toastVariantForNotificationLevel = {
9
9
  [NotificationLevel.SUCCESS]: ToastVariant.SUCCESS,
10
10
  };
11
11
  const ToastNotificationItem = ({ notification, onRemove, autoHideTimeout, testID = "toast-notification-item", style: customStyle, }) => {
12
- const title = useI18nMessage({ id: notification.titleI18nKey }) || undefined;
13
- const body = useI18nMessage({ id: notification.bodyI18nKey || "" });
12
+ const { formatMessage } = useIntl();
13
+ const title = useMemo(() => (notification.titleI18nKey ? formatMessage({ id: notification.titleI18nKey }) : undefined), [formatMessage, notification.titleI18nKey]);
14
+ const body = useI18nMessage({ id: notification.bodyI18nKey });
14
15
  const handleOnClose = useCallback(() => onRemove(notification.id), [notification.id, onRemove]);
15
16
  useEffect(() => {
16
17
  if (!autoHideTimeout) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "3.3.0-beta.0",
3
+ "version": "3.4.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "@expo/dev-server": "0.1.120",
30
30
  "@gorhom/portal": "^1.0.14",
31
- "@lookiero/i18n": "^0.8.3",
32
- "@lookiero/i18n-react": "^0.8.3",
31
+ "@lookiero/i18n": "^0.9.0",
32
+ "@lookiero/i18n-react": "^0.9.0",
33
33
  "@lookiero/messaging": "^8.1.1",
34
34
  "@lookiero/messaging-react": "^8.1.1",
35
35
  "@react-spring/native": "9.6.1",
@@ -1,13 +0,0 @@
1
- import { Command } from "@lookiero/messaging";
2
- declare const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
3
- interface MarkCheckoutAsPaidPayload {
4
- readonly aggregateId: string;
5
- }
6
- interface MarkCheckoutAsPaid extends Command<typeof MARK_CHECKOUT_AS_PAID>, MarkCheckoutAsPaidPayload {
7
- }
8
- interface MarkCheckoutAsPaidFunction {
9
- (payload: MarkCheckoutAsPaidPayload): MarkCheckoutAsPaid;
10
- }
11
- declare const markCheckoutAsPaid: MarkCheckoutAsPaidFunction;
12
- export type { MarkCheckoutAsPaid };
13
- export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
@@ -1,4 +0,0 @@
1
- import { command } from "@lookiero/messaging";
2
- const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
3
- const markCheckoutAsPaid = ({ aggregateId }) => command({ aggregateId, name: MARK_CHECKOUT_AS_PAID });
4
- export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
@@ -1,13 +0,0 @@
1
- import { DomainEvent } from "@lookiero/messaging";
2
- declare const CHECKOUT_PAID = "checkout_paid";
3
- interface CheckoutPaidPayload {
4
- readonly aggregateId: string;
5
- }
6
- interface CheckoutPaid extends DomainEvent<typeof CHECKOUT_PAID>, CheckoutPaidPayload {
7
- }
8
- interface CheckoutPaidFunction {
9
- (payload: CheckoutPaidPayload): CheckoutPaid;
10
- }
11
- declare const checkoutPaid: CheckoutPaidFunction;
12
- export type { CheckoutPaid };
13
- export { CHECKOUT_PAID, checkoutPaid };
@@ -1,4 +0,0 @@
1
- import { domainEvent } from "@lookiero/messaging";
2
- const CHECKOUT_PAID = "checkout_paid";
3
- const checkoutPaid = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_PAID });
4
- export { CHECKOUT_PAID, checkoutPaid };
@@ -1,6 +0,0 @@
1
- import { ProcessManagerFunction } from "@lookiero/messaging";
2
- import { CheckoutBookingExpired } from "../model/checkoutBookingExpired";
3
- interface CreateNotificationWhenCheckoutBookingExpiredFunction extends ProcessManagerFunction<CheckoutBookingExpired> {
4
- }
5
- declare const createNotificationWhenCheckoutBookingExpired: CreateNotificationWhenCheckoutBookingExpiredFunction;
6
- export { createNotificationWhenCheckoutBookingExpired };
@@ -1,13 +0,0 @@
1
- import { v4 as uuid } from "uuid";
2
- import { I18nMessages } from "../../../infrastructure/ui/i18n/i18n";
3
- import { createNotification } from "../../../shared/notifications/domain/notification/command/createNotification";
4
- import { NotificationLevel } from "../../../shared/notifications/domain/notification/model/notification";
5
- const createNotificationWhenCheckoutBookingExpired = ({ commandBus }) => async () => {
6
- await commandBus(createNotification({
7
- aggregateId: uuid(),
8
- level: NotificationLevel.ERROR,
9
- titleI18nKey: undefined,
10
- bodyI18nKey: I18nMessages.CHECKOUT_TOAST_BOOKING_EXPIRED,
11
- }));
12
- };
13
- export { createNotificationWhenCheckoutBookingExpired };
@@ -1,5 +0,0 @@
1
- import { HttpCheckoutsSaveFunction } from "./httpCheckouts";
2
- interface HttpCheckoutsMarkAsPaidFunction extends HttpCheckoutsSaveFunction {
3
- }
4
- declare const httpCheckoutsMarkAsPaid: HttpCheckoutsMarkAsPaidFunction;
5
- export { httpCheckoutsMarkAsPaid };
@@ -1,13 +0,0 @@
1
- import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
2
- const isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
3
- const httpCheckoutsMarkAsPaid = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
4
- const checkoutPaid = domainEvents.find(isCheckoutPaid);
5
- if (!checkoutPaid) {
6
- return;
7
- }
8
- await httpPost({
9
- endpoint: "/mark-checkout-as-paid",
10
- body: { checkoutId: aggregateId },
11
- });
12
- };
13
- export { httpCheckoutsMarkAsPaid };
@@ -1,13 +0,0 @@
1
- import { CommandStatus } from "@lookiero/messaging-react";
2
- interface MarkAsPaidFunction {
3
- (): Promise<void>;
4
- }
5
- type UseMarkCheckoutAsPaid = [markAsPaid: MarkAsPaidFunction, status: CommandStatus];
6
- interface UseMarkCheckoutAsPaidFunctionArgs {
7
- readonly checkoutId?: string;
8
- }
9
- interface UseMarkCheckoutAsPaidFunction {
10
- (args: UseMarkCheckoutAsPaidFunctionArgs): UseMarkCheckoutAsPaid;
11
- }
12
- declare const useMarkCheckoutAsPaid: UseMarkCheckoutAsPaidFunction;
13
- export { useMarkCheckoutAsPaid };
@@ -1,16 +0,0 @@
1
- import { useCommand } from "@lookiero/messaging-react";
2
- import { useCallback } from "react";
3
- import invariant from "tiny-invariant";
4
- import { markCheckoutAsPaid } from "../../../../domain/checkout/command/markCheckoutAsPaid";
5
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const useMarkCheckoutAsPaid = ({ checkoutId }) => {
7
- const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
- const markAsPaid = useCallback(() => {
9
- invariant(checkoutId, "CheckoutId must be defined in order to mark the checkout as paid");
10
- return commandBus(markCheckoutAsPaid({
11
- aggregateId: checkoutId,
12
- }));
13
- }, [checkoutId, commandBus]);
14
- return [markAsPaid, status];
15
- };
16
- export { useMarkCheckoutAsPaid };
@@ -1,13 +0,0 @@
1
- import { CommandStatus } from "@lookiero/messaging-react";
2
- interface BookFunction {
3
- (): Promise<void>;
4
- }
5
- type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
6
- interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
7
- readonly checkoutItemId: string;
8
- }
9
- interface UseBookCheckouBookingForCheckoutItemFunction {
10
- (args: UseBookCheckouBookingForCheckoutItemFunctionArgs): UseBookCheckouBookingForCheckoutItem;
11
- }
12
- declare const useBookCheckouBookingForCheckoutItem: UseBookCheckouBookingForCheckoutItemFunction;
13
- export { useBookCheckouBookingForCheckoutItem };
@@ -1,14 +0,0 @@
1
- import { useCommand } from "@lookiero/messaging-react";
2
- import { useCallback } from "react";
3
- import { v4 as uuid } from "uuid";
4
- import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
5
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId }) => {
7
- const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
- const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
9
- aggregateId: uuid(),
10
- checkoutItemId,
11
- })), [checkoutItemId, commandBus]);
12
- return [book, status];
13
- };
14
- export { useBookCheckouBookingForCheckoutItem };
@@ -1,10 +0,0 @@
1
- import { CommandStatus } from "@lookiero/messaging-react";
2
- interface IncrementIntroShownCountFunction {
3
- (): Promise<void>;
4
- }
5
- type UseIncrementIntroShownCount = [incrementIntroShownCount: IncrementIntroShownCountFunction, status: CommandStatus];
6
- interface UseIncrementIntroShownCountFunction {
7
- (): UseIncrementIntroShownCount;
8
- }
9
- declare const useIncrementIntroShownCount: UseIncrementIntroShownCountFunction;
10
- export { useIncrementIntroShownCount };
@@ -1,11 +0,0 @@
1
- import { useCallback } from "react";
2
- import { useViewIntroShownCount } from "../../../projection/uiSetting/react/useViewIntroShownCount";
3
- import { UISettings } from "../../../ui/settings/UISettings";
4
- import { useUpdateUiSetting } from "./useUpdateUiSetting";
5
- const useIncrementIntroShownCount = () => {
6
- const [update, status] = useUpdateUiSetting();
7
- const [introShownCount] = useViewIntroShownCount();
8
- const incrementIntroShownCount = useCallback(() => update({ key: UISettings.INTRO_SHOWN_COUNT, value: introShownCount + 1 }), [introShownCount, update]);
9
- return [incrementIntroShownCount, status];
10
- };
11
- export { useIncrementIntroShownCount };
@@ -1,12 +0,0 @@
1
- import { BookedSizeChangeProductsVariantsForCheckoutItemView } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
2
- import { HttpPostFunction } from "../../delivery/http/httpClient";
3
- interface HttpBookedSizeChangeProductsVariantsForCheckoutItemView extends BookedSizeChangeProductsVariantsForCheckoutItemView {
4
- }
5
- interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs {
6
- readonly httpPost: HttpPostFunction;
7
- }
8
- interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction {
9
- (args: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeChangeProductsVariantsForCheckoutItemView;
10
- }
11
- declare const httpBookedSizeChangeProductsVariantsForCheckoutItemView: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction;
12
- export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
@@ -1,9 +0,0 @@
1
- const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
2
- const response = await httpPost({
3
- endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
4
- body: { checkoutItemId },
5
- signal,
6
- });
7
- return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
- };
9
- export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
@@ -1,10 +0,0 @@
1
- import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
- import { BookedSizeChangeProductsVariantsProjection } from "../../../../projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants";
3
- interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs {
4
- readonly checkoutItemId: string;
5
- }
6
- interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
7
- (args: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeChangeProductsVariantsProjection>;
8
- }
9
- declare const useViewBookedSizeChangeProductsVariantsForCheckoutItem: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
10
- export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
@@ -1,12 +0,0 @@
1
- import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
3
- import { viewBookedSizeChangeProductsVariantsForCheckoutItem } from "../../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
4
- import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
- const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
6
- const useViewBookedSizeChangeProductsVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
7
- query: viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId }),
8
- contextId: MESSAGING_CONTEXT_ID,
9
- invalidation: isCheckoutBookingBooked,
10
- options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
11
- });
12
- export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
@@ -1,12 +0,0 @@
1
- import { CheckoutFeedbackByCheckoutIdView } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId";
2
- import { HttpPostFunction } from "../../delivery/http/httpClient";
3
- interface HttpCheckoutFeebackByCheckoutIdView extends CheckoutFeedbackByCheckoutIdView {
4
- }
5
- interface HttpCheckoutFeebackByCheckoutIdViewFunctionArgs {
6
- readonly httpPost: HttpPostFunction;
7
- }
8
- interface HttpCheckoutFeebackByCheckoutIdViewFunction {
9
- (args: HttpCheckoutFeebackByCheckoutIdViewFunctionArgs): HttpCheckoutFeebackByCheckoutIdView;
10
- }
11
- declare const httpCheckoutFeebackByCheckoutIdView: HttpCheckoutFeebackByCheckoutIdViewFunction;
12
- export { httpCheckoutFeebackByCheckoutIdView };
@@ -1,9 +0,0 @@
1
- const httpCheckoutFeebackByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
2
- const response = await httpPost({
3
- endpoint: "/view-checkout-feedback-by-checkout-id",
4
- body: { checkoutId },
5
- signal,
6
- });
7
- return !response.ok || response.status === 404 ? null : (await response.json()).result;
8
- };
9
- export { httpCheckoutFeebackByCheckoutIdView };
@@ -1,6 +0,0 @@
1
- import { QueryStatus } from "@lookiero/messaging-react";
2
- interface UseShouldIntroBeShownFunction {
3
- (): [boolean, QueryStatus];
4
- }
5
- declare const useShouldIntroBeShown: UseShouldIntroBeShownFunction;
6
- export { useShouldIntroBeShown };
@@ -1,7 +0,0 @@
1
- import { useViewIntroShownCount } from "./useViewIntroShownCount";
2
- const MAX_INTRO_SHOWN_COUNT = 2;
3
- const useShouldIntroBeShown = () => {
4
- const [introShownCount, introShownCountStatus] = useViewIntroShownCount();
5
- return [introShownCount < MAX_INTRO_SHOWN_COUNT, introShownCountStatus];
6
- };
7
- export { useShouldIntroBeShown };
@@ -1,6 +0,0 @@
1
- import { QueryStatus } from "@lookiero/messaging-react";
2
- interface UseViewIntroShownCountFunction {
3
- (): [number, QueryStatus];
4
- }
5
- declare const useViewIntroShownCount: UseViewIntroShownCountFunction;
6
- export { useViewIntroShownCount };
@@ -1,9 +0,0 @@
1
- import { UISettings } from "../../../ui/settings/UISettings";
2
- import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
3
- const useViewIntroShownCount = () => {
4
- const [introShownCount, introShownCountStatus] = useViewUiSettingByKey({
5
- key: UISettings.INTRO_SHOWN_COUNT,
6
- });
7
- return [introShownCount?.value || 0, introShownCountStatus];
8
- };
9
- export { useViewIntroShownCount };
@@ -1,13 +0,0 @@
1
- import { FC, ReactNode } from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
- import { Edge } from "react-native-safe-area-context";
4
- type SafeAreaScrollViewStyle = "safeAreaView" | "scrollView";
5
- interface SafeAreaScrollViewProps {
6
- readonly children: ReactNode;
7
- readonly footer?: ReactNode;
8
- readonly scrollerPaddingTop?: number;
9
- readonly edges?: Edge[];
10
- readonly style?: Partial<Record<SafeAreaScrollViewStyle, StyleProp<ViewStyle>>>;
11
- }
12
- declare const SafeAreaScrollView: FC<SafeAreaScrollViewProps>;
13
- export { SafeAreaScrollView };
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- import { ScrollView } from "react-native";
3
- import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
4
- import { theme } from "../../theme/theme";
5
- import { style } from "./SafeAreaScrollView.style.ts";
6
- const { spaceXXL } = theme();
7
- const SafeAreaScrollView = ({ children, footer, edges = ["top", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
8
- const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
9
- return (React.createElement(SafeAreaView, { edges: edges, style: [style.safeAreaView, customStyle?.safeAreaView] },
10
- React.createElement(ScrollView, { contentContainerStyle: [
11
- {
12
- paddingTop: scrollerPaddingTop,
13
- paddingBottom: safeAreaInsetBottom + spaceXXL,
14
- },
15
- customStyle?.scrollView,
16
- ] }, children),
17
- footer));
18
- };
19
- export { SafeAreaScrollView };
@@ -1,6 +0,0 @@
1
- declare const style: {
2
- safeAreaView: {
3
- flex: number;
4
- };
5
- };
6
- export { style };
@@ -1,7 +0,0 @@
1
- import { StyleSheet } from "react-native";
2
- const style = StyleSheet.create({
3
- safeAreaView: {
4
- flex: 1,
5
- },
6
- });
7
- export { style };
@@ -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 };
@@ -1,4 +0,0 @@
1
- declare const style: {
2
- header: {};
3
- };
4
- export { style };
@@ -1,16 +0,0 @@
1
- import { Platform, StyleSheet } from "react-native";
2
- const style = StyleSheet.create({
3
- header: {
4
- ...Platform.select({
5
- web: {
6
- position: "fixed",
7
- zIndex: 1,
8
- },
9
- native: {
10
- position: "absolute",
11
- zIndex: 1,
12
- },
13
- }),
14
- },
15
- });
16
- export { style };
@@ -1,7 +0,0 @@
1
- import { FC } from "react";
2
- interface CheckoutSuccessModalProps {
3
- readonly visible: boolean;
4
- readonly onDismiss: () => void;
5
- }
6
- declare const CheckoutSuccessModal: FC<CheckoutSuccessModalProps>;
7
- export { CheckoutSuccessModal };