@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
package/dist/index.d.ts
CHANGED
|
@@ -8,16 +8,9 @@ import { KameleoonEnvironment } from "./src/infrastructure/ab-testing/kameleoonE
|
|
|
8
8
|
import { RootProps } from "./src/infrastructure/ui/Root";
|
|
9
9
|
import { translationEndpoint, translationExternalEndpoint } from "./src/infrastructure/ui/i18n/translationEndpoint";
|
|
10
10
|
import { CheckoutProjection } from "./src/projection/checkout/checkout";
|
|
11
|
-
import { IsCheckoutAccessibleByCustomerIdProjection } from "./src/projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
12
11
|
import { Customer } from "./src/projection/shared/customer";
|
|
13
12
|
import { Order } from "./src/projection/shared/order";
|
|
14
13
|
import { Subscription } from "./src/projection/shared/subscription";
|
|
15
|
-
interface IsCheckoutAccessibleFunctionArgs {
|
|
16
|
-
readonly customerId: string | undefined;
|
|
17
|
-
}
|
|
18
|
-
interface IsCheckoutAccessibleFunction {
|
|
19
|
-
(args: IsCheckoutAccessibleFunctionArgs): Promise<IsCheckoutAccessibleByCustomerIdProjection>;
|
|
20
|
-
}
|
|
21
14
|
interface FirstAvailableCheckoutByCustomerIdFunctionArgs {
|
|
22
15
|
readonly customerId: string | undefined;
|
|
23
16
|
}
|
|
@@ -33,7 +26,6 @@ interface BootstrapFunctionArgs {
|
|
|
33
26
|
}
|
|
34
27
|
interface BootstrapFunctionReturn {
|
|
35
28
|
readonly root: (args: SentryLoggerFunctionArgs) => ComponentType<RootProps>;
|
|
36
|
-
readonly isCheckoutAccessible: IsCheckoutAccessibleFunction;
|
|
37
29
|
readonly firstAvailableCheckoutByCustomerId: FirstAvailableCheckoutByCustomerIdFunction;
|
|
38
30
|
}
|
|
39
31
|
interface BootstrapFunction {
|
package/dist/index.js
CHANGED
|
@@ -7,18 +7,15 @@ import { root } from "./src/infrastructure/ui/Root";
|
|
|
7
7
|
import { fetchTranslations } from "./src/infrastructure/ui/i18n/fetchTranslations";
|
|
8
8
|
import { translationEndpoint, translationExternalEndpoint } from "./src/infrastructure/ui/i18n/translationEndpoint";
|
|
9
9
|
import { viewFirstAvailableCheckoutByCustomerId } from "./src/projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
10
|
-
import { viewIsCheckoutAccessibleByCustomerId, } from "./src/projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
11
10
|
const bootstrap = ({ apiUrl, getAuthToken, translations, sentry, kameleoon }) => {
|
|
12
11
|
const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
|
|
13
12
|
const I18n = i18n({
|
|
14
13
|
fetchTranslation: fetchTranslations({ translations }),
|
|
15
14
|
contextId: "CheckoutI18n",
|
|
16
15
|
});
|
|
17
|
-
const isCheckoutAccessible = ({ customerId }) => queryBus(viewIsCheckoutAccessibleByCustomerId({ customerId }));
|
|
18
16
|
const firstAvailableCheckoutByCustomerId = ({ customerId }) => queryBus(viewFirstAvailableCheckoutByCustomerId({ customerId: customerId }));
|
|
19
17
|
return {
|
|
20
18
|
root: root({ Messaging, I18n, getAuthToken, sentry, kameleoon }),
|
|
21
|
-
isCheckoutAccessible,
|
|
22
19
|
firstAvailableCheckoutByCustomerId,
|
|
23
20
|
};
|
|
24
21
|
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/src/Expo.js
CHANGED
package/dist/src/ExpoRoot.js
CHANGED
|
@@ -100,7 +100,14 @@ setPaymentsBridge({
|
|
|
100
100
|
});
|
|
101
101
|
const kameleoonConfig = {
|
|
102
102
|
siteCode: "aplm4v3ckn",
|
|
103
|
-
experiments: {
|
|
103
|
+
experiments: {
|
|
104
|
+
newFeedback: {
|
|
105
|
+
id: "245000",
|
|
106
|
+
variations: {
|
|
107
|
+
v1: "964072",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
104
111
|
};
|
|
105
112
|
// const { Component: Messaging } = checkoutMockBootstrap();
|
|
106
113
|
const { Component: Messaging } = checkoutBootstrap({ apiUrl: () => apiUrl, getAuthToken });
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface Experiment {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly variations: Record<string, string>;
|
|
2
4
|
}
|
|
3
5
|
interface KameleoonEnvironment {
|
|
4
6
|
readonly siteCode: string;
|
|
5
|
-
readonly experiments:
|
|
7
|
+
readonly experiments: {
|
|
8
|
+
readonly newFeedback: Experiment;
|
|
9
|
+
};
|
|
6
10
|
}
|
|
7
11
|
export type { KameleoonEnvironment };
|
|
@@ -25,7 +25,6 @@ import { viewBookedProductsVariantsForCheckoutItemHandler, VIEW_BOOKED_PRODUCT_V
|
|
|
25
25
|
import { viewCheckoutByIdHandler, VIEW_CHECKOUT_BY_ID, } from "../../projection/checkout/viewCheckoutById";
|
|
26
26
|
import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
27
27
|
import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
28
|
-
import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
29
28
|
import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
30
29
|
import { viewIsSizeChangeEnabledByCheckoutIdHandler, VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID, } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
|
|
31
30
|
import { viewCheckoutBookingByIdHandler, VIEW_CHECKOUT_BOOKING_BY_ID, } from "../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
@@ -53,7 +52,6 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
53
52
|
.query(VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID, viewIsSizeChangeEnabledByCheckoutIdHandler, {
|
|
54
53
|
view: isSizeChangeEnabledByCheckoutIdView,
|
|
55
54
|
})
|
|
56
|
-
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler)
|
|
57
55
|
.command(START_CHECKOUT, startCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
58
56
|
.command(SUBMIT_CHECKOUT, submitCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
59
57
|
.query(VIEW_CHECKOUT_ITEM_BY_ID, viewCheckoutItemByIdHandler, {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC, ReactNode, RefObject } from "react";
|
|
2
|
+
import { LayoutChangeEvent, ScrollView, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface LayoutStyle {
|
|
4
|
+
readonly safeAreaView: StyleProp<ViewStyle>;
|
|
5
|
+
readonly scrollView: StyleProp<ViewStyle>;
|
|
6
|
+
readonly header: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
interface LayoutProps {
|
|
9
|
+
readonly children: ReactNode;
|
|
10
|
+
readonly header?: JSX.Element | null;
|
|
11
|
+
readonly footer?: JSX.Element | null;
|
|
12
|
+
readonly panel?: JSX.Element | null;
|
|
13
|
+
readonly stickyHeader?: boolean;
|
|
14
|
+
readonly stickyHeaderHiddenOnScroll?: boolean;
|
|
15
|
+
readonly scrollRef?: RefObject<ScrollView>;
|
|
16
|
+
readonly scrollEnabled?: boolean;
|
|
17
|
+
readonly style?: Partial<LayoutStyle>;
|
|
18
|
+
readonly onLayout?: (event: LayoutChangeEvent) => void;
|
|
19
|
+
}
|
|
20
|
+
type Layout = FC<LayoutProps>;
|
|
21
|
+
export type { Layout };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Platform, StyleSheet } from "react-native";
|
|
2
|
+
import { HEADER_HEIGHT } from "../../../../templates/header/Header.style";
|
|
3
|
+
const style = StyleSheet.create({
|
|
4
|
+
header: {
|
|
5
|
+
...Platform.select({
|
|
6
|
+
web: {
|
|
7
|
+
position: "sticky",
|
|
8
|
+
top: 0,
|
|
9
|
+
zIndex: 10,
|
|
10
|
+
height: HEADER_HEIGHT,
|
|
11
|
+
},
|
|
12
|
+
native: {
|
|
13
|
+
position: "relative",
|
|
14
|
+
height: HEADER_HEIGHT,
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export { style };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { GestureHandlerRootView, ScrollView as RNGHScrollView } from "react-native-gesture-handler";
|
|
5
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
6
|
+
import { Footer as DefaultFooter } from "../../../templates/footer/Footer";
|
|
7
|
+
import { DefaultHeader } from "../../../templates/header/defaultHeader/DefaultHeader";
|
|
8
|
+
import { Footer } from "../components/footer/Footer";
|
|
9
|
+
import { Header } from "../components/header/Header";
|
|
10
|
+
import { style } from "./DummyLayout.style";
|
|
11
|
+
const DummyLayout = ({ children, header = React.createElement(DefaultHeader, null), footer = React.createElement(DefaultFooter, null), panel, style: customStyle, scrollEnabled, onLayout, }) => (React.createElement(SafeAreaView, { style: [style.safeAreaView, customStyle?.safeAreaView] },
|
|
12
|
+
React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
|
|
13
|
+
React.createElement(RNGHScrollView, { contentContainerStyle: [style.scrollView, customStyle?.scrollView], scrollEnabled: scrollEnabled, scrollEventThrottle: 16, showsVerticalScrollIndicator: false, stickyHeaderIndices: [0] },
|
|
14
|
+
React.createElement(Header, null, header),
|
|
15
|
+
panel,
|
|
16
|
+
React.createElement(View, { style: style.children, onLayout: onLayout }, children))),
|
|
17
|
+
React.createElement(Footer, null, footer)));
|
|
18
|
+
export { DummyLayout };
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text, View } from "@lookiero/aurora";
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
|
+
import { NewFeedbackExperimentVariation, useNewFeedbackExperiment, } from "../../../../../hooks/useNewFeedbackExperiment";
|
|
4
5
|
import { I18nMessages } from "../../../../../i18n/i18n";
|
|
5
6
|
import { style } from "./HostDefaultReturnQuestionItem.style";
|
|
6
7
|
const HostDefaultReturnQuestionItem = ({ returnQuestion, children }) => {
|
|
7
8
|
const titleText = useI18nMessage({ id: returnQuestion.name });
|
|
8
9
|
const isAllOptions = returnQuestion.name === I18nMessages.RETURN_QUESTION_MAIN_ALL_OPINION;
|
|
10
|
+
/* Kameleoon experiment */
|
|
11
|
+
const newFeedbackVariation = useNewFeedbackExperiment();
|
|
12
|
+
const isReturnPage = newFeedbackVariation === NewFeedbackExperimentVariation.RETURN_PAGE;
|
|
13
|
+
/* Kameleoon experiment */
|
|
9
14
|
return (React.createElement(React.Fragment, null,
|
|
10
|
-
titleText && titleText !== " "
|
|
15
|
+
titleText && titleText !== " " ? (React.createElement(View, { style: [
|
|
16
|
+
style.title,
|
|
17
|
+
isAllOptions ? style.allOptionsTitle : undefined,
|
|
18
|
+
isReturnPage ? style.formTitle : undefined,
|
|
19
|
+
] },
|
|
11
20
|
React.createElement(Text, { level: 3, action: true }, titleText))) : null,
|
|
12
21
|
children));
|
|
13
22
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
declare const style: {
|
|
2
|
+
allOptionsTitle: {
|
|
3
|
+
display: "none";
|
|
4
|
+
};
|
|
5
|
+
formTitle: {
|
|
6
|
+
paddingLeft: number;
|
|
7
|
+
};
|
|
2
8
|
title: {
|
|
3
9
|
backgroundColor: string;
|
|
4
10
|
paddingBottom: number;
|
|
5
|
-
|
|
11
|
+
paddingRight: number;
|
|
6
12
|
paddingTop: number;
|
|
7
13
|
};
|
|
8
14
|
};
|
|
@@ -2,10 +2,16 @@ import { StyleSheet } from "react-native";
|
|
|
2
2
|
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
3
|
const { colorBgBase, space4, space6 } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
allOptionsTitle: {
|
|
6
|
+
display: "none",
|
|
7
|
+
},
|
|
8
|
+
formTitle: {
|
|
9
|
+
paddingLeft: space6,
|
|
10
|
+
},
|
|
5
11
|
title: {
|
|
6
12
|
backgroundColor: colorBgBase,
|
|
7
13
|
paddingBottom: space4,
|
|
8
|
-
|
|
14
|
+
paddingRight: space6,
|
|
9
15
|
paddingTop: space6,
|
|
10
16
|
},
|
|
11
17
|
});
|
|
@@ -2,14 +2,19 @@ import React, { useCallback, useMemo } from "react";
|
|
|
2
2
|
import { View } from "@lookiero/aurora";
|
|
3
3
|
import { useIntl } from "@lookiero/i18n-react";
|
|
4
4
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
5
|
+
import { NewFeedbackExperimentVariation, useNewFeedbackExperiment, } from "../../../../../hooks/useNewFeedbackExperiment";
|
|
5
6
|
import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
|
|
6
7
|
import { style } from "./TextareaReturnQuestionItem.style";
|
|
7
8
|
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParent, testID, }) => {
|
|
8
9
|
const { formatMessage } = useIntl();
|
|
10
|
+
/* Kameleoon experiment */
|
|
11
|
+
const newFeedbackVariation = useNewFeedbackExperiment();
|
|
12
|
+
const isReturnPage = newFeedbackVariation === NewFeedbackExperimentVariation.RETURN_PAGE;
|
|
13
|
+
/* Kameleoon experiment */
|
|
9
14
|
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
10
15
|
const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
|
|
11
16
|
const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: value }), [onChange, returnQuestionParent.id]);
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
const fieldComponent = (React.createElement(InputField, { label: placeholderText, placeholder: placeholderText, testID: testID, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
18
|
+
return isReturnPage ? React.createElement(View, { style: style.wrapper }, fieldComponent) : fieldComponent;
|
|
14
19
|
};
|
|
15
20
|
export { TextareaReturnQuestionItem };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ButtonIcon } from "@lookiero/aurora";
|
|
3
|
+
import { Header } from "../Header";
|
|
4
|
+
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
5
|
+
import { Logo } from "../logo/Logo";
|
|
6
|
+
import { style } from "./DefaultHeader.style";
|
|
7
|
+
const DefaultHeader = ({ onPressMenu }) => (React.createElement(Header, { testID: "default-header" },
|
|
8
|
+
React.createElement(Logo, null),
|
|
9
|
+
React.createElement(ButtonIconPlaceholder, null),
|
|
10
|
+
React.createElement(ButtonIcon, { name: "menu", style: style.button, testID: "menu-button-icon", onPress: onPressMenu })));
|
|
11
|
+
export { DefaultHeader };
|
package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "@lookiero/sty-psp-ui";
|
|
3
|
+
const { space10 } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
button: {
|
|
6
|
+
alignSelf: "auto",
|
|
7
|
+
height: space10,
|
|
8
|
+
width: space10,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export { style };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
declare enum NewFeedbackExperimentVariation {
|
|
3
|
+
CONTROL = "control",
|
|
4
|
+
RETURN_PAGE = "return_page"
|
|
5
|
+
}
|
|
6
|
+
interface NewFeedbackExperimentProviderProps {
|
|
7
|
+
readonly children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const NewFeedbackExperimentProvider: FC<NewFeedbackExperimentProviderProps>;
|
|
10
|
+
declare const useNewFeedbackExperiment: () => NewFeedbackExperimentVariation;
|
|
11
|
+
export { useNewFeedbackExperiment, NewFeedbackExperimentProvider, NewFeedbackExperimentVariation };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { createContext, useContext, useEffect, useMemo, useRef } from "react";
|
|
2
|
+
import invariant from "tiny-invariant";
|
|
3
|
+
import { Spinner } from "@lookiero/aurora";
|
|
4
|
+
import { useAssignedVariationByExperimentId } from "@lookiero/sty-psp-ab-testing";
|
|
5
|
+
import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
6
|
+
import { useTrackAssignedVariationByExperiment } from "../../tracking/useTrackAssignedVariationByExperiment";
|
|
7
|
+
import { useStaticInfo } from "./useStaticInfo";
|
|
8
|
+
var NewFeedbackExperimentVariation;
|
|
9
|
+
(function (NewFeedbackExperimentVariation) {
|
|
10
|
+
NewFeedbackExperimentVariation["CONTROL"] = "control";
|
|
11
|
+
NewFeedbackExperimentVariation["RETURN_PAGE"] = "return_page";
|
|
12
|
+
})(NewFeedbackExperimentVariation || (NewFeedbackExperimentVariation = {}));
|
|
13
|
+
const NewFeedbackExperimentContext = createContext(null);
|
|
14
|
+
const NewFeedbackExperimentProvider = ({ children }) => {
|
|
15
|
+
const { kameleoon: { experiments: { newFeedback: { id: newFeedbackId, variations }, }, }, customer: { customerId, country, segment }, } = useStaticInfo();
|
|
16
|
+
const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
17
|
+
const { assignedVariation: newFeedbackVariation } = useAssignedVariationByExperimentId({
|
|
18
|
+
experimentId: newFeedbackId,
|
|
19
|
+
});
|
|
20
|
+
const trackAssignedVariation = useTrackAssignedVariationByExperiment({
|
|
21
|
+
checkoutId: checkout?.id,
|
|
22
|
+
country,
|
|
23
|
+
segment,
|
|
24
|
+
experimentId: newFeedbackId,
|
|
25
|
+
});
|
|
26
|
+
const value = useMemo(() => ({
|
|
27
|
+
variation: newFeedbackVariation?.id === Number(variations.v1)
|
|
28
|
+
? NewFeedbackExperimentVariation.RETURN_PAGE
|
|
29
|
+
: NewFeedbackExperimentVariation.CONTROL,
|
|
30
|
+
}), [newFeedbackVariation?.id, variations.v1]);
|
|
31
|
+
const assignedVariantTracked = useRef(false);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (assignedVariantTracked.current || !newFeedbackVariation || !checkout?.id) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
trackAssignedVariation({ assignedVariation: newFeedbackVariation });
|
|
37
|
+
assignedVariantTracked.current = true;
|
|
38
|
+
}, [checkout?.id, newFeedbackVariation, trackAssignedVariation]);
|
|
39
|
+
if (!checkout) {
|
|
40
|
+
return React.createElement(Spinner, null);
|
|
41
|
+
}
|
|
42
|
+
return React.createElement(NewFeedbackExperimentContext.Provider, { value: value }, children);
|
|
43
|
+
};
|
|
44
|
+
const useNewFeedbackExperiment = () => {
|
|
45
|
+
const newFeedbackExperiment = useContext(NewFeedbackExperimentContext);
|
|
46
|
+
invariant(newFeedbackExperiment, "Your are trying to use the useNewFeedbackExperiment hook without wrapping your app with the <NewFeedbackExperimentProvider>.");
|
|
47
|
+
return newFeedbackExperiment.variation;
|
|
48
|
+
};
|
|
49
|
+
export { useNewFeedbackExperiment, NewFeedbackExperimentProvider, NewFeedbackExperimentVariation };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { memo, Suspense } from "react";
|
|
2
2
|
import { Navigate, Outlet, useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
3
3
|
import { Spinner } from "@lookiero/aurora";
|
|
4
4
|
import { Kameleoon } from "@lookiero/sty-psp-ab-testing";
|
|
5
|
+
import { NewFeedbackExperimentProvider } from "../hooks/useNewFeedbackExperiment";
|
|
5
6
|
import { StaticInfoProvider } from "../hooks/useStaticInfo";
|
|
6
7
|
import { App } from "../views/App";
|
|
8
|
+
import { Checkout } from "../views/checkout/Checkout";
|
|
7
9
|
import { CheckoutPaymentModal } from "../views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal";
|
|
8
|
-
import {
|
|
10
|
+
import { Feedback } from "../views/feedback/Feedback";
|
|
11
|
+
import { Item } from "../views/item/Item";
|
|
12
|
+
import { Return } from "../views/return/Return";
|
|
13
|
+
import { Summary } from "../views/summary/Summary";
|
|
14
|
+
import { SummaryTabs } from "../views/summaryTabs/SummaryTabs";
|
|
9
15
|
import { CheckoutMiddleware } from "./CheckoutMiddleware";
|
|
10
16
|
import { Routes } from "./routes";
|
|
11
17
|
import { BasePathProvider } from "./useBasePath";
|
|
12
|
-
const Item = lazy(() => import("../views/item/Item").then((module) => ({ default: module.Item })));
|
|
13
|
-
const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
|
|
14
|
-
const SummaryTabs = lazy(() => import("../views/summaryTabs/SummaryTabs").then((module) => ({ default: module.SummaryTabs })));
|
|
15
|
-
const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
|
|
16
|
-
const Feedback = lazy(() => import("../views/feedback/Feedback").then((module) => ({ default: module.Feedback })));
|
|
17
|
-
const Return = lazy(() => import("../views/return/Return").then((module) => ({ default: module.Return })));
|
|
18
18
|
const Routing = ({ basePath = "", customer, order, subscription, locale, I18n, kameleoon, layout, getAuthToken, onI18nError, onNotAccessible, onCheckoutSubmitted, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
|
|
19
19
|
return useRoutes([
|
|
20
20
|
{
|
|
21
21
|
path: "",
|
|
22
22
|
element: (React.createElement(BasePathProvider, { basePath: basePath },
|
|
23
|
-
React.createElement(
|
|
24
|
-
React.createElement(
|
|
25
|
-
React.createElement(
|
|
26
|
-
React.createElement(
|
|
27
|
-
React.createElement(
|
|
23
|
+
React.createElement(StaticInfoProvider, { customer: customer, kameleoon: kameleoon },
|
|
24
|
+
React.createElement(I18n, { loader: React.createElement(Spinner, null), locale: locale, onError: onI18nError },
|
|
25
|
+
React.createElement(Kameleoon, { loader: React.createElement(Spinner, null), siteCode: kameleoon.siteCode },
|
|
26
|
+
React.createElement(CheckoutMiddleware, { customerId: customer?.customerId, onNotAccessible: onNotAccessible },
|
|
27
|
+
React.createElement(NewFeedbackExperimentProvider, null,
|
|
28
28
|
React.createElement(App, null,
|
|
29
29
|
React.createElement(Outlet, null))))))))),
|
|
30
30
|
children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from "react";
|
|
2
2
|
import { Platform, ScrollView, View } from "react-native";
|
|
3
3
|
import { useNavigate } from "react-router-native";
|
|
4
|
-
import { Box, Button, Layout
|
|
4
|
+
import { Box, Button, Layout, Spinner, Text, useDevice } 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";
|
|
@@ -23,7 +23,7 @@ import { Pricing } from "../summary/components/pricing/Pricing";
|
|
|
23
23
|
import { style } from "./Checkout.style";
|
|
24
24
|
import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
|
|
25
25
|
import { PaymentInstrument } from "./components/paymentInstrument/PaymentInstrument";
|
|
26
|
-
const Checkout = ({ children, layout:
|
|
26
|
+
const Checkout = ({ children, layout: UiLayout, useRedirect }) => {
|
|
27
27
|
const { customer: { customerId, country, segment }, } = useStaticInfo();
|
|
28
28
|
const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_TITLE });
|
|
29
29
|
const submitButtonText = useI18nMessage({ id: I18nMessages.CHECKOUT_PAY_BUTTON });
|
|
@@ -68,13 +68,13 @@ const Checkout = ({ children, layout: Layout, useRedirect }) => {
|
|
|
68
68
|
if (!dependenciesLoaded) {
|
|
69
69
|
return React.createElement(Spinner, null);
|
|
70
70
|
}
|
|
71
|
-
return (React.createElement(
|
|
71
|
+
return (React.createElement(UiLayout, { header: React.createElement(CheckoutHeader, { onBack: handleOnBack }), scrollEnabled: false, style: {
|
|
72
72
|
header: style.header,
|
|
73
73
|
scrollView: style.scrollView,
|
|
74
74
|
} },
|
|
75
75
|
React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
|
|
76
76
|
hasReplacedCheckoutItem && React.createElement(DeliveryBanner, null),
|
|
77
|
-
React.createElement(
|
|
77
|
+
React.createElement(Layout, { fullWidth: !screen.L, style: [screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }] },
|
|
78
78
|
React.createElement(Box, { size: { L: "2/3" }, style: screen.L && style.desktopListSpacing },
|
|
79
79
|
React.createElement(View, { style: [style.contentWrapper, screen.L && style.desktopContentWrapper] },
|
|
80
80
|
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { Layout
|
|
2
|
+
import { Layout } from "@lookiero/sty-psp-ui";
|
|
3
3
|
interface FeedbackProps {
|
|
4
|
-
readonly layout:
|
|
4
|
+
readonly layout: Layout;
|
|
5
5
|
}
|
|
6
6
|
declare const Feedback: FC<FeedbackProps>;
|
|
7
7
|
export { Feedback };
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
buttonContainer: {
|
|
6
|
+
paddingHorizontal: space6,
|
|
7
|
+
paddingVertical: space8,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export { style };
|