@lookiero/checkout 12.4.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/ExpoRoot.js +1 -1
- package/dist/src/domain/checkoutItem/model/currency.d.ts +6 -0
- package/dist/src/domain/checkoutItem/model/currency.js +7 -0
- package/dist/src/domain/uiSetting/command/updateUiSetting.d.ts +15 -0
- package/dist/src/domain/uiSetting/command/updateUiSetting.js +10 -0
- package/dist/src/domain/uiSetting/model/uiSetting.d.ts +9 -0
- package/dist/src/domain/uiSetting/model/uiSetting.js +11 -0
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.d.ts +15 -0
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.js +8 -0
- package/dist/src/domain/uiSetting/model/uiSettings.d.ts +7 -0
- package/dist/src/domain/uiSetting/model/uiSettings.js +1 -0
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +17 -0
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.js +20 -0
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +18 -0
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +22 -0
- package/dist/src/infrastructure/integration/useRedirect.d.ts +7 -0
- package/dist/src/infrastructure/integration/useRedirect.js +1 -0
- package/dist/src/infrastructure/persistence/asyncStorageStorage.d.ts +5 -0
- package/dist/src/infrastructure/persistence/asyncStorageStorage.js +7 -0
- package/dist/src/infrastructure/persistence/uiSettingData.d.ts +6 -0
- package/dist/src/infrastructure/persistence/uiSettingData.js +1 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +3 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +103 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.d.ts +12 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +10 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.d.ts +10 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.js +9 -0
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +47 -58
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.d.ts +10 -0
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +11 -0
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.d.ts +13 -0
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.js +15 -0
- 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/hooks/useSubmitCheckout.d.ts +27 -0
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +97 -0
- package/dist/src/infrastructure/ui/routing/useBasePath.d.ts +8 -0
- package/dist/src/infrastructure/ui/routing/useBasePath.js +9 -0
- package/dist/src/infrastructure/ui/settings/UISettings.d.ts +3 -0
- package/dist/src/infrastructure/ui/settings/UISettings.js +4 -0
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.d.ts +12 -0
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +90 -0
- 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/checkoutQuestion/checkoutQuestion.d.ts +18 -0
- package/dist/src/projection/checkoutQuestion/checkoutQuestion.js +10 -0
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.d.ts +25 -0
- package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.js +8 -0
- 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/projection/uiSetting/viewUiSettingByKey.d.ts +29 -0
- package/dist/src/projection/uiSetting/viewUiSettingByKey.js +8 -0
- 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 -1
- 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
|
@@ -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 };
|