@lookiero/checkout 12.4.0 → 12.5.1
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/src/ExpoRoot.js +1 -2
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +47 -58
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.d.ts +4 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.js +17 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.d.ts +11 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.js +16 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +3 -5
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +2 -4
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -0
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -1
- package/dist/src/projection/returnQuestion/returnQuestion.constants.d.ts +1 -0
- package/dist/src/projection/returnQuestion/returnQuestion.constants.js +1 -0
- package/dist/src/projection/returnQuestion/returnQuestion.d.ts +2 -2
- package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +2 -4
- package/dist/src/projection/returnQuestion/returnQuestion.typeguard.js +2 -2
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/src/ExpoRoot.tsx +1 -2
- package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +47 -58
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +1 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.ts +19 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.tsx +36 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.test.tsx +46 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -12
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +6 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +22 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +2 -7
- package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +1 -0
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +3 -1
- package/src/projection/returnQuestion/returnQuestion.constants.ts +1 -0
- package/src/projection/returnQuestion/returnQuestion.ts +6 -2
- package/src/projection/returnQuestion/returnQuestion.typeguard.ts +3 -11
package/dist/src/ExpoRoot.js
CHANGED
|
@@ -28,7 +28,7 @@ const order = {
|
|
|
28
28
|
coupon: "MYLOOKIERO",
|
|
29
29
|
};
|
|
30
30
|
const customer = {
|
|
31
|
-
customerId: "
|
|
31
|
+
customerId: "c7373f39-cae1-4b6d-9711-19eaf007d6a8",
|
|
32
32
|
country: Country.NL,
|
|
33
33
|
segment: Segment.WOMEN,
|
|
34
34
|
email: "email@example.com",
|
|
@@ -113,7 +113,6 @@ const ExpoRoot = () => {
|
|
|
113
113
|
["AreaNormal-Extrabold"]: require("@lookiero/aurora/build/assets/fonts/AreaNormal-Extrabold.otf"),
|
|
114
114
|
["OpenSans-Regular"]: require("@lookiero/aurora/build/assets/fonts/OpenSans-Regular.ttf"),
|
|
115
115
|
["OpenSans-Bold"]: require("@lookiero/aurora/build/assets/fonts/OpenSans-Bold.ttf"),
|
|
116
|
-
["DalaFloda-Bold"]: require("@lookiero/aurora/build/assets/fonts/DalaFloda-Bold.otf"),
|
|
117
116
|
auroraicons: require("@lookiero/aurora-iconfont/dist/auroraicons.ttf"),
|
|
118
117
|
});
|
|
119
118
|
const [isAccessible, setIsAccessible] = useState();
|
|
@@ -6,76 +6,65 @@ const returnQuestions = [
|
|
|
6
6
|
type: ReturnQuestionType.HOST_DEFAULT,
|
|
7
7
|
children: [
|
|
8
8
|
{
|
|
9
|
-
id: "
|
|
10
|
-
|
|
11
|
-
type: ReturnQuestionType.HOST_SELECT,
|
|
12
|
-
metadata: {
|
|
13
|
-
placeholder: "size_placeholder",
|
|
14
|
-
},
|
|
9
|
+
id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
|
|
10
|
+
type: ReturnQuestionType.HOST_RADIO_GROUP,
|
|
15
11
|
children: [
|
|
16
12
|
{
|
|
17
|
-
id: "
|
|
18
|
-
translationKey: "
|
|
19
|
-
type: ReturnQuestionType.
|
|
13
|
+
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
14
|
+
translationKey: "size_large",
|
|
15
|
+
type: ReturnQuestionType.OPTION,
|
|
20
16
|
children: [
|
|
21
17
|
{
|
|
22
|
-
id: "
|
|
23
|
-
|
|
24
|
-
type: ReturnQuestionType.OPTION,
|
|
18
|
+
id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
19
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
25
20
|
children: [
|
|
26
21
|
{
|
|
27
|
-
id: "
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
42
|
-
translationKey: "size_fit_cut_does_not_fit",
|
|
43
|
-
type: ReturnQuestionType.OPTION,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
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,
|
|
46
35
|
},
|
|
47
36
|
],
|
|
48
37
|
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "a081c3e9-1904-4a60-8899-b72c1a3a0291",
|
|
42
|
+
translationKey: "size_correct",
|
|
43
|
+
type: ReturnQuestionType.OPTION,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
|
|
47
|
+
translationKey: "size_small",
|
|
48
|
+
type: ReturnQuestionType.OPTION,
|
|
49
|
+
children: [
|
|
49
50
|
{
|
|
50
|
-
id: "
|
|
51
|
-
|
|
52
|
-
type: ReturnQuestionType.OPTION,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
|
|
56
|
-
translationKey: "size_small",
|
|
57
|
-
type: ReturnQuestionType.OPTION,
|
|
51
|
+
id: "58e5ae9a-bc0d-4d27-b267-854a51c2a79a",
|
|
52
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
58
53
|
children: [
|
|
59
54
|
{
|
|
60
|
-
id: "
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
|
|
75
|
-
translationKey: "size_fit_cut_does_not_fit",
|
|
76
|
-
type: ReturnQuestionType.OPTION,
|
|
77
|
-
},
|
|
78
|
-
],
|
|
55
|
+
id: "6a3d11fc-570c-4085-a850-1967228cdd4c",
|
|
56
|
+
translationKey: "size_overall",
|
|
57
|
+
type: ReturnQuestionType.OPTION,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "c27e1936-deea-4dbe-a8f1-fe4fb8564deb",
|
|
61
|
+
translationKey: "size_trousers_too_short",
|
|
62
|
+
type: ReturnQuestionType.OPTION,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
|
|
66
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
67
|
+
type: ReturnQuestionType.OPTION,
|
|
79
68
|
},
|
|
80
69
|
],
|
|
81
70
|
},
|
|
@@ -3,7 +3,6 @@ import React, { useMemo } from "react";
|
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { Text } from "@lookiero/aurora";
|
|
5
5
|
import { useI18n } from "@lookiero/i18n-react";
|
|
6
|
-
import { returnQuestionWithTranslationKey } from "../../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
7
6
|
import { DOMAIN, I18nMessages } from "../../../../../i18n/i18n";
|
|
8
7
|
import { style as hostDefaultReturnQuestionItemStyle } from "./HostDefaultReturnQuestionItem.style";
|
|
9
8
|
const HostDefaultReturnQuestionItem = ({ returnQuestion, children, }) => {
|
|
@@ -11,7 +10,7 @@ const HostDefaultReturnQuestionItem = ({ returnQuestion, children, }) => {
|
|
|
11
10
|
const isAllOptions = returnQuestion.translationKey === I18nMessages.RETURN_QUESTION_MAIN_ALL_OPINION;
|
|
12
11
|
const style = useMemo(() => hostDefaultReturnQuestionItemStyle(), []);
|
|
13
12
|
return (React.createElement(React.Fragment, null,
|
|
14
|
-
|
|
13
|
+
returnQuestion.translationKey && returnQuestion.translationKey !== " " && !isAllOptions ? (React.createElement(View, { style: style.title },
|
|
15
14
|
React.createElement(Text, { level: 3, action: true }, formatMessage({ id: returnQuestion.translationKey })))) : null,
|
|
16
15
|
children));
|
|
17
16
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
2
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
3
|
+
declare const HostLegacyRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_SELECT>;
|
|
4
|
+
export { HostLegacyRadioGroupReturnQuestionItem };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { Text } from "@lookiero/aurora";
|
|
5
|
+
import { useI18n } from "@lookiero/i18n-react";
|
|
6
|
+
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
7
|
+
import { style as hostLegacyRadioGroupReturnQuestionItemStyle } from "./HostLegacyRadioGroupReturnQuestionItem.style";
|
|
8
|
+
const HostLegacyRadioGroupReturnQuestionItem = ({ returnQuestion, children, testID, }) => {
|
|
9
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
10
|
+
const placeholderText = useMemo(() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""), [formatMessage, returnQuestion.metadata.placeholder]);
|
|
11
|
+
const style = useMemo(() => hostLegacyRadioGroupReturnQuestionItemStyle(), []);
|
|
12
|
+
return (React.createElement(React.Fragment, null,
|
|
13
|
+
React.createElement(View, { style: style.wrapper, testID: testID },
|
|
14
|
+
React.createElement(Text, { level: 3, style: style.title, action: true }, placeholderText),
|
|
15
|
+
children)));
|
|
16
|
+
};
|
|
17
|
+
export { HostLegacyRadioGroupReturnQuestionItem };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
|
+
const style = () => {
|
|
4
|
+
const { colorBgBase, space2, space6 } = theme();
|
|
5
|
+
return StyleSheet.create({
|
|
6
|
+
title: {
|
|
7
|
+
marginBottom: space2,
|
|
8
|
+
},
|
|
9
|
+
wrapper: {
|
|
10
|
+
backgroundColor: colorBgBase,
|
|
11
|
+
marginBottom: space2,
|
|
12
|
+
padding: space6,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export { style };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
2
2
|
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
3
|
-
declare const HostRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.
|
|
3
|
+
declare const HostRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_RADIO_GROUP>;
|
|
4
4
|
export { HostRadioGroupReturnQuestionItem };
|
|
@@ -7,11 +7,9 @@ import { DOMAIN } from "../../../../../i18n/i18n";
|
|
|
7
7
|
import { style as hostRadioGroupReturnQuestionItemStyle } from "./HostRadioGroupReturnQuestionItem.style";
|
|
8
8
|
const HostRadioGroupReturnQuestionItem = ({ returnQuestion, children, testID, }) => {
|
|
9
9
|
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
10
|
-
const placeholderText = useMemo(() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""), [formatMessage, returnQuestion.metadata.placeholder]);
|
|
11
10
|
const style = useMemo(() => hostRadioGroupReturnQuestionItemStyle(), []);
|
|
12
|
-
return (React.createElement(
|
|
13
|
-
React.createElement(
|
|
14
|
-
|
|
15
|
-
children)));
|
|
11
|
+
return (React.createElement(View, { style: style.wrapper, testID: testID },
|
|
12
|
+
returnQuestion.translationKey && (React.createElement(Text, { level: 3, style: style.title, action: true }, formatMessage({ id: returnQuestion.translationKey }))),
|
|
13
|
+
children));
|
|
16
14
|
};
|
|
17
15
|
export { HostRadioGroupReturnQuestionItem };
|
|
@@ -8,15 +8,14 @@ import { useReturnQuestionFeedback } from "../../behaviors/useReturnQuestionFeed
|
|
|
8
8
|
import { feedbackForReturnQuestion } from "../../util/returnQuestionFeedback";
|
|
9
9
|
import { style as returnQuestionFeedbackItemStyle } from "./ReturnQuestionFeedbackItem.style";
|
|
10
10
|
const ReturnQuestionFeedbackItem = ({ returnQuestion }) => {
|
|
11
|
-
const
|
|
11
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
12
12
|
const unansweredText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.FEEDBACK_UNANSWERED });
|
|
13
13
|
const returnQuestionFeedback = useReturnQuestionFeedback();
|
|
14
|
-
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
15
14
|
const translate = useCallback((returnQuestionName) => formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }), [formatMessage]);
|
|
16
15
|
const feedback = feedbackForReturnQuestion({ feedback: returnQuestionFeedback, returnQuestion, translate }).join(" / ");
|
|
17
16
|
const style = useMemo(() => returnQuestionFeedbackItemStyle(), []);
|
|
18
17
|
return (React.createElement(View, { style: style.container },
|
|
19
|
-
React.createElement(Text, { level: 2, style: style.title, detailBold: true },
|
|
18
|
+
returnQuestion.translationKey && (React.createElement(Text, { level: 2, style: style.title, detailBold: true }, formatMessage({ id: returnQuestion.translationKey }))),
|
|
20
19
|
React.createElement(Text, { level: 1, detail: true }, feedback || unansweredText)));
|
|
21
20
|
};
|
|
22
21
|
export { ReturnQuestionFeedbackItem };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isUuid } from "@lookiero/sty-psp-uuid";
|
|
2
|
-
import { returnQuestionHasChildren
|
|
2
|
+
import { returnQuestionHasChildren } from "../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
3
3
|
const feedbackForReturnQuestion = ({ feedback, returnQuestion, translate, acc = [], }) => {
|
|
4
4
|
const returnQuestionId = Object.keys(feedback).find((id) => id === returnQuestion.id);
|
|
5
5
|
if (returnQuestionId) {
|
|
@@ -10,9 +10,7 @@ const feedbackForReturnQuestion = ({ feedback, returnQuestion, translate, acc =
|
|
|
10
10
|
if (feebackReturnQuestionChild) {
|
|
11
11
|
return [
|
|
12
12
|
...acc,
|
|
13
|
-
...(
|
|
14
|
-
? [translate(feebackReturnQuestionChild.translationKey)]
|
|
15
|
-
: []),
|
|
13
|
+
...(feebackReturnQuestionChild.translationKey ? [translate(feebackReturnQuestionChild.translationKey)] : []),
|
|
16
14
|
...feedbackForReturnQuestion({ feedback, returnQuestion: feebackReturnQuestionChild, translate, acc }),
|
|
17
15
|
];
|
|
18
16
|
}
|
|
@@ -17,6 +17,7 @@ const returnQuestionItems = {
|
|
|
17
17
|
[ReturnQuestionType.HOST_STACK]: ReturnQuestionFeedbackItem,
|
|
18
18
|
[ReturnQuestionType.TEXTAREA]: ReturnQuestionFeedbackItem,
|
|
19
19
|
[ReturnQuestionType.OPTION]: ReturnQuestionFeedbackItem,
|
|
20
|
+
[ReturnQuestionType.HOST_RADIO_GROUP]: ReturnQuestionFeedbackItem,
|
|
20
21
|
};
|
|
21
22
|
const ReturnQuestionsFeedback = ({ returnQuestions, onEditFeedback }) => {
|
|
22
23
|
const titleText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.FEEDBACK_TITLE });
|
|
@@ -20,6 +20,7 @@ import { ReturnQuestions } from "../../../../components/organisms/returnQuestion
|
|
|
20
20
|
import { useReturnQuestionFeedback } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
|
|
21
21
|
import { ReturnQuestionItemProvider, } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
|
|
22
22
|
import { HostDefaultReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem";
|
|
23
|
+
import { HostLegacyRadioGroupReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem";
|
|
23
24
|
import { HostRadioGroupReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem";
|
|
24
25
|
import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem";
|
|
25
26
|
import { RadioReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem";
|
|
@@ -34,7 +35,8 @@ const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
|
|
|
34
35
|
const returnQuestionItems = {
|
|
35
36
|
[ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
|
|
36
37
|
[ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
|
|
37
|
-
[ReturnQuestionType.HOST_SELECT]:
|
|
38
|
+
[ReturnQuestionType.HOST_SELECT]: HostLegacyRadioGroupReturnQuestionItem,
|
|
39
|
+
[ReturnQuestionType.HOST_RADIO_GROUP]: HostRadioGroupReturnQuestionItem,
|
|
38
40
|
[ReturnQuestionType.HOST_STACK]: HostStackReturnQuestionItem,
|
|
39
41
|
[ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
|
|
40
42
|
[ReturnQuestionType.OPTION]: RadioReturnQuestionItem,
|
|
@@ -4,6 +4,7 @@ var ReturnQuestionType;
|
|
|
4
4
|
ReturnQuestionType["HOST_TEXTAREA"] = "HOST_TEXTAREA";
|
|
5
5
|
ReturnQuestionType["HOST_SELECT"] = "HOST_SELECT";
|
|
6
6
|
ReturnQuestionType["HOST_STACK"] = "HOST_STACK";
|
|
7
|
+
ReturnQuestionType["HOST_RADIO_GROUP"] = "HOST_RADIO_GROUP";
|
|
7
8
|
ReturnQuestionType["TEXTAREA"] = "TEXTAREA";
|
|
8
9
|
ReturnQuestionType["OPTION"] = "OPTION";
|
|
9
10
|
})(ReturnQuestionType || (ReturnQuestionType = {}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EmptyObject, ExcludePropertyIfOptional, NonEmptyArray } from "@lookiero/sty-psp-typescript";
|
|
2
2
|
import { ReturnQuestionType } from "./returnQuestion.constants";
|
|
3
3
|
import { Metadata } from "./returnQuestion.metadata";
|
|
4
|
-
type ReturnQuestionTypesWithChildren = ReturnQuestionType.HOST_DEFAULT | ReturnQuestionType.HOST_SELECT | ReturnQuestionType.HOST_STACK | ReturnQuestionType.HOST_TEXTAREA;
|
|
4
|
+
type ReturnQuestionTypesWithChildren = ReturnQuestionType.HOST_DEFAULT | ReturnQuestionType.HOST_SELECT | ReturnQuestionType.HOST_STACK | ReturnQuestionType.HOST_TEXTAREA | ReturnQuestionType.HOST_RADIO_GROUP;
|
|
5
5
|
type ReturnQuestionTypesWithOptionalChildren = ReturnQuestionType.OPTION;
|
|
6
|
-
type ReturnQuestionTypesWithOptionalTranslationKeys = ReturnQuestionType.HOST_STACK;
|
|
6
|
+
type ReturnQuestionTypesWithOptionalTranslationKeys = ReturnQuestionType.HOST_DEFAULT | ReturnQuestionType.HOST_STACK | ReturnQuestionType.HOST_RADIO_GROUP;
|
|
7
7
|
type ReturnQuestionMetadata<RQT extends ReturnQuestionType> = ExcludePropertyIfOptional<"metadata", {
|
|
8
8
|
readonly metadata: Metadata<RQT>;
|
|
9
9
|
}>;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ReturnQuestionProjection, ReturnQuestionTypesWithChildren
|
|
2
|
-
import { ReturnQuestionType } from "./returnQuestion.constants";
|
|
3
|
-
declare const returnQuestionWithTranslationKey: (question: ReturnQuestionProjection) => question is ReturnQuestionProjection<Exclude<ReturnQuestionType, ReturnQuestionTypesWithOptionalTranslationKeys>>;
|
|
1
|
+
import { ReturnQuestionProjection, ReturnQuestionTypesWithChildren } from "./returnQuestion";
|
|
4
2
|
declare const returnQuestionHasChildren: (question: ReturnQuestionProjection) => question is ReturnQuestionProjection<ReturnQuestionTypesWithChildren>;
|
|
5
|
-
export {
|
|
3
|
+
export { returnQuestionHasChildren };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReturnQuestionType } from "./returnQuestion.constants";
|
|
2
|
-
const returnQuestionWithTranslationKey = (question) => Boolean(question.translationKey);
|
|
3
2
|
const returnQuestionHasChildren = (question) => [
|
|
4
3
|
ReturnQuestionType.HOST_DEFAULT,
|
|
5
4
|
ReturnQuestionType.HOST_SELECT,
|
|
6
5
|
ReturnQuestionType.HOST_STACK,
|
|
7
6
|
ReturnQuestionType.HOST_TEXTAREA,
|
|
7
|
+
ReturnQuestionType.HOST_RADIO_GROUP,
|
|
8
8
|
ReturnQuestionType.OPTION,
|
|
9
9
|
].includes(question.type);
|
|
10
|
-
export {
|
|
10
|
+
export { returnQuestionHasChildren };
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "12.
|
|
1
|
+
export declare const VERSION = "12.5.1";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "12.
|
|
1
|
+
export const VERSION = "12.5.1";
|
package/package.json
CHANGED
package/src/ExpoRoot.tsx
CHANGED
|
@@ -37,7 +37,7 @@ const order: OrderProjection = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const customer: Customer = {
|
|
40
|
-
customerId: "
|
|
40
|
+
customerId: "c7373f39-cae1-4b6d-9711-19eaf007d6a8",
|
|
41
41
|
country: Country.NL,
|
|
42
42
|
segment: Segment.WOMEN,
|
|
43
43
|
email: "email@example.com",
|
|
@@ -136,7 +136,6 @@ const ExpoRoot: FC = () => {
|
|
|
136
136
|
["AreaNormal-Extrabold"]: require("@lookiero/aurora/build/assets/fonts/AreaNormal-Extrabold.otf"),
|
|
137
137
|
["OpenSans-Regular"]: require("@lookiero/aurora/build/assets/fonts/OpenSans-Regular.ttf"),
|
|
138
138
|
["OpenSans-Bold"]: require("@lookiero/aurora/build/assets/fonts/OpenSans-Bold.ttf"),
|
|
139
|
-
["DalaFloda-Bold"]: require("@lookiero/aurora/build/assets/fonts/DalaFloda-Bold.otf"),
|
|
140
139
|
auroraicons: require("@lookiero/aurora-iconfont/dist/auroraicons.ttf"),
|
|
141
140
|
});
|
|
142
141
|
|
|
@@ -8,76 +8,65 @@ const returnQuestions: ReturnQuestionProjection[] = [
|
|
|
8
8
|
type: ReturnQuestionType.HOST_DEFAULT,
|
|
9
9
|
children: [
|
|
10
10
|
{
|
|
11
|
-
id: "
|
|
12
|
-
|
|
13
|
-
type: ReturnQuestionType.HOST_SELECT,
|
|
14
|
-
metadata: {
|
|
15
|
-
placeholder: "size_placeholder",
|
|
16
|
-
},
|
|
11
|
+
id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
|
|
12
|
+
type: ReturnQuestionType.HOST_RADIO_GROUP,
|
|
17
13
|
children: [
|
|
18
14
|
{
|
|
19
|
-
id: "
|
|
20
|
-
translationKey: "
|
|
21
|
-
type: ReturnQuestionType.
|
|
15
|
+
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
16
|
+
translationKey: "size_large",
|
|
17
|
+
type: ReturnQuestionType.OPTION,
|
|
22
18
|
children: [
|
|
23
19
|
{
|
|
24
|
-
id: "
|
|
25
|
-
|
|
26
|
-
type: ReturnQuestionType.OPTION,
|
|
20
|
+
id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
21
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
27
22
|
children: [
|
|
28
23
|
{
|
|
29
|
-
id: "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
44
|
-
translationKey: "size_fit_cut_does_not_fit",
|
|
45
|
-
type: ReturnQuestionType.OPTION,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
24
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
25
|
+
translationKey: "size_overall",
|
|
26
|
+
type: ReturnQuestionType.OPTION,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
30
|
+
translationKey: "size_trousers_too_long",
|
|
31
|
+
type: ReturnQuestionType.OPTION,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
35
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
36
|
+
type: ReturnQuestionType.OPTION,
|
|
48
37
|
},
|
|
49
38
|
],
|
|
50
39
|
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "a081c3e9-1904-4a60-8899-b72c1a3a0291",
|
|
44
|
+
translationKey: "size_correct",
|
|
45
|
+
type: ReturnQuestionType.OPTION,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
|
|
49
|
+
translationKey: "size_small",
|
|
50
|
+
type: ReturnQuestionType.OPTION,
|
|
51
|
+
children: [
|
|
51
52
|
{
|
|
52
|
-
id: "
|
|
53
|
-
|
|
54
|
-
type: ReturnQuestionType.OPTION,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
|
|
58
|
-
translationKey: "size_small",
|
|
59
|
-
type: ReturnQuestionType.OPTION,
|
|
53
|
+
id: "58e5ae9a-bc0d-4d27-b267-854a51c2a79a",
|
|
54
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
60
55
|
children: [
|
|
61
56
|
{
|
|
62
|
-
id: "
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
|
|
77
|
-
translationKey: "size_fit_cut_does_not_fit",
|
|
78
|
-
type: ReturnQuestionType.OPTION,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
57
|
+
id: "6a3d11fc-570c-4085-a850-1967228cdd4c",
|
|
58
|
+
translationKey: "size_overall",
|
|
59
|
+
type: ReturnQuestionType.OPTION,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "c27e1936-deea-4dbe-a8f1-fe4fb8564deb",
|
|
63
|
+
translationKey: "size_trousers_too_short",
|
|
64
|
+
type: ReturnQuestionType.OPTION,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
|
|
68
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
69
|
+
type: ReturnQuestionType.OPTION,
|
|
81
70
|
},
|
|
82
71
|
],
|
|
83
72
|
},
|
|
@@ -4,7 +4,6 @@ import { View } from "react-native";
|
|
|
4
4
|
import { Text } from "@lookiero/aurora";
|
|
5
5
|
import { useI18n } from "@lookiero/i18n-react";
|
|
6
6
|
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
|
-
import { returnQuestionWithTranslationKey } from "../../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
8
7
|
import { DOMAIN, I18nMessages } from "../../../../../i18n/i18n";
|
|
9
8
|
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
10
9
|
import { style as hostDefaultReturnQuestionItemStyle } from "./HostDefaultReturnQuestionItem.style";
|
|
@@ -20,7 +19,7 @@ const HostDefaultReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_
|
|
|
20
19
|
|
|
21
20
|
return (
|
|
22
21
|
<>
|
|
23
|
-
{
|
|
22
|
+
{returnQuestion.translationKey && returnQuestion.translationKey !== " " && !isAllOptions ? (
|
|
24
23
|
<View style={style.title}>
|
|
25
24
|
<Text level={3} action>
|
|
26
25
|
{formatMessage({ id: returnQuestion.translationKey })}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
|
+
|
|
4
|
+
const style = () => {
|
|
5
|
+
const { colorBgBase, space2, space6 } = theme();
|
|
6
|
+
|
|
7
|
+
return StyleSheet.create({
|
|
8
|
+
title: {
|
|
9
|
+
marginBottom: space2,
|
|
10
|
+
},
|
|
11
|
+
wrapper: {
|
|
12
|
+
backgroundColor: colorBgBase,
|
|
13
|
+
marginBottom: space2,
|
|
14
|
+
padding: space6,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { style };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { Text } from "@lookiero/aurora";
|
|
5
|
+
import { useI18n } from "@lookiero/i18n-react";
|
|
6
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
|
+
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
8
|
+
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
9
|
+
import { style as hostLegacyRadioGroupReturnQuestionItemStyle } from "./HostLegacyRadioGroupReturnQuestionItem.style";
|
|
10
|
+
|
|
11
|
+
const HostLegacyRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_SELECT> = ({
|
|
12
|
+
returnQuestion,
|
|
13
|
+
children,
|
|
14
|
+
testID,
|
|
15
|
+
}) => {
|
|
16
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
17
|
+
const placeholderText = useMemo(
|
|
18
|
+
() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""),
|
|
19
|
+
[formatMessage, returnQuestion.metadata.placeholder],
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const style = useMemo(() => hostLegacyRadioGroupReturnQuestionItemStyle(), []);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<View style={style.wrapper} testID={testID}>
|
|
27
|
+
<Text level={3} style={style.title} action>
|
|
28
|
+
{placeholderText}
|
|
29
|
+
</Text>
|
|
30
|
+
{children}
|
|
31
|
+
</View>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { HostLegacyRadioGroupReturnQuestionItem };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Text } from "react-native";
|
|
3
|
+
import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
+
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
5
|
+
import { render } from "../../../../../test/render";
|
|
6
|
+
import { HostRadioGroupReturnQuestionItem } from "./HostRadioGroupReturnQuestionItem";
|
|
7
|
+
|
|
8
|
+
const returnQuestion: ReturnQuestionProjection<ReturnQuestionType.HOST_RADIO_GROUP> = {
|
|
9
|
+
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
10
|
+
translationKey: "size_large",
|
|
11
|
+
type: ReturnQuestionType.HOST_RADIO_GROUP,
|
|
12
|
+
children: [
|
|
13
|
+
{
|
|
14
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
15
|
+
translationKey: "size_overall",
|
|
16
|
+
type: ReturnQuestionType.OPTION,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
20
|
+
translationKey: "size_trousers_too_long",
|
|
21
|
+
type: ReturnQuestionType.OPTION,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
25
|
+
translationKey: "size_fit_cut_does_not_fit",
|
|
26
|
+
type: ReturnQuestionType.OPTION,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
describe("HostRadioGroupReturnQuestionItem component (ReturnQuestions organism)", () => {
|
|
32
|
+
it("renders correctly", () => {
|
|
33
|
+
const childrenText = "HostRadioGroupReturnQuestionItem children";
|
|
34
|
+
const { getByText } = render(
|
|
35
|
+
<HostRadioGroupReturnQuestionItem
|
|
36
|
+
returnQuestion={returnQuestion}
|
|
37
|
+
returnQuestionParent={{} as ReturnQuestionProjection}
|
|
38
|
+
>
|
|
39
|
+
<Text>{childrenText}</Text>
|
|
40
|
+
</HostRadioGroupReturnQuestionItem>,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
expect(getByText(returnQuestion.translationKey as string)).toBeTruthy();
|
|
44
|
+
expect(getByText(childrenText)).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -8,28 +8,23 @@ import { DOMAIN } from "../../../../../i18n/i18n";
|
|
|
8
8
|
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
9
9
|
import { style as hostRadioGroupReturnQuestionItemStyle } from "./HostRadioGroupReturnQuestionItem.style";
|
|
10
10
|
|
|
11
|
-
const HostRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.
|
|
11
|
+
const HostRadioGroupReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_RADIO_GROUP> = ({
|
|
12
12
|
returnQuestion,
|
|
13
13
|
children,
|
|
14
14
|
testID,
|
|
15
15
|
}) => {
|
|
16
16
|
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
17
|
-
const placeholderText = useMemo(
|
|
18
|
-
() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""),
|
|
19
|
-
[formatMessage, returnQuestion.metadata.placeholder],
|
|
20
|
-
);
|
|
21
|
-
|
|
22
17
|
const style = useMemo(() => hostRadioGroupReturnQuestionItemStyle(), []);
|
|
23
18
|
|
|
24
19
|
return (
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
<View style={style.wrapper} testID={testID}>
|
|
21
|
+
{returnQuestion.translationKey && (
|
|
27
22
|
<Text level={3} style={style.title} action>
|
|
28
|
-
{
|
|
23
|
+
{formatMessage({ id: returnQuestion.translationKey })}
|
|
29
24
|
</Text>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
)}
|
|
26
|
+
{children}
|
|
27
|
+
</View>
|
|
33
28
|
);
|
|
34
29
|
};
|
|
35
30
|
|
|
@@ -11,12 +11,11 @@ import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
|
11
11
|
import { style as returnQuestionFeedbackItemStyle } from "./ReturnQuestionFeedbackItem.style";
|
|
12
12
|
|
|
13
13
|
const ReturnQuestionFeedbackItem: ReturnQuestionItem<ReturnQuestionType.HOST_DEFAULT> = ({ returnQuestion }) => {
|
|
14
|
-
const
|
|
14
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
15
15
|
const unansweredText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.FEEDBACK_UNANSWERED });
|
|
16
16
|
|
|
17
17
|
const returnQuestionFeedback = useReturnQuestionFeedback();
|
|
18
18
|
|
|
19
|
-
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
20
19
|
const translate = useCallback(
|
|
21
20
|
(returnQuestionName: string) => formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }),
|
|
22
21
|
[formatMessage],
|
|
@@ -29,9 +28,11 @@ const ReturnQuestionFeedbackItem: ReturnQuestionItem<ReturnQuestionType.HOST_DEF
|
|
|
29
28
|
|
|
30
29
|
return (
|
|
31
30
|
<View style={style.container}>
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
31
|
+
{returnQuestion.translationKey && (
|
|
32
|
+
<Text level={2} style={style.title} detailBold>
|
|
33
|
+
{formatMessage({ id: returnQuestion.translationKey })}
|
|
34
|
+
</Text>
|
|
35
|
+
)}
|
|
35
36
|
<Text level={1} detail>
|
|
36
37
|
{feedback || unansweredText}
|
|
37
38
|
</Text>
|
|
@@ -2,8 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`returnQuestionFeedback utils return the deepest returnQuestion with feedback recursively 1`] = `
|
|
4
4
|
[
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
{
|
|
6
|
+
"children": [
|
|
7
|
+
{
|
|
8
|
+
"id": "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
9
|
+
"translationKey": "size_overall",
|
|
10
|
+
"type": "OPTION",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
14
|
+
"translationKey": "size_trousers_too_long",
|
|
15
|
+
"type": "OPTION",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
19
|
+
"translationKey": "size_fit_cut_does_not_fit",
|
|
20
|
+
"type": "OPTION",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
"id": "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
24
|
+
"type": "HOST_STACK",
|
|
25
|
+
},
|
|
26
|
+
true,
|
|
7
27
|
]
|
|
8
28
|
`;
|
|
9
29
|
|
package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { isUuid } from "@lookiero/sty-psp-uuid";
|
|
2
2
|
import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
|
|
3
3
|
import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
-
import {
|
|
5
|
-
returnQuestionHasChildren,
|
|
6
|
-
returnQuestionWithTranslationKey,
|
|
7
|
-
} from "../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
4
|
+
import { returnQuestionHasChildren } from "../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
8
5
|
|
|
9
6
|
interface RecursiveFeedbackForReturnQuestionFunctionArgs {
|
|
10
7
|
readonly feedback: FeedbackProjection;
|
|
@@ -36,9 +33,7 @@ const feedbackForReturnQuestion: RecursiveFeedbackForReturnQuestionFunction = ({
|
|
|
36
33
|
if (feebackReturnQuestionChild) {
|
|
37
34
|
return [
|
|
38
35
|
...acc,
|
|
39
|
-
...(
|
|
40
|
-
? [translate(feebackReturnQuestionChild.translationKey)]
|
|
41
|
-
: []),
|
|
36
|
+
...(feebackReturnQuestionChild.translationKey ? [translate(feebackReturnQuestionChild.translationKey)] : []),
|
|
42
37
|
...feedbackForReturnQuestion({ feedback, returnQuestion: feebackReturnQuestionChild, translate, acc }),
|
|
43
38
|
];
|
|
44
39
|
}
|
|
@@ -22,6 +22,7 @@ const returnQuestionItems: ReturnQuestionItems = {
|
|
|
22
22
|
[ReturnQuestionType.HOST_STACK]: ReturnQuestionFeedbackItem,
|
|
23
23
|
[ReturnQuestionType.TEXTAREA]: ReturnQuestionFeedbackItem,
|
|
24
24
|
[ReturnQuestionType.OPTION]: ReturnQuestionFeedbackItem,
|
|
25
|
+
[ReturnQuestionType.HOST_RADIO_GROUP]: ReturnQuestionFeedbackItem,
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
interface ReturnQuestionsFeedbackProps {
|
package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
ReturnQuestionItems,
|
|
28
28
|
} from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
|
|
29
29
|
import { HostDefaultReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem";
|
|
30
|
+
import { HostLegacyRadioGroupReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem";
|
|
30
31
|
import { HostRadioGroupReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem";
|
|
31
32
|
import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem";
|
|
32
33
|
import { RadioReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem";
|
|
@@ -43,7 +44,8 @@ const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
|
|
|
43
44
|
const returnQuestionItems: ReturnQuestionItems = {
|
|
44
45
|
[ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
|
|
45
46
|
[ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
|
|
46
|
-
[ReturnQuestionType.HOST_SELECT]:
|
|
47
|
+
[ReturnQuestionType.HOST_SELECT]: HostLegacyRadioGroupReturnQuestionItem,
|
|
48
|
+
[ReturnQuestionType.HOST_RADIO_GROUP]: HostRadioGroupReturnQuestionItem,
|
|
47
49
|
[ReturnQuestionType.HOST_STACK]: HostStackReturnQuestionItem,
|
|
48
50
|
[ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
|
|
49
51
|
[ReturnQuestionType.OPTION]: RadioReturnQuestionItem,
|
|
@@ -6,11 +6,15 @@ type ReturnQuestionTypesWithChildren =
|
|
|
6
6
|
| ReturnQuestionType.HOST_DEFAULT
|
|
7
7
|
| ReturnQuestionType.HOST_SELECT
|
|
8
8
|
| ReturnQuestionType.HOST_STACK
|
|
9
|
-
| ReturnQuestionType.HOST_TEXTAREA
|
|
9
|
+
| ReturnQuestionType.HOST_TEXTAREA
|
|
10
|
+
| ReturnQuestionType.HOST_RADIO_GROUP;
|
|
10
11
|
|
|
11
12
|
type ReturnQuestionTypesWithOptionalChildren = ReturnQuestionType.OPTION;
|
|
12
13
|
|
|
13
|
-
type ReturnQuestionTypesWithOptionalTranslationKeys =
|
|
14
|
+
type ReturnQuestionTypesWithOptionalTranslationKeys =
|
|
15
|
+
| ReturnQuestionType.HOST_DEFAULT
|
|
16
|
+
| ReturnQuestionType.HOST_STACK
|
|
17
|
+
| ReturnQuestionType.HOST_RADIO_GROUP;
|
|
14
18
|
|
|
15
19
|
type ReturnQuestionMetadata<RQT extends ReturnQuestionType> = ExcludePropertyIfOptional<
|
|
16
20
|
"metadata",
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ReturnQuestionProjection,
|
|
3
|
-
ReturnQuestionTypesWithChildren,
|
|
4
|
-
ReturnQuestionTypesWithOptionalTranslationKeys,
|
|
5
|
-
} from "./returnQuestion";
|
|
1
|
+
import { ReturnQuestionProjection, ReturnQuestionTypesWithChildren } from "./returnQuestion";
|
|
6
2
|
import { ReturnQuestionType } from "./returnQuestion.constants";
|
|
7
3
|
|
|
8
|
-
const returnQuestionWithTranslationKey = (
|
|
9
|
-
question: ReturnQuestionProjection,
|
|
10
|
-
): question is ReturnQuestionProjection<Exclude<ReturnQuestionType, ReturnQuestionTypesWithOptionalTranslationKeys>> =>
|
|
11
|
-
Boolean(question.translationKey);
|
|
12
|
-
|
|
13
4
|
const returnQuestionHasChildren = (
|
|
14
5
|
question: ReturnQuestionProjection,
|
|
15
6
|
): question is ReturnQuestionProjection<ReturnQuestionTypesWithChildren> =>
|
|
@@ -18,7 +9,8 @@ const returnQuestionHasChildren = (
|
|
|
18
9
|
ReturnQuestionType.HOST_SELECT,
|
|
19
10
|
ReturnQuestionType.HOST_STACK,
|
|
20
11
|
ReturnQuestionType.HOST_TEXTAREA,
|
|
12
|
+
ReturnQuestionType.HOST_RADIO_GROUP,
|
|
21
13
|
ReturnQuestionType.OPTION,
|
|
22
14
|
].includes(question.type);
|
|
23
15
|
|
|
24
|
-
export {
|
|
16
|
+
export { returnQuestionHasChildren };
|