ordering-ui-react-native 0.21.88 → 0.21.90
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/package.json +1 -1
- package/themes/business/src/components/UserProfileForm/index.tsx +4 -4
- package/themes/original/src/components/AddressDetails/index.tsx +18 -8
- package/themes/original/src/components/CartContent/index.tsx +19 -4
- package/themes/original/src/components/MultiCheckout/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -118,14 +118,14 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
118
118
|
includeBase64: true,
|
|
119
119
|
},
|
|
120
120
|
(image: any) => {
|
|
121
|
-
const response = image?.assets[0];
|
|
122
|
-
if (response
|
|
121
|
+
const response = image?.assets?.[0];
|
|
122
|
+
if (response?.didCancel) {
|
|
123
123
|
console.log('User cancelled image picker');
|
|
124
|
-
} else if (response
|
|
124
|
+
} else if (response?.errorMessage) {
|
|
125
125
|
console.log('ImagePicker Error: ', response.errorMessage);
|
|
126
126
|
showToast(ToastType.Error, response.errorMessage);
|
|
127
127
|
} else {
|
|
128
|
-
if (response
|
|
128
|
+
if (response?.uri) {
|
|
129
129
|
const url = `data:${response.type};base64,${response.base64}`;
|
|
130
130
|
handleButtonUpdateClick(null, true, url);
|
|
131
131
|
} else {
|
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FastImage from 'react-native-fast-image'
|
|
3
|
-
import { StyleSheet, TouchableOpacity,
|
|
3
|
+
import { StyleSheet, TouchableOpacity, useWindowDimensions } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
AddressDetails as AddressDetailsController,
|
|
6
6
|
useOrder,
|
|
7
7
|
useLanguage,
|
|
8
8
|
} from 'ordering-components/native';
|
|
9
|
+
import { useTheme } from 'styled-components/native';
|
|
9
10
|
|
|
10
11
|
import { ADContainer, ADHeader, ADAddress, ADMap } from './styles';
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
import { OText, OIcon } from '../shared';
|
|
14
|
-
import { useWindowDimensions } from 'react-native';
|
|
12
|
+
import { OText } from '../shared';
|
|
13
|
+
import { getTypesText } from '../../utils';
|
|
15
14
|
|
|
16
15
|
const AddressDetailsUI = (props: any) => {
|
|
17
|
-
const {
|
|
18
|
-
|
|
16
|
+
const {
|
|
17
|
+
navigation,
|
|
18
|
+
addressToShow,
|
|
19
|
+
isCartPending,
|
|
20
|
+
googleMapsUrl,
|
|
21
|
+
apiKey
|
|
22
|
+
} = props;
|
|
19
23
|
|
|
20
24
|
const theme = useTheme();
|
|
21
25
|
const [orderState] = useOrder();
|
|
26
|
+
const [{ options }] = useOrder();
|
|
22
27
|
const [, t] = useLanguage();
|
|
23
28
|
const { width } = useWindowDimensions();
|
|
24
29
|
|
|
30
|
+
const orderTypeText = {
|
|
31
|
+
key: getTypesText(options?.type || 1),
|
|
32
|
+
value: t(getTypesText(options?.type || 1), 'Delivery')
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
const styles = StyleSheet.create({
|
|
26
36
|
productStyle: {
|
|
27
37
|
width,
|
|
@@ -39,7 +49,7 @@ const AddressDetailsUI = (props: any) => {
|
|
|
39
49
|
lineHeight={24}
|
|
40
50
|
color={theme.colors.textNormal}
|
|
41
51
|
>
|
|
42
|
-
{t(
|
|
52
|
+
{t(`${orderTypeText.key}_ADDRESS`, `${orderTypeText.value} address`)}
|
|
43
53
|
</OText>
|
|
44
54
|
)}
|
|
45
55
|
</ADHeader>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
@@ -13,7 +13,8 @@ export const CartContent = (props: any) => {
|
|
|
13
13
|
const {
|
|
14
14
|
onNavigationRedirect,
|
|
15
15
|
singleBusiness,
|
|
16
|
-
businessSlug
|
|
16
|
+
businessSlug,
|
|
17
|
+
navigation
|
|
17
18
|
} = props
|
|
18
19
|
|
|
19
20
|
const theme = useTheme();
|
|
@@ -22,7 +23,7 @@ export const CartContent = (props: any) => {
|
|
|
22
23
|
const [{ parsePrice }] = useUtils();
|
|
23
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
24
25
|
const [cartsOpened, setCartsOpened] = useState([])
|
|
25
|
-
const [{ carts: cartsContext }] = useOrder();
|
|
26
|
+
const [{ carts: cartsContext }, { confirmCart }] = useOrder();
|
|
26
27
|
const cartsList =
|
|
27
28
|
(cartsContext &&
|
|
28
29
|
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
@@ -71,7 +72,7 @@ export const CartContent = (props: any) => {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
const changeActiveState = useCallback((isClosed
|
|
75
|
+
const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
|
|
75
76
|
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
76
77
|
if (isActive || !isClosed) {
|
|
77
78
|
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
@@ -83,6 +84,20 @@ export const CartContent = (props: any) => {
|
|
|
83
84
|
}
|
|
84
85
|
}, [cartsOpened])
|
|
85
86
|
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const unsuscribe = navigation.addListener('focus', () => {
|
|
89
|
+
const cartsListBlockedByPaypal = carts?.filter((cart: any) => cart?.status === 2 && cart?.paymethod_data?.gateway === 'paypal')
|
|
90
|
+
if (cartsListBlockedByPaypal?.length > 0) {
|
|
91
|
+
cartsListBlockedByPaypal.map(async (cart: any) => {
|
|
92
|
+
await confirmCart(cart?.uuid)
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
return () => {
|
|
97
|
+
return unsuscribe()
|
|
98
|
+
}
|
|
99
|
+
}, [carts, navigation])
|
|
100
|
+
|
|
86
101
|
return (
|
|
87
102
|
<CCContainer
|
|
88
103
|
style={{ paddingHorizontal: 20 }}
|
|
@@ -318,7 +318,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
318
318
|
</TopHeader>
|
|
319
319
|
</View>
|
|
320
320
|
</SafeAreaView>
|
|
321
|
-
<Container pt={0} noPadding onScroll={handleScroll}>
|
|
321
|
+
<Container pt={0} noPadding onScroll={handleScroll} showsVerticalScrollIndicator={false}>
|
|
322
322
|
<View style={styles.wrapperNavbar}>
|
|
323
323
|
<NavBar
|
|
324
324
|
hideArrowLeft
|