@lookiero/checkout 7.0.0-beta.0 → 7.0.1-beta.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.
Files changed (48) hide show
  1. package/dist/src/ExpoRoot.js +1 -8
  2. package/dist/src/infrastructure/ab-testing/kameleoonEnvironment.d.ts +2 -6
  3. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -10
  4. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.d.ts +1 -7
  5. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.js +1 -7
  6. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -7
  7. package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.js +5 -1
  8. package/dist/src/infrastructure/ui/routing/Routing.js +2 -4
  9. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +4 -4
  10. package/dist/src/infrastructure/ui/views/feedback/Feedback.d.ts +2 -2
  11. package/dist/src/infrastructure/ui/views/item/Item.js +4 -33
  12. package/dist/src/infrastructure/ui/views/return/Return.js +8 -127
  13. package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +5 -7
  14. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +15 -0
  15. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +112 -0
  16. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +40 -0
  17. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +43 -0
  18. package/dist/src/infrastructure/ui/views/summary/Summary.js +4 -4
  19. package/dist/src/version.d.ts +1 -1
  20. package/dist/src/version.js +1 -1
  21. package/package.json +1 -1
  22. package/src/ExpoRoot.tsx +1 -8
  23. package/src/infrastructure/ab-testing/kameleoonEnvironment.ts +3 -7
  24. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.ts +1 -7
  25. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.test.tsx +0 -5
  26. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +2 -17
  27. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.test.tsx +0 -5
  28. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +11 -20
  29. package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +10 -0
  30. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +7 -1
  31. package/src/infrastructure/ui/routing/Routing.tsx +3 -6
  32. package/src/infrastructure/ui/views/checkout/Checkout.tsx +6 -6
  33. package/src/infrastructure/ui/views/feedback/Feedback.tsx +2 -2
  34. package/src/infrastructure/ui/views/item/Item.test.tsx +6 -62
  35. package/src/infrastructure/ui/views/item/Item.tsx +5 -48
  36. package/src/infrastructure/ui/views/return/Return.test.tsx +54 -0
  37. package/src/infrastructure/ui/views/return/Return.tsx +12 -200
  38. package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.test.tsx +32 -0
  39. package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.tsx +12 -7
  40. package/src/infrastructure/ui/views/return/components/productVariantPreview/__snapshots__/ProductVariantPreview.test.tsx.snap +221 -0
  41. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.test.tsx +95 -0
  42. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +184 -0
  43. package/src/infrastructure/ui/views/summary/Summary.tsx +6 -6
  44. package/src/infrastructure/ui/hooks/useNewFeedbackExperiment.test.tsx +0 -84
  45. package/src/infrastructure/ui/hooks/useNewFeedbackExperiment.tsx +0 -82
  46. package/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +0 -18
  47. package/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.tsx +0 -79
  48. /package/src/infrastructure/ui/views/return/{Return.style.ts → components/returnQuestionsForm/ReturnQuestionsForm.style.ts} +0 -0
@@ -0,0 +1,221 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ProductVariantPreview matches the snapshot 1`] = `
4
+ <View
5
+ style={
6
+ [
7
+ {
8
+ "backgroundColor": "#FFFFFF",
9
+ "flex": 1,
10
+ },
11
+ ]
12
+ }
13
+ >
14
+ <View
15
+ style={
16
+ [
17
+ {
18
+ "alignSelf": "center",
19
+ "left": 0,
20
+ "marginHorizontal": "auto",
21
+ "position": "absolute",
22
+ "right": 0,
23
+ "top": 0,
24
+ "width": "100%",
25
+ "zIndex": 5,
26
+ },
27
+ ]
28
+ }
29
+ >
30
+ <RCTSafeAreaView />
31
+ </View>
32
+ <View
33
+ style={
34
+ [
35
+ false,
36
+ {
37
+ "backgroundColor": "#FFFFFF",
38
+ "flexDirection": "row",
39
+ "padding": 16,
40
+ },
41
+ ]
42
+ }
43
+ testID="product-variant-preview"
44
+ >
45
+ <View
46
+ style={
47
+ [
48
+ {
49
+ "alignItems": "center",
50
+ "flexBasis": "auto",
51
+ "flexWrap": "wrap",
52
+ "justifyContent": "flex-start",
53
+ "width": "100%",
54
+ },
55
+ {
56
+ "paddingHorizontal": 24,
57
+ },
58
+ {
59
+ "flex": 1,
60
+ "justifyContent": "center",
61
+ },
62
+ ]
63
+ }
64
+ >
65
+ <View
66
+ style={
67
+ [
68
+ {
69
+ "width": "100%",
70
+ },
71
+ undefined,
72
+ {
73
+ "flexDirection": "row",
74
+ },
75
+ ]
76
+ }
77
+ >
78
+ <Image
79
+ resizeMode="stretch"
80
+ source={
81
+ {
82
+ "uri": "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg?w=70&f=auto",
83
+ }
84
+ }
85
+ style={
86
+ {
87
+ "borderRadius": 4,
88
+ "width": 35,
89
+ }
90
+ }
91
+ testID="product-variant-image"
92
+ />
93
+ <View
94
+ style={
95
+ [
96
+ {
97
+ "flex": 1,
98
+ "marginLeft": 8,
99
+ },
100
+ ]
101
+ }
102
+ >
103
+ <Text
104
+ allowFontScaling={false}
105
+ selectable={false}
106
+ style={
107
+ [
108
+ {
109
+ "color": "#837C7C",
110
+ "fontFamily": "AreaNormal-Semibold",
111
+ "fontSize": 12,
112
+ "letterSpacing": 0.1,
113
+ "lineHeight": 16,
114
+ "paddingBottom": 0,
115
+ "paddingLeft": 0,
116
+ "paddingRight": 0,
117
+ "paddingTop": 0,
118
+ },
119
+ ]
120
+ }
121
+ >
122
+ CKS
123
+ </Text>
124
+ <Text
125
+ allowFontScaling={false}
126
+ selectable={false}
127
+ style={
128
+ [
129
+ {
130
+ "color": "#0C0A0A",
131
+ "fontFamily": "AreaNormal-Semibold",
132
+ "fontSize": 12,
133
+ "letterSpacing": 0.1,
134
+ "lineHeight": 16,
135
+ "paddingBottom": 0,
136
+ "paddingLeft": 0,
137
+ "paddingRight": 0,
138
+ "paddingTop": 0,
139
+ },
140
+ ]
141
+ }
142
+ >
143
+ Sari Tshirt lines
144
+ </Text>
145
+ <Text
146
+ allowFontScaling={false}
147
+ selectable={false}
148
+ style={
149
+ [
150
+ {
151
+ "color": "#837C7C",
152
+ "fontFamily": "AreaNormal-Semibold",
153
+ "fontSize": 12,
154
+ "letterSpacing": 0.1,
155
+ "lineHeight": 16,
156
+ "paddingBottom": 0,
157
+ "paddingLeft": 0,
158
+ "paddingRight": 0,
159
+ "paddingTop": 0,
160
+ },
161
+ ]
162
+ }
163
+ >
164
+ item.size M
165
+ </Text>
166
+ </View>
167
+ <View
168
+ style={
169
+ [
170
+ {
171
+ "justifyContent": "flex-end",
172
+ },
173
+ ]
174
+ }
175
+ >
176
+ <View
177
+ style={
178
+ {
179
+ "flexDirection": "row",
180
+ }
181
+ }
182
+ testID="price"
183
+ >
184
+ <View
185
+ style={
186
+ {
187
+ "alignItems": "flex-end",
188
+ "marginLeft": 8,
189
+ }
190
+ }
191
+ >
192
+ <Text
193
+ allowFontScaling={false}
194
+ selectable={false}
195
+ style={
196
+ [
197
+ {
198
+ "color": "#0C0A0A",
199
+ "fontFamily": "AreaNormal-Semibold",
200
+ "fontSize": 13,
201
+ "letterSpacing": 0.1,
202
+ "lineHeight": 17,
203
+ "paddingBottom": 0,
204
+ "paddingLeft": 0,
205
+ "paddingRight": 0,
206
+ "paddingTop": 4,
207
+ },
208
+ ]
209
+ }
210
+ testID="price-text"
211
+ >
212
+ €39.99
213
+ </Text>
214
+ </View>
215
+ </View>
216
+ </View>
217
+ </View>
218
+ </View>
219
+ </View>
220
+ </View>
221
+ `;
@@ -0,0 +1,95 @@
1
+ import { fireEvent } from "@testing-library/react-native";
2
+ import React from "react";
3
+ import { generatePath } from "react-router-native";
4
+ import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
5
+ import { Country } from "@lookiero/sty-psp-locale";
6
+ import { Segment } from "@lookiero/sty-psp-segment";
7
+ import { DummyLayout } from "@lookiero/sty-psp-ui";
8
+ import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
9
+ import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
10
+ import { useReturnCheckoutItem } from "../../../../../domain/checkoutItem/react/useReturnCheckoutItem";
11
+ import { checkout } from "../../../../../projection/checkout/checkout.mock";
12
+ import { useListReturnQuestionsByCheckoutItemId } from "../../../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
13
+ import { returnQuestions as mockReturnQuestions } from "../../../../../projection/returnQuestion/returnQuestions.mock";
14
+ import { ReturnQuestionFeedbackProvider } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
15
+ import { I18nMessages } from "../../../../i18n/i18n";
16
+ import { Routes } from "../../../../routing/routes";
17
+ import { render } from "../../../../test/render";
18
+ import { ReturnQuestionsForm } from "./ReturnQuestionsForm";
19
+
20
+ const country = Country.ES;
21
+ const segment = Segment.WOMEN;
22
+ const mockCheckout = checkout({
23
+ items: [
24
+ { status: CheckoutItemStatus.KEPT },
25
+ { status: CheckoutItemStatus.RETURNED },
26
+ { status: CheckoutItemStatus.REPLACED },
27
+ ],
28
+ });
29
+ const checkoutItem = mockCheckout.items[1] as CheckoutItemProjection;
30
+
31
+ const mockNavigate = jest.fn();
32
+ jest.mock("react-router-native", () => ({
33
+ ...jest.requireActual("react-router-native"),
34
+ useNavigate: () => mockNavigate,
35
+ }));
36
+
37
+ jest.mock("../../../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId");
38
+ jest.mock("../../../../../domain/checkoutItem/react/useReturnCheckoutItem");
39
+
40
+ const mockPressNext = jest.fn();
41
+ jest.mock("../../../../../tracking/useTrackPressNext", () => ({
42
+ useTrackPressNext: () => mockPressNext,
43
+ }));
44
+
45
+ const mockPressBack = jest.fn();
46
+ jest.mock("../../../../../tracking/useTrackPressBack", () => ({
47
+ useTrackPressBack: () => mockPressBack,
48
+ }));
49
+
50
+ const mockReturnItem = jest.fn();
51
+ jest.mock("../../../../../tracking/useTrackReturnItem", () => ({
52
+ useTrackReturnItem: () => mockReturnItem,
53
+ }));
54
+
55
+ describe("Return", () => {
56
+ test("renders correctly", async () => {
57
+ (useListReturnQuestionsByCheckoutItemId as jest.Mock).mockReturnValue([mockReturnQuestions, QueryStatus.SUCCESS]);
58
+ const mockReturnCheckoutItem = jest.fn();
59
+ (useReturnCheckoutItem as jest.Mock).mockReturnValue([mockReturnCheckoutItem, CommandStatus.IDLE]);
60
+
61
+ const { findByTestId, getByTestId, getByText } = render(
62
+ <ReturnQuestionFeedbackProvider feedback={{}}>
63
+ <ReturnQuestionsForm
64
+ checkout={mockCheckout}
65
+ checkoutItem={checkoutItem}
66
+ country={country}
67
+ layout={DummyLayout}
68
+ segment={segment}
69
+ />
70
+ ,
71
+ </ReturnQuestionFeedbackProvider>,
72
+ );
73
+
74
+ expect(await findByTestId("return-questions-form")).toBeTruthy();
75
+
76
+ expect(getByTestId("product-variant-preview")).toBeTruthy();
77
+
78
+ expect(getByText(I18nMessages.RETURN_QUESTIONS_TITLE)).toBeTruthy();
79
+ expect(getByText(I18nMessages.RETURN_QUESTIONS_DESCRIPTION)).toBeTruthy();
80
+
81
+ expect(getByTestId("item-detail-header")).toBeTruthy();
82
+
83
+ fireEvent.press(getByTestId("close-button-icon"));
84
+ expect(mockPressBack).toHaveBeenCalled();
85
+ expect(mockNavigate).toHaveBeenLastCalledWith(-1);
86
+
87
+ fireEvent.press(getByTestId("return-questions-button"));
88
+ expect(mockReturnCheckoutItem).toHaveBeenCalled();
89
+ expect(mockReturnItem).toHaveBeenCalled();
90
+ expect(mockPressNext).toHaveBeenCalled();
91
+ expect(mockNavigate).toHaveBeenLastCalledWith(
92
+ generatePath(`/${Routes.ITEM}`, { id: mockCheckout.items[2]?.id as string }),
93
+ );
94
+ });
95
+ });
@@ -0,0 +1,184 @@
1
+ import { PortalHost } from "@gorhom/portal";
2
+ import React, { FC, useCallback, useMemo } from "react";
3
+ import { ScrollView } from "react-native";
4
+ import { generatePath, useNavigate } from "react-router-native";
5
+ import { Box, Button, Layout as AuroraLayout, Spinner, Text, View, useDevice } from "@lookiero/aurora";
6
+ import { useI18nMessage } from "@lookiero/i18n-react";
7
+ import { CommandStatus } from "@lookiero/messaging-react";
8
+ import { useLogger } from "@lookiero/sty-psp-logging";
9
+ import { Segment } from "@lookiero/sty-psp-segment";
10
+ import { Layout as UiLayout } from "@lookiero/sty-psp-ui";
11
+ import { CheckoutProjection } from "../../../../../../projection/checkout/checkout";
12
+ import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
13
+ import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion";
14
+ import { Country } from "../../../../../../projection/shared/country";
15
+ import { useReturnCheckoutItem } from "../../../../../domain/checkoutItem/react/useReturnCheckoutItem";
16
+ import { useListReturnQuestionsByCheckoutItemId } from "../../../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
17
+ import { TrackingPage } from "../../../../../tracking/tracking";
18
+ import { useTrackPageView } from "../../../../../tracking/useTrackPageView";
19
+ import { useTrackPressBack } from "../../../../../tracking/useTrackPressBack";
20
+ import { useTrackPressNext } from "../../../../../tracking/useTrackPressNext";
21
+ import { useTrackReturnItem } from "../../../../../tracking/useTrackReturnItem";
22
+ import { ReturnQuestions } from "../../../../components/organisms/returnQuestions/ReturnQuestions";
23
+ import { useReturnQuestionFeedback } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
24
+ import {
25
+ ReturnQuestionItemProvider,
26
+ ReturnQuestionItems,
27
+ } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
28
+ import { HostDefaultReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem";
29
+ import { HostRadioGroupReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem";
30
+ import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem";
31
+ import { RadioReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem";
32
+ import { TextareaReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
33
+ import { ItemDetailHeader } from "../../../../components/templates/header/itemDetailHeader/ItemDetailHeader";
34
+ import { I18nMessages } from "../../../../i18n/i18n";
35
+ import { Routes } from "../../../../routing/routes";
36
+ import { useBasePath } from "../../../../routing/useBasePath";
37
+ import { ProductVariantPreview } from "../productVariantPreview/ProductVariantPreview";
38
+ import { style } from "./ReturnQuestionsForm.style";
39
+
40
+ const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
41
+
42
+ const returnQuestionItems: ReturnQuestionItems = {
43
+ [ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
44
+ [ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
45
+ [ReturnQuestionType.HOST_SELECT]: HostRadioGroupReturnQuestionItem,
46
+ [ReturnQuestionType.HOST_STACK]: HostStackReturnQuestionItem,
47
+ [ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
48
+ [ReturnQuestionType.OPTION]: RadioReturnQuestionItem,
49
+ };
50
+
51
+ interface ReturnQuestionsFormProps {
52
+ readonly checkout: CheckoutProjection;
53
+ readonly checkoutItem: CheckoutItemProjection;
54
+ readonly country: Country;
55
+ readonly layout: UiLayout;
56
+ readonly segment: Segment;
57
+ }
58
+
59
+ const ReturnQuestionsForm: FC<ReturnQuestionsFormProps> = ({
60
+ checkout,
61
+ checkoutItem,
62
+ country,
63
+ layout: Layout,
64
+ segment,
65
+ }) => {
66
+ const navigate = useNavigate();
67
+ const basePath = useBasePath();
68
+ const logger = useLogger();
69
+
70
+ const { screen } = useDevice();
71
+
72
+ const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE });
73
+ const descriptionText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_DESCRIPTION });
74
+ const submitButtonText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON });
75
+
76
+ const feedback = useReturnQuestionFeedback();
77
+ const [returnQuestions] = useListReturnQuestionsByCheckoutItemId({
78
+ checkoutItemId: checkoutItem.id,
79
+ });
80
+
81
+ const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
82
+ checkoutItemId: checkoutItem.id,
83
+ logger,
84
+ });
85
+ const trackReturnItem = useTrackReturnItem({
86
+ page: TrackingPage.RETURN,
87
+ country,
88
+ segment,
89
+ checkoutId: checkout.id,
90
+ checkoutItemId: checkoutItem.id,
91
+ });
92
+
93
+ useTrackPageView({ checkoutId: checkout.id, country, segment, page: TrackingPage.RETURN });
94
+
95
+ const trackPressBack = useTrackPressBack({
96
+ page: TrackingPage.ITEM,
97
+ country,
98
+ segment,
99
+ checkoutId: checkout?.id,
100
+ });
101
+ const handleOnBack = useCallback(() => {
102
+ trackPressBack();
103
+ navigate(-1);
104
+ }, [navigate, trackPressBack]);
105
+
106
+ const trackPressNext = useTrackPressNext({
107
+ page: TrackingPage.ITEM,
108
+ country,
109
+ segment,
110
+ checkoutId: checkout.id,
111
+ });
112
+
113
+ const handleOnSubmit = useCallback(async () => {
114
+ returnCheckoutItem({ feedbacks: feedback });
115
+ trackReturnItem();
116
+
117
+ const itemIndex = checkout.items.indexOf(checkoutItem);
118
+ const nextItemIndex = itemIndex === checkout.items.length - 1 ? 0 : itemIndex + 1;
119
+ const nextItem = checkout.items[nextItemIndex] as CheckoutItemProjection;
120
+
121
+ trackPressNext({ from: checkoutItem.id, to: nextItem.id });
122
+ navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: nextItem.id }));
123
+ }, [basePath, checkout.items, checkoutItem, feedback, navigate, returnCheckoutItem, trackPressNext, trackReturnItem]);
124
+
125
+ const header = useMemo(
126
+ () => (
127
+ <Box style={style.headerWrapper}>
128
+ <ItemDetailHeader onBack={handleOnBack} />
129
+ </Box>
130
+ ),
131
+ [handleOnBack],
132
+ );
133
+
134
+ const dependenciesLoaded = checkoutItem && returnQuestions && returnCheckoutItemStatus !== CommandStatus.LOADING;
135
+
136
+ if (!dependenciesLoaded) {
137
+ return <Spinner />;
138
+ }
139
+
140
+ return (
141
+ <ReturnQuestionItemProvider returnQuestionItems={returnQuestionItems}>
142
+ <PortalHost name={RETURN_QUESTION_FORM_PORTAL_HOST_NAME} />
143
+
144
+ <Layout
145
+ header={header}
146
+ scrollEnabled={false}
147
+ style={{
148
+ safeAreaView: style.safeAreaView,
149
+ scrollView: style.scrollView,
150
+ }}
151
+ >
152
+ <ProductVariantPreview country={country} item={checkoutItem} />
153
+
154
+ <ScrollView showsVerticalScrollIndicator={false} testID="return-questions-form">
155
+ <AuroraLayout fullWidth={!screen.L} style={[style.layout, screen.L ? style.desktopLayoutSpacing : undefined]}>
156
+ <Box size={{ L: "2/3" }}>
157
+ <View style={[style.info, !screen.S && style.desktopInfo]}>
158
+ <Text level={3} heading>
159
+ {titleText}
160
+ </Text>
161
+ <Text level={1} style={style.description} detail>
162
+ {descriptionText}
163
+ </Text>
164
+ </View>
165
+
166
+ <ReturnQuestions
167
+ portalHostName={RETURN_QUESTION_FORM_PORTAL_HOST_NAME}
168
+ returnQuestions={returnQuestions}
169
+ />
170
+
171
+ <View style={style.submit}>
172
+ <Button testID="return-questions-button" onPress={handleOnSubmit}>
173
+ {submitButtonText}
174
+ </Button>
175
+ </View>
176
+ </Box>
177
+ </AuroraLayout>
178
+ </ScrollView>
179
+ </Layout>
180
+ </ReturnQuestionItemProvider>
181
+ );
182
+ };
183
+
184
+ export { ReturnQuestionsForm };
@@ -1,7 +1,7 @@
1
1
  import React, { FC, ReactNode, useCallback, useEffect, useMemo, useState } from "react";
2
2
  import { LayoutRectangle, Platform, ScrollView, View } from "react-native";
3
3
  import { generatePath, useMatch, useNavigate } from "react-router-native";
4
- import { Box, Text, Layout, useDevice, Spinner } from "@lookiero/aurora";
4
+ import { Box, Text, Layout as AuroraLayout, useDevice, Spinner } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { QueryStatus } from "@lookiero/messaging-react";
7
7
  import { Layout as UiLayout, Sticky } from "@lookiero/sty-psp-ui";
@@ -27,7 +27,7 @@ interface SummaryProps {
27
27
  readonly children: ReactNode;
28
28
  }
29
29
 
30
- const Summary: FC<SummaryProps> = ({ layout: UiLayout, children }) => {
30
+ const Summary: FC<SummaryProps> = ({ layout: Layout, children }) => {
31
31
  const {
32
32
  customer: { customerId, country, segment },
33
33
  } = useStaticInfo();
@@ -110,7 +110,7 @@ const Summary: FC<SummaryProps> = ({ layout: UiLayout, children }) => {
110
110
  }
111
111
 
112
112
  return (
113
- <UiLayout
113
+ <Layout
114
114
  scrollEnabled={false}
115
115
  style={{
116
116
  header: style.header,
@@ -120,7 +120,7 @@ const Summary: FC<SummaryProps> = ({ layout: UiLayout, children }) => {
120
120
  <ScrollView showsVerticalScrollIndicator={false}>
121
121
  {fiveItemsDiscount !== 0 && <FiveItemsDiscountBanner fiveItemsDiscount={fiveItemsDiscount} />}
122
122
 
123
- <Layout
123
+ <AuroraLayout
124
124
  fullWidth={!screen.L}
125
125
  style={[screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }]}
126
126
  >
@@ -153,7 +153,7 @@ const Summary: FC<SummaryProps> = ({ layout: UiLayout, children }) => {
153
153
  </View>
154
154
  </Box>
155
155
  ) : null}
156
- </Layout>
156
+ </AuroraLayout>
157
157
  </ScrollView>
158
158
 
159
159
  {pricing && !screen.L ? (
@@ -170,7 +170,7 @@ const Summary: FC<SummaryProps> = ({ layout: UiLayout, children }) => {
170
170
  </Body>
171
171
  </Sticky>
172
172
  ) : null}
173
- </UiLayout>
173
+ </Layout>
174
174
  );
175
175
  };
176
176
 
@@ -1,84 +0,0 @@
1
- import { renderHook, waitFor } from "@testing-library/react-native";
2
- import React, { FC } from "react";
3
- import { Variation, useAssignedVariationByExperimentId } from "@lookiero/sty-psp-ab-testing";
4
- import { Segment } from "@lookiero/sty-psp-segment";
5
- import { CheckoutProjection } from "../../../projection/checkout/checkout";
6
- import { Country } from "../../../projection/shared/country";
7
- import { KameleoonEnvironment } from "../../ab-testing/kameleoonEnvironment";
8
- import {
9
- NewFeedbackExperimentProvider,
10
- NewFeedbackExperimentVariation,
11
- useNewFeedbackExperiment as sut,
12
- } from "./useNewFeedbackExperiment";
13
-
14
- const mockKameleoon: KameleoonEnvironment = {
15
- siteCode: "aplm4v3ckn",
16
- experiments: {
17
- newFeedback: {
18
- id: "245000",
19
- variations: {
20
- v1: "964072",
21
- },
22
- },
23
- },
24
- };
25
-
26
- const country = Country.ES;
27
- const segment = Segment.WOMEN;
28
- const customerId = "1f410890-b3e1-49d2-9950-2ff89182cb79";
29
- const mockTrackAssignedVariation = jest.fn();
30
- // useStaticInfo
31
-
32
- jest.mock("../../tracking/useTrackAssignedVariationByExperiment", () => ({
33
- useTrackAssignedVariationByExperiment: () => mockTrackAssignedVariation,
34
- }));
35
-
36
- jest.mock("@lookiero/sty-psp-ab-testing");
37
-
38
- jest.mock("./useStaticInfo", () => ({
39
- useStaticInfo: () => ({ kameleoon: mockKameleoon, customer: { customerId, country, segment } }),
40
- }));
41
-
42
- jest.mock("../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId", () => ({
43
- useViewFirstAvailableCheckoutByCustomerId: () => [
44
- { id: "3db6984e-c8d2-4242-a795-ab5babb25e8c" } as CheckoutProjection,
45
- ],
46
- }));
47
-
48
- interface WrapperProps {
49
- readonly children: JSX.Element;
50
- }
51
-
52
- const Wrapper: FC<WrapperProps> = ({ children }) => (
53
- <NewFeedbackExperimentProvider>{children}</NewFeedbackExperimentProvider>
54
- );
55
-
56
- beforeEach(() => {
57
- mockTrackAssignedVariation.mockClear();
58
- });
59
-
60
- describe("useNewFeedbackExperiment hook", () => {
61
- it("returns 'control' as variation", async () => {
62
- const assignedVariation: Variation = { id: 0, name: "Control" };
63
- (useAssignedVariationByExperimentId as jest.Mock).mockReturnValue({ assignedVariation });
64
-
65
- const { result } = renderHook(() => sut(), { wrapper: Wrapper });
66
-
67
- await waitFor(() => expect(result.current).toBe(NewFeedbackExperimentVariation.CONTROL));
68
- await waitFor(() => {
69
- expect(mockTrackAssignedVariation).toHaveBeenCalledWith({ assignedVariation });
70
- });
71
- });
72
-
73
- it("returns 'return_page' as variation", async () => {
74
- const assignedVariation: Variation = { id: 964072, name: "Variation 1" };
75
- (useAssignedVariationByExperimentId as jest.Mock).mockReturnValue({ assignedVariation });
76
-
77
- const { result } = renderHook(() => sut(), { wrapper: Wrapper });
78
-
79
- await waitFor(() => expect(result.current).toBe(NewFeedbackExperimentVariation.RETURN_PAGE));
80
- await waitFor(() => {
81
- expect(mockTrackAssignedVariation).toHaveBeenCalledWith({ assignedVariation });
82
- });
83
- });
84
- });