ordering-ui-react-native 0.15.27 → 0.15.28-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 +3 -2
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessController/index.tsx +8 -2
- package/src/components/BusinessTypeFilter/index.tsx +4 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -3
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/OrderDetails/index.tsx +2 -2
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeElementsForm/index.tsx +27 -48
- 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/config.json +0 -2
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +5 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- 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 +38 -86
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- 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 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +58 -51
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +5 -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/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- 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/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -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/BusinessListingSearch/index.tsx +121 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +132 -35
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +118 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +53 -60
- package/themes/original/src/components/Cart/index.tsx +21 -17
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +58 -45
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- 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 +90 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +389 -156
- package/themes/original/src/components/LoginForm/styles.tsx +7 -4
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- 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/OrderDetails/index.tsx +56 -33
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +55 -58
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +16 -14
- package/themes/original/src/components/ProductForm/index.tsx +76 -61
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- 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 +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SearchBar/index.tsx +4 -1
- 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/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- 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/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +1 -1
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +68 -6
- package/themes/original/src/utils/index.tsx +28 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -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,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
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
BusinessList as BusinessesListingController,
|
|
4
4
|
useLanguage,
|
|
5
|
-
|
|
5
|
+
useOrder
|
|
6
6
|
} from 'ordering-components/native';
|
|
7
7
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
8
8
|
import { View, ScrollView, Platform, Dimensions } from 'react-native';
|
|
@@ -24,117 +24,125 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
24
24
|
} = props;
|
|
25
25
|
|
|
26
26
|
const [, t] = useLanguage()
|
|
27
|
-
|
|
27
|
+
const [orderState] = useOrder()
|
|
28
28
|
|
|
29
29
|
const windowWidth = Dimensions.get('window').width;
|
|
30
30
|
|
|
31
31
|
useEffect(() => {
|
|
32
|
-
if (businessesList?.loading || !isLoading) return
|
|
32
|
+
if (businessesList?.loading || !isLoading) return
|
|
33
33
|
getBusinesses(true)
|
|
34
34
|
}, [isLoading])
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
justifyContent: 'space-between',
|
|
71
|
-
}}>
|
|
72
|
-
<PlaceholderLine
|
|
73
|
-
height={15}
|
|
74
|
-
width={40}
|
|
75
|
-
style={{ marginBottom: 15 }}
|
|
76
|
-
/>
|
|
77
|
-
<PlaceholderLine
|
|
78
|
-
height={15}
|
|
79
|
-
width={20}
|
|
80
|
-
style={{ marginBottom: 15 }}
|
|
81
|
-
/>
|
|
82
|
-
</View>
|
|
38
|
+
|
|
39
|
+
{businessesList.loading ? (
|
|
40
|
+
<>
|
|
41
|
+
<ScrollView
|
|
42
|
+
showsHorizontalScrollIndicator={false}
|
|
43
|
+
nestedScrollEnabled
|
|
44
|
+
horizontal
|
|
45
|
+
style={{ height: 300, paddingHorizontal: 40 }}
|
|
46
|
+
>
|
|
47
|
+
{[
|
|
48
|
+
...Array(10).keys()
|
|
49
|
+
].map((item, i) => (
|
|
50
|
+
<Placeholder
|
|
51
|
+
Animation={Fade}
|
|
52
|
+
key={i}
|
|
53
|
+
style={{
|
|
54
|
+
marginTop: 20,
|
|
55
|
+
width: windowWidth - 100,
|
|
56
|
+
paddingHorizontal: 5,
|
|
57
|
+
height: '100%'
|
|
58
|
+
}}>
|
|
59
|
+
<View style={{ width: '100%' }}>
|
|
60
|
+
<PlaceholderLine
|
|
61
|
+
height={150}
|
|
62
|
+
style={{ marginBottom: 20, borderRadius: 8 }}
|
|
63
|
+
/>
|
|
64
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
65
|
+
<View
|
|
66
|
+
style={{
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
justifyContent: 'space-between',
|
|
69
|
+
}}>
|
|
83
70
|
<PlaceholderLine
|
|
84
71
|
height={15}
|
|
85
|
-
width={
|
|
86
|
-
style={{ marginBottom:
|
|
72
|
+
width={40}
|
|
73
|
+
style={{ marginBottom: 15 }}
|
|
87
74
|
/>
|
|
88
75
|
<PlaceholderLine
|
|
89
76
|
height={15}
|
|
90
|
-
width={
|
|
91
|
-
style={{ marginBottom:
|
|
77
|
+
width={20}
|
|
78
|
+
style={{ marginBottom: 15 }}
|
|
92
79
|
/>
|
|
93
80
|
</View>
|
|
81
|
+
<PlaceholderLine
|
|
82
|
+
height={15}
|
|
83
|
+
width={30}
|
|
84
|
+
style={{ marginBottom: 10 }}
|
|
85
|
+
/>
|
|
86
|
+
<PlaceholderLine
|
|
87
|
+
height={15}
|
|
88
|
+
width={80}
|
|
89
|
+
style={{ marginBottom: 10 }}
|
|
90
|
+
/>
|
|
94
91
|
</View>
|
|
95
|
-
</
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
92
|
+
</View>
|
|
93
|
+
</Placeholder>
|
|
94
|
+
))}
|
|
95
|
+
</ScrollView>
|
|
96
|
+
</>
|
|
97
|
+
) : (
|
|
98
|
+
<>
|
|
99
|
+
{businessesList.businesses.length > 0 && (
|
|
100
|
+
<ListWrapper>
|
|
101
|
+
<OText size={16} mBottom={5} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('HIGHEST_RATED', 'Highest rated')}</OText>
|
|
102
|
+
<OText size={12}>{t('TOP_RATINGS_AND_GREAT_SERVICE', 'Top ratings and great service')}</OText>
|
|
103
|
+
<ScrollView
|
|
104
|
+
showsHorizontalScrollIndicator={false}
|
|
105
|
+
nestedScrollEnabled
|
|
106
|
+
horizontal
|
|
107
|
+
style={{ height: 300 }}
|
|
108
|
+
>
|
|
109
|
+
{
|
|
110
|
+
businessesList.businesses?.map(
|
|
111
|
+
(business: any) => (
|
|
112
|
+
<View
|
|
113
|
+
key={business.id}
|
|
114
|
+
style={{
|
|
115
|
+
width: windowWidth - 100,
|
|
116
|
+
paddingHorizontal: 5,
|
|
117
|
+
height: '100%'
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<BusinessController
|
|
121
|
+
business={business}
|
|
122
|
+
isBusinessOpen={business?.open}
|
|
123
|
+
handleCustomClick={onBusinessClick}
|
|
124
|
+
orderType={orderState?.options?.type}
|
|
125
|
+
navigation={navigation}
|
|
126
|
+
/>
|
|
127
|
+
</View>
|
|
128
|
+
)
|
|
119
129
|
)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
)}
|
|
124
|
-
</>
|
|
130
|
+
}
|
|
131
|
+
</ScrollView>
|
|
132
|
+
</ListWrapper>
|
|
125
133
|
)}
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
128
136
|
</>
|
|
129
137
|
)
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
export const HighestRatedBusinesses = (props: any) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
141
|
+
const highestRatedBusinessesProps = {
|
|
142
|
+
...props,
|
|
143
|
+
UIComponent: HighestRatedBusinessesUI,
|
|
136
144
|
initialOrderByValue: 'rating'
|
|
137
|
-
|
|
145
|
+
};
|
|
138
146
|
|
|
139
|
-
|
|
147
|
+
return <BusinessesListingController {...highestRatedBusinessesProps} />;
|
|
140
148
|
};
|
|
@@ -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,90 @@
|
|
|
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
|
+
} = props
|
|
20
|
+
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
const [, t] = useLanguage();
|
|
23
|
+
const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
|
|
24
|
+
600, willVerifyOtpState)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const handleOnSubmit = () => {
|
|
28
|
+
setAlertState({
|
|
29
|
+
open: true,
|
|
30
|
+
title: t('CODE_SENT', 'The code has been sent'),
|
|
31
|
+
})
|
|
32
|
+
resetOtpLeftTime()
|
|
33
|
+
onSubmit()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (otpLeftTime === 0) {
|
|
38
|
+
setAlertState({
|
|
39
|
+
open: true,
|
|
40
|
+
title: t('TIME_IS_UP', 'Time is up'),
|
|
41
|
+
content: t('PLEASE_RESEND_CODE', 'Please resend code again')
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
}, [otpLeftTime])
|
|
45
|
+
|
|
46
|
+
const loginStyle = StyleSheet.create({
|
|
47
|
+
underlineStyleBase: {
|
|
48
|
+
width: 45,
|
|
49
|
+
height: 60,
|
|
50
|
+
borderWidth: 1,
|
|
51
|
+
fontSize: 16
|
|
52
|
+
},
|
|
53
|
+
underlineStyleHighLighted: {
|
|
54
|
+
borderColor: theme.colors.primary,
|
|
55
|
+
color: theme.colors.primary,
|
|
56
|
+
fontSize: 16
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<OTPContainer>
|
|
63
|
+
<OText size={24}>
|
|
64
|
+
{formatSeconds(otpLeftTime)}
|
|
65
|
+
</OText>
|
|
66
|
+
<OTPInputView
|
|
67
|
+
style={{ width: '100%', height: 150 }}
|
|
68
|
+
pinCount={6}
|
|
69
|
+
codeInputFieldStyle={loginStyle.underlineStyleBase}
|
|
70
|
+
codeInputHighlightStyle={loginStyle.underlineStyleHighLighted}
|
|
71
|
+
onCodeFilled={(code: string) => handleLoginOtp(code)}
|
|
72
|
+
selectionColor={theme.colors.primary}
|
|
73
|
+
/>
|
|
74
|
+
<TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
|
|
75
|
+
<OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
|
|
76
|
+
{t('RESEND_CODE', 'Resend code')}
|
|
77
|
+
</OText>
|
|
78
|
+
</TouchableOpacity>
|
|
79
|
+
<OButton
|
|
80
|
+
onClick={() => setWillVerifyOtpState(false)}
|
|
81
|
+
bgColor={theme.colors.white}
|
|
82
|
+
borderColor={theme.colors.primary}
|
|
83
|
+
textStyle={{ color: theme.colors.primary }}
|
|
84
|
+
style={{ borderRadius: 8, width: '100%' }}
|
|
85
|
+
text={t('CANCEL', 'Cancel')}
|
|
86
|
+
/>
|
|
87
|
+
</OTPContainer>
|
|
88
|
+
</>
|
|
89
|
+
)
|
|
90
|
+
}
|