@lookiero/checkout 0.2.27-beta.3 → 0.2.27-beta.4
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/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +7 -17
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +1 -1
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.js +16 -3
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.style.d.ts +36 -27
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.style.js +12 -4
- package/package.json +1 -1
package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
CheckoutItemStatus.INITIAL,
|
|
8
|
-
CheckoutItemStatus.INITIAL,
|
|
9
|
-
CheckoutItemStatus.INITIAL,
|
|
10
|
-
CheckoutItemStatus.INITIAL,
|
|
11
|
-
],
|
|
1
|
+
import { toCheckoutProjection } from "./checkout";
|
|
2
|
+
const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId, signal }) => {
|
|
3
|
+
const response = await httpPost({
|
|
4
|
+
endpoint: "/view-first-available-checkout-by-customer-id",
|
|
5
|
+
body: { customer_id: customerId },
|
|
6
|
+
signal,
|
|
12
7
|
});
|
|
13
|
-
|
|
14
|
-
// endpoint: "/view-first-available-checkout-by-customer-id",
|
|
15
|
-
// body: { customer_id: customerId },
|
|
16
|
-
// signal,
|
|
17
|
-
// });
|
|
18
|
-
// return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
|
|
8
|
+
return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
|
|
19
9
|
};
|
|
20
10
|
export { httpFirstAvailableCheckoutByCustomerIdView };
|
|
@@ -6,7 +6,7 @@ const { spaceXL } = theme();
|
|
|
6
6
|
const SafeAreaScrollView = ({ children, edges = ["top", "bottom", "left", "right"] }) => {
|
|
7
7
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
8
8
|
return (React.createElement(SafeAreaView, { edges: edges },
|
|
9
|
-
React.createElement(ScrollView,
|
|
9
|
+
React.createElement(ScrollView, null,
|
|
10
10
|
React.createElement(View, { style: {
|
|
11
11
|
paddingTop: !safeAreaInsetTop ? spaceXL : 0,
|
|
12
12
|
paddingBottom: !safeAreaInsetBottom ? spaceXL : 0,
|
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import { Portal } from "@gorhom/portal";
|
|
2
|
+
import { useBack } from "@lookiero/aurora-next/build/hooks/useBack/useBack";
|
|
2
3
|
import { animated, useTransition } from "@react-spring/native";
|
|
3
4
|
import React, { useCallback, useMemo, useState } from "react";
|
|
4
5
|
import { Dimensions, Platform, ScrollView, TouchableWithoutFeedback, View, } from "react-native";
|
|
5
6
|
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
7
|
+
import { theme } from "../../../../theme/theme";
|
|
6
8
|
import { useScreenSize } from "../../../hooks/useScreenSize";
|
|
7
9
|
import { ButtonIcon } from "../../molecules/buttonIcon/ButtonIcon";
|
|
8
10
|
import { Row } from "../row/Row";
|
|
9
11
|
import { style } from "./Modal.style";
|
|
12
|
+
const { spaceXXL } = theme();
|
|
10
13
|
const TRANSITION_MODAL_SCALE = 0.9;
|
|
14
|
+
const DEFAULT_SAFEAREA_INSET_TOP = spaceXXL;
|
|
11
15
|
const Modal = ({ children, visible, header, portalHostName, onClose, showCloseButton = false, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, }) => {
|
|
12
16
|
const { height: screenHeight } = Dimensions.get("screen");
|
|
13
17
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
14
|
-
|
|
18
|
+
// On Android safeAreaInsetTop won't return the actual value.
|
|
19
|
+
const screenSizeWithoutInsets = screenHeight - (Platform.OS === "android" ? DEFAULT_SAFEAREA_INSET_TOP : safeAreaInsetTop);
|
|
15
20
|
const screenSize = useScreenSize();
|
|
16
|
-
const isSmallDevice = screenSize === "S"
|
|
21
|
+
const isSmallDevice = screenSize === "S";
|
|
17
22
|
const columnSizeForScreenSize = size[screenSize];
|
|
23
|
+
const handleHardwareBackPress = useCallback(() => {
|
|
24
|
+
if (!visible) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
onClose();
|
|
28
|
+
return true; // The event will not be bubbled up
|
|
29
|
+
}, [onClose, visible]);
|
|
30
|
+
useBack(handleHardwareBackPress);
|
|
18
31
|
const [modalHeight, setModalHeight] = useState();
|
|
19
32
|
const handleOnModalLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => setModalHeight(height), []);
|
|
20
33
|
const transitions = useTransition(visible, {
|
|
@@ -45,7 +58,7 @@ const Modal = ({ children, visible, header, portalHostName, onClose, showCloseBu
|
|
|
45
58
|
React.createElement(Row, { pointerEvents: "box-none", style: [style.row, isSmallDevice && style.rowSmall, customStyle?.row] },
|
|
46
59
|
React.createElement(animated.View, { pointerEvents: visible ? "auto" : "none", style: [
|
|
47
60
|
style.modal,
|
|
48
|
-
columnSizeForScreenSize && style
|
|
61
|
+
columnSizeForScreenSize && style[columnSizeForScreenSize],
|
|
49
62
|
{
|
|
50
63
|
opacity: modalOpacity,
|
|
51
64
|
transform: [{ translateY: modalTranslateY }, { scale: modalScale }],
|
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
import { ViewStyle } from "react-native";
|
|
2
|
-
declare const style: {
|
|
3
|
-
container: {
|
|
4
|
-
height: string;
|
|
5
|
-
overflow: "hidden";
|
|
6
|
-
position: "absolute";
|
|
7
|
-
width: string;
|
|
8
|
-
};
|
|
9
|
-
header: {
|
|
10
|
-
alignItems: "center";
|
|
11
|
-
flexDirection: "row";
|
|
12
|
-
justifyContent: "space-between";
|
|
13
|
-
padding: number;
|
|
14
|
-
};
|
|
15
|
-
modal: {
|
|
16
|
-
"1/4": ViewStyle;
|
|
17
|
-
"1/3": ViewStyle;
|
|
18
|
-
"1/2": ViewStyle;
|
|
19
|
-
"2/3": ViewStyle;
|
|
20
|
-
backgroundColor: string;
|
|
21
|
-
position: "absolute";
|
|
22
|
-
width: string;
|
|
23
|
-
zIndex: number;
|
|
24
|
-
};
|
|
1
|
+
import { StyleSheet, ViewStyle } from "react-native";
|
|
2
|
+
declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
25
3
|
overlay: {
|
|
26
|
-
backgroundColor: string;
|
|
27
|
-
cursor: string;
|
|
28
4
|
height: string;
|
|
29
5
|
position: "absolute";
|
|
30
6
|
width: string;
|
|
31
7
|
zIndex: number;
|
|
8
|
+
cursor?: string | undefined;
|
|
9
|
+
backgroundColor: string;
|
|
32
10
|
};
|
|
33
11
|
row: {
|
|
34
12
|
alignContent: "center";
|
|
@@ -42,5 +20,36 @@ declare const style: {
|
|
|
42
20
|
flex: number;
|
|
43
21
|
zIndex: number;
|
|
44
22
|
};
|
|
45
|
-
|
|
23
|
+
"1/4": ViewStyle;
|
|
24
|
+
"1/3": ViewStyle;
|
|
25
|
+
"1/2": ViewStyle;
|
|
26
|
+
"2/3": ViewStyle;
|
|
27
|
+
container: {
|
|
28
|
+
width: string;
|
|
29
|
+
height: string;
|
|
30
|
+
overflow: "hidden";
|
|
31
|
+
} | {
|
|
32
|
+
width: string;
|
|
33
|
+
position: "fixed";
|
|
34
|
+
height: string;
|
|
35
|
+
overflow: "hidden";
|
|
36
|
+
} | {
|
|
37
|
+
width: string;
|
|
38
|
+
position: "absolute";
|
|
39
|
+
height: string;
|
|
40
|
+
overflow: "hidden";
|
|
41
|
+
};
|
|
42
|
+
header: {
|
|
43
|
+
alignItems: "center";
|
|
44
|
+
flexDirection: "row";
|
|
45
|
+
justifyContent: "space-between";
|
|
46
|
+
padding: number;
|
|
47
|
+
};
|
|
48
|
+
modal: {
|
|
49
|
+
backgroundColor: string;
|
|
50
|
+
position: "absolute";
|
|
51
|
+
width: string;
|
|
52
|
+
zIndex: number;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
46
55
|
export { style };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
1
|
+
import { Platform, StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
3
|
const { spaceM, colorBase, colorOverlay } = theme();
|
|
4
4
|
const modalStylesForColumSize = {
|
|
@@ -16,10 +16,16 @@ const modalStylesForColumSize = {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
const style = StyleSheet.create({
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
|
+
// @ts-ignore
|
|
19
21
|
container: {
|
|
20
22
|
height: "100%",
|
|
21
23
|
overflow: "hidden",
|
|
22
|
-
|
|
24
|
+
...Platform.select({
|
|
25
|
+
web: { position: "fixed" },
|
|
26
|
+
android: { position: "absolute" },
|
|
27
|
+
ios: { position: "absolute" },
|
|
28
|
+
}),
|
|
23
29
|
width: "100%",
|
|
24
30
|
},
|
|
25
31
|
header: {
|
|
@@ -33,11 +39,13 @@ const style = StyleSheet.create({
|
|
|
33
39
|
position: "absolute",
|
|
34
40
|
width: "100%",
|
|
35
41
|
zIndex: 3,
|
|
36
|
-
...modalStylesForColumSize,
|
|
37
42
|
},
|
|
43
|
+
...modalStylesForColumSize,
|
|
38
44
|
overlay: {
|
|
39
45
|
backgroundColor: colorOverlay,
|
|
40
|
-
|
|
46
|
+
...Platform.select({
|
|
47
|
+
web: { cursor: "pointer" },
|
|
48
|
+
}),
|
|
41
49
|
height: "100%",
|
|
42
50
|
position: "absolute",
|
|
43
51
|
width: "100%",
|