@lookiero/checkout 6.6.0 → 7.0.0-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.
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -3
- 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/Expo.js +0 -2
- package/dist/src/ExpoRoot.js +8 -1
- package/dist/src/infrastructure/ab-testing/kameleoonEnvironment.d.ts +6 -2
- package/dist/src/infrastructure/delivery/baseBootstrap.js +0 -2
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +21 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +6 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +4 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +6 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +5 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +19 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +3 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +18 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +13 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +10 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.d.ts +7 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.js +7 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +7 -2
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +6 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +11 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +11 -0
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +11 -0
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +49 -0
- package/dist/src/infrastructure/ui/routing/Routing.js +13 -13
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +4 -4
- package/dist/src/infrastructure/ui/views/feedback/Feedback.d.ts +2 -2
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +7 -0
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +10 -0
- package/dist/src/infrastructure/ui/views/item/Item.js +33 -4
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +11 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +40 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +15 -0
- package/dist/src/infrastructure/ui/views/return/Return.js +127 -8
- package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +7 -5
- package/dist/src/infrastructure/ui/views/summary/Summary.js +4 -4
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +13 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +9 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +10 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/index.ts +0 -17
- package/package.json +1 -3
- package/src/Expo.tsx +0 -3
- package/src/ExpoRoot.tsx +8 -1
- package/src/infrastructure/ab-testing/kameleoonEnvironment.ts +7 -3
- package/src/infrastructure/delivery/baseBootstrap.ts +0 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.style.ts +7 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.test.tsx +5 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +17 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.test.tsx +5 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +20 -11
- package/src/infrastructure/ui/hooks/useNewFeedbackExperiment.test.tsx +84 -0
- package/src/infrastructure/ui/hooks/useNewFeedbackExperiment.tsx +82 -0
- package/src/infrastructure/ui/routing/Routing.tsx +18 -21
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +6 -6
- package/src/infrastructure/ui/views/feedback/Feedback.tsx +2 -2
- package/src/infrastructure/ui/views/item/Item.test.tsx +62 -6
- package/src/infrastructure/ui/views/item/Item.tsx +48 -5
- package/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +18 -0
- package/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.tsx +79 -0
- package/src/infrastructure/ui/views/return/Return.tsx +200 -12
- package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.tsx +7 -12
- package/src/infrastructure/ui/views/summary/Summary.tsx +6 -6
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -15
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -112
- package/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.test.ts +0 -45
- package/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.ts +0 -33
- package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.test.tsx +0 -74
- package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.tsx +0 -39
- package/src/infrastructure/ui/views/return/Return.test.tsx +0 -54
- package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.test.tsx +0 -32
- package/src/infrastructure/ui/views/return/components/productVariantPreview/__snapshots__/ProductVariantPreview.test.tsx.snap +0 -221
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.test.tsx +0 -95
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +0 -184
- package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.test.ts +0 -54
- package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.ts +0 -46
- /package/dist/src/infrastructure/ui/views/return/{components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts → Return.style.d.ts} +0 -0
- /package/dist/src/infrastructure/ui/views/return/{components/returnQuestionsForm/ReturnQuestionsForm.style.js → Return.style.js} +0 -0
- /package/src/infrastructure/ui/views/return/{components/returnQuestionsForm/ReturnQuestionsForm.style.ts → Return.style.ts} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
|
|
3
3
|
import { Box, Spinner } from "@lookiero/aurora";
|
|
4
|
-
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
+
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
5
5
|
import { useLogger } from "@lookiero/sty-psp-logging";
|
|
6
6
|
import { useScreenSize } from "@lookiero/sty-psp-ui";
|
|
7
7
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
8
8
|
import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
|
|
9
|
+
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
9
10
|
import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
|
|
10
11
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
11
12
|
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
|
|
@@ -16,14 +17,17 @@ import { useTrackItemPageView } from "../../../tracking/useTrackItemPageView";
|
|
|
16
17
|
import { useTrackPressBack } from "../../../tracking/useTrackPressBack";
|
|
17
18
|
import { useTrackPressNext } from "../../../tracking/useTrackPressNext";
|
|
18
19
|
import { useTrackPressPrevious } from "../../../tracking/useTrackPressPrevious";
|
|
20
|
+
import { useTrackReturnItem } from "../../../tracking/useTrackReturnItem";
|
|
19
21
|
import { FiveItemsDiscountBanner } from "../../components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
20
22
|
import { ReturnQuestionFeedbackProvider } from "../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
|
|
21
23
|
import { ItemDetailHeader } from "../../components/templates/header/itemDetailHeader/ItemDetailHeader";
|
|
22
24
|
import { ItemHeader } from "../../components/templates/header/itemHeader/ItemHeader";
|
|
25
|
+
import { NewFeedbackExperimentVariation, useNewFeedbackExperiment } from "../../hooks/useNewFeedbackExperiment";
|
|
23
26
|
import { useStaticInfo } from "../../hooks/useStaticInfo";
|
|
24
27
|
import { Routes } from "../../routing/routes";
|
|
25
28
|
import { useBasePath } from "../../routing/useBasePath";
|
|
26
29
|
import { style } from "./Item.style";
|
|
30
|
+
import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQuestionsForm";
|
|
27
31
|
import { ItemWithCustomerDecission, } from "./views/itemWithCustomerDecission/ItemWithCustomerDecission";
|
|
28
32
|
import { ItemWithoutCustomerDecission, } from "./views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission";
|
|
29
33
|
const Item = ({ layout: Layout }) => {
|
|
@@ -37,6 +41,10 @@ const Item = ({ layout: Layout }) => {
|
|
|
37
41
|
const [fiveItemsDiscount = 0, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({ customerId });
|
|
38
42
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
39
43
|
const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
|
|
44
|
+
/* Kameleoon experiment */
|
|
45
|
+
const newFeedbackVariation = useNewFeedbackExperiment();
|
|
46
|
+
const redirectToReturnPage = newFeedbackVariation === NewFeedbackExperimentVariation.RETURN_PAGE;
|
|
47
|
+
/* Kameleoon experiment */
|
|
40
48
|
/* SizeChange and Booking */
|
|
41
49
|
const [isSizeChangeEnabled, sizeChangeEnabledStatus] = useViewIsSizeChangeEnabledByCheckoutId({
|
|
42
50
|
checkoutId: checkout?.id,
|
|
@@ -64,9 +72,28 @@ const Item = ({ layout: Layout }) => {
|
|
|
64
72
|
const [returnQuestions] = useListReturnQuestionsByCheckoutItemId({
|
|
65
73
|
checkoutItemId: checkoutItem.id,
|
|
66
74
|
});
|
|
75
|
+
const [returnQuestionsVisible, setReturnQuestionsVisible] = useState(false);
|
|
76
|
+
const showReturnQuestions = useCallback(() => setReturnQuestionsVisible(true), []);
|
|
77
|
+
const hideReturnQuestions = useCallback(() => setReturnQuestionsVisible(false), []);
|
|
67
78
|
const goToReturnPage = useCallback(() => {
|
|
68
79
|
navigate(`${basePath}/${generatePath(Routes.RETURN, { id: checkoutItem.id })}`);
|
|
69
80
|
}, [basePath, checkoutItem.id, navigate]);
|
|
81
|
+
const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
|
|
82
|
+
checkoutItemId: checkoutItem.id,
|
|
83
|
+
logger,
|
|
84
|
+
});
|
|
85
|
+
const trackReturnItem = useTrackReturnItem({
|
|
86
|
+
page: TrackingPage.ITEM,
|
|
87
|
+
country,
|
|
88
|
+
segment,
|
|
89
|
+
checkoutId: checkout?.id,
|
|
90
|
+
checkoutItemId: checkoutItem.id,
|
|
91
|
+
});
|
|
92
|
+
const returnItem = useCallback(async (feedbacks) => {
|
|
93
|
+
hideReturnQuestions();
|
|
94
|
+
returnCheckoutItem({ feedbacks });
|
|
95
|
+
trackReturnItem();
|
|
96
|
+
}, [hideReturnQuestions, returnCheckoutItem, trackReturnItem]);
|
|
70
97
|
/* ReturnCheckoutItem */
|
|
71
98
|
const currentProductVariant = useMemo(() => checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
72
99
|
? { id: checkoutItem.replacedFor.id, size: checkoutItem.replacedFor.size }
|
|
@@ -136,7 +163,8 @@ const Item = ({ layout: Layout }) => {
|
|
|
136
163
|
bookedProductsVariantsStatus !== QueryStatus.LOADING &&
|
|
137
164
|
fiveItemsDiscountStatus !== QueryStatus.LOADING &&
|
|
138
165
|
sizeChangeEnabledStatus !== QueryStatus.LOADING &&
|
|
139
|
-
(isBookingRequired ? checkout.checkoutBookingId && bookedProductsVariants : true)
|
|
166
|
+
(isBookingRequired ? checkout.checkoutBookingId && bookedProductsVariants : true) &&
|
|
167
|
+
returnCheckoutItemStatus !== CommandStatus.LOADING;
|
|
140
168
|
if (!dependenciesLoaded) {
|
|
141
169
|
return React.createElement(Spinner, { testID: "spinner" });
|
|
142
170
|
}
|
|
@@ -145,6 +173,7 @@ const Item = ({ layout: Layout }) => {
|
|
|
145
173
|
header: fiveItemsDiscount !== 0 ? style.headerWithDoubleHeight : style.header,
|
|
146
174
|
scrollView: { height: itemWithoutCustomerDecission ? "100%" : "auto" },
|
|
147
175
|
safeAreaView: isDesktopScreen ? style.safeAreaView : null,
|
|
148
|
-
} }, itemWithoutCustomerDecission ? (React.createElement(ItemWithoutCustomerDecission, { bookedProductsVariants: bookedProductsVariants, checkoutId: checkout.id, checkoutItem: checkoutItem, currentProductVariant: currentProductVariant, onReturn: goToReturnPage })) : (React.createElement(ItemWithCustomerDecission, { checkoutId: checkout.id, checkoutItem: checkoutItem, currentProductVariant: currentProductVariant, returnQuestions: returnQuestions, onEditFeedback: goToReturnPage })))
|
|
176
|
+
} }, itemWithoutCustomerDecission ? (React.createElement(ItemWithoutCustomerDecission, { bookedProductsVariants: bookedProductsVariants, checkoutId: checkout.id, checkoutItem: checkoutItem, currentProductVariant: currentProductVariant, onReturn: redirectToReturnPage ? goToReturnPage : showReturnQuestions })) : (React.createElement(ItemWithCustomerDecission, { checkoutId: checkout.id, checkoutItem: checkoutItem, currentProductVariant: currentProductVariant, returnQuestions: returnQuestions, onEditFeedback: redirectToReturnPage ? goToReturnPage : showReturnQuestions }))),
|
|
177
|
+
!redirectToReturnPage ? (React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem })) : null));
|
|
149
178
|
};
|
|
150
179
|
export { Item };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
|
|
3
|
+
import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
4
|
+
interface ReturnQuestionsFormProps {
|
|
5
|
+
readonly visible: boolean;
|
|
6
|
+
readonly returnQuestions: ReturnQuestionProjection[];
|
|
7
|
+
readonly onSubmit: (feedback: FeedbackProjection) => void;
|
|
8
|
+
readonly onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const ReturnQuestionsForm: FC<ReturnQuestionsFormProps>;
|
|
11
|
+
export { ReturnQuestionsForm };
|
package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PortalHost } from "@gorhom/portal";
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { Button, Text } from "@lookiero/aurora";
|
|
5
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
6
|
+
import { Modal } from "@lookiero/sty-psp-ui";
|
|
7
|
+
import { ReturnQuestionType, } from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
8
|
+
import { ReturnQuestions } from "../../../../components/organisms/returnQuestions/ReturnQuestions";
|
|
9
|
+
import { useReturnQuestionFeedback } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
|
|
10
|
+
import { ReturnQuestionItemProvider, } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
|
|
11
|
+
import { HostDefaultReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem";
|
|
12
|
+
import { HostSelectReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem";
|
|
13
|
+
import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem";
|
|
14
|
+
import { OptionReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem";
|
|
15
|
+
import { TextareaReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
|
|
16
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
17
|
+
import { style } from "./ReturnQuestionsForm.style";
|
|
18
|
+
const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
|
|
19
|
+
const returnQuestionItems = {
|
|
20
|
+
[ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
|
|
21
|
+
[ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
|
|
22
|
+
[ReturnQuestionType.HOST_SELECT]: HostSelectReturnQuestionItem,
|
|
23
|
+
[ReturnQuestionType.HOST_STACK]: HostStackReturnQuestionItem,
|
|
24
|
+
[ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
|
|
25
|
+
[ReturnQuestionType.OPTION]: OptionReturnQuestionItem,
|
|
26
|
+
};
|
|
27
|
+
const ReturnQuestionsForm = ({ returnQuestions, visible, onSubmit, onClose }) => {
|
|
28
|
+
const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE });
|
|
29
|
+
const submitButtonText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON });
|
|
30
|
+
const feedback = useReturnQuestionFeedback();
|
|
31
|
+
const handleOnSubmit = useCallback(() => onSubmit(feedback), [feedback, onSubmit]);
|
|
32
|
+
return (React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
|
|
33
|
+
React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
|
|
34
|
+
React.createElement(Modal, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, testID: "return-questions-form-modal", visible: visible, scroll: true, showCloseButton: true, onClose: onClose },
|
|
35
|
+
React.createElement(View, { style: style.modalContent },
|
|
36
|
+
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
37
|
+
React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }),
|
|
38
|
+
React.createElement(Button, { style: style.submit, testID: "return-questions-button", onPress: handleOnSubmit }, submitButtonText)))));
|
|
39
|
+
};
|
|
40
|
+
export { ReturnQuestionsForm };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
|
+
const { space6, space8 } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
modalContent: {
|
|
6
|
+
paddingHorizontal: space6,
|
|
7
|
+
},
|
|
8
|
+
submit: {
|
|
9
|
+
marginTop: space8,
|
|
10
|
+
},
|
|
11
|
+
title: {
|
|
12
|
+
marginBottom: space6,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export { style };
|
|
@@ -1,12 +1,131 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { PortalHost } from "@gorhom/portal";
|
|
2
|
+
import React, { useCallback, useMemo } from "react";
|
|
3
|
+
import { ScrollView } from "react-native";
|
|
4
|
+
import { generatePath, useNavigate, useParams } from "react-router-native";
|
|
5
|
+
import { Box, Button, Layout, Spinner, Text, View, useDevice } from "@lookiero/aurora";
|
|
6
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
7
|
+
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
8
|
+
import { useLogger } from "@lookiero/sty-psp-logging";
|
|
9
|
+
import { ReturnQuestionType } from "../../../../projection/returnQuestion/returnQuestion";
|
|
10
|
+
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
5
11
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
6
|
-
import {
|
|
12
|
+
import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
|
|
13
|
+
import { TrackingPage } from "../../../tracking/tracking";
|
|
14
|
+
import { useTrackPageView } from "../../../tracking/useTrackPageView";
|
|
15
|
+
import { useTrackPressNext } from "../../../tracking/useTrackPressNext";
|
|
16
|
+
import { useTrackPressPrevious } from "../../../tracking/useTrackPressPrevious";
|
|
17
|
+
import { useTrackReturnItem } from "../../../tracking/useTrackReturnItem";
|
|
18
|
+
import { ReturnQuestions } from "../../components/organisms/returnQuestions/ReturnQuestions";
|
|
19
|
+
import { ReturnQuestionFeedbackProvider, useReturnQuestionFeedback, } from "../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
|
|
20
|
+
import { ReturnQuestionItemProvider, } from "../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
|
|
21
|
+
import { HostDefaultReturnQuestionItem } from "../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem";
|
|
22
|
+
import { HostRadioGroupReturnQuestionItem } from "../../components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem";
|
|
23
|
+
import { HostStackReturnQuestionItem } from "../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem";
|
|
24
|
+
import { RadioReturnQuestionItem } from "../../components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem";
|
|
25
|
+
import { TextareaReturnQuestionItem } from "../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
|
|
26
|
+
import { ItemHeader } from "../../components/templates/header/itemHeader/ItemHeader";
|
|
7
27
|
import { useStaticInfo } from "../../hooks/useStaticInfo";
|
|
8
|
-
import {
|
|
9
|
-
|
|
28
|
+
import { I18nMessages } from "../../i18n/i18n";
|
|
29
|
+
import { Routes } from "../../routing/routes";
|
|
30
|
+
import { useBasePath } from "../../routing/useBasePath";
|
|
31
|
+
import { style } from "./Return.style";
|
|
32
|
+
import { ProductVariantPreview } from "./components/productVariantPreview/ProductVariantPreview";
|
|
33
|
+
const returnQuestionItems = {
|
|
34
|
+
[ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
|
|
35
|
+
[ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
|
|
36
|
+
[ReturnQuestionType.HOST_SELECT]: HostRadioGroupReturnQuestionItem,
|
|
37
|
+
[ReturnQuestionType.HOST_STACK]: HostStackReturnQuestionItem,
|
|
38
|
+
[ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
|
|
39
|
+
[ReturnQuestionType.OPTION]: RadioReturnQuestionItem,
|
|
40
|
+
};
|
|
41
|
+
const ReturnForm = ({ checkout, checkoutItem, country, segment, layout: UiLayout }) => {
|
|
42
|
+
const { screen } = useDevice();
|
|
43
|
+
const navigate = useNavigate();
|
|
44
|
+
const logger = useLogger();
|
|
45
|
+
const basePath = useBasePath();
|
|
46
|
+
const checkoutId = checkout.id;
|
|
47
|
+
const trackPressNext = useTrackPressNext({
|
|
48
|
+
page: TrackingPage.ITEM,
|
|
49
|
+
country,
|
|
50
|
+
segment,
|
|
51
|
+
checkoutId,
|
|
52
|
+
});
|
|
53
|
+
const trackPressPrevious = useTrackPressPrevious({
|
|
54
|
+
page: TrackingPage.ITEM,
|
|
55
|
+
country,
|
|
56
|
+
segment,
|
|
57
|
+
checkoutId,
|
|
58
|
+
});
|
|
59
|
+
const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE });
|
|
60
|
+
const descriptionText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_DESCRIPTION });
|
|
61
|
+
const submitButtonText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON });
|
|
62
|
+
const isSmallScreen = screen.S;
|
|
63
|
+
useTrackPageView({ checkoutId, country, segment, page: TrackingPage.RETURN });
|
|
64
|
+
/* ReturnCheckoutItem */
|
|
65
|
+
const [returnQuestions] = useListReturnQuestionsByCheckoutItemId({
|
|
66
|
+
checkoutItemId: checkoutItem.id,
|
|
67
|
+
});
|
|
68
|
+
const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
|
|
69
|
+
checkoutItemId: checkoutItem.id,
|
|
70
|
+
logger,
|
|
71
|
+
});
|
|
72
|
+
const trackReturnItem = useTrackReturnItem({
|
|
73
|
+
page: TrackingPage.RETURN,
|
|
74
|
+
country,
|
|
75
|
+
segment,
|
|
76
|
+
checkoutId: checkoutId,
|
|
77
|
+
checkoutItemId: checkoutItem.id,
|
|
78
|
+
});
|
|
79
|
+
const navigateToNextItem = useCallback(() => {
|
|
80
|
+
const item = checkoutItem;
|
|
81
|
+
const items = checkout?.items;
|
|
82
|
+
const itemIndex = items.indexOf(item);
|
|
83
|
+
const nextItemIndex = itemIndex === items.length - 1 ? 0 : itemIndex + 1;
|
|
84
|
+
const nextItem = items[nextItemIndex];
|
|
85
|
+
trackPressNext({ from: item.id, to: nextItem.id });
|
|
86
|
+
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: nextItem.id }));
|
|
87
|
+
}, [basePath, checkout?.items, checkoutItem, navigate, trackPressNext]);
|
|
88
|
+
const navigateToPreviousItem = useCallback(() => {
|
|
89
|
+
const item = checkoutItem;
|
|
90
|
+
const items = checkout?.items;
|
|
91
|
+
const itemIndex = items.indexOf(item);
|
|
92
|
+
const previousItemIndex = itemIndex === 0 ? items.length - 1 : itemIndex - 1;
|
|
93
|
+
const previousItem = items[previousItemIndex];
|
|
94
|
+
trackPressPrevious({ from: item.id, to: previousItem.id });
|
|
95
|
+
navigate(generatePath(`${basePath}/${Routes.ITEM}`, { id: previousItem.id }));
|
|
96
|
+
}, [basePath, checkout?.items, checkoutItem, navigate, trackPressPrevious]);
|
|
97
|
+
const returnItem = useCallback(async (feedbacks) => {
|
|
98
|
+
returnCheckoutItem({ feedbacks });
|
|
99
|
+
trackReturnItem();
|
|
100
|
+
navigateToNextItem();
|
|
101
|
+
}, [navigateToNextItem, returnCheckoutItem, trackReturnItem]);
|
|
102
|
+
const feedback = useReturnQuestionFeedback();
|
|
103
|
+
const handleOnSubmit = useCallback(() => returnItem(feedback), [feedback, returnItem]);
|
|
104
|
+
const header = useMemo(() => (React.createElement(Box, { style: style.headerWrapper },
|
|
105
|
+
React.createElement(ItemHeader, { item: checkoutItem, items: checkout?.items, onNext: navigateToNextItem, onPrevious: navigateToPreviousItem }))), [checkout?.items, checkoutItem, navigateToNextItem, navigateToPreviousItem]);
|
|
106
|
+
/* ReturnCheckoutItem */
|
|
107
|
+
const dependenciesLoaded = checkoutItem && returnQuestions && returnCheckoutItemStatus !== CommandStatus.LOADING;
|
|
108
|
+
if (!dependenciesLoaded) {
|
|
109
|
+
return React.createElement(Spinner, null);
|
|
110
|
+
}
|
|
111
|
+
return (React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
|
|
112
|
+
React.createElement(PortalHost, { name: "return-question-form-portal" }),
|
|
113
|
+
React.createElement(UiLayout, { header: header, scrollEnabled: false, style: {
|
|
114
|
+
safeAreaView: style.safeAreaView,
|
|
115
|
+
scrollView: style.scrollView,
|
|
116
|
+
} },
|
|
117
|
+
React.createElement(ProductVariantPreview, { country: country, item: checkoutItem }),
|
|
118
|
+
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
119
|
+
React.createElement(Layout, { fullWidth: !screen.L, style: [style.layout, screen.L ? style.desktopLayoutSpacing : undefined] },
|
|
120
|
+
React.createElement(Box, { size: { L: "2/3" } },
|
|
121
|
+
React.createElement(View, { style: [style.info, isSmallScreen ? undefined : style.desktopInfo] },
|
|
122
|
+
React.createElement(Text, { level: 3, heading: true }, titleText),
|
|
123
|
+
React.createElement(Text, { level: 1, style: style.description, detail: true }, descriptionText)),
|
|
124
|
+
React.createElement(ReturnQuestions, { portalHostName: "return-question-form-portal", returnQuestions: returnQuestions }),
|
|
125
|
+
React.createElement(View, { style: style.submit },
|
|
126
|
+
React.createElement(Button, { testID: "return-questions-button", onPress: handleOnSubmit }, submitButtonText))))))));
|
|
127
|
+
};
|
|
128
|
+
const Return = ({ layout: UiLayout }) => {
|
|
10
129
|
const { id } = useParams();
|
|
11
130
|
const { customer: { customerId, country, segment }, } = useStaticInfo();
|
|
12
131
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
@@ -16,6 +135,6 @@ const Return = ({ layout }) => {
|
|
|
16
135
|
return React.createElement(Spinner, null);
|
|
17
136
|
}
|
|
18
137
|
return (React.createElement(ReturnQuestionFeedbackProvider, { key: checkoutItem.id, feedback: checkoutItem.feedbacks || {} },
|
|
19
|
-
React.createElement(
|
|
138
|
+
React.createElement(ReturnForm, { checkout: checkout, checkoutItem: checkoutItem, country: country, layout: UiLayout, segment: segment })));
|
|
20
139
|
};
|
|
21
140
|
export { Return };
|
|
@@ -11,19 +11,21 @@ import { IMAGE_SIZE, style } from "./ProductVariantPreview.style";
|
|
|
11
11
|
const ProductVariantPreview = ({ item, country }) => {
|
|
12
12
|
const cdnImageUrl = useMediaImage();
|
|
13
13
|
const { screen } = useDevice();
|
|
14
|
+
const isSmallScreen = screen.S;
|
|
15
|
+
const { productVariant, price } = item;
|
|
16
|
+
const { media, brand, name, size: sizeProjection } = productVariant;
|
|
17
|
+
const mainImage = media.find((mediaElement) => mediaElement.perspective === "MAIN");
|
|
14
18
|
const sizeText = useI18nMessage({ id: I18nMessages.ITEM_SIZE });
|
|
15
19
|
const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
|
|
16
|
-
|
|
17
|
-
const mainImage = media.find((mediaElement) => mediaElement.perspective === "MAIN");
|
|
18
|
-
return (React.createElement(View, { style: [style.wrapper, !screen.S && style.mobileWrapper], testID: "product-variant-preview" },
|
|
20
|
+
return (React.createElement(View, { style: [style.wrapper, isSmallScreen ? style.mobileWrapper : undefined] },
|
|
19
21
|
React.createElement(Row, { style: style.row },
|
|
20
22
|
React.createElement(Column, { size: { M: "2/3", L: "2/3" }, style: style.content },
|
|
21
|
-
mainImage
|
|
23
|
+
mainImage ? (React.createElement(Image, { resizeMode: "stretch", style: style.image, testID: "product-variant-image", source: {
|
|
22
24
|
uri: cdnImageUrl({
|
|
23
25
|
url: mainImage.url,
|
|
24
26
|
width: IMAGE_SIZE,
|
|
25
27
|
}),
|
|
26
|
-
} })),
|
|
28
|
+
} })) : null,
|
|
27
29
|
React.createElement(View, { style: style.info },
|
|
28
30
|
React.createElement(Text, { color: COLOR.TEXT_MEDIUM, level: 2, detail: true }, brand),
|
|
29
31
|
React.createElement(Text, { level: 2, detail: true }, name),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { Platform, ScrollView, View } from "react-native";
|
|
3
3
|
import { generatePath, useMatch, useNavigate } from "react-router-native";
|
|
4
|
-
import { Box, Text, Layout
|
|
4
|
+
import { Box, Text, Layout, useDevice, Spinner } from "@lookiero/aurora";
|
|
5
5
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
6
6
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
7
7
|
import { Sticky } from "@lookiero/sty-psp-ui";
|
|
@@ -21,7 +21,7 @@ import { Routes } from "../../routing/routes";
|
|
|
21
21
|
import { useBasePath } from "../../routing/useBasePath";
|
|
22
22
|
import { style } from "./Summary.style";
|
|
23
23
|
import { CollapsiblePricing } from "./components/collapsiblePricing/CollapsiblePricing";
|
|
24
|
-
const Summary = ({ layout:
|
|
24
|
+
const Summary = ({ layout: UiLayout, children }) => {
|
|
25
25
|
const { customer: { customerId, country, segment }, } = useStaticInfo();
|
|
26
26
|
const [pricingCollapsed, setPricingCollapsed] = useState(true);
|
|
27
27
|
const [pricingHeight, setPricingHeight] = useState(0);
|
|
@@ -79,13 +79,13 @@ const Summary = ({ layout: Layout, children }) => {
|
|
|
79
79
|
if (!dependenciesLoaded) {
|
|
80
80
|
return React.createElement(Spinner, null);
|
|
81
81
|
}
|
|
82
|
-
return (React.createElement(
|
|
82
|
+
return (React.createElement(UiLayout, { scrollEnabled: false, style: {
|
|
83
83
|
header: style.header,
|
|
84
84
|
scrollView: style.scrollView,
|
|
85
85
|
} },
|
|
86
86
|
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
87
87
|
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
88
|
-
React.createElement(
|
|
88
|
+
React.createElement(Layout, { fullWidth: !screen.L, style: [screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }] },
|
|
89
89
|
React.createElement(Box, { size: { L: "2/3" }, style: screen.L && style.desktopListSpacing },
|
|
90
90
|
React.createElement(View, { style: [style.contentWrapper, screen.L && style.desktopContentWrapper] },
|
|
91
91
|
React.createElement(View, { style: !screen.L && style.mobileInfo },
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { LayoutRectangle } from "react-native";
|
|
3
|
+
import { PricingProjection } from "../../../../../../projection/pricing/pricing";
|
|
4
|
+
interface StickyPricingProps {
|
|
5
|
+
readonly pricing: PricingProjection;
|
|
6
|
+
readonly totalCheckoutItemsKept: number;
|
|
7
|
+
readonly collapsed: boolean;
|
|
8
|
+
readonly onPress: () => void;
|
|
9
|
+
readonly onSubmit: () => void;
|
|
10
|
+
readonly onLayout?: ({ width, height }: LayoutRectangle) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const StickyPricing: FC<StickyPricingProps>;
|
|
13
|
+
export { StickyPricing };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Sticky } from "@lookiero/sty-psp-ui";
|
|
3
|
+
import { Body } from "../../../../components/layouts/body/Body";
|
|
4
|
+
import { Pricing } from "../pricing/Pricing";
|
|
5
|
+
import { style } from "./StickyPricing.style";
|
|
6
|
+
const StickyPricing = ({ pricing, totalCheckoutItemsKept, collapsed, onPress, onSubmit, onLayout, }) => (React.createElement(Sticky, { style: style.sticky, onLayout: onLayout },
|
|
7
|
+
React.createElement(Body, null,
|
|
8
|
+
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsed: collapsed, discount: pricing.discount, discountPercentage: pricing.discountPercentage, pendingToPay: pricing.pendingToPay, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: totalCheckoutItemsKept, onPress: onPress, onSubmit: onSubmit }))));
|
|
9
|
+
export { StickyPricing };
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "7.0.0-beta.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "
|
|
1
|
+
export const VERSION = "7.0.0-beta.0";
|
package/index.ts
CHANGED
|
@@ -12,22 +12,10 @@ import { fetchTranslations } from "./src/infrastructure/ui/i18n/fetchTranslation
|
|
|
12
12
|
import { translationEndpoint, translationExternalEndpoint } from "./src/infrastructure/ui/i18n/translationEndpoint";
|
|
13
13
|
import { CheckoutProjection } from "./src/projection/checkout/checkout";
|
|
14
14
|
import { viewFirstAvailableCheckoutByCustomerId } from "./src/projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
15
|
-
import {
|
|
16
|
-
IsCheckoutAccessibleByCustomerIdProjection,
|
|
17
|
-
viewIsCheckoutAccessibleByCustomerId,
|
|
18
|
-
} from "./src/projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
19
15
|
import { Customer } from "./src/projection/shared/customer";
|
|
20
16
|
import { Order } from "./src/projection/shared/order";
|
|
21
17
|
import { Subscription } from "./src/projection/shared/subscription";
|
|
22
18
|
|
|
23
|
-
interface IsCheckoutAccessibleFunctionArgs {
|
|
24
|
-
readonly customerId: string | undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface IsCheckoutAccessibleFunction {
|
|
28
|
-
(args: IsCheckoutAccessibleFunctionArgs): Promise<IsCheckoutAccessibleByCustomerIdProjection>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
19
|
interface FirstAvailableCheckoutByCustomerIdFunctionArgs {
|
|
32
20
|
readonly customerId: string | undefined;
|
|
33
21
|
}
|
|
@@ -46,7 +34,6 @@ interface BootstrapFunctionArgs {
|
|
|
46
34
|
|
|
47
35
|
interface BootstrapFunctionReturn {
|
|
48
36
|
readonly root: (args: SentryLoggerFunctionArgs) => ComponentType<RootProps>;
|
|
49
|
-
readonly isCheckoutAccessible: IsCheckoutAccessibleFunction;
|
|
50
37
|
readonly firstAvailableCheckoutByCustomerId: FirstAvailableCheckoutByCustomerIdFunction;
|
|
51
38
|
}
|
|
52
39
|
|
|
@@ -61,15 +48,11 @@ const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken, translations, sent
|
|
|
61
48
|
contextId: "CheckoutI18n",
|
|
62
49
|
});
|
|
63
50
|
|
|
64
|
-
const isCheckoutAccessible: IsCheckoutAccessibleFunction = ({ customerId }) =>
|
|
65
|
-
queryBus(viewIsCheckoutAccessibleByCustomerId({ customerId }));
|
|
66
|
-
|
|
67
51
|
const firstAvailableCheckoutByCustomerId: FirstAvailableCheckoutByCustomerIdFunction = ({ customerId }) =>
|
|
68
52
|
queryBus(viewFirstAvailableCheckoutByCustomerId({ customerId: customerId as string }));
|
|
69
53
|
|
|
70
54
|
return {
|
|
71
55
|
root: root({ Messaging, I18n, getAuthToken, sentry, kameleoon }),
|
|
72
|
-
isCheckoutAccessible,
|
|
73
56
|
firstAvailableCheckoutByCustomerId,
|
|
74
57
|
};
|
|
75
58
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-beta.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": "false",
|
|
@@ -32,8 +32,6 @@
|
|
|
32
32
|
"@lookiero/sty-psp-uuid": "^0.1.0",
|
|
33
33
|
"@react-native-async-storage/async-storage": "^1.22.3",
|
|
34
34
|
"@react-spring/native": "9.6.1",
|
|
35
|
-
"react-native-gesture-handler": "^2.12.0",
|
|
36
|
-
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
37
35
|
"react-native-svg": "^13.4.0",
|
|
38
36
|
"tiny-invariant": "^1.3.1"
|
|
39
37
|
},
|
package/src/Expo.tsx
CHANGED
package/src/ExpoRoot.tsx
CHANGED
|
@@ -117,7 +117,14 @@ setPaymentsBridge({
|
|
|
117
117
|
|
|
118
118
|
const kameleoonConfig: KameleoonEnvironment = {
|
|
119
119
|
siteCode: "aplm4v3ckn",
|
|
120
|
-
experiments: {
|
|
120
|
+
experiments: {
|
|
121
|
+
newFeedback: {
|
|
122
|
+
id: "245000",
|
|
123
|
+
variations: {
|
|
124
|
+
v1: "964072",
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
121
128
|
};
|
|
122
129
|
|
|
123
130
|
// const { Component: Messaging } = checkoutMockBootstrap();
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface Experiment {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly variations: Record<string, string>;
|
|
4
|
+
}
|
|
3
5
|
|
|
4
6
|
interface KameleoonEnvironment {
|
|
5
7
|
readonly siteCode: string;
|
|
6
|
-
readonly experiments:
|
|
8
|
+
readonly experiments: {
|
|
9
|
+
readonly newFeedback: Experiment;
|
|
10
|
+
};
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
export type { KameleoonEnvironment };
|
|
@@ -72,10 +72,6 @@ import {
|
|
|
72
72
|
viewFiveItemsDiscountByCustomerIdHandler,
|
|
73
73
|
VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID,
|
|
74
74
|
} from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
75
|
-
import {
|
|
76
|
-
viewIsCheckoutAccessibleByCustomerIdHandler,
|
|
77
|
-
VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID,
|
|
78
|
-
} from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
79
75
|
import {
|
|
80
76
|
IsCheckoutEnabledByCustomerIdView,
|
|
81
77
|
viewIsCheckoutEnabledByCustomerIdHandler,
|
|
@@ -261,7 +257,6 @@ const baseBootstrap: BaseBootstrapFunction = ({
|
|
|
261
257
|
.query(VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID, viewIsSizeChangeEnabledByCheckoutIdHandler, {
|
|
262
258
|
view: isSizeChangeEnabledByCheckoutIdView,
|
|
263
259
|
})
|
|
264
|
-
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler)
|
|
265
260
|
.command(START_CHECKOUT, startCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
266
261
|
.command(SUBMIT_CHECKOUT, submitCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
267
262
|
.query(VIEW_CHECKOUT_ITEM_BY_ID, viewCheckoutItemByIdHandler, {
|
|
@@ -4,10 +4,16 @@ import { theme } from "@lookiero/sty-psp-ui";
|
|
|
4
4
|
const { colorBgBase, space4, space6 } = theme();
|
|
5
5
|
|
|
6
6
|
const style = StyleSheet.create({
|
|
7
|
+
allOptionsTitle: {
|
|
8
|
+
display: "none",
|
|
9
|
+
},
|
|
10
|
+
formTitle: {
|
|
11
|
+
paddingLeft: space6,
|
|
12
|
+
},
|
|
7
13
|
title: {
|
|
8
14
|
backgroundColor: colorBgBase,
|
|
9
15
|
paddingBottom: space4,
|
|
10
|
-
|
|
16
|
+
paddingRight: space6,
|
|
11
17
|
paddingTop: space6,
|
|
12
18
|
},
|
|
13
19
|
});
|
|
@@ -12,6 +12,11 @@ jest.mock("../../behaviors/useReturnQuestionFeedback", () => ({
|
|
|
12
12
|
useReturnQuestionFeedbackForReturnQuestion: () => ({ feedback: "", onChange: mockOnChange }),
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
|
+
jest.mock("../../../../../hooks/useNewFeedbackExperiment", () => ({
|
|
16
|
+
...jest.requireActual("../../../../../hooks/useNewFeedbackExperiment"),
|
|
17
|
+
useNewFeedbackExperiment: () => "control",
|
|
18
|
+
}));
|
|
19
|
+
|
|
15
20
|
const returnQuestion: ReturnQuestionProjection = {
|
|
16
21
|
id: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
17
22
|
name: "size_large",
|