ordering-ui-react-native 0.15.3 → 0.15.5-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 +7 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +66 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +25 -4
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- 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/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +27 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- 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 +70 -116
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- 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/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- 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/CategoriesMenu/index.tsx +7 -5
- 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/LanguageSelector/index.tsx +12 -8
- 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 +2 -2
- 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 +172 -124
- 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/components/shared/OCard.tsx +112 -78
- package/themes/original/index.tsx +179 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +28 -2
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +100 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +32 -21
- package/themes/original/src/components/BusinessListingSearch/index.tsx +7 -3
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +23 -30
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessesListing/index.tsx +40 -53
- package/themes/original/src/components/Cart/index.tsx +40 -9
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +58 -33
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- 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/LoginForm/index.tsx +156 -70
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +52 -45
- 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 +104 -126
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- 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 +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +15 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +157 -108
- package/themes/original/src/components/ProductForm/styles.tsx +5 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +6 -1
- 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/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +17 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +16 -16
- package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
- 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/shared/HeaderTitle.tsx +21 -0
- 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 +63 -23
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- 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
|
@@ -4,6 +4,7 @@ import Spinner from 'react-native-loading-spinner-overlay';
|
|
|
4
4
|
import { useForm, Controller } from 'react-hook-form';
|
|
5
5
|
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
6
6
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
7
|
+
import Recaptcha from 'react-native-recaptcha-that-works'
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
LoginForm as LoginFormController,
|
|
@@ -18,7 +19,6 @@ import { FacebookLogin } from '../FacebookLogin';
|
|
|
18
19
|
import { VerifyPhone } from '../../../../../src/components/VerifyPhone';
|
|
19
20
|
import { OModal } from '../../../../../src/components/shared';
|
|
20
21
|
|
|
21
|
-
|
|
22
22
|
import {
|
|
23
23
|
Container,
|
|
24
24
|
ButtonsWrapper,
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
LineSeparator,
|
|
33
33
|
SkeletonWrapper,
|
|
34
34
|
TabBtn,
|
|
35
|
+
RecaptchaButton
|
|
35
36
|
} from './styles';
|
|
36
37
|
|
|
37
38
|
import NavBar from '../NavBar';
|
|
@@ -60,14 +61,16 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
60
61
|
handleSendVerifyCode,
|
|
61
62
|
handleCheckPhoneCode,
|
|
62
63
|
onNavigationRedirect,
|
|
63
|
-
notificationState
|
|
64
|
+
notificationState,
|
|
65
|
+
handleReCaptcha,
|
|
66
|
+
enableReCaptcha
|
|
64
67
|
} = props;
|
|
65
68
|
|
|
66
69
|
const [, { showToast }] = useToast();
|
|
67
70
|
const [, t] = useLanguage();
|
|
68
71
|
const [{ configs }] = useConfig();
|
|
69
72
|
const [, { login }] = useSession();
|
|
70
|
-
const { control, handleSubmit, errors } = useForm();
|
|
73
|
+
const { control, handleSubmit, errors, reset, register, setValue } = useForm();
|
|
71
74
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
72
75
|
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
73
76
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
@@ -79,6 +82,8 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
79
82
|
cellphone: null,
|
|
80
83
|
},
|
|
81
84
|
});
|
|
85
|
+
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
86
|
+
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
82
87
|
|
|
83
88
|
const theme = useTheme();
|
|
84
89
|
|
|
@@ -91,7 +96,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
91
96
|
inputStyle: {
|
|
92
97
|
marginBottom: 28,
|
|
93
98
|
borderWidth: 1,
|
|
94
|
-
borderColor: theme.colors.border,
|
|
99
|
+
// borderColor: theme.colors.border,
|
|
95
100
|
borderRadius: 7.6,
|
|
96
101
|
},
|
|
97
102
|
line: {
|
|
@@ -100,10 +105,15 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
100
105
|
flexGrow: 1,
|
|
101
106
|
marginBottom: 7,
|
|
102
107
|
},
|
|
108
|
+
recaptchaIcon: {
|
|
109
|
+
width: 100,
|
|
110
|
+
height: 100,
|
|
111
|
+
}
|
|
103
112
|
});
|
|
104
113
|
|
|
105
114
|
const emailRef = useRef<any>({});
|
|
106
115
|
const passwordRef = useRef<any>({});
|
|
116
|
+
const recaptchaRef = useRef<any>({});
|
|
107
117
|
|
|
108
118
|
const handleChangeTab = (val: string) => {
|
|
109
119
|
props.handleChangeTab(val);
|
|
@@ -156,6 +166,33 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
156
166
|
onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
|
|
157
167
|
};
|
|
158
168
|
|
|
169
|
+
const handleOpenRecaptcha = () => {
|
|
170
|
+
setRecaptchaVerified(false)
|
|
171
|
+
if (!recaptchaConfig?.siteKey) {
|
|
172
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
if (!recaptchaConfig?.baseUrl) {
|
|
176
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
recaptchaRef.current.open()
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const onRecaptchaVerify = (token: any) => {
|
|
183
|
+
setRecaptchaVerified(true)
|
|
184
|
+
handleReCaptcha(token)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
|
|
189
|
+
setRecaptchaConfig({
|
|
190
|
+
siteKey: configs?.security_recaptcha_site_key?.value || null,
|
|
191
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
}, [configs, enableReCaptcha])
|
|
195
|
+
|
|
159
196
|
useEffect(() => {
|
|
160
197
|
if (!formState.loading && formState.result?.error) {
|
|
161
198
|
formState.result?.result &&
|
|
@@ -189,33 +226,21 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
189
226
|
}, [verifyPhoneState]);
|
|
190
227
|
|
|
191
228
|
useEffect(() => {
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
208
|
-
'The field Mobile phone is required.',
|
|
209
|
-
),
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
list.map((item: any, i: number) => {
|
|
213
|
-
stringError +=
|
|
214
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
215
|
-
});
|
|
216
|
-
showToast(ToastType.Error, stringError);
|
|
217
|
-
}
|
|
218
|
-
}, [errors]);
|
|
229
|
+
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
230
|
+
else setValue('cellphone', '')
|
|
231
|
+
}, [phoneInputData?.phone?.cellphone])
|
|
232
|
+
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
register('cellphone', {
|
|
235
|
+
required: loginTab === 'cellphone'
|
|
236
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
237
|
+
: null
|
|
238
|
+
})
|
|
239
|
+
}, [register])
|
|
240
|
+
|
|
241
|
+
useEffect(() => {
|
|
242
|
+
reset()
|
|
243
|
+
}, [loginTab])
|
|
219
244
|
|
|
220
245
|
return (
|
|
221
246
|
<Container>
|
|
@@ -284,43 +309,58 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
284
309
|
{(useLoginByCellphone || useLoginByEmail) && (
|
|
285
310
|
<FormInput>
|
|
286
311
|
{useLoginByEmail && loginTab === 'email' && (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
handleChangeInputEmail(e, onChange);
|
|
296
|
-
}}
|
|
297
|
-
value={value}
|
|
298
|
-
autoCapitalize="none"
|
|
299
|
-
autoCorrect={false}
|
|
300
|
-
type="email-address"
|
|
301
|
-
autoCompleteType="email"
|
|
302
|
-
returnKeyType="next"
|
|
303
|
-
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
304
|
-
blurOnSubmit={false}
|
|
305
|
-
forwardRef={emailRef}
|
|
306
|
-
/>
|
|
312
|
+
<>
|
|
313
|
+
{errors?.email && (
|
|
314
|
+
<OText
|
|
315
|
+
size={14}
|
|
316
|
+
color={theme.colors.danger5}
|
|
317
|
+
weight={'normal'}>
|
|
318
|
+
{errors?.email?.message}{errors?.email?.type === 'required' && '*'}
|
|
319
|
+
</OText>
|
|
307
320
|
)}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
<Controller
|
|
322
|
+
control={control}
|
|
323
|
+
render={({ onChange, value }: any) => (
|
|
324
|
+
<OInput
|
|
325
|
+
placeholder={t('EMAIL', 'Email')}
|
|
326
|
+
style={loginStyle.inputStyle}
|
|
327
|
+
icon={theme.images.general.email}
|
|
328
|
+
onChange={(e: any) => {
|
|
329
|
+
handleChangeInputEmail(e, onChange);
|
|
330
|
+
}}
|
|
331
|
+
value={value}
|
|
332
|
+
autoCapitalize="none"
|
|
333
|
+
autoCorrect={false}
|
|
334
|
+
type="email-address"
|
|
335
|
+
autoCompleteType="email"
|
|
336
|
+
returnKeyType="next"
|
|
337
|
+
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
338
|
+
blurOnSubmit={false}
|
|
339
|
+
forwardRef={emailRef}
|
|
340
|
+
borderColor={errors?.email ? theme.colors.danger5 : theme.colors.border}
|
|
341
|
+
/>
|
|
342
|
+
)}
|
|
343
|
+
name="email"
|
|
344
|
+
rules={{
|
|
345
|
+
required: {
|
|
346
|
+
value: true,
|
|
347
|
+
message: t(
|
|
348
|
+
'VALIDATION_ERROR_EMAIL_REQUIRED',
|
|
349
|
+
'The field Email is required',
|
|
350
|
+
).replace('_attribute_', t('EMAIL', 'Email'))
|
|
351
|
+
},
|
|
352
|
+
pattern: {
|
|
353
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
354
|
+
message: t(
|
|
355
|
+
'INVALID_ERROR_EMAIL',
|
|
356
|
+
'Invalid email address',
|
|
357
|
+
).replace('_attribute_', t('EMAIL', 'Email')),
|
|
358
|
+
}
|
|
359
|
+
}}
|
|
360
|
+
defaultValue=""
|
|
361
|
+
/>
|
|
362
|
+
</>
|
|
363
|
+
|
|
324
364
|
)}
|
|
325
365
|
{useLoginByCellphone && loginTab === 'cellphone' && (
|
|
326
366
|
<View style={{ marginBottom: 28 }}>
|
|
@@ -331,10 +371,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
331
371
|
returnKeyType: 'next',
|
|
332
372
|
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
333
373
|
}}
|
|
374
|
+
isStartValidation={errors?.cellphone}
|
|
334
375
|
/>
|
|
335
376
|
</View>
|
|
336
377
|
)}
|
|
337
|
-
|
|
378
|
+
{errors?.password && (
|
|
379
|
+
<OText
|
|
380
|
+
size={14}
|
|
381
|
+
color={theme.colors.danger5}
|
|
382
|
+
weight={'normal'}>
|
|
383
|
+
{errors?.password?.message}{errors?.password?.type === 'required' && '*'}
|
|
384
|
+
</OText>
|
|
385
|
+
)}
|
|
338
386
|
<Controller
|
|
339
387
|
control={control}
|
|
340
388
|
render={({ onChange, value }: any) => (
|
|
@@ -366,14 +414,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
366
414
|
returnKeyType="done"
|
|
367
415
|
onSubmitEditing={handleSubmit(onSubmit)}
|
|
368
416
|
blurOnSubmit
|
|
417
|
+
borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
|
|
369
418
|
/>
|
|
370
419
|
)}
|
|
371
420
|
name="password"
|
|
372
421
|
rules={{
|
|
373
|
-
required:
|
|
422
|
+
required: {
|
|
423
|
+
value: true,
|
|
424
|
+
message: t(
|
|
374
425
|
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
375
426
|
'The field Password is required',
|
|
376
|
-
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
427
|
+
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
428
|
+
}
|
|
377
429
|
}}
|
|
378
430
|
defaultValue=""
|
|
379
431
|
/>
|
|
@@ -384,6 +436,39 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
384
436
|
</OText>
|
|
385
437
|
</TouchableOpacity>
|
|
386
438
|
)}
|
|
439
|
+
|
|
440
|
+
{enableReCaptcha && (
|
|
441
|
+
<>
|
|
442
|
+
<TouchableOpacity
|
|
443
|
+
onPress={handleOpenRecaptcha}
|
|
444
|
+
>
|
|
445
|
+
<RecaptchaButton>
|
|
446
|
+
{recaptchaVerified ? (
|
|
447
|
+
<MaterialCommunityIcons
|
|
448
|
+
name="checkbox-marked"
|
|
449
|
+
size={26}
|
|
450
|
+
color={theme.colors.primary}
|
|
451
|
+
/>
|
|
452
|
+
) : (
|
|
453
|
+
<MaterialCommunityIcons
|
|
454
|
+
name="checkbox-blank-outline"
|
|
455
|
+
size={26}
|
|
456
|
+
color={theme.colors.mediumGray}
|
|
457
|
+
/>
|
|
458
|
+
)}
|
|
459
|
+
<OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
|
|
460
|
+
</RecaptchaButton>
|
|
461
|
+
</TouchableOpacity>
|
|
462
|
+
<Recaptcha
|
|
463
|
+
ref={recaptchaRef}
|
|
464
|
+
siteKey={recaptchaConfig?.siteKey}
|
|
465
|
+
baseUrl={recaptchaConfig?.baseUrl}
|
|
466
|
+
onVerify={onRecaptchaVerify}
|
|
467
|
+
onExpire={() => setRecaptchaVerified(false)}
|
|
468
|
+
/>
|
|
469
|
+
</>
|
|
470
|
+
)}
|
|
471
|
+
|
|
387
472
|
<OButton
|
|
388
473
|
onClick={handleSubmit(onSubmit)}
|
|
389
474
|
text={loginButtonText}
|
|
@@ -544,6 +629,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
544
629
|
export const LoginForm = (props: any) => {
|
|
545
630
|
const loginProps = {
|
|
546
631
|
...props,
|
|
632
|
+
isRecaptchaEnable: true,
|
|
547
633
|
UIComponent: LoginFormUI,
|
|
548
634
|
};
|
|
549
635
|
return <LoginFormController {...loginProps} />;
|
|
@@ -36,7 +36,7 @@ export const LoginWith = styled.View`
|
|
|
36
36
|
width: 100%;
|
|
37
37
|
align-items: flex-start;
|
|
38
38
|
border-bottom-width: 1px;
|
|
39
|
-
border-bottom-color: ${(props: any) => props.theme.colors.border}
|
|
39
|
+
border-bottom-color: ${(props: any) => props.theme.colors.border};
|
|
40
40
|
`;
|
|
41
41
|
|
|
42
42
|
export const FormInput = styled.View`
|
|
@@ -80,3 +80,8 @@ export const LineSeparator = styled.View`
|
|
|
80
80
|
export const SkeletonWrapper = styled.View`
|
|
81
81
|
width: 90%;
|
|
82
82
|
`
|
|
83
|
+
export const RecaptchaButton = styled.View`
|
|
84
|
+
flex-direction: row;
|
|
85
|
+
align-items: center;
|
|
86
|
+
margin-bottom: 10px;
|
|
87
|
+
`
|
|
@@ -35,6 +35,8 @@ const ORDER_STATUS: any = {
|
|
|
35
35
|
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
36
36
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
37
37
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
38
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
39
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
const filterSpecialStatus = ['prepared_in', 'delivered_in']
|
|
@@ -95,28 +97,18 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
const handleImagePicker = () => {
|
|
98
|
-
launchImageLibrary({ mediaType: 'photo', maxHeight:
|
|
99
|
-
if (response
|
|
100
|
-
|
|
101
|
-
} else if (response
|
|
102
|
-
console.log('ImagePicker Error: ', response.errorMessage);
|
|
100
|
+
launchImageLibrary({ mediaType: 'photo', maxHeight: 2048, maxWidth: 2048, includeBase64: true }, (response: any) => {
|
|
101
|
+
if (response?.didCancel) {
|
|
102
|
+
showToast(ToastType.Error, t('IMAGE_CANCELLED', 'User cancelled image picker'));
|
|
103
|
+
} else if (response?.errorMessage) {
|
|
103
104
|
showToast(ToastType.Error, response.errorMessage);
|
|
104
105
|
} else {
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} else {
|
|
110
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
111
|
-
}
|
|
106
|
+
if (response?.assets?.length > 0) {
|
|
107
|
+
const image = response?.assets[0]
|
|
108
|
+
const url = `data:${image.type};base64,${image.base64}`
|
|
109
|
+
setImage && setImage(url);
|
|
112
110
|
} else {
|
|
113
|
-
|
|
114
|
-
const image = response?.assets[0]
|
|
115
|
-
const url = `data:${image.type};base64,${image.base64}`
|
|
116
|
-
setImage && setImage(url);
|
|
117
|
-
} else {
|
|
118
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
119
|
-
}
|
|
111
|
+
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
114
|
});
|
|
@@ -235,7 +227,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
235
227
|
{image && (
|
|
236
228
|
<TouchableOpacity
|
|
237
229
|
style={{ position: 'absolute', top: -5, right: -5, borderColor: theme.colors.backgroundDark, backgroundColor: theme.colors.white, borderRadius: 25 }}
|
|
238
|
-
onPress={
|
|
230
|
+
onPress={removeImage}
|
|
239
231
|
>
|
|
240
232
|
<MaterialCommunityIcon name='close-circle-outline' color={theme.colors.backgroundDark} size={24} />
|
|
241
233
|
</TouchableOpacity>
|
|
@@ -340,30 +332,34 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
340
332
|
)
|
|
341
333
|
)
|
|
342
334
|
|
|
343
|
-
const renderSend = (props: any) =>
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
335
|
+
const renderSend = (props: any) => {
|
|
336
|
+
const isDisabled = (sendMessage?.loading || (message === '' && !image) || messages?.loading)
|
|
337
|
+
return (
|
|
338
|
+
<Send
|
|
339
|
+
{...props}
|
|
340
|
+
disabled={isDisabled}
|
|
341
|
+
alwaysShowSend
|
|
342
|
+
containerStyle={styles.containerSend}
|
|
343
|
+
>
|
|
344
|
+
<OIconButton
|
|
345
|
+
onClick={onSubmit}
|
|
346
|
+
style={{
|
|
347
|
+
height: 44,
|
|
348
|
+
width: 44,
|
|
349
|
+
borderRadius: 7.6,
|
|
350
|
+
opacity: isDisabled ? 0.2 : 1,
|
|
351
|
+
borderColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
|
|
352
|
+
backgroundColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
|
|
353
|
+
}}
|
|
354
|
+
iconStyle={{ marginTop: 3, marginRight: 2 }}
|
|
355
|
+
icon={theme.images.general.enter}
|
|
356
|
+
iconColor={isDisabled ? '#000' : '#fff'}
|
|
357
|
+
disabled={isDisabled}
|
|
358
|
+
disabledColor={theme.colors.secondary}
|
|
359
|
+
/>
|
|
360
|
+
</Send>
|
|
361
|
+
)
|
|
362
|
+
}
|
|
367
363
|
|
|
368
364
|
const renderBubble = (props: any) => (
|
|
369
365
|
<Bubble
|
|
@@ -543,9 +539,20 @@ const styles = StyleSheet.create({
|
|
|
543
539
|
})
|
|
544
540
|
|
|
545
541
|
export const Messages = (props: MessagesParams) => {
|
|
542
|
+
const [allMessages, setAllMessages] = useState(props.messages)
|
|
543
|
+
|
|
544
|
+
useEffect(() => {
|
|
545
|
+
setAllMessages(props.messages)
|
|
546
|
+
}, [props.messages])
|
|
547
|
+
|
|
546
548
|
const MessagesProps = {
|
|
547
549
|
...props,
|
|
548
|
-
UIComponent: MessagesUI
|
|
550
|
+
UIComponent: MessagesUI,
|
|
551
|
+
messages: allMessages,
|
|
552
|
+
setMessages: (values: any) => {
|
|
553
|
+
props.setMessages && props.setMessages(values)
|
|
554
|
+
setAllMessages(values)
|
|
555
|
+
}
|
|
549
556
|
}
|
|
550
557
|
return <MessagesController {...MessagesProps} />
|
|
551
558
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
import styled, { css } from 'styled-components/native'
|
|
3
2
|
|
|
4
|
-
|
|
5
3
|
export const Wrapper = styled.View`
|
|
6
4
|
flex: 1;
|
|
7
5
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
@@ -39,4 +37,4 @@ export const MessageTypeItem = styled.View`
|
|
|
39
37
|
${({ active }: any) => active && css`
|
|
40
38
|
background-color: ${(props: any) => props.theme.colors.whiteGray};
|
|
41
39
|
`}
|
|
42
|
-
`
|
|
40
|
+
`
|
|
@@ -4,6 +4,7 @@ import CalendarStrip from 'react-native-calendar-strip'
|
|
|
4
4
|
import {
|
|
5
5
|
useLanguage,
|
|
6
6
|
useConfig,
|
|
7
|
+
useUtils,
|
|
7
8
|
useOrder,
|
|
8
9
|
MomentOption as MomentOptionController,
|
|
9
10
|
} from 'ordering-components/native';
|
|
@@ -132,6 +133,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
132
133
|
|
|
133
134
|
const [, t] = useLanguage();
|
|
134
135
|
const [{ configs }] = useConfig();
|
|
136
|
+
const [{ parseTime }] = useUtils()
|
|
135
137
|
const [orderState] = useOrder();
|
|
136
138
|
const [optionSelected, setOptionSelected] = useState({
|
|
137
139
|
isAsap: false,
|
|
@@ -143,6 +145,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
143
145
|
});
|
|
144
146
|
const { bottom } = useSafeAreaInsets();
|
|
145
147
|
|
|
148
|
+
const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
|
|
149
|
+
|
|
146
150
|
const [selectedTime, setSelectedTime] = useState(null);
|
|
147
151
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
148
152
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
@@ -338,7 +342,12 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
338
342
|
style={{
|
|
339
343
|
lineHeight: 24
|
|
340
344
|
}}
|
|
341
|
-
>{
|
|
345
|
+
>{is12hours ? (
|
|
346
|
+
time.startTime.includes('12')
|
|
347
|
+
? `${time.startTime}PM`
|
|
348
|
+
: parseTime(moment(time.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
349
|
+
) : time.startTime
|
|
350
|
+
}</OText>
|
|
342
351
|
</TimeItem>
|
|
343
352
|
</TouchableOpacity>
|
|
344
353
|
))}
|