ordering-ui-react-native 0.15.56 → 0.15.58-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 +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessTypeFilter/index.tsx +3 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeMethodForm/index.tsx +1 -2
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +42 -90
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +41 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +5 -2
- package/themes/business/src/components/PreviousOrders/index.tsx +2 -2
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +6 -1
- 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/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +11 -12
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/index.tsx +169 -4
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +7 -6
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +9 -13
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
- package/themes/original/src/components/BusinessController/index.tsx +48 -11
- package/themes/original/src/components/BusinessController/styles.tsx +27 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +119 -35
- package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
- package/themes/original/src/components/BusinessProductsListing/index.tsx +109 -21
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
- package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
- package/themes/original/src/components/Cart/index.tsx +60 -41
- package/themes/original/src/components/Checkout/index.tsx +48 -32
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +11 -11
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +135 -49
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +130 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -36
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +70 -62
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/SearchBar/index.tsx +10 -4
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +269 -130
- package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +5 -96
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +53 -6
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +192 -33
- package/themes/original/src/utils/index.tsx +85 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { useForm, Controller } from 'react-hook-form';
|
|
4
|
+
import Recaptcha from 'react-native-recaptcha-that-works'
|
|
5
|
+
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
6
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
4
7
|
|
|
5
8
|
import {
|
|
6
9
|
ForgotPasswordForm as ForgotPasswordController,
|
|
7
10
|
useLanguage,
|
|
8
11
|
useToast,
|
|
9
12
|
ToastType,
|
|
13
|
+
useConfig
|
|
10
14
|
} from 'ordering-components/native';
|
|
11
15
|
import { useTheme } from 'styled-components/native';
|
|
12
16
|
import NavBar from '../NavBar';
|
|
13
|
-
import { FormInput, FormSide } from '../LoginForm/styles'
|
|
17
|
+
import { FormInput, FormSide, RecaptchaButton } from '../LoginForm/styles'
|
|
14
18
|
import { Container } from './styles'
|
|
15
19
|
|
|
16
20
|
import { OButton, OInput, OText } from '../shared';
|
|
@@ -20,10 +24,16 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
20
24
|
navigation,
|
|
21
25
|
formState,
|
|
22
26
|
handleButtonForgotPasswordClick,
|
|
27
|
+
handleReCaptcha,
|
|
28
|
+
enableReCaptcha,
|
|
29
|
+
reCaptchaValue
|
|
23
30
|
} = props;
|
|
24
31
|
const [, t] = useLanguage();
|
|
25
32
|
const [, { showToast }] = useToast();
|
|
33
|
+
const [{ configs }] = useConfig();
|
|
26
34
|
const { control, handleSubmit, errors } = useForm();
|
|
35
|
+
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
36
|
+
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
27
37
|
|
|
28
38
|
const theme = useTheme();
|
|
29
39
|
|
|
@@ -38,6 +48,7 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
38
48
|
});
|
|
39
49
|
|
|
40
50
|
const [emailSent, setEmailSent] = useState(null);
|
|
51
|
+
const recaptchaRef = useRef<any>({});
|
|
41
52
|
|
|
42
53
|
const onSubmit = (values: any) => {
|
|
43
54
|
setEmailSent(values.email)
|
|
@@ -48,23 +59,60 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
48
59
|
onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''))
|
|
49
60
|
}
|
|
50
61
|
|
|
62
|
+
const handleOpenRecaptcha = () => {
|
|
63
|
+
setRecaptchaVerified(false)
|
|
64
|
+
handleReCaptcha(null)
|
|
65
|
+
if (reCaptchaValue) return
|
|
66
|
+
|
|
67
|
+
if (!recaptchaConfig?.siteKey) {
|
|
68
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
if (!recaptchaConfig?.baseUrl) {
|
|
72
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
recaptchaRef.current.open()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const onRecaptchaVerify = (token: any) => {
|
|
79
|
+
setRecaptchaVerified(true)
|
|
80
|
+
handleReCaptcha(token)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const handleRecaptchaExpire = () => {
|
|
84
|
+
setRecaptchaVerified(false)
|
|
85
|
+
handleReCaptcha(null)
|
|
86
|
+
}
|
|
87
|
+
|
|
51
88
|
useEffect(() => {
|
|
52
89
|
if (!formState.loading && emailSent) {
|
|
53
90
|
if (formState.result?.error) {
|
|
54
91
|
setEmailSent(null)
|
|
55
92
|
formState.result?.result && showToast(
|
|
56
93
|
ToastType.Error,
|
|
57
|
-
formState.result?.result
|
|
94
|
+
typeof formState.result?.result === 'string'
|
|
95
|
+
? formState.result?.result
|
|
96
|
+
: formState.result?.result[0]
|
|
58
97
|
)
|
|
59
98
|
return
|
|
60
99
|
}
|
|
61
100
|
showToast(
|
|
62
101
|
ToastType.Success,
|
|
63
|
-
|
|
102
|
+
t('IF_ACCOUNT_EXIST_EMAIL_SEND_PASSWORD', 'If an account exists with this email a password will be sent')
|
|
64
103
|
)
|
|
65
104
|
}
|
|
66
105
|
}, [formState])
|
|
67
106
|
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
|
|
109
|
+
setRecaptchaConfig({
|
|
110
|
+
siteKey: configs?.security_recaptcha_site_key?.value || null,
|
|
111
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
}, [configs, enableReCaptcha])
|
|
115
|
+
|
|
68
116
|
return (
|
|
69
117
|
<Container>
|
|
70
118
|
<NavBar
|
|
@@ -126,6 +174,37 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
126
174
|
}}
|
|
127
175
|
defaultValue=""
|
|
128
176
|
/>
|
|
177
|
+
{enableReCaptcha && (
|
|
178
|
+
<>
|
|
179
|
+
<TouchableOpacity
|
|
180
|
+
onPress={handleOpenRecaptcha}
|
|
181
|
+
>
|
|
182
|
+
<RecaptchaButton>
|
|
183
|
+
{recaptchaVerified ? (
|
|
184
|
+
<MaterialCommunityIcons
|
|
185
|
+
name="checkbox-marked"
|
|
186
|
+
size={26}
|
|
187
|
+
color={theme.colors.primary}
|
|
188
|
+
/>
|
|
189
|
+
) : (
|
|
190
|
+
<MaterialCommunityIcons
|
|
191
|
+
name="checkbox-blank-outline"
|
|
192
|
+
size={26}
|
|
193
|
+
color={theme.colors.mediumGray}
|
|
194
|
+
/>
|
|
195
|
+
)}
|
|
196
|
+
<OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
|
|
197
|
+
</RecaptchaButton>
|
|
198
|
+
</TouchableOpacity>
|
|
199
|
+
<Recaptcha
|
|
200
|
+
ref={recaptchaRef}
|
|
201
|
+
siteKey={recaptchaConfig?.siteKey}
|
|
202
|
+
baseUrl={recaptchaConfig?.baseUrl}
|
|
203
|
+
onVerify={onRecaptchaVerify}
|
|
204
|
+
onExpire={handleRecaptchaExpire}
|
|
205
|
+
/>
|
|
206
|
+
</>
|
|
207
|
+
)}
|
|
129
208
|
|
|
130
209
|
<OButton
|
|
131
210
|
text={emailSent && !formState.result?.error ? t('LINK_SEND_FORGOT_PASSWORD', 'Link Sent') : t('FRONT_RECOVER_PASSWORD', 'Recover Password')}
|
|
@@ -146,6 +225,7 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
146
225
|
export const ForgotPasswordForm = (props: any) => {
|
|
147
226
|
const ForgotPasswordProps = {
|
|
148
227
|
...props,
|
|
228
|
+
isRecaptchaEnable: true,
|
|
149
229
|
UIComponent: ForgotPasswordUI
|
|
150
230
|
}
|
|
151
231
|
return <ForgotPasswordController {...ForgotPasswordProps} />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
2
3
|
import Geolocation from '@react-native-community/geolocation'
|
|
3
4
|
import Geocoder from 'react-native-geocoding'
|
|
4
5
|
import { GpsButtonStyle } from './styles'
|
|
@@ -55,14 +56,20 @@ export const GPSButton = (props: any) => {
|
|
|
55
56
|
})
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
const getCurrentPosition = () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const getCurrentPosition = async () => {
|
|
60
|
+
let trackingStatus = await getTrackingStatus()
|
|
61
|
+
if (trackingStatus === 'not-determined') {
|
|
62
|
+
trackingStatus = await requestTrackingPermission()
|
|
63
|
+
}
|
|
64
|
+
if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
|
|
65
|
+
setLoading(true);
|
|
66
|
+
Geolocation.getCurrentPosition((pos) => {
|
|
67
|
+
geoCodePosition(pos.coords);
|
|
68
|
+
}, (err) => {
|
|
69
|
+
setLoading(false);
|
|
70
|
+
console.log(err);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
useEffect(() => {
|
|
@@ -32,6 +32,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
32
32
|
latitudeDelta: 0.0010,
|
|
33
33
|
longitudeDelta: 0.0010 * ASPECT_RATIO
|
|
34
34
|
})
|
|
35
|
+
const [MARKERS, SETMARKERS] = useState(locations)
|
|
35
36
|
let mapRef = useRef<any>(null)
|
|
36
37
|
const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
|
|
37
38
|
|
|
@@ -41,12 +42,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
41
42
|
ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
|
|
42
43
|
ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
latitude: location.lat,
|
|
47
|
-
longitude: location.lng
|
|
48
|
-
}
|
|
49
|
-
})
|
|
45
|
+
|
|
50
46
|
const geocodePosition = (pos: { latitude: number, longitude: number }) => {
|
|
51
47
|
Geocoder.from({
|
|
52
48
|
latitude: pos.latitude,
|
|
@@ -147,7 +143,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
147
143
|
}
|
|
148
144
|
|
|
149
145
|
const fitAllMarkers = () => {
|
|
150
|
-
mapRef.current.fitToCoordinates(MARKERS, {
|
|
146
|
+
mapRef.current.fitToCoordinates(MARKERS?.map(location => ({ latitude: location.lat, longitude: location.lng })), {
|
|
151
147
|
edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
|
|
152
148
|
animated: true,
|
|
153
149
|
});
|
|
@@ -170,6 +166,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
170
166
|
fitAllMarkers()
|
|
171
167
|
}
|
|
172
168
|
}, 1000)
|
|
169
|
+
if (locations) {
|
|
170
|
+
SETMARKERS(locations)
|
|
171
|
+
}
|
|
173
172
|
return () => clearInterval(interval)
|
|
174
173
|
}, [locations])
|
|
175
174
|
|
|
@@ -189,15 +188,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
189
188
|
>
|
|
190
189
|
{locations ? (
|
|
191
190
|
<>
|
|
192
|
-
{MARKERS && MARKERS.map((location: {
|
|
191
|
+
{MARKERS && MARKERS.map((location: { lat: number, lng: number }, i: number) => (
|
|
193
192
|
<React.Fragment key={i}>
|
|
194
193
|
{
|
|
195
194
|
<Marker
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
zIndex={i}
|
|
196
|
+
coordinate={{ latitude: location.lat ?? 0, longitude: location.lng ?? 0 }}
|
|
197
|
+
title={MARKERS[i]?.title}
|
|
198
198
|
>
|
|
199
199
|
<View>
|
|
200
|
-
<OIcon url={
|
|
200
|
+
<OIcon url={MARKERS[i].icon} width={50} height={50} />
|
|
201
201
|
</View>
|
|
202
202
|
</Marker>
|
|
203
203
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { RefreshControl } from 'react-native'
|
|
2
3
|
import { HelpParams } from '../../types'
|
|
3
4
|
import { useLanguage } from 'ordering-components/native'
|
|
4
5
|
import NavBar from '../NavBar'
|
|
5
6
|
import { OText } from '../shared'
|
|
6
7
|
import { LastOrders } from '../LastOrders'
|
|
8
|
+
import { Container } from '../../layouts/Container'
|
|
7
9
|
|
|
8
10
|
import {
|
|
9
11
|
HelpSubItem,
|
|
@@ -15,13 +17,28 @@ export const Help = (props: HelpParams) => {
|
|
|
15
17
|
navigation
|
|
16
18
|
} = props
|
|
17
19
|
const [, t] = useLanguage()
|
|
20
|
+
const [refreshing] = useState(false);
|
|
21
|
+
const [refresh, setRefresh] = useState(false)
|
|
18
22
|
|
|
19
23
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
20
24
|
const onRedirect = (route: string, params?: any) => {
|
|
21
25
|
navigation.navigate(route, params)
|
|
22
26
|
}
|
|
27
|
+
|
|
28
|
+
const handleOnRefresh = () => {
|
|
29
|
+
setRefresh(true)
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
return (
|
|
24
|
-
|
|
33
|
+
<Container
|
|
34
|
+
noPadding
|
|
35
|
+
refreshControl={
|
|
36
|
+
<RefreshControl
|
|
37
|
+
refreshing={refreshing}
|
|
38
|
+
onRefresh={() => handleOnRefresh()}
|
|
39
|
+
/>
|
|
40
|
+
}
|
|
41
|
+
>
|
|
25
42
|
<NavBar
|
|
26
43
|
title={t('HELP', 'Help')}
|
|
27
44
|
titleAlign={'center'}
|
|
@@ -48,8 +65,8 @@ export const Help = (props: HelpParams) => {
|
|
|
48
65
|
|
|
49
66
|
<LastOrdersContainer>
|
|
50
67
|
<OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
|
|
51
|
-
<LastOrders {...props} onRedirect={onRedirect} />
|
|
68
|
+
<LastOrders {...props} onRedirect={onRedirect} refresh={refresh} setRefresh={setRefresh} />
|
|
52
69
|
</LastOrdersContainer>
|
|
53
|
-
|
|
70
|
+
</Container>
|
|
54
71
|
)
|
|
55
72
|
}
|
|
@@ -20,7 +20,10 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
20
20
|
onBusinessClick,
|
|
21
21
|
navigation,
|
|
22
22
|
isLoading,
|
|
23
|
-
getBusinesses
|
|
23
|
+
getBusinesses,
|
|
24
|
+
favoriteIds,
|
|
25
|
+
setFavoriteIds,
|
|
26
|
+
handleUpdateBusinessList
|
|
24
27
|
} = props;
|
|
25
28
|
|
|
26
29
|
const [, t] = useLanguage()
|
|
@@ -33,6 +36,17 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
33
36
|
getBusinesses(true)
|
|
34
37
|
}, [isLoading])
|
|
35
38
|
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!businessesList?.businesses?.length) return
|
|
41
|
+
const ids = [...favoriteIds]
|
|
42
|
+
businessesList.businesses.forEach(business => {
|
|
43
|
+
if (business?.favorite) {
|
|
44
|
+
ids.push(business.id)
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
setFavoriteIds([...new Set(ids)])
|
|
48
|
+
}, [businessesList?.businesses?.length])
|
|
49
|
+
|
|
36
50
|
return (
|
|
37
51
|
<>
|
|
38
52
|
|
|
@@ -123,6 +137,9 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
123
137
|
handleCustomClick={onBusinessClick}
|
|
124
138
|
orderType={orderState?.options?.type}
|
|
125
139
|
navigation={navigation}
|
|
140
|
+
favoriteIds={favoriteIds}
|
|
141
|
+
setFavoriteIds={setFavoriteIds}
|
|
142
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
126
143
|
/>
|
|
127
144
|
</View>
|
|
128
145
|
)
|
|
@@ -36,7 +36,7 @@ export const Home = (props: any) => {
|
|
|
36
36
|
{t('WELCOME', 'Welcome!')}
|
|
37
37
|
</OText>
|
|
38
38
|
<OText color={theme.colors.white} size={14} style={{ marginBottom: 46 }}>
|
|
39
|
-
{t('
|
|
39
|
+
{t('SUBTITLE_HOME', "Let's start to order now")}
|
|
40
40
|
</OText>
|
|
41
41
|
<OButton
|
|
42
42
|
text={t('LOGIN_NOW', 'Login now')}
|
|
@@ -18,11 +18,15 @@ import {
|
|
|
18
18
|
OrderContainer,
|
|
19
19
|
OrderInfo
|
|
20
20
|
} from './styles'
|
|
21
|
+
import { useEffect } from 'react'
|
|
21
22
|
|
|
22
23
|
const LastOrdersUI = (props: LastOrdersParams) => {
|
|
23
24
|
const {
|
|
24
25
|
orderList,
|
|
25
|
-
onRedirect
|
|
26
|
+
onRedirect,
|
|
27
|
+
loadOrders,
|
|
28
|
+
refresh,
|
|
29
|
+
setRefresh
|
|
26
30
|
} = props
|
|
27
31
|
const { loading, error, orders } = orderList
|
|
28
32
|
|
|
@@ -46,6 +50,13 @@ const LastOrdersUI = (props: LastOrdersParams) => {
|
|
|
46
50
|
onRedirect && onRedirect('OrderDetails', { orderId: uuid })
|
|
47
51
|
}
|
|
48
52
|
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if(refresh){
|
|
55
|
+
loadOrders(false, false, false, true)
|
|
56
|
+
setRefresh && setRefresh(false)
|
|
57
|
+
}
|
|
58
|
+
}, [refresh])
|
|
59
|
+
|
|
49
60
|
return (
|
|
50
61
|
<>
|
|
51
62
|
{loading ? (
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { formatSeconds } from '../../../utils'
|
|
3
|
+
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
4
|
+
import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
|
|
5
|
+
import { useLanguage } from 'ordering-components/native';
|
|
6
|
+
import { OTPContainer } from './styles';
|
|
7
|
+
import { OText, OButton } from '../../shared';
|
|
8
|
+
import OTPInputView from '@twotalltotems/react-native-otp-input'
|
|
9
|
+
import { useTheme } from 'styled-components/native';
|
|
10
|
+
import { otpParams } from '../../../types'
|
|
11
|
+
|
|
12
|
+
export const Otp = (props: otpParams) => {
|
|
13
|
+
const {
|
|
14
|
+
willVerifyOtpState,
|
|
15
|
+
setWillVerifyOtpState,
|
|
16
|
+
onSubmit,
|
|
17
|
+
handleLoginOtp,
|
|
18
|
+
setAlertState,
|
|
19
|
+
pinCount
|
|
20
|
+
} = props
|
|
21
|
+
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const [, t] = useLanguage();
|
|
24
|
+
const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
|
|
25
|
+
600, willVerifyOtpState)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const handleOnSubmit = () => {
|
|
29
|
+
setAlertState({
|
|
30
|
+
open: true,
|
|
31
|
+
title: t('CODE_SENT', 'The code has been sent'),
|
|
32
|
+
})
|
|
33
|
+
resetOtpLeftTime()
|
|
34
|
+
onSubmit()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (otpLeftTime === 0) {
|
|
39
|
+
setAlertState({
|
|
40
|
+
open: true,
|
|
41
|
+
title: t('TIME_IS_UP', 'Time is up'),
|
|
42
|
+
content: t('PLEASE_RESEND_CODE', 'Please resend code again')
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}, [otpLeftTime])
|
|
46
|
+
|
|
47
|
+
const loginStyle = StyleSheet.create({
|
|
48
|
+
underlineStyleBase: {
|
|
49
|
+
width: 45,
|
|
50
|
+
height: 60,
|
|
51
|
+
borderWidth: 1,
|
|
52
|
+
fontSize: 16
|
|
53
|
+
},
|
|
54
|
+
underlineStyleHighLighted: {
|
|
55
|
+
borderColor: theme.colors.primary,
|
|
56
|
+
color: theme.colors.primary,
|
|
57
|
+
fontSize: 16
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
<OTPContainer>
|
|
64
|
+
<OText size={24}>
|
|
65
|
+
{formatSeconds(otpLeftTime)}
|
|
66
|
+
</OText>
|
|
67
|
+
<OTPInputView
|
|
68
|
+
style={{ width: '100%', height: 150 }}
|
|
69
|
+
pinCount={pinCount || 6}
|
|
70
|
+
codeInputFieldStyle={loginStyle.underlineStyleBase}
|
|
71
|
+
codeInputHighlightStyle={loginStyle.underlineStyleHighLighted}
|
|
72
|
+
onCodeFilled={(code: string) => handleLoginOtp(code)}
|
|
73
|
+
selectionColor={theme.colors.primary}
|
|
74
|
+
/>
|
|
75
|
+
<TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
|
|
76
|
+
<OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
|
|
77
|
+
{t('RESEND_CODE', 'Resend code')}
|
|
78
|
+
</OText>
|
|
79
|
+
</TouchableOpacity>
|
|
80
|
+
<OButton
|
|
81
|
+
onClick={() => setWillVerifyOtpState(false)}
|
|
82
|
+
bgColor={theme.colors.white}
|
|
83
|
+
borderColor={theme.colors.primary}
|
|
84
|
+
textStyle={{ color: theme.colors.primary }}
|
|
85
|
+
style={{ borderRadius: 8, width: '100%' }}
|
|
86
|
+
text={t('CANCEL', 'Cancel')}
|
|
87
|
+
/>
|
|
88
|
+
</OTPContainer>
|
|
89
|
+
</>
|
|
90
|
+
)
|
|
91
|
+
}
|