@lookiero/checkout 3.6.1-beta.1 → 3.7.0-beta.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 (125) hide show
  1. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +6 -0
  2. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +13 -0
  3. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +10 -0
  4. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +11 -0
  5. package/dist/infrastructure/projection/checkout/checkout.js +0 -12
  6. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +6 -0
  7. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +7 -0
  8. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +6 -0
  9. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +9 -0
  10. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +7 -12
  11. package/dist/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +1 -1
  12. package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +1 -0
  13. package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -2
  14. package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +3 -3
  15. package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -2
  16. package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +1 -1
  17. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +1 -0
  18. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -2
  19. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -2
  20. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -2
  21. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +13 -0
  22. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +19 -0
  23. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +6 -0
  24. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +7 -0
  25. package/dist/infrastructure/ui/components/templates/header/header/Header.d.ts +3 -0
  26. package/dist/infrastructure/ui/components/templates/header/header/Header.js +10 -0
  27. package/dist/infrastructure/ui/components/templates/header/header/Header.style.d.ts +9 -0
  28. package/dist/infrastructure/ui/components/templates/header/header/Header.style.js +12 -0
  29. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts +13 -0
  30. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js +19 -0
  31. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.d.ts +6 -0
  32. package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.js +7 -0
  33. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +2 -0
  34. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +28 -0
  35. package/dist/infrastructure/ui/hooks/useToast.d.ts +11 -0
  36. package/dist/infrastructure/ui/hooks/useToast.js +49 -0
  37. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +7 -0
  38. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +25 -0
  39. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +16 -0
  40. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +19 -0
  41. package/dist/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +1 -1
  42. package/dist/infrastructure/ui/views/intro/Intro.d.ts +6 -0
  43. package/dist/infrastructure/ui/views/intro/Intro.js +52 -0
  44. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +52 -0
  45. package/dist/infrastructure/ui/views/intro/Intro.style.js +55 -0
  46. package/dist/infrastructure/ui/views/item/Item.style.d.ts +15 -0
  47. package/dist/infrastructure/ui/views/item/Item.style.js +18 -0
  48. package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +6 -4
  49. package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +10 -3
  50. package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +10 -3
  51. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -3
  52. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.d.ts +3 -0
  53. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.js +3 -0
  54. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +26 -0
  55. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +44 -0
  56. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +45 -0
  57. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +53 -0
  58. package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js +10 -7
  59. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.d.ts +1 -0
  60. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.js +1 -0
  61. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -2
  62. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +3 -0
  63. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +3 -0
  64. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +7 -0
  65. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +25 -0
  66. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +16 -0
  67. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +19 -0
  68. package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -3
  69. package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.d.ts +10 -3
  70. package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.js +10 -3
  71. package/dist/infrastructure/ui/views/navigation/Navigation.d.ts +21 -0
  72. package/dist/infrastructure/ui/views/navigation/Navigation.js +45 -0
  73. package/dist/infrastructure/ui/views/navigation/Navigation.style.d.ts +5 -0
  74. package/dist/infrastructure/ui/views/navigation/Navigation.style.js +30 -0
  75. package/dist/infrastructure/ui/views/navigation/components/header/Header.d.ts +46 -0
  76. package/dist/infrastructure/ui/views/navigation/components/header/Header.js +120 -0
  77. package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +31 -0
  78. package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +34 -0
  79. package/dist/infrastructure/ui/views/navigation/components/header/Logo.d.ts +7 -0
  80. package/dist/infrastructure/ui/views/navigation/components/header/Logo.js +11 -0
  81. package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.d.ts +7 -0
  82. package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.js +8 -0
  83. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +12 -0
  84. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +24 -0
  85. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +15 -0
  86. package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +18 -0
  87. package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +6 -5
  88. package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +6 -0
  89. package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +6 -0
  90. package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +17 -0
  91. package/dist/shared/notifications/domain/notification/command/createNotification.js +7 -0
  92. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +21 -0
  93. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +22 -0
  94. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +12 -0
  95. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +24 -0
  96. package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +9 -0
  97. package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +20 -0
  98. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +36 -0
  99. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +31 -0
  100. package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.js +4 -3
  101. package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts +10 -3
  102. package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.js +10 -3
  103. package/dist/shared/tracking/infrastructure/usePageView.d.ts +13 -0
  104. package/dist/shared/tracking/infrastructure/usePageView.js +27 -0
  105. package/dist/shared/ui/components/atoms/error/Error.style.d.ts +6 -0
  106. package/dist/shared/ui/components/atoms/error/Error.style.js +9 -0
  107. package/dist/shared/ui/components/atoms/input/Input.js +2 -2
  108. package/dist/shared/ui/components/layouts/modal/Modal.js +1 -1
  109. package/dist/shared/ui/components/layouts/slider/Bullets.js +1 -1
  110. package/dist/shared/ui/components/molecules/selectField/SelectField.js +3 -3
  111. package/package.json +1 -4
  112. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.d.ts +0 -15
  113. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.js +0 -14
  114. package/dist/shared/ui/components/layouts/carousel/Carousel.d.ts +0 -11
  115. package/dist/shared/ui/components/layouts/carousel/Carousel.js +0 -31
  116. package/dist/shared/ui/components/layouts/carousel/Carousel.style.d.ts +0 -17
  117. package/dist/shared/ui/components/layouts/carousel/Carousel.style.js +0 -7
  118. package/dist/shared/ui/components/layouts/carousel/Carousel2.d.ts +0 -16
  119. package/dist/shared/ui/components/layouts/carousel/Carousel2.js +0 -72
  120. package/dist/shared/ui/components/layouts/carousel/DragComponent.d.ts +0 -3
  121. package/dist/shared/ui/components/layouts/carousel/DragComponent.js +0 -48
  122. package/dist/shared/ui/components/layouts/slider/SliderDots.d.ts +0 -8
  123. package/dist/shared/ui/components/layouts/slider/SliderDots.js +0 -16
  124. package/dist/shared/ui/components/layouts/slider/SliderDots.style.d.ts +0 -12
  125. package/dist/shared/ui/components/layouts/slider/SliderDots.style.js +0 -15
@@ -0,0 +1,21 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ import { Logger } from "../../../../../logging/Logger";
3
+ import { NotificationLevel } from "../../../../domain/notification/model/notification";
4
+ interface CreateNotificationFunctionArgs {
5
+ readonly aggregateId?: string;
6
+ readonly level: NotificationLevel;
7
+ readonly bodyI18nKey: string;
8
+ readonly titleI18nKey?: string;
9
+ }
10
+ interface CreateNotificationFunction {
11
+ (args: CreateNotificationFunctionArgs): Promise<void>;
12
+ }
13
+ interface UseCreateNotificationFunctionArgs {
14
+ readonly contextId: string;
15
+ readonly logger: Logger;
16
+ }
17
+ interface UseCreateNotificationFunction {
18
+ (args: UseCreateNotificationFunctionArgs): [create: CreateNotificationFunction, status: CommandStatus];
19
+ }
20
+ declare const useCreateNotification: UseCreateNotificationFunction;
21
+ export { useCreateNotification };
@@ -0,0 +1,22 @@
1
+ import { useCommand } from "@lookiero/messaging-react";
2
+ import { useCallback } from "react";
3
+ import { v4 as uuid } from "uuid";
4
+ import { createNotification } from "../../../../domain/notification/command/createNotification";
5
+ const useCreateNotification = ({ contextId, logger }) => {
6
+ const [commandBus, status] = useCommand({ contextId });
7
+ const create = useCallback(async ({ aggregateId, level, titleI18nKey, bodyI18nKey }) => {
8
+ try {
9
+ await commandBus(createNotification({
10
+ aggregateId: aggregateId || uuid(),
11
+ level,
12
+ titleI18nKey,
13
+ bodyI18nKey,
14
+ }));
15
+ }
16
+ catch (error) {
17
+ logger.captureException(error);
18
+ }
19
+ }, [commandBus, logger]);
20
+ return [create, status];
21
+ };
22
+ export { useCreateNotification };
@@ -0,0 +1,12 @@
1
+ import { FC } from "react";
2
+ import { ToastStyle } from "../../../../ui/components/molecules/toast/Toast";
3
+ import { NotificationProjection } from "../../../projection/notification/notification";
4
+ interface NotificationItemProps {
5
+ readonly notification: NotificationProjection;
6
+ readonly onRemove: (notificationId: string) => void;
7
+ readonly autoHideTimeout?: number;
8
+ readonly testID?: string;
9
+ readonly style?: ToastStyle;
10
+ }
11
+ declare const NotificationItem: FC<NotificationItemProps>;
12
+ export { NotificationItem };
@@ -0,0 +1,24 @@
1
+ import { useI18nMessage } from "@lookiero/i18n-react";
2
+ import React from "react";
3
+ import { useCallback, useEffect } from "react";
4
+ import { Toast, ToastVariant } from "../../../../ui/components/molecules/toast/Toast";
5
+ import { NotificationLevel } from "../../../domain/notification/model/notification";
6
+ const toastVariantForNotificationLevel = {
7
+ [NotificationLevel.INFO]: ToastVariant.INFO,
8
+ [NotificationLevel.ERROR]: ToastVariant.ERROR,
9
+ [NotificationLevel.SUCCESS]: ToastVariant.SUCCESS,
10
+ };
11
+ const NotificationItem = ({ notification, onRemove, autoHideTimeout, testID = "notification-item", style: customStyle, }) => {
12
+ const title = useI18nMessage({ id: notification.titleI18nKey }) || undefined;
13
+ const body = useI18nMessage({ id: notification.bodyI18nKey || "" });
14
+ const handleOnClose = useCallback(() => onRemove(notification.id), [notification.id, onRemove]);
15
+ useEffect(() => {
16
+ if (!autoHideTimeout) {
17
+ return;
18
+ }
19
+ const hideTimeout = setTimeout(handleOnClose, autoHideTimeout);
20
+ return () => clearTimeout(hideTimeout);
21
+ }, [autoHideTimeout, handleOnClose]);
22
+ return (React.createElement(Toast, { body: body, style: customStyle, testID: testID, title: title, variant: toastVariantForNotificationLevel[notification.level], onClose: handleOnClose }));
23
+ };
24
+ export { NotificationItem };
@@ -0,0 +1,9 @@
1
+ import { FC } from "react";
2
+ import { NotificationProjection } from "../../../projection/notification/notification";
3
+ interface NotificationsProps {
4
+ readonly notifications?: NotificationProjection[];
5
+ readonly onRemove: (notificationId: string) => void;
6
+ readonly autoHideTimeout?: number;
7
+ }
8
+ declare const Notifications: FC<NotificationsProps>;
9
+ export { Notifications };
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
4
+ import { Column } from "../../../../ui/components/layouts/column/Column";
5
+ import { Row } from "../../../../ui/components/layouts/row/Row";
6
+ import { Stack } from "../../../../ui/components/layouts/stack/Stack";
7
+ import { useScreenSize } from "../../../../ui/hooks/useScreenSize";
8
+ import { NotificationItem } from "./NotificationItem";
9
+ import { style } from "./Notifications.style";
10
+ const NOTIFICATIONS_AUTOHIDE_TIMEOUT = 10000;
11
+ const Notifications = ({ notifications = [], onRemove, autoHideTimeout = NOTIFICATIONS_AUTOHIDE_TIMEOUT, }) => {
12
+ const { top: safeAreaInsetTop } = useSafeAreaInsets();
13
+ const screenSize = useScreenSize();
14
+ const isSmallDevice = screenSize === "S";
15
+ return (React.createElement(View, { pointerEvents: "box-none", style: style.notifications, testID: "notifications" },
16
+ React.createElement(Row, { style: [style.row, isSmallDevice && style.rowSmall, { paddingTop: safeAreaInsetTop }] },
17
+ React.createElement(Column, null,
18
+ React.createElement(Stack, null, notifications.map((notification) => (React.createElement(NotificationItem, { key: notification.id, autoHideTimeout: autoHideTimeout, notification: notification, style: { toast: style.toast }, testID: notification.id, onRemove: onRemove }))))))));
19
+ };
20
+ export { Notifications };
@@ -0,0 +1,36 @@
1
+ import { StyleSheet } from "react-native";
2
+ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
3
+ notifications: {
4
+ flexDirection: "column";
5
+ top: number;
6
+ width: string;
7
+ zIndex: number;
8
+ left: number;
9
+ } | {
10
+ flexDirection: "column";
11
+ top: number;
12
+ width: string;
13
+ zIndex: number;
14
+ position: "fixed";
15
+ left: number;
16
+ } | {
17
+ flexDirection: "column";
18
+ top: number;
19
+ width: string;
20
+ zIndex: number;
21
+ position: "absolute";
22
+ left: number;
23
+ };
24
+ row: {
25
+ flex: number;
26
+ justifyContent: "center";
27
+ };
28
+ rowSmall: {
29
+ paddingLeft: number;
30
+ paddingRight: number;
31
+ };
32
+ toast: {
33
+ marginTop: number;
34
+ };
35
+ }>;
36
+ export { style };
@@ -0,0 +1,31 @@
1
+ import { Platform, StyleSheet } from "react-native";
2
+ import { theme } from "../../../../../infrastructure/ui/theme/theme";
3
+ const { spaceM } = theme();
4
+ const style = StyleSheet.create({
5
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
+ // @ts-ignore
7
+ notifications: {
8
+ left: 0,
9
+ ...Platform.select({
10
+ web: { position: "fixed" },
11
+ ios: { position: "absolute" },
12
+ android: { position: "absolute" },
13
+ }),
14
+ flexDirection: "column",
15
+ top: 0,
16
+ width: "100%",
17
+ zIndex: 20,
18
+ },
19
+ row: {
20
+ flex: 1,
21
+ justifyContent: "center",
22
+ },
23
+ rowSmall: {
24
+ paddingLeft: spaceM,
25
+ paddingRight: spaceM,
26
+ },
27
+ toast: {
28
+ marginTop: spaceM,
29
+ },
30
+ });
31
+ export { style };
@@ -24,8 +24,9 @@ const ModalNotificationItem = ({ visible, notification, onRemove, testID = "moda
24
24
  }, [notification.id, onRemove]);
25
25
  return (React.createElement(Modal, { testID: testID, visible: visible, onClose: handleOnClose },
26
26
  React.createElement(View, { style: style.modal },
27
- React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
28
- React.createElement(Text, { level: 3, style: style.modalDescription }, bodyText),
29
- React.createElement(Button, { style: style.button, onPress: handleOnClose }, acceptText))));
27
+ React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
28
+ React.createElement(Text, { level: 3, style: style.description }, bodyText),
29
+ React.createElement(Button, { style: style.button, testID: "modal-notification-button", onPress: handleOnClose },
30
+ React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, acceptText)))));
30
31
  };
31
32
  export { ModalNotificationItem };
@@ -2,12 +2,19 @@ declare const style: {
2
2
  button: {
3
3
  flex: number;
4
4
  };
5
- modal: {
6
- padding: number;
5
+ buttonText: {
6
+ width: string;
7
7
  };
8
- modalDescription: {
8
+ description: {
9
9
  marginVertical: number;
10
10
  textAlign: "center";
11
+ width: string;
12
+ };
13
+ modal: {
14
+ padding: number;
15
+ };
16
+ title: {
17
+ width: string;
11
18
  };
12
19
  };
13
20
  export { style };
@@ -5,12 +5,19 @@ const style = StyleSheet.create({
5
5
  button: {
6
6
  flex: 0,
7
7
  },
8
- modal: {
9
- padding: spaceXL,
8
+ buttonText: {
9
+ width: "100%",
10
10
  },
11
- modalDescription: {
11
+ description: {
12
12
  marginVertical: spaceXL,
13
13
  textAlign: "center",
14
+ width: "100%",
15
+ },
16
+ modal: {
17
+ padding: spaceXL,
18
+ },
19
+ title: {
20
+ width: "100%",
14
21
  },
15
22
  });
16
23
  export { style };
@@ -0,0 +1,13 @@
1
+ import { TrackingPage } from "../../../infrastructure/tracking/tracking";
2
+ import { Country } from "../../../projection/shared/country";
3
+ interface UsePageViewFunctionArgs {
4
+ readonly page: TrackingPage;
5
+ readonly country: Country;
6
+ readonly checkoutId?: string;
7
+ readonly checkoutItemId?: string;
8
+ }
9
+ interface UsePageViewFunction {
10
+ (agrs: UsePageViewFunctionArgs): void;
11
+ }
12
+ declare const usePageView: UsePageViewFunction;
13
+ export { usePageView };
@@ -0,0 +1,27 @@
1
+ import { useLayoutEffect } from "react";
2
+ import { PROJECT } from "../../../infrastructure/tracking/tracking";
3
+ import { TrackingEvent, TrackingEventCategory } from "../tracking";
4
+ import { useEmitUserEvent } from "./useEmitUserEvent";
5
+ const usePageView = ({ page, country, checkoutId, checkoutItemId }) => {
6
+ const emitUserEvent = useEmitUserEvent();
7
+ useLayoutEffect(() => {
8
+ if (!checkoutId) {
9
+ return;
10
+ }
11
+ const baseTrackingEvent = {
12
+ event: TrackingEvent.PAGEVIEW,
13
+ eventCategory: TrackingEventCategory.NAVIGATION,
14
+ section: `${PROJECT}_${page}`,
15
+ store: country,
16
+ checkoutId,
17
+ };
18
+ const pageViewTrackingEvent = checkoutItemId
19
+ ? {
20
+ ...baseTrackingEvent,
21
+ checkoutItemId,
22
+ }
23
+ : baseTrackingEvent;
24
+ emitUserEvent(pageViewTrackingEvent);
25
+ }, [checkoutId, checkoutItemId, country, emitUserEvent, page]);
26
+ };
27
+ export { usePageView };
@@ -0,0 +1,6 @@
1
+ declare const style: {
2
+ error: {
3
+ color: string;
4
+ };
5
+ };
6
+ export { style };
@@ -0,0 +1,9 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../../infrastructure/ui/theme/theme";
3
+ const { colorPrimary } = theme();
4
+ const style = StyleSheet.create({
5
+ error: {
6
+ color: colorPrimary,
7
+ },
8
+ });
9
+ export { style };
@@ -6,7 +6,7 @@ const MIN_HEIGHT = 56;
6
6
  const MAX_HEIGHT = 242; // 10 lines
7
7
  const { colorGrayscaleL } = theme();
8
8
  const clamp = (min, max, value) => Math.min(Math.max(min, value), max);
9
- const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline, ...restOfProps }) => {
9
+ const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline, testID = "input", ...restOfProps }) => {
10
10
  const [height, setHeight] = useState(minHeight);
11
11
  // When content height has became smaller the onContentSizeChange does in fact triggered but the internal height is incorrect.
12
12
  const handleOnContentSizeChange = useCallback((event) => {
@@ -32,6 +32,6 @@ const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customSt
32
32
  }, [maxHeight, minHeight, multiline]);
33
33
  useLayoutEffect(handleOnContentSizeChangeWeb, [handleOnContentSizeChangeWeb, value]);
34
34
  const textInputRef = useRef(null);
35
- return (React.createElement(TextInput, { ...restOfProps, ref: textInputRef, multiline: multiline, numberOfLines: !!multiline ? undefined : 1, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, { height }], testID: "input", textAlignVertical: "top", value: value, onChange: onChange, onContentSizeChange: handleOnContentSizeChange }));
35
+ return (React.createElement(TextInput, { ref: textInputRef, accessibilityLabel: testID, multiline: multiline, numberOfLines: !!multiline ? undefined : 1, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, { height }], testID: testID, textAlignVertical: "top", value: value, accessible: true, onChange: onChange, onContentSizeChange: handleOnContentSizeChange, ...restOfProps }));
36
36
  };
37
37
  export { Input };
@@ -75,7 +75,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
75
75
  (header || showCloseButton) && (React.createElement(View, { style: [style.header, customStyle?.header] },
76
76
  React.createElement(View, null, header),
77
77
  showCloseButton && (React.createElement(ButtonIcon, { name: "close", style: { button: customStyle?.closeButton }, onPress: onClose })))),
78
- React.createElement(ModalContentView, null,
78
+ React.createElement(ModalContentView, { keyboardShouldPersistTaps: "handled" },
79
79
  React.createElement(View, { style: {
80
80
  paddingBottom: safeAreaInsetBottom +
81
81
  (Platform.OS !== "ios" ? spaceXL : 0) +
@@ -5,7 +5,7 @@ import { theme } from "../../../../../infrastructure/ui/theme/theme";
5
5
  import { style } from "./Bullets.style";
6
6
  const { colorContent, colorGrayscaleM } = theme();
7
7
  const colorTransparent = "rgba(0,0,0,0)";
8
- const MAX = 5;
8
+ const MAX = 7;
9
9
  const DIAMETER_MAX = 8;
10
10
  const DIAMETER_MIN = 2;
11
11
  const Bullet = ({ index, activeIndex, maxBullets, onChange }) => {
@@ -6,7 +6,7 @@ import { Modal } from "../../layouts/modal/Modal";
6
6
  import { InputField } from "../inputField/InputField";
7
7
  import { style } from "./SelectField.style";
8
8
  const { colorGrayscaleS } = theme();
9
- const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
9
+ const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, testID, ...touchableRestProps }) => {
10
10
  const [modalVisible, setModalVisible] = useState(false);
11
11
  const handleOnPressSelectField = useCallback(() => setModalVisible(true), []);
12
12
  const handleOnModalClose = useCallback(() => setModalVisible(false), []);
@@ -16,13 +16,13 @@ const SelectField = ({ title, placeholder, value, options, style: customStyle, o
16
16
  }, [handleOnModalClose, onChange]);
17
17
  const selectedValue = useMemo(() => options.find((option) => option.value === value), [options, value]);
18
18
  return (React.createElement(React.Fragment, null,
19
- React.createElement(TouchableHighlight, { style: customStyle?.selectField, underlayColor: colorGrayscaleS, onPress: handleOnPressSelectField, ...touchableRestProps },
19
+ React.createElement(TouchableHighlight, { accessibilityLabel: testID, style: customStyle?.selectField, testID: testID, underlayColor: colorGrayscaleS, accessible: true, onPress: handleOnPressSelectField, ...touchableRestProps },
20
20
  React.createElement(View, { pointerEvents: "none" },
21
21
  React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholder, style: customStyle?.inputField, value: selectedValue?.label }))),
22
22
  React.createElement(Modal, { testID: "select-field-modal", visible: modalVisible, scroll: true, showCloseButton: true, onClose: handleOnModalClose },
23
23
  React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] },
24
24
  title && (React.createElement(Text, { level: 2, style: style.modalTitle }, title)),
25
- options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
25
+ options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, accessibilityLabel: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], testID: optionValue, underlayColor: colorGrayscaleS, accessible: true, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
26
26
  React.createElement(Text, { color: value === optionValue ? COLOR.GRAYSCALE_M : COLOR.CONTENT, level: 3, style: [style.optionText, customStyle?.optionText] }, label))))))));
27
27
  };
28
28
  export { SelectField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "3.6.1-beta.1",
3
+ "version": "3.7.0-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -36,10 +36,7 @@
36
36
  "@sentry/react-native": "^4.13.0",
37
37
  "inline-style-prefixer": "6.0.1",
38
38
  "lodash": "^4.17.21",
39
- "react-native-gesture-handler": "^2.12.0",
40
39
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
41
- "react-native-reanimated": "^3.3.0",
42
- "react-native-reanimated-carousel": "^3.4.0",
43
40
  "react-native-safe-area-context": "^4.5.0",
44
41
  "react-native-svg": "^13.4.0",
45
42
  "tiny-invariant": "^1.3.1",
@@ -1,15 +0,0 @@
1
- import { FC, ReactNode, Ref } from "react";
2
- import { GestureType, ScrollView } from "react-native-gesture-handler";
3
- interface ContextShape {
4
- readonly scrollViewRef: Ref<ScrollView>;
5
- readonly panGestureRef: Ref<GestureType>;
6
- }
7
- interface ScrollViewRefContextProviderProps {
8
- readonly children: ReactNode;
9
- }
10
- declare const ScrollViewRefContextProvider: FC<ScrollViewRefContextProviderProps>;
11
- interface UseScrollViewRefFunction {
12
- (): ContextShape;
13
- }
14
- declare const useScrollViewRef: UseScrollViewRefFunction;
15
- export { useScrollViewRef, ScrollViewRefContextProvider };
@@ -1,14 +0,0 @@
1
- import React, { createContext, useContext, useRef } from "react";
2
- import invariant from "tiny-invariant";
3
- const ScrollViewRefContext = createContext(null);
4
- const ScrollViewRefContextProvider = ({ children }) => {
5
- const scrollViewRef = useRef(null);
6
- const panGestureRef = useRef(null);
7
- return (React.createElement(ScrollViewRefContext.Provider, { value: { scrollViewRef, panGestureRef } }, children));
8
- };
9
- const useScrollViewRef = () => {
10
- const ref = useContext(ScrollViewRefContext);
11
- invariant(ref, "Your are trying to use the useScrollViewRef hook without wrapping your app with the <ScrollViewRefContextProvider>.");
12
- return ref;
13
- };
14
- export { useScrollViewRef, ScrollViewRefContextProvider };
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { TCarouselProps } from "react-native-reanimated-carousel";
3
- type CarouselRenderItem<T> = TCarouselProps<T>["renderItem"];
4
- interface CarouselProps<T> {
5
- readonly data: T[];
6
- readonly children: CarouselRenderItem<T>;
7
- readonly onActiveIndexChanged?: (index: number) => void;
8
- }
9
- declare const Carousel: <T>({ data, children, onActiveIndexChanged }: CarouselProps<T>) => JSX.Element;
10
- export type { CarouselRenderItem };
11
- export { Carousel };
@@ -1,31 +0,0 @@
1
- import React, { useCallback, useRef, useState } from "react";
2
- import { View } from "react-native";
3
- import { GestureHandlerRootView } from "react-native-gesture-handler";
4
- import RNRCarousel from "react-native-reanimated-carousel";
5
- import { Bullets } from "../slider/Bullets";
6
- const Carousel = ({ data, children, onActiveIndexChanged }) => {
7
- const [carouselDimensions, setCarouselDimensions] = useState();
8
- const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => setCarouselDimensions({ width, height }), []);
9
- const ref = React.useRef(null);
10
- const [activeIndex, setActiveIndex] = useState(0);
11
- const activeIndexRef = useRef(activeIndex);
12
- activeIndexRef.current = activeIndex;
13
- const handleOnActiveChanged = useCallback((index) => ref.current?.scrollTo({ index, animated: true }), []);
14
- const handleOnProgressChanged = useCallback(
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- (_offsetProgress, absoluteProgress) => {
17
- const index = Math.round(absoluteProgress);
18
- if (activeIndexRef.current === index) {
19
- return;
20
- }
21
- setActiveIndex(index);
22
- onActiveIndexChanged?.(index);
23
- }, [onActiveIndexChanged]);
24
- return (React.createElement(React.Fragment, null,
25
- React.createElement(View, { style: { flex: 1 }, onLayout: handleOnLayout }, carouselDimensions && (React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
26
- React.createElement(RNRCarousel, { ref: ref, data: data, height: carouselDimensions.height, loop: false, renderItem: children, width: carouselDimensions.width, panGestureHandlerProps: {
27
- activeOffsetX: [-10, 10],
28
- }, onProgressChange: handleOnProgressChanged })))),
29
- React.createElement(Bullets, { activeIndex: activeIndex, count: data.length, onChange: handleOnActiveChanged })));
30
- };
31
- export { Carousel };
@@ -1,17 +0,0 @@
1
- declare const style: {
2
- carousel: {
3
- flex: number;
4
- flexDirection: "row";
5
- height: string;
6
- position: "absolute";
7
- };
8
- carouselItem: {
9
- flex: number;
10
- };
11
- container: {
12
- flex: number;
13
- overflow: "hidden";
14
- position: "relative";
15
- };
16
- };
17
- export { style };
@@ -1,7 +0,0 @@
1
- import { StyleSheet } from "react-native";
2
- const style = StyleSheet.create({
3
- carousel: { flex: 1, flexDirection: "row", height: "100%", position: "absolute" },
4
- carouselItem: { flex: 1 },
5
- container: { flex: 1, overflow: "hidden", position: "relative" },
6
- });
7
- export { style };
@@ -1,16 +0,0 @@
1
- /// <reference types="react" />
2
- interface RenderItemFunctionArgs<T> {
3
- readonly item: T;
4
- readonly index: number;
5
- }
6
- interface RenderItemFunction<T> {
7
- (args: RenderItemFunctionArgs<T>): JSX.Element;
8
- }
9
- interface CarouselProps<T> {
10
- readonly data: T[];
11
- readonly children: RenderItemFunction<T>;
12
- readonly onActiveIndexChanged?: (index: number) => void;
13
- }
14
- declare const Carousel2: <T>({ data, children, onActiveIndexChanged }: CarouselProps<T>) => JSX.Element;
15
- export type { RenderItemFunction };
16
- export { Carousel2 };
@@ -1,72 +0,0 @@
1
- import { clamp } from "@react-spring/shared";
2
- import React, { useCallback, useMemo, useRef, useState } from "react";
3
- import { View } from "react-native";
4
- import { Gesture, GestureDetector } from "react-native-gesture-handler";
5
- import Animated, { useSharedValue, withSpring, useAnimatedStyle, runOnJS } from "react-native-reanimated";
6
- import { useScrollViewRef } from "../../../../../infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef";
7
- import { Bullets } from "../slider/Bullets";
8
- import { style } from "./Carousel.style";
9
- const SPRING_CONFIG = {
10
- damping: 25,
11
- mass: 1,
12
- stiffness: 300,
13
- };
14
- const Carousel2 = ({ data, children, onActiveIndexChanged }) => {
15
- const { scrollViewRef, panGestureRef } = useScrollViewRef();
16
- const [carouselDimensions, setCarouselDimensions] = useState();
17
- const carouselItemWidth = carouselDimensions?.width || 1;
18
- const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => setCarouselDimensions({ width, height }), []);
19
- const [activeIndex, setActiveIndex] = useState(0);
20
- const activeIndexRef = useRef(activeIndex);
21
- activeIndexRef.current = activeIndex;
22
- const panTranslationX = useSharedValue(0);
23
- const panInitialTranslationX = useSharedValue(0);
24
- const updateActiveIndex = useCallback((index) => {
25
- if (activeIndexRef.current === index) {
26
- return;
27
- }
28
- setActiveIndex(index);
29
- onActiveIndexChanged?.(index);
30
- }, [onActiveIndexChanged]);
31
- const panGesture = useMemo(() => Gesture.Pan()
32
- .maxPointers(1)
33
- .activeOffsetX([-20, 20])
34
- .onStart(() => {
35
- panInitialTranslationX.value = panTranslationX.value;
36
- })
37
- .onUpdate(({ translationX }) => {
38
- const tX = panInitialTranslationX.value + translationX;
39
- const index = clamp(0, data.length - 1, Math.round(-tX / carouselItemWidth));
40
- panTranslationX.value = tX;
41
- runOnJS(updateActiveIndex)(index);
42
- })
43
- .onEnd(({ translationX }) => {
44
- const tX = panInitialTranslationX.value + translationX;
45
- const index = clamp(0, data.length - 1, Math.round(-tX / carouselItemWidth));
46
- panTranslationX.value = withSpring(-index * carouselItemWidth, SPRING_CONFIG);
47
- })
48
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
49
- // @ts-ignore
50
- .simultaneousWithExternalGesture(scrollViewRef)
51
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
52
- // @ts-ignore
53
- .withRef(panGestureRef), [
54
- carouselItemWidth,
55
- data.length,
56
- panGestureRef,
57
- panInitialTranslationX,
58
- panTranslationX,
59
- scrollViewRef,
60
- updateActiveIndex,
61
- ]);
62
- const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateX: panTranslationX.value }] }), [panTranslationX]);
63
- return (React.createElement(React.Fragment, null,
64
- React.createElement(View, { style: style.container, onLayout: handleOnLayout }, carouselDimensions && (
65
- // <GestureHandlerRootView style={{ flex: 1 }}>
66
- React.createElement(GestureDetector, { gesture: panGesture },
67
- React.createElement(Animated.View, { style: [style.carousel, { width: carouselDimensions.width * data.length }, animatedStyle] }, data.map((item, index) => (React.createElement(View, { key: index, style: [style.carouselItem, { width: carouselDimensions.width }] }, children({ index, item }))))))
68
- // </GestureHandlerRootView>
69
- )),
70
- React.createElement(Bullets, { activeIndex: activeIndex, count: data.length, onChange: () => void 0 })));
71
- };
72
- export { Carousel2 };
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const DragComponent: (props: any) => JSX.Element;
3
- export { DragComponent };
@@ -1,48 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- import React from "react";
3
- import { View } from "react-native";
4
- import { Gesture, GestureDetector } from "react-native-gesture-handler";
5
- import { useSharedValue } from "react-native-reanimated";
6
- import { useScrollViewRef } from "../../../../../infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef";
7
- const TOUCH_SLOP = 5;
8
- const TIME_TO_ACTIVATE_PAN = 400;
9
- // @ts-ignore
10
- const DragComponent = (props) => {
11
- const { scrollViewRef, panGestureRef } = useScrollViewRef();
12
- const touchStart = useSharedValue({ x: 0, y: 0, time: 0 });
13
- const gesture = Gesture.Pan()
14
- .manualActivation(true)
15
- .onTouchesDown((e) => {
16
- touchStart.value = {
17
- // @ts-ignore
18
- x: e.changedTouches[0].x,
19
- // @ts-ignore
20
- y: e.changedTouches[0].y,
21
- time: Date.now(),
22
- };
23
- })
24
- .onTouchesMove((e, state) => {
25
- if (Date.now() - touchStart.value.time > TIME_TO_ACTIVATE_PAN) {
26
- state.activate();
27
- console.log("activate");
28
- }
29
- else if (
30
- // @ts-ignore
31
- Math.abs(touchStart.value.x - e.changedTouches[0].x) > TOUCH_SLOP ||
32
- // @ts-ignore
33
- Math.abs(touchStart.value.y - e.changedTouches[0].y) > TOUCH_SLOP) {
34
- state.fail();
35
- console.log("fail");
36
- }
37
- })
38
- .onUpdate(() => {
39
- console.log("pan update");
40
- })
41
- // @ts-ignore
42
- .simultaneousWithExternalGesture(scrollViewRef)
43
- // @ts-ignore
44
- .withRef(panGestureRef);
45
- return (React.createElement(GestureDetector, { gesture: gesture },
46
- React.createElement(View, null, props.children)));
47
- };
48
- export { DragComponent };