@lookiero/checkout 5.1.4-beta.0 → 5.1.5
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/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/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +12 -2
- package/dist/infrastructure/ui/i18n/i18n.d.ts +1 -0
- package/dist/infrastructure/ui/i18n/i18n.js +1 -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/package.json +2 -1
- package/dist/infrastructure/ui/components/layouts/banner/Banner.d.ts +0 -7
- package/dist/infrastructure/ui/components/layouts/banner/Banner.js +0 -8
- package/dist/infrastructure/ui/components/layouts/banner/Banner.style.d.ts +0 -9
- package/dist/infrastructure/ui/components/layouts/banner/Banner.style.js +0 -12
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/icons/icon.d.ts +0 -4
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/icons/icon.js +0 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.d.ts +0 -3
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.js +0 -27
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.style.d.ts +0 -6
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.style.js +0 -9
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +0 -9
- package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +0 -12
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.d.ts +0 -7
- package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.js +0 -8
- package/dist/infrastructure/ui/theme/theme.d.ts +0 -10
- package/dist/infrastructure/ui/theme/theme.js +0 -3
- package/dist/infrastructure/ui/views/notFound/NotFound.d.ts +0 -10
- package/dist/infrastructure/ui/views/notFound/NotFound.js +0 -40
- package/dist/infrastructure/ui/views/notFound/NotFound.style.d.ts +0 -17
- package/dist/infrastructure/ui/views/notFound/NotFound.style.js +0 -20
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.d.ts +0 -6
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +0 -15
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.d.ts +0 -9
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +0 -12
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowDown.d.ts +0 -4
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowDown.js +0 -5
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowUp.d.ts +0 -4
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowUp.js +0 -5
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +0 -6
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +0 -9
- package/dist/shared/ui/components/atoms/icon/Icon.d.ts +0 -14
- package/dist/shared/ui/components/atoms/icon/Icon.js +0 -4
- package/dist/shared/ui/components/atoms/icon/Icon.style.d.ts +0 -13
- package/dist/shared/ui/components/atoms/icon/Icon.style.js +0 -16
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.d.ts +0 -16
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.js +0 -7
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.style.d.ts +0 -8
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.style.js +0 -11
- package/dist/shared/ui/components/molecules/selectField/SelectField.d.ts +0 -27
- package/dist/shared/ui/components/molecules/selectField/SelectField.js +0 -28
- package/dist/shared/ui/components/molecules/selectField/SelectField.style.d.ts +0 -19
- package/dist/shared/ui/components/molecules/selectField/SelectField.style.js +0 -22
- package/dist/shared/ui/components/molecules/toast/Toast.d.ts +0 -25
- package/dist/shared/ui/components/molecules/toast/Toast.js +0 -22
- package/dist/shared/ui/components/molecules/toast/Toast.style.d.ts +0 -34
- package/dist/shared/ui/components/molecules/toast/Toast.style.js +0 -34
|
@@ -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);
|
|
@@ -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
|
});
|
|
@@ -2,15 +2,25 @@ 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 TEXTAREA_MIN_HEIGHT = 96;
|
|
8
10
|
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParent, testID, }) => {
|
|
9
11
|
const { formatMessage } = useIntl();
|
|
12
|
+
/* Kameleoon experiment */
|
|
13
|
+
const { kameleoon } = useStaticInfo();
|
|
14
|
+
const { experiments: { newFeedback: { id: newFeedbackId = "", variations = {} } = {} }, } = kameleoon;
|
|
15
|
+
const { assignedVariation: newFeedbackVariation } = useAssignedVariationByExperimentId({
|
|
16
|
+
experimentId: newFeedbackId,
|
|
17
|
+
});
|
|
18
|
+
const isReturnPage = newFeedbackVariation?.id === Number(variations.v2);
|
|
19
|
+
/* Kameleoon experiment */
|
|
10
20
|
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
11
21
|
const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
|
|
12
22
|
const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: value }), [onChange, returnQuestionParent.id]);
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
const fieldComponent = (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, testID: testID, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
24
|
+
return isReturnPage ? React.createElement(View, { style: style.wrapper }, fieldComponent) : fieldComponent;
|
|
15
25
|
};
|
|
16
26
|
export { TextareaReturnQuestionItem };
|
|
@@ -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";
|
|
@@ -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
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Theme } from "@lookiero/aurora";
|
|
2
2
|
import { StyleSheet } from "react-native";
|
|
3
3
|
import { HEADER_HEIGHT } from "../../components/templates/header/Header.style";
|
|
4
|
-
const { borderRadius5, colorBgPrimaryLight, colorBgBase, colorTextMedium, space4, space6, space8 } = Theme.get();
|
|
4
|
+
const { borderRadius5, colorBgPrimaryLight, colorBgBase, colorTextMedium, space2, space4, space6, space8 } = Theme.get();
|
|
5
5
|
const style = StyleSheet.create({
|
|
6
6
|
description: {
|
|
7
7
|
color: colorTextMedium,
|
|
@@ -10,11 +10,15 @@ const style = StyleSheet.create({
|
|
|
10
10
|
borderTopLeftRadius: borderRadius5,
|
|
11
11
|
borderTopRightRadius: borderRadius5,
|
|
12
12
|
},
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
desktopLayoutSpacing: {
|
|
14
|
+
paddingVertical: space8,
|
|
15
15
|
},
|
|
16
16
|
header: {
|
|
17
|
-
height: HEADER_HEIGHT,
|
|
17
|
+
height: HEADER_HEIGHT - space2,
|
|
18
|
+
},
|
|
19
|
+
headerWrapper: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
18
22
|
},
|
|
19
23
|
info: {
|
|
20
24
|
backgroundColor: colorBgBase,
|
|
@@ -22,7 +26,7 @@ const style = StyleSheet.create({
|
|
|
22
26
|
paddingHorizontal: space6,
|
|
23
27
|
paddingTop: space8,
|
|
24
28
|
},
|
|
25
|
-
|
|
29
|
+
layout: {
|
|
26
30
|
flex: 1,
|
|
27
31
|
justifyContent: "center",
|
|
28
32
|
},
|
|
@@ -30,8 +34,13 @@ const style = StyleSheet.create({
|
|
|
30
34
|
backgroundColor: colorBgPrimaryLight,
|
|
31
35
|
flex: 1,
|
|
32
36
|
},
|
|
37
|
+
scrollView: {
|
|
38
|
+
flex: 1,
|
|
39
|
+
},
|
|
33
40
|
submit: {
|
|
34
41
|
backgroundColor: colorBgBase,
|
|
42
|
+
borderBottomLeftRadius: borderRadius5,
|
|
43
|
+
borderBottomRightRadius: borderRadius5,
|
|
35
44
|
padding: space6,
|
|
36
45
|
},
|
|
37
46
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { PriceProjection } from "../../../../../../projection/shared/price";
|
|
3
|
+
interface PriceProps {
|
|
4
|
+
readonly price: PriceProjection;
|
|
5
|
+
readonly withPercentage?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Price: FC<PriceProps>;
|
|
8
|
+
export { Price };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Text } from "@lookiero/aurora";
|
|
2
|
+
import { useI18nNumber } from "@lookiero/i18n-react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
import { style } from "./Price.style";
|
|
6
|
+
const Price = ({ price, withPercentage = false }) => {
|
|
7
|
+
const isDiscounted = price.discountedPrice && price.discountedPrice.percentage > 0;
|
|
8
|
+
const productPrice = useI18nNumber({
|
|
9
|
+
value: price.amount / 100,
|
|
10
|
+
style: "currency",
|
|
11
|
+
currency: price.currency,
|
|
12
|
+
});
|
|
13
|
+
const productDiscountedPrice = useI18nNumber({
|
|
14
|
+
value: (price.discountedPrice?.amount || 0) / 100,
|
|
15
|
+
style: "currency",
|
|
16
|
+
currency: price.currency,
|
|
17
|
+
});
|
|
18
|
+
const priceValue = isDiscounted ? productDiscountedPrice : productPrice;
|
|
19
|
+
return (React.createElement(View, { style: style.price, testID: "price" },
|
|
20
|
+
isDiscounted && (React.createElement(Text, { level: 1, style: style.discountedPriceText, testID: "discounted-price-text", detail: true, lineThrough: true }, productPrice)),
|
|
21
|
+
React.createElement(View, { style: style.discountedPriceInfo },
|
|
22
|
+
React.createElement(Text, { level: 1, testID: "price-text", detail: true }, priceValue),
|
|
23
|
+
isDiscounted && withPercentage ? (React.createElement(Text, { level: 1, style: style.discountedPercentage, testID: "discounted-percentage-text", detail: true }, `-${price.discountedPrice.percentage}%`)) : null)));
|
|
24
|
+
};
|
|
25
|
+
export { Price };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
discountedPercentage: {
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
discountedPriceInfo: {
|
|
6
|
+
alignItems: "flex-end";
|
|
7
|
+
marginLeft: number;
|
|
8
|
+
};
|
|
9
|
+
discountedPriceText: {
|
|
10
|
+
color: string;
|
|
11
|
+
};
|
|
12
|
+
price: {
|
|
13
|
+
flexDirection: "row";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export { style };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Theme } from "@lookiero/aurora";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
const { colorTextError, colorTextMedium, space2 } = Theme.get();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
discountedPercentage: {
|
|
6
|
+
color: colorTextError,
|
|
7
|
+
},
|
|
8
|
+
discountedPriceInfo: {
|
|
9
|
+
alignItems: "flex-end",
|
|
10
|
+
marginLeft: space2,
|
|
11
|
+
},
|
|
12
|
+
discountedPriceText: {
|
|
13
|
+
color: colorTextMedium,
|
|
14
|
+
},
|
|
15
|
+
price: {
|
|
16
|
+
flexDirection: "row",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export { style };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
3
|
+
import { Country } from "../../../../../../projection/shared/country";
|
|
4
|
+
interface ProductVariantPreviewProps {
|
|
5
|
+
readonly item: CheckoutItemProjection;
|
|
6
|
+
readonly country: Country;
|
|
7
|
+
}
|
|
8
|
+
declare const ProductVariantPreview: FC<ProductVariantPreviewProps>;
|
|
9
|
+
export { ProductVariantPreview };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { COLOR, Text, View, useDevice } from "@lookiero/aurora";
|
|
2
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Image } from "react-native";
|
|
5
|
+
import { size } from "../../../../../../projection/shared/size";
|
|
6
|
+
import { Column } from "../../../../../../shared/ui/components/layouts/column/Column";
|
|
7
|
+
import { Row } from "../../../../../../shared/ui/components/layouts/row/Row";
|
|
8
|
+
import { useMediaImage } from "../../../../hooks/useMediaImage";
|
|
9
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
10
|
+
import { Price } from "../price/Price";
|
|
11
|
+
import { IMAGE_SIZE, style } from "./ProductVariantPreview.style";
|
|
12
|
+
const ProductVariantPreview = ({ item, country }) => {
|
|
13
|
+
const cdnImageUrl = useMediaImage();
|
|
14
|
+
const { screen } = useDevice();
|
|
15
|
+
const isSmallScreen = screen.S;
|
|
16
|
+
const { productVariant, price } = item;
|
|
17
|
+
const { media, brand, name, size: sizeProjection } = productVariant;
|
|
18
|
+
const mainImage = media.find((mediaElement) => mediaElement.perspective === "MAIN");
|
|
19
|
+
const sizeText = useI18nMessage({ id: I18nMessages.ITEM_SIZE });
|
|
20
|
+
const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
|
|
21
|
+
return (React.createElement(View, { style: [style.wrapper, isSmallScreen ? style.mobileWrapper : undefined] },
|
|
22
|
+
React.createElement(Row, { style: style.row },
|
|
23
|
+
React.createElement(Column, { size: { M: "2/3", L: "2/3" }, style: style.content },
|
|
24
|
+
mainImage ? (React.createElement(Image, { resizeMode: "stretch", style: style.image, testID: "product-variant-image", source: {
|
|
25
|
+
uri: cdnImageUrl({
|
|
26
|
+
url: mainImage.url,
|
|
27
|
+
width: IMAGE_SIZE,
|
|
28
|
+
}),
|
|
29
|
+
} })) : null,
|
|
30
|
+
React.createElement(View, { style: style.info },
|
|
31
|
+
React.createElement(Text, { color: COLOR.TEXT_MEDIUM, level: 2, detail: true }, brand),
|
|
32
|
+
React.createElement(Text, { level: 2, detail: true }, name),
|
|
33
|
+
React.createElement(Text, { color: COLOR.TEXT_MEDIUM, level: 2, detail: true }, `${sizeText} ${sizeProjection.unique ? uniqueText : size({ size: sizeProjection, country })}`)),
|
|
34
|
+
React.createElement(View, { style: style.price },
|
|
35
|
+
React.createElement(Price, { price: price, withPercentage: true }))))));
|
|
36
|
+
};
|
|
37
|
+
export { ProductVariantPreview };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare const IMAGE_SIZE = 35;
|
|
2
|
+
declare const style: {
|
|
3
|
+
content: {
|
|
4
|
+
flexDirection: "row";
|
|
5
|
+
};
|
|
6
|
+
image: {
|
|
7
|
+
borderRadius: number;
|
|
8
|
+
width: number;
|
|
9
|
+
};
|
|
10
|
+
info: {
|
|
11
|
+
flex: number;
|
|
12
|
+
marginLeft: number;
|
|
13
|
+
};
|
|
14
|
+
mobileWrapper: {
|
|
15
|
+
borderBottomWidth: number;
|
|
16
|
+
borderColor: string;
|
|
17
|
+
};
|
|
18
|
+
price: {
|
|
19
|
+
justifyContent: "flex-end";
|
|
20
|
+
};
|
|
21
|
+
row: {
|
|
22
|
+
flex: number;
|
|
23
|
+
justifyContent: "center";
|
|
24
|
+
};
|
|
25
|
+
wrapper: {
|
|
26
|
+
backgroundColor: string;
|
|
27
|
+
flexDirection: "row";
|
|
28
|
+
padding: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export { style, IMAGE_SIZE };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Theme } from "@lookiero/aurora";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
const { borderRadius2, borderWidth1, colorBgBase, colorBorderInput, space2, space4 } = Theme.get();
|
|
4
|
+
const IMAGE_SIZE = 35;
|
|
5
|
+
const style = StyleSheet.create({
|
|
6
|
+
content: {
|
|
7
|
+
flexDirection: "row",
|
|
8
|
+
},
|
|
9
|
+
image: {
|
|
10
|
+
borderRadius: borderRadius2,
|
|
11
|
+
width: IMAGE_SIZE,
|
|
12
|
+
},
|
|
13
|
+
info: {
|
|
14
|
+
flex: 1,
|
|
15
|
+
marginLeft: space2,
|
|
16
|
+
},
|
|
17
|
+
mobileWrapper: {
|
|
18
|
+
borderBottomWidth: borderWidth1,
|
|
19
|
+
borderColor: colorBorderInput,
|
|
20
|
+
},
|
|
21
|
+
price: {
|
|
22
|
+
justifyContent: "flex-end",
|
|
23
|
+
},
|
|
24
|
+
row: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
justifyContent: "center",
|
|
27
|
+
},
|
|
28
|
+
wrapper: {
|
|
29
|
+
backgroundColor: colorBgBase,
|
|
30
|
+
flexDirection: "row",
|
|
31
|
+
padding: space4,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export { style, IMAGE_SIZE };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@react-spring/native": "9.6.1",
|
|
36
36
|
"@sentry/react-native": "^4.13.0",
|
|
37
37
|
"inline-style-prefixer": "6.0.1",
|
|
38
|
+
"lodash": "^4.17.21",
|
|
38
39
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
39
40
|
"react-native-safe-area-context": "^4.5.0",
|
|
40
41
|
"react-native-svg": "^13.4.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
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 };
|
|
@@ -1,12 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
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 };
|
package/dist/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js
DELETED
|
@@ -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 };
|