@lookiero/checkout 0.8.17 → 0.8.19-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.
- package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +13 -0
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +4 -0
- package/dist/domain/checkout/event/createModalNotificationWhenCheckoutSubmitted.d.ts +7 -0
- package/dist/domain/checkout/event/createModalNotificationWhenCheckoutSubmitted.js +12 -0
- package/dist/domain/checkout/model/checkoutPaid.d.ts +13 -0
- package/dist/domain/checkout/model/checkoutPaid.js +4 -0
- package/dist/domain/checkoutBooking/event/createToastNotificationWhenCheckoutBookingExpired.d.ts +7 -0
- package/dist/domain/checkoutBooking/event/createToastNotificationWhenCheckoutBookingExpired.js +13 -0
- package/dist/domain/checkoutItem/event/createModalNotificationWhenCheckoutItemReplaced.d.ts +7 -0
- package/dist/domain/checkoutItem/event/createModalNotificationWhenCheckoutItemReplaced.js +12 -0
- package/dist/domain/checkoutItem/model/checkoutItem.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/infrastructure/delivery/baseBootstrap.js +8 -2
- package/dist/infrastructure/delivery/mock/checkoutDataSource.js +4 -1
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +5 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +16 -0
- package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.js +2 -2
- package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +2 -2
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +13 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +14 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.js +2 -2
- package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.js +2 -2
- package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.js +3 -5
- package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.js +3 -6
- package/dist/infrastructure/domain/checkoutItem/react/useResetCheckoutItem.js +3 -5
- package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.js +3 -6
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +10 -0
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +11 -0
- package/dist/infrastructure/projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem.js +4 -1
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +12 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +9 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +10 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +12 -0
- package/dist/infrastructure/projection/checkout/react/useViewFiveItemsDiscountByCustomerId.js +1 -1
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +9 -0
- package/dist/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.js +1 -1
- package/dist/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +6 -1
- package/dist/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +6 -1
- package/dist/infrastructure/projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId.js +1 -1
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +6 -0
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +7 -0
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +6 -0
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +9 -0
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +2 -2
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +2 -2
- package/dist/infrastructure/ui/i18n/translationEndpoint.d.ts +10 -1
- package/dist/infrastructure/ui/i18n/translationEndpoint.js +19 -1
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +54 -36
- package/dist/infrastructure/ui/routing/Routing.js +1 -7
- package/dist/infrastructure/ui/views/App.js +4 -4
- package/dist/infrastructure/ui/views/App.style.d.ts +4 -0
- package/dist/infrastructure/ui/views/App.style.js +16 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +3 -7
- package/dist/infrastructure/ui/views/feedback/Feedback.js +10 -3
- package/dist/infrastructure/ui/views/header/Header.d.ts +15 -0
- package/dist/infrastructure/ui/views/header/Header.js +90 -0
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +35 -0
- package/dist/infrastructure/ui/views/header/Header.style.js +38 -0
- package/dist/infrastructure/ui/views/header/components/Logo.d.ts +7 -0
- package/dist/infrastructure/ui/views/header/components/Logo.js +11 -0
- package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +7 -0
- package/dist/infrastructure/ui/views/header/components/Logo.style.js +8 -0
- package/dist/infrastructure/ui/views/intro/Intro.d.ts +6 -0
- package/dist/infrastructure/ui/views/intro/Intro.js +52 -0
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +55 -0
- package/dist/infrastructure/ui/views/intro/Intro.style.js +58 -0
- package/dist/infrastructure/ui/views/item/Item.js +9 -53
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.d.ts +1 -0
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +10 -4
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.style.d.ts +8 -1
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.style.js +8 -1
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +10 -0
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +1 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +25 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +8 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +25 -0
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +8 -0
- package/dist/projection/shared/country.d.ts +10 -10
- package/dist/projection/shared/locale.d.ts +11 -0
- package/dist/projection/shared/locale.js +12 -0
- package/dist/shared/logging/location.d.ts +3 -0
- package/dist/shared/logging/location.js +5 -0
- package/dist/shared/logging/matchRoutes.d.ts +3 -0
- package/dist/shared/logging/matchRoutes.js +7 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +29 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +134 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +22 -0
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +15 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +27 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.js +115 -0
- package/dist/shared/notifications/domain/notification/command/createModalNotification.d.ts +18 -0
- package/dist/shared/notifications/domain/notification/command/createModalNotification.js +9 -0
- package/dist/shared/notifications/domain/notification/command/createToastNotification.d.ts +18 -0
- package/dist/shared/notifications/domain/notification/command/createToastNotification.js +9 -0
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +1 -0
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +9 -0
- package/dist/shared/notifications/domain/notification/model/notification.d.ts +11 -4
- package/dist/shared/notifications/domain/notification/model/notification.js +20 -4
- package/dist/shared/notifications/index.d.ts +3 -2
- package/dist/shared/notifications/index.js +3 -2
- package/dist/shared/notifications/infrastructure/delivery/bootstrap.js +7 -4
- package/dist/shared/notifications/infrastructure/domain/notification/model/storageNotifications.js +3 -1
- package/dist/shared/notifications/infrastructure/domain/notification/model/storageNotificationsCreate.d.ts +1 -1
- package/dist/shared/notifications/infrastructure/domain/notification/model/storageNotificationsCreate.js +3 -1
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateModalNotification.d.ts +20 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateModalNotification.js +22 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateToastNotification.d.ts +21 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateToastNotification.js +22 -0
- package/dist/shared/notifications/infrastructure/persistence/notificationDto.d.ts +3 -1
- package/dist/shared/notifications/infrastructure/projection/notification/notification.d.ts +2 -2
- package/dist/shared/notifications/infrastructure/projection/notification/notification.js +16 -6
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.d.ts +10 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.js +26 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts +16 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.js +19 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotifications.d.ts +8 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotifications.js +6 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotifications.style.d.ts +25 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotifications.style.js +18 -0
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotificationItem.d.ts +12 -0
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotificationItem.js +24 -0
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotifications.d.ts +9 -0
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotifications.js +20 -0
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotifications.style.d.ts +36 -0
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotifications.style.js +31 -0
- package/dist/shared/notifications/infrastructure/ui/views/Notifications.js +9 -3
- package/dist/shared/notifications/projection/notification/notification.d.ts +18 -2
- package/dist/shared/notifications/projection/notification/notification.js +8 -1
- package/dist/shared/ui/components/atoms/spinner/Spinner.d.ts +6 -1
- package/dist/shared/ui/components/atoms/spinner/Spinner.js +2 -2
- package/dist/shared/ui/components/layouts/modal/Modal.d.ts +1 -0
- package/dist/shared/ui/components/layouts/modal/Modal.js +2 -2
- package/package.json +7 -5
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { NotificationLevel } from "../../domain/notification/model/notification";
|
|
1
|
+
import { NotificationLevel, NotificationType } from "../../domain/notification/model/notification";
|
|
2
2
|
interface NotificationDto {
|
|
3
3
|
readonly aggregateId: string;
|
|
4
|
+
readonly type: NotificationType;
|
|
4
5
|
readonly level: NotificationLevel;
|
|
5
6
|
readonly bodyI18nKey: string;
|
|
6
7
|
readonly titleI18nKey: string | undefined;
|
|
8
|
+
readonly acceptI18nKey: string | undefined;
|
|
7
9
|
}
|
|
8
10
|
export type { NotificationDto };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModalNotificationProjection, ToastNotificationProjection } from "../../../projection/notification/notification";
|
|
2
2
|
import { NotificationDto } from "../../persistence/notificationDto";
|
|
3
3
|
interface ToNotificationProjectionFunction {
|
|
4
|
-
(notificationDto: NotificationDto):
|
|
4
|
+
(notificationDto: NotificationDto): ToastNotificationProjection | ModalNotificationProjection;
|
|
5
5
|
}
|
|
6
6
|
declare const toNotificationProjection: ToNotificationProjectionFunction;
|
|
7
7
|
export { toNotificationProjection };
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { NotificationType } from "../../../domain/notification/model/notification";
|
|
2
|
+
const toNotificationProjection = (notificationDto) => notificationDto.type === NotificationType.TOAST
|
|
3
|
+
? {
|
|
4
|
+
id: notificationDto.aggregateId,
|
|
5
|
+
type: notificationDto.type,
|
|
6
|
+
level: notificationDto.level,
|
|
7
|
+
titleI18nKey: notificationDto.titleI18nKey,
|
|
8
|
+
bodyI18nKey: notificationDto.bodyI18nKey,
|
|
9
|
+
}
|
|
10
|
+
: {
|
|
11
|
+
id: notificationDto.aggregateId,
|
|
12
|
+
type: notificationDto.type,
|
|
13
|
+
titleI18nKey: notificationDto.titleI18nKey,
|
|
14
|
+
bodyI18nKey: notificationDto.bodyI18nKey,
|
|
15
|
+
acceptI18nKey: notificationDto.acceptI18nKey,
|
|
16
|
+
};
|
|
7
17
|
export { toNotificationProjection };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ModalNotificationProjection } from "../../../../projection/notification/notification";
|
|
3
|
+
interface ModalNotificationItemProps {
|
|
4
|
+
readonly visible: boolean;
|
|
5
|
+
readonly notification: ModalNotificationProjection;
|
|
6
|
+
readonly onRemove: (notificationId: string) => void;
|
|
7
|
+
readonly testID?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const ModalNotificationItem: FC<ModalNotificationItemProps>;
|
|
10
|
+
export { ModalNotificationItem };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
|
|
2
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
3
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { useCallback } from "react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
import { Modal } from "../../../../../ui/components/layouts/modal/Modal";
|
|
8
|
+
import { style } from "./ModalNotificationItem.style";
|
|
9
|
+
const ModalNotificationItem = ({ visible, notification, onRemove, testID = "modal-notification-item", }) => {
|
|
10
|
+
const titleText = useI18nMessage({ id: notification.titleI18nKey });
|
|
11
|
+
const bodyText = useI18nMessage({ id: notification.bodyI18nKey });
|
|
12
|
+
const acceptText = useI18nMessage({ id: notification.acceptI18nKey });
|
|
13
|
+
const handleOnClose = useCallback(() => onRemove(notification.id), [notification.id, onRemove]);
|
|
14
|
+
return (React.createElement(Modal, { testID: testID, visible: visible, onClose: handleOnClose },
|
|
15
|
+
React.createElement(View, { style: style.modal },
|
|
16
|
+
React.createElement(Text, { level: 1, style: style.modalTitle, body: true }, titleText),
|
|
17
|
+
React.createElement(Text, { level: 3, style: style.modalDescription, body: true }, bodyText),
|
|
18
|
+
React.createElement(Button
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
, {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
style: style.button, onPress: handleOnClose }, acceptText))));
|
|
25
|
+
};
|
|
26
|
+
export { ModalNotificationItem };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../../../infrastructure/ui/theme/theme";
|
|
3
|
+
const { spaceXL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
button: {
|
|
6
|
+
flex: 0,
|
|
7
|
+
},
|
|
8
|
+
modal: {
|
|
9
|
+
padding: spaceXL,
|
|
10
|
+
},
|
|
11
|
+
modalDescription: {
|
|
12
|
+
marginVertical: spaceXL,
|
|
13
|
+
textAlign: "center",
|
|
14
|
+
},
|
|
15
|
+
modalTitle: {
|
|
16
|
+
textAlign: "center",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export { style };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ModalNotificationProjection } from "../../../../projection/notification/notification";
|
|
3
|
+
interface ModalNotificationsProps {
|
|
4
|
+
readonly notifications?: ModalNotificationProjection[];
|
|
5
|
+
readonly onRemove: (notificationId: string) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const ModalNotifications: FC<ModalNotificationsProps>;
|
|
8
|
+
export { ModalNotifications };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { style } from "../toastNotifications/ToastNotifications.style";
|
|
4
|
+
import { ModalNotificationItem } from "./ModalNotificationItem";
|
|
5
|
+
const ModalNotifications = ({ notifications = [], onRemove }) => (React.createElement(View, { pointerEvents: "box-none", style: style.notifications, testID: "modal-notifications" }, notifications.map((notification) => (React.createElement(ModalNotificationItem, { key: notification.id, notification: notification, testID: notification.id, visible: true, onRemove: onRemove })))));
|
|
6
|
+
export { ModalNotifications };
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}>;
|
|
25
|
+
export { style };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Platform, StyleSheet } from "react-native";
|
|
2
|
+
const style = StyleSheet.create({
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
notifications: {
|
|
6
|
+
left: 0,
|
|
7
|
+
...Platform.select({
|
|
8
|
+
web: { position: "fixed" },
|
|
9
|
+
ios: { position: "absolute" },
|
|
10
|
+
android: { position: "absolute" },
|
|
11
|
+
}),
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
top: 0,
|
|
14
|
+
width: "100%",
|
|
15
|
+
zIndex: 20,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export { style };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ToastStyle } from "../../../../../ui/components/molecules/toast/Toast";
|
|
3
|
+
import { ToastNotificationProjection } from "../../../../projection/notification/notification";
|
|
4
|
+
interface ToastNotificationItemProps {
|
|
5
|
+
readonly notification: ToastNotificationProjection;
|
|
6
|
+
readonly onRemove: (notificationId: string) => void;
|
|
7
|
+
readonly autoHideTimeout?: number;
|
|
8
|
+
readonly testID?: string;
|
|
9
|
+
readonly style?: ToastStyle;
|
|
10
|
+
}
|
|
11
|
+
declare const ToastNotificationItem: FC<ToastNotificationItemProps>;
|
|
12
|
+
export { ToastNotificationItem };
|
|
@@ -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 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 || "" });
|
|
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 { ToastNotificationItem };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ToastNotificationProjection } from "../../../../projection/notification/notification";
|
|
3
|
+
interface ToastNotificationsProps {
|
|
4
|
+
readonly notifications?: ToastNotificationProjection[];
|
|
5
|
+
readonly onRemove: (notificationId: string) => void;
|
|
6
|
+
readonly autoHideTimeout?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const ToastNotifications: FC<ToastNotificationsProps>;
|
|
9
|
+
export { ToastNotifications };
|
|
@@ -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 { ToastNotificationItem } from "./ToastNotificationItem";
|
|
9
|
+
import { style } from "./ToastNotifications.style";
|
|
10
|
+
const NOTIFICATIONS_AUTOHIDE_TIMEOUT = 10000;
|
|
11
|
+
const ToastNotifications = ({ 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: "toast-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(ToastNotificationItem, { key: notification.id, autoHideTimeout: autoHideTimeout, notification: notification, style: { toast: style.toast }, testID: notification.id, onRemove: onRemove }))))))));
|
|
19
|
+
};
|
|
20
|
+
export { ToastNotifications };
|
|
@@ -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 };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
import { useLogger } from "../../../../logging/useLogger";
|
|
3
|
+
import { isModalNotification, isToastNotification } from "../../../projection/notification/notification";
|
|
3
4
|
import { useListNotifications } from "../../../projection/notification/react/useListNotifications";
|
|
4
5
|
import { useRemoveNotification } from "../../domain/notification/react/useRemoveNotification";
|
|
5
|
-
import {
|
|
6
|
+
import { ModalNotifications } from "../components/modalNotifications/ModalNotifications";
|
|
7
|
+
import { ToastNotifications } from "../components/toastNotifications/ToastNotifications";
|
|
6
8
|
const Notifications = ({ contextId }) => {
|
|
7
9
|
const logger = useLogger();
|
|
8
10
|
const [notifications] = useListNotifications({ contextId });
|
|
9
11
|
const [remove] = useRemoveNotification({ contextId, logger });
|
|
10
12
|
const onRemove = useCallback((id) => remove({ aggregateId: id }), [remove]);
|
|
11
|
-
|
|
13
|
+
const toastNotifications = useMemo(() => notifications?.filter(isToastNotification), [notifications]);
|
|
14
|
+
const modalNotifications = useMemo(() => notifications?.filter(isModalNotification), [notifications]);
|
|
15
|
+
return (React.createElement(React.Fragment, null,
|
|
16
|
+
React.createElement(ToastNotifications, { notifications: toastNotifications, onRemove: onRemove }),
|
|
17
|
+
React.createElement(ModalNotifications, { notifications: modalNotifications, onRemove: onRemove })));
|
|
12
18
|
};
|
|
13
19
|
export { Notifications };
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { NotificationLevel } from "../../domain/notification/model/notification";
|
|
2
|
+
declare enum NotificationType {
|
|
3
|
+
TOAST = "TOAST",
|
|
4
|
+
MODAL = "MODAL"
|
|
5
|
+
}
|
|
2
6
|
interface NotificationProjection {
|
|
3
7
|
readonly id: string;
|
|
4
|
-
readonly
|
|
8
|
+
readonly type: NotificationType;
|
|
5
9
|
readonly bodyI18nKey: string;
|
|
6
10
|
readonly titleI18nKey: string | undefined;
|
|
7
11
|
}
|
|
8
|
-
|
|
12
|
+
interface ToastNotificationProjection extends NotificationProjection {
|
|
13
|
+
readonly type: NotificationType.TOAST;
|
|
14
|
+
readonly level: NotificationLevel;
|
|
15
|
+
}
|
|
16
|
+
interface ModalNotificationProjection extends NotificationProjection {
|
|
17
|
+
readonly type: NotificationType.MODAL;
|
|
18
|
+
readonly titleI18nKey: string;
|
|
19
|
+
readonly acceptI18nKey: string;
|
|
20
|
+
}
|
|
21
|
+
declare const isToastNotification: (notification: NotificationProjection) => notification is ToastNotificationProjection;
|
|
22
|
+
declare const isModalNotification: (notification: NotificationProjection) => notification is ModalNotificationProjection;
|
|
23
|
+
export type { NotificationProjection, ToastNotificationProjection, ModalNotificationProjection };
|
|
24
|
+
export { isToastNotification, isModalNotification };
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
var NotificationType;
|
|
2
|
+
(function (NotificationType) {
|
|
3
|
+
NotificationType["TOAST"] = "TOAST";
|
|
4
|
+
NotificationType["MODAL"] = "MODAL";
|
|
5
|
+
})(NotificationType || (NotificationType = {}));
|
|
6
|
+
const isToastNotification = (notification) => notification.type === NotificationType.TOAST;
|
|
7
|
+
const isModalNotification = (notification) => notification.type === NotificationType.MODAL;
|
|
8
|
+
export { isToastNotification, isModalNotification };
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
|
|
2
|
+
import { ColorValue } from "react-native";
|
|
3
|
+
interface SpinnerProps {
|
|
4
|
+
readonly color?: ColorValue;
|
|
5
|
+
readonly size?: number | "large" | "small";
|
|
6
|
+
}
|
|
7
|
+
declare const Spinner: FC<SpinnerProps>;
|
|
3
8
|
export { Spinner };
|
|
@@ -3,6 +3,6 @@ import { ActivityIndicator, View } from "react-native";
|
|
|
3
3
|
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
4
4
|
import { style } from "./Spinner.style";
|
|
5
5
|
const { colorPrimary } = theme();
|
|
6
|
-
const Spinner = () => (React.createElement(View, { style: style.container },
|
|
7
|
-
React.createElement(ActivityIndicator, { color:
|
|
6
|
+
const Spinner = ({ color = colorPrimary, size = "large" }) => (React.createElement(View, { style: style.container },
|
|
7
|
+
React.createElement(ActivityIndicator, { color: color, size: size })));
|
|
8
8
|
export { Spinner };
|
|
@@ -14,6 +14,7 @@ interface ModalProps {
|
|
|
14
14
|
readonly scroll?: boolean;
|
|
15
15
|
readonly size?: Partial<Record<ScreenSize, ColumnSize>>;
|
|
16
16
|
readonly style?: Partial<Record<ModalStyle, StyleProp<ViewStyle>>>;
|
|
17
|
+
readonly testID?: string;
|
|
17
18
|
}
|
|
18
19
|
declare const Modal: FC<ModalProps>;
|
|
19
20
|
export type { ColumnSize };
|
|
@@ -15,7 +15,7 @@ const { spaceXL, spaceXXL } = theme();
|
|
|
15
15
|
const TRANSITION_MODAL_SCALE = 0.9;
|
|
16
16
|
const DEFAULT_SAFEAREA_INSET_TOP = spaceXXL;
|
|
17
17
|
const MODAL_DESKTOP_VERTICAL_PADDING = spaceXXL;
|
|
18
|
-
const Modal = ({ children, visible, header, footer, portalHostName, onClose, showCloseButton = false, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, }) => {
|
|
18
|
+
const Modal = ({ children, visible, header, footer, portalHostName, onClose, showCloseButton = false, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, testID = "modal", }) => {
|
|
19
19
|
const { height: screenHeight } = Dimensions.get(Platform.OS === "web" ? "window" : "screen");
|
|
20
20
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
21
21
|
const screenSize = useScreenSize();
|
|
@@ -57,7 +57,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
|
|
|
57
57
|
unique: true,
|
|
58
58
|
});
|
|
59
59
|
const ModalContentView = useMemo(() => (scroll ? KeyboardAwareScrollView : View), [scroll]);
|
|
60
|
-
return (React.createElement(Portal, { hostName: portalHostName }, transitions(({ modalOpacity, overlayOpacity, modalTranslateY, modalScale }, item) => item && (React.createElement(View, { pointerEvents: visible ? "auto" : "none", style: style.container, testID:
|
|
60
|
+
return (React.createElement(Portal, { hostName: portalHostName }, transitions(({ modalOpacity, overlayOpacity, modalTranslateY, modalScale }, item) => item && (React.createElement(View, { pointerEvents: visible ? "auto" : "none", style: style.container, testID: testID },
|
|
61
61
|
React.createElement(TouchableWithoutFeedback, { onPress: visible ? onClose : undefined },
|
|
62
62
|
React.createElement(animated.View, { style: [style.overlay, { opacity: overlayOpacity }, customStyle?.overlay] })),
|
|
63
63
|
React.createElement(SafeAreaView, { edges: ["right", "top", "left"], pointerEvents: "box-none", style: style.safeArea },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19-beta.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@react-spring/native": "^9.5.5",
|
|
36
36
|
"@sentry/react-native": "^4.13.0",
|
|
37
37
|
"inline-style-prefixer": "6.0.1",
|
|
38
|
+
"lodash": "^4.17.21",
|
|
38
39
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
39
40
|
"react-native-safe-area-context": "^4.4.1",
|
|
40
41
|
"react-native-svg": "^12.1.1",
|
|
@@ -58,8 +59,8 @@
|
|
|
58
59
|
"react-native": "^0.70.6",
|
|
59
60
|
"react-native-get-random-values": "^1.8.0",
|
|
60
61
|
"react-native-web": "^0.18.9",
|
|
61
|
-
"react-router-dom": "^6.
|
|
62
|
-
"react-router-native": "^6.
|
|
62
|
+
"react-router-dom": "^6.8.1",
|
|
63
|
+
"react-router-native": "^6.8.1"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
66
|
"@babel/core": "^7.19.1",
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
"@types/react-dom": "~18.0.0",
|
|
86
87
|
"@types/react-native": "~0.69.1",
|
|
87
88
|
"@types/uuid": "^9.0.0",
|
|
89
|
+
"abort-controller": "^3.0.0",
|
|
88
90
|
"apollo-boost": "0.4.4",
|
|
89
91
|
"eslint": "^8.31.0",
|
|
90
92
|
"eslint-config-prettier": "^8.5.0",
|
|
@@ -117,8 +119,8 @@
|
|
|
117
119
|
"react-native-get-random-values": "^1.8.0",
|
|
118
120
|
"react-native-unimodules": "^0.14.10",
|
|
119
121
|
"react-native-web": "^0.18.9",
|
|
120
|
-
"react-router-dom": "^6.
|
|
121
|
-
"react-router-native": "^6.
|
|
122
|
+
"react-router-dom": "^6.8.1",
|
|
123
|
+
"react-router-native": "^6.8.1",
|
|
122
124
|
"react-test-renderer": "^18.0.0",
|
|
123
125
|
"typescript": "^4.9.3",
|
|
124
126
|
"webpack-bundle-analyzer": "^4.7.0"
|