ordering-ui-react-native 0.22.21 → 0.22.22-release
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 +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +40 -39
- package/src/components/StripeMethodForm/index.tsx +4 -2
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/types/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +49 -26
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
- package/themes/business/src/components/OrderDetails/Business.tsx +47 -27
- package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +128 -41
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +45 -18
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +6 -4
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +217 -156
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +39 -16
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +162 -174
- package/themes/business/src/components/PrinterSettings/styles.tsx +14 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +55 -22
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +16 -4
- package/themes/business/src/utils/index.tsx +33 -3
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +11 -0
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +46 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +127 -77
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +3 -11
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +12 -9
- package/themes/original/src/components/MessageListing/index.tsx +2 -1
- package/themes/original/src/components/Messages/index.tsx +27 -19
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +80 -51
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- package/themes/original/src/components/MyOrders/index.tsx +2 -2
- package/themes/original/src/components/NavBar/index.tsx +7 -4
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
- package/themes/original/src/components/OrderDetails/index.tsx +44 -21
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -3
- package/themes/original/src/components/OrderSummary/index.tsx +29 -10
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +3 -6
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +4 -3
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +50 -43
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +0 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +102 -88
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -5
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +16 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +76 -62
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +164 -135
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserVerification/index.tsx +15 -4
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/types/index.tsx +10 -3
- package/themes/original/src/utils/index.tsx +30 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import GeoLocation from 'react-native-geolocation-service';
|
|
3
3
|
import { Location } from '../types';
|
|
4
|
-
import {useApi, useSession, useLanguage} from 'ordering-components/native'
|
|
4
|
+
import { useApi, useSession, useLanguage } from 'ordering-components/native'
|
|
5
5
|
|
|
6
6
|
export const useLocation = () => {
|
|
7
|
-
const [,t] = useLanguage()
|
|
7
|
+
const [, t] = useLanguage()
|
|
8
8
|
const [ordering] = useApi()
|
|
9
|
-
const [{token, user}] = useSession()
|
|
9
|
+
const [{ token, user }] = useSession()
|
|
10
10
|
const [hasLocation, setHasLocation] = useState(false);
|
|
11
11
|
const [initialPosition, setInitialPosition] = useState<Location>({
|
|
12
12
|
longitude: 0,
|
|
13
13
|
latitude: 0,
|
|
14
14
|
speed: 0,
|
|
15
|
+
mocked: false
|
|
15
16
|
});
|
|
16
17
|
const [userLocation, setUserLocation] = useState<Location>({
|
|
17
18
|
longitude: 0,
|
|
18
19
|
latitude: 0,
|
|
19
20
|
speed: 0,
|
|
21
|
+
mocked: false
|
|
20
22
|
});
|
|
21
|
-
const [newLocation,setNewLocation] = useState<any>({ loading: false, error: null, newLocation: null })
|
|
23
|
+
const [newLocation, setNewLocation] = useState<any>({ loading: false, error: null, newLocation: null })
|
|
22
24
|
const [routeLines, setRoutesLines] = useState<Location[]>([]);
|
|
23
25
|
const isMounted = useRef(true);
|
|
24
26
|
|
|
@@ -37,7 +39,7 @@ export const useLocation = () => {
|
|
|
37
39
|
if (!isMounted.current) return;
|
|
38
40
|
setInitialPosition(location);
|
|
39
41
|
setUserLocation(location);
|
|
40
|
-
setRoutesLines(routes => [...routes, location]);
|
|
42
|
+
setRoutesLines((routes: any) => [...routes, location]);
|
|
41
43
|
setHasLocation(true);
|
|
42
44
|
})
|
|
43
45
|
.catch(err => console.log(err));
|
|
@@ -46,14 +48,15 @@ export const useLocation = () => {
|
|
|
46
48
|
const getCurrentLocation = (): Promise<Location> => {
|
|
47
49
|
return new Promise((resolve, reject) => {
|
|
48
50
|
GeoLocation.getCurrentPosition(
|
|
49
|
-
({ coords }) => {
|
|
51
|
+
({ coords, mocked }: any) => {
|
|
50
52
|
resolve({
|
|
51
53
|
latitude: typeof coords.latitude === 'number' && !Number.isNaN(coords.latitude) ? coords.latitude : 0,
|
|
52
54
|
longitude: typeof coords.longitude === 'number' && !Number.isNaN(coords.longitude) ? coords.longitude : 0,
|
|
53
55
|
speed: coords.speed,
|
|
56
|
+
mocked
|
|
54
57
|
});
|
|
55
58
|
},
|
|
56
|
-
err => reject({ err }),
|
|
59
|
+
(err: any) => reject({ err }),
|
|
57
60
|
{ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000 },
|
|
58
61
|
);
|
|
59
62
|
});
|
|
@@ -61,18 +64,19 @@ export const useLocation = () => {
|
|
|
61
64
|
|
|
62
65
|
const followUserLocation = () => {
|
|
63
66
|
watchId.current = GeoLocation.watchPosition(
|
|
64
|
-
({ coords }) => {
|
|
67
|
+
({ coords, mocked }: any) => {
|
|
65
68
|
if (!isMounted.current) return;
|
|
66
69
|
if (typeof coords.latitude !== 'number' || typeof coords.longitude !== 'number') return
|
|
67
70
|
const location: Location = {
|
|
68
71
|
latitude: coords.latitude || 0,
|
|
69
72
|
longitude: coords.longitude || 0,
|
|
70
73
|
speed: coords.speed,
|
|
74
|
+
mocked
|
|
71
75
|
};
|
|
72
76
|
setUserLocation(location);
|
|
73
|
-
setRoutesLines(routes => [...routes, location]);
|
|
77
|
+
setRoutesLines((routes: any) => [...routes, location]);
|
|
74
78
|
},
|
|
75
|
-
err => console.log(err),
|
|
79
|
+
(err: any) => console.log(err),
|
|
76
80
|
{ enableHighAccuracy: true, distanceFilter: 3 },
|
|
77
81
|
);
|
|
78
82
|
};
|
|
@@ -83,14 +87,14 @@ export const useLocation = () => {
|
|
|
83
87
|
|
|
84
88
|
const updateDriverPosition = async (newLocation = {}) => {
|
|
85
89
|
try {
|
|
86
|
-
setNewLocation({...newLocation, loading: true})
|
|
90
|
+
setNewLocation({ ...newLocation, loading: true })
|
|
87
91
|
const { content: { error, result } } = await ordering.setAccessToken(token).users(user?.id).driverLocations().save(newLocation)
|
|
88
92
|
if (error) {
|
|
89
93
|
setNewLocation({ ...newLocation, loading: false, error: [result[0] || result || t('ERROR_UPDATING_POSITION', 'Error updating position')] })
|
|
90
94
|
} else {
|
|
91
95
|
setNewLocation({ ...newLocation, loading: false, newLocation: { ...newLocation, ...result } })
|
|
92
96
|
}
|
|
93
|
-
} catch (error
|
|
97
|
+
} catch (error: any) {
|
|
94
98
|
setNewLocation({ ...newLocation, loading: false, error: [error?.message || t('NETWORK_ERROR', 'Network Error')] })
|
|
95
99
|
}
|
|
96
100
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Dimensions,
|
|
4
4
|
Platform,
|
|
5
5
|
StatusBar,
|
|
6
|
-
StyleSheet,
|
|
7
6
|
View,
|
|
8
7
|
} from 'react-native';
|
|
9
|
-
import styled from 'styled-components/native';
|
|
8
|
+
import styled, { useTheme } from 'styled-components/native';
|
|
9
|
+
import { useNetInfo } from '@react-native-community/netinfo';
|
|
10
10
|
|
|
11
11
|
export const SafeAreaContainer = styled.SafeAreaView`
|
|
12
12
|
flex: 1;
|
|
@@ -14,6 +14,10 @@ export const SafeAreaContainer = styled.SafeAreaView`
|
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
16
|
export const SafeAreaContainerLayout = (props: any) => {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const netInfo = useNetInfo()
|
|
19
|
+
|
|
20
|
+
const [statusColor, setStatusColor] = useState<string | null>(null)
|
|
17
21
|
const [orientation, setOrientation] = useState(
|
|
18
22
|
Dimensions.get('window').width < Dimensions.get('window').height
|
|
19
23
|
? 'Portrait'
|
|
@@ -28,22 +32,34 @@ export const SafeAreaContainerLayout = (props: any) => {
|
|
|
28
32
|
}
|
|
29
33
|
});
|
|
30
34
|
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (netInfo.isConnected === false) {
|
|
37
|
+
setStatusColor(theme.colors.danger500)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (netInfo.isConnected && statusColor) {
|
|
41
|
+
setStatusColor(theme.colors.success500)
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
setStatusColor(null)
|
|
44
|
+
}, 2000);
|
|
45
|
+
}
|
|
46
|
+
}, [netInfo.isConnected])
|
|
47
|
+
|
|
31
48
|
return (
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</>
|
|
49
|
+
<SafeAreaContainer>
|
|
50
|
+
<View
|
|
51
|
+
style={{
|
|
52
|
+
paddingHorizontal: 30,
|
|
53
|
+
paddingTop: 0,
|
|
54
|
+
paddingBottom: 0,
|
|
55
|
+
flex: 1,
|
|
56
|
+
}}>
|
|
57
|
+
<StatusBar
|
|
58
|
+
barStyle={Platform.OS === 'ios' ? 'dark-content' : 'default'}
|
|
59
|
+
{...statusColor && ({ backgroundColor: statusColor })}
|
|
60
|
+
/>
|
|
61
|
+
{props.children}
|
|
62
|
+
</View>
|
|
63
|
+
</SafeAreaContainer>
|
|
48
64
|
);
|
|
49
65
|
};
|
|
@@ -43,6 +43,7 @@ export interface ProfileParams {
|
|
|
43
43
|
navigation?: any;
|
|
44
44
|
isEdit?: boolean;
|
|
45
45
|
formState?: any;
|
|
46
|
+
setRootState?: any;
|
|
46
47
|
userState?: any;
|
|
47
48
|
toggleIsEdit?: any;
|
|
48
49
|
cleanFormState?: any;
|
|
@@ -51,6 +52,7 @@ export interface ProfileParams {
|
|
|
51
52
|
handleChangeInput?: any;
|
|
52
53
|
handleButtonUpdateClick?: any;
|
|
53
54
|
handleToggleAvalaibleStatusDriver?: any;
|
|
55
|
+
handleRemoveAccount?: any;
|
|
54
56
|
onNavigationRedirect?: any;
|
|
55
57
|
handlechangeImage?: any;
|
|
56
58
|
validationFields?: any;
|
|
@@ -311,9 +313,9 @@ export interface OrdersOptionParams {
|
|
|
311
313
|
cancelled?: Array<number>;
|
|
312
314
|
};
|
|
313
315
|
isBusinessApp?: boolean;
|
|
314
|
-
handleClickLogisticOrder
|
|
315
|
-
logisticOrders
|
|
316
|
-
loadLogisticOrders
|
|
316
|
+
handleClickLogisticOrder?: (status: number, orderId: number) => void,
|
|
317
|
+
logisticOrders?: { orders: Array<any>, loading: boolean, error: Array<string> | string },
|
|
318
|
+
loadLogisticOrders?: () => void;
|
|
317
319
|
isLogisticActivated?: boolean;
|
|
318
320
|
isAlsea?: boolean;
|
|
319
321
|
checkNotification?: boolean;
|
|
@@ -321,6 +323,10 @@ export interface OrdersOptionParams {
|
|
|
321
323
|
handleChangeOrderStatus?: () => void;
|
|
322
324
|
handleSendCustomerReview?: () => void;
|
|
323
325
|
orderDetailsProps?: any;
|
|
326
|
+
isNetConnected?: boolean;
|
|
327
|
+
isDriverApp?: boolean;
|
|
328
|
+
combineTabs?: boolean;
|
|
329
|
+
setCombineTabsState?: any;
|
|
324
330
|
}
|
|
325
331
|
export interface ActiveOrdersParams {
|
|
326
332
|
orders?: any;
|
|
@@ -411,6 +417,8 @@ export interface OrderDetailsParams {
|
|
|
411
417
|
orderTitle?: any;
|
|
412
418
|
forceUpdate?: number;
|
|
413
419
|
getPermissions?: any
|
|
420
|
+
loadMessages?: any;
|
|
421
|
+
notificationApp?: string
|
|
414
422
|
}
|
|
415
423
|
export interface ProductItemAccordionParams {
|
|
416
424
|
isCartPending?: boolean;
|
|
@@ -446,6 +454,7 @@ export interface MessagesParams {
|
|
|
446
454
|
sendMessage?: any;
|
|
447
455
|
canRead?: any;
|
|
448
456
|
setCanRead?: any;
|
|
457
|
+
notificationApp?: string
|
|
449
458
|
handleSend?: () => {};
|
|
450
459
|
setImage?: (image: string | null) => {};
|
|
451
460
|
setMessage?: (comment: string) => {};
|
|
@@ -496,7 +505,8 @@ export interface FloatingButtonParams {
|
|
|
496
505
|
firstColorCustom?: string;
|
|
497
506
|
secondColorCustom?: string;
|
|
498
507
|
paddingBottomIos?: any;
|
|
499
|
-
isHideRejectButtons?: boolean
|
|
508
|
+
isHideRejectButtons?: boolean;
|
|
509
|
+
principalButtonColor?: string;
|
|
500
510
|
}
|
|
501
511
|
export interface MomentOptionParams {
|
|
502
512
|
navigation: any;
|
|
@@ -533,6 +543,7 @@ export interface Location {
|
|
|
533
543
|
latitude: number;
|
|
534
544
|
longitude: number;
|
|
535
545
|
speed: number;
|
|
546
|
+
mocked?: boolean;
|
|
536
547
|
}
|
|
537
548
|
|
|
538
549
|
export interface GoogleMapsParams {
|
|
@@ -597,6 +608,7 @@ export interface AcceptOrRejectOrderParams {
|
|
|
597
608
|
isPage?: boolean
|
|
598
609
|
navigation?: any
|
|
599
610
|
route?: any
|
|
611
|
+
isLoadingOrder?: boolean
|
|
600
612
|
}
|
|
601
613
|
|
|
602
614
|
export interface MapViewParams {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
3
3
|
import { CODES } from 'ordering-components/native';
|
|
4
|
+
import { CURRENCY } from '../config/currency'
|
|
4
5
|
|
|
5
6
|
export const flatArray = (arr: any) => [].concat(...arr);
|
|
6
7
|
|
|
@@ -39,7 +40,8 @@ export const getTraduction = (key: string, t: any) => {
|
|
|
39
40
|
ERROR_USER_UPDATE_YOU_HAVE_ASSIGNED_ORDERS:
|
|
40
41
|
"You can't because you have assigned orders",
|
|
41
42
|
ERROR_INVALID_OFFER: 'The offer doesn\'t exist',
|
|
42
|
-
ERROR_AUTH_DRIVER_LOGIN_VALIDATION: 'Error auth driver login validation'
|
|
43
|
+
ERROR_AUTH_DRIVER_LOGIN_VALIDATION: 'Error auth driver login validation',
|
|
44
|
+
ERROR_DRIVER_UPDATE_SCHEDULE: 'Error driver update schedule',
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
return keyList[key] ? t(key, keyList[key]) : t(key);
|
|
@@ -146,17 +148,22 @@ export const transformCountryCode = (countryCode: number) => {
|
|
|
146
148
|
return code?.countryCode;
|
|
147
149
|
};
|
|
148
150
|
|
|
151
|
+
export const findExitingCode = (countryCode: string) => {
|
|
152
|
+
const code = CODES.find((code: any) => code.countryCode === (countryCode || '').toUpperCase())
|
|
153
|
+
return code?.countryCode
|
|
154
|
+
}
|
|
155
|
+
|
|
149
156
|
/**
|
|
150
157
|
* Function to check if a number is decimal or not
|
|
151
158
|
* @param {*} value number to check if decimal or not
|
|
152
159
|
* @param {*} parser function fallback when is decimal
|
|
153
160
|
* @returns string
|
|
154
161
|
*/
|
|
155
|
-
export const verifyDecimals = (value: number, parser: any) => {
|
|
162
|
+
export const verifyDecimals = (value: number, parser: any, options?: any) => {
|
|
156
163
|
if (value % 1 === 0) {
|
|
157
164
|
return value;
|
|
158
165
|
} else {
|
|
159
|
-
return parser(value);
|
|
166
|
+
return options ? parser(value, options) : parser(value);
|
|
160
167
|
}
|
|
161
168
|
};
|
|
162
169
|
|
|
@@ -338,6 +345,24 @@ export const getOrderStatus = (s: string, t: any) => {
|
|
|
338
345
|
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
339
346
|
slug: 'ORDER_DRIVER_ON_WAY',
|
|
340
347
|
percentage: 45
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
key: 24,
|
|
351
|
+
value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
|
|
352
|
+
slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
|
|
353
|
+
percentage: 25
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
key: 25,
|
|
357
|
+
value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
|
|
358
|
+
slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
|
|
359
|
+
percentage: 25
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
key: 26,
|
|
363
|
+
value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
|
|
364
|
+
slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
|
|
365
|
+
percentage: 80
|
|
341
366
|
}
|
|
342
367
|
];
|
|
343
368
|
|
|
@@ -396,3 +421,8 @@ export const calculateDistance = (
|
|
|
396
421
|
const distanceInKm = distance / 1000;
|
|
397
422
|
return distanceInKm;
|
|
398
423
|
};
|
|
424
|
+
|
|
425
|
+
export const getCurrenySymbol = (code : string) => {
|
|
426
|
+
return CURRENCY?.[code]?.symbol ?? code
|
|
427
|
+
}
|
|
428
|
+
|
|
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
197
197
|
{isFarAway && (
|
|
198
198
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
199
199
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
200
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
200
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
|
|
201
201
|
</FarAwayMessage>
|
|
202
202
|
)}
|
|
203
203
|
{!auth && (
|
|
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
410
410
|
textInputProps={{
|
|
411
411
|
returnKeyType: 'next',
|
|
412
412
|
onSubmitEditing: () => inputRef?.current?.focus?.(),
|
|
413
|
-
style: { borderWidth: 0, fontSize: 12 }
|
|
414
|
-
maxLength: 10
|
|
413
|
+
style: { borderWidth: 0, fontSize: 12 }
|
|
415
414
|
}}
|
|
416
415
|
textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
|
|
417
416
|
/>
|
|
@@ -155,7 +155,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
155
155
|
{isFarAway && (
|
|
156
156
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
157
157
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
158
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
158
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
|
|
159
159
|
</FarAwayMessage>
|
|
160
160
|
)}
|
|
161
161
|
<View style={styles.wrapperOrderOptions}>
|
|
@@ -50,6 +50,12 @@ const CheckoutUI = (props: any) => {
|
|
|
50
50
|
}
|
|
51
51
|
}, [cart])
|
|
52
52
|
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
|
|
55
|
+
navigation?.canGoBack() && navigation.goBack()
|
|
56
|
+
}
|
|
57
|
+
}, [cart])
|
|
58
|
+
|
|
53
59
|
return (
|
|
54
60
|
<>
|
|
55
61
|
<PaymentOptions
|
|
@@ -4,6 +4,7 @@ import { OIcon, OButton, OText } from '../shared'
|
|
|
4
4
|
import { ImageStyle, TextStyle, View, Platform, TouchableOpacity } from 'react-native'
|
|
5
5
|
import { useConfig, useLanguage, useOrder } from 'ordering-components/native'
|
|
6
6
|
import { useTheme } from 'styled-components/native'
|
|
7
|
+
|
|
7
8
|
const Wrapper = styled.View`
|
|
8
9
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
9
10
|
padding: 10px 0px 20px 0px;
|
|
@@ -65,28 +66,27 @@ const NavBar = (props: Props) => {
|
|
|
65
66
|
|
|
66
67
|
return (
|
|
67
68
|
<Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
|
|
68
|
-
{(props?.onActionLeft) && (
|
|
69
|
+
{(props?.onActionLeft || props?.leftImg) && (
|
|
69
70
|
<OButton
|
|
70
|
-
imgLeftSrc={props.leftImg}
|
|
71
|
+
imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
|
|
71
72
|
imgRightSrc={null}
|
|
72
73
|
style={{ ...btnBackArrow, ...props.btnStyle }}
|
|
73
74
|
onClick={props.onActionLeft}
|
|
74
|
-
imgLeftStyle={props.imgLeftStyle}
|
|
75
|
-
{...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
|
|
75
|
+
imgLeftStyle= {props.imgLeftStyle}
|
|
76
76
|
/>)
|
|
77
77
|
}
|
|
78
78
|
<TitleTopWrapper>
|
|
79
79
|
{props.withIcon
|
|
80
80
|
? (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
<OIcon
|
|
82
|
+
url={props.icon}
|
|
83
|
+
style={{
|
|
84
|
+
borderColor: theme.colors.lightGray,
|
|
85
|
+
borderRadius: 20,
|
|
86
|
+
}}
|
|
87
|
+
width={60}
|
|
88
|
+
height={60}
|
|
89
|
+
/>
|
|
90
90
|
)
|
|
91
91
|
: null
|
|
92
92
|
}
|
|
@@ -134,7 +134,7 @@ const NavBar = (props: Props) => {
|
|
|
134
134
|
</View>
|
|
135
135
|
)}
|
|
136
136
|
|
|
137
|
-
{props.rightComponent}
|
|
137
|
+
{ props.rightComponent }
|
|
138
138
|
</Wrapper>
|
|
139
139
|
)
|
|
140
140
|
}
|
|
@@ -15,8 +15,6 @@ import { Container } from '../../layouts/Container'
|
|
|
15
15
|
import NavBar from '../NavBar'
|
|
16
16
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
|
|
17
17
|
import GridContainer from '../../layouts/GridContainer'
|
|
18
|
-
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
19
|
-
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
20
18
|
|
|
21
19
|
const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
22
20
|
const {
|
|
@@ -29,7 +27,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
29
27
|
callback
|
|
30
28
|
} = props
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
const theme = useTheme();
|
|
33
31
|
const [, t] = useLanguage();
|
|
34
32
|
const [orientationState] = useDeviceOrientation();
|
|
35
33
|
const [orderState] = useOrder()
|
|
@@ -47,7 +45,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
useEffect(() => {
|
|
50
|
-
if
|
|
48
|
+
if(isCardCliked){
|
|
51
49
|
callback?.()
|
|
52
50
|
setIsCardClicked(false)
|
|
53
51
|
setIsLoadingCard(null)
|
|
@@ -85,13 +83,13 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
85
83
|
style={cardStyle}
|
|
86
84
|
isDisabled={isCardCliked}
|
|
87
85
|
isLoading={isLoadingCard === 'Eat In'}
|
|
88
|
-
title={t('EAT_IN',
|
|
86
|
+
title={t('EAT_IN','Eat In')}
|
|
89
87
|
description={t('EAT_IN_DESCRIPTION', 'We are very glad to have you here. Bon appetit!')}
|
|
90
88
|
bgImage={theme.images.general.eatIn}
|
|
91
|
-
|
|
89
|
+
icon={theme.images.general.pushPin}
|
|
92
90
|
callToActionText={t('START_MY_ORDER', 'Start my order')}
|
|
93
91
|
onClick={() => {
|
|
94
|
-
if
|
|
92
|
+
if(_eatIn?.value !== orderState?.options?.type){
|
|
95
93
|
handleChangeOrderType(_eatIn?.value);
|
|
96
94
|
setIsCardClicked(true)
|
|
97
95
|
setIsLoadingCard('Eat In')
|
|
@@ -108,15 +106,15 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
108
106
|
|
|
109
107
|
<OptionCard
|
|
110
108
|
style={cardStyle}
|
|
111
|
-
title={t('TAKE_OUT',
|
|
109
|
+
title={t('TAKE_OUT','Take out')}
|
|
112
110
|
isDisabled={isCardCliked}
|
|
113
111
|
isLoading={isLoadingCard === 'Take out'}
|
|
114
112
|
description={t('TAKE_OUT_DESCRIPTION', 'You are very welcome anytime you visit us!')}
|
|
115
113
|
bgImage={theme.images.general.takeOut}
|
|
116
|
-
|
|
114
|
+
icon={theme.images.general.shoppingCart}
|
|
117
115
|
callToActionText={t('START_MY_ORDER', 'Start my order')}
|
|
118
116
|
onClick={() => {
|
|
119
|
-
if
|
|
117
|
+
if(_takeOut?.value !== orderState?.options?.type){
|
|
120
118
|
handleChangeOrderType(_takeOut?.value);
|
|
121
119
|
setIsCardClicked(true)
|
|
122
120
|
setIsLoadingCard('Take out')
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import styled from 'styled-components/native';
|
|
13
|
-
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
14
|
-
import { Icon, IconProps } from 'react-native-vector-icons/Icon';
|
|
15
13
|
|
|
16
14
|
const StyledButton = styled.View<Props>`
|
|
17
15
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
@@ -79,19 +77,17 @@ interface Props {
|
|
|
79
77
|
isCircle?: boolean;
|
|
80
78
|
bgColor?: string;
|
|
81
79
|
borderColor?: string;
|
|
82
|
-
iconProps?: IconProps;
|
|
83
|
-
IconCustom?: React.FunctionComponent
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
const OButton = (props: Props): React.ReactElement => {
|
|
87
83
|
if (props.isDisabled) {
|
|
88
84
|
return (
|
|
89
85
|
<View style={props.parentStyle}>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
<StyledButtonDisabled style={props.style}>
|
|
87
|
+
<StyledTextDisabled style={props.disabledTextStyle ? props.disabledTextStyle : props.textStyle}>
|
|
88
|
+
{props.text}
|
|
89
|
+
</StyledTextDisabled>
|
|
90
|
+
</StyledButtonDisabled>
|
|
95
91
|
</View>
|
|
96
92
|
);
|
|
97
93
|
}
|
|
@@ -115,15 +111,6 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
115
111
|
{props.imgLeftSrc ? (
|
|
116
112
|
<StyledImage style={props.imgLeftStyle} source={props.imgLeftSrc} />
|
|
117
113
|
) : null}
|
|
118
|
-
{props.iconProps ? (
|
|
119
|
-
<>
|
|
120
|
-
{props?.IconCustom ? (
|
|
121
|
-
<props.IconCustom {...props.iconProps} />
|
|
122
|
-
) : (
|
|
123
|
-
<AntDesignIcon {...props.iconProps} />
|
|
124
|
-
)}
|
|
125
|
-
</>
|
|
126
|
-
) : null}
|
|
127
114
|
{props.text ? (
|
|
128
115
|
<StyledText style={props.textStyle}>{props.text}</StyledText>
|
|
129
116
|
) : null}
|
|
@@ -19,6 +19,7 @@ import { Favorite } from './src/components/Favorite';
|
|
|
19
19
|
import { FavoriteList } from './src/components/FavoriteList';
|
|
20
20
|
import { FloatingButton } from './src/components/FloatingButton';
|
|
21
21
|
import { ForgotPasswordForm } from './src/components/ForgotPasswordForm';
|
|
22
|
+
import { GPSButton } from './src/components/GPSButton';
|
|
22
23
|
import { MomentOption } from './src/components/MomentOption';
|
|
23
24
|
import { OrdersOption } from './src/components/OrdersOption';
|
|
24
25
|
import { OrderDetails } from './src/components/OrderDetails';
|
|
@@ -85,6 +86,7 @@ import { VerifyPhone } from './src/components/VerifyPhone';
|
|
|
85
86
|
import { GoogleLogin } from './src/components/GoogleLogin';
|
|
86
87
|
import { PreviousOrders } from './src/components/PreviousOrders';
|
|
87
88
|
import { PaymentOptionCash } from './src/components/PaymentOptionCash';
|
|
89
|
+
import { SendGiftCard } from './src/components/GiftCard/SendGiftCard';
|
|
88
90
|
import { StripeElementsForm } from './src/components/StripeElementsForm';
|
|
89
91
|
import { StripeCardsList } from './src/components/StripeCardsList';
|
|
90
92
|
import { ProductIngredient } from './src/components/ProductIngredient';
|
|
@@ -106,6 +108,8 @@ import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from './src/components/Orde
|
|
|
106
108
|
import { FormInput, FormSide, ButtonsWrapper, LoginWith, OTab, OTabs } from './src/components/LoginForm/styles';
|
|
107
109
|
import { OSItem, OSItemContent, OSItemActions } from './src/components/PaymentOptionStripe/styles';
|
|
108
110
|
|
|
111
|
+
import { orderTypeList, getTraduction, verifyDecimals, getOrderStatus, getOrderStatuPickUp } from './src/utils'
|
|
112
|
+
|
|
109
113
|
import Alert from './src/providers/AlertProvider'
|
|
110
114
|
|
|
111
115
|
import {
|
|
@@ -182,6 +186,7 @@ export {
|
|
|
182
186
|
Checkout,
|
|
183
187
|
Favorite,
|
|
184
188
|
FavoriteList,
|
|
189
|
+
GPSButton,
|
|
185
190
|
ForgotPasswordForm,
|
|
186
191
|
MomentOption,
|
|
187
192
|
OrdersOption,
|
|
@@ -256,6 +261,7 @@ export {
|
|
|
256
261
|
ProductIngredient,
|
|
257
262
|
ProductOption,
|
|
258
263
|
ProductOptionSubOption,
|
|
264
|
+
SendGiftCard,
|
|
259
265
|
Sessions,
|
|
260
266
|
SingleProductReview,
|
|
261
267
|
LogoutButton,
|
|
@@ -343,6 +349,11 @@ export {
|
|
|
343
349
|
_setStoreData,
|
|
344
350
|
_removeStoreData,
|
|
345
351
|
_clearStoreData,
|
|
352
|
+
orderTypeList,
|
|
353
|
+
getTraduction,
|
|
354
|
+
verifyDecimals,
|
|
355
|
+
getOrderStatus,
|
|
356
|
+
getOrderStatuPickUp,
|
|
346
357
|
|
|
347
358
|
// Date Picker
|
|
348
359
|
DatePickerUI
|