@lookiero/checkout 8.17.1-beta.1 → 8.19.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/cypress/support/interceptListReturnQuestionsByCheckoutItemId.ts +1 -1
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +3 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.d.ts +3 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +4 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.js +1 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +8 -6
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +1 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +5 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +4 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +18 -9
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -1
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +1 -1
- package/dist/src/projection/returnQuestion/returnQuestion.d.ts +23 -16
- package/dist/src/projection/returnQuestion/returnQuestion.js +1 -11
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +4 -4
- package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.ts +1 -1
- package/src/infrastructure/projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId.test.ts +4 -9
- package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +72 -117
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.test.tsx +10 -12
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +10 -8
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.test.tsx +10 -9
- package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.ts +2 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.test.tsx +7 -9
- package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.tsx +3 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +4 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.test.tsx +7 -13
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.tsx +4 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.test.tsx +8 -14
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +13 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.test.tsx +10 -14
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +7 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +5 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.test.tsx +43 -36
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +10 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +11 -9
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.test.tsx +8 -14
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +6 -4
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +6 -4
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.test.tsx +23 -25
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +5 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.test.tsx +9 -29
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +7 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +5 -4
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +32 -18
- package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +87 -66
- package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +2 -4
- package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +261 -198
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +1 -1
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +87 -66
- package/src/projection/returnQuestion/listReturnQuestionsByCheckoutItemId.test.ts +4 -12
- package/src/projection/returnQuestion/returnQuestion.constants.ts +10 -0
- package/src/projection/returnQuestion/returnQuestion.metadata.ts +17 -0
- package/src/projection/returnQuestion/returnQuestion.ts +42 -20
- package/src/projection/returnQuestion/returnQuestion.typeguard.ts +24 -0
- package/dist/pact.config.d.ts +0 -13
- package/dist/pact.config.js +0 -9
- package/dist/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +0 -27
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -48
- package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +0 -19
- package/dist/src/infrastructure/projection/checkout/checkout.mock.js +0 -21
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -109
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -49
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -44
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -44
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -44
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +0 -6
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -49
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +0 -15
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +0 -43
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -50
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +0 -103
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -48
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -109
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +0 -6
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +0 -183
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -48
- package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +0 -9
- package/dist/src/infrastructure/projection/pricing/pricing.mock.js +0 -42
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -48
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +0 -400
- package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
- package/dist/src/infrastructure/ui/views/App.style.js +0 -7
package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
2
|
import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
3
|
+
import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
3
4
|
|
|
4
|
-
interface ReturnQuestionItemProps {
|
|
5
|
+
interface ReturnQuestionItemProps<RQT extends ReturnQuestionType> {
|
|
5
6
|
readonly returnQuestionParent: ReturnQuestionProjection;
|
|
6
|
-
readonly returnQuestion: ReturnQuestionProjection
|
|
7
|
+
readonly returnQuestion: ReturnQuestionProjection<RQT>;
|
|
7
8
|
readonly children?: ReactNode;
|
|
8
9
|
readonly portalHostName?: string;
|
|
9
10
|
readonly testID?: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
type ReturnQuestionItem = FC<ReturnQuestionItemProps
|
|
13
|
+
type ReturnQuestionItem<QT extends ReturnQuestionType> = FC<ReturnQuestionItemProps<QT>>;
|
|
13
14
|
|
|
14
15
|
export type { ReturnQuestionItem, ReturnQuestionItemProps };
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ReturnQuestionType,
|
|
6
|
-
} from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
3
|
+
import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
5
|
import { render } from "../../../../../test/render";
|
|
8
6
|
import { HostDefaultReturnQuestionFeedbackItem } from "./HostDefaultReturnQuestionFeedbackItem";
|
|
9
7
|
|
|
10
8
|
const returnQuestion: ReturnQuestionProjection = {
|
|
11
9
|
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type: ReturnQuestionType.OPTION,
|
|
10
|
+
translationKey: "size_large",
|
|
11
|
+
type: ReturnQuestionType.HOST_DEFAULT,
|
|
15
12
|
children: [
|
|
16
13
|
{
|
|
17
14
|
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
18
|
-
|
|
19
|
-
placeholder: "",
|
|
15
|
+
translationKey: "size_overall",
|
|
20
16
|
type: ReturnQuestionType.OPTION,
|
|
21
17
|
},
|
|
22
18
|
{
|
|
23
19
|
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
24
|
-
|
|
25
|
-
placeholder: "",
|
|
20
|
+
translationKey: "size_trousers_too_long",
|
|
26
21
|
type: ReturnQuestionType.OPTION,
|
|
27
22
|
},
|
|
28
23
|
{
|
|
29
24
|
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
30
|
-
|
|
31
|
-
placeholder: "",
|
|
25
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
32
26
|
type: ReturnQuestionType.OPTION,
|
|
33
27
|
},
|
|
34
28
|
],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
4
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
3
5
|
|
|
4
|
-
const HostDefaultReturnQuestionFeedbackItem: ReturnQuestionItem = ({ children }
|
|
6
|
+
const HostDefaultReturnQuestionFeedbackItem: ReturnQuestionItem<ReturnQuestionType.HOST_DEFAULT> = ({ children }) => (
|
|
5
7
|
<>{children}</>
|
|
6
8
|
);
|
|
7
9
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ReturnQuestionType,
|
|
6
|
-
} from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
3
|
+
import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
5
|
import { render } from "../../../../../test/render";
|
|
8
6
|
import { HostDefaultReturnQuestionItem } from "./HostDefaultReturnQuestionItem";
|
|
9
7
|
|
|
@@ -14,26 +12,22 @@ jest.mock("../../behaviors/useReturnQuestionFeedback", () => ({
|
|
|
14
12
|
|
|
15
13
|
const returnQuestion: ReturnQuestionProjection = {
|
|
16
14
|
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type: ReturnQuestionType.OPTION,
|
|
15
|
+
translationKey: "size_large",
|
|
16
|
+
type: ReturnQuestionType.HOST_DEFAULT,
|
|
20
17
|
children: [
|
|
21
18
|
{
|
|
22
19
|
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
23
|
-
|
|
24
|
-
placeholder: "",
|
|
20
|
+
translationKey: "size_overall",
|
|
25
21
|
type: ReturnQuestionType.OPTION,
|
|
26
22
|
},
|
|
27
23
|
{
|
|
28
24
|
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
29
|
-
|
|
30
|
-
placeholder: "",
|
|
25
|
+
translationKey: "size_trousers_too_long",
|
|
31
26
|
type: ReturnQuestionType.OPTION,
|
|
32
27
|
},
|
|
33
28
|
{
|
|
34
29
|
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
35
|
-
|
|
36
|
-
placeholder: "",
|
|
30
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
37
31
|
type: ReturnQuestionType.OPTION,
|
|
38
32
|
},
|
|
39
33
|
],
|
|
@@ -50,7 +44,7 @@ describe("HostDefaultReturnQuestionItem component (ReturnQuestions organism)", (
|
|
|
50
44
|
</HostDefaultReturnQuestionItem>,
|
|
51
45
|
);
|
|
52
46
|
|
|
53
|
-
expect(getByText(returnQuestion.
|
|
47
|
+
expect(getByText(returnQuestion.translationKey)).toBeTruthy();
|
|
54
48
|
expect(getByText("HostDefaultReturnQuestionItem children")).toBeTruthy();
|
|
55
49
|
});
|
|
56
50
|
});
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Text, View } from "@lookiero/aurora";
|
|
3
|
-
import {
|
|
4
|
+
import { useIntl } from "@lookiero/i18n-react";
|
|
5
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
6
|
+
import { returnQuestionWithTranslationKey } from "../../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
4
7
|
import { I18nMessages } from "../../../../../i18n/i18n";
|
|
5
|
-
import { ReturnQuestionItem
|
|
8
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
6
9
|
import { style } from "./HostDefaultReturnQuestionItem.style";
|
|
7
10
|
|
|
8
|
-
const HostDefaultReturnQuestionItem: ReturnQuestionItem = ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
const HostDefaultReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_DEFAULT> = ({
|
|
12
|
+
returnQuestion,
|
|
13
|
+
children,
|
|
14
|
+
}) => {
|
|
15
|
+
const { formatMessage } = useIntl();
|
|
16
|
+
const isAllOptions = returnQuestion.translationKey === I18nMessages.RETURN_QUESTION_MAIN_ALL_OPINION;
|
|
11
17
|
|
|
12
18
|
return (
|
|
13
19
|
<>
|
|
14
|
-
{
|
|
20
|
+
{returnQuestionWithTranslationKey(returnQuestion) && returnQuestion.translationKey !== " " && !isAllOptions ? (
|
|
15
21
|
<View style={style.title}>
|
|
16
22
|
<Text level={3} action>
|
|
17
|
-
{
|
|
23
|
+
{formatMessage({ id: returnQuestion.translationKey })}
|
|
18
24
|
</Text>
|
|
19
25
|
</View>
|
|
20
26
|
) : null}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useMemo } from "react";
|
|
2
3
|
import { View } from "react-native";
|
|
3
4
|
import { Text } from "@lookiero/aurora";
|
|
4
5
|
import { useIntl } from "@lookiero/i18n-react";
|
|
5
|
-
import {
|
|
6
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
6
8
|
import { style } from "./HostRadioGroupReturnQuestionItem.style";
|
|
7
9
|
|
|
8
|
-
const HostRadioGroupReturnQuestionItem: ReturnQuestionItem = ({
|
|
10
|
+
const HostRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_SELECT> = ({
|
|
9
11
|
returnQuestion,
|
|
10
12
|
children,
|
|
11
13
|
testID,
|
|
12
|
-
}
|
|
14
|
+
}) => {
|
|
13
15
|
const { formatMessage } = useIntl();
|
|
14
16
|
const placeholderText = useMemo(
|
|
15
|
-
() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""),
|
|
16
|
-
[formatMessage, returnQuestion.placeholder],
|
|
17
|
+
() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""),
|
|
18
|
+
[formatMessage, returnQuestion.metadata.placeholder],
|
|
17
19
|
);
|
|
18
20
|
|
|
19
21
|
return (
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { fireEvent, within } from "@testing-library/react-native";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Text } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
ReturnQuestionType,
|
|
7
|
-
} from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
+
import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
5
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
8
6
|
import { render } from "../../../../../test/render";
|
|
9
7
|
import { HostSelectReturnQuestionItem } from "./HostSelectReturnQuestionItem";
|
|
10
8
|
|
|
@@ -18,32 +16,30 @@ jest.mock("../../behaviors/useReturnQuestionFeedback", () => ({
|
|
|
18
16
|
|
|
19
17
|
const returnQuestion: ReturnQuestionProjection = {
|
|
20
18
|
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
21
|
-
|
|
22
|
-
placeholder: "",
|
|
19
|
+
translationKey: "size_large",
|
|
23
20
|
type: ReturnQuestionType.HOST_SELECT,
|
|
21
|
+
metadata: {
|
|
22
|
+
placeholder: "",
|
|
23
|
+
},
|
|
24
24
|
children: [
|
|
25
25
|
{
|
|
26
26
|
id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
27
|
-
|
|
28
|
-
placeholder: "",
|
|
27
|
+
translationKey: "",
|
|
29
28
|
type: ReturnQuestionType.HOST_STACK,
|
|
30
29
|
children: [
|
|
31
30
|
{
|
|
32
31
|
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
33
|
-
|
|
34
|
-
placeholder: "",
|
|
32
|
+
translationKey: "size_overall",
|
|
35
33
|
type: ReturnQuestionType.OPTION,
|
|
36
34
|
},
|
|
37
35
|
{
|
|
38
36
|
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
39
|
-
|
|
40
|
-
placeholder: "",
|
|
37
|
+
translationKey: "size_trousers_too_long",
|
|
41
38
|
type: ReturnQuestionType.OPTION,
|
|
42
39
|
},
|
|
43
40
|
{
|
|
44
41
|
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
45
|
-
|
|
46
|
-
placeholder: "",
|
|
42
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
47
43
|
type: ReturnQuestionType.OPTION,
|
|
48
44
|
},
|
|
49
45
|
],
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
3
|
import { TouchableHighlight, View } from "react-native";
|
|
3
4
|
import { ButtonIcon } from "@lookiero/aurora";
|
|
4
5
|
import { useIntl } from "@lookiero/i18n-react";
|
|
5
6
|
import { Modal } from "@lookiero/sty-psp-ui";
|
|
7
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
6
8
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
7
9
|
import {
|
|
8
10
|
useReturnQuestionFeedback,
|
|
@@ -12,19 +14,19 @@ import {
|
|
|
12
14
|
deepestReturnQuestionWithFeedbackForReturnQuestion,
|
|
13
15
|
feedbackForReturnQuestion,
|
|
14
16
|
} from "../../util/returnQuestionFeedback";
|
|
15
|
-
import { ReturnQuestionItem
|
|
17
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
16
18
|
import { style, containerUnderlayColor } from "./HostSelectReturnQuestionItem.style";
|
|
17
19
|
|
|
18
|
-
const HostSelectReturnQuestionItem: ReturnQuestionItem = ({
|
|
20
|
+
const HostSelectReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_SELECT> = ({
|
|
19
21
|
returnQuestion,
|
|
20
22
|
children,
|
|
21
23
|
portalHostName,
|
|
22
24
|
testID,
|
|
23
|
-
}
|
|
25
|
+
}) => {
|
|
24
26
|
const { formatMessage } = useIntl();
|
|
25
27
|
const placeholderText = useMemo(
|
|
26
|
-
() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""),
|
|
27
|
-
[formatMessage, returnQuestion.placeholder],
|
|
28
|
+
() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""),
|
|
29
|
+
[formatMessage, returnQuestion.metadata.placeholder],
|
|
28
30
|
);
|
|
29
31
|
|
|
30
32
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React from "react";
|
|
3
|
+
import { ReturnQuestionType } from "../../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
2
4
|
import ReturnQuestion from "../../../ReturnQuestion";
|
|
3
|
-
import { ReturnQuestionItem
|
|
5
|
+
import { ReturnQuestionItem } from "../../ReturnQuestionItem";
|
|
4
6
|
|
|
5
|
-
const HostStackReturnQuestionItem: ReturnQuestionItem = ({
|
|
7
|
+
const HostStackReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_STACK> = ({
|
|
6
8
|
returnQuestion,
|
|
7
9
|
portalHostName,
|
|
8
|
-
}
|
|
10
|
+
}) => (
|
|
9
11
|
<>
|
|
10
12
|
{returnQuestion.children?.map((childReturnQuestion) => (
|
|
11
13
|
<ReturnQuestion
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ReturnQuestionType,
|
|
6
|
-
} from "../../../../../../../../projection/returnQuestion/returnQuestion";
|
|
3
|
+
import { ReturnQuestionProjection } from "../../../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
+
import { ReturnQuestionType } from "../../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
5
|
import { render } from "../../../../../../test/render";
|
|
8
6
|
import * as useReturnQuestionFeedback from "../../../behaviors/useReturnQuestionFeedback";
|
|
9
7
|
import { HostStackReturnQuestionItem } from "./HostStackReturnQuestionItem";
|
|
@@ -15,45 +13,54 @@ const mockedUseReturnQuestionFeedbackForReturnQuestion = (
|
|
|
15
13
|
useReturnQuestionFeedback as jest.Mocked<typeof useReturnQuestionFeedback>
|
|
16
14
|
).useReturnQuestionFeedbackForReturnQuestion;
|
|
17
15
|
|
|
18
|
-
const
|
|
19
|
-
{
|
|
20
|
-
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
21
|
-
name: "size_overall",
|
|
22
|
-
placeholder: "",
|
|
23
|
-
type: ReturnQuestionType.OPTION,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
27
|
-
name: "size_trousers_too_long",
|
|
28
|
-
placeholder: "",
|
|
29
|
-
type: ReturnQuestionType.OPTION,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
33
|
-
name: "size_fit_cut_does_not_fit",
|
|
34
|
-
placeholder: "",
|
|
35
|
-
type: ReturnQuestionType.OPTION,
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
const withTitle: ReturnQuestionProjection = {
|
|
16
|
+
const withTitle: ReturnQuestionProjection<ReturnQuestionType.HOST_STACK> = {
|
|
40
17
|
id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
41
|
-
|
|
42
|
-
placeholder: "",
|
|
18
|
+
translationKey: "return question title",
|
|
43
19
|
type: ReturnQuestionType.HOST_STACK,
|
|
44
|
-
children:
|
|
20
|
+
children: [
|
|
21
|
+
{
|
|
22
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
23
|
+
translationKey: "size_overall",
|
|
24
|
+
type: ReturnQuestionType.OPTION,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
28
|
+
translationKey: "size_trousers_too_long",
|
|
29
|
+
type: ReturnQuestionType.OPTION,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
33
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
34
|
+
type: ReturnQuestionType.OPTION,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
45
37
|
};
|
|
46
38
|
|
|
47
|
-
const withoutTitle: ReturnQuestionProjection = {
|
|
39
|
+
const withoutTitle: ReturnQuestionProjection<ReturnQuestionType.HOST_STACK> = {
|
|
48
40
|
id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
49
|
-
|
|
50
|
-
placeholder: "",
|
|
41
|
+
translationKey: "",
|
|
51
42
|
type: ReturnQuestionType.HOST_STACK,
|
|
52
|
-
children:
|
|
43
|
+
children: [
|
|
44
|
+
{
|
|
45
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
46
|
+
translationKey: "size_overall",
|
|
47
|
+
type: ReturnQuestionType.OPTION,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
51
|
+
translationKey: "size_trousers_too_long",
|
|
52
|
+
type: ReturnQuestionType.OPTION,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
56
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
57
|
+
type: ReturnQuestionType.OPTION,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
53
60
|
};
|
|
54
61
|
|
|
55
62
|
interface RenderHostStackReturnQuestionItemParameters {
|
|
56
|
-
readonly returnQuestion: ReturnQuestionProjection
|
|
63
|
+
readonly returnQuestion: ReturnQuestionProjection<ReturnQuestionType.HOST_STACK>;
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
const renderHostStackReturnQuestionItem = ({ returnQuestion }: RenderHostStackReturnQuestionItemParameters) =>
|
|
@@ -72,7 +79,7 @@ describe("HostStackReturnQuestionItem component (ReturnQuestions organism)", ()
|
|
|
72
79
|
});
|
|
73
80
|
const { findByText } = renderHostStackReturnQuestionItem({ returnQuestion: withTitle });
|
|
74
81
|
|
|
75
|
-
expect(await findByText(withTitle.
|
|
82
|
+
expect(await findByText(withTitle.translationKey as string)).toBeDefined();
|
|
76
83
|
});
|
|
77
84
|
|
|
78
85
|
it("does not render a title for the returnQuestion (when returnQuestion's name is not provided)", async () => {
|
|
@@ -83,7 +90,7 @@ describe("HostStackReturnQuestionItem component (ReturnQuestions organism)", ()
|
|
|
83
90
|
});
|
|
84
91
|
const { queryByText } = renderHostStackReturnQuestionItem({ returnQuestion: withoutTitle });
|
|
85
92
|
|
|
86
|
-
expect(await queryByText(withTitle.
|
|
93
|
+
expect(await queryByText(withTitle.translationKey as string)).toBeNull();
|
|
87
94
|
});
|
|
88
95
|
|
|
89
96
|
it("renders the feedback and a ReturnQuestion for its returnQuestion.children when there is feedback", async () => {
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import { animated, useSpring } from "@react-spring/native";
|
|
2
3
|
import React, { useCallback, useMemo, useState } from "react";
|
|
3
4
|
import { LayoutChangeEvent, View } from "react-native";
|
|
4
5
|
import { COLOR, Text } from "@lookiero/aurora";
|
|
5
6
|
import { useIntl } from "@lookiero/i18n-react";
|
|
7
|
+
import { ReturnQuestionType } from "../../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
8
|
+
import { returnQuestionHasChildren } from "../../../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
6
9
|
import ReturnQuestion from "../../../ReturnQuestion";
|
|
7
10
|
import { useReturnQuestionFeedbackForReturnQuestion } from "../../../behaviors/useReturnQuestionFeedback";
|
|
8
|
-
import { ReturnQuestionItem
|
|
11
|
+
import { ReturnQuestionItem } from "../../ReturnQuestionItem";
|
|
9
12
|
import { style } from "./HostStackReturnQuestionItem.style";
|
|
10
13
|
|
|
11
|
-
const HostStackReturnQuestionItem: ReturnQuestionItem = ({
|
|
14
|
+
const HostStackReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_STACK> = ({
|
|
12
15
|
returnQuestion,
|
|
13
16
|
children,
|
|
14
17
|
portalHostName,
|
|
15
|
-
}
|
|
18
|
+
}) => {
|
|
16
19
|
const { formatMessage } = useIntl();
|
|
17
20
|
const { feedback } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion });
|
|
18
21
|
const feedbackReturnQuestion = feedback
|
|
@@ -20,11 +23,11 @@ const HostStackReturnQuestionItem: ReturnQuestionItem = ({
|
|
|
20
23
|
: undefined;
|
|
21
24
|
|
|
22
25
|
const titleText = useMemo(
|
|
23
|
-
() => (returnQuestion.
|
|
24
|
-
[formatMessage, returnQuestion.
|
|
26
|
+
() => (returnQuestion.translationKey ? formatMessage({ id: returnQuestion.translationKey }) : undefined),
|
|
27
|
+
[formatMessage, returnQuestion.translationKey],
|
|
25
28
|
);
|
|
26
29
|
const feedbackText = useMemo(
|
|
27
|
-
() => (feedbackReturnQuestion ? formatMessage({ id: feedbackReturnQuestion.
|
|
30
|
+
() => (feedbackReturnQuestion ? formatMessage({ id: feedbackReturnQuestion.translationKey }) : undefined),
|
|
28
31
|
[feedbackReturnQuestion, formatMessage],
|
|
29
32
|
);
|
|
30
33
|
|
|
@@ -48,7 +51,7 @@ const HostStackReturnQuestionItem: ReturnQuestionItem = ({
|
|
|
48
51
|
{titleText}
|
|
49
52
|
</Text>
|
|
50
53
|
)}
|
|
51
|
-
{feedbackReturnQuestion ? (
|
|
54
|
+
{feedbackReturnQuestion && returnQuestionHasChildren(feedbackReturnQuestion) ? (
|
|
52
55
|
<>
|
|
53
56
|
<Text color={COLOR.TEXT_MEDIUM} level={3}>
|
|
54
57
|
{feedbackText}
|
|
@@ -4,6 +4,7 @@ import { COLOR, Text } from "@lookiero/aurora";
|
|
|
4
4
|
import { useIntl } from "@lookiero/i18n-react";
|
|
5
5
|
import { Modal } from "@lookiero/sty-psp-ui";
|
|
6
6
|
import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
7
|
+
import { returnQuestionHasChildren } from "../../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
7
8
|
import ReturnQuestion from "../../ReturnQuestion";
|
|
8
9
|
import { style } from "./ModalOptionReturnQuestionItems.style";
|
|
9
10
|
|
|
@@ -22,7 +23,7 @@ const ModalOptionReturnQuestionItems = ({
|
|
|
22
23
|
onClose,
|
|
23
24
|
}: ModalOptionReturnQuestionItemsProps) => {
|
|
24
25
|
const { formatMessage } = useIntl();
|
|
25
|
-
const title = formatMessage({ id: returnQuestion.
|
|
26
|
+
const title = formatMessage({ id: returnQuestion.translationKey });
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
29
|
<Modal portalHostName={portalHostName} visible={visible} scroll showCloseButton onClose={onClose}>
|
|
@@ -31,14 +32,15 @@ const ModalOptionReturnQuestionItems = ({
|
|
|
31
32
|
{title}
|
|
32
33
|
</Text>
|
|
33
34
|
<>
|
|
34
|
-
{returnQuestion
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
{returnQuestionHasChildren(returnQuestion) &&
|
|
36
|
+
returnQuestion.children?.map((childReturnQuestion) => (
|
|
37
|
+
<ReturnQuestion
|
|
38
|
+
key={childReturnQuestion.id}
|
|
39
|
+
portalHostName=""
|
|
40
|
+
returnQuestion={childReturnQuestion}
|
|
41
|
+
returnQuestionParent={returnQuestion}
|
|
42
|
+
/>
|
|
43
|
+
))}
|
|
42
44
|
</>
|
|
43
45
|
</View>
|
|
44
46
|
</Modal>
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { fireEvent } from "@testing-library/react-native";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ReturnQuestionType,
|
|
6
|
-
} from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
3
|
+
import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
5
|
import { render } from "../../../../../test/render";
|
|
8
6
|
import { OptionReturnQuestionItem } from "./OptionReturnQuestionItem";
|
|
9
7
|
|
|
@@ -17,26 +15,22 @@ const returnQuestionParent = {
|
|
|
17
15
|
} as ReturnQuestionProjection;
|
|
18
16
|
const returnQuestion: ReturnQuestionProjection = {
|
|
19
17
|
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
20
|
-
|
|
21
|
-
placeholder: "",
|
|
18
|
+
translationKey: "size_large",
|
|
22
19
|
type: ReturnQuestionType.OPTION,
|
|
23
20
|
children: [
|
|
24
21
|
{
|
|
25
22
|
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
26
|
-
|
|
27
|
-
placeholder: "",
|
|
23
|
+
translationKey: "size_overall",
|
|
28
24
|
type: ReturnQuestionType.OPTION,
|
|
29
25
|
},
|
|
30
26
|
{
|
|
31
27
|
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
32
|
-
|
|
33
|
-
placeholder: "",
|
|
28
|
+
translationKey: "size_trousers_too_long",
|
|
34
29
|
type: ReturnQuestionType.OPTION,
|
|
35
30
|
},
|
|
36
31
|
{
|
|
37
32
|
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
38
|
-
|
|
39
|
-
placeholder: "",
|
|
33
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
40
34
|
type: ReturnQuestionType.OPTION,
|
|
41
35
|
},
|
|
42
36
|
],
|
|
@@ -48,9 +42,9 @@ describe("OptionReturnQuestionItem component (ReturnQuestions organism)", () =>
|
|
|
48
42
|
<OptionReturnQuestionItem returnQuestion={returnQuestion} returnQuestionParent={returnQuestionParent} />,
|
|
49
43
|
);
|
|
50
44
|
|
|
51
|
-
expect(getByText(returnQuestion.
|
|
45
|
+
expect(getByText(returnQuestion.translationKey)).toBeTruthy();
|
|
52
46
|
|
|
53
|
-
fireEvent.press(getByText(returnQuestion.
|
|
47
|
+
fireEvent.press(getByText(returnQuestion.translationKey));
|
|
54
48
|
|
|
55
49
|
expect(mockOnChange).toHaveBeenCalledWith({
|
|
56
50
|
returnQuestionId: returnQuestionParent.id,
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useCallback } from "react";
|
|
2
3
|
import { TouchableHighlight, ViewStyle } from "react-native";
|
|
3
4
|
import { Text } from "@lookiero/aurora";
|
|
4
5
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
6
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
5
7
|
import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
|
|
6
|
-
import { ReturnQuestionItem
|
|
8
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
7
9
|
import { containerUnderlayColor, style } from "./OptionReturnQuestionItem.style";
|
|
8
10
|
|
|
9
|
-
const OptionReturnQuestionItem: ReturnQuestionItem = ({
|
|
11
|
+
const OptionReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = ({
|
|
10
12
|
returnQuestion,
|
|
11
13
|
returnQuestionParent,
|
|
12
14
|
testID,
|
|
13
|
-
}
|
|
15
|
+
}) => {
|
|
14
16
|
const { onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
|
|
15
17
|
|
|
16
|
-
const optionText = useI18nMessage({ id: returnQuestion.
|
|
18
|
+
const optionText = useI18nMessage({ id: returnQuestion.translationKey });
|
|
17
19
|
const handleOnPress = useCallback(
|
|
18
20
|
() => onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: returnQuestion.id }),
|
|
19
21
|
[onChange, returnQuestion.id, returnQuestionParent.id],
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import React, { useCallback, useEffect, useState } from "react";
|
|
2
3
|
import { View, Option, OPTION_VARIANT, SIZE } from "@lookiero/aurora";
|
|
3
4
|
import { useIntl } from "@lookiero/i18n-react";
|
|
5
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
4
6
|
import {
|
|
5
7
|
useReturnQuestionFeedback,
|
|
6
8
|
useReturnQuestionFeedbackForReturnQuestion,
|
|
@@ -9,16 +11,16 @@ import {
|
|
|
9
11
|
deepestReturnQuestionWithFeedbackForReturnQuestion,
|
|
10
12
|
feedbackForReturnQuestion,
|
|
11
13
|
} from "../../util/returnQuestionFeedback";
|
|
12
|
-
import { ReturnQuestionItem
|
|
14
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
13
15
|
import { ModalOptionReturnQuestionItems } from "../modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems";
|
|
14
16
|
import { style } from "./RadioReturnQuestionItem.style";
|
|
15
17
|
|
|
16
|
-
const RadioReturnQuestionItem: ReturnQuestionItem = ({
|
|
18
|
+
const RadioReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = ({
|
|
17
19
|
returnQuestion,
|
|
18
20
|
returnQuestionParent,
|
|
19
21
|
testID,
|
|
20
22
|
portalHostName,
|
|
21
|
-
}
|
|
23
|
+
}) => {
|
|
22
24
|
const intl = useIntl();
|
|
23
25
|
const [modalVisible, setModalVisible] = useState(false);
|
|
24
26
|
const {
|
|
@@ -33,7 +35,7 @@ const RadioReturnQuestionItem: ReturnQuestionItem = ({
|
|
|
33
35
|
);
|
|
34
36
|
|
|
35
37
|
const inputValue = feedbackForReturnQuestion({ feedback, returnQuestion, translate }).join(" / ");
|
|
36
|
-
const optionText = intl.formatMessage({ id: returnQuestion.
|
|
38
|
+
const optionText = intl.formatMessage({ id: returnQuestion.translationKey });
|
|
37
39
|
|
|
38
40
|
const hasChildren = Boolean(returnQuestion.children && returnQuestion.children.length > 0);
|
|
39
41
|
|