@lookiero/checkout 1.1.7 → 1.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/components/atoms/price/Price.js +1 -1
- package/dist/infrastructure/ui/components/layouts/banner/Banner.js +2 -2
- package/dist/infrastructure/ui/components/layouts/banner/Banner.style.d.ts +0 -3
- package/dist/infrastructure/ui/components/layouts/banner/Banner.style.js +0 -3
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.js +2 -2
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.style.d.ts +0 -6
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.style.js +1 -7
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -9
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +1 -1
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +1 -1
- 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.js +9 -4
- package/dist/infrastructure/ui/theme/theme.d.ts +1 -1
- package/dist/infrastructure/ui/theme/theme.js +1 -3
- package/dist/infrastructure/ui/views/checkout/Checkout.js +1 -1
- 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/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +2 -5
- 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.style.d.ts +15 -0
- package/dist/infrastructure/ui/views/item/Item.style.js +18 -0
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +1 -1
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +5 -19
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +0 -3
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +1 -2
- 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/productVariantDescription/ProductVariantDescription.js +5 -5
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +0 -7
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +1 -8
- package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -1
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +1 -2
- 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/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -11
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.js +0 -3
- package/dist/infrastructure/ui/views/navigation/Navigation.js +1 -1
- package/dist/infrastructure/ui/views/navigation/components/header/Header.js +4 -4
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +0 -3
- package/dist/infrastructure/ui/views/notFound/NotFound.js +2 -3
- package/dist/infrastructure/ui/views/shared/components/productVariant/ProductVariant.js +4 -4
- package/dist/infrastructure/ui/views/shared/components/productVariant/ProductVariant.style.d.ts +0 -9
- package/dist/infrastructure/ui/views/shared/components/productVariant/ProductVariant.style.js +0 -9
- package/dist/infrastructure/ui/views/summary/Summary.js +2 -2
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +1 -1
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +2 -2
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +3 -4
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +0 -3
- 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/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.js +4 -11
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts +0 -3
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.js +0 -3
- 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.js +2 -3
- package/dist/shared/ui/components/atoms/field/Field.js +1 -1
- package/dist/shared/ui/components/atoms/spinner/Spinner.js +1 -1
- package/dist/shared/ui/components/layouts/modal/Modal.js +1 -1
- package/dist/shared/ui/components/layouts/sticky/Sticky.style.d.ts +12 -3
- package/dist/shared/ui/components/molecules/selectField/SelectField.js +2 -2
- package/dist/shared/ui/components/molecules/selectField/SelectField.style.d.ts +0 -3
- package/dist/shared/ui/components/molecules/selectField/SelectField.style.js +1 -4
- package/dist/shared/ui/components/molecules/toast/Toast.js +3 -3
- package/dist/shared/ui/components/molecules/toast/Toast.style.d.ts +4 -4
- package/dist/shared/ui/components/molecules/toast/Toast.style.js +1 -4
- package/dist/shared/ui/hooks/useScreenSize.js +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,6 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface IncrementIntroShownCountFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
type UseIncrementIntroShownCount = [incrementIntroShownCount: IncrementIntroShownCountFunction, status: CommandStatus];
|
|
6
|
+
interface UseIncrementIntroShownCountFunction {
|
|
7
|
+
(): UseIncrementIntroShownCount;
|
|
8
|
+
}
|
|
9
|
+
declare const useIncrementIntroShownCount: UseIncrementIntroShownCountFunction;
|
|
10
|
+
export { useIncrementIntroShownCount };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useViewIntroShownCount } from "../../../projection/uiSetting/react/useViewIntroShownCount";
|
|
3
|
+
import { UISettings } from "../../../ui/settings/UISettings";
|
|
4
|
+
import { useUpdateUiSetting } from "./useUpdateUiSetting";
|
|
5
|
+
const useIncrementIntroShownCount = () => {
|
|
6
|
+
const [update, status] = useUpdateUiSetting();
|
|
7
|
+
const [introShownCount] = useViewIntroShownCount();
|
|
8
|
+
const incrementIntroShownCount = useCallback(() => update({ key: UISettings.INTRO_SHOWN_COUNT, value: introShownCount + 1 }), [introShownCount, update]);
|
|
9
|
+
return [incrementIntroShownCount, status];
|
|
10
|
+
};
|
|
11
|
+
export { useIncrementIntroShownCount };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useViewIntroShownCount } from "./useViewIntroShownCount";
|
|
2
|
+
const MAX_INTRO_SHOWN_COUNT = 2;
|
|
3
|
+
const useShouldIntroBeShown = () => {
|
|
4
|
+
const [introShownCount, introShownCountStatus] = useViewIntroShownCount();
|
|
5
|
+
return [introShownCount < MAX_INTRO_SHOWN_COUNT, introShownCountStatus];
|
|
6
|
+
};
|
|
7
|
+
export { useShouldIntroBeShown };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UISettings } from "../../../ui/settings/UISettings";
|
|
2
|
+
import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
|
|
3
|
+
const useViewIntroShownCount = () => {
|
|
4
|
+
const [introShownCount, introShownCountStatus] = useViewUiSettingByKey({
|
|
5
|
+
key: UISettings.INTRO_SHOWN_COUNT,
|
|
6
|
+
});
|
|
7
|
+
return [introShownCount?.value || 0, introShownCountStatus];
|
|
8
|
+
};
|
|
9
|
+
export { useViewIntroShownCount };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
import { ALIGN, Text } from "@lookiero/aurora";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { style } from "./Banner.style";
|
|
5
5
|
const Banner = ({ children, text }) => (React.createElement(View, { style: style.container },
|
|
6
|
-
React.createElement(Text, {
|
|
6
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 2, detail: true }, text),
|
|
7
7
|
children));
|
|
8
8
|
export { Banner };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
import { COLOR, Text } from "@lookiero/aurora";
|
|
2
2
|
import { animated, useSpring } from "@react-spring/native";
|
|
3
3
|
import React, { Children, useCallback, useEffect, useState } from "react";
|
|
4
4
|
import { Pressable, View } from "react-native";
|
|
@@ -6,7 +6,7 @@ import invariant from "tiny-invariant";
|
|
|
6
6
|
import { Slider } from "../../../../../shared/ui/components/layouts/slider/Slider";
|
|
7
7
|
import { style } from "./Tabs.style";
|
|
8
8
|
const Tab = ({ children, active, disabled = false, style: customStyle, onPress, onLayout }) => (React.createElement(Pressable, { disabled: disabled, style: [style.tab, customStyle?.tab], testID: "tab", onLayout: onLayout, onPress: onPress },
|
|
9
|
-
React.createElement(Text, {
|
|
9
|
+
React.createElement(Text, { color: active ? COLOR.CONTENT : COLOR.GRAYSCALE_L, level: 2, style: customStyle?.tabText, detail: true }, children)));
|
|
10
10
|
const TabList = ({ labels = [], tabIndex = 0, style: customStyle, onSelect }) => {
|
|
11
11
|
const [tabItemPositions, setTabItemPositions] = useState([]);
|
|
12
12
|
const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, x }, }, }, index) => setTabItemPositions((prevState) => [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../theme/theme";
|
|
3
|
-
const { colorBase, colorContent, colorGrayscaleS,
|
|
3
|
+
const { colorBase, colorContent, colorGrayscaleS, spaceM, spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
container: {
|
|
6
6
|
width: "100%",
|
|
@@ -16,12 +16,6 @@ const style = StyleSheet.create({
|
|
|
16
16
|
marginHorizontal: spaceM,
|
|
17
17
|
paddingVertical: spaceM,
|
|
18
18
|
},
|
|
19
|
-
tabActiveText: {
|
|
20
|
-
color: colorContent,
|
|
21
|
-
},
|
|
22
|
-
tabText: {
|
|
23
|
-
color: colorGrayscaleL,
|
|
24
|
-
},
|
|
25
19
|
tabs: {
|
|
26
20
|
alignItems: "center",
|
|
27
21
|
backgroundColor: colorBase,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Button } from "@lookiero/aurora
|
|
2
|
-
import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
|
|
1
|
+
import { Button, BUTTON_VARIANT } from "@lookiero/aurora";
|
|
3
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
3
|
import React, { useCallback } from "react";
|
|
5
4
|
import { theme } from "../../../../../theme/theme";
|
|
@@ -10,12 +9,6 @@ const ButtonCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId
|
|
|
10
9
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
11
10
|
const optionText = useI18nMessage({ id: checkoutQuestion.name });
|
|
12
11
|
const handleOnPress = useCallback(() => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }), [onChange, checkoutQuestion.id, checkoutQuestionParentId]);
|
|
13
|
-
return (React.createElement(Button
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
, {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
style: [style.button, { backgroundColor: feedback === checkoutQuestion.id ? colorAccent : colorBase }], variant: BUTTON_VARIANT.SECONDARY, onPress: handleOnPress }, optionText));
|
|
12
|
+
return (React.createElement(Button, { style: [style.button, { backgroundColor: feedback === checkoutQuestion.id ? colorAccent : colorBase }], variant: BUTTON_VARIANT.SECONDARY, onPress: handleOnPress }, optionText));
|
|
20
13
|
};
|
|
21
14
|
export { ButtonCheckoutQuestionItem };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { style } from "./HostDefaultCheckoutQuestionItem.style";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { style } from "./HostDefaultReturnQuestionItem.style";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import { animated, useSpring } from "@react-spring/native";
|
|
4
4
|
import React, { useCallback, useState } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback } from "react";
|
|
4
4
|
import { TouchableHighlight } from "react-native";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEvent } from "@lookiero/event";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
import { useCreateNotification } from "../../../shared/notifications";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
5
|
+
import { I18nMessages } from "../i18n/i18n";
|
|
6
|
+
import { useToast } from "./useToast";
|
|
7
|
+
const PAYMENT_ERROR = "ERROR";
|
|
8
|
+
const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
|
|
9
|
+
const usePaymentInstrumentUpdateEvents = () => {
|
|
10
|
+
const { subscribe, unsubscribe } = useEvent();
|
|
11
|
+
const { showError, showSuccess } = useToast();
|
|
12
|
+
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
|
|
13
|
+
const onSuccess = useCallback(({ message }) => showSuccess({ message: message.id }), [showSuccess]);
|
|
14
|
+
const onError = useCallback(({ error }) => {
|
|
15
|
+
if (error.toaster) {
|
|
16
|
+
showError({ message: error.toaster.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR });
|
|
17
|
+
}
|
|
18
|
+
}, [showError]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
subscribe({ event: PAYMENT_ERROR }, onError);
|
|
21
|
+
subscribe({ event: PAYMENT_SUCCESS }, onSuccess);
|
|
22
|
+
return () => {
|
|
23
|
+
unsubscribe({ event: PAYMENT_ERROR }, onError);
|
|
24
|
+
unsubscribe({ event: PAYMENT_SUCCESS }, onSuccess);
|
|
25
|
+
};
|
|
26
|
+
}, [subscribe, unsubscribe, createNotification, onError, onSuccess]);
|
|
27
|
+
};
|
|
28
|
+
export { usePaymentInstrumentUpdateEvents };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Notification } from "@lookiero/aurora
|
|
2
|
-
import { useStack } from "@lookiero/aurora-next/build/contexts/Stack/Stack";
|
|
1
|
+
import { Notification, useStack } from "@lookiero/aurora";
|
|
3
2
|
import { useIntl } from "@lookiero/i18n-react";
|
|
4
3
|
import { useCallback } from "react";
|
|
5
4
|
import { StyleSheet } from "react-native";
|
|
@@ -34,8 +33,14 @@ const useToast = () => {
|
|
|
34
33
|
const Stack = useStack();
|
|
35
34
|
const intl = useIntl();
|
|
36
35
|
const translate = useCallback((message) => intl.formatMessage({ id: message, defaultMessage: message }), [intl]);
|
|
37
|
-
const showError = useCallback(({ message }) => Stack.alert(uuid(),
|
|
38
|
-
|
|
36
|
+
const showError = useCallback(({ message }) => Stack.alert(uuid(),
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
Notification, { ...getNotificationDefaults(), text: translate(message) }), [Stack, translate]);
|
|
40
|
+
const showSuccess = useCallback(({ message }) => Stack.success(uuid(),
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
Notification, { ...getNotificationDefaults(), text: translate(message) }), [Stack, translate]);
|
|
39
44
|
return {
|
|
40
45
|
showError,
|
|
41
46
|
showSuccess,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from "@lookiero/aurora
|
|
1
|
+
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 } from "react";
|
|
@@ -0,0 +1,25 @@
|
|
|
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 };
|
|
@@ -0,0 +1,19 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { Button } from "@lookiero/aurora
|
|
1
|
+
import { Button } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback, useMemo } from "react";
|
|
4
4
|
import { CheckoutQuestionType, } from "../../../../../../projection/checkoutQuestion/checkoutQuestion";
|
|
@@ -32,9 +32,6 @@ const CheckoutQuestionsForm = ({ checkoutQuestions, submitButtonDisabled, onSubm
|
|
|
32
32
|
return (React.createElement(React.Fragment, null,
|
|
33
33
|
React.createElement(CheckoutQuestionItemProvider, { checkoutQuestionItems: checkoutQuestionItems },
|
|
34
34
|
React.createElement(CheckoutQuestions, { checkoutQuestions: filteredCheckoutQuestions })),
|
|
35
|
-
React.createElement(Button, { busy: submitButtonDisabled,
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
style: style.button, onPress: handlePress }, buttonText)));
|
|
35
|
+
React.createElement(Button, { busy: submitButtonDisabled, style: style.button, onPress: handlePress }, buttonText)));
|
|
39
36
|
};
|
|
40
37
|
export { CheckoutQuestionsForm };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
|
|
2
|
+
import { Icon } from "@lookiero/aurora-next/build/components/primitives/Icon/Icon";
|
|
3
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
4
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
5
|
+
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { Platform, View } from "react-native";
|
|
8
|
+
import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
|
|
9
|
+
import { useIncrementIntroShownCount } from "../../../domain/uiSetting/react/useIncrementIntroShownCount";
|
|
10
|
+
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
|
|
11
|
+
import { Body } from "../../components/layouts/body/Body";
|
|
12
|
+
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
13
|
+
import { I18nMessages } from "../../i18n/i18n";
|
|
14
|
+
import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
15
|
+
import { style } from "./Intro.style";
|
|
16
|
+
const Bullet = ({ text }) => (React.createElement(View, { style: style.bullet },
|
|
17
|
+
React.createElement(Icon, { name: "rounded-tick", style: style.tickIcon }),
|
|
18
|
+
React.createElement(Text, { level: 2, detail: true }, text)));
|
|
19
|
+
const Intro = ({ customerId }) => {
|
|
20
|
+
const titleText = useI18nMessage({ id: I18nMessages.INTRO_TITLE });
|
|
21
|
+
const subTitleText = useI18nMessage({ id: I18nMessages.INTRO_SUBTITLE });
|
|
22
|
+
const discountText = useI18nMessage({ id: I18nMessages.INTRO_DISCOUNT });
|
|
23
|
+
const bulletOneText = useI18nMessage({ id: I18nMessages.INTRO_BULLET_ONE });
|
|
24
|
+
const bulletTwoText = useI18nMessage({ id: I18nMessages.INTRO_BULLET_TWO });
|
|
25
|
+
const bulletThreeText = useI18nMessage({ id: I18nMessages.INTRO_BULLET_THREE });
|
|
26
|
+
const buttonText = useI18nMessage({ id: I18nMessages.INTRO_BUTTON });
|
|
27
|
+
const [fiveItemsDiscount, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({
|
|
28
|
+
customerId,
|
|
29
|
+
});
|
|
30
|
+
const [incrementIntroShownCount, incrementIntroShownCountStatus] = useIncrementIntroShownCount();
|
|
31
|
+
if (fiveItemsDiscountStatus === QueryStatus.LOADING)
|
|
32
|
+
return React.createElement(Spinner, null);
|
|
33
|
+
return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
|
|
34
|
+
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
35
|
+
React.createElement(View, { style: style.intro },
|
|
36
|
+
React.createElement(View, { style: style.content },
|
|
37
|
+
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
38
|
+
React.createElement(Text, { level: 3, style: style.subtitle, body: true }, subTitleText),
|
|
39
|
+
fiveItemsDiscount !== 0 && (React.createElement(View, { style: style.discountContainer },
|
|
40
|
+
React.createElement(View, { style: style.discount },
|
|
41
|
+
React.createElement(Text, { level: 2, heading: true },
|
|
42
|
+
"- ",
|
|
43
|
+
fiveItemsDiscount),
|
|
44
|
+
React.createElement(Text, { level: 3, style: style.percentage, heading: true }, "%")),
|
|
45
|
+
React.createElement(Text, { level: 3, body: true }, discountText))),
|
|
46
|
+
React.createElement(View, { style: style.description },
|
|
47
|
+
React.createElement(Bullet, { text: bulletOneText }),
|
|
48
|
+
React.createElement(Bullet, { text: bulletTwoText }),
|
|
49
|
+
React.createElement(Bullet, { text: bulletThreeText }))),
|
|
50
|
+
React.createElement(Button, { disabled: incrementIntroShownCountStatus === CommandStatus.LOADING, onPress: incrementIntroShownCount }, buttonText)))));
|
|
51
|
+
};
|
|
52
|
+
export { Intro };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
bodyColumn: {
|
|
3
|
+
paddingHorizontal: number;
|
|
4
|
+
};
|
|
5
|
+
bullet: {
|
|
6
|
+
alignItems: "center";
|
|
7
|
+
flexDirection: "row";
|
|
8
|
+
marginVertical: number;
|
|
9
|
+
};
|
|
10
|
+
content: {
|
|
11
|
+
alignItems: "center";
|
|
12
|
+
};
|
|
13
|
+
description: {
|
|
14
|
+
borderWidth: number;
|
|
15
|
+
marginBottom: number;
|
|
16
|
+
padding: number;
|
|
17
|
+
width: string;
|
|
18
|
+
};
|
|
19
|
+
discount: {
|
|
20
|
+
alignItems: "flex-end";
|
|
21
|
+
flexDirection: "row";
|
|
22
|
+
justifyContent: "center";
|
|
23
|
+
marginBottom: number;
|
|
24
|
+
};
|
|
25
|
+
discountContainer: {
|
|
26
|
+
alignItems: "center";
|
|
27
|
+
backgroundColor: string;
|
|
28
|
+
marginBottom: number;
|
|
29
|
+
padding: number;
|
|
30
|
+
textAlign: "center";
|
|
31
|
+
width: string;
|
|
32
|
+
};
|
|
33
|
+
intro: {
|
|
34
|
+
flex: number;
|
|
35
|
+
justifyContent: "space-between";
|
|
36
|
+
};
|
|
37
|
+
percentage: {
|
|
38
|
+
marginLeft: number;
|
|
39
|
+
};
|
|
40
|
+
subtitle: {
|
|
41
|
+
marginBottom: number;
|
|
42
|
+
textAlign: "center";
|
|
43
|
+
};
|
|
44
|
+
tickIcon: {
|
|
45
|
+
marginRight: number;
|
|
46
|
+
};
|
|
47
|
+
title: {
|
|
48
|
+
marginBottom: number;
|
|
49
|
+
textAlign: "center";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export { style };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../theme/theme";
|
|
3
|
+
const { borderSize, colorAccent, spaceXS, spaceS, spaceM, spaceL, spaceXL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
bodyColumn: {
|
|
6
|
+
paddingHorizontal: spaceXL,
|
|
7
|
+
},
|
|
8
|
+
bullet: {
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
flexDirection: "row",
|
|
11
|
+
marginVertical: spaceS,
|
|
12
|
+
},
|
|
13
|
+
content: {
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
},
|
|
16
|
+
description: {
|
|
17
|
+
borderWidth: borderSize,
|
|
18
|
+
marginBottom: spaceXL,
|
|
19
|
+
padding: spaceM,
|
|
20
|
+
width: "100%",
|
|
21
|
+
},
|
|
22
|
+
discount: {
|
|
23
|
+
alignItems: "flex-end",
|
|
24
|
+
flexDirection: "row",
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
marginBottom: spaceS,
|
|
27
|
+
},
|
|
28
|
+
discountContainer: {
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
backgroundColor: colorAccent,
|
|
31
|
+
marginBottom: spaceL,
|
|
32
|
+
padding: spaceM,
|
|
33
|
+
textAlign: "center",
|
|
34
|
+
width: "100%",
|
|
35
|
+
},
|
|
36
|
+
intro: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
justifyContent: "space-between",
|
|
39
|
+
},
|
|
40
|
+
percentage: {
|
|
41
|
+
marginLeft: spaceXS,
|
|
42
|
+
},
|
|
43
|
+
subtitle: {
|
|
44
|
+
marginBottom: spaceXL,
|
|
45
|
+
textAlign: "center",
|
|
46
|
+
},
|
|
47
|
+
tickIcon: {
|
|
48
|
+
marginRight: spaceS,
|
|
49
|
+
},
|
|
50
|
+
title: {
|
|
51
|
+
marginBottom: spaceM,
|
|
52
|
+
textAlign: "center",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
export { style };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
content: {
|
|
3
|
+
paddingHorizontal: number;
|
|
4
|
+
};
|
|
5
|
+
feedbackContainer: {
|
|
6
|
+
borderTopColor: string;
|
|
7
|
+
borderTopWidth: number;
|
|
8
|
+
marginVertical: number;
|
|
9
|
+
};
|
|
10
|
+
sliderContainer: {
|
|
11
|
+
marginBottom: number;
|
|
12
|
+
minHeight: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export { style };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../theme/theme";
|
|
3
|
+
const { borderSize, colorGrayscaleM, spaceXL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
content: {
|
|
6
|
+
paddingHorizontal: spaceXL,
|
|
7
|
+
},
|
|
8
|
+
feedbackContainer: {
|
|
9
|
+
borderTopColor: colorGrayscaleM,
|
|
10
|
+
borderTopWidth: borderSize,
|
|
11
|
+
marginVertical: spaceXL,
|
|
12
|
+
},
|
|
13
|
+
sliderContainer: {
|
|
14
|
+
marginBottom: spaceXL,
|
|
15
|
+
minHeight: 500,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export { style };
|