@lookiero/checkout 3.7.0-beta.0 → 3.7.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/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +1 -1
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +0 -1
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +3 -3
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +0 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +1 -1
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -2
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +1 -1
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +2 -2
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.js +1 -1
- package/dist/shared/ui/components/atoms/input/Input.js +2 -2
- package/dist/shared/ui/components/layouts/modal/Modal.js +1 -1
- package/dist/shared/ui/components/molecules/selectField/SelectField.js +3 -3
- package/package.json +1 -1
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +0 -6
- package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +0 -13
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +0 -7
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +0 -9
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +0 -13
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +0 -19
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.d.ts +0 -6
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.ts.js +0 -7
- package/dist/infrastructure/ui/components/templates/header/header/Header.d.ts +0 -3
- package/dist/infrastructure/ui/components/templates/header/header/Header.js +0 -10
- package/dist/infrastructure/ui/components/templates/header/header/Header.style.d.ts +0 -9
- package/dist/infrastructure/ui/components/templates/header/header/Header.style.js +0 -12
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts +0 -13
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js +0 -19
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.d.ts +0 -6
- package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.style.ts.js +0 -7
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +0 -2
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +0 -28
- package/dist/infrastructure/ui/hooks/useToast.d.ts +0 -11
- package/dist/infrastructure/ui/hooks/useToast.js +0 -49
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +0 -7
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +0 -25
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +0 -16
- package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +0 -19
- package/dist/infrastructure/ui/views/intro/Intro.d.ts +0 -6
- package/dist/infrastructure/ui/views/intro/Intro.js +0 -52
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -52
- package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -55
- package/dist/infrastructure/ui/views/item/Item.style.d.ts +0 -15
- package/dist/infrastructure/ui/views/item/Item.style.js +0 -18
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +0 -26
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +0 -44
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +0 -45
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +0 -53
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +0 -7
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +0 -25
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +0 -16
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +0 -19
- package/dist/infrastructure/ui/views/navigation/Navigation.d.ts +0 -21
- package/dist/infrastructure/ui/views/navigation/Navigation.js +0 -45
- package/dist/infrastructure/ui/views/navigation/Navigation.style.d.ts +0 -5
- package/dist/infrastructure/ui/views/navigation/Navigation.style.js +0 -30
- package/dist/infrastructure/ui/views/navigation/components/header/Header.d.ts +0 -46
- package/dist/infrastructure/ui/views/navigation/components/header/Header.js +0 -120
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.d.ts +0 -31
- package/dist/infrastructure/ui/views/navigation/components/header/Header.style.js +0 -34
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.d.ts +0 -7
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.js +0 -11
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.d.ts +0 -7
- package/dist/infrastructure/ui/views/navigation/components/header/Logo.style.js +0 -8
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +0 -12
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +0 -24
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +0 -15
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +0 -18
- package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +0 -17
- package/dist/shared/notifications/domain/notification/command/createNotification.js +0 -7
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +0 -21
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +0 -22
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +0 -12
- package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +0 -24
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +0 -9
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +0 -20
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +0 -36
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +0 -31
- package/dist/shared/tracking/infrastructure/usePageView.d.ts +0 -13
- package/dist/shared/tracking/infrastructure/usePageView.js +0 -27
- package/dist/shared/ui/components/atoms/error/Error.style.d.ts +0 -6
- package/dist/shared/ui/components/atoms/error/Error.style.js +0 -9
- package/dist/shared/ui/components/layouts/slider/Pagination.d.ts +0 -14
- package/dist/shared/ui/components/layouts/slider/Pagination.js +0 -11
- package/dist/shared/ui/components/layouts/slider/Pagination.style.d.ts +0 -23
- package/dist/shared/ui/components/layouts/slider/Pagination.style.js +0 -27
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
|
2
2
|
import { useCheckoutQuestionItem } from "./behaviors/useCheckoutQuestionItem";
|
|
3
3
|
const CheckoutQuestion = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
4
4
|
const Item = useCheckoutQuestionItem({ type: checkoutQuestion.type });
|
|
5
|
-
return (React.createElement(Item, { checkoutQuestion: checkoutQuestion, checkoutQuestionParentId: checkoutQuestionParentId
|
|
5
|
+
return (React.createElement(Item, { checkoutQuestion: checkoutQuestion, checkoutQuestionParentId: checkoutQuestionParentId },
|
|
6
6
|
React.createElement(React.Fragment, null, checkoutQuestion.children?.map((childCheckoutQuestion) => (React.createElement(CheckoutQuestion, { key: childCheckoutQuestion.id, checkoutQuestion: childCheckoutQuestion, checkoutQuestionParentId: checkoutQuestion.id }))))));
|
|
7
7
|
};
|
|
8
8
|
export default memo(CheckoutQuestion);
|
|
@@ -5,7 +5,6 @@ interface CheckoutQuestionItemProps {
|
|
|
5
5
|
readonly checkoutQuestionParentId: string;
|
|
6
6
|
readonly children?: ReactNode;
|
|
7
7
|
readonly portalHostName?: string;
|
|
8
|
-
readonly testID: string;
|
|
9
8
|
}
|
|
10
9
|
type CheckoutQuestionItem = FC<CheckoutQuestionItemProps>;
|
|
11
10
|
export type { CheckoutQuestionItem, CheckoutQuestionItemProps };
|
|
@@ -5,10 +5,10 @@ import { theme } from "../../../../../theme/theme";
|
|
|
5
5
|
import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
|
|
6
6
|
import { style } from "./ButtonCheckoutQuestionItem.style";
|
|
7
7
|
const { colorAccent, colorBase } = theme();
|
|
8
|
-
const ButtonCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId,
|
|
8
|
+
const ButtonCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
9
9
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
10
10
|
const optionText = useI18nMessage({ id: checkoutQuestion.name });
|
|
11
11
|
const handleOnPress = useCallback(() => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }), [onChange, checkoutQuestion.id, checkoutQuestionParentId]);
|
|
12
|
-
return (React.createElement(Button, {
|
|
12
|
+
return (React.createElement(Button, { style: [style.button, { backgroundColor: feedback === checkoutQuestion.id ? colorAccent : colorBase }], variant: BUTTON_VARIANT.SECONDARY, onPress: handleOnPress }, optionText));
|
|
13
13
|
};
|
|
14
14
|
export { ButtonCheckoutQuestionItem };
|
|
@@ -16,12 +16,12 @@ const ICON = {
|
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
17
|
"checkout_question.icon.good": Happy,
|
|
18
18
|
};
|
|
19
|
-
const IconCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId,
|
|
19
|
+
const IconCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
20
20
|
const Icon = ICON[checkoutQuestion.name];
|
|
21
21
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
22
22
|
const handleOnPress = useCallback(() => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }), [onChange, checkoutQuestion.id, checkoutQuestionParentId]);
|
|
23
23
|
invariant(Icon, "CheckoutQuestion icon does not exist");
|
|
24
|
-
return (React.createElement(Pressable, {
|
|
25
|
-
React.createElement(Icon, { fill: feedback === checkoutQuestion.id ? colorAccent : "none", style: style.icon })));
|
|
24
|
+
return (React.createElement(Pressable, { onPress: handleOnPress },
|
|
25
|
+
React.createElement(Icon, { fill: feedback === checkoutQuestion.id ? colorAccent : "none", style: style.icon, testID: checkoutQuestion.name })));
|
|
26
26
|
};
|
|
27
27
|
export { IconCheckoutQuestionItem };
|
|
@@ -3,11 +3,11 @@ import React, { useCallback, useMemo } from "react";
|
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
4
|
import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
|
|
5
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
6
|
-
const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId,
|
|
6
|
+
const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
7
7
|
const { formatMessage } = useIntl();
|
|
8
8
|
const placeholderText = useMemo(() => (checkoutQuestion.placeholder ? formatMessage({ id: checkoutQuestion.placeholder }) : ""), [formatMessage, checkoutQuestion.placeholder]);
|
|
9
9
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
10
10
|
const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
|
|
11
|
-
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText,
|
|
11
|
+
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
12
12
|
};
|
|
13
13
|
export { TextareaCheckoutQuestionItem };
|
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
|
2
2
|
import { useReturnQuestionItem } from "./behaviors/useReturnQuestionItem";
|
|
3
3
|
const ReturnQuestion = ({ returnQuestion, returnQuestionParentId, portalHostName, }) => {
|
|
4
4
|
const Item = useReturnQuestionItem({ type: returnQuestion.type });
|
|
5
|
-
return (React.createElement(Item, { portalHostName: portalHostName, returnQuestion: returnQuestion, returnQuestionParentId: returnQuestionParentId
|
|
5
|
+
return (React.createElement(Item, { portalHostName: portalHostName, returnQuestion: returnQuestion, returnQuestionParentId: returnQuestionParentId },
|
|
6
6
|
React.createElement(React.Fragment, null, returnQuestion.children?.map((childReturnQuestion) => (React.createElement(ReturnQuestion, { key: childReturnQuestion.id, portalHostName: portalHostName, returnQuestion: childReturnQuestion, returnQuestionParentId: returnQuestion.id }))))));
|
|
7
7
|
};
|
|
8
8
|
export default memo(ReturnQuestion);
|
|
@@ -5,7 +5,6 @@ interface ReturnQuestionItemProps {
|
|
|
5
5
|
readonly returnQuestionParentId: string;
|
|
6
6
|
readonly children?: ReactNode;
|
|
7
7
|
readonly portalHostName?: string;
|
|
8
|
-
readonly testID: string;
|
|
9
8
|
}
|
|
10
9
|
type ReturnQuestionItem = FC<ReturnQuestionItemProps>;
|
|
11
10
|
export type { ReturnQuestionItem, ReturnQuestionItemProps };
|
|
@@ -7,7 +7,7 @@ import { InputField } from "../../../../../../../shared/ui/components/molecules/
|
|
|
7
7
|
import { useReturnQuestionFeedback, useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
8
8
|
import { deepestReturnQuestionWithFeedbackForReturnQuestion, feedbackForReturnQuestion, } from "../../util/returnQuestionFeedback";
|
|
9
9
|
import { style, containerUnderlayColor } from "./HostSelectReturnQuestionItem.style";
|
|
10
|
-
const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName,
|
|
10
|
+
const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
|
|
11
11
|
const { formatMessage } = useIntl();
|
|
12
12
|
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
13
13
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -31,7 +31,7 @@ const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName
|
|
|
31
31
|
// deepestReturnQuestionWithFeedback needs to be as a dependency in order to be re-evaluated whenever it changes
|
|
32
32
|
}, [handleOnModalClose, deepestReturnQuestionWithFeedback, isLeaf]);
|
|
33
33
|
return (React.createElement(React.Fragment, null,
|
|
34
|
-
React.createElement(TouchableHighlight, {
|
|
34
|
+
React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
35
35
|
React.createElement(View, { pointerEvents: "none" },
|
|
36
36
|
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholderText, value: inputValue }))),
|
|
37
37
|
React.createElement(Modal, { portalHostName: portalHostName, visible: modalVisible, header: deepestReturnQuestionWithFeedback && (React.createElement(ButtonIcon, { name: "arrow-left", testID: "modal-back-button", onPress: handleOnBackButtonPress })), scroll: true, showCloseButton: true, onClose: handleOnModalClose },
|
|
@@ -4,11 +4,11 @@ import React, { useCallback } from "react";
|
|
|
4
4
|
import { TouchableHighlight } from "react-native";
|
|
5
5
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
6
6
|
import { containerUnderlayColor, style } from "./OptionReturnQuestionItem.style";
|
|
7
|
-
const OptionReturnQuestionItem = ({ returnQuestion, returnQuestionParentId,
|
|
7
|
+
const OptionReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
|
|
8
8
|
const { onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
|
|
9
9
|
const optionText = useI18nMessage({ id: returnQuestion.name });
|
|
10
10
|
const handleOnPress = useCallback(() => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: returnQuestion.id }), [onChange, returnQuestion.id, returnQuestionParentId]);
|
|
11
|
-
return (React.createElement(TouchableHighlight, {
|
|
11
|
+
return (React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
12
12
|
React.createElement(Text, { level: 3, style: style.text }, optionText)));
|
|
13
13
|
};
|
|
14
14
|
export { OptionReturnQuestionItem };
|
|
@@ -3,11 +3,11 @@ import React, { useCallback, useMemo } from "react";
|
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
4
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
5
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
6
|
-
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParentId,
|
|
6
|
+
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
|
|
7
7
|
const { formatMessage } = useIntl();
|
|
8
8
|
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
9
9
|
const { feedback, onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
|
|
10
10
|
const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: value }), [onChange, returnQuestionParentId]);
|
|
11
|
-
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText,
|
|
11
|
+
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
12
12
|
};
|
|
13
13
|
export { TextareaReturnQuestionItem };
|
|
@@ -32,6 +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, style: style.button,
|
|
35
|
+
React.createElement(Button, { busy: submitButtonDisabled, style: style.button, onPress: handlePress }, buttonText)));
|
|
36
36
|
};
|
|
37
37
|
export { CheckoutQuestionsForm };
|
|
@@ -20,7 +20,7 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onSizeSe
|
|
|
20
20
|
(sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === currentProductVariant.id), [sizeSelectorOptions, currentProductVariant.id]);
|
|
21
21
|
return (React.createElement(Sticky, { onLayout: onLayout },
|
|
22
22
|
React.createElement(Body, { style: { column: style.container } },
|
|
23
|
-
React.createElement(Button, {
|
|
23
|
+
React.createElement(Button, { onPress: onKeep }, keepButtonText),
|
|
24
24
|
React.createElement(View, { style: style.row },
|
|
25
25
|
!currentProductVariant.size.unique && productVariants && (React.createElement(SelectField, { ...(disabledSizeSelector && {
|
|
26
26
|
onPress: onSizeSelectorPress,
|
|
@@ -29,7 +29,7 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onSizeSe
|
|
|
29
29
|
inputField: { input: disabledSizeSelector && style.inputDisabled },
|
|
30
30
|
}, onChange: onReplace })),
|
|
31
31
|
React.createElement(View, { style: style.returnButtonContainer },
|
|
32
|
-
React.createElement(Button, {
|
|
32
|
+
React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn },
|
|
33
33
|
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, returnButtonText)))))));
|
|
34
34
|
};
|
|
35
35
|
export { ItemActions };
|
package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js
CHANGED
|
@@ -35,7 +35,7 @@ const ReturnQuestionsForm = ({ returnQuestions, visible, onSubmit, onClose }) =>
|
|
|
35
35
|
React.createElement(View, { style: style.returnQuestionsContainer },
|
|
36
36
|
React.createElement(Text, { level: 2, style: style.title }, titleText),
|
|
37
37
|
React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }),
|
|
38
|
-
React.createElement(Button, { style: style.submit,
|
|
38
|
+
React.createElement(Button, { style: style.submit, onPress: handleOnSubmit },
|
|
39
39
|
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, submitButtonText))))));
|
|
40
40
|
};
|
|
41
41
|
export { ReturnQuestionsForm };
|
|
@@ -40,7 +40,7 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
|
|
|
40
40
|
totalCheckoutItemsKeptText),
|
|
41
41
|
React.createElement(Price, { price: pendingToPay, variant: "detail" })),
|
|
42
42
|
React.createElement(View, { style: style.collapsedContent },
|
|
43
|
-
React.createElement(Button, { busy: busy,
|
|
43
|
+
React.createElement(Button, { busy: busy, small: true, onPress: onSubmit },
|
|
44
44
|
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, submitButtonText))))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
|
|
45
45
|
React.createElement(Row, { text: `${subtotalText} ${totalCheckoutItemsKeptText}` },
|
|
46
46
|
React.createElement(Price, { price: subtotal, variant: "subtotal" })),
|
|
@@ -52,6 +52,6 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
|
|
|
52
52
|
React.createElement(View, { style: style.divider }),
|
|
53
53
|
React.createElement(Row, { level: 2, text: totalText },
|
|
54
54
|
React.createElement(Price, { price: pendingToPay, variant: "total" })),
|
|
55
|
-
React.createElement(Button, { busy: busy,
|
|
55
|
+
React.createElement(Button, { busy: busy, onPress: onSubmit }, submitButtonText)))));
|
|
56
56
|
};
|
|
57
57
|
export { Pricing };
|
|
@@ -26,7 +26,7 @@ const ModalNotificationItem = ({ visible, notification, onRemove, testID = "moda
|
|
|
26
26
|
React.createElement(View, { style: style.modal },
|
|
27
27
|
React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
|
|
28
28
|
React.createElement(Text, { level: 3, style: style.description }, bodyText),
|
|
29
|
-
React.createElement(Button, { style: style.button,
|
|
29
|
+
React.createElement(Button, { style: style.button, onPress: handleOnClose },
|
|
30
30
|
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, acceptText)))));
|
|
31
31
|
};
|
|
32
32
|
export { ModalNotificationItem };
|
|
@@ -6,7 +6,7 @@ const MIN_HEIGHT = 56;
|
|
|
6
6
|
const MAX_HEIGHT = 242; // 10 lines
|
|
7
7
|
const { colorGrayscaleL } = theme();
|
|
8
8
|
const clamp = (min, max, value) => Math.min(Math.max(min, value), max);
|
|
9
|
-
const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline,
|
|
9
|
+
const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline, ...restOfProps }) => {
|
|
10
10
|
const [height, setHeight] = useState(minHeight);
|
|
11
11
|
// When content height has became smaller the onContentSizeChange does in fact triggered but the internal height is incorrect.
|
|
12
12
|
const handleOnContentSizeChange = useCallback((event) => {
|
|
@@ -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, { ref: textInputRef,
|
|
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 }));
|
|
36
36
|
};
|
|
37
37
|
export { Input };
|
|
@@ -75,7 +75,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
|
|
|
75
75
|
(header || showCloseButton) && (React.createElement(View, { style: [style.header, customStyle?.header] },
|
|
76
76
|
React.createElement(View, null, header),
|
|
77
77
|
showCloseButton && (React.createElement(ButtonIcon, { name: "close", style: { button: customStyle?.closeButton }, onPress: onClose })))),
|
|
78
|
-
React.createElement(ModalContentView,
|
|
78
|
+
React.createElement(ModalContentView, null,
|
|
79
79
|
React.createElement(View, { style: {
|
|
80
80
|
paddingBottom: safeAreaInsetBottom +
|
|
81
81
|
(Platform.OS !== "ios" ? spaceXL : 0) +
|
|
@@ -6,7 +6,7 @@ import { Modal } from "../../layouts/modal/Modal";
|
|
|
6
6
|
import { InputField } from "../inputField/InputField";
|
|
7
7
|
import { style } from "./SelectField.style";
|
|
8
8
|
const { colorGrayscaleS } = theme();
|
|
9
|
-
const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0,
|
|
9
|
+
const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
|
|
10
10
|
const [modalVisible, setModalVisible] = useState(false);
|
|
11
11
|
const handleOnPressSelectField = useCallback(() => setModalVisible(true), []);
|
|
12
12
|
const handleOnModalClose = useCallback(() => setModalVisible(false), []);
|
|
@@ -16,13 +16,13 @@ const SelectField = ({ title, placeholder, value, options, style: customStyle, o
|
|
|
16
16
|
}, [handleOnModalClose, onChange]);
|
|
17
17
|
const selectedValue = useMemo(() => options.find((option) => option.value === value), [options, value]);
|
|
18
18
|
return (React.createElement(React.Fragment, null,
|
|
19
|
-
React.createElement(TouchableHighlight, {
|
|
19
|
+
React.createElement(TouchableHighlight, { style: customStyle?.selectField, underlayColor: colorGrayscaleS, onPress: handleOnPressSelectField, ...touchableRestProps },
|
|
20
20
|
React.createElement(View, { pointerEvents: "none" },
|
|
21
21
|
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholder, style: customStyle?.inputField, value: selectedValue?.label }))),
|
|
22
22
|
React.createElement(Modal, { testID: "select-field-modal", visible: modalVisible, scroll: true, showCloseButton: true, onClose: handleOnModalClose },
|
|
23
23
|
React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] },
|
|
24
24
|
title && (React.createElement(Text, { level: 2, style: style.modalTitle }, title)),
|
|
25
|
-
options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue,
|
|
25
|
+
options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
|
|
26
26
|
React.createElement(Text, { color: value === optionValue ? COLOR.GRAYSCALE_M : COLOR.CONTENT, level: 3, style: [style.optionText, customStyle?.optionText] }, label))))))));
|
|
27
27
|
};
|
|
28
28
|
export { SelectField };
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ProcessManagerFunction } from "@lookiero/messaging";
|
|
2
|
-
import { CheckoutBookingExpired } from "../model/checkoutBookingExpired";
|
|
3
|
-
interface CreateNotificationWhenCheckoutBookingExpiredFunction extends ProcessManagerFunction<CheckoutBookingExpired> {
|
|
4
|
-
}
|
|
5
|
-
declare const createNotificationWhenCheckoutBookingExpired: CreateNotificationWhenCheckoutBookingExpiredFunction;
|
|
6
|
-
export { createNotificationWhenCheckoutBookingExpired };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
import { I18nMessages } from "../../../infrastructure/ui/i18n/i18n";
|
|
3
|
-
import { createNotification } from "../../../shared/notifications/domain/notification/command/createNotification";
|
|
4
|
-
import { NotificationLevel } from "../../../shared/notifications/domain/notification/model/notification";
|
|
5
|
-
const createNotificationWhenCheckoutBookingExpired = ({ commandBus }) => async () => {
|
|
6
|
-
await commandBus(createNotification({
|
|
7
|
-
aggregateId: uuid(),
|
|
8
|
-
level: NotificationLevel.ERROR,
|
|
9
|
-
titleI18nKey: undefined,
|
|
10
|
-
bodyI18nKey: I18nMessages.CHECKOUT_TOAST_BOOKING_EXPIRED,
|
|
11
|
-
}));
|
|
12
|
-
};
|
|
13
|
-
export { createNotificationWhenCheckoutBookingExpired };
|
|
@@ -1,10 +0,0 @@
|
|
|
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 };
|
|
@@ -1,11 +0,0 @@
|
|
|
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 };
|
|
@@ -1,7 +0,0 @@
|
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
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,13 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
import { Edge } from "react-native-safe-area-context";
|
|
4
|
-
type SafeAreaScrollViewStyle = "safeAreaView" | "scrollView";
|
|
5
|
-
interface SafeAreaScrollViewProps {
|
|
6
|
-
readonly children: ReactNode;
|
|
7
|
-
readonly footer?: ReactNode;
|
|
8
|
-
readonly scrollerPaddingTop?: number;
|
|
9
|
-
readonly edges?: Edge[];
|
|
10
|
-
readonly style?: Partial<Record<SafeAreaScrollViewStyle, StyleProp<ViewStyle>>>;
|
|
11
|
-
}
|
|
12
|
-
declare const SafeAreaScrollView: FC<SafeAreaScrollViewProps>;
|
|
13
|
-
export { SafeAreaScrollView };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ScrollView } from "react-native";
|
|
3
|
-
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
-
import { theme } from "../../theme/theme";
|
|
5
|
-
import { style } from "./SafeAreaScrollView.style.ts";
|
|
6
|
-
const { spaceXXL } = theme();
|
|
7
|
-
const SafeAreaScrollView = ({ children, footer, edges = ["top", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
|
|
8
|
-
const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
9
|
-
return (React.createElement(SafeAreaView, { edges: edges, style: [style.safeAreaView, customStyle?.safeAreaView] },
|
|
10
|
-
React.createElement(ScrollView, { contentContainerStyle: [
|
|
11
|
-
{
|
|
12
|
-
paddingTop: scrollerPaddingTop,
|
|
13
|
-
paddingBottom: safeAreaInsetBottom + spaceXXL,
|
|
14
|
-
},
|
|
15
|
-
customStyle?.scrollView,
|
|
16
|
-
] }, children),
|
|
17
|
-
footer));
|
|
18
|
-
};
|
|
19
|
-
export { SafeAreaScrollView };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
3
|
-
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
4
|
-
import { Logo } from "../logo/Logo";
|
|
5
|
-
import { style } from "./Header.style";
|
|
6
|
-
const Header = () => (React.createElement(React.Fragment, null,
|
|
7
|
-
React.createElement(Logo, { style: style.logo }),
|
|
8
|
-
React.createElement(ButtonIconPlaceholder, null),
|
|
9
|
-
React.createElement(ButtonIcon, { name: "menu", testID: "menu-button-icon", onPress: () => void 0 })));
|
|
10
|
-
export { Header };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { spaceXXXL } = theme();
|
|
4
|
-
const HEADER_HEIGHT = spaceXXXL;
|
|
5
|
-
const style = StyleSheet.create({
|
|
6
|
-
logo: {
|
|
7
|
-
left: 0,
|
|
8
|
-
position: "absolute",
|
|
9
|
-
top: 0,
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
export { style, HEADER_HEIGHT };
|
package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
import { Edge } from "react-native-safe-area-context";
|
|
4
|
-
type SafeAreaScrollViewStyle = "safeAreaView" | "scrollView";
|
|
5
|
-
interface SafeAreaScrollViewProps {
|
|
6
|
-
readonly children: ReactNode;
|
|
7
|
-
readonly footer?: ReactNode;
|
|
8
|
-
readonly scrollerPaddingTop?: number;
|
|
9
|
-
readonly edges?: Edge[];
|
|
10
|
-
readonly style?: Partial<Record<SafeAreaScrollViewStyle, StyleProp<ViewStyle>>>;
|
|
11
|
-
}
|
|
12
|
-
declare const SafeAreaScrollView: FC<SafeAreaScrollViewProps>;
|
|
13
|
-
export { SafeAreaScrollView };
|
package/dist/infrastructure/ui/components/templates/safeAreaScrollView/SafeAreaScrollView.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ScrollView } from "react-native";
|
|
3
|
-
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
-
import { theme } from "../../../theme/theme.js";
|
|
5
|
-
import { style } from "./SafeAreaScrollView.style.ts";
|
|
6
|
-
const { spaceXXL } = theme();
|
|
7
|
-
const SafeAreaScrollView = ({ children, footer, edges = ["top", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
|
|
8
|
-
const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
9
|
-
return (React.createElement(SafeAreaView, { edges: edges, style: [style.safeAreaView, customStyle?.safeAreaView] },
|
|
10
|
-
React.createElement(ScrollView, { contentContainerStyle: [
|
|
11
|
-
{
|
|
12
|
-
paddingTop: scrollerPaddingTop,
|
|
13
|
-
paddingBottom: safeAreaInsetBottom + spaceXXL,
|
|
14
|
-
},
|
|
15
|
-
customStyle?.scrollView,
|
|
16
|
-
] }, children),
|
|
17
|
-
footer));
|
|
18
|
-
};
|
|
19
|
-
export { SafeAreaScrollView };
|
|
@@ -1,28 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
1
|
-
interface ShowErrorFunctionArgs {
|
|
2
|
-
readonly message: string;
|
|
3
|
-
}
|
|
4
|
-
interface ShowErrorFunction {
|
|
5
|
-
(args: ShowErrorFunctionArgs): void;
|
|
6
|
-
}
|
|
7
|
-
declare const useToast: () => {
|
|
8
|
-
showError: ShowErrorFunction;
|
|
9
|
-
showSuccess: ShowErrorFunction;
|
|
10
|
-
};
|
|
11
|
-
export { useToast };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Notification, useStack } from "@lookiero/aurora";
|
|
2
|
-
import { useIntl } from "@lookiero/i18n-react";
|
|
3
|
-
import { useCallback } from "react";
|
|
4
|
-
import { StyleSheet } from "react-native";
|
|
5
|
-
import { v4 as uuid } from "uuid";
|
|
6
|
-
import { theme } from "../theme/theme";
|
|
7
|
-
const { layoutXXS, elevationColor, elevationOffset, elevationOpacityM, elevationRadius } = theme();
|
|
8
|
-
const style = StyleSheet.create({
|
|
9
|
-
container: {
|
|
10
|
-
marginHorizontal: layoutXXS,
|
|
11
|
-
marginTop: layoutXXS,
|
|
12
|
-
shadowColor: elevationColor,
|
|
13
|
-
shadowOffset: elevationOffset,
|
|
14
|
-
shadowOpacity: elevationOpacityM,
|
|
15
|
-
shadowRadius: elevationRadius,
|
|
16
|
-
},
|
|
17
|
-
inAppContainer: {
|
|
18
|
-
top: 75,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
const NOTIFICATION_DEFAULTS = {
|
|
22
|
-
motion: "top",
|
|
23
|
-
timeoutClose: 10000,
|
|
24
|
-
style: style.container,
|
|
25
|
-
};
|
|
26
|
-
const IN_APP_NOTIFICATION_DEFAULTS = {
|
|
27
|
-
...NOTIFICATION_DEFAULTS,
|
|
28
|
-
style: [style.container, style.inAppContainer],
|
|
29
|
-
};
|
|
30
|
-
const iOSInAppBrowser = window.screen?.height > 667 && /FBIOS/.test(navigator.userAgent);
|
|
31
|
-
const getNotificationDefaults = () => (iOSInAppBrowser ? IN_APP_NOTIFICATION_DEFAULTS : NOTIFICATION_DEFAULTS);
|
|
32
|
-
const useToast = () => {
|
|
33
|
-
const Stack = useStack();
|
|
34
|
-
const intl = useIntl();
|
|
35
|
-
const translate = useCallback((message) => intl.formatMessage({ id: message, defaultMessage: message }), [intl]);
|
|
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]);
|
|
44
|
-
return {
|
|
45
|
-
showError,
|
|
46
|
-
showSuccess,
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export { useToast };
|