@lookiero/checkout 0.2.26 → 0.2.27-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/delivery/_mock/bootstrap.mock.d.ts +6 -0
- package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +34 -0
- package/dist/infrastructure/delivery/_mock/checkout.mock.d.ts +9 -0
- package/dist/infrastructure/delivery/_mock/checkout.mock.js +46 -0
- package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +15 -0
- package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.js +15 -0
- package/dist/infrastructure/domain/react/useSetCheckoutIntroShown.d.ts +10 -0
- package/dist/infrastructure/domain/react/useSetCheckoutIntroShown.js +9 -0
- package/dist/infrastructure/domain/react/useUpdateUiSetting.d.ts +14 -0
- package/dist/infrastructure/domain/react/useUpdateUiSetting.js +15 -0
- package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +17 -7
- package/dist/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts +36 -0
- package/dist/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js +30 -0
- package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.d.ts +60 -0
- package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.js +54 -0
- package/dist/infrastructure/projection/httpFiveItemsDiscountByCustomerIdView.d.ts +12 -0
- package/dist/infrastructure/projection/httpFiveItemsDiscountByCustomerIdView.js +7 -0
- package/dist/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.d.ts +12 -0
- package/dist/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.js +7 -0
- package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +10 -0
- package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +9 -0
- package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.d.ts +2 -0
- package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.js +6 -0
- package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.d.ts +10 -0
- package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.js +9 -0
- package/dist/infrastructure/projection/react/useViewFiveItemsDiscountByCustomerId.d.ts +10 -0
- package/dist/infrastructure/projection/react/useViewFiveItemsDiscountByCustomerId.js +9 -0
- package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +10 -0
- package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.js +9 -0
- package/dist/infrastructure/projection/react/useViewUiSettingByKey.d.ts +10 -0
- package/dist/infrastructure/projection/react/useViewUiSettingByKey.js +12 -0
- package/dist/infrastructure/projection/storageUiSettingByKeyView.d.ts +13 -0
- package/dist/infrastructure/projection/storageUiSettingByKeyView.js +15 -0
- package/dist/infrastructure/ui/components/atoms/spinner/Spinner.d.ts +3 -0
- package/dist/infrastructure/ui/components/atoms/spinner/Spinner.js +8 -0
- package/dist/infrastructure/ui/components/atoms/spinner/Spinner.style.d.ts +9 -0
- package/dist/infrastructure/ui/components/atoms/spinner/Spinner.style.js +10 -0
- package/dist/infrastructure/ui/components/layouts/slider/Pagination.d.ts +14 -0
- package/dist/infrastructure/ui/components/layouts/slider/Pagination.js +11 -0
- package/dist/infrastructure/ui/components/layouts/slider/Pagination.style.d.ts +23 -0
- package/dist/infrastructure/ui/components/layouts/slider/Pagination.style.js +27 -0
- package/dist/infrastructure/ui/components/layouts/slider/Slider.d.ts +20 -0
- package/dist/infrastructure/ui/components/layouts/slider/Slider.js +132 -0
- package/dist/infrastructure/ui/components/layouts/slider/Slider.style.d.ts +11 -0
- package/dist/infrastructure/ui/components/layouts/slider/Slider.style.js +12 -0
- package/dist/infrastructure/ui/components/organisms/dropdown/Dropdown.d.ts +15 -0
- package/dist/infrastructure/ui/components/organisms/dropdown/Dropdown.js +20 -0
- package/dist/infrastructure/ui/components/organisms/dropdown/Dropdown.style.d.ts +6 -0
- package/dist/infrastructure/ui/components/organisms/dropdown/Dropdown.style.js +9 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +1 -1
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.d.ts +10 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.js +11 -0
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.d.ts +4 -3
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.js +3 -3
- package/dist/infrastructure/ui/views/item/components/actions/Actions.d.ts +11 -0
- package/dist/infrastructure/ui/views/item/components/actions/Actions.js +24 -0
- package/dist/infrastructure/ui/views/item/components/actions/Actions.style.d.ts +20 -0
- package/dist/infrastructure/ui/views/item/components/actions/Actions.style.js +23 -0
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +16 -14
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +3 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +1 -1
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +11 -9
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +3 -0
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +11 -9
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.js +3 -0
- package/dist/infrastructure/ui/views/summary/Summary.js +5 -2
- package/package.json +5 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface PaginationProps {
|
|
4
|
+
readonly touchable?: boolean;
|
|
5
|
+
readonly paginationStyle?: StyleProp<ViewStyle>;
|
|
6
|
+
readonly paginationItemStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
readonly paginationActiveItemStyle?: StyleProp<ViewStyle>;
|
|
8
|
+
readonly count?: number;
|
|
9
|
+
readonly activeIndex?: number;
|
|
10
|
+
readonly onChange: (index: number) => void;
|
|
11
|
+
readonly renderItem?: (index: number) => JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
declare const Pagination: FC<PaginationProps>;
|
|
14
|
+
export { Pagination };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable, View } from "react-native";
|
|
3
|
+
import { style } from "./Pagination.style";
|
|
4
|
+
const Pagination = ({ touchable = true, paginationStyle, paginationItemStyle, paginationActiveItemStyle, count = 0, activeIndex = 0, renderItem, onChange, }) => (React.createElement(View, { style: [style.paginationWrapper, paginationStyle], testID: "slider-pagination" }, Array.from(Array(count).keys()).map((index) => (React.createElement(View, { key: index, style: style.paginationContainer },
|
|
5
|
+
React.createElement(Pressable, { onPress: !touchable ? undefined : () => onChange(index), style: [
|
|
6
|
+
style.paginationItem,
|
|
7
|
+
activeIndex === index && style.active,
|
|
8
|
+
paginationItemStyle,
|
|
9
|
+
activeIndex === index && paginationActiveItemStyle,
|
|
10
|
+
], testID: "slider-pagination-item" }, renderItem?.(index)))))));
|
|
11
|
+
export { Pagination };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
paginationWrapper: {
|
|
3
|
+
alignItems: "center";
|
|
4
|
+
bottom: number;
|
|
5
|
+
flexDirection: "row";
|
|
6
|
+
justifyContent: "center";
|
|
7
|
+
position: "absolute";
|
|
8
|
+
width: string;
|
|
9
|
+
};
|
|
10
|
+
paginationContainer: {
|
|
11
|
+
margin: number;
|
|
12
|
+
};
|
|
13
|
+
paginationItem: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
borderRadius: number;
|
|
17
|
+
backgroundColor: string;
|
|
18
|
+
};
|
|
19
|
+
active: {
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export { style };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../theme/theme";
|
|
3
|
+
const { colorGrayscaleS, colorGrayscaleXL } = theme();
|
|
4
|
+
const DOT_SIZE = 8;
|
|
5
|
+
const style = StyleSheet.create({
|
|
6
|
+
paginationWrapper: {
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
bottom: 10,
|
|
9
|
+
flexDirection: "row",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
position: "absolute",
|
|
12
|
+
width: "100%",
|
|
13
|
+
},
|
|
14
|
+
paginationContainer: {
|
|
15
|
+
margin: 3,
|
|
16
|
+
},
|
|
17
|
+
paginationItem: {
|
|
18
|
+
width: DOT_SIZE,
|
|
19
|
+
height: DOT_SIZE,
|
|
20
|
+
borderRadius: DOT_SIZE / 2,
|
|
21
|
+
backgroundColor: colorGrayscaleS,
|
|
22
|
+
},
|
|
23
|
+
active: {
|
|
24
|
+
backgroundColor: colorGrayscaleXL,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export { style };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface SliderProps {
|
|
4
|
+
readonly children: ReactNode[];
|
|
5
|
+
readonly active?: number;
|
|
6
|
+
readonly loop?: boolean;
|
|
7
|
+
readonly minDistanceToCapture?: number;
|
|
8
|
+
readonly minDistanceForAction?: number;
|
|
9
|
+
readonly gesturesEnabled?: boolean;
|
|
10
|
+
readonly paginationEnabled?: boolean;
|
|
11
|
+
readonly paginationStyle?: StyleProp<ViewStyle>;
|
|
12
|
+
readonly paginationItemStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
readonly paginationActiveItemStyle?: StyleProp<ViewStyle>;
|
|
14
|
+
readonly onSliderStart?: () => void;
|
|
15
|
+
readonly onSliderEnd?: () => void;
|
|
16
|
+
readonly onChanged?: (index: number) => void;
|
|
17
|
+
readonly paginationRenderItem?: (index: number) => JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
declare const Slider: FC<SliderProps>;
|
|
20
|
+
export { Slider };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Animated, I18nManager, PanResponder, StyleSheet, View, } from "react-native";
|
|
3
|
+
import { Pagination } from "./Pagination";
|
|
4
|
+
import { style } from "./Slider.style";
|
|
5
|
+
const DEFAULT_WIDTH = 200;
|
|
6
|
+
const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5, minDistanceForAction = 0.2, gesturesEnabled = true, paginationEnabled = true, paginationStyle, paginationItemStyle, paginationActiveItemStyle, onSliderStart, onSliderEnd, onChanged, paginationRenderItem, }) => {
|
|
7
|
+
const flatennedChildren = children.flat();
|
|
8
|
+
const count = flatennedChildren.length;
|
|
9
|
+
const [width, setWidth] = useState(0);
|
|
10
|
+
const widthRef = useRef(width);
|
|
11
|
+
const activeIndex = useRef(active);
|
|
12
|
+
const animatedValueX = useRef(0);
|
|
13
|
+
const animatedValueY = useRef(0);
|
|
14
|
+
const pan = useRef(new Animated.ValueXY()).current;
|
|
15
|
+
const started = useRef(false);
|
|
16
|
+
const panResponder = useRef(PanResponder.create({
|
|
17
|
+
onPanResponderTerminationRequest: () => false,
|
|
18
|
+
onMoveShouldSetPanResponder: () => gesturesEnabled,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
20
|
+
onMoveShouldSetPanResponderCapture: (_e, gestureState) => {
|
|
21
|
+
if (!gesturesEnabled) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
startAnimation();
|
|
25
|
+
const allow = Math.abs(gestureState.dx) > minDistanceToCapture;
|
|
26
|
+
return allow;
|
|
27
|
+
},
|
|
28
|
+
onPanResponderGrant: () => fixState(),
|
|
29
|
+
onPanResponderMove: Animated.event([null, { dx: pan.x }], {
|
|
30
|
+
useNativeDriver: false,
|
|
31
|
+
}),
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
|
+
onPanResponderRelease: (_e, gesture) => {
|
|
34
|
+
const correction = gesture.moveX - gesture.x0;
|
|
35
|
+
if (Math.abs(correction) < widthRef.current * minDistanceForAction) {
|
|
36
|
+
spring({ x: 0, y: 0 });
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
changeIndex(correction > 0 ? (I18nManager.isRTL ? 1 : -1) : I18nManager.isRTL ? -1 : 1);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
onPanResponderEnd: () => endAnimation(),
|
|
43
|
+
})).current;
|
|
44
|
+
const startAnimation = useCallback(() => {
|
|
45
|
+
if (!started.current) {
|
|
46
|
+
onSliderStart?.();
|
|
47
|
+
started.current = true;
|
|
48
|
+
}
|
|
49
|
+
}, [onSliderStart]);
|
|
50
|
+
const endAnimation = useCallback(() => {
|
|
51
|
+
if (started.current) {
|
|
52
|
+
onSliderEnd?.();
|
|
53
|
+
started.current = false;
|
|
54
|
+
}
|
|
55
|
+
}, [onSliderEnd]);
|
|
56
|
+
const fixState = useCallback(() => {
|
|
57
|
+
animatedValueX.current = widthRef.current * activeIndex.current * (I18nManager.isRTL ? 1 : -1);
|
|
58
|
+
animatedValueY.current = 0;
|
|
59
|
+
pan.setOffset({
|
|
60
|
+
x: animatedValueX.current,
|
|
61
|
+
y: animatedValueY.current,
|
|
62
|
+
});
|
|
63
|
+
pan.setValue({ x: 0, y: 0 });
|
|
64
|
+
}, [pan]);
|
|
65
|
+
const spring = useCallback((toValue) => {
|
|
66
|
+
Animated.spring(pan, {
|
|
67
|
+
toValue,
|
|
68
|
+
useNativeDriver: false,
|
|
69
|
+
}).start();
|
|
70
|
+
}, [pan]);
|
|
71
|
+
const changeIndex = useCallback((delta = 1) => {
|
|
72
|
+
const toValue = { x: 0, y: 0 };
|
|
73
|
+
let skipChanges = !delta;
|
|
74
|
+
let calcDelta = delta;
|
|
75
|
+
if (activeIndex.current <= 0 && delta < 0) {
|
|
76
|
+
skipChanges = !loop;
|
|
77
|
+
calcDelta = count + delta;
|
|
78
|
+
}
|
|
79
|
+
else if (activeIndex.current + 1 >= count && delta > 0) {
|
|
80
|
+
skipChanges = !loop;
|
|
81
|
+
calcDelta = -1 * activeIndex.current + delta - 1;
|
|
82
|
+
}
|
|
83
|
+
if (skipChanges) {
|
|
84
|
+
return spring(toValue);
|
|
85
|
+
}
|
|
86
|
+
const index = activeIndex.current + calcDelta;
|
|
87
|
+
activeIndex.current = index;
|
|
88
|
+
toValue.x = widthRef.current * (I18nManager.isRTL ? 1 : -1) * calcDelta;
|
|
89
|
+
spring(toValue);
|
|
90
|
+
onChanged?.(index);
|
|
91
|
+
}, [count, loop, onChanged, spring]);
|
|
92
|
+
const fixAndGo = useCallback((delta) => {
|
|
93
|
+
fixState();
|
|
94
|
+
startAnimation();
|
|
95
|
+
changeIndex(delta);
|
|
96
|
+
}, [changeIndex, fixState, startAnimation]);
|
|
97
|
+
const goTo = useCallback((index = 0) => {
|
|
98
|
+
const delta = index - activeIndex.current;
|
|
99
|
+
if (delta) {
|
|
100
|
+
fixAndGo(delta);
|
|
101
|
+
}
|
|
102
|
+
}, [fixAndGo]);
|
|
103
|
+
const getActiveIndex = useCallback(() => activeIndex.current, []);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
pan.x.addListener(({ value }) => (animatedValueX.current = value));
|
|
106
|
+
pan.y.addListener(({ value }) => (animatedValueY.current = value));
|
|
107
|
+
return () => {
|
|
108
|
+
pan.x.removeAllListeners();
|
|
109
|
+
pan.y.removeAllListeners();
|
|
110
|
+
};
|
|
111
|
+
}, [pan.x, pan.y]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (activeIndex.current !== active) {
|
|
114
|
+
goTo(active);
|
|
115
|
+
}
|
|
116
|
+
}, [active, goTo]);
|
|
117
|
+
const onLayoutWrapper = useCallback(({ nativeEvent: { layout: { width: wrapperWidth }, }, }) => {
|
|
118
|
+
const width = wrapperWidth || DEFAULT_WIDTH;
|
|
119
|
+
setWidth(width);
|
|
120
|
+
widthRef.current = width;
|
|
121
|
+
fixState();
|
|
122
|
+
}, [fixState]);
|
|
123
|
+
return (React.createElement(View, { style: style.container, onLayout: onLayoutWrapper, testID: "slider" },
|
|
124
|
+
React.createElement(Animated.View, { style: StyleSheet.flatten([
|
|
125
|
+
{
|
|
126
|
+
transform: [{ translateX: pan.x }, { translateY: pan.y }],
|
|
127
|
+
},
|
|
128
|
+
style.sliderAreaStyle,
|
|
129
|
+
]), ...panResponder.panHandlers }, flatennedChildren.map((child, index) => (React.createElement(View, { key: index, style: { width }, testID: "slider-child" }, child)))),
|
|
130
|
+
paginationEnabled && (React.createElement(Pagination, { count: count, activeIndex: getActiveIndex(), onChange: (index) => goTo(index), paginationStyle: paginationStyle, paginationItemStyle: paginationItemStyle, paginationActiveItemStyle: paginationActiveItemStyle, renderItem: paginationRenderItem }))));
|
|
131
|
+
};
|
|
132
|
+
export { Slider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
interface Option {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly value: string;
|
|
5
|
+
}
|
|
6
|
+
interface DrodownProps {
|
|
7
|
+
readonly defaultValue: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly options: Option[];
|
|
11
|
+
readonly disabled?: boolean;
|
|
12
|
+
readonly onChanged?: (value: string) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const Dropdown: FC<DrodownProps>;
|
|
15
|
+
export { Dropdown };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { InputDropdown } from "@lookiero/aurora-next/build/components/organisms/InputDropdown/InputDropdown";
|
|
4
|
+
import { style } from "./Dropdown.style";
|
|
5
|
+
const Dropdown = ({ defaultValue, label, name, options, disabled = false, onChanged }) => {
|
|
6
|
+
const [value, setValue] = useState(defaultValue);
|
|
7
|
+
const handleOnChange = useCallback((value) => {
|
|
8
|
+
setValue(value);
|
|
9
|
+
onChanged?.(value);
|
|
10
|
+
}, [onChanged]);
|
|
11
|
+
return (React.createElement(View, { pointerEvents: disabled ? "none" : "auto" },
|
|
12
|
+
React.createElement(InputDropdown, { label: label, name: name, options: options, value: value, onChange: handleOnChange,
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
disabled: disabled,
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
style: style.dropdown })));
|
|
19
|
+
};
|
|
20
|
+
export { Dropdown };
|
|
@@ -29,7 +29,7 @@ const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName
|
|
|
29
29
|
React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
30
30
|
React.createElement(View, { pointerEvents: "none" },
|
|
31
31
|
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholderText || "", value: inputValue }))),
|
|
32
|
-
React.createElement(Modal, { portalHostName: portalHostName, visible: modalVisible, header: deepestReturnQuestionWithFeedback && (React.createElement(ButtonIcon, { name: "arrow-left", testID: "modal-back-button", onPress: handleOnBackButtonPress })), scroll: true, onClose: handleOnModalClose },
|
|
32
|
+
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 },
|
|
33
33
|
React.createElement(View, { style: style.modalContent }, children))));
|
|
34
34
|
};
|
|
35
35
|
export { HostSelectReturnQuestionItem };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import { ScreenSize } from "../../../hooks/useScreenSize";
|
|
4
4
|
declare type ColumnSize = "1/4" | "1/3" | "1/2" | "2/3";
|
|
5
5
|
declare type ModalStyle = "overlay" | "row" | "modal" | "header" | "closeButton";
|
|
6
6
|
interface ModalProps {
|
|
7
7
|
readonly children: ReactNode;
|
|
8
8
|
readonly visible: boolean;
|
|
9
|
-
readonly onClose
|
|
9
|
+
readonly onClose: () => void;
|
|
10
|
+
readonly showCloseButton?: boolean;
|
|
10
11
|
readonly header?: ReactNode;
|
|
11
12
|
readonly portalHostName?: string;
|
|
12
13
|
readonly scroll?: boolean;
|
|
13
14
|
readonly size?: Partial<Record<ScreenSize, ColumnSize>>;
|
|
14
|
-
readonly style?: Partial<Record<ModalStyle,
|
|
15
|
+
readonly style?: Partial<Record<ModalStyle, StyleProp<ViewStyle>>>;
|
|
15
16
|
}
|
|
16
17
|
declare const Modal: FC<ModalProps>;
|
|
17
18
|
export type { ColumnSize };
|
|
@@ -8,7 +8,7 @@ import { ButtonIcon } from "../../molecules/buttonIcon/ButtonIcon";
|
|
|
8
8
|
import { Row } from "../row/Row";
|
|
9
9
|
import { style } from "./Modal.style";
|
|
10
10
|
const TRANSITION_MODAL_SCALE = 0.9;
|
|
11
|
-
const Modal = ({ children, visible, header, portalHostName, onClose, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, }) => {
|
|
11
|
+
const Modal = ({ children, visible, header, portalHostName, onClose, showCloseButton = false, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, }) => {
|
|
12
12
|
const { height: screenHeight } = Dimensions.get("screen");
|
|
13
13
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
14
14
|
const screenSizeWithoutInsets = screenHeight - safeAreaInsetTop;
|
|
@@ -53,9 +53,9 @@ const Modal = ({ children, visible, header, portalHostName, onClose, size = { M:
|
|
|
53
53
|
},
|
|
54
54
|
customStyle?.modal,
|
|
55
55
|
], onLayout: handleOnModalLayout },
|
|
56
|
-
(header ||
|
|
56
|
+
(header || showCloseButton) && (React.createElement(View, { style: [style.header, customStyle?.header] },
|
|
57
57
|
React.createElement(View, null, header),
|
|
58
|
-
|
|
58
|
+
showCloseButton && (React.createElement(ButtonIcon, { name: "close", style: { button: customStyle?.closeButton }, onPress: onClose })))),
|
|
59
59
|
React.createElement(ModalContentView, null,
|
|
60
60
|
React.createElement(View, { style: { paddingBottom: safeAreaInsetBottom } }, children))))))))));
|
|
61
61
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SizeProjection } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
interface ActionsProps {
|
|
4
|
+
readonly sizes: SizeProjection[];
|
|
5
|
+
readonly size: SizeProjection;
|
|
6
|
+
readonly onKeep: (value: string) => void;
|
|
7
|
+
readonly onReturn: (value: string) => void;
|
|
8
|
+
readonly onReplace: (value: string) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Actions: FC<ActionsProps>;
|
|
11
|
+
export { Actions };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
|
|
2
|
+
import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
|
|
3
|
+
import { Dropdown } from "../../../../components/organisms/dropdown/Dropdown";
|
|
4
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
5
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
import React, { useMemo } from "react";
|
|
8
|
+
import { style } from "./Actions.style";
|
|
9
|
+
const Actions = ({ sizes, size, onKeep, onReplace, onReturn }) => {
|
|
10
|
+
const sizesLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
|
|
11
|
+
const sizesNameText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_NAME });
|
|
12
|
+
const keepButtonText = useI18nMessage({ id: I18nMessages.ITEM_KEEP_BUTTON });
|
|
13
|
+
const returnButtonText = useI18nMessage({ id: I18nMessages.ITEM_RETURN_BUTTON });
|
|
14
|
+
const options = useMemo(() => sizes.map((size) => ({ name: size.lookiero, value: size.id })), [sizes]);
|
|
15
|
+
const disabled = useMemo(() => options.length === 1 && options[0]?.value === size.id, [options, size.id]);
|
|
16
|
+
return (React.createElement(View, { style: style.container },
|
|
17
|
+
React.createElement(Button, { onPress: onKeep }, keepButtonText),
|
|
18
|
+
React.createElement(View, { style: style.row },
|
|
19
|
+
!size.unique && (React.createElement(View, { style: style.dropdownContainer },
|
|
20
|
+
React.createElement(Dropdown, { defaultValue: size.id, label: sizesLabelText, name: sizesNameText, options: options, onChanged: onReplace, disabled: disabled }))),
|
|
21
|
+
React.createElement(View, { style: style.returnButtonContainer },
|
|
22
|
+
React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn }, returnButtonText)))));
|
|
23
|
+
};
|
|
24
|
+
export { Actions };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
container: {
|
|
3
|
+
padding: number;
|
|
4
|
+
width: string;
|
|
5
|
+
};
|
|
6
|
+
row: {
|
|
7
|
+
alignItems: "center";
|
|
8
|
+
flexDirection: "row";
|
|
9
|
+
marginTop: number;
|
|
10
|
+
};
|
|
11
|
+
dropdownContainer: {
|
|
12
|
+
flex: number;
|
|
13
|
+
zIndex: number;
|
|
14
|
+
marginRight: number;
|
|
15
|
+
};
|
|
16
|
+
returnButtonContainer: {
|
|
17
|
+
flex: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { style };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { spaceL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
padding: spaceL,
|
|
7
|
+
width: "100%",
|
|
8
|
+
},
|
|
9
|
+
row: {
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
flexDirection: "row",
|
|
12
|
+
marginTop: spaceL,
|
|
13
|
+
},
|
|
14
|
+
dropdownContainer: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
zIndex: 4,
|
|
17
|
+
marginRight: spaceL,
|
|
18
|
+
},
|
|
19
|
+
returnButtonContainer: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export { style };
|
package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js
CHANGED
|
@@ -3,30 +3,32 @@ import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/But
|
|
|
3
3
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
4
4
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { View } from "react-native";
|
|
7
7
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
|
+
import { Modal } from "../../../../shared/components/layouts/modal/Modal";
|
|
8
9
|
import { style } from "./GetOutOfCheckoutModal.style";
|
|
9
10
|
const GetOutOfCheckoutModal = ({ visible, onDismiss, onConfirm }) => {
|
|
10
11
|
const titleText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_TITLE });
|
|
11
12
|
const descriptionText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_DESCRIPTION });
|
|
12
13
|
const dismissButtonText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_DISMISS_BUTTON });
|
|
13
14
|
const confirmButtonText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON });
|
|
14
|
-
return (React.createElement(Modal, { visible: visible },
|
|
15
|
-
React.createElement(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
, {
|
|
15
|
+
return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
|
|
16
|
+
React.createElement(View, { style: style.modal },
|
|
17
|
+
React.createElement(Text, { level: 1, style: style.modalTitle, body: true }, titleText),
|
|
18
|
+
React.createElement(Text, { level: 3, style: style.modalDescription, body: true }, descriptionText),
|
|
19
|
+
React.createElement(Button
|
|
21
20
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
21
|
// @ts-ignore
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
, {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
style: style.button, onPress: onDismiss }, dismissButtonText),
|
|
26
|
+
React.createElement(Button
|
|
28
27
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
29
28
|
// @ts-ignore
|
|
30
|
-
|
|
29
|
+
, {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
style: [style.button, style.confirmButton], variant: BUTTON_VARIANT.SECONDARY, onPress: onConfirm }, confirmButtonText))));
|
|
31
33
|
};
|
|
32
34
|
export { GetOutOfCheckoutModal };
|
package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js
CHANGED
|
@@ -24,7 +24,7 @@ const returnQuestionItems = {
|
|
|
24
24
|
const ReturnQuestionsForm = ({ feedback, returnQuestions, onClose, visible }) => (React.createElement(ReturnQuestionFeedbackProvider, { feedback: feedback },
|
|
25
25
|
React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
|
|
26
26
|
React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
|
|
27
|
-
React.createElement(Modal, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, visible: visible, scroll: true, onClose: onClose },
|
|
27
|
+
React.createElement(Modal, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, visible: visible, scroll: true, showCloseButton: true, onClose: onClose },
|
|
28
28
|
React.createElement(View, { style: style.returnQuestionsContainer },
|
|
29
29
|
React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }))))));
|
|
30
30
|
export { ReturnQuestionsForm };
|
|
@@ -2,22 +2,24 @@ import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Butt
|
|
|
2
2
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { View } from "react-native";
|
|
6
6
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
7
|
+
import { Modal } from "../../../../shared/components/layouts/modal/Modal";
|
|
7
8
|
import { style } from "./SizeChangeModal.style";
|
|
8
9
|
const SizeChangeModal = ({ visible, onDismiss }) => {
|
|
9
10
|
const titleText = useI18nMessage({ id: I18nMessages.SIZE_CHANGE_MODAL_TITLE });
|
|
10
11
|
const descriptionText = useI18nMessage({ id: I18nMessages.SIZE_CHANGE_MODAL_DESCRIPTION });
|
|
11
12
|
const buttonText = useI18nMessage({ id: I18nMessages.SIZE_CHANGE_MODAL_BUTTON });
|
|
12
|
-
return (React.createElement(Modal, { visible: visible },
|
|
13
|
-
React.createElement(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
, {
|
|
13
|
+
return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
|
|
14
|
+
React.createElement(View, { style: style.modal },
|
|
15
|
+
React.createElement(Text, { level: 1, style: style.modalTitle, body: true }, titleText),
|
|
16
|
+
React.createElement(Text, { level: 3, style: style.modalDescription, body: true }, descriptionText),
|
|
17
|
+
React.createElement(Button
|
|
19
18
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
19
|
// @ts-ignore
|
|
21
|
-
|
|
20
|
+
, {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
style: style.button, onPress: onDismiss }, buttonText))));
|
|
22
24
|
};
|
|
23
25
|
export { SizeChangeModal };
|