@lookiero/checkout 2.4.1 → 3.0.0-beta.1
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/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +6 -0
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +13 -0
- 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/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/Root.d.ts +2 -1
- package/dist/infrastructure/ui/Root.js +2 -2
- package/dist/infrastructure/ui/components/layouts/layout/Layout.d.ts +11 -0
- package/dist/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
- package/dist/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +6 -0
- package/dist/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +4 -0
- package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +6 -0
- package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.js +5 -0
- package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +5 -0
- package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +21 -0
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +3 -0
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +15 -0
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +10 -0
- package/dist/infrastructure/ui/components/templates/footer/Footer.d.ts +3 -0
- package/dist/infrastructure/ui/components/templates/footer/Footer.js +13 -0
- package/dist/infrastructure/ui/components/templates/header/Header.d.ts +5 -0
- package/dist/infrastructure/ui/components/templates/header/Header.js +5 -0
- package/dist/infrastructure/ui/components/templates/header/Header.style.d.ts +14 -0
- package/dist/infrastructure/ui/components/templates/header/Header.style.js +17 -0
- package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.d.ts +3 -0
- package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.js +5 -0
- package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.style.js +12 -0
- package/dist/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.d.ts +6 -0
- package/dist/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +24 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +3 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +11 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
- package/dist/infrastructure/ui/components/templates/header/header/Header.d.ts +3 -0
- package/dist/infrastructure/ui/components/templates/header/header/Header.js +10 -0
- package/dist/infrastructure/ui/components/templates/header/header/Header.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/templates/header/header/Header.style.js +12 -0
- package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.d.ts +6 -0
- package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +15 -0
- package/dist/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.d.ts +26 -0
- package/dist/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +35 -0
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.d.ts +7 -0
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.js +11 -0
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.d.ts +7 -0
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.js +8 -0
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts +13 -0
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js +19 -0
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.d.ts +6 -0
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.js +7 -0
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +2 -0
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +28 -0
- package/dist/infrastructure/ui/hooks/useToast.d.ts +11 -0
- package/dist/infrastructure/ui/hooks/useToast.js +49 -0
- package/dist/infrastructure/ui/routing/Routing.d.ts +2 -1
- package/dist/infrastructure/ui/routing/Routing.js +7 -7
- package/dist/infrastructure/ui/views/App.d.ts +0 -4
- package/dist/infrastructure/ui/views/App.js +2 -4
- package/dist/infrastructure/ui/views/checkout/Checkout.d.ts +2 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.js +12 -6
- package/dist/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +7 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +25 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +16 -0
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +19 -0
- package/dist/infrastructure/ui/views/feedback/Feedback.d.ts +2 -0
- package/dist/infrastructure/ui/views/feedback/Feedback.js +6 -6
- package/dist/infrastructure/ui/views/feedback/Feedback.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/feedback/Feedback.style.js +4 -1
- 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 +52 -0
- package/dist/infrastructure/ui/views/intro/Intro.style.js +55 -0
- package/dist/infrastructure/ui/views/item/Item.d.ts +2 -0
- package/dist/infrastructure/ui/views/item/Item.js +39 -3
- package/dist/infrastructure/ui/views/item/Item.style.d.ts +15 -0
- package/dist/infrastructure/ui/views/item/Item.style.js +18 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +26 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +44 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +45 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +53 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +7 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +25 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +16 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +19 -0
- package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +2 -4
- package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.style.js +4 -1
- package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +5 -5
- package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.d.ts +6 -0
- package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.js +9 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.d.ts +2 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.js +9 -10
- package/dist/infrastructure/ui/views/notFound/NotFound.style.d.ts +1 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.style.js +2 -1
- package/dist/infrastructure/ui/views/summary/Summary.d.ts +2 -0
- package/dist/infrastructure/ui/views/summary/Summary.js +11 -11
- package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/summary/Summary.style.js +4 -1
- package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +17 -0
- package/dist/shared/notifications/domain/notification/command/createNotification.js +7 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +21 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +22 -0
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +12 -0
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +24 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +9 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +20 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +36 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +31 -0
- package/dist/shared/tracking/infrastructure/usePageView.d.ts +13 -0
- package/dist/shared/tracking/infrastructure/usePageView.js +27 -0
- package/dist/shared/ui/components/atoms/error/Error.style.d.ts +6 -0
- package/dist/shared/ui/components/atoms/error/Error.style.js +9 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { Text } from "@lookiero/aurora";
|
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
4
|
import React, { useCallback, useMemo, useState } from "react";
|
|
5
|
-
import { Platform, View } from "react-native";
|
|
5
|
+
import { Platform, ScrollView, View } from "react-native";
|
|
6
6
|
import { generatePath, useNavigate } from "react-router-native";
|
|
7
7
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
8
8
|
import { useTrackPageView } from "../../../../shared/tracking/infrastructure/useTrackPageView";
|
|
@@ -16,16 +16,14 @@ import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checko
|
|
|
16
16
|
import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
17
17
|
import { TrackingPage } from "../../../tracking/tracking";
|
|
18
18
|
import { Body } from "../../components/layouts/body/Body";
|
|
19
|
-
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
20
19
|
import { I18nMessages } from "../../i18n/i18n";
|
|
21
20
|
import { Routes } from "../../routing/routes";
|
|
22
21
|
import { useBasePath } from "../../routing/useBasePath";
|
|
23
|
-
import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
24
22
|
import { style } from "./Summary.style";
|
|
25
23
|
import { CheckoutItemsTabs } from "./components/checkoutItemsTabs/CheckoutItemsTabs";
|
|
26
24
|
import { FiveItemsDiscountBanner } from "./components/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
27
25
|
import { StickyPricing } from "./components/stickyPricing/StickyPricing";
|
|
28
|
-
const Summary = ({ customerId, country }) => {
|
|
26
|
+
const Summary = ({ customerId, country, layout: Layout }) => {
|
|
29
27
|
const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
|
|
30
28
|
const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
|
|
31
29
|
const [pricingHeight, setPricingHeight] = useState(0);
|
|
@@ -83,12 +81,14 @@ const Summary = ({ customerId, country }) => {
|
|
|
83
81
|
dependenciesLoadedStatuses.includes(fiveItemsDiscountStatus);
|
|
84
82
|
if (!dependenciesLoaded)
|
|
85
83
|
return React.createElement(Spinner, null);
|
|
86
|
-
return (React.createElement(
|
|
87
|
-
React.createElement(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
React.createElement(
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
return (React.createElement(Layout, null,
|
|
85
|
+
React.createElement(ScrollView, { contentContainerStyle: style.container, showsVerticalScrollIndicator: false },
|
|
86
|
+
React.createElement(Body, { style: { row: { paddingBottom: pricingHeight } } },
|
|
87
|
+
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
88
|
+
React.createElement(View, { style: style.content },
|
|
89
|
+
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
90
|
+
React.createElement(Text, { level: 3, style: style.description }, descriptionText)),
|
|
91
|
+
React.createElement(CheckoutItemsTabs, { checkoutItemsKept: checkoutItemsKept || [], checkoutItemsReturned: checkoutItemsReturned || [], country: country, onChanged: handleOnChangedTab, onPressItem: handleOnPressItem }))),
|
|
92
|
+
pricing && (React.createElement(StickyPricing, { collapsed: pricingCollapsed, pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined, onPress: handleOnPressPricing, onSubmit: handleOnSubmit }))));
|
|
93
93
|
};
|
|
94
94
|
export { Summary };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../theme/theme";
|
|
3
|
-
const { spaceM, spaceL, spaceXL } = theme();
|
|
3
|
+
const { spaceM, spaceL, spaceXL, spaceXXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
paddingBottom: spaceXXL,
|
|
7
|
+
},
|
|
5
8
|
content: {
|
|
6
9
|
paddingHorizontal: spaceXL,
|
|
7
10
|
},
|
|
@@ -0,0 +1,17 @@
|
|
|
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 };
|
|
@@ -0,0 +1,7 @@
|
|
|
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 };
|
|
@@ -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 };
|
package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js
ADDED
|
@@ -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 };
|
|
@@ -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 };
|