ordering-ui-react-native 0.15.90 → 0.15.93

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.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/src/components/Checkout/index.tsx +23 -2
  3. package/src/components/SingleProductCard/index.tsx +16 -4
  4. package/themes/business/src/components/Chat/index.tsx +38 -86
  5. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  6. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  7. package/themes/business/src/components/NewOrderNotification/index.tsx +24 -13
  8. package/themes/business/src/components/OrderDetails/Delivery.tsx +11 -3
  9. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -0
  10. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  11. package/themes/business/src/types/index.tsx +3 -0
  12. package/themes/kiosk/src/components/BusinessMenu/index.tsx +23 -25
  13. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  14. package/themes/kiosk/src/components/Cart/index.tsx +10 -11
  15. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +36 -30
  16. package/themes/kiosk/src/components/Checkout/index.tsx +22 -19
  17. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +1 -1
  18. package/themes/kiosk/src/components/PaymentOptions/index.tsx +54 -52
  19. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  20. package/themes/original/src/components/AppleLogin/index.tsx +2 -4
  21. package/themes/original/src/components/BusinessListingSearch/index.tsx +117 -7
  22. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  23. package/themes/original/src/components/BusinessesListing/index.tsx +3 -1
  24. package/themes/original/src/components/Checkout/index.tsx +36 -28
  25. package/themes/original/src/components/DriverTips/index.tsx +6 -6
  26. package/themes/original/src/components/Help/index.tsx +21 -4
  27. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  28. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -1
  29. package/themes/original/src/components/LoginForm/index.tsx +42 -9
  30. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  31. package/themes/original/src/components/OrderDetails/index.tsx +18 -21
  32. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
  33. package/themes/original/src/components/ProductForm/index.tsx +48 -40
  34. package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
  35. package/themes/original/src/components/Promotions/index.tsx +18 -2
  36. package/themes/original/src/types/index.tsx +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.90",
3
+ "version": "0.15.93",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -592,6 +592,19 @@ const CheckoutUI = (props: any) => {
592
592
  {t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')}
593
593
  </OText>
594
594
  )}
595
+
596
+ {options.type === 1 &&
597
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
598
+ validationFields?.fields?.checkout?.driver_tip?.required &&
599
+ (Number(cart?.driver_tip) <= 0) && (
600
+ <OText
601
+ style={{ textAlign: 'center' }}
602
+ color={theme.colors.error}
603
+ size={14}
604
+ >
605
+ {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
606
+ </OText>
607
+ )}
595
608
  </ChErrors>
596
609
  </ChSection>
597
610
  )}
@@ -602,8 +615,16 @@ const CheckoutUI = (props: any) => {
602
615
  <>
603
616
  <FloatingButton
604
617
  handleClick={() => handlePlaceOrder()}
605
- isSecondaryBtn={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal_to_calculate < cart?.minimum || paymethodSelected?.gateway === 'paypal'}
606
- disabled={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal_to_calculate < cart?.minimum || paymethodSelected?.gateway === 'paypal'}
618
+ isSecondaryBtn={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal_to_calculate < cart?.minimum || paymethodSelected?.gateway === 'paypal' ||
619
+ (options.type === 1 &&
620
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
621
+ validationFields?.fields?.checkout?.driver_tip?.required &&
622
+ (Number(cart?.driver_tip) <= 0))}
623
+ disabled={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal_to_calculate < cart?.minimum || paymethodSelected?.gateway === 'paypal' ||
624
+ (options.type === 1 &&
625
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
626
+ validationFields?.fields?.checkout?.driver_tip?.required &&
627
+ (Number(cart?.driver_tip) <= 0))}
607
628
  btnText={cart?.subtotal_to_calculate >= cart?.minimum
608
629
  ? (
609
630
  placing
@@ -10,6 +10,7 @@ import {
10
10
  import { StyleSheet } from 'react-native'
11
11
  import { OText, OIcon } from '../shared'
12
12
  import { useTheme } from 'styled-components/native'
13
+ import FastImage from 'react-native-fast-image'
13
14
 
14
15
  export const SingleProductCard = (props: SingleProductCardParams) => {
15
16
  const {
@@ -77,10 +78,21 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
77
78
  activeOpacity={1}
78
79
  onPress={() => onProductClick?.(product)}
79
80
  >
80
- <OIcon
81
- url={optimizeImage(product?.images, 'h_200,c_limit')}
82
- style={styles.productStyle}
83
- />
81
+ {product?.images ? (
82
+ <FastImage
83
+ style={styles.productStyle}
84
+ source={{
85
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
86
+ priority: FastImage.priority.normal,
87
+ }}
88
+ resizeMode={FastImage.resizeMode.cover}
89
+ />
90
+ ) : (
91
+ <OIcon
92
+ src={theme?.images?.dummies?.product}
93
+ style={styles.productStyle}
94
+ />
95
+ )}
84
96
  <CardInfo>
85
97
  <OText numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
86
98
  <OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
@@ -44,6 +44,35 @@ import { USER_TYPE } from '../../config/constants';
44
44
 
45
45
  import SignatureScreen from 'react-native-signature-canvas';
46
46
 
47
+ const ORDER_STATUS: any = {
48
+ 0: 'ORDER_STATUS_PENDING',
49
+ 1: 'ORDERS_COMPLETED',
50
+ 2: 'ORDER_REJECTED',
51
+ 3: 'ORDER_STATUS_IN_BUSINESS',
52
+ 4: 'ORDER_READY',
53
+ 5: 'ORDER_REJECTED_RESTAURANT',
54
+ 6: 'ORDER_STATUS_CANCELLEDBYDRIVER',
55
+ 7: 'ORDER_STATUS_ACCEPTEDBYRESTAURANT',
56
+ 8: 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER',
57
+ 9: 'ORDER_PICKUP_COMPLETED_BY_DRIVER',
58
+ 10: 'ORDER_PICKUP_FAILED_BY_DRIVER',
59
+ 11: 'ORDER_DELIVERY_COMPLETED_BY_DRIVER',
60
+ 12: 'ORDER_DELIVERY_FAILED_BY_DRIVER',
61
+ 13: 'PREORDER',
62
+ 14: 'ORDER_NOT_READY',
63
+ 15: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
64
+ 16: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
65
+ 17: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
66
+ 18: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
67
+ 19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
68
+ 20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
69
+ 21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
70
+ 22: 'ORDER_LOOKING_FOR_DRIVER',
71
+ 23: 'ORDER_DRIVER_ON_WAY'
72
+ }
73
+
74
+ const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
75
+
47
76
  const ChatUI = (props: MessagesParams) => {
48
77
  const {
49
78
  type,
@@ -317,71 +346,6 @@ const ChatUI = (props: MessagesParams) => {
317
346
  }
318
347
  };
319
348
 
320
- const getStatus = (status: number, attribute: any) => {
321
- const hour = Math.trunc(status / 60);
322
- const min = Math.round((status / 60 - hour) * 60);
323
-
324
- if (attribute === 'status') {
325
- switch (status) {
326
- case 0:
327
- return 'ORDER_STATUS_PENDING';
328
- case 1:
329
- return 'ORDERS_COMPLETED';
330
- case 2:
331
- return 'ORDER_REJECTED';
332
- case 3:
333
- return 'ORDER_STATUS_IN_BUSINESS';
334
- case 4:
335
- return 'ORDER_READY';
336
- case 5:
337
- return 'ORDER_REJECTED_RESTAURANT';
338
- case 6:
339
- return 'ORDER_STATUS_CANCELLEDBYDRIVER';
340
- case 7:
341
- return 'ORDER_STATUS_ACCEPTEDBYRESTAURANT';
342
- case 8:
343
- return 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER';
344
- case 9:
345
- return 'ORDER_PICKUP_COMPLETED_BY_DRIVER';
346
- case 10:
347
- return 'ORDER_PICKUP_FAILED_BY_DRIVER';
348
- case 11:
349
- return 'ORDER_DELIVERY_COMPLETED_BY_DRIVER';
350
- case 12:
351
- return 'ORDER_DELIVERY_FAILED_BY_DRIVER';
352
- case 13:
353
- return 'PREORDER';
354
- case 14:
355
- return 'ORDER_NOT_READY';
356
- case 15:
357
- return 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER';
358
- case 16:
359
- return 'ORDER_STATUS_CANCELLED_BY_CUSTOMER';
360
- case 17:
361
- return 'ORDER_NOT_PICKEDUP_BY_CUSTOMER';
362
- case 18:
363
- return 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS';
364
- case 19:
365
- return 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER';
366
- case 20:
367
- return 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS';
368
- case 21:
369
- return 'ORDER_CUSTOMER_ARRIVED_BUSINESS';
370
- case 22:
371
- return 'ORDER_LOOKING_FOR_DRIVER'
372
- case 23:
373
- return 'ORDER_DRIVER_ON_WAY'
374
- default:
375
- return ``;
376
- }
377
- }
378
-
379
- if (attribute === 'prepared_in' || attribute === 'delivered_in') {
380
- return `${hour < 10 ? '0' + hour : hour}:${min < 10 ? '0' + min : min} ${status > 60 ? 'hours' : 'minutes'
381
- }`;
382
- }
383
- };
384
-
385
349
  const onSubmit = (values: any) => {
386
350
  handleSend && handleSend();
387
351
  setImage && setImage(null);
@@ -403,28 +367,16 @@ const ChatUI = (props: MessagesParams) => {
403
367
  numberOfLines={3}
404
368
  style={{ ...styles.firstMessageText, textAlign: 'center' }}>
405
369
  {message.change?.attribute !== 'driver_id'
406
- ? `${t('ORDER', 'Order')} ${t(
407
- message.change.attribute.toUpperCase(),
408
- message.change.attribute,
409
- )} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null
410
- ? t(
411
- getStatus(
412
- parseInt(message.change.old, 10),
413
- message.change?.attribute,
414
- ),
415
- )
416
- : '0'
417
- } ${t('TO', 'to')} ${t(
418
- getStatus(
419
- parseInt(message.change.new, 10),
420
- message.change?.attribute,
421
- ),
422
- )}`
370
+ ?
371
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
372
+ `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
373
+ `${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
374
+ }`
423
375
  : message.change.new
424
- ? `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''
425
- } ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''
426
- }`
427
- : `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`}
376
+ ?
377
+ `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
378
+ :
379
+ `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`}
428
380
  </OText>
429
381
  <OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
430
382
  {parseTime(message?.created_at, { outputFormat: 'hh:mma' })}
@@ -8,6 +8,8 @@ import {
8
8
  ScrollView,
9
9
  } from 'react-native';
10
10
  import { useForm, Controller } from 'react-hook-form';
11
+ import Recaptcha from 'react-native-recaptcha-that-works'
12
+ import { TouchableOpacity } from 'react-native-gesture-handler';
11
13
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
12
14
  import {
13
15
  ToastType,
@@ -25,6 +27,7 @@ import {
25
27
  TabsContainer,
26
28
  OrSeparator,
27
29
  LineSeparator,
30
+ RecaptchaButton
28
31
  } from './styles';
29
32
  import { _setStoreData } from '../../providers/StoreUtil'
30
33
  import { OText, OButton, OInput, OIconButton, OModal } from '../shared';
@@ -47,7 +50,10 @@ const LoginFormUI = (props: LoginParams) => {
47
50
  handleCheckPhoneCode,
48
51
  setCheckPhoneCodeState,
49
52
  allowedLevels,
50
- useRootPoint
53
+ useRootPoint,
54
+ notificationState,
55
+ handleReCaptcha,
56
+ enableReCaptcha
51
57
  } = props;
52
58
 
53
59
  const [ordering, { setOrdering }] = useApi();
@@ -61,6 +67,7 @@ const LoginFormUI = (props: LoginParams) => {
61
67
  const inputRef = useRef<any>(null);
62
68
  const inputMailRef = useRef<any>(null);
63
69
 
70
+ const [projectName, setProjectName] = useState({name: '', isFocued: false});
64
71
  const [passwordSee, setPasswordSee] = useState(false);
65
72
  const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
66
73
  const [isModalVisible, setIsModalVisible] = useState(false);
@@ -84,6 +91,50 @@ const LoginFormUI = (props: LoginParams) => {
84
91
  const [submitted, setSubmitted] = useState(false);
85
92
  const [formValues, setFormValues] = useState(null);
86
93
 
94
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
95
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
96
+
97
+ const recaptchaRef = useRef<any>({});
98
+
99
+ const handleOpenRecaptcha = () => {
100
+ setRecaptchaVerified(false)
101
+ if (!recaptchaConfig?.siteKey) {
102
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
103
+ return
104
+ }
105
+ if (!recaptchaConfig?.baseUrl) {
106
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
107
+ return
108
+ }
109
+ recaptchaRef.current.open()
110
+ }
111
+
112
+ const onRecaptchaVerify = (token: any) => {
113
+ setRecaptchaVerified(true)
114
+ handleReCaptcha(token)
115
+ }
116
+
117
+ useEffect(() => {
118
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
119
+ setRecaptchaConfig({
120
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
121
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
122
+ })
123
+ }
124
+ }, [configs, enableReCaptcha])
125
+
126
+ useEffect(() => {
127
+ const projectInputInterval = setInterval(() => {
128
+ if (projectName.name && useRootPoint && projectName.isFocued) {
129
+ setOrdering({
130
+ ...ordering,
131
+ project: projectName.name
132
+ })
133
+ }
134
+ }, 1500)
135
+ return () => clearInterval(projectInputInterval);
136
+ }, [projectName])
137
+
87
138
  const getTraduction = (key: string) => {
88
139
  const keyList: any = {
89
140
  // Add the key and traduction that you need below
@@ -465,6 +516,7 @@ const LoginFormUI = (props: LoginParams) => {
465
516
  icon={theme.images.general.project}
466
517
  iconColor={theme.colors.arrowColor}
467
518
  onChange={(e: any) => {
519
+ setProjectName({name: e?.target?.value, isFocued: true})
468
520
  onChange(e?.target?.value);
469
521
  setSubmitted(false);
470
522
  }}
@@ -493,6 +545,7 @@ const LoginFormUI = (props: LoginParams) => {
493
545
  icon={theme.images.logos.emailInputIcon}
494
546
  iconColor={theme.colors.arrowColor}
495
547
  onChange={(e: any) => {
548
+ setProjectName({...projectName, isFocued: false})
496
549
  handleChangeInputEmail(e, onChange);
497
550
  }}
498
551
  selectionColor={theme.colors.primary}
@@ -590,7 +643,7 @@ const LoginFormUI = (props: LoginParams) => {
590
643
 
591
644
  {onNavigationRedirect && (
592
645
  <Pressable
593
- style={{ marginRight: 'auto', marginBottom: 35 }}
646
+ style={{ marginRight: 'auto', marginBottom: 20 }}
594
647
  onPress={() => onNavigationRedirect('Forgot')}>
595
648
  <OText style={styles.textForgot}>
596
649
  {t('FORGOT_YOUR_PASSWORD', 'Forgot your password?')}
@@ -598,6 +651,39 @@ const LoginFormUI = (props: LoginParams) => {
598
651
  </Pressable>
599
652
  )}
600
653
 
654
+ {enableReCaptcha && (
655
+ <>
656
+ <TouchableOpacity
657
+ style={{ marginBottom: 15 }}
658
+ onPress={handleOpenRecaptcha}
659
+ >
660
+ <RecaptchaButton>
661
+ {recaptchaVerified ? (
662
+ <MaterialCommunityIcons
663
+ name="checkbox-marked"
664
+ size={26}
665
+ color={theme.colors.primary}
666
+ />
667
+ ) : (
668
+ <MaterialCommunityIcons
669
+ name="checkbox-blank-outline"
670
+ size={26}
671
+ color={theme.colors.mediumGray}
672
+ />
673
+ )}
674
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
675
+ </RecaptchaButton>
676
+ </TouchableOpacity>
677
+ <Recaptcha
678
+ ref={recaptchaRef}
679
+ siteKey={recaptchaConfig?.siteKey}
680
+ baseUrl={recaptchaConfig?.baseUrl}
681
+ onVerify={onRecaptchaVerify}
682
+ onExpire={() => setRecaptchaVerified(false)}
683
+ />
684
+ </>
685
+ )}
686
+
601
687
  <OButton
602
688
  onClick={handleLogin}
603
689
  text={t('LOGIN', 'Login')}
@@ -657,6 +743,7 @@ const LoginFormUI = (props: LoginParams) => {
657
743
  export const LoginForm = (props: any) => {
658
744
  const loginProps = {
659
745
  ...props,
746
+ isRecaptchaEnable: true,
660
747
  UIComponent: LoginFormUI,
661
748
  };
662
749
 
@@ -46,3 +46,9 @@ export const LineSeparator = styled.View`
46
46
  height: 1px;
47
47
  background-color: ${(props: any) => props.theme.colors.disabled};
48
48
  `;
49
+
50
+ export const RecaptchaButton = styled.View`
51
+ flex-direction: row;
52
+ align-items: center;
53
+ margin-bottom: 10px;
54
+ `
@@ -23,7 +23,7 @@ const NewOrderNotificationUI = (props: any) => {
23
23
  const [ordering] = useApi()
24
24
  const { getCurrentLocation } = useLocation();
25
25
  const [soundTimeout, setSoundTimeout] = useState<any>(null)
26
- const [currentEvent, setCurrentEvent] = useState<any>(null)
26
+ let [currentEvent, setCurrentEvent] = useState<any>(null)
27
27
 
28
28
  const evtList: any = {
29
29
  1: {
@@ -46,6 +46,7 @@ const NewOrderNotificationUI = (props: any) => {
46
46
  const notificationSound = new Sound(theme.sounds.notification, (e) => { console.log(e) });
47
47
 
48
48
  const handlePlayNotificationSound = () => {
49
+ if (currentEvent) return
49
50
  let times = 0
50
51
  const _timeout = setInterval(function () {
51
52
  notificationSound.play(success => {
@@ -63,30 +64,40 @@ const NewOrderNotificationUI = (props: any) => {
63
64
 
64
65
  const handleCloseModal = () => {
65
66
  clearInterval(soundTimeout)
67
+ currentEvent = null
66
68
  setCurrentEvent({ evt: null })
67
69
  }
68
70
 
69
71
  const handleEventNotification = async (evtType: number, value: any) => {
70
72
  if (value?.driver) {
71
- const location = await getCurrentLocation()
72
- await fetch(`${ordering.root}/users/${user.id}/locations`, {
73
- method: 'POST',
74
- body: JSON.stringify({
75
- location: JSON.stringify({location: `{lat: ${location.latitude}, lng: ${location.longitude}}`})
76
- }),
77
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
78
- })
79
- const assignedTimeDiff = moment.utc(value?.driver?.last_order_assigned_at).local().fromNow()
80
- if (assignedTimeDiff === 'a few seconds ago' && !isBusinessApp) {
73
+ try {
74
+ const location = await getCurrentLocation()
75
+ await fetch(`${ordering.root}/users/${user.id}/locations`, {
76
+ method: 'POST',
77
+ body: JSON.stringify({
78
+ location: JSON.stringify({location: `{lat: ${location.latitude}, lng: ${location.longitude}}`})
79
+ }),
80
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
81
+ })
82
+ } catch (error) {
83
+ console.log(error)
84
+ }
85
+ const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
86
+ const assignedSecondsDiff = duration.asSeconds()
87
+ if (assignedSecondsDiff < 5 && !isBusinessApp) {
81
88
  handlePlayNotificationSound()
82
89
  clearInterval(soundTimeout)
90
+ currentEvent = { evt: 2, orderId: value?.id }
83
91
  setCurrentEvent({ evt: 2, orderId: value?.id })
84
92
  }
85
- return
86
93
  }
87
- if (evtType === 3) return
94
+ if (evtType === 3 || value.author_id === user.id) return
88
95
  handlePlayNotificationSound()
89
96
  clearInterval(soundTimeout)
97
+ currentEvent = {
98
+ evt: evtType,
99
+ orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
100
+ }
90
101
  setCurrentEvent({
91
102
  evt: evtType,
92
103
  orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
@@ -1,6 +1,6 @@
1
1
  //React & React Native
2
2
  import React, { useState, useEffect } from 'react';
3
- import { StyleSheet, View, Platform, ScrollView } from 'react-native';
3
+ import { StyleSheet, View } from 'react-native';
4
4
 
5
5
  // Thirds
6
6
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
@@ -29,7 +29,6 @@ import { NotFoundSource } from '../NotFoundSource';
29
29
  import { getOrderStatus } from '../../utils';
30
30
  import { OrderHeaderComponent } from './OrderHeaderComponent';
31
31
  import { OrderContentComponent } from './OrderContentComponent';
32
-
33
32
  //Styles
34
33
  import { OrderDetailsContainer, Pickup } from './styles';
35
34
 
@@ -52,7 +51,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
52
51
  appTitle,
53
52
  handleClickLogisticOrder,
54
53
  forceUpdate,
55
- getPermissions
54
+ getPermissions,
55
+ isGrantedPermissions
56
56
  } = props;
57
57
  const [, { showToast }] = useToast();
58
58
  const { order } = props.order
@@ -102,6 +102,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
102
102
  };
103
103
 
104
104
  const handleOpenMapView = async () => {
105
+ if (!isGrantedPermissions) {
106
+ navigation.navigate('RequestPermissions')
107
+ return
108
+ }
105
109
  const _permissions = await getPermissions()
106
110
 
107
111
  const isBlocked = _permissions.some((_permission: string) => permissions?.locationStatus?.[_permission] === 'blocked')
@@ -128,6 +132,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
128
132
  };
129
133
 
130
134
  const handleViewActionOrder = (action: string) => {
135
+ if (!isGrantedPermissions) {
136
+ navigation.navigate('RequestPermissions')
137
+ return
138
+ }
131
139
  if (openModalForMapView) {
132
140
  setOpenModalForMapView(false);
133
141
  }
@@ -77,6 +77,7 @@ export const OrderContentComponent = (props: OrderContent) => {
77
77
  })
78
78
 
79
79
  const getIncludedTaxes = () => {
80
+ if (!order?.taxes) return 0
80
81
  if (order?.taxes?.length === 0) {
81
82
  return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
82
83
  } else {
@@ -725,8 +725,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
725
725
  </ScrollView>
726
726
  </View>
727
727
  {/* </GestureRecognizer> */}
728
-
729
- <NewOrderNotification isBusinessApp={isBusinessApp} />
728
+
729
+ {isBusinessApp && (
730
+ <NewOrderNotification isBusinessApp={isBusinessApp} />
731
+ )}
732
+
730
733
  {(openSearchModal || openSLASettingModal) && (
731
734
  <OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
732
735
  <ModalContainer
@@ -20,6 +20,9 @@ export interface LoginParams {
20
20
  passwordInputIcon?: any;
21
21
  allowedLevels?: any;
22
22
  useRootPoint?: any;
23
+ notificationState?: any;
24
+ handleReCaptcha?: any;
25
+ enableReCaptcha?: any;
23
26
  }
24
27
  export interface ProfileParams {
25
28
  navigation?: any;
@@ -120,32 +120,30 @@ const BusinessMenu = (props:any): React.ReactElement => {
120
120
  }}
121
121
  >
122
122
  <Container nopadding nestedScrollEnabled>
123
- <View style={{ paddingTop: 20 }}>
124
- <NavBar
125
- title={t('MENU_V21', 'Menu')}
126
- onActionLeft={goToBack}
127
- includeOrderTypeSelector
128
- onClickTypes={handleRedirect}
129
- rightComponent={cart && (
130
- <TouchableOpacity
131
- style={{ paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center' }}
132
- onPress={onToggleCart}
123
+ <NavBar
124
+ title={t('MENU_V21', 'Menu')}
125
+ onActionLeft={goToBack}
126
+ includeOrderTypeSelector
127
+ onClickTypes={handleRedirect}
128
+ rightComponent={cart && (
129
+ <TouchableOpacity
130
+ style={{ flexDirection: 'row', alignItems: 'center' }}
131
+ onPress={onToggleCart}
132
+ >
133
+ <OText
134
+ color={theme.colors.mediumGray}
133
135
  >
134
- <OText
135
- color={theme.colors.mediumGray}
136
- >
137
- {`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
138
- </OText>
139
-
140
- <MaterialIcon
141
- name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
142
- color={theme.colors.primary}
143
- size={30}
144
- />
145
- </TouchableOpacity>
146
- )}
147
- />
148
- </View>
136
+ {`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
137
+ </OText>
138
+
139
+ <MaterialIcon
140
+ name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
141
+ color={theme.colors.primary}
142
+ size={30}
143
+ />
144
+ </TouchableOpacity>
145
+ )}
146
+ />
149
147
 
150
148
  <BusinessProductsListing
151
149
  { ...businessProductsListingProps }
@@ -1,5 +1,5 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
1
+ import React from 'react';
2
+ import { PlaceholderLine } from 'rn-placeholder';
3
3
  import { View, ScrollView, Platform } from 'react-native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
@@ -21,7 +21,6 @@ const BusinessesListingUI = (props: any) => {
21
21
  navigation,
22
22
  businessesList,
23
23
  handleBusinessClick,
24
- paginationProps,
25
24
  } = props;
26
25
 
27
26
  const theme = useTheme();