@lookiero/checkout 8.14.0 → 8.17.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/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +1 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.js +1 -2
- 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 +3 -4
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.js +0 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +6 -8
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +0 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +3 -5
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +2 -4
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +10 -22
- 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/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +1 -1
- package/dist/src/projection/returnQuestion/returnQuestion.d.ts +16 -23
- package/dist/src/projection/returnQuestion/returnQuestion.js +11 -1
- 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/react/useListReturnQuestionsByCheckoutItemId.test.ts +9 -4
- package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +117 -72
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.test.tsx +12 -10
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +8 -10
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.test.tsx +9 -10
- package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.ts +1 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.test.tsx +9 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.tsx +3 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +3 -4
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.test.tsx +13 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.tsx +2 -4
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.test.tsx +14 -8
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +7 -13
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +5 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.test.tsx +14 -10
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +5 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +3 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.test.tsx +36 -43
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +7 -10
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +9 -11
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.test.tsx +14 -8
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +4 -6
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +4 -6
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.test.tsx +25 -23
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +3 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.test.tsx +29 -9
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +5 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +4 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +19 -40
- package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +26 -24
- package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +4 -2
- package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +78 -72
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +1 -1
- package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +4 -4
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +2 -2
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +30 -28
- package/src/projection/returnQuestion/listReturnQuestionsByCheckoutItemId.test.ts +12 -4
- package/src/projection/returnQuestion/returnQuestion.ts +20 -42
- package/dist/src/projection/returnQuestion/returnQuestion.constants.d.ts +0 -9
- package/dist/src/projection/returnQuestion/returnQuestion.constants.js +0 -10
- package/dist/src/projection/returnQuestion/returnQuestion.metadata.d.ts +0 -12
- package/dist/src/projection/returnQuestion/returnQuestion.metadata.js +0 -1
- package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +0 -5
- package/dist/src/projection/returnQuestion/returnQuestion.typeguard.js +0 -10
- package/src/projection/returnQuestion/returnQuestion.constants.ts +0 -10
- package/src/projection/returnQuestion/returnQuestion.metadata.ts +0 -17
- package/src/projection/returnQuestion/returnQuestion.typeguard.ts +0 -24
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
ReturnQuestionProjection,
|
|
4
|
+
ReturnQuestionType,
|
|
5
|
+
} from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
6
|
import { feedback as mockFeedback } from "../../../../../../projection/feedback/feedback.mock";
|
|
5
7
|
import { I18nMessages } from "../../../../../i18n/i18n";
|
|
6
8
|
import { render } from "../../../../../test/render";
|
|
@@ -10,34 +12,40 @@ jest.mock("../../behaviors/useReturnQuestionFeedback", () => ({
|
|
|
10
12
|
useReturnQuestionFeedback: () => mockFeedback,
|
|
11
13
|
}));
|
|
12
14
|
|
|
13
|
-
const returnQuestion: ReturnQuestionProjection
|
|
15
|
+
const returnQuestion: ReturnQuestionProjection = {
|
|
14
16
|
id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
name: "size_title",
|
|
18
|
+
placeholder: "",
|
|
19
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
17
20
|
children: [
|
|
18
21
|
{
|
|
19
22
|
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
20
|
-
|
|
23
|
+
name: "size_large",
|
|
24
|
+
placeholder: "",
|
|
21
25
|
type: ReturnQuestionType.OPTION,
|
|
22
26
|
children: [
|
|
23
27
|
{
|
|
24
28
|
id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
name: "",
|
|
30
|
+
placeholder: "",
|
|
31
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
27
32
|
children: [
|
|
28
33
|
{
|
|
29
34
|
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
30
|
-
|
|
35
|
+
name: "size_overall",
|
|
36
|
+
placeholder: "",
|
|
31
37
|
type: ReturnQuestionType.OPTION,
|
|
32
38
|
},
|
|
33
39
|
{
|
|
34
40
|
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
35
|
-
|
|
41
|
+
name: "size_trousers_too_long",
|
|
42
|
+
placeholder: "",
|
|
36
43
|
type: ReturnQuestionType.OPTION,
|
|
37
44
|
},
|
|
38
45
|
{
|
|
39
46
|
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
40
|
-
|
|
47
|
+
name: "size_fit_cut_does_not_fit",
|
|
48
|
+
placeholder: "",
|
|
41
49
|
type: ReturnQuestionType.OPTION,
|
|
42
50
|
},
|
|
43
51
|
],
|
|
@@ -46,17 +54,11 @@ const returnQuestion: ReturnQuestionProjection<ReturnQuestionType.HOST_DEFAULT>
|
|
|
46
54
|
},
|
|
47
55
|
],
|
|
48
56
|
};
|
|
49
|
-
const returnQuestionUnanswered: ReturnQuestionProjection
|
|
57
|
+
const returnQuestionUnanswered: ReturnQuestionProjection = {
|
|
50
58
|
id: "fd7ff4a0-78ed-4c0d-aa4d-64962739c322",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
56
|
-
translationKey: "size_overall",
|
|
57
|
-
type: ReturnQuestionType.OPTION,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
59
|
+
name: "style_title",
|
|
60
|
+
placeholder: "",
|
|
61
|
+
type: ReturnQuestionType.HOST_STACK,
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
describe("ReturnQuestionFeedbackItem component (ReturnQuestions organism)", () => {
|
|
@@ -68,7 +70,7 @@ describe("ReturnQuestionFeedbackItem component (ReturnQuestions organism)", () =
|
|
|
68
70
|
/>,
|
|
69
71
|
);
|
|
70
72
|
|
|
71
|
-
expect(getByText(returnQuestion.
|
|
73
|
+
expect(getByText(returnQuestion.name)).toBeTruthy();
|
|
72
74
|
expect(getByText("size_large / size_overall")).toBeTruthy();
|
|
73
75
|
});
|
|
74
76
|
|
|
@@ -80,7 +82,7 @@ describe("ReturnQuestionFeedbackItem component (ReturnQuestions organism)", () =
|
|
|
80
82
|
/>,
|
|
81
83
|
);
|
|
82
84
|
|
|
83
|
-
expect(getByText(returnQuestionUnanswered.
|
|
85
|
+
expect(getByText(returnQuestionUnanswered.name)).toBeTruthy();
|
|
84
86
|
expect(getByText(I18nMessages.FEEDBACK_UNANSWERED)).toBeTruthy();
|
|
85
87
|
});
|
|
86
88
|
});
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
/* eslint-disable react/prop-types */
|
|
2
1
|
import React, { useCallback } from "react";
|
|
3
2
|
import { View } from "react-native";
|
|
4
3
|
import { Text } from "@lookiero/aurora";
|
|
5
4
|
import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
|
|
6
|
-
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
5
|
import { I18nMessages } from "../../../../../i18n/i18n";
|
|
8
6
|
import { useReturnQuestionFeedback } from "../../behaviors/useReturnQuestionFeedback";
|
|
9
7
|
import { feedbackForReturnQuestion } from "../../util/returnQuestionFeedback";
|
|
10
|
-
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
8
|
+
import { ReturnQuestionItem, ReturnQuestionItemProps } from "../ReturnQuestionItem";
|
|
11
9
|
import { style } from "./ReturnQuestionFeedbackItem.style";
|
|
12
10
|
|
|
13
|
-
const ReturnQuestionFeedbackItem: ReturnQuestionItem
|
|
14
|
-
const titleText = useI18nMessage({ id: returnQuestion.
|
|
11
|
+
const ReturnQuestionFeedbackItem: ReturnQuestionItem = ({ returnQuestion }: ReturnQuestionItemProps) => {
|
|
12
|
+
const titleText = useI18nMessage({ id: returnQuestion.name });
|
|
15
13
|
const unansweredText = useI18nMessage({ id: I18nMessages.FEEDBACK_UNANSWERED });
|
|
16
14
|
|
|
17
15
|
const returnQuestionFeedback = useReturnQuestionFeedback();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { fireEvent } from "@testing-library/react-native";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
ReturnQuestionProjection,
|
|
5
|
+
ReturnQuestionType,
|
|
6
|
+
} from "../../../../../../../projection/returnQuestion/returnQuestion";
|
|
5
7
|
import { render } from "../../../../../test/render";
|
|
6
8
|
import { TextareaReturnQuestionItem } from "./TextareaReturnQuestionItem";
|
|
7
9
|
|
|
@@ -13,13 +15,31 @@ jest.mock("../../behaviors/useReturnQuestionFeedback", () => ({
|
|
|
13
15
|
const returnQuestionParent = {
|
|
14
16
|
id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
|
|
15
17
|
} as ReturnQuestionProjection;
|
|
16
|
-
const returnQuestion: ReturnQuestionProjection
|
|
17
|
-
id: "
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const returnQuestion: ReturnQuestionProjection = {
|
|
19
|
+
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
20
|
+
name: "size_large",
|
|
21
|
+
placeholder: "",
|
|
22
|
+
type: ReturnQuestionType.OPTION,
|
|
23
|
+
children: [
|
|
24
|
+
{
|
|
25
|
+
id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
26
|
+
name: "size_overall",
|
|
27
|
+
placeholder: "",
|
|
28
|
+
type: ReturnQuestionType.OPTION,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "85e84a77-461c-41e6-8544-95b5294d0b80",
|
|
32
|
+
name: "size_trousers_too_long",
|
|
33
|
+
placeholder: "",
|
|
34
|
+
type: ReturnQuestionType.OPTION,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "29441d25-8d9f-471e-a13e-a03f61c88091",
|
|
38
|
+
name: "size_fit_cut_does_not_fit",
|
|
39
|
+
placeholder: "",
|
|
40
|
+
type: ReturnQuestionType.OPTION,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
23
43
|
};
|
|
24
44
|
|
|
25
45
|
describe("TextareaReturnQuestionItem component (ReturnQuestions organism)", () => {
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
/* eslint-disable react/prop-types */
|
|
2
1
|
import React, { useCallback, useMemo } from "react";
|
|
3
2
|
import { View } from "@lookiero/aurora";
|
|
4
3
|
import { useIntl } from "@lookiero/i18n-react";
|
|
5
|
-
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
6
4
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
7
5
|
import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
|
|
8
|
-
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
6
|
+
import { ReturnQuestionItem, ReturnQuestionItemProps } from "../ReturnQuestionItem";
|
|
9
7
|
import { style } from "./TextareaReturnQuestionItem.style";
|
|
10
8
|
|
|
11
|
-
const TextareaReturnQuestionItem: ReturnQuestionItem
|
|
9
|
+
const TextareaReturnQuestionItem: ReturnQuestionItem = ({
|
|
12
10
|
returnQuestion,
|
|
13
11
|
returnQuestionParent,
|
|
14
12
|
testID,
|
|
15
|
-
}) => {
|
|
13
|
+
}: ReturnQuestionItemProps) => {
|
|
16
14
|
const { formatMessage } = useIntl();
|
|
17
15
|
|
|
18
16
|
const placeholderText = useMemo(
|
|
19
|
-
() => (returnQuestion.
|
|
20
|
-
[formatMessage, returnQuestion.
|
|
17
|
+
() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""),
|
|
18
|
+
[formatMessage, returnQuestion.placeholder],
|
|
21
19
|
);
|
|
22
20
|
|
|
23
21
|
const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
|
|
@@ -13,15 +13,14 @@ exports[`returnQuestionFeedback utils return the deepest returnQuestion with fee
|
|
|
13
13
|
"children": [
|
|
14
14
|
{
|
|
15
15
|
"id": "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
"translationKey": "comment_textarea",
|
|
16
|
+
"name": "comment_textarea",
|
|
17
|
+
"placeholder": "comment_textarea_placeholder",
|
|
20
18
|
"type": "TEXTAREA",
|
|
21
19
|
},
|
|
22
20
|
],
|
|
23
21
|
"id": "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
|
|
24
|
-
"
|
|
22
|
+
"name": "comment_title",
|
|
23
|
+
"placeholder": "",
|
|
25
24
|
"type": "HOST_TEXTAREA",
|
|
26
25
|
},
|
|
27
26
|
false,
|
package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
+
import { isUuid } from "@lookiero/sty-psp-uuid";
|
|
1
2
|
import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
|
|
2
3
|
import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
3
|
-
import {
|
|
4
|
-
returnQuestionHasChildren,
|
|
5
|
-
returnQuestionWithTranslationKey,
|
|
6
|
-
} from "../../../../../../projection/returnQuestion/returnQuestion.typeguard";
|
|
7
|
-
|
|
8
|
-
type Uuid = string;
|
|
9
|
-
|
|
10
|
-
const REGEX =
|
|
11
|
-
/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
12
|
-
const isUuid = (value: string): value is Uuid => {
|
|
13
|
-
return typeof value === "string" && REGEX.test(value);
|
|
14
|
-
};
|
|
15
4
|
|
|
16
5
|
interface RecursiveFeedbackForReturnQuestionFunctionArgs {
|
|
17
6
|
readonly feedback: FeedbackProjection;
|
|
@@ -36,16 +25,14 @@ const feedbackForReturnQuestion: RecursiveFeedbackForReturnQuestionFunction = ({
|
|
|
36
25
|
const returnQuestionFeedback = feedback[returnQuestionId];
|
|
37
26
|
|
|
38
27
|
if (isUuid(returnQuestionFeedback as string)) {
|
|
39
|
-
const feebackReturnQuestionChild =
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
const feebackReturnQuestionChild = returnQuestion.children?.find(
|
|
29
|
+
(childReturnQuestion) => childReturnQuestion.id === returnQuestionFeedback,
|
|
30
|
+
);
|
|
42
31
|
|
|
43
32
|
if (feebackReturnQuestionChild) {
|
|
44
33
|
return [
|
|
45
34
|
...acc,
|
|
46
|
-
|
|
47
|
-
? [translate(feebackReturnQuestionChild.translationKey)]
|
|
48
|
-
: []),
|
|
35
|
+
translate(feebackReturnQuestionChild?.name),
|
|
49
36
|
...feedbackForReturnQuestion({ feedback, returnQuestion: feebackReturnQuestionChild, translate, acc }),
|
|
50
37
|
];
|
|
51
38
|
}
|
|
@@ -57,15 +44,13 @@ const feedbackForReturnQuestion: RecursiveFeedbackForReturnQuestionFunction = ({
|
|
|
57
44
|
}
|
|
58
45
|
|
|
59
46
|
return (
|
|
60
|
-
(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
)) ||
|
|
68
|
-
[]
|
|
47
|
+
returnQuestion.children?.reduce(
|
|
48
|
+
(acc, childReturnQuestion) => [
|
|
49
|
+
...acc,
|
|
50
|
+
...feedbackForReturnQuestion({ feedback, returnQuestion: childReturnQuestion, translate, acc }),
|
|
51
|
+
],
|
|
52
|
+
[] as string[],
|
|
53
|
+
) || []
|
|
69
54
|
);
|
|
70
55
|
};
|
|
71
56
|
|
|
@@ -92,9 +77,9 @@ const deepestReturnQuestionWithFeedbackForReturnQuestion: RecursiveDeepestReturn
|
|
|
92
77
|
const returnQuestionFeedback = feedback[returnQuestionId];
|
|
93
78
|
|
|
94
79
|
if (isUuid(returnQuestionFeedback as string)) {
|
|
95
|
-
const feebackReturnQuestionChild =
|
|
96
|
-
|
|
97
|
-
|
|
80
|
+
const feebackReturnQuestionChild = returnQuestion.children?.find(
|
|
81
|
+
(childReturnQuestion) => childReturnQuestion.id === returnQuestionFeedback,
|
|
82
|
+
);
|
|
98
83
|
|
|
99
84
|
if (feebackReturnQuestionChild) {
|
|
100
85
|
return deepestReturnQuestionWithFeedbackForReturnQuestion({
|
|
@@ -110,11 +95,9 @@ const deepestReturnQuestionWithFeedbackForReturnQuestion: RecursiveDeepestReturn
|
|
|
110
95
|
return [returnQuestion, false];
|
|
111
96
|
}
|
|
112
97
|
|
|
113
|
-
const feebackReturnQuestionChild =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Object.keys(feedback).find((id) => id === childReturnQuestion.id),
|
|
117
|
-
);
|
|
98
|
+
const feebackReturnQuestionChild = returnQuestion.children?.find((childReturnQuestion) =>
|
|
99
|
+
Object.keys(feedback).find((id) => id === childReturnQuestion.id),
|
|
100
|
+
);
|
|
118
101
|
|
|
119
102
|
if (feebackReturnQuestionChild) {
|
|
120
103
|
return deepestReturnQuestionWithFeedbackForReturnQuestion({
|
|
@@ -124,11 +107,7 @@ const deepestReturnQuestionWithFeedbackForReturnQuestion: RecursiveDeepestReturn
|
|
|
124
107
|
});
|
|
125
108
|
}
|
|
126
109
|
|
|
127
|
-
|
|
128
|
-
returnQuestionHasChildren(returnQuestion) && returnQuestion.children && returnQuestion.children.length > 0,
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
return [deepestReturnQuestion, !hasChildren];
|
|
110
|
+
return [deepestReturnQuestion, !returnQuestion.children || returnQuestion.children.length === 0];
|
|
132
111
|
};
|
|
133
112
|
|
|
134
113
|
export { feedbackForReturnQuestion, deepestReturnQuestionWithFeedbackForReturnQuestion };
|
|
@@ -77,7 +77,8 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
|
|
|
77
77
|
style={{}}
|
|
78
78
|
>
|
|
79
79
|
<View
|
|
80
|
-
|
|
80
|
+
collapsable={false}
|
|
81
|
+
jestAnimatedStyle={
|
|
81
82
|
{
|
|
82
83
|
"value": {
|
|
83
84
|
"transform": [
|
|
@@ -88,7 +89,6 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
|
|
|
88
89
|
},
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
collapsable={false}
|
|
92
92
|
style={
|
|
93
93
|
{
|
|
94
94
|
"flex": 1,
|
|
@@ -105,16 +105,17 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
|
|
|
105
105
|
testID="carousel-track"
|
|
106
106
|
>
|
|
107
107
|
<View
|
|
108
|
+
collapsable={false}
|
|
109
|
+
jestAnimatedStyle={
|
|
110
|
+
{
|
|
111
|
+
"value": {},
|
|
112
|
+
}
|
|
113
|
+
}
|
|
108
114
|
style={
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
undefined,
|
|
114
|
-
{
|
|
115
|
-
"width": 300,
|
|
116
|
-
},
|
|
117
|
-
]
|
|
115
|
+
{
|
|
116
|
+
"flex": 1,
|
|
117
|
+
"width": 300,
|
|
118
|
+
}
|
|
118
119
|
}
|
|
119
120
|
testID="carousel-item"
|
|
120
121
|
>
|
|
@@ -231,14 +232,14 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
|
|
|
231
232
|
</View>
|
|
232
233
|
</View>
|
|
233
234
|
<Image
|
|
234
|
-
|
|
235
|
+
collapsable={false}
|
|
236
|
+
jestAnimatedStyle={
|
|
235
237
|
{
|
|
236
238
|
"value": {
|
|
237
239
|
"opacity": 0,
|
|
238
240
|
},
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
|
-
collapsable={false}
|
|
242
243
|
onLoad={[Function]}
|
|
243
244
|
resizeMode="stretch"
|
|
244
245
|
source={
|
|
@@ -263,16 +264,17 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
|
|
|
263
264
|
</View>
|
|
264
265
|
</View>
|
|
265
266
|
<View
|
|
267
|
+
collapsable={false}
|
|
268
|
+
jestAnimatedStyle={
|
|
269
|
+
{
|
|
270
|
+
"value": {},
|
|
271
|
+
}
|
|
272
|
+
}
|
|
266
273
|
style={
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
undefined,
|
|
272
|
-
{
|
|
273
|
-
"width": 300,
|
|
274
|
-
},
|
|
275
|
-
]
|
|
274
|
+
{
|
|
275
|
+
"flex": 1,
|
|
276
|
+
"width": 300,
|
|
277
|
+
}
|
|
276
278
|
}
|
|
277
279
|
testID="carousel-item"
|
|
278
280
|
>
|
|
@@ -389,14 +391,14 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
|
|
|
389
391
|
</View>
|
|
390
392
|
</View>
|
|
391
393
|
<Image
|
|
392
|
-
|
|
394
|
+
collapsable={false}
|
|
395
|
+
jestAnimatedStyle={
|
|
393
396
|
{
|
|
394
397
|
"value": {
|
|
395
398
|
"opacity": 0,
|
|
396
399
|
},
|
|
397
400
|
}
|
|
398
401
|
}
|
|
399
|
-
collapsable={false}
|
|
400
402
|
onLoad={[Function]}
|
|
401
403
|
resizeMode="stretch"
|
|
402
404
|
source={
|
|
@@ -2,8 +2,10 @@ import React, { FC } from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { ButtonIcon, Text } from "@lookiero/aurora";
|
|
4
4
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
ReturnQuestionProjection,
|
|
7
|
+
ReturnQuestionType,
|
|
8
|
+
} from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
7
9
|
import { ReturnQuestions } from "../../../../components/organisms/returnQuestions/ReturnQuestions";
|
|
8
10
|
import {
|
|
9
11
|
ReturnQuestionItemProvider,
|