@lookiero/checkout 5.2.0-LK-34381-2024.5.14.94607 → 5.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/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.js +4 -0
- package/dist/infrastructure/ui/components/layouts/banner/Banner.d.ts +7 -0
- package/dist/infrastructure/ui/components/layouts/banner/Banner.js +8 -0
- package/dist/infrastructure/ui/components/layouts/banner/Banner.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/layouts/banner/Banner.style.js +12 -0
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.js +2 -0
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.style.d.ts +1 -1
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/icons/icon.d.ts +4 -0
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/icons/icon.js +1 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +15 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.d.ts +4 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.js +4 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.d.ts +3 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.js +27 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.style.d.ts +6 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.style.js +9 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +12 -2
- package/dist/infrastructure/ui/components/templates/header/Header.style.d.ts +1 -1
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.d.ts +7 -0
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.js +8 -0
- package/dist/infrastructure/ui/i18n/i18n.d.ts +1 -0
- package/dist/infrastructure/ui/i18n/i18n.js +1 -0
- package/dist/infrastructure/ui/theme/theme.d.ts +10 -0
- package/dist/infrastructure/ui/theme/theme.js +3 -0
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +3 -3
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +1 -1
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.d.ts +2 -2
- package/dist/infrastructure/ui/views/notFound/NotFound.d.ts +10 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.js +40 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.style.d.ts +17 -0
- package/dist/infrastructure/ui/views/notFound/NotFound.style.js +20 -0
- package/dist/infrastructure/ui/views/return/Return.js +30 -8
- package/dist/infrastructure/ui/views/return/Return.style.d.ts +12 -3
- package/dist/infrastructure/ui/views/return/Return.style.js +14 -5
- package/dist/infrastructure/ui/views/return/components/price/Price.d.ts +8 -0
- package/dist/infrastructure/ui/views/return/components/price/Price.js +25 -0
- package/dist/infrastructure/ui/views/return/components/price/Price.style.d.ts +16 -0
- package/dist/infrastructure/ui/views/return/components/price/Price.style.js +19 -0
- package/dist/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.d.ts +9 -0
- package/dist/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +37 -0
- package/dist/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.style.d.ts +31 -0
- package/dist/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.style.js +34 -0
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.d.ts +6 -0
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +15 -0
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.d.ts +9 -0
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +12 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowDown.d.ts +4 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowDown.js +5 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowUp.d.ts +4 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowUp.js +5 -0
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +6 -0
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +9 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts +2 -2
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotifications.style.d.ts +3 -3
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotifications.style.d.ts +67 -58
- package/dist/shared/ui/components/atoms/field/Field.js +2 -0
- package/dist/shared/ui/components/atoms/field/Field.style.d.ts +2 -2
- package/dist/shared/ui/components/atoms/icon/Icon.d.ts +14 -0
- package/dist/shared/ui/components/atoms/icon/Icon.js +4 -0
- package/dist/shared/ui/components/atoms/icon/Icon.style.d.ts +13 -0
- package/dist/shared/ui/components/atoms/icon/Icon.style.js +16 -0
- package/dist/shared/ui/components/atoms/input/Input.d.ts +11 -0
- package/dist/shared/ui/components/atoms/input/Input.js +37 -0
- package/dist/shared/ui/components/atoms/input/Input.style.d.ts +21 -0
- package/dist/shared/ui/components/atoms/input/Input.style.js +28 -0
- package/dist/shared/ui/components/layouts/carousel/Carousel.style.d.ts +2 -2
- package/dist/shared/ui/components/layouts/column/Column.style.d.ts +1 -1
- package/dist/shared/ui/components/layouts/modal/Modal.js +11 -1
- package/dist/shared/ui/components/layouts/modal/Modal.style.d.ts +71 -62
- package/dist/shared/ui/components/layouts/row/Row.style.d.ts +2 -2
- package/dist/shared/ui/components/layouts/stack/Stack.style.d.ts +2 -2
- package/dist/shared/ui/components/layouts/sticky/Sticky.style.d.ts +68 -59
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.d.ts +16 -0
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.js +7 -0
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.style.d.ts +8 -0
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.style.js +11 -0
- package/dist/shared/ui/components/molecules/inputField/InputField.style.d.ts +1 -1
- package/dist/shared/ui/components/molecules/selectField/SelectField.d.ts +27 -0
- package/dist/shared/ui/components/molecules/selectField/SelectField.js +28 -0
- package/dist/shared/ui/components/molecules/selectField/SelectField.style.d.ts +19 -0
- package/dist/shared/ui/components/molecules/selectField/SelectField.style.js +22 -0
- package/dist/shared/ui/components/molecules/toast/Toast.d.ts +25 -0
- package/dist/shared/ui/components/molecules/toast/Toast.js +22 -0
- package/dist/shared/ui/components/molecules/toast/Toast.style.d.ts +34 -0
- package/dist/shared/ui/components/molecules/toast/Toast.style.js +34 -0
- package/package.json +13 -13
|
@@ -11,6 +11,10 @@ const useReturnCheckoutItem = ({ checkoutItemId, logger }) => {
|
|
|
11
11
|
const returnCheckoutItem = useCallback(async ({ feedbacks }) => {
|
|
12
12
|
try {
|
|
13
13
|
await commandBus(returnCheckoutItemCommand({ aggregateId: checkoutItemId, feedbacks }));
|
|
14
|
+
createNotification({
|
|
15
|
+
bodyI18nKey: I18nMessages.RETURN_QUESTION_TOAST_SUCCESS,
|
|
16
|
+
level: NotificationLevel.SUCCESS,
|
|
17
|
+
});
|
|
14
18
|
}
|
|
15
19
|
catch (error) {
|
|
16
20
|
logger.captureException(error);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ALIGN, Text } from "@lookiero/aurora";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { style } from "./Banner.style";
|
|
5
|
+
const Banner = ({ children, text }) => (React.createElement(View, { style: style.container },
|
|
6
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 2, detail: true }, text),
|
|
7
|
+
children));
|
|
8
|
+
export { Banner };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../theme/theme";
|
|
3
|
+
const { colorInfo, spaceM, spaceL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
backgroundColor: colorInfo,
|
|
8
|
+
paddingHorizontal: spaceL,
|
|
9
|
+
paddingVertical: spaceM,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export { style };
|
|
@@ -29,6 +29,8 @@ const TabList = ({ labels = [], tabIndex = 0, style: customStyle, onSelect }) =>
|
|
|
29
29
|
width: springs.width,
|
|
30
30
|
transform: [{ translateX: springs.left }],
|
|
31
31
|
},
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
|
+
// @ts-ignore
|
|
32
34
|
customStyle?.indicator,
|
|
33
35
|
] })));
|
|
34
36
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import { Text, View } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { useAssignedVariationByExperimentId } from "../../../../../../testing/react/useAssignedVariationByExperimentId";
|
|
5
|
+
import { useStaticInfo } from "../../../../../hooks/useStaticInfo";
|
|
4
6
|
import { I18nMessages } from "../../../../../i18n/i18n";
|
|
5
7
|
import { style } from "./HostDefaultReturnQuestionItem.style";
|
|
6
8
|
const HostDefaultReturnQuestionItem = ({ returnQuestion, children }) => {
|
|
7
9
|
const titleText = useI18nMessage({ id: returnQuestion.name });
|
|
8
10
|
const isAllOptions = returnQuestion.name === I18nMessages.RETURN_QUESTION_MAIN_ALL_OPINION;
|
|
11
|
+
/* Kameleoon experiment */
|
|
12
|
+
const { kameleoon } = useStaticInfo();
|
|
13
|
+
const { experiments: { newFeedback: { id: newFeedbackId = "", variations = {} } = {} }, } = kameleoon;
|
|
14
|
+
const { assignedVariation: newFeedbackVariation } = useAssignedVariationByExperimentId({
|
|
15
|
+
experimentId: newFeedbackId,
|
|
16
|
+
});
|
|
17
|
+
const isReturnPage = newFeedbackVariation?.id === Number(variations.v2);
|
|
18
|
+
/* Kameleoon experiment */
|
|
9
19
|
return (React.createElement(React.Fragment, null,
|
|
10
|
-
titleText && titleText !== " " ? (React.createElement(View, { style: [
|
|
20
|
+
titleText && titleText !== " " ? (React.createElement(View, { style: [
|
|
21
|
+
style.title,
|
|
22
|
+
isAllOptions ? style.allOptionsTitle : undefined,
|
|
23
|
+
isReturnPage ? style.formTitle : undefined,
|
|
24
|
+
] },
|
|
11
25
|
React.createElement(Text, { level: 3, action: true }, titleText))) : null,
|
|
12
26
|
children));
|
|
13
27
|
};
|
|
@@ -2,10 +2,13 @@ declare const style: {
|
|
|
2
2
|
allOptionsTitle: {
|
|
3
3
|
display: "none";
|
|
4
4
|
};
|
|
5
|
+
formTitle: {
|
|
6
|
+
paddingLeft: number;
|
|
7
|
+
};
|
|
5
8
|
title: {
|
|
6
9
|
backgroundColor: string;
|
|
7
10
|
paddingBottom: number;
|
|
8
|
-
|
|
11
|
+
paddingRight: number;
|
|
9
12
|
paddingTop: number;
|
|
10
13
|
};
|
|
11
14
|
};
|
|
@@ -5,10 +5,13 @@ const style = StyleSheet.create({
|
|
|
5
5
|
allOptionsTitle: {
|
|
6
6
|
display: "none",
|
|
7
7
|
},
|
|
8
|
+
formTitle: {
|
|
9
|
+
paddingLeft: space6,
|
|
10
|
+
},
|
|
8
11
|
title: {
|
|
9
12
|
backgroundColor: colorBgBase,
|
|
10
13
|
paddingBottom: space4,
|
|
11
|
-
|
|
14
|
+
paddingRight: space6,
|
|
12
15
|
paddingTop: space6,
|
|
13
16
|
},
|
|
14
17
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { COLOR, Text } from "@lookiero/aurora";
|
|
2
|
+
import { useIntl } from "@lookiero/i18n-react";
|
|
3
|
+
import { animated, useSpring } from "@react-spring/native";
|
|
4
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
5
|
+
import { View } from "react-native";
|
|
6
|
+
import ReturnQuestion from "../../ReturnQuestion";
|
|
7
|
+
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
8
|
+
import { style } from "./HostStackReturnQuestionItem.style";
|
|
9
|
+
const HostStackReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
const { feedback } = useReturnQuestionFeedbackForId({ id: returnQuestion.id });
|
|
12
|
+
const feedbackReturnQuestion = feedback
|
|
13
|
+
? returnQuestion.children?.find((returnQuestion) => returnQuestion.id === feedback)
|
|
14
|
+
: undefined;
|
|
15
|
+
const titleText = useMemo(() => (returnQuestion.name ? formatMessage({ id: returnQuestion.name }) : undefined), [formatMessage, returnQuestion.name]);
|
|
16
|
+
const feedbackText = useMemo(() => (feedbackReturnQuestion ? formatMessage({ id: feedbackReturnQuestion.name }) : undefined), [feedbackReturnQuestion, formatMessage]);
|
|
17
|
+
const [stackHeight, setStackHeight] = useState();
|
|
18
|
+
const handleOnLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => setStackHeight(height), []);
|
|
19
|
+
const stackSyle = useSpring({ height: stackHeight });
|
|
20
|
+
return (React.createElement(animated.View, { style: stackSyle },
|
|
21
|
+
React.createElement(View, { onLayout: handleOnLayout },
|
|
22
|
+
titleText && (React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText)),
|
|
23
|
+
feedbackReturnQuestion ? (React.createElement(React.Fragment, null,
|
|
24
|
+
React.createElement(Text, { color: COLOR.TEXT_MEDIUM, level: 3 }, feedbackText),
|
|
25
|
+
feedbackReturnQuestion.children?.map((childReturnQuestion) => (React.createElement(ReturnQuestion, { key: childReturnQuestion.id, portalHostName: portalHostName, returnQuestion: childReturnQuestion, returnQuestionParentId: feedbackReturnQuestion.id }))))) : (children))));
|
|
26
|
+
};
|
|
27
|
+
export { HostStackReturnQuestionItem };
|
|
@@ -2,14 +2,24 @@ import { View } from "@lookiero/aurora";
|
|
|
2
2
|
import { useIntl } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback, useMemo } from "react";
|
|
4
4
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
5
|
+
import { useAssignedVariationByExperimentId } from "../../../../../../testing/react/useAssignedVariationByExperimentId";
|
|
6
|
+
import { useStaticInfo } from "../../../../../hooks/useStaticInfo";
|
|
5
7
|
import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
|
|
6
8
|
import { style } from "./TextareaReturnQuestionItem.style";
|
|
7
9
|
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParent, testID, }) => {
|
|
8
10
|
const { formatMessage } = useIntl();
|
|
11
|
+
/* Kameleoon experiment */
|
|
12
|
+
const { kameleoon } = useStaticInfo();
|
|
13
|
+
const { experiments: { newFeedback: { id: newFeedbackId = "", variations = {} } = {} }, } = kameleoon;
|
|
14
|
+
const { assignedVariation: newFeedbackVariation } = useAssignedVariationByExperimentId({
|
|
15
|
+
experimentId: newFeedbackId,
|
|
16
|
+
});
|
|
17
|
+
const isReturnPage = newFeedbackVariation?.id === Number(variations.v2);
|
|
18
|
+
/* Kameleoon experiment */
|
|
9
19
|
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
10
20
|
const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
|
|
11
21
|
const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: value }), [onChange, returnQuestionParent.id]);
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
const fieldComponent = (React.createElement(InputField, { label: placeholderText, placeholder: placeholderText, testID: testID, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
23
|
+
return isReturnPage ? React.createElement(View, { style: style.wrapper }, fieldComponent) : fieldComponent;
|
|
14
24
|
};
|
|
15
25
|
export { TextareaReturnQuestionItem };
|
package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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 };
|
|
@@ -26,6 +26,7 @@ declare enum I18nMessages {
|
|
|
26
26
|
RETURN_QUESTIONS_DESCRIPTION = "return_questions.description",
|
|
27
27
|
RETURN_QUESTIONS_SUBMIT_BUTTON = "return_questions.submit_button",
|
|
28
28
|
RETURN_QUESTION_MAIN_ALL_OPINION = "return_question.main.all.opinion",
|
|
29
|
+
RETURN_QUESTION_TOAST_SUCCESS = "return_question.thankyou",
|
|
29
30
|
SUMMARY_TITLE = "summary.title",
|
|
30
31
|
SUMMARY_DESCRIPTION = "summary.description",
|
|
31
32
|
BANNER_DISCOUNT_TEXT = "summary.banner.text",
|
|
@@ -28,6 +28,7 @@ var I18nMessages;
|
|
|
28
28
|
I18nMessages["RETURN_QUESTIONS_DESCRIPTION"] = "return_questions.description";
|
|
29
29
|
I18nMessages["RETURN_QUESTIONS_SUBMIT_BUTTON"] = "return_questions.submit_button";
|
|
30
30
|
I18nMessages["RETURN_QUESTION_MAIN_ALL_OPINION"] = "return_question.main.all.opinion";
|
|
31
|
+
I18nMessages["RETURN_QUESTION_TOAST_SUCCESS"] = "return_question.thankyou";
|
|
31
32
|
I18nMessages["SUMMARY_TITLE"] = "summary.title";
|
|
32
33
|
I18nMessages["SUMMARY_DESCRIPTION"] = "summary.description";
|
|
33
34
|
I18nMessages["BANNER_DISCOUNT_TEXT"] = "summary.banner.text";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DefaultTheme } from "@lookiero/aurora";
|
|
2
|
+
type Remove$PrefixFromKeys<T> = {
|
|
3
|
+
[K in keyof T as K extends `$${infer F}` ? F : K]: T[K];
|
|
4
|
+
};
|
|
5
|
+
type AuroraTheme = Remove$PrefixFromKeys<typeof DefaultTheme>;
|
|
6
|
+
interface ThemeFunction {
|
|
7
|
+
(): AuroraTheme;
|
|
8
|
+
}
|
|
9
|
+
declare const theme: ThemeFunction;
|
|
10
|
+
export { theme };
|
|
@@ -3,20 +3,20 @@ declare const style: {
|
|
|
3
3
|
flex: number;
|
|
4
4
|
};
|
|
5
5
|
buttonText: {
|
|
6
|
-
width:
|
|
6
|
+
width: "100%";
|
|
7
7
|
};
|
|
8
8
|
confirmButton: {
|
|
9
9
|
marginTop: number;
|
|
10
10
|
};
|
|
11
11
|
description: {
|
|
12
12
|
marginVertical: number;
|
|
13
|
-
width:
|
|
13
|
+
width: "100%";
|
|
14
14
|
};
|
|
15
15
|
modal: {
|
|
16
16
|
padding: number;
|
|
17
17
|
};
|
|
18
18
|
title: {
|
|
19
|
-
width:
|
|
19
|
+
width: "100%";
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export { style };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Country } from "../../../../projection/shared/country";
|
|
3
|
+
import { Layout } from "../../components/layouts/layout/Layout";
|
|
4
|
+
interface NotFoundProps {
|
|
5
|
+
readonly customerId: string;
|
|
6
|
+
readonly country: Country;
|
|
7
|
+
readonly layout: Layout;
|
|
8
|
+
}
|
|
9
|
+
declare const NotFound: FC<NotFoundProps>;
|
|
10
|
+
export { NotFound };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Button, Text } from "@lookiero/aurora";
|
|
2
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
+
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
+
import React, { useCallback } from "react";
|
|
5
|
+
import { Image } from "react-native";
|
|
6
|
+
import { useNavigate } from "react-router-native";
|
|
7
|
+
import { useTrackPageView } from "../../../../shared/tracking/infrastructure/useTrackPageView";
|
|
8
|
+
import { AspectRatioView } from "../../../../shared/ui/components/atoms/aspectRatioView/AspectRatioView";
|
|
9
|
+
import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
|
|
10
|
+
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
11
|
+
import { TrackingPage } from "../../../tracking/tracking";
|
|
12
|
+
import { Body } from "../../components/layouts/body/Body";
|
|
13
|
+
import { I18nMessages } from "../../i18n/i18n";
|
|
14
|
+
import { Routes } from "../../routing/routes";
|
|
15
|
+
import { useBasePath } from "../../routing/useBasePath";
|
|
16
|
+
import { style } from "./NotFound.style";
|
|
17
|
+
const NotFound = ({ customerId, country, layout: Layout }) => {
|
|
18
|
+
const descriptionText = useI18nMessage({ id: I18nMessages.NOT_FOUND_DESCRIPTION });
|
|
19
|
+
const buttonText = useI18nMessage({ id: I18nMessages.NOT_FOUND_BUTTON });
|
|
20
|
+
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
21
|
+
useTrackPageView({
|
|
22
|
+
page: TrackingPage.NOT_FOUND,
|
|
23
|
+
country,
|
|
24
|
+
checkoutId: checkout?.id,
|
|
25
|
+
});
|
|
26
|
+
const navigate = useNavigate();
|
|
27
|
+
const basePath = useBasePath();
|
|
28
|
+
const handleOnPress = useCallback(() => navigate(`${basePath}/${Routes.HOME}`), [basePath, navigate]);
|
|
29
|
+
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
30
|
+
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus);
|
|
31
|
+
if (!dependenciesLoaded)
|
|
32
|
+
return React.createElement(Spinner, null);
|
|
33
|
+
return (React.createElement(Layout, { style: { scrollView: style.container } },
|
|
34
|
+
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
35
|
+
React.createElement(AspectRatioView, { aspectRatio: 1.25 },
|
|
36
|
+
React.createElement(Image, { resizeMode: "contain", source: require("../../../../public/images/not-found.png"), style: style.image, testID: "not-found-image" })),
|
|
37
|
+
React.createElement(Text, { level: 1, style: style.description }, descriptionText),
|
|
38
|
+
React.createElement(Button, { onPress: handleOnPress }, buttonText))));
|
|
39
|
+
};
|
|
40
|
+
export { NotFound };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
bodyColumn: {
|
|
3
|
+
paddingHorizontal: number;
|
|
4
|
+
};
|
|
5
|
+
container: {
|
|
6
|
+
flex: number;
|
|
7
|
+
paddingBottom: number;
|
|
8
|
+
};
|
|
9
|
+
description: {
|
|
10
|
+
marginBottom: number;
|
|
11
|
+
textAlign: "center";
|
|
12
|
+
};
|
|
13
|
+
image: {
|
|
14
|
+
flex: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export { style };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../theme/theme";
|
|
3
|
+
const { spaceXL, spaceXXL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
bodyColumn: {
|
|
6
|
+
paddingHorizontal: spaceXL,
|
|
7
|
+
},
|
|
8
|
+
container: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
paddingBottom: spaceXXL,
|
|
11
|
+
},
|
|
12
|
+
description: {
|
|
13
|
+
marginBottom: spaceXL,
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
},
|
|
16
|
+
image: {
|
|
17
|
+
flex: 1,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
export { style };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { PortalHost } from "@gorhom/portal";
|
|
2
|
-
import { Button, Text, View, useDevice } from "@lookiero/aurora";
|
|
2
|
+
import { Box, Button, Layout, Text, View, useDevice } from "@lookiero/aurora";
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
4
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
5
|
-
import React, { useCallback } from "react";
|
|
5
|
+
import React, { useCallback, useMemo } from "react";
|
|
6
|
+
import { ScrollView } from "react-native";
|
|
6
7
|
import { generatePath, useNavigate, useParams } from "react-router-native";
|
|
7
8
|
import { ReturnQuestionType } from "../../../../projection/returnQuestion/returnQuestion";
|
|
8
9
|
import { useLogger } from "../../../../shared/logging/useLogger";
|
|
9
10
|
import { useTrackPressNext } from "../../../../shared/tracking/infrastructure/useTrackPressNext";
|
|
11
|
+
import { useTrackPressPrevious } from "../../../../shared/tracking/infrastructure/useTrackPressPrevious";
|
|
10
12
|
import { useTrackReturnItem } from "../../../../shared/tracking/infrastructure/useTrackReturnItem";
|
|
11
13
|
import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
|
|
12
|
-
import { Column } from "../../../../shared/ui/components/layouts/column/Column";
|
|
13
|
-
import { Row } from "../../../../shared/ui/components/layouts/row/Row";
|
|
14
14
|
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
15
15
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
16
16
|
import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
|
|
@@ -23,10 +23,12 @@ import { HostRadioGroupReturnQuestionItem } from "../../components/organisms/ret
|
|
|
23
23
|
import { HostStackReturnQuestionItem } from "../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem";
|
|
24
24
|
import { RadioReturnQuestionItem } from "../../components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem";
|
|
25
25
|
import { TextareaReturnQuestionItem } from "../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
|
|
26
|
+
import { ItemHeader } from "../../components/templates/header/itemHeader/ItemHeader";
|
|
26
27
|
import { I18nMessages } from "../../i18n/i18n";
|
|
27
28
|
import { Routes } from "../../routing/routes";
|
|
28
29
|
import { useBasePath } from "../../routing/useBasePath";
|
|
29
30
|
import { style } from "./Return.style";
|
|
31
|
+
import { ProductVariantPreview } from "./components/productVariantPreview/ProductVariantPreview";
|
|
30
32
|
const returnQuestionItems = {
|
|
31
33
|
[ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
|
|
32
34
|
[ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
|
|
@@ -41,6 +43,7 @@ const ReturnForm = ({ checkout, checkoutItem, country, layout: LocalLayout }) =>
|
|
|
41
43
|
const logger = useLogger();
|
|
42
44
|
const basePath = useBasePath();
|
|
43
45
|
const trackPressNext = useTrackPressNext();
|
|
46
|
+
const trackPressPrevious = useTrackPressPrevious();
|
|
44
47
|
const checkoutId = checkout.id;
|
|
45
48
|
const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE });
|
|
46
49
|
const descriptionText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_DESCRIPTION });
|
|
@@ -75,6 +78,21 @@ const ReturnForm = ({ checkout, checkoutItem, country, layout: LocalLayout }) =>
|
|
|
75
78
|
});
|
|
76
79
|
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: nextItem.id }));
|
|
77
80
|
}, [basePath, checkout?.items, checkoutId, checkoutItem, country, navigate, trackPressNext]);
|
|
81
|
+
const navigateToPreviousItem = useCallback(() => {
|
|
82
|
+
const item = checkoutItem;
|
|
83
|
+
const items = checkout?.items;
|
|
84
|
+
const itemIndex = items.indexOf(item);
|
|
85
|
+
const previousItemIndex = itemIndex === 0 ? items.length - 1 : itemIndex - 1;
|
|
86
|
+
const previousItem = items[previousItemIndex];
|
|
87
|
+
trackPressPrevious({
|
|
88
|
+
page: TrackingPage.ITEM,
|
|
89
|
+
country,
|
|
90
|
+
checkoutId: checkout?.id,
|
|
91
|
+
from: item.id,
|
|
92
|
+
to: previousItem.id,
|
|
93
|
+
});
|
|
94
|
+
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: previousItem.id }));
|
|
95
|
+
}, [basePath, checkout?.id, checkout?.items, checkoutItem, country, navigate, trackPressPrevious]);
|
|
78
96
|
const returnItem = useCallback(async (feedbacks) => {
|
|
79
97
|
returnCheckoutItem({ feedbacks });
|
|
80
98
|
trackReturnItem();
|
|
@@ -82,6 +100,8 @@ const ReturnForm = ({ checkout, checkoutItem, country, layout: LocalLayout }) =>
|
|
|
82
100
|
}, [navigateToNextItem, returnCheckoutItem, trackReturnItem]);
|
|
83
101
|
const feedback = useReturnQuestionFeedback();
|
|
84
102
|
const handleOnSubmit = useCallback(() => returnItem(feedback), [feedback, returnItem]);
|
|
103
|
+
const header = useMemo(() => (React.createElement(Box, { style: style.headerWrapper },
|
|
104
|
+
React.createElement(ItemHeader, { item: checkoutItem, items: checkout?.items, onNext: navigateToNextItem, onPrevious: navigateToPreviousItem }))), [checkout?.items, checkoutItem, navigateToNextItem, navigateToPreviousItem]);
|
|
85
105
|
/* ReturnCheckoutItem */
|
|
86
106
|
const dependenciesLoaded = checkoutItem && returnQuestions && returnCheckoutItemStatus !== CommandStatus.LOADING;
|
|
87
107
|
if (!dependenciesLoaded) {
|
|
@@ -89,13 +109,15 @@ const ReturnForm = ({ checkout, checkoutItem, country, layout: LocalLayout }) =>
|
|
|
89
109
|
}
|
|
90
110
|
return (React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
|
|
91
111
|
React.createElement(PortalHost, { name: "return-question-form-portal" }),
|
|
92
|
-
React.createElement(LocalLayout, { scrollEnabled:
|
|
112
|
+
React.createElement(LocalLayout, { header: header, scrollEnabled: false, style: {
|
|
93
113
|
header: style.header,
|
|
94
114
|
safeAreaView: style.safeAreaView,
|
|
115
|
+
scrollView: style.scrollView,
|
|
95
116
|
} },
|
|
96
|
-
React.createElement(
|
|
97
|
-
|
|
98
|
-
|
|
117
|
+
React.createElement(ProductVariantPreview, { country: country, item: checkoutItem }),
|
|
118
|
+
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
119
|
+
React.createElement(Layout, { fullWidth: !screen.L, style: [style.layout, screen.L ? style.desktopLayoutSpacing : undefined] },
|
|
120
|
+
React.createElement(Box, { size: { L: "2/3" } },
|
|
99
121
|
React.createElement(View, { style: [style.info, isSmallScreen ? undefined : style.desktopInfo] },
|
|
100
122
|
React.createElement(Text, { level: 3, heading: true }, titleText),
|
|
101
123
|
React.createElement(Text, { level: 1, style: style.description, detail: true }, descriptionText)),
|
|
@@ -6,19 +6,23 @@ declare const style: {
|
|
|
6
6
|
borderTopLeftRadius: number;
|
|
7
7
|
borderTopRightRadius: number;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
desktopLayoutSpacing: {
|
|
10
|
+
paddingVertical: number;
|
|
11
11
|
};
|
|
12
12
|
header: {
|
|
13
13
|
height: number;
|
|
14
14
|
};
|
|
15
|
+
headerWrapper: {
|
|
16
|
+
display: "flex";
|
|
17
|
+
flexDirection: "column";
|
|
18
|
+
};
|
|
15
19
|
info: {
|
|
16
20
|
backgroundColor: string;
|
|
17
21
|
paddingBottom: number;
|
|
18
22
|
paddingHorizontal: number;
|
|
19
23
|
paddingTop: number;
|
|
20
24
|
};
|
|
21
|
-
|
|
25
|
+
layout: {
|
|
22
26
|
flex: number;
|
|
23
27
|
justifyContent: "center";
|
|
24
28
|
};
|
|
@@ -26,8 +30,13 @@ declare const style: {
|
|
|
26
30
|
backgroundColor: string;
|
|
27
31
|
flex: number;
|
|
28
32
|
};
|
|
33
|
+
scrollView: {
|
|
34
|
+
flex: number;
|
|
35
|
+
};
|
|
29
36
|
submit: {
|
|
30
37
|
backgroundColor: string;
|
|
38
|
+
borderBottomLeftRadius: number;
|
|
39
|
+
borderBottomRightRadius: number;
|
|
31
40
|
padding: number;
|
|
32
41
|
};
|
|
33
42
|
};
|