@lookiero/checkout 0.8.16 → 0.8.18
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/event/createModalNotificationWhenCheckoutSubmitted.d.ts +7 -0
- package/dist/domain/checkout/event/createModalNotificationWhenCheckoutSubmitted.js +12 -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/infrastructure/delivery/baseBootstrap.js +8 -2
- package/dist/infrastructure/delivery/mock/checkoutDataSource.js +4 -1
- 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/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/projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem.js +4 -1
- package/dist/infrastructure/projection/checkout/react/useViewFiveItemsDiscountByCustomerId.js +1 -1
- 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/ui/hooks/usePaymentInstrumentEvents.js +2 -2
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +2 -2
- 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/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +3 -7
- package/dist/infrastructure/ui/views/feedback/Feedback.js +10 -3
- 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/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -1
- 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/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/{useCreateNotification.js → useCreateToastNotification.js} +4 -4
- 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/{infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js → shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.js} +1 -1
- 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/{NotificationItem.js → toastNotifications/ToastNotificationItem.js} +4 -4
- 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/{Notifications.style.js → toastNotifications/ToastNotifications.style.js} +1 -1
- 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
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +0 -6
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +0 -13
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +0 -7
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +0 -25
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +0 -7
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +0 -25
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +0 -16
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +0 -19
- package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +0 -17
- package/dist/shared/notifications/domain/notification/command/createNotification.js +0 -7
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +0 -21
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +0 -12
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +0 -9
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +0 -20
- /package/dist/{infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts → shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts} +0 -0
- /package/dist/shared/notifications/infrastructure/ui/components/{Notifications.style.d.ts → toastNotifications/ToastNotifications.style.d.ts} +0 -0
|
@@ -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,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 };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { useCallback, useEffect } from "react";
|
|
4
|
-
import { Toast, ToastVariant } from "
|
|
5
|
-
import { NotificationLevel } from "
|
|
4
|
+
import { Toast, ToastVariant } from "../../../../../ui/components/molecules/toast/Toast";
|
|
5
|
+
import { NotificationLevel } from "../../../../domain/notification/model/notification";
|
|
6
6
|
const toastVariantForNotificationLevel = {
|
|
7
7
|
[NotificationLevel.INFO]: ToastVariant.INFO,
|
|
8
8
|
[NotificationLevel.ERROR]: ToastVariant.ERROR,
|
|
9
9
|
[NotificationLevel.SUCCESS]: ToastVariant.SUCCESS,
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const ToastNotificationItem = ({ notification, onRemove, autoHideTimeout, testID = "toast-notification-item", style: customStyle, }) => {
|
|
12
12
|
const title = useI18nMessage({ id: notification.titleI18nKey }) || undefined;
|
|
13
13
|
const body = useI18nMessage({ id: notification.bodyI18nKey || "" });
|
|
14
14
|
const handleOnClose = useCallback(() => onRemove(notification.id), [notification.id, onRemove]);
|
|
@@ -21,4 +21,4 @@ const NotificationItem = ({ notification, onRemove, autoHideTimeout, testID = "n
|
|
|
21
21
|
}, [autoHideTimeout, handleOnClose]);
|
|
22
22
|
return (React.createElement(Toast, { body: body, style: customStyle, testID: testID, title: title, variant: toastVariantForNotificationLevel[notification.level], onClose: handleOnClose }));
|
|
23
23
|
};
|
|
24
|
-
export {
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform, StyleSheet } from "react-native";
|
|
2
|
-
import { theme } from "
|
|
2
|
+
import { theme } from "../../../../../../infrastructure/ui/theme/theme";
|
|
3
3
|
const { spaceM } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -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.18",
|
|
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"
|
|
@@ -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,25 +0,0 @@
|
|
|
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 { View } from "react-native";
|
|
6
|
-
import { Modal } from "../../../../../../shared/ui/components/layouts/modal/Modal";
|
|
7
|
-
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
|
-
import { style } from "./CheckoutSuccessModal.style";
|
|
9
|
-
const CheckoutSuccessModal = ({ visible, onDismiss }) => {
|
|
10
|
-
const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_SUCCESS_MODAL_TITLE });
|
|
11
|
-
const descriptionText = useI18nMessage({ id: I18nMessages.CHECKOUT_SUCCESS_MODAL_DESCRIPTION });
|
|
12
|
-
const buttonText = useI18nMessage({ id: I18nMessages.CHECKOUT_SUCCESS_MODAL_BUTTON });
|
|
13
|
-
return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
|
|
14
|
-
React.createElement(View, { style: style.modal },
|
|
15
|
-
React.createElement(Text, { level: 1, style: style.modalTitle, body: true }, titleText),
|
|
16
|
-
React.createElement(Text, { level: 3, style: style.modalDescription, body: true }, descriptionText),
|
|
17
|
-
React.createElement(Button
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
, {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
style: style.button, onPress: onDismiss }, buttonText))));
|
|
24
|
-
};
|
|
25
|
-
export { CheckoutSuccessModal };
|
|
@@ -1,25 +0,0 @@
|
|
|
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 { View } from "react-native";
|
|
6
|
-
import { Modal } from "../../../../../../shared/ui/components/layouts/modal/Modal";
|
|
7
|
-
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
|
-
import { style } from "./SizeChangeModal.style";
|
|
9
|
-
const SizeChangeModal = ({ visible, onDismiss }) => {
|
|
10
|
-
const titleText = useI18nMessage({ id: I18nMessages.SIZE_CHANGE_MODAL_TITLE });
|
|
11
|
-
const descriptionText = useI18nMessage({ id: I18nMessages.SIZE_CHANGE_MODAL_DESCRIPTION });
|
|
12
|
-
const buttonText = useI18nMessage({ id: I18nMessages.SIZE_CHANGE_MODAL_BUTTON });
|
|
13
|
-
return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
|
|
14
|
-
React.createElement(View, { style: style.modal },
|
|
15
|
-
React.createElement(Text, { level: 1, style: style.modalTitle, body: true }, titleText),
|
|
16
|
-
React.createElement(Text, { level: 3, style: style.modalDescription, body: true }, descriptionText),
|
|
17
|
-
React.createElement(Button
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
, {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
style: style.button, onPress: onDismiss }, buttonText))));
|
|
24
|
-
};
|
|
25
|
-
export { SizeChangeModal };
|
package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
import { theme } from "../../../../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 };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Command } from "@lookiero/messaging";
|
|
2
|
-
import { NotificationLevel } from "../model/notification";
|
|
3
|
-
declare const CREATE_NOTIFICATION = "create_notification";
|
|
4
|
-
interface CreateNotificationPayload {
|
|
5
|
-
readonly aggregateId: string;
|
|
6
|
-
readonly level: NotificationLevel;
|
|
7
|
-
readonly bodyI18nKey: string;
|
|
8
|
-
readonly titleI18nKey: string | undefined;
|
|
9
|
-
}
|
|
10
|
-
interface CreateNotification extends Command<typeof CREATE_NOTIFICATION>, CreateNotificationPayload {
|
|
11
|
-
}
|
|
12
|
-
interface CreateNotificationFunction {
|
|
13
|
-
(payload: CreateNotificationPayload): CreateNotification;
|
|
14
|
-
}
|
|
15
|
-
declare const createNotification: CreateNotificationFunction;
|
|
16
|
-
export type { CreateNotification };
|
|
17
|
-
export { CREATE_NOTIFICATION, createNotification };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { command } from "@lookiero/messaging";
|
|
2
|
-
const CREATE_NOTIFICATION = "create_notification";
|
|
3
|
-
const createNotification = ({ aggregateId, ...payload }) => ({
|
|
4
|
-
...command({ aggregateId, name: CREATE_NOTIFICATION }),
|
|
5
|
-
...payload,
|
|
6
|
-
});
|
|
7
|
-
export { CREATE_NOTIFICATION, createNotification };
|
|
@@ -1,21 +0,0 @@
|
|
|
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 };
|
|
@@ -1,12 +0,0 @@
|
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
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 };
|
|
@@ -1,20 +0,0 @@
|
|
|
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 };
|
|
File without changes
|