@lookiero/checkout 1.1.0 → 1.1.1-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/checkout/command/markCheckoutAsPaid.d.ts +13 -0
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +4 -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/createNotificationWhenCheckoutBookingExpired.d.ts +6 -0
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +13 -0
- 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/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +13 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +14 -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/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/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +9 -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/views/App.style.d.ts +4 -0
- package/dist/infrastructure/ui/views/App.style.js +16 -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/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/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/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/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/createNotification.d.ts +17 -0
- package/dist/shared/notifications/domain/notification/command/createNotification.js +7 -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/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/tracking/tracking.d.ts +14 -14
- package/dist/shared/tracking/tracking.js +14 -14
- package/dist/shared/ui/components/atoms/field/Field.js +7 -4
- package/dist/shared/ui/components/atoms/field/Field.style.js +2 -2
- package/dist/shared/ui/components/atoms/input/Input.js +1 -1
- package/dist/shared/ui/components/atoms/input/Input.style.d.ts +5 -0
- package/dist/shared/ui/components/atoms/input/Input.style.js +9 -0
- package/dist/shared/ui/components/molecules/inputField/InputField.js +3 -8
- package/dist/shared/ui/components/molecules/inputField/InputField.style.d.ts +2 -1
- package/dist/shared/ui/components/molecules/inputField/InputField.style.js +4 -3
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
import { RoutingInstrumentation } from "@sentry/react-native";
|
|
3
|
+
import { logger } from "@sentry/utils";
|
|
4
|
+
import React from "react";
|
|
5
|
+
class ReactRouterV6Instrumentation extends RoutingInstrumentation {
|
|
6
|
+
static instrumentationName = "react-router-v6";
|
|
7
|
+
useEffect;
|
|
8
|
+
useLocation;
|
|
9
|
+
useNavigationType;
|
|
10
|
+
matchRoutes;
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
prevRoute;
|
|
13
|
+
recentRouteKeys = [];
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
latestTransaction;
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
shouldUpdateLatestTransaction = false;
|
|
18
|
+
constructor(useEffect, useLocation, useNavigationType, matchRoutes) {
|
|
19
|
+
super();
|
|
20
|
+
this.useEffect = useEffect;
|
|
21
|
+
this.useLocation = useLocation;
|
|
22
|
+
this.useNavigationType = useNavigationType;
|
|
23
|
+
this.matchRoutes = matchRoutes;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Extends by calling _handleInitialState at the end.
|
|
27
|
+
*/
|
|
28
|
+
registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute) {
|
|
29
|
+
super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);
|
|
30
|
+
// Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.
|
|
31
|
+
this.handleInitialState();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Starts an idle transaction for the initial state which won't get called by the router listener.
|
|
35
|
+
*/
|
|
36
|
+
handleInitialState() {
|
|
37
|
+
this.latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT);
|
|
38
|
+
// We set this to true so when registerAppContainer is called, the transaction gets updated with the actual route data
|
|
39
|
+
this.shouldUpdateLatestTransaction = true;
|
|
40
|
+
}
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
getTransactionContext(route, previousRoute) {
|
|
43
|
+
return {
|
|
44
|
+
name: route.name,
|
|
45
|
+
op: "navigation",
|
|
46
|
+
tags: {
|
|
47
|
+
["routing.instrumentation"]: ReactRouterV6Instrumentation.instrumentationName,
|
|
48
|
+
["routing.route.name"]: route.name,
|
|
49
|
+
},
|
|
50
|
+
data: {
|
|
51
|
+
route: {
|
|
52
|
+
name: route.name,
|
|
53
|
+
key: route.key,
|
|
54
|
+
params: route.params ?? {},
|
|
55
|
+
hasBeenSeen: this.recentRouteKeys.includes(route.key),
|
|
56
|
+
},
|
|
57
|
+
previousRoute: previousRoute
|
|
58
|
+
? {
|
|
59
|
+
name: previousRoute.name,
|
|
60
|
+
key: previousRoute.key,
|
|
61
|
+
params: previousRoute.params ?? {},
|
|
62
|
+
}
|
|
63
|
+
: null,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
wrapUseRoutes = (origUseRoutes) => {
|
|
68
|
+
if (!this.useEffect ||
|
|
69
|
+
!this.useLocation ||
|
|
70
|
+
!this.useNavigationType ||
|
|
71
|
+
!this.matchRoutes
|
|
72
|
+
// !this._customStartTransaction
|
|
73
|
+
) {
|
|
74
|
+
__DEBUG_BUILD__ &&
|
|
75
|
+
logger.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.");
|
|
76
|
+
return origUseRoutes;
|
|
77
|
+
}
|
|
78
|
+
let isMountRenderPass = true;
|
|
79
|
+
// eslint-disable-next-line react/display-name
|
|
80
|
+
return (routes, locationArg) => {
|
|
81
|
+
const SentryRoutes = () => {
|
|
82
|
+
const Routes = origUseRoutes(routes, locationArg);
|
|
83
|
+
const location = this.useLocation();
|
|
84
|
+
const navigationType = this.useNavigationType();
|
|
85
|
+
// A value with stable identity to either pick `locationArg` if available or `location` if not
|
|
86
|
+
const stableLocationParam = typeof locationArg === "string" || (locationArg && locationArg.pathname)
|
|
87
|
+
? locationArg
|
|
88
|
+
: location;
|
|
89
|
+
this.useEffect(() => {
|
|
90
|
+
const normalizedLocation = typeof stableLocationParam === "string" ? { pathname: stableLocationParam } : stableLocationParam;
|
|
91
|
+
if (isMountRenderPass) {
|
|
92
|
+
console.log("updatePageloadTransaction", normalizedLocation, routes);
|
|
93
|
+
// updatePageloadTransaction(normalizedLocation, routes);
|
|
94
|
+
isMountRenderPass = false;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
console.log("normalizedLocation", normalizedLocation, routes, navigationType);
|
|
98
|
+
// handleNavigation(normalizedLocation, routes, navigationType);
|
|
99
|
+
}
|
|
100
|
+
}, [navigationType, stableLocationParam]);
|
|
101
|
+
return Routes;
|
|
102
|
+
};
|
|
103
|
+
return React.createElement(SentryRoutes, null);
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const INITIAL_TRANSACTION_CONTEXT = {
|
|
108
|
+
name: "App Launch",
|
|
109
|
+
op: "navigation",
|
|
110
|
+
tags: {
|
|
111
|
+
["routing.instrumentation"]: ReactRouterV6Instrumentation.instrumentationName,
|
|
112
|
+
},
|
|
113
|
+
data: {},
|
|
114
|
+
};
|
|
115
|
+
export { ReactRouterV6Instrumentation };
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { removeNotification as sut, REMOVE_NOTIFICATION } from "./removeNotification";
|
|
2
|
+
describe("removeNotification", () => {
|
|
3
|
+
it("returns a RemoveNotification command", () => {
|
|
4
|
+
const aggregateId = "67ac1d5c-6d24-4b19-bc01-8f61c266670c";
|
|
5
|
+
const command = sut({ aggregateId });
|
|
6
|
+
expect(command.aggregateId).toBe(aggregateId);
|
|
7
|
+
expect(command.name).toBe(REMOVE_NOTIFICATION);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -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 };
|
|
@@ -2,20 +2,20 @@ import { MediaPerspective } from "../../projection/checkoutItem/checkoutItem";
|
|
|
2
2
|
import { Country } from "../../projection/shared/country";
|
|
3
3
|
declare enum TrackingEvent {
|
|
4
4
|
PAGEVIEW = "pageview",
|
|
5
|
-
KEEP_ITEM = "
|
|
6
|
-
RETURN_ITEM = "
|
|
7
|
-
REPLACE_ITEM = "
|
|
8
|
-
RESET_ITEM = "
|
|
9
|
-
IMAGE_VIEW = "
|
|
10
|
-
PRESS_PRICING = "
|
|
11
|
-
PRESS_ITEM = "
|
|
12
|
-
PRESS_CONTINUE = "
|
|
13
|
-
TAB_VIEW = "
|
|
14
|
-
CHANGE_FEEDBACK = "
|
|
15
|
-
PRESS_MENU = "
|
|
16
|
-
PRESS_BACK = "
|
|
17
|
-
PRESS_NEXT = "
|
|
18
|
-
PRESS_PREVIOUS = "
|
|
5
|
+
KEEP_ITEM = "keep_item",
|
|
6
|
+
RETURN_ITEM = "return_item",
|
|
7
|
+
REPLACE_ITEM = "replace_item",
|
|
8
|
+
RESET_ITEM = "reset_item",
|
|
9
|
+
IMAGE_VIEW = "image_view",
|
|
10
|
+
PRESS_PRICING = "press_pricing",
|
|
11
|
+
PRESS_ITEM = "press_item",
|
|
12
|
+
PRESS_CONTINUE = "press_continue",
|
|
13
|
+
TAB_VIEW = "tab_view",
|
|
14
|
+
CHANGE_FEEDBACK = "change_feedback",
|
|
15
|
+
PRESS_MENU = "press_menu",
|
|
16
|
+
PRESS_BACK = "press_back",
|
|
17
|
+
PRESS_NEXT = "press_next",
|
|
18
|
+
PRESS_PREVIOUS = "press_previous"
|
|
19
19
|
}
|
|
20
20
|
declare enum TrackingEventCategory {
|
|
21
21
|
NAVIGATION = "navigation"
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var TrackingEvent;
|
|
2
2
|
(function (TrackingEvent) {
|
|
3
3
|
TrackingEvent["PAGEVIEW"] = "pageview";
|
|
4
|
-
TrackingEvent["KEEP_ITEM"] = "
|
|
5
|
-
TrackingEvent["RETURN_ITEM"] = "
|
|
6
|
-
TrackingEvent["REPLACE_ITEM"] = "
|
|
7
|
-
TrackingEvent["RESET_ITEM"] = "
|
|
8
|
-
TrackingEvent["IMAGE_VIEW"] = "
|
|
9
|
-
TrackingEvent["PRESS_PRICING"] = "
|
|
10
|
-
TrackingEvent["PRESS_ITEM"] = "
|
|
11
|
-
TrackingEvent["PRESS_CONTINUE"] = "
|
|
12
|
-
TrackingEvent["TAB_VIEW"] = "
|
|
13
|
-
TrackingEvent["CHANGE_FEEDBACK"] = "
|
|
14
|
-
TrackingEvent["PRESS_MENU"] = "
|
|
15
|
-
TrackingEvent["PRESS_BACK"] = "
|
|
16
|
-
TrackingEvent["PRESS_NEXT"] = "
|
|
17
|
-
TrackingEvent["PRESS_PREVIOUS"] = "
|
|
4
|
+
TrackingEvent["KEEP_ITEM"] = "keep_item";
|
|
5
|
+
TrackingEvent["RETURN_ITEM"] = "return_item";
|
|
6
|
+
TrackingEvent["REPLACE_ITEM"] = "replace_item";
|
|
7
|
+
TrackingEvent["RESET_ITEM"] = "reset_item";
|
|
8
|
+
TrackingEvent["IMAGE_VIEW"] = "image_view";
|
|
9
|
+
TrackingEvent["PRESS_PRICING"] = "press_pricing";
|
|
10
|
+
TrackingEvent["PRESS_ITEM"] = "press_item";
|
|
11
|
+
TrackingEvent["PRESS_CONTINUE"] = "press_continue";
|
|
12
|
+
TrackingEvent["TAB_VIEW"] = "tab_view";
|
|
13
|
+
TrackingEvent["CHANGE_FEEDBACK"] = "change_feedback";
|
|
14
|
+
TrackingEvent["PRESS_MENU"] = "press_menu";
|
|
15
|
+
TrackingEvent["PRESS_BACK"] = "press_back";
|
|
16
|
+
TrackingEvent["PRESS_NEXT"] = "press_next";
|
|
17
|
+
TrackingEvent["PRESS_PREVIOUS"] = "press_previous";
|
|
18
18
|
})(TrackingEvent || (TrackingEvent = {}));
|
|
19
19
|
var TrackingEventCategory;
|
|
20
20
|
(function (TrackingEventCategory) {
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
2
|
import { animated, useSpring } from "@react-spring/native";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useCallback, useState } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
6
6
|
import { style } from "./Field.style";
|
|
7
|
-
const
|
|
7
|
+
const SCALE = 0.75;
|
|
8
|
+
const { spaceXS, spaceM } = theme();
|
|
8
9
|
const Field = ({ label, isFocused = false, style: customStyle }) => {
|
|
10
|
+
const [width, setWidth] = useState(0);
|
|
11
|
+
const handleOnLayout = useCallback(({ nativeEvent: { layout } }) => setWidth(layout.width), []);
|
|
9
12
|
const springs = useSpring(isFocused
|
|
10
|
-
? { scale:
|
|
13
|
+
? { scale: SCALE, translateY: -14, translateX: -(((1 - SCALE) * width) / 2 + spaceXS) }
|
|
11
14
|
: { scale: 1, translateY: spaceM, translateX: 0 });
|
|
12
15
|
return (React.createElement(animated.View, { pointerEvents: "none", style: [
|
|
13
16
|
{
|
|
14
17
|
transform: [{ scale: springs.scale }, { translateY: springs.translateY }, { translateX: springs.translateX }],
|
|
15
18
|
},
|
|
16
19
|
customStyle?.field,
|
|
17
|
-
] },
|
|
20
|
+
], onLayout: handleOnLayout },
|
|
18
21
|
React.createElement(Text, { level: 1, numberOfLines: 1, style: [style.fieldText, customStyle?.fieldText], detail: true }, label),
|
|
19
22
|
React.createElement(View, { style: [style.fieldBackground, { opacity: isFocused ? 1 : 0 }] })));
|
|
20
23
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
|
-
const { colorBase,
|
|
3
|
+
const { colorBase, spaceXS } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
fieldBackground: {
|
|
6
6
|
backgroundColor: colorBase,
|
|
@@ -12,7 +12,7 @@ const style = StyleSheet.create({
|
|
|
12
12
|
fieldText: {
|
|
13
13
|
flexWrap: "nowrap",
|
|
14
14
|
overflow: "hidden",
|
|
15
|
-
paddingHorizontal:
|
|
15
|
+
paddingHorizontal: spaceXS,
|
|
16
16
|
zIndex: 1,
|
|
17
17
|
},
|
|
18
18
|
});
|
|
@@ -32,6 +32,6 @@ const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customSt
|
|
|
32
32
|
}, [maxHeight, minHeight, multiline]);
|
|
33
33
|
useLayoutEffect(handleOnContentSizeChangeWeb, [handleOnContentSizeChangeWeb, value]);
|
|
34
34
|
const textInputRef = useRef(null);
|
|
35
|
-
return (React.createElement(TextInput, { ...restOfProps, ref: textInputRef, multiline: multiline, numberOfLines: !!multiline ? undefined : 1, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, { height }], testID: "input", textAlignVertical: "top", value: value, onChange: onChange, onContentSizeChange: handleOnContentSizeChange }));
|
|
35
|
+
return (React.createElement(TextInput, { ...restOfProps, ref: textInputRef, multiline: multiline, numberOfLines: !!multiline ? undefined : 1, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, !multiline && style.singleLine, { height }], testID: "input", textAlignVertical: "top", value: value, onChange: onChange, onContentSizeChange: handleOnContentSizeChange }));
|
|
36
36
|
};
|
|
37
37
|
export { Input };
|
|
@@ -3,8 +3,12 @@ declare const paddingVertical: number;
|
|
|
3
3
|
declare const style: {
|
|
4
4
|
input: {
|
|
5
5
|
lineHeight?: number | undefined;
|
|
6
|
+
textOverflow?: string | undefined;
|
|
7
|
+
appearance?: string | undefined;
|
|
8
|
+
outlineWidth?: number | undefined;
|
|
6
9
|
borderWidth: number;
|
|
7
10
|
color: string;
|
|
11
|
+
display: "flex";
|
|
8
12
|
fontFamily: string;
|
|
9
13
|
fontSize: number;
|
|
10
14
|
letterSpacing: number;
|
|
@@ -12,5 +16,6 @@ declare const style: {
|
|
|
12
16
|
paddingHorizontal: number;
|
|
13
17
|
paddingTop: number;
|
|
14
18
|
};
|
|
19
|
+
singleLine: {};
|
|
15
20
|
};
|
|
16
21
|
export { style, borderSize, paddingVertical };
|
|
@@ -7,6 +7,7 @@ const style = StyleSheet.create({
|
|
|
7
7
|
input: {
|
|
8
8
|
borderWidth: borderSize,
|
|
9
9
|
color: colorContent,
|
|
10
|
+
display: "flex",
|
|
10
11
|
fontFamily: fontMap.Body,
|
|
11
12
|
fontSize: fontBodySize3,
|
|
12
13
|
letterSpacing: fontBodyLetterSpacing3,
|
|
@@ -16,8 +17,16 @@ const style = StyleSheet.create({
|
|
|
16
17
|
...Platform.select({
|
|
17
18
|
web: {
|
|
18
19
|
lineHeight: fontBodyHeight3,
|
|
20
|
+
textOverflow: "ellipsis",
|
|
21
|
+
appearance: "none",
|
|
22
|
+
outlineWidth: 0,
|
|
19
23
|
},
|
|
20
24
|
}),
|
|
21
25
|
},
|
|
26
|
+
singleLine: {
|
|
27
|
+
// flexWrap: "nowrap",
|
|
28
|
+
// flex: 1,
|
|
29
|
+
// flexShrink: 1,
|
|
30
|
+
},
|
|
22
31
|
});
|
|
23
32
|
export { style, borderSize, paddingVertical };
|
|
@@ -6,9 +6,8 @@ import { Field } from "../../atoms/field/Field";
|
|
|
6
6
|
import { Icon } from "../../atoms/icon/Icon";
|
|
7
7
|
import { Input } from "../../atoms/input/Input";
|
|
8
8
|
import { style } from "./InputField.style";
|
|
9
|
-
const { colorBase, colorContent, colorGrayscaleL, colorPrimary,
|
|
10
|
-
const inputPaddingRightWithIcon = iconSize +
|
|
11
|
-
const inputPaddingRightWithoutIcon = spaceM;
|
|
9
|
+
const { colorBase, colorContent, colorGrayscaleL, colorPrimary, spaceL, iconSize } = theme();
|
|
10
|
+
const inputPaddingRightWithIcon = iconSize + spaceL;
|
|
12
11
|
const InputField = ({ label, placeholder, value, multiline = false, minHeight, error, style: customStyle, onChange = () => void 0, icon, ...inputRestProps }) => {
|
|
13
12
|
const [isFocused, setIsFocused] = useState(false);
|
|
14
13
|
const handleOnChange = useCallback((text) => onChange(text), [onChange]);
|
|
@@ -18,11 +17,7 @@ const InputField = ({ label, placeholder, value, multiline = false, minHeight, e
|
|
|
18
17
|
return (React.createElement(View, { style: customStyle?.inputField, testID: "input-field" },
|
|
19
18
|
React.createElement(Field, { isFocused: isFocused || !!value, label: label, style: {
|
|
20
19
|
field: [style.field, customStyle?.field],
|
|
21
|
-
fieldText: [
|
|
22
|
-
{ color },
|
|
23
|
-
{ paddingRight: !!icon ? inputPaddingRightWithIcon : inputPaddingRightWithoutIcon },
|
|
24
|
-
customStyle?.fieldText,
|
|
25
|
-
],
|
|
20
|
+
fieldText: [{ color }, customStyle?.fieldText],
|
|
26
21
|
} }),
|
|
27
22
|
React.createElement(Input, { minHeight: minHeight, multiline: multiline, placeholder: placeholder, placeholderTextColor: isFocused ? colorGrayscaleL : colorBase, style: [!!icon && { paddingRight: inputPaddingRightWithIcon }, { borderColor: color }, customStyle?.input], value: value, onBlur: handleOnBlur, onChangeText: handleOnChange, onFocus: handleOnFocus, ...inputRestProps }),
|
|
28
23
|
!!icon && React.createElement(Icon, { name: icon, style: [style.icon, { color }, customStyle?.icon] }),
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
|
-
const { spaceXS,
|
|
3
|
+
const { spaceXS, spaceM, spaceL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
error: {
|
|
6
6
|
marginLeft: spaceL,
|
|
7
7
|
marginTop: spaceXS,
|
|
8
8
|
},
|
|
9
9
|
field: {
|
|
10
|
+
left: spaceM,
|
|
11
|
+
maxWidth: "100%",
|
|
10
12
|
position: "absolute",
|
|
11
|
-
width: "100%",
|
|
12
13
|
zIndex: 4,
|
|
13
14
|
},
|
|
14
15
|
icon: {
|
|
15
16
|
position: "absolute",
|
|
16
|
-
right:
|
|
17
|
+
right: spaceM,
|
|
17
18
|
top: spaceM,
|
|
18
19
|
zIndex: 4,
|
|
19
20
|
},
|