@lookiero/checkout 11.3.0 → 11.3.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/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +15 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.style.js +13 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.style.ts +24 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +19 -6
- package/src/infrastructure/ui/views/return/Return.test.tsx +2 -1
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.test.tsx +2 -0
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { Pressable } from "react-native";
|
|
4
|
-
import { Text } from "@lookiero/aurora";
|
|
4
|
+
import { Text as AuroraText } from "@lookiero/aurora";
|
|
5
5
|
import { useI18n } from "@lookiero/i18n-react";
|
|
6
6
|
import { Checkbox } from "@lookiero/sty-psp-ui";
|
|
7
|
+
import { Tradename } from "@lookiero/sty-sp-tradename";
|
|
8
|
+
import { useStaticInfo } from "../../../../../hooks/useStaticInfo";
|
|
7
9
|
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
8
10
|
import { useReturnQuestionFeedback, useReturnQuestionFeedbackForReturnQuestion, } from "../../behaviors/useReturnQuestionFeedback";
|
|
9
11
|
import { deepestReturnQuestionWithFeedbackForReturnQuestion, feedbackForReturnQuestion, } from "../../util/returnQuestionFeedback";
|
|
10
12
|
import { ModalOptionReturnQuestionItems } from "../modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems";
|
|
11
13
|
import { style as radioReturnQuestionItemStyle } from "./RadioReturnQuestionItem.style";
|
|
14
|
+
const TEXT = {
|
|
15
|
+
[Tradename.LOOKIERO]: (props) => React.createElement(AuroraText, { level: 1, detail: true, ...props }),
|
|
16
|
+
[Tradename.OUTFITTERY]: (props) => React.createElement(AuroraText, { level: 3, ...props }),
|
|
17
|
+
};
|
|
12
18
|
const RadioReturnQuestionItem = ({ returnQuestion, returnQuestionParent, testID, portalHostName, }) => {
|
|
19
|
+
const { tradename } = useStaticInfo();
|
|
13
20
|
const style = useMemo(() => radioReturnQuestionItemStyle(), []);
|
|
14
21
|
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
15
22
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -47,10 +54,15 @@ const RadioReturnQuestionItem = ({ returnQuestion, returnQuestionParent, testID,
|
|
|
47
54
|
* This logic is for closing the Modal when its children has been answered.
|
|
48
55
|
*/
|
|
49
56
|
const checked = returnQuestion.id === feedbackId;
|
|
57
|
+
const Text = useMemo(() => TEXT[tradename], [tradename]);
|
|
50
58
|
return (React.createElement(React.Fragment, null,
|
|
51
|
-
React.createElement(Pressable, { accessibilityLabel: "radio-return-question-item", accessibilityState: { checked },
|
|
59
|
+
React.createElement(Pressable, { accessibilityLabel: "radio-return-question-item", accessibilityState: { checked }, testID: testID, style: [
|
|
60
|
+
style.wrapper,
|
|
61
|
+
tradename === Tradename.LOOKIERO && style.wrapperLookiero,
|
|
62
|
+
tradename === Tradename.LOOKIERO && checked && style.wrapperLookieroChecked,
|
|
63
|
+
], accessible: true, onPress: handleOnPress },
|
|
52
64
|
React.createElement(Checkbox, { checked: checked }),
|
|
53
|
-
React.createElement(Text, {
|
|
65
|
+
React.createElement(Text, { style: style.text }, inputValue ? `${optionText} / ${inputValue}` : `${optionText}`)),
|
|
54
66
|
hasChildren ? (React.createElement(ModalOptionReturnQuestionItems, { portalHostName: portalHostName, returnQuestion: returnQuestion, returnQuestionParent: returnQuestion, visible: modalVisible, onClose: handleOnModalClose })) : null));
|
|
55
67
|
};
|
|
56
68
|
export { RadioReturnQuestionItem };
|
|
@@ -10,5 +10,17 @@ declare const style: () => {
|
|
|
10
10
|
flexDirection: "row";
|
|
11
11
|
marginVertical: number;
|
|
12
12
|
};
|
|
13
|
+
wrapperLookiero: {
|
|
14
|
+
borderColor: string;
|
|
15
|
+
borderRadius: number;
|
|
16
|
+
borderWidth: number;
|
|
17
|
+
marginVertical: number;
|
|
18
|
+
padding: number;
|
|
19
|
+
};
|
|
20
|
+
wrapperLookieroChecked: {
|
|
21
|
+
borderColor: string;
|
|
22
|
+
borderWidth: number;
|
|
23
|
+
padding: number;
|
|
24
|
+
};
|
|
13
25
|
};
|
|
14
26
|
export { style };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
3
|
const style = () => {
|
|
4
|
-
const { colorText, space3, space4 } = theme();
|
|
4
|
+
const { borderWidth1, borderWidth2, borderRadius3, colorBorderInteractive, colorBorderInputFocus, colorText, space025, space1, space3, space4, } = theme();
|
|
5
5
|
return StyleSheet.create({
|
|
6
6
|
text: {
|
|
7
7
|
color: colorText,
|
|
@@ -14,6 +14,18 @@ const style = () => {
|
|
|
14
14
|
flexDirection: "row",
|
|
15
15
|
marginVertical: space3,
|
|
16
16
|
},
|
|
17
|
+
wrapperLookiero: {
|
|
18
|
+
borderColor: colorBorderInteractive,
|
|
19
|
+
borderRadius: borderRadius3,
|
|
20
|
+
borderWidth: borderWidth1,
|
|
21
|
+
marginVertical: space1,
|
|
22
|
+
padding: space4,
|
|
23
|
+
},
|
|
24
|
+
wrapperLookieroChecked: {
|
|
25
|
+
borderColor: colorBorderInputFocus,
|
|
26
|
+
borderWidth: borderWidth2,
|
|
27
|
+
padding: space4 - space025,
|
|
28
|
+
},
|
|
17
29
|
});
|
|
18
30
|
};
|
|
19
31
|
export { style };
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "11.3.
|
|
1
|
+
export declare const VERSION = "11.3.1";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "11.3.
|
|
1
|
+
export const VERSION = "11.3.1";
|
package/package.json
CHANGED
|
@@ -2,7 +2,18 @@ import { StyleSheet } from "react-native";
|
|
|
2
2
|
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
3
|
|
|
4
4
|
const style = () => {
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
borderWidth1,
|
|
7
|
+
borderWidth2,
|
|
8
|
+
borderRadius3,
|
|
9
|
+
colorBorderInteractive,
|
|
10
|
+
colorBorderInputFocus,
|
|
11
|
+
colorText,
|
|
12
|
+
space025,
|
|
13
|
+
space1,
|
|
14
|
+
space3,
|
|
15
|
+
space4,
|
|
16
|
+
} = theme();
|
|
6
17
|
|
|
7
18
|
return StyleSheet.create({
|
|
8
19
|
text: {
|
|
@@ -16,6 +27,18 @@ const style = () => {
|
|
|
16
27
|
flexDirection: "row",
|
|
17
28
|
marginVertical: space3,
|
|
18
29
|
},
|
|
30
|
+
wrapperLookiero: {
|
|
31
|
+
borderColor: colorBorderInteractive,
|
|
32
|
+
borderRadius: borderRadius3,
|
|
33
|
+
borderWidth: borderWidth1,
|
|
34
|
+
marginVertical: space1,
|
|
35
|
+
padding: space4,
|
|
36
|
+
},
|
|
37
|
+
wrapperLookieroChecked: {
|
|
38
|
+
borderColor: colorBorderInputFocus,
|
|
39
|
+
borderWidth: borderWidth2,
|
|
40
|
+
padding: space4 - space025,
|
|
41
|
+
},
|
|
19
42
|
});
|
|
20
43
|
};
|
|
21
44
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
|
-
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import React, { FC, useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { Pressable } from "react-native";
|
|
4
|
-
import { Text } from "@lookiero/aurora";
|
|
4
|
+
import { Text as AuroraText, TextProperties } from "@lookiero/aurora";
|
|
5
5
|
import { useI18n } from "@lookiero/i18n-react";
|
|
6
6
|
import { Checkbox } from "@lookiero/sty-psp-ui";
|
|
7
|
+
import { Tradename } from "@lookiero/sty-sp-tradename";
|
|
7
8
|
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
9
|
+
import { useStaticInfo } from "../../../../../hooks/useStaticInfo";
|
|
8
10
|
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
9
11
|
import {
|
|
10
12
|
useReturnQuestionFeedback,
|
|
@@ -18,12 +20,19 @@ import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
|
18
20
|
import { ModalOptionReturnQuestionItems } from "../modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems";
|
|
19
21
|
import { style as radioReturnQuestionItemStyle } from "./RadioReturnQuestionItem.style";
|
|
20
22
|
|
|
23
|
+
const TEXT: Record<Tradename, FC<TextProperties>> = {
|
|
24
|
+
[Tradename.LOOKIERO]: (props) => <AuroraText level={1} detail {...props} />,
|
|
25
|
+
[Tradename.OUTFITTERY]: (props) => <AuroraText level={3} {...props} />,
|
|
26
|
+
};
|
|
27
|
+
|
|
21
28
|
const RadioReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = ({
|
|
22
29
|
returnQuestion,
|
|
23
30
|
returnQuestionParent,
|
|
24
31
|
testID,
|
|
25
32
|
portalHostName,
|
|
26
33
|
}) => {
|
|
34
|
+
const { tradename } = useStaticInfo();
|
|
35
|
+
|
|
27
36
|
const style = useMemo(() => radioReturnQuestionItemStyle(), []);
|
|
28
37
|
|
|
29
38
|
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
@@ -78,21 +87,25 @@ const RadioReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = (
|
|
|
78
87
|
|
|
79
88
|
const checked = returnQuestion.id === feedbackId;
|
|
80
89
|
|
|
90
|
+
const Text = useMemo(() => TEXT[tradename], [tradename]);
|
|
91
|
+
|
|
81
92
|
return (
|
|
82
93
|
<>
|
|
83
94
|
<Pressable
|
|
84
95
|
accessibilityLabel="radio-return-question-item"
|
|
85
96
|
accessibilityState={{ checked }}
|
|
86
|
-
style={style.wrapper}
|
|
87
97
|
testID={testID}
|
|
98
|
+
style={[
|
|
99
|
+
style.wrapper,
|
|
100
|
+
tradename === Tradename.LOOKIERO && style.wrapperLookiero,
|
|
101
|
+
tradename === Tradename.LOOKIERO && checked && style.wrapperLookieroChecked,
|
|
102
|
+
]}
|
|
88
103
|
accessible
|
|
89
104
|
onPress={handleOnPress}
|
|
90
105
|
>
|
|
91
106
|
<Checkbox checked={checked} />
|
|
92
107
|
|
|
93
|
-
<Text
|
|
94
|
-
{inputValue ? `${optionText} / ${inputValue}` : `${optionText}`}
|
|
95
|
-
</Text>
|
|
108
|
+
<Text style={style.text}>{inputValue ? `${optionText} / ${inputValue}` : `${optionText}`}</Text>
|
|
96
109
|
</Pressable>
|
|
97
110
|
|
|
98
111
|
{hasChildren ? (
|
|
@@ -3,6 +3,7 @@ import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
|
3
3
|
import { Country } from "@lookiero/sty-psp-locale";
|
|
4
4
|
import { Segment } from "@lookiero/sty-psp-segment";
|
|
5
5
|
import { DummyLayout } from "@lookiero/sty-psp-ui";
|
|
6
|
+
import { Tradename } from "@lookiero/sty-sp-tradename";
|
|
6
7
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
8
|
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
8
9
|
import { checkout } from "../../../projection/checkout/checkout.mock";
|
|
@@ -25,7 +26,7 @@ const mockCheckout = checkout({
|
|
|
25
26
|
const mockFirstCheckoutItemId = mockCheckout.items[0]?.id;
|
|
26
27
|
|
|
27
28
|
jest.mock("../../hooks/useStaticInfo", () => ({
|
|
28
|
-
useStaticInfo: () => ({ customer: { customerId, country, segment } }),
|
|
29
|
+
useStaticInfo: () => ({ customer: { customerId, country, segment }, tradename: Tradename.LOOKIERO }),
|
|
29
30
|
}));
|
|
30
31
|
|
|
31
32
|
jest.mock("react-router-native", () => ({
|
|
@@ -5,6 +5,7 @@ import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
|
5
5
|
import { Country } from "@lookiero/sty-psp-locale";
|
|
6
6
|
import { Segment } from "@lookiero/sty-psp-segment";
|
|
7
7
|
import { DummyLayout } from "@lookiero/sty-psp-ui";
|
|
8
|
+
import { Tradename } from "@lookiero/sty-sp-tradename";
|
|
8
9
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
9
10
|
import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
10
11
|
import { useReturnCheckoutItem } from "../../../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
@@ -55,6 +56,7 @@ jest.mock("../../../../../tracking/useTrackReturnItem", () => ({
|
|
|
55
56
|
jest.mock("../../../../hooks/useStaticInfo", () => ({
|
|
56
57
|
useStaticInfo: () => ({
|
|
57
58
|
basePath: "",
|
|
59
|
+
tradename: Tradename.LOOKIERO,
|
|
58
60
|
}),
|
|
59
61
|
}));
|
|
60
62
|
|