@lookiero/checkout 3.9.0-beta.1 → 3.10.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/infrastructure/domain/checkout/react/useStartCheckout.js +1 -1
- package/dist/infrastructure/projection/checkout/checkout.js +0 -14
- package/dist/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.d.ts +6 -4
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.js +9 -11
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.style.d.ts +1 -0
- package/dist/infrastructure/ui/components/layouts/tabs/Tabs.style.js +1 -0
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +1 -1
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +1 -0
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +3 -3
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +1 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/templates/header/Header.style.d.ts +0 -1
- package/dist/infrastructure/ui/components/templates/header/Header.style.js +1 -3
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +0 -5
- package/dist/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +1 -1
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +6 -4
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +10 -3
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +10 -3
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -3
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.js +3 -0
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js +9 -5
- package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.d.ts +1 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.js +1 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -2
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +3 -0
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -3
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.d.ts +10 -3
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.js +10 -3
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +8 -7
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +6 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +6 -0
- package/dist/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +6 -6
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.js +4 -3
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts +10 -3
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.js +10 -3
- package/dist/shared/ui/components/atoms/input/Input.js +2 -2
- package/dist/shared/ui/components/layouts/carousel/Bullets.d.ts +10 -0
- package/dist/shared/ui/components/layouts/carousel/Bullets.js +28 -0
- package/dist/shared/ui/components/layouts/carousel/Bullets.style.d.ts +12 -0
- package/dist/shared/ui/components/layouts/carousel/Bullets.style.js +15 -0
- package/dist/shared/ui/components/layouts/carousel/Carousel.d.ts +26 -5
- package/dist/shared/ui/components/layouts/carousel/Carousel.js +76 -20
- package/dist/shared/ui/components/layouts/modal/Modal.js +1 -1
- package/dist/shared/ui/components/molecules/selectField/SelectField.js +3 -3
- package/package.json +3 -5
|
@@ -11,7 +11,7 @@ const useStartCheckout = ({ checkoutId, logger }) => {
|
|
|
11
11
|
await commandBus(startCheckout({ aggregateId: checkoutId }));
|
|
12
12
|
}
|
|
13
13
|
catch (error) {
|
|
14
|
-
if (!error?.message?.includes("
|
|
14
|
+
if (!error?.message?.includes("Invariant failed")) {
|
|
15
15
|
logger.captureException(error);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
const toCheckoutProjection = (checkoutDto) => ({
|
|
2
2
|
...checkoutDto,
|
|
3
|
-
items: checkoutDto.items.map((item) => ({
|
|
4
|
-
...item,
|
|
5
|
-
productVariant: {
|
|
6
|
-
...item.productVariant,
|
|
7
|
-
media: [
|
|
8
|
-
...item.productVariant.media,
|
|
9
|
-
...item.productVariant.media,
|
|
10
|
-
...item.productVariant.media,
|
|
11
|
-
...item.productVariant.media,
|
|
12
|
-
...item.productVariant.media,
|
|
13
|
-
...item.productVariant.media,
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
})),
|
|
17
3
|
expiresOn: new Date(checkoutDto.expiresOn),
|
|
18
4
|
});
|
|
19
5
|
export { toCheckoutProjection };
|
package/dist/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js
CHANGED
|
@@ -13,6 +13,6 @@ const useViewPaymentFlowPayloadByCheckoutId = ({ checkoutId }) => useQuery({
|
|
|
13
13
|
query: viewPaymentFlowPayloadByCheckoutId({ checkoutId: checkoutId }),
|
|
14
14
|
contextId: MESSAGING_CONTEXT_ID,
|
|
15
15
|
invalidation: shouldInvalidate,
|
|
16
|
-
options: { refetchOnMount: "always", enabled: Boolean(checkoutId) },
|
|
16
|
+
options: { refetchOnMount: "always", enabled: Boolean(checkoutId), cacheTime: 0 },
|
|
17
17
|
});
|
|
18
18
|
export { useViewPaymentFlowPayloadByCheckoutId };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
import { RenderItemFunction } from "../../../../../shared/ui/components/layouts/carousel/Carousel";
|
|
3
4
|
interface TabStyle {
|
|
4
5
|
readonly tab: StyleProp<ViewStyle>;
|
|
5
6
|
readonly tabText: StyleProp<TextStyle>;
|
|
@@ -14,13 +15,14 @@ interface TabsStyle {
|
|
|
14
15
|
readonly sliderContainer: StyleProp<ViewStyle>;
|
|
15
16
|
readonly tabList: Partial<TabListStyle>;
|
|
16
17
|
}
|
|
17
|
-
interface TabsProps {
|
|
18
|
-
readonly
|
|
18
|
+
interface TabsProps<T> {
|
|
19
|
+
readonly data: T[];
|
|
20
|
+
readonly children: RenderItemFunction<T>;
|
|
19
21
|
readonly defaultIndex?: number;
|
|
20
22
|
readonly tabLabels: string[];
|
|
21
23
|
readonly style?: Partial<TabsStyle>;
|
|
22
24
|
readonly onChanged?: (index: number) => void;
|
|
23
25
|
readonly tabLabelsWrapper?: (children: ReactNode) => ReactNode;
|
|
24
26
|
}
|
|
25
|
-
declare const Tabs:
|
|
27
|
+
declare const Tabs: <T>({ data, children, defaultIndex, tabLabels, style: customStyle, onChanged, tabLabelsWrapper, }: TabsProps<T>) => JSX.Element;
|
|
26
28
|
export { Tabs };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { COLOR, Text } from "@lookiero/aurora";
|
|
2
2
|
import { animated, useSpring } from "@react-spring/native";
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
4
4
|
import { Pressable, View } from "react-native";
|
|
5
5
|
import invariant from "tiny-invariant";
|
|
6
|
-
import {
|
|
6
|
+
import { Carousel } from "../../../../../shared/ui/components/layouts/carousel/Carousel";
|
|
7
7
|
import { style } from "./Tabs.style";
|
|
8
8
|
const Tab = ({ children, active, disabled = false, style: customStyle, onPress, onLayout }) => (React.createElement(Pressable, { disabled: disabled, style: [style.tab, customStyle?.tab], testID: "tab", onLayout: onLayout, onPress: onPress },
|
|
9
9
|
React.createElement(Text, { color: active ? COLOR.CONTENT : COLOR.GRAYSCALE_L, level: 2, style: customStyle?.tabText, detail: true }, children)));
|
|
@@ -18,8 +18,8 @@ const TabList = ({ labels = [], tabIndex = 0, style: customStyle, onSelect }) =>
|
|
|
18
18
|
...prevState.slice(index),
|
|
19
19
|
]), []);
|
|
20
20
|
const springs = useSpring({
|
|
21
|
-
width: tabItemPositions[tabIndex]?.width,
|
|
22
|
-
left: tabItemPositions[tabIndex]?.position,
|
|
21
|
+
width: tabItemPositions[tabIndex]?.width || 0,
|
|
22
|
+
left: tabItemPositions[tabIndex]?.position || 0,
|
|
23
23
|
});
|
|
24
24
|
return (React.createElement(View, { style: [style.tabs, customStyle?.tabList], testID: "tab-list" },
|
|
25
25
|
labels.map((item, index) => (React.createElement(Tab, { key: index, active: tabIndex === index, style: customStyle?.tab, onLayout: (event) => handleOnLayout(event, index), onPress: () => onSelect?.(index) }, item))),
|
|
@@ -27,21 +27,19 @@ const TabList = ({ labels = [], tabIndex = 0, style: customStyle, onSelect }) =>
|
|
|
27
27
|
style.indicator,
|
|
28
28
|
{
|
|
29
29
|
width: springs.width,
|
|
30
|
-
|
|
30
|
+
transform: [{ translateX: springs.left }],
|
|
31
31
|
},
|
|
32
32
|
customStyle?.indicator,
|
|
33
33
|
] })));
|
|
34
34
|
};
|
|
35
|
-
const Tabs = ({ children, defaultIndex = 0, tabLabels, style: customStyle, onChanged, tabLabelsWrapper = (children) => children, }) => {
|
|
36
|
-
invariant(
|
|
35
|
+
const Tabs = ({ data, children, defaultIndex = 0, tabLabels, style: customStyle, onChanged, tabLabelsWrapper = (children) => children, }) => {
|
|
36
|
+
invariant(data.length === tabLabels.length, "data and tab labels must be the same length");
|
|
37
37
|
const [active, setActive] = useState(defaultIndex);
|
|
38
38
|
const handleOnActiveChanged = useCallback((activeIndex) => setActive(activeIndex), []);
|
|
39
|
-
useEffect(() =>
|
|
40
|
-
onChanged?.(active);
|
|
41
|
-
}, [active, onChanged]);
|
|
39
|
+
useEffect(() => onChanged?.(active), [active, onChanged]);
|
|
42
40
|
return (React.createElement(View, { style: [style.container, customStyle?.tabContainer], testID: "tabs" },
|
|
43
41
|
tabLabelsWrapper(React.createElement(TabList, { labels: tabLabels, style: customStyle?.tabList, tabIndex: active, onSelect: handleOnActiveChanged })),
|
|
44
42
|
React.createElement(View, { style: customStyle?.sliderContainer },
|
|
45
|
-
React.createElement(
|
|
43
|
+
React.createElement(Carousel, { activeIndex: active, data: data, enabled: false, onActiveIndexChanged: handleOnActiveChanged }, children))));
|
|
46
44
|
};
|
|
47
45
|
export { Tabs };
|
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
|
2
2
|
import { useCheckoutQuestionItem } from "./behaviors/useCheckoutQuestionItem";
|
|
3
3
|
const CheckoutQuestion = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
4
4
|
const Item = useCheckoutQuestionItem({ type: checkoutQuestion.type });
|
|
5
|
-
return (React.createElement(Item, { checkoutQuestion: checkoutQuestion, checkoutQuestionParentId: checkoutQuestionParentId },
|
|
5
|
+
return (React.createElement(Item, { checkoutQuestion: checkoutQuestion, checkoutQuestionParentId: checkoutQuestionParentId, testID: checkoutQuestion.id },
|
|
6
6
|
React.createElement(React.Fragment, null, checkoutQuestion.children?.map((childCheckoutQuestion) => (React.createElement(CheckoutQuestion, { key: childCheckoutQuestion.id, checkoutQuestion: childCheckoutQuestion, checkoutQuestionParentId: checkoutQuestion.id }))))));
|
|
7
7
|
};
|
|
8
8
|
export default memo(CheckoutQuestion);
|
|
@@ -5,6 +5,7 @@ interface CheckoutQuestionItemProps {
|
|
|
5
5
|
readonly checkoutQuestionParentId: string;
|
|
6
6
|
readonly children?: ReactNode;
|
|
7
7
|
readonly portalHostName?: string;
|
|
8
|
+
readonly testID?: string;
|
|
8
9
|
}
|
|
9
10
|
type CheckoutQuestionItem = FC<CheckoutQuestionItemProps>;
|
|
10
11
|
export type { CheckoutQuestionItem, CheckoutQuestionItemProps };
|
|
@@ -5,10 +5,10 @@ import { theme } from "../../../../../theme/theme";
|
|
|
5
5
|
import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
|
|
6
6
|
import { style } from "./ButtonCheckoutQuestionItem.style";
|
|
7
7
|
const { colorAccent, colorBase } = theme();
|
|
8
|
-
const ButtonCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
8
|
+
const ButtonCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, testID, }) => {
|
|
9
9
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
10
10
|
const optionText = useI18nMessage({ id: checkoutQuestion.name });
|
|
11
11
|
const handleOnPress = useCallback(() => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }), [onChange, checkoutQuestion.id, checkoutQuestionParentId]);
|
|
12
|
-
return (React.createElement(Button, { style: [style.button, { backgroundColor: feedback === checkoutQuestion.id ? colorAccent : colorBase }], variant: BUTTON_VARIANT.SECONDARY, onPress: handleOnPress }, optionText));
|
|
12
|
+
return (React.createElement(Button, { accessibilityLabel: testID, style: [style.button, { backgroundColor: feedback === checkoutQuestion.id ? colorAccent : colorBase }], testID: testID, variant: BUTTON_VARIANT.SECONDARY, onPress: handleOnPress }, optionText));
|
|
13
13
|
};
|
|
14
14
|
export { ButtonCheckoutQuestionItem };
|
|
@@ -16,12 +16,12 @@ const ICON = {
|
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
17
|
"checkout_question.icon.good": Happy,
|
|
18
18
|
};
|
|
19
|
-
const IconCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
19
|
+
const IconCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, testID, }) => {
|
|
20
20
|
const Icon = ICON[checkoutQuestion.name];
|
|
21
21
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
22
22
|
const handleOnPress = useCallback(() => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }), [onChange, checkoutQuestion.id, checkoutQuestionParentId]);
|
|
23
23
|
invariant(Icon, "CheckoutQuestion icon does not exist");
|
|
24
|
-
return (React.createElement(Pressable, { onPress: handleOnPress },
|
|
25
|
-
React.createElement(Icon, { fill: feedback === checkoutQuestion.id ? colorAccent : "none", style: style.icon
|
|
24
|
+
return (React.createElement(Pressable, { accessibilityLabel: testID, testID: testID, onPress: handleOnPress },
|
|
25
|
+
React.createElement(Icon, { fill: feedback === checkoutQuestion.id ? colorAccent : "none", style: style.icon })));
|
|
26
26
|
};
|
|
27
27
|
export { IconCheckoutQuestionItem };
|
|
@@ -3,11 +3,11 @@ import React, { useCallback, useMemo } from "react";
|
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
4
|
import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
|
|
5
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
6
|
-
const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
6
|
+
const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, testID, }) => {
|
|
7
7
|
const { formatMessage } = useIntl();
|
|
8
8
|
const placeholderText = useMemo(() => (checkoutQuestion.placeholder ? formatMessage({ id: checkoutQuestion.placeholder }) : ""), [formatMessage, checkoutQuestion.placeholder]);
|
|
9
9
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
10
10
|
const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
|
|
11
|
-
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
11
|
+
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, testID: testID, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
12
12
|
};
|
|
13
13
|
export { TextareaCheckoutQuestionItem };
|
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
|
2
2
|
import { useReturnQuestionItem } from "./behaviors/useReturnQuestionItem";
|
|
3
3
|
const ReturnQuestion = ({ returnQuestion, returnQuestionParentId, portalHostName, }) => {
|
|
4
4
|
const Item = useReturnQuestionItem({ type: returnQuestion.type });
|
|
5
|
-
return (React.createElement(Item, { portalHostName: portalHostName, returnQuestion: returnQuestion, returnQuestionParentId: returnQuestionParentId },
|
|
5
|
+
return (React.createElement(Item, { portalHostName: portalHostName, returnQuestion: returnQuestion, returnQuestionParentId: returnQuestionParentId, testID: returnQuestion.id },
|
|
6
6
|
React.createElement(React.Fragment, null, returnQuestion.children?.map((childReturnQuestion) => (React.createElement(ReturnQuestion, { key: childReturnQuestion.id, portalHostName: portalHostName, returnQuestion: childReturnQuestion, returnQuestionParentId: returnQuestion.id }))))));
|
|
7
7
|
};
|
|
8
8
|
export default memo(ReturnQuestion);
|
|
@@ -5,6 +5,7 @@ interface ReturnQuestionItemProps {
|
|
|
5
5
|
readonly returnQuestionParentId: string;
|
|
6
6
|
readonly children?: ReactNode;
|
|
7
7
|
readonly portalHostName?: string;
|
|
8
|
+
readonly testID?: string;
|
|
8
9
|
}
|
|
9
10
|
type ReturnQuestionItem = FC<ReturnQuestionItemProps>;
|
|
10
11
|
export type { ReturnQuestionItem, ReturnQuestionItemProps };
|
|
@@ -7,7 +7,7 @@ import { InputField } from "../../../../../../../shared/ui/components/molecules/
|
|
|
7
7
|
import { useReturnQuestionFeedback, useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
8
8
|
import { deepestReturnQuestionWithFeedbackForReturnQuestion, feedbackForReturnQuestion, } from "../../util/returnQuestionFeedback";
|
|
9
9
|
import { style, containerUnderlayColor } from "./HostSelectReturnQuestionItem.style";
|
|
10
|
-
const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
|
|
10
|
+
const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName, testID, }) => {
|
|
11
11
|
const { formatMessage } = useIntl();
|
|
12
12
|
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
13
13
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -31,7 +31,7 @@ const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName
|
|
|
31
31
|
// deepestReturnQuestionWithFeedback needs to be as a dependency in order to be re-evaluated whenever it changes
|
|
32
32
|
}, [handleOnModalClose, deepestReturnQuestionWithFeedback, isLeaf]);
|
|
33
33
|
return (React.createElement(React.Fragment, null,
|
|
34
|
-
React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
34
|
+
React.createElement(TouchableHighlight, { accessibilityLabel: testID, style: style.container, testID: testID, underlayColor: containerUnderlayColor, accessible: true, onPress: handleOnPress },
|
|
35
35
|
React.createElement(View, { pointerEvents: "none" },
|
|
36
36
|
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholderText, value: inputValue }))),
|
|
37
37
|
React.createElement(Modal, { portalHostName: portalHostName, visible: modalVisible, header: deepestReturnQuestionWithFeedback && (React.createElement(ButtonIcon, { name: "arrow-left", testID: "modal-back-button", onPress: handleOnBackButtonPress })), scroll: true, showCloseButton: true, onClose: handleOnModalClose },
|
|
@@ -4,11 +4,11 @@ import React, { useCallback } from "react";
|
|
|
4
4
|
import { TouchableHighlight } from "react-native";
|
|
5
5
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
6
6
|
import { containerUnderlayColor, style } from "./OptionReturnQuestionItem.style";
|
|
7
|
-
const OptionReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
|
|
7
|
+
const OptionReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, testID, }) => {
|
|
8
8
|
const { onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
|
|
9
9
|
const optionText = useI18nMessage({ id: returnQuestion.name });
|
|
10
10
|
const handleOnPress = useCallback(() => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: returnQuestion.id }), [onChange, returnQuestion.id, returnQuestionParentId]);
|
|
11
|
-
return (React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
11
|
+
return (React.createElement(TouchableHighlight, { accessibilityLabel: testID, style: style.container, testID: testID, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
12
12
|
React.createElement(Text, { level: 3, style: style.text }, optionText)));
|
|
13
13
|
};
|
|
14
14
|
export { OptionReturnQuestionItem };
|
|
@@ -3,11 +3,11 @@ import React, { useCallback, useMemo } from "react";
|
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
4
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
5
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
6
|
-
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
|
|
6
|
+
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, testID, }) => {
|
|
7
7
|
const { formatMessage } = useIntl();
|
|
8
8
|
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
9
9
|
const { feedback, onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
|
|
10
10
|
const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: value }), [onChange, returnQuestionParentId]);
|
|
11
|
-
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
11
|
+
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, testID: testID, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
12
12
|
};
|
|
13
13
|
export { TextareaReturnQuestionItem };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../theme/theme";
|
|
3
|
-
const { colorBase, spaceS
|
|
4
|
-
const HEADER_HEIGHT = spaceXXXL;
|
|
3
|
+
const { colorBase, spaceS } = theme();
|
|
5
4
|
const style = StyleSheet.create({
|
|
6
5
|
header: {
|
|
7
6
|
alignItems: "center",
|
|
@@ -9,7 +8,6 @@ const style = StyleSheet.create({
|
|
|
9
8
|
flexDirection: "row",
|
|
10
9
|
flexGrow: 0,
|
|
11
10
|
flexWrap: "nowrap",
|
|
12
|
-
height: HEADER_HEIGHT,
|
|
13
11
|
justifyContent: "space-between",
|
|
14
12
|
overflow: "visible",
|
|
15
13
|
paddingHorizontal: spaceS,
|
|
@@ -23,5 +23,5 @@ interface UseSubmitCheckoutFunction {
|
|
|
23
23
|
(args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckoutResult;
|
|
24
24
|
}
|
|
25
25
|
declare const useSubmitCheckout: UseSubmitCheckoutFunction;
|
|
26
|
-
export type { Status };
|
|
26
|
+
export type { Status, SubmitCheckoutFunction };
|
|
27
27
|
export { useSubmitCheckout };
|
|
@@ -19,11 +19,6 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
|
|
|
19
19
|
catch (error) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* paymentFlowRef.current is not properly set between render-cycles,
|
|
24
|
-
* so we have to defer the startLegacyBoxCheckout invocation.
|
|
25
|
-
*/
|
|
26
|
-
await new Promise((resolve) => setTimeout(() => resolve(0), 200));
|
|
27
22
|
paymentFlowRef.current?.startLegacyBoxCheckout(
|
|
28
23
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
29
24
|
// @ts-ignore
|
|
@@ -32,6 +32,6 @@ const CheckoutQuestionsForm = ({ checkoutQuestions, submitButtonDisabled, onSubm
|
|
|
32
32
|
return (React.createElement(React.Fragment, null,
|
|
33
33
|
React.createElement(CheckoutQuestionItemProvider, { checkoutQuestionItems: checkoutQuestionItems },
|
|
34
34
|
React.createElement(CheckoutQuestions, { checkoutQuestions: filteredCheckoutQuestions })),
|
|
35
|
-
React.createElement(Button, { busy: submitButtonDisabled, style: style.button, onPress: handlePress }, buttonText)));
|
|
35
|
+
React.createElement(Button, { busy: submitButtonDisabled, style: style.button, testID: "checkout-feedback-button", onPress: handlePress }, buttonText)));
|
|
36
36
|
};
|
|
37
37
|
export { CheckoutQuestionsForm };
|
package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js
CHANGED
|
@@ -12,9 +12,11 @@ const GetOutOfCheckoutModal = ({ visible, onDismiss, onConfirm }) => {
|
|
|
12
12
|
const confirmButtonText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON });
|
|
13
13
|
return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
|
|
14
14
|
React.createElement(View, { style: style.modal },
|
|
15
|
-
React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
|
|
16
|
-
React.createElement(Text, { level: 3, style: style.
|
|
17
|
-
React.createElement(Button, { style: style.button, onPress: onDismiss },
|
|
18
|
-
|
|
15
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
|
|
16
|
+
React.createElement(Text, { level: 3, style: style.description }, descriptionText),
|
|
17
|
+
React.createElement(Button, { style: style.button, onPress: onDismiss },
|
|
18
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, dismissButtonText)),
|
|
19
|
+
React.createElement(Button, { style: [style.button, style.confirmButton], variant: BUTTON_VARIANT.SECONDARY, onPress: onConfirm },
|
|
20
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, confirmButtonText)))));
|
|
19
21
|
};
|
|
20
22
|
export { GetOutOfCheckoutModal };
|
|
@@ -2,15 +2,22 @@ declare const style: {
|
|
|
2
2
|
button: {
|
|
3
3
|
flex: number;
|
|
4
4
|
};
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: string;
|
|
7
|
+
};
|
|
5
8
|
confirmButton: {
|
|
6
9
|
marginTop: number;
|
|
7
10
|
};
|
|
11
|
+
description: {
|
|
12
|
+
marginVertical: number;
|
|
13
|
+
textAlign: "center";
|
|
14
|
+
width: string;
|
|
15
|
+
};
|
|
8
16
|
modal: {
|
|
9
17
|
padding: number;
|
|
10
18
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
textAlign: "center";
|
|
19
|
+
title: {
|
|
20
|
+
width: string;
|
|
14
21
|
};
|
|
15
22
|
};
|
|
16
23
|
export { style };
|
|
@@ -5,15 +5,22 @@ const style = StyleSheet.create({
|
|
|
5
5
|
button: {
|
|
6
6
|
flex: 0,
|
|
7
7
|
},
|
|
8
|
+
buttonText: {
|
|
9
|
+
width: "100%",
|
|
10
|
+
},
|
|
8
11
|
confirmButton: {
|
|
9
12
|
marginTop: spaceXL,
|
|
10
13
|
},
|
|
14
|
+
description: {
|
|
15
|
+
marginVertical: spaceXL,
|
|
16
|
+
textAlign: "center",
|
|
17
|
+
width: "100%",
|
|
18
|
+
},
|
|
11
19
|
modal: {
|
|
12
20
|
padding: spaceXL,
|
|
13
21
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
textAlign: "center",
|
|
22
|
+
title: {
|
|
23
|
+
width: "100%",
|
|
17
24
|
},
|
|
18
25
|
});
|
|
19
26
|
export { style };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, BUTTON_VARIANT } from "@lookiero/aurora";
|
|
1
|
+
import { ALIGN, Button, BUTTON_VARIANT, Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useMemo } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
@@ -20,7 +20,7 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onSizeSe
|
|
|
20
20
|
(sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === currentProductVariant.id), [sizeSelectorOptions, currentProductVariant.id]);
|
|
21
21
|
return (React.createElement(Sticky, { onLayout: onLayout },
|
|
22
22
|
React.createElement(Body, { style: { column: style.container } },
|
|
23
|
-
React.createElement(Button, { onPress: onKeep }, keepButtonText),
|
|
23
|
+
React.createElement(Button, { testID: "keep-button", onPress: onKeep }, keepButtonText),
|
|
24
24
|
React.createElement(View, { style: style.row },
|
|
25
25
|
!currentProductVariant.size.unique && productVariants && (React.createElement(SelectField, { ...(disabledSizeSelector && {
|
|
26
26
|
onPress: onSizeSelectorPress,
|
|
@@ -29,6 +29,7 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onSizeSe
|
|
|
29
29
|
inputField: { input: disabledSizeSelector && style.inputDisabled },
|
|
30
30
|
}, onChange: onReplace })),
|
|
31
31
|
React.createElement(View, { style: style.returnButtonContainer },
|
|
32
|
-
React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn },
|
|
32
|
+
React.createElement(Button, { testID: "return-button", variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn },
|
|
33
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, returnButtonText)))))));
|
|
33
34
|
};
|
|
34
35
|
export { ItemActions };
|
|
@@ -2,6 +2,9 @@ import { StyleSheet } from "react-native";
|
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
3
|
const { colorGrayscaleL, spaceM, spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
},
|
|
5
8
|
container: {
|
|
6
9
|
paddingHorizontal: spaceXL,
|
|
7
10
|
},
|
package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
2
|
import { Image, View } from "react-native";
|
|
3
3
|
import { AspectRatioView } from "../../../../../../shared/ui/components/atoms/aspectRatioView/AspectRatioView";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Bullets } from "../../../../../../shared/ui/components/layouts/carousel/Bullets";
|
|
5
|
+
import { Carousel, } from "../../../../../../shared/ui/components/layouts/carousel/Carousel";
|
|
6
6
|
import { useMediaImage } from "../../../../hooks/useMediaImage";
|
|
7
7
|
import { style } from "./ProductVariantSlider.style";
|
|
8
8
|
const ProductVariantSlider = ({ producVariantMedia, onChanged }) => {
|
|
9
9
|
const cdnImageUrl = useMediaImage();
|
|
10
|
-
const
|
|
10
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
11
|
+
const handleOnActiveChanged = useCallback((activeIndex) => {
|
|
12
|
+
setActiveIndex(activeIndex);
|
|
13
|
+
onChanged?.(activeIndex);
|
|
14
|
+
}, [onChanged]);
|
|
11
15
|
const renderItem = useCallback(({ item }) => (React.createElement(View, { style: style.slide },
|
|
12
16
|
React.createElement(AspectRatioView, { aspectRatio: 4 / 3 },
|
|
13
17
|
React.createElement(Image, { resizeMode: "contain", style: style.image, testID: "product-variant-image", source: {
|
|
@@ -17,6 +21,6 @@ const ProductVariantSlider = ({ producVariantMedia, onChanged }) => {
|
|
|
17
21
|
}),
|
|
18
22
|
} })))), [cdnImageUrl]);
|
|
19
23
|
const renderBullets = useCallback(({ activeIndex, count, onChange }) => React.createElement(Bullets, { activeIndex: activeIndex, count: count, onChange: onChange }), []);
|
|
20
|
-
return (React.createElement(
|
|
24
|
+
return (React.createElement(Carousel, { activeIndex: activeIndex, bullets: renderBullets, data: producVariantMedia, onActiveIndexChanged: handleOnActiveChanged }, renderItem));
|
|
21
25
|
};
|
|
22
26
|
export { ProductVariantSlider };
|
package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PortalHost } from "@gorhom/portal";
|
|
2
|
-
import { Button, Text } from "@lookiero/aurora";
|
|
2
|
+
import { ALIGN, Button, Text } from "@lookiero/aurora";
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
4
|
import React, { useCallback } from "react";
|
|
5
5
|
import { View } from "react-native";
|
|
@@ -35,6 +35,7 @@ const ReturnQuestionsForm = ({ returnQuestions, visible, onSubmit, onClose }) =>
|
|
|
35
35
|
React.createElement(View, { style: style.returnQuestionsContainer },
|
|
36
36
|
React.createElement(Text, { level: 2, style: style.title }, titleText),
|
|
37
37
|
React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }),
|
|
38
|
-
React.createElement(Button, { style: style.submit, onPress: handleOnSubmit },
|
|
38
|
+
React.createElement(Button, { style: style.submit, testID: "return-questions-button", onPress: handleOnSubmit },
|
|
39
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, submitButtonText))))));
|
|
39
40
|
};
|
|
40
41
|
export { ReturnQuestionsForm };
|
|
@@ -2,6 +2,9 @@ import { StyleSheet } from "react-native";
|
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
3
|
const { spaceS, spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
},
|
|
5
8
|
returnQuestionsContainer: {
|
|
6
9
|
paddingHorizontal: spaceXL,
|
|
7
10
|
},
|
package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js
CHANGED
|
@@ -11,8 +11,9 @@ const SizeWithoutStockModal = ({ visible, onDismiss }) => {
|
|
|
11
11
|
const buttonText = useI18nMessage({ id: I18nMessages.SIZE_WITHOUT_STOCK_MODAL_BUTTON });
|
|
12
12
|
return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
|
|
13
13
|
React.createElement(View, { style: style.modal },
|
|
14
|
-
React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
|
|
15
|
-
React.createElement(Text, { level: 3, style: style.
|
|
16
|
-
React.createElement(Button, { style: style.button, onPress: onDismiss },
|
|
14
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
|
|
15
|
+
React.createElement(Text, { level: 3, style: style.description }, descriptionText),
|
|
16
|
+
React.createElement(Button, { style: style.button, onPress: onDismiss },
|
|
17
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, buttonText)))));
|
|
17
18
|
};
|
|
18
19
|
export { SizeWithoutStockModal };
|
|
@@ -2,12 +2,19 @@ declare const style: {
|
|
|
2
2
|
button: {
|
|
3
3
|
flex: number;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
description: {
|
|
9
9
|
marginVertical: number;
|
|
10
10
|
textAlign: "center";
|
|
11
|
+
width: string;
|
|
12
|
+
};
|
|
13
|
+
modal: {
|
|
14
|
+
padding: number;
|
|
15
|
+
};
|
|
16
|
+
title: {
|
|
17
|
+
width: string;
|
|
11
18
|
};
|
|
12
19
|
};
|
|
13
20
|
export { style };
|
|
@@ -5,12 +5,19 @@ const style = StyleSheet.create({
|
|
|
5
5
|
button: {
|
|
6
6
|
flex: 0,
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
buttonText: {
|
|
9
|
+
width: "100%",
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
description: {
|
|
12
12
|
marginVertical: spaceXL,
|
|
13
13
|
textAlign: "center",
|
|
14
|
+
width: "100%",
|
|
15
|
+
},
|
|
16
|
+
modal: {
|
|
17
|
+
padding: spaceXL,
|
|
18
|
+
},
|
|
19
|
+
title: {
|
|
20
|
+
width: "100%",
|
|
14
21
|
},
|
|
15
22
|
});
|
|
16
23
|
export { style };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, Text } from "@lookiero/aurora";
|
|
1
|
+
import { ALIGN, Button, Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import { animated, useSpring } from "@react-spring/native";
|
|
4
4
|
import React from "react";
|
|
@@ -30,17 +30,18 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
|
|
|
30
30
|
const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE });
|
|
31
31
|
const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
|
|
32
32
|
const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
|
|
33
|
-
return (React.createElement(
|
|
34
|
-
collapsible && (React.createElement(
|
|
33
|
+
return (React.createElement(React.Fragment, null,
|
|
34
|
+
collapsible && (React.createElement(Pressable, { style: style.iconContainer, testID: "pricing-collapsed", onPress: onPress }, collapsed ? (React.createElement(ArrowUp, { stroke: colorGrayscaleS, style: style.icon, testID: "arrow-up" })) : (React.createElement(ArrowDown, { stroke: colorGrayscaleS, style: style.icon, testID: "arrow-down" })))),
|
|
35
35
|
collapsed && collapsible ? (React.createElement(animated.View, { style: [style.collapsed, { opacity: collapsedStyle.opacitiy }] },
|
|
36
|
-
React.createElement(View,
|
|
36
|
+
React.createElement(View, { style: style.collapsedContent },
|
|
37
37
|
React.createElement(Text, { level: 1, style: style.totalCollapsed, detail: true },
|
|
38
38
|
totalText,
|
|
39
39
|
" ",
|
|
40
40
|
totalCheckoutItemsKeptText),
|
|
41
41
|
React.createElement(Price, { price: pendingToPay, variant: "detail" })),
|
|
42
|
-
React.createElement(View,
|
|
43
|
-
React.createElement(Button, { busy: busy, small: true, onPress: onSubmit },
|
|
42
|
+
React.createElement(View, { style: style.collapsedContent },
|
|
43
|
+
React.createElement(Button, { busy: busy, testID: "confirm-checkout-collpased-button", small: true, onPress: onSubmit },
|
|
44
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, submitButtonText))))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
|
|
44
45
|
React.createElement(Row, { text: `${subtotalText} ${totalCheckoutItemsKeptText}` },
|
|
45
46
|
React.createElement(Price, { price: subtotal, variant: "subtotal" })),
|
|
46
47
|
discount && discount.amount !== 0 && (React.createElement(Row, { text: discountText },
|
|
@@ -51,6 +52,6 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
|
|
|
51
52
|
React.createElement(View, { style: style.divider }),
|
|
52
53
|
React.createElement(Row, { level: 2, text: totalText },
|
|
53
54
|
React.createElement(Price, { price: pendingToPay, variant: "total" })),
|
|
54
|
-
React.createElement(Button, { busy: busy, onPress: onSubmit }, submitButtonText)))));
|
|
55
|
+
React.createElement(Button, { busy: busy, testID: "confirm-checkout-button", onPress: onSubmit }, submitButtonText)))));
|
|
55
56
|
};
|
|
56
57
|
export { Pricing };
|
|
@@ -2,10 +2,16 @@ import { StyleSheet } from "react-native";
|
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
3
|
const { colorContent, spaceXS, spaceL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
},
|
|
5
8
|
collapsed: {
|
|
6
9
|
flexDirection: "row",
|
|
7
10
|
justifyContent: "space-between",
|
|
8
11
|
},
|
|
12
|
+
collapsedContent: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
},
|
|
9
15
|
divider: {
|
|
10
16
|
backgroundColor: colorContent,
|
|
11
17
|
height: 1,
|
package/dist/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
-
import React, { useCallback } from "react";
|
|
3
|
+
import React, { useCallback, useMemo } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
6
|
import { Tabs } from "../../../../components/layouts/tabs/Tabs";
|
|
@@ -15,10 +15,10 @@ const CheckoutItemsTabs = ({ tabIndex, checkoutItemsKept, checkoutItemsReturned,
|
|
|
15
15
|
const keepEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_EMPTY });
|
|
16
16
|
const returnEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_EMPTY });
|
|
17
17
|
const handleOnPressItem = useCallback((checkoutItemId) => onPressItem(checkoutItemId), [onPressItem]);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const data = useMemo(() => [0, 0], []);
|
|
19
|
+
const renderItem = useCallback(({ index }) => index === 0 ? (checkoutItemsKept.length === 0 ? (React.createElement(Text, { style: style.emptyText }, keepEmptyText)) : (React.createElement(React.Fragment, null, checkoutItemsKept.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemStatus: checkoutItem.status, country: country, testID: "keep-checkout-item", checkoutItemProductVariant: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
20
|
+
? checkoutItem.replacedFor
|
|
21
|
+
: checkoutItem.productVariant, onPress: () => handleOnPressItem(checkoutItem.id) })))))) : checkoutItemsReturned.length === 0 ? (React.createElement(Text, { style: style.emptyText }, returnEmptyText)) : (React.createElement(React.Fragment, null, checkoutItemsReturned.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemProductVariant: checkoutItem.productVariant, checkoutItemStatus: checkoutItem.status, country: country, style: { image: style.returnCheckoutItem }, testID: "return-checkout-item", discarded: true, onPress: () => handleOnPressItem(checkoutItem.id) }))))), [checkoutItemsKept, checkoutItemsReturned, country, handleOnPressItem, keepEmptyText, returnEmptyText]);
|
|
22
|
+
return (React.createElement(Tabs, { data: data, defaultIndex: tabIndex, style: { sliderContainer: style.sliderContainer }, tabLabels: [`${keepTabText} (${checkoutItemsKept.length})`, `${returnTabText} (${checkoutItemsReturned.length})`], onChanged: onChanged }, renderItem));
|
|
23
23
|
};
|
|
24
24
|
export { CheckoutItemsTabs };
|
|
@@ -24,8 +24,9 @@ const ModalNotificationItem = ({ visible, notification, onRemove, testID = "moda
|
|
|
24
24
|
}, [notification.id, onRemove]);
|
|
25
25
|
return (React.createElement(Modal, { testID: testID, visible: visible, onClose: handleOnClose },
|
|
26
26
|
React.createElement(View, { style: style.modal },
|
|
27
|
-
React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
|
|
28
|
-
React.createElement(Text, { level: 3, style: style.
|
|
29
|
-
React.createElement(Button, { style: style.button, onPress: handleOnClose },
|
|
27
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
|
|
28
|
+
React.createElement(Text, { level: 3, style: style.description }, bodyText),
|
|
29
|
+
React.createElement(Button, { style: style.button, testID: "modal-notification-button", onPress: handleOnClose },
|
|
30
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, acceptText)))));
|
|
30
31
|
};
|
|
31
32
|
export { ModalNotificationItem };
|
|
@@ -2,12 +2,19 @@ declare const style: {
|
|
|
2
2
|
button: {
|
|
3
3
|
flex: number;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
description: {
|
|
9
9
|
marginVertical: number;
|
|
10
10
|
textAlign: "center";
|
|
11
|
+
width: string;
|
|
12
|
+
};
|
|
13
|
+
modal: {
|
|
14
|
+
padding: number;
|
|
15
|
+
};
|
|
16
|
+
title: {
|
|
17
|
+
width: string;
|
|
11
18
|
};
|
|
12
19
|
};
|
|
13
20
|
export { style };
|
|
@@ -5,12 +5,19 @@ const style = StyleSheet.create({
|
|
|
5
5
|
button: {
|
|
6
6
|
flex: 0,
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
buttonText: {
|
|
9
|
+
width: "100%",
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
description: {
|
|
12
12
|
marginVertical: spaceXL,
|
|
13
13
|
textAlign: "center",
|
|
14
|
+
width: "100%",
|
|
15
|
+
},
|
|
16
|
+
modal: {
|
|
17
|
+
padding: spaceXL,
|
|
18
|
+
},
|
|
19
|
+
title: {
|
|
20
|
+
width: "100%",
|
|
14
21
|
},
|
|
15
22
|
});
|
|
16
23
|
export { style };
|
|
@@ -6,7 +6,7 @@ const MIN_HEIGHT = 56;
|
|
|
6
6
|
const MAX_HEIGHT = 242; // 10 lines
|
|
7
7
|
const { colorGrayscaleL } = theme();
|
|
8
8
|
const clamp = (min, max, value) => Math.min(Math.max(min, value), max);
|
|
9
|
-
const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline, ...restOfProps }) => {
|
|
9
|
+
const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline, testID = "input", ...restOfProps }) => {
|
|
10
10
|
const [height, setHeight] = useState(minHeight);
|
|
11
11
|
// When content height has became smaller the onContentSizeChange does in fact triggered but the internal height is incorrect.
|
|
12
12
|
const handleOnContentSizeChange = useCallback((event) => {
|
|
@@ -32,6 +32,6 @@ const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customSt
|
|
|
32
32
|
}, [maxHeight, minHeight, multiline]);
|
|
33
33
|
useLayoutEffect(handleOnContentSizeChangeWeb, [handleOnContentSizeChangeWeb, value]);
|
|
34
34
|
const textInputRef = useRef(null);
|
|
35
|
-
return (React.createElement(TextInput, {
|
|
35
|
+
return (React.createElement(TextInput, { ref: textInputRef, accessibilityLabel: testID, multiline: multiline, numberOfLines: !!multiline ? undefined : 1, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, { height }], testID: testID, textAlignVertical: "top", value: value, accessible: true, onChange: onChange, onContentSizeChange: handleOnContentSizeChange, ...restOfProps }));
|
|
36
36
|
};
|
|
37
37
|
export { Input };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
interface BulletsProps {
|
|
3
|
+
readonly activeIndex: number;
|
|
4
|
+
readonly onChange: (index: number) => void;
|
|
5
|
+
readonly count: number;
|
|
6
|
+
readonly maxBullets?: number;
|
|
7
|
+
readonly testID?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Bullets: FC<BulletsProps>;
|
|
10
|
+
export { Bullets };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { animated, useSpring } from "@react-spring/native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { View, Pressable } from "react-native";
|
|
4
|
+
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
5
|
+
import { style } from "./Bullets.style";
|
|
6
|
+
const { colorContent, colorGrayscaleM } = theme();
|
|
7
|
+
const MAX = 5;
|
|
8
|
+
const DIAMETER_MAX = 8;
|
|
9
|
+
const DIAMETER_MIN = 2;
|
|
10
|
+
const Bullet = ({ index, activeIndex, maxBullets, onChange }) => {
|
|
11
|
+
const pivot = Math.floor(maxBullets / 2) + 1;
|
|
12
|
+
const delta = Math.abs(index - activeIndex);
|
|
13
|
+
const diameter = delta > 1 ? DIAMETER_MAX - delta * DIAMETER_MIN : DIAMETER_MAX;
|
|
14
|
+
const color = delta === 0 ? colorContent : colorGrayscaleM;
|
|
15
|
+
const springs = useSpring({ diameter, color });
|
|
16
|
+
return delta >= pivot ? null : (React.createElement(Pressable, { onPress: () => onChange(index) },
|
|
17
|
+
React.createElement(animated.View, { accessibilityState: { selected: delta === 0 }, testID: "bullet", style: [
|
|
18
|
+
style.bullet,
|
|
19
|
+
{
|
|
20
|
+
width: springs.diameter,
|
|
21
|
+
height: springs.diameter,
|
|
22
|
+
backgroundColor: springs.color,
|
|
23
|
+
borderRadius: springs.diameter,
|
|
24
|
+
},
|
|
25
|
+
] })));
|
|
26
|
+
};
|
|
27
|
+
const Bullets = ({ activeIndex, count, maxBullets = MAX, onChange, testID = "bullets" }) => (React.createElement(View, { style: style.bullets, testID: testID }, [...Array(count).keys()].map((index) => (React.createElement(Bullet, { key: index, activeIndex: activeIndex, index: index, maxBullets: maxBullets, onChange: onChange })))));
|
|
28
|
+
export { Bullets };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
|
+
const { spaceM } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
bullet: {
|
|
6
|
+
marginHorizontal: 3,
|
|
7
|
+
},
|
|
8
|
+
bullets: {
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
flexDirection: "row",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
paddingVertical: spaceM,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export { style };
|
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface RenderItemFunctionArgs<T> {
|
|
4
|
+
readonly item: T;
|
|
5
|
+
readonly index: number;
|
|
6
|
+
}
|
|
7
|
+
interface RenderItemFunction<T> {
|
|
8
|
+
(args: RenderItemFunctionArgs<T>): JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
interface RenderBulletsFunctionArgs {
|
|
11
|
+
readonly activeIndex: number;
|
|
12
|
+
readonly count: number;
|
|
13
|
+
readonly onChange: (index: number) => void;
|
|
14
|
+
}
|
|
15
|
+
interface RenderBulletsFunction {
|
|
16
|
+
(args: RenderBulletsFunctionArgs): JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
interface CarouselStyle {
|
|
19
|
+
readonly container?: StyleProp<ViewStyle>;
|
|
20
|
+
}
|
|
4
21
|
interface CarouselProps<T> {
|
|
22
|
+
readonly activeIndex?: number;
|
|
5
23
|
readonly data: T[];
|
|
6
|
-
readonly
|
|
24
|
+
readonly enabled?: boolean;
|
|
25
|
+
readonly children: RenderItemFunction<T>;
|
|
26
|
+
readonly bullets?: RenderBulletsFunction;
|
|
7
27
|
readonly onActiveIndexChanged?: (index: number) => void;
|
|
28
|
+
readonly style?: CarouselStyle;
|
|
8
29
|
}
|
|
9
|
-
declare const Carousel: <T>({ data, children, onActiveIndexChanged }: CarouselProps<T>) => JSX.Element;
|
|
10
|
-
export type {
|
|
30
|
+
declare const Carousel: <T>({ activeIndex, data, enabled, children, bullets, onActiveIndexChanged, style: customStyle, }: CarouselProps<T>) => JSX.Element;
|
|
31
|
+
export type { RenderItemFunction, RenderBulletsFunction };
|
|
11
32
|
export { Carousel };
|
|
@@ -1,31 +1,87 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
3
|
+
import { Gesture, GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
|
|
4
|
+
import Animated, { useSharedValue, withSpring, useAnimatedStyle, runOnJS } from "react-native-reanimated";
|
|
5
|
+
import { style } from "./Carousel.style";
|
|
6
|
+
const SPRING_CONFIG = {
|
|
7
|
+
damping: 25,
|
|
8
|
+
mass: 1,
|
|
9
|
+
stiffness: 300,
|
|
10
|
+
};
|
|
11
|
+
const clamp = (min, max, value) => {
|
|
12
|
+
"worklet";
|
|
13
|
+
return Math.min(max, Math.max(min, value));
|
|
14
|
+
};
|
|
15
|
+
const Carousel = ({ activeIndex = 0, data, enabled = true, children, bullets, onActiveIndexChanged, style: customStyle, }) => {
|
|
7
16
|
const [carouselDimensions, setCarouselDimensions] = useState();
|
|
8
|
-
const handleOnLayout = useCallback(({ nativeEvent: { layout
|
|
9
|
-
const
|
|
10
|
-
const
|
|
17
|
+
const handleOnLayout = useCallback(({ nativeEvent: { layout } }) => setCarouselDimensions({ width: layout.width, height: layout.height }), []);
|
|
18
|
+
const carouselWidth = carouselDimensions?.width;
|
|
19
|
+
const panTranslationX = useSharedValue(0);
|
|
20
|
+
const panInitialTranslationX = useSharedValue(undefined);
|
|
21
|
+
const [panActive, setPanActive] = useState(false);
|
|
11
22
|
const activeIndexRef = useRef(activeIndex);
|
|
12
23
|
activeIndexRef.current = activeIndex;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (panActive || !carouselWidth) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
panTranslationX.value = -activeIndex * carouselWidth;
|
|
29
|
+
}, [activeIndex, carouselWidth, panActive, panTranslationX]);
|
|
30
|
+
const updateActiveIndex = useCallback((index) => {
|
|
18
31
|
if (activeIndexRef.current === index) {
|
|
19
32
|
return;
|
|
20
33
|
}
|
|
21
|
-
setActiveIndex(index);
|
|
22
34
|
onActiveIndexChanged?.(index);
|
|
23
35
|
}, [onActiveIndexChanged]);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
const handleOnActiveIndexChanged = useCallback((index) => {
|
|
37
|
+
if (!carouselWidth) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
updateActiveIndex(index);
|
|
41
|
+
panTranslationX.value = withSpring(-index * carouselWidth, SPRING_CONFIG);
|
|
42
|
+
}, [carouselWidth, panTranslationX, updateActiveIndex]);
|
|
43
|
+
const panGesture = useMemo(() => Gesture.Pan()
|
|
44
|
+
.withTestId("carousel-pan-gesture")
|
|
45
|
+
.enabled(enabled)
|
|
46
|
+
.maxPointers(1)
|
|
47
|
+
.activeOffsetX([-20, 20])
|
|
48
|
+
// This method does not work if legacy implementation is enabled
|
|
49
|
+
// Expo.tsx => enableLegacyWebImplementation(true)
|
|
50
|
+
// .onStart(() => {
|
|
51
|
+
// panInitialTranslationX.value = panTranslationX.value;
|
|
52
|
+
// })
|
|
53
|
+
// This method is defined as legacy implementation is enabled
|
|
54
|
+
.onBegin(() => {
|
|
55
|
+
runOnJS(setPanActive)(true);
|
|
56
|
+
panInitialTranslationX.value = panTranslationX.value;
|
|
57
|
+
})
|
|
58
|
+
.onUpdate(({ translationX }) => {
|
|
59
|
+
if (panInitialTranslationX.value === undefined || !carouselWidth) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const tX = panInitialTranslationX.value + translationX;
|
|
63
|
+
const index = clamp(0, data.length - 1, Math.round(-tX / carouselWidth));
|
|
64
|
+
panTranslationX.value = tX;
|
|
65
|
+
runOnJS(updateActiveIndex)(index);
|
|
66
|
+
})
|
|
67
|
+
.onEnd(({ translationX, velocityX }) => {
|
|
68
|
+
if (panInitialTranslationX.value === undefined || !carouselWidth) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const tX = panInitialTranslationX.value + translationX;
|
|
72
|
+
const indexDelta = Math.round(translationX / carouselWidth);
|
|
73
|
+
const velocityIndex = Math.abs(indexDelta) > 0 ? 0 : clamp(-1, 1, Math.abs(velocityX) > 2 ? -velocityX : 0);
|
|
74
|
+
const index = clamp(0, data.length - 1, Math.round(-tX / carouselWidth) + velocityIndex);
|
|
75
|
+
panTranslationX.value = withSpring(-index * carouselWidth, SPRING_CONFIG);
|
|
76
|
+
panInitialTranslationX.value = undefined;
|
|
77
|
+
runOnJS(updateActiveIndex)(index);
|
|
78
|
+
runOnJS(setPanActive)(true);
|
|
79
|
+
}), [carouselWidth, data.length, enabled, panInitialTranslationX, panTranslationX, updateActiveIndex]);
|
|
80
|
+
const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateX: panTranslationX.value }] }), [panTranslationX]);
|
|
81
|
+
return (React.createElement(View, { style: [style.container, customStyle?.container], testID: "carousel" },
|
|
82
|
+
React.createElement(View, { style: style.carousel, testID: "carousel-layout", onLayout: handleOnLayout }, carouselWidth && (React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
|
|
83
|
+
React.createElement(GestureDetector, { gesture: panGesture },
|
|
84
|
+
React.createElement(Animated.View, { style: [style.carouselTrack, { width: carouselWidth * data.length }, animatedStyle], testID: "carousel-track" }, data.map((item, index) => (React.createElement(View, { key: index, style: [style.carouselItem, { width: carouselWidth }], testID: "carousel-item" }, children({ index, item }))))))))),
|
|
85
|
+
bullets && (React.createElement(View, { style: style.bullets, testID: "carousel-bullets" }, bullets({ activeIndex, count: data.length, onChange: handleOnActiveIndexChanged })))));
|
|
30
86
|
};
|
|
31
87
|
export { Carousel };
|
|
@@ -75,7 +75,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
|
|
|
75
75
|
(header || showCloseButton) && (React.createElement(View, { style: [style.header, customStyle?.header] },
|
|
76
76
|
React.createElement(View, null, header),
|
|
77
77
|
showCloseButton && (React.createElement(ButtonIcon, { name: "close", style: { button: customStyle?.closeButton }, onPress: onClose })))),
|
|
78
|
-
React.createElement(ModalContentView,
|
|
78
|
+
React.createElement(ModalContentView, { keyboardShouldPersistTaps: "handled" },
|
|
79
79
|
React.createElement(View, { style: {
|
|
80
80
|
paddingBottom: safeAreaInsetBottom +
|
|
81
81
|
(Platform.OS !== "ios" ? spaceXL : 0) +
|
|
@@ -6,7 +6,7 @@ import { Modal } from "../../layouts/modal/Modal";
|
|
|
6
6
|
import { InputField } from "../inputField/InputField";
|
|
7
7
|
import { style } from "./SelectField.style";
|
|
8
8
|
const { colorGrayscaleS } = theme();
|
|
9
|
-
const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
|
|
9
|
+
const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, testID, ...touchableRestProps }) => {
|
|
10
10
|
const [modalVisible, setModalVisible] = useState(false);
|
|
11
11
|
const handleOnPressSelectField = useCallback(() => setModalVisible(true), []);
|
|
12
12
|
const handleOnModalClose = useCallback(() => setModalVisible(false), []);
|
|
@@ -16,13 +16,13 @@ const SelectField = ({ title, placeholder, value, options, style: customStyle, o
|
|
|
16
16
|
}, [handleOnModalClose, onChange]);
|
|
17
17
|
const selectedValue = useMemo(() => options.find((option) => option.value === value), [options, value]);
|
|
18
18
|
return (React.createElement(React.Fragment, null,
|
|
19
|
-
React.createElement(TouchableHighlight, { style: customStyle?.selectField, underlayColor: colorGrayscaleS, onPress: handleOnPressSelectField, ...touchableRestProps },
|
|
19
|
+
React.createElement(TouchableHighlight, { accessibilityLabel: testID, style: customStyle?.selectField, testID: testID, underlayColor: colorGrayscaleS, accessible: true, onPress: handleOnPressSelectField, ...touchableRestProps },
|
|
20
20
|
React.createElement(View, { pointerEvents: "none" },
|
|
21
21
|
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholder, style: customStyle?.inputField, value: selectedValue?.label }))),
|
|
22
22
|
React.createElement(Modal, { testID: "select-field-modal", visible: modalVisible, scroll: true, showCloseButton: true, onClose: handleOnModalClose },
|
|
23
23
|
React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] },
|
|
24
24
|
title && (React.createElement(Text, { level: 2, style: style.modalTitle }, title)),
|
|
25
|
-
options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
|
|
25
|
+
options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, accessibilityLabel: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], testID: optionValue, underlayColor: colorGrayscaleS, accessible: true, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
|
|
26
26
|
React.createElement(Text, { color: value === optionValue ? COLOR.GRAYSCALE_M : COLOR.CONTENT, level: 3, style: [style.optionText, customStyle?.optionText] }, label))))))));
|
|
27
27
|
};
|
|
28
28
|
export { SelectField };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0-beta.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@lookiero/data-sources": "^0.3",
|
|
50
50
|
"@lookiero/event": "^0.3",
|
|
51
51
|
"@lookiero/locale": "^0.3",
|
|
52
|
-
"@lookiero/payments-front": "^
|
|
52
|
+
"@lookiero/payments-front": "^4.1.3",
|
|
53
53
|
"@lookiero/user-tracking-front": "0.0.37",
|
|
54
54
|
"apollo-boost": "0.4.4",
|
|
55
55
|
"graphql": "16.6.0",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"react-native-get-random-values": "^1.8.0",
|
|
62
62
|
"react-native-web": "^0.18.11",
|
|
63
63
|
"react-native-reanimated": "^3.3.0",
|
|
64
|
-
"react-native-reanimated-carousel": "^3.4.0",
|
|
65
64
|
"react-router-dom": "^6.8.1",
|
|
66
65
|
"react-router-native": "^6.8.1"
|
|
67
66
|
},
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
"@lookiero/data-sources": "^0.3",
|
|
75
74
|
"@lookiero/event": "^0.3",
|
|
76
75
|
"@lookiero/locale": "^0.3",
|
|
77
|
-
"@lookiero/payments-front": "^
|
|
76
|
+
"@lookiero/payments-front": "^4.1.3",
|
|
78
77
|
"@lookiero/user-tracking-front": "0.0.37",
|
|
79
78
|
"@pact-foundation/pact": "^10.1.4",
|
|
80
79
|
"@pact-foundation/pact-node": "^10.17.6",
|
|
@@ -123,7 +122,6 @@
|
|
|
123
122
|
"react-native-get-random-values": "^1.8.0",
|
|
124
123
|
"react-native-web": "^0.18.11",
|
|
125
124
|
"react-native-reanimated": "^3.3.0",
|
|
126
|
-
"react-native-reanimated-carousel": "^3.4.0",
|
|
127
125
|
"react-router-dom": "^6.8.1",
|
|
128
126
|
"react-router-native": "^6.8.1",
|
|
129
127
|
"react-test-renderer": "^18.0.0",
|