ordering-ui-react-native 0.22.71 → 0.22.72-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.
Files changed (141) hide show
  1. package/package.json +5 -7
  2. package/src/components/BusinessesListing/index.tsx +1 -1
  3. package/src/components/Checkout/index.tsx +40 -39
  4. package/src/components/VerifyPhone/styles.tsx +1 -2
  5. package/src/context/OfflineActions/index.tsx +236 -0
  6. package/src/providers/AlertProvider.tsx +3 -1
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -3
  8. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  9. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  10. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  11. package/themes/business/src/components/Chat/index.tsx +15 -3
  12. package/themes/business/src/components/DriverMap/index.tsx +44 -33
  13. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  14. package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
  15. package/themes/business/src/components/LoginForm/index.tsx +123 -98
  16. package/themes/business/src/components/LogoutButton/index.tsx +13 -4
  17. package/themes/business/src/components/MapView/RenderMarker.tsx +146 -0
  18. package/themes/business/src/components/MapView/index.tsx +68 -142
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +38 -54
  20. package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +123 -54
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
  24. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  27. package/themes/business/src/components/OrderSummary/index.tsx +271 -176
  28. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  29. package/themes/business/src/components/OrdersOption/index.tsx +219 -144
  30. package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
  31. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +20 -8
  33. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  34. package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
  35. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  36. package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
  37. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  38. package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
  39. package/themes/business/src/components/ProductItemAccordion/index.tsx +15 -16
  40. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  41. package/themes/business/src/components/StoresList/index.tsx +2 -2
  42. package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
  43. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  44. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  45. package/themes/business/src/config/currency.tsx +1010 -0
  46. package/themes/business/src/hooks/useLocation.tsx +16 -12
  47. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  48. package/themes/business/src/types/index.tsx +28 -4
  49. package/themes/business/src/utils/index.tsx +28 -3
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +223 -219
  61. package/themes/original/src/components/AddressForm/index.tsx +922 -885
  62. package/themes/original/src/components/AppleLogin/index.tsx +3 -4
  63. package/themes/original/src/components/BusinessController/index.tsx +4 -2
  64. package/themes/original/src/components/BusinessItemAccordion/index.tsx +10 -4
  65. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
  66. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
  67. package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
  68. package/themes/original/src/components/BusinessPreorder/index.tsx +30 -17
  69. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
  70. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
  71. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  72. package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -4
  73. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  74. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  75. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  76. package/themes/original/src/components/Cart/index.tsx +44 -12
  77. package/themes/original/src/components/CartContent/index.tsx +0 -2
  78. package/themes/original/src/components/Checkout/index.tsx +126 -98
  79. package/themes/original/src/components/ForgotPasswordForm/index.tsx +1 -2
  80. package/themes/original/src/components/GPSButton/index.tsx +2 -1
  81. package/themes/original/src/components/GoogleMap/index.tsx +3 -2
  82. package/themes/original/src/components/Help/functions.tsx +76 -0
  83. package/themes/original/src/components/Help/index.tsx +74 -29
  84. package/themes/original/src/components/Help/styles.tsx +4 -1
  85. package/themes/original/src/components/HelpOptions/index.tsx +53 -0
  86. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  87. package/themes/original/src/components/Home/index.tsx +36 -11
  88. package/themes/original/src/components/LastOrder/index.tsx +1 -1
  89. package/themes/original/src/components/LoginForm/index.tsx +11 -5
  90. package/themes/original/src/components/MessageListing/index.tsx +1 -1
  91. package/themes/original/src/components/Messages/index.tsx +562 -555
  92. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  93. package/themes/original/src/components/MomentOption/index.tsx +141 -61
  94. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  95. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  96. package/themes/original/src/components/MultiCheckout/index.tsx +78 -36
  97. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +2 -2
  98. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  99. package/themes/original/src/components/NavBar/index.tsx +6 -2
  100. package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
  101. package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
  102. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  103. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
  104. package/themes/original/src/components/OrderDetails/index.tsx +45 -21
  105. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  106. package/themes/original/src/components/OrderProgress/index.tsx +5 -4
  107. package/themes/original/src/components/OrderSummary/index.tsx +32 -11
  108. package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -120
  109. package/themes/original/src/components/OrdersOption/index.tsx +325 -325
  110. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
  111. package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
  112. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  113. package/themes/original/src/components/ProductForm/ActionButton.tsx +6 -10
  114. package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
  115. package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
  116. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  117. package/themes/original/src/components/SignupForm/index.tsx +40 -24
  118. package/themes/original/src/components/SingleOrderCard/index.tsx +8 -5
  119. package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
  120. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  121. package/themes/original/src/components/StripeCardsList/index.tsx +9 -4
  122. package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
  123. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  124. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +7 -2
  125. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  126. package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
  127. package/themes/original/src/components/UserVerification/index.tsx +18 -5
  128. package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
  129. package/themes/original/src/components/shared/OButton.tsx +2 -2
  130. package/themes/original/src/components/shared/OInput.tsx +97 -97
  131. package/themes/original/src/components/shared/OModal.tsx +7 -2
  132. package/themes/original/src/providers/AlertProvider.tsx +1 -1
  133. package/themes/original/src/types/index.tsx +700 -695
  134. package/themes/original/src/utils/index.tsx +50 -34
  135. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  136. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
  137. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
  138. package/themes/original/src/components/HelpGuide/index.tsx +0 -68
  139. package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
  140. package/themes/original/src/components/HelpOrder/index.tsx +0 -71
  141. package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
@@ -1,24 +1,26 @@
1
1
  import { useEffect, useState, useRef } from 'react';
2
2
  import GeoLocation from 'react-native-geolocation-service';
3
3
  import { Location } from '../types';
4
- import {useApi, useSession, useLanguage} from 'ordering-components/native'
4
+ import { useApi, useSession, useLanguage } from 'ordering-components/native'
5
5
 
6
6
  export const useLocation = () => {
7
- const [,t] = useLanguage()
7
+ const [, t] = useLanguage()
8
8
  const [ordering] = useApi()
9
- const [{token, user}] = useSession()
9
+ const [{ token, user }] = useSession()
10
10
  const [hasLocation, setHasLocation] = useState(false);
11
11
  const [initialPosition, setInitialPosition] = useState<Location>({
12
12
  longitude: 0,
13
13
  latitude: 0,
14
14
  speed: 0,
15
+ mocked: false
15
16
  });
16
17
  const [userLocation, setUserLocation] = useState<Location>({
17
18
  longitude: 0,
18
19
  latitude: 0,
19
20
  speed: 0,
21
+ mocked: false
20
22
  });
21
- const [newLocation,setNewLocation] = useState<any>({ loading: false, error: null, newLocation: null })
23
+ const [newLocation, setNewLocation] = useState<any>({ loading: false, error: null, newLocation: null })
22
24
  const [routeLines, setRoutesLines] = useState<Location[]>([]);
23
25
  const isMounted = useRef(true);
24
26
 
@@ -37,7 +39,7 @@ export const useLocation = () => {
37
39
  if (!isMounted.current) return;
38
40
  setInitialPosition(location);
39
41
  setUserLocation(location);
40
- setRoutesLines(routes => [...routes, location]);
42
+ setRoutesLines((routes: any) => [...routes, location]);
41
43
  setHasLocation(true);
42
44
  })
43
45
  .catch(err => console.log(err));
@@ -46,14 +48,15 @@ export const useLocation = () => {
46
48
  const getCurrentLocation = (): Promise<Location> => {
47
49
  return new Promise((resolve, reject) => {
48
50
  GeoLocation.getCurrentPosition(
49
- ({ coords }) => {
51
+ ({ coords, mocked }: any) => {
50
52
  resolve({
51
53
  latitude: typeof coords.latitude === 'number' && !Number.isNaN(coords.latitude) ? coords.latitude : 0,
52
54
  longitude: typeof coords.longitude === 'number' && !Number.isNaN(coords.longitude) ? coords.longitude : 0,
53
55
  speed: coords.speed,
56
+ mocked
54
57
  });
55
58
  },
56
- err => reject({ err }),
59
+ (err: any) => reject({ err }),
57
60
  { enableHighAccuracy: true, timeout: 15000, maximumAge: 10000 },
58
61
  );
59
62
  });
@@ -61,18 +64,19 @@ export const useLocation = () => {
61
64
 
62
65
  const followUserLocation = () => {
63
66
  watchId.current = GeoLocation.watchPosition(
64
- ({ coords }) => {
67
+ ({ coords, mocked }: any) => {
65
68
  if (!isMounted.current) return;
66
69
  if (typeof coords.latitude !== 'number' || typeof coords.longitude !== 'number') return
67
70
  const location: Location = {
68
71
  latitude: coords.latitude || 0,
69
72
  longitude: coords.longitude || 0,
70
73
  speed: coords.speed,
74
+ mocked
71
75
  };
72
76
  setUserLocation(location);
73
- setRoutesLines(routes => [...routes, location]);
77
+ setRoutesLines((routes: any) => [...routes, location]);
74
78
  },
75
- err => console.log(err),
79
+ (err: any) => console.log(err),
76
80
  { enableHighAccuracy: true, distanceFilter: 3 },
77
81
  );
78
82
  };
@@ -83,14 +87,14 @@ export const useLocation = () => {
83
87
 
84
88
  const updateDriverPosition = async (newLocation = {}) => {
85
89
  try {
86
- setNewLocation({...newLocation, loading: true})
90
+ setNewLocation({ ...newLocation, loading: true })
87
91
  const { content: { error, result } } = await ordering.setAccessToken(token).users(user?.id).driverLocations().save(newLocation)
88
92
  if (error) {
89
93
  setNewLocation({ ...newLocation, loading: false, error: [result[0] || result || t('ERROR_UPDATING_POSITION', 'Error updating position')] })
90
94
  } else {
91
95
  setNewLocation({ ...newLocation, loading: false, newLocation: { ...newLocation, ...result } })
92
96
  }
93
- } catch (error : any) {
97
+ } catch (error: any) {
94
98
  setNewLocation({ ...newLocation, loading: false, error: [error?.message || t('NETWORK_ERROR', 'Network Error')] })
95
99
  }
96
100
  }
@@ -1,12 +1,12 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import {
3
3
  Dimensions,
4
4
  Platform,
5
5
  StatusBar,
6
- StyleSheet,
7
6
  View,
8
7
  } from 'react-native';
9
- import styled from 'styled-components/native';
8
+ import styled, { useTheme } from 'styled-components/native';
9
+ import { useNetInfo } from '@react-native-community/netinfo';
10
10
 
11
11
  export const SafeAreaContainer = styled.SafeAreaView`
12
12
  flex: 1;
@@ -14,6 +14,10 @@ export const SafeAreaContainer = styled.SafeAreaView`
14
14
  `;
15
15
 
16
16
  export const SafeAreaContainerLayout = (props: any) => {
17
+ const theme = useTheme();
18
+ const netInfo = useNetInfo()
19
+
20
+ const [statusColor, setStatusColor] = useState<string | null>(null)
17
21
  const [orientation, setOrientation] = useState(
18
22
  Dimensions.get('window').width < Dimensions.get('window').height
19
23
  ? 'Portrait'
@@ -28,22 +32,34 @@ export const SafeAreaContainerLayout = (props: any) => {
28
32
  }
29
33
  });
30
34
 
35
+ useEffect(() => {
36
+ if (netInfo.isConnected === false) {
37
+ setStatusColor(theme.colors.danger500)
38
+ }
39
+
40
+ if (netInfo.isConnected && statusColor) {
41
+ setStatusColor(theme.colors.success500)
42
+ setTimeout(() => {
43
+ setStatusColor(null)
44
+ }, 2000);
45
+ }
46
+ }, [netInfo.isConnected])
47
+
31
48
  return (
32
- <>
33
- <SafeAreaContainer>
34
- <View
35
- style={{
36
- paddingHorizontal: 30,
37
- paddingTop: 30,
38
- paddingBottom: 0,
39
- flex: 1,
40
- }}>
41
- <StatusBar
42
- barStyle={Platform.OS === 'ios' ? 'dark-content' : 'default'}
43
- />
44
- {props.children}
45
- </View>
46
- </SafeAreaContainer>
47
- </>
49
+ <SafeAreaContainer>
50
+ <View
51
+ style={{
52
+ paddingHorizontal: 30,
53
+ paddingTop: 0,
54
+ paddingBottom: 0,
55
+ flex: 1,
56
+ }}>
57
+ <StatusBar
58
+ barStyle={Platform.OS === 'ios' ? 'dark-content' : 'default'}
59
+ {...statusColor && ({ backgroundColor: statusColor })}
60
+ />
61
+ {props.children}
62
+ </View>
63
+ </SafeAreaContainer>
48
64
  );
49
65
  };
@@ -1,4 +1,5 @@
1
1
  import { TextInputProps, ViewStyle } from 'react-native';
2
+ import { LatLng } from 'react-native-maps';
2
3
  export interface LoginParams {
3
4
  navigation?: any;
4
5
  formState?: any;
@@ -29,7 +30,8 @@ export interface LoginParams {
29
30
  generateOtpCode: (values?: any) => void,
30
31
  useLoginOtpEmail?: boolean,
31
32
  useLoginOtpCellphone?: boolean,
32
- useLoginOtp?: boolean
33
+ useLoginOtp?: boolean,
34
+ validateDeveloperMode: boolean
33
35
  }
34
36
  export interface otpParams {
35
37
  willVerifyOtpState: boolean,
@@ -43,6 +45,7 @@ export interface ProfileParams {
43
45
  navigation?: any;
44
46
  isEdit?: boolean;
45
47
  formState?: any;
48
+ setRootState?: any;
46
49
  userState?: any;
47
50
  toggleIsEdit?: any;
48
51
  cleanFormState?: any;
@@ -51,6 +54,7 @@ export interface ProfileParams {
51
54
  handleChangeInput?: any;
52
55
  handleButtonUpdateClick?: any;
53
56
  handleToggleAvalaibleStatusDriver?: any;
57
+ handleRemoveAccount?: any;
54
58
  onNavigationRedirect?: any;
55
59
  handlechangeImage?: any;
56
60
  validationFields?: any;
@@ -285,8 +289,8 @@ export interface OrdersOptionParams {
285
289
  rememberOrderStatus?: any;
286
290
  titleContent?: string;
287
291
  customArray?: Array<any>;
288
- loadMoreOrders?: () => {};
289
- loadOrders?: ({ }: any) => {};
292
+ loadMoreOrders?: (options?: any) => {};
293
+ loadOrders?: ({ }: any, options?: any) => {};
290
294
  messages?: any;
291
295
  setMessages?: () => {};
292
296
  loadMessages?: () => {};
@@ -323,6 +327,9 @@ export interface OrdersOptionParams {
323
327
  orderDetailsProps?: any;
324
328
  isNetConnected?: boolean;
325
329
  isDriverApp?: boolean;
330
+ combineTabs?: boolean;
331
+ setCombineTabsState?: any;
332
+ ordersFiltered?: any
326
333
  }
327
334
  export interface ActiveOrdersParams {
328
335
  orders?: any;
@@ -413,6 +420,8 @@ export interface OrderDetailsParams {
413
420
  orderTitle?: any;
414
421
  forceUpdate?: number;
415
422
  getPermissions?: any
423
+ loadMessages?: any;
424
+ notificationApp?: string
416
425
  }
417
426
  export interface ProductItemAccordionParams {
418
427
  isCartPending?: boolean;
@@ -448,6 +457,7 @@ export interface MessagesParams {
448
457
  sendMessage?: any;
449
458
  canRead?: any;
450
459
  setCanRead?: any;
460
+ notificationApp?: string
451
461
  handleSend?: () => {};
452
462
  setImage?: (image: string | null) => {};
453
463
  setMessage?: (comment: string) => {};
@@ -498,7 +508,8 @@ export interface FloatingButtonParams {
498
508
  firstColorCustom?: string;
499
509
  secondColorCustom?: string;
500
510
  paddingBottomIos?: any;
501
- isHideRejectButtons?: boolean
511
+ isHideRejectButtons?: boolean;
512
+ principalButtonColor?: string;
502
513
  }
503
514
  export interface MomentOptionParams {
504
515
  navigation: any;
@@ -535,6 +546,7 @@ export interface Location {
535
546
  latitude: number;
536
547
  longitude: number;
537
548
  speed: number;
549
+ mocked?: boolean;
538
550
  }
539
551
 
540
552
  export interface GoogleMapsParams {
@@ -607,6 +619,7 @@ export interface MapViewParams {
607
619
  getBusinessLocations: () => void,
608
620
  setDriverLocation: (location: any) => void,
609
621
  isLoadingBusinessMarkers?: boolean,
622
+ isDeliveryApp: boolean,
610
623
  markerGroups: Array<any>,
611
624
  customerMarkerGroups: Array<any>,
612
625
  alertState: { open: boolean, content: Array<string>, key?: string | null },
@@ -642,3 +655,14 @@ export interface SessionsParams {
642
655
  handleDeleteSession: any,
643
656
  handleDeleteAllSessions: any
644
657
  }
658
+
659
+ export interface RenderMarkerParams {
660
+ key?: number,
661
+ marker: any,
662
+ customer?: boolean,
663
+ orderIds?: Array<number>
664
+ onNavigationRedirect?: any,
665
+ initialPosition?: LatLng,
666
+ locationSelected?: LatLng,
667
+ setLocationSelected ?: any
668
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import FontAwesome from 'react-native-vector-icons/FontAwesome';
3
3
  import { CODES } from 'ordering-components/native';
4
+ import { CURRENCY } from '../config/currency'
4
5
 
5
6
  export const flatArray = (arr: any) => [].concat(...arr);
6
7
 
@@ -39,7 +40,8 @@ export const getTraduction = (key: string, t: any) => {
39
40
  ERROR_USER_UPDATE_YOU_HAVE_ASSIGNED_ORDERS:
40
41
  "You can't because you have assigned orders",
41
42
  ERROR_INVALID_OFFER: 'The offer doesn\'t exist',
42
- ERROR_AUTH_DRIVER_LOGIN_VALIDATION: 'Error auth driver login validation'
43
+ ERROR_AUTH_DRIVER_LOGIN_VALIDATION: 'Error auth driver login validation',
44
+ ERROR_DRIVER_UPDATE_SCHEDULE: 'Error driver update schedule',
43
45
  };
44
46
 
45
47
  return keyList[key] ? t(key, keyList[key]) : t(key);
@@ -157,11 +159,11 @@ export const findExitingCode = (countryCode: string) => {
157
159
  * @param {*} parser function fallback when is decimal
158
160
  * @returns string
159
161
  */
160
- export const verifyDecimals = (value: number, parser: any) => {
162
+ export const verifyDecimals = (value: number, parser: any, options?: any) => {
161
163
  if (value % 1 === 0) {
162
164
  return value;
163
165
  } else {
164
- return parser(value);
166
+ return options ? parser(value, options) : parser(value);
165
167
  }
166
168
  };
167
169
 
@@ -343,6 +345,24 @@ export const getOrderStatus = (s: string, t: any) => {
343
345
  value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
344
346
  slug: 'ORDER_DRIVER_ON_WAY',
345
347
  percentage: 45
348
+ },
349
+ {
350
+ key: 24,
351
+ value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
352
+ slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
353
+ percentage: 25
354
+ },
355
+ {
356
+ key: 25,
357
+ value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
358
+ slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
359
+ percentage: 25
360
+ },
361
+ {
362
+ key: 26,
363
+ value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
364
+ slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
365
+ percentage: 80
346
366
  }
347
367
  ];
348
368
 
@@ -401,3 +421,8 @@ export const calculateDistance = (
401
421
  const distanceInKm = distance / 1000;
402
422
  return distanceInKm;
403
423
  };
424
+
425
+ export const getCurrenySymbol = (code : string) => {
426
+ return CURRENCY?.[code]?.symbol ?? code
427
+ }
428
+
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
197
197
  {isFarAway && (
198
198
  <FarAwayMessage style={styles.farAwayMsg}>
199
199
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
200
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
200
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
201
201
  </FarAwayMessage>
202
202
  )}
203
203
  {!auth && (
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
410
410
  textInputProps={{
411
411
  returnKeyType: 'next',
412
412
  onSubmitEditing: () => inputRef?.current?.focus?.(),
413
- style: { borderWidth: 0, fontSize: 12 },
414
- maxLength: 10
413
+ style: { borderWidth: 0, fontSize: 12 }
415
414
  }}
416
415
  textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
417
416
  />
@@ -155,7 +155,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
155
155
  {isFarAway && (
156
156
  <FarAwayMessage style={styles.farAwayMsg}>
157
157
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
158
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
158
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
159
159
  </FarAwayMessage>
160
160
  )}
161
161
  <View style={styles.wrapperOrderOptions}>
@@ -31,8 +31,7 @@ const CheckoutUI = (props: any) => {
31
31
  paymethodSelected,
32
32
  handlePaymethodChange,
33
33
  handlerClickPlaceOrder,
34
- onNavigationRedirect,
35
- isKiosk
34
+ onNavigationRedirect
36
35
  } = props
37
36
 
38
37
  const [errorCash, setErrorCash] = useState(false);
@@ -51,6 +50,12 @@ const CheckoutUI = (props: any) => {
51
50
  }
52
51
  }, [cart])
53
52
 
53
+ useEffect(() => {
54
+ if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
55
+ navigation?.canGoBack() && navigation.goBack()
56
+ }
57
+ }, [cart])
58
+
54
59
  return (
55
60
  <>
56
61
  <PaymentOptions
@@ -69,7 +74,6 @@ const CheckoutUI = (props: any) => {
69
74
  isLoading={cartState.loading || businessDetails.loading}
70
75
  paymethods={businessDetails?.business?.paymethods}
71
76
  setErrorCash={setErrorCash}
72
- isKiosk={isKiosk}
73
77
  />
74
78
  </>
75
79
  )
@@ -86,7 +90,7 @@ export const Checkout = (props: any) => {
86
90
  const [, { showToast }] = useToast();
87
91
  const [{ token }] = useSession();
88
92
  const [ordering] = useApi();
89
- const [, { confirmCart }] = useOrder();
93
+ const [,{ confirmCart }] = useOrder();
90
94
 
91
95
  const [cartState, setCartState] = useState<any>({ loading: true, error: [], cart: null });
92
96
 
@@ -111,7 +115,7 @@ export const Checkout = (props: any) => {
111
115
  const confirmCartRes = await confirmCart(cartUuid)
112
116
  if (confirmCartRes.error) {
113
117
  showToast(ToastType.Error, confirmCartRes.error.message)
114
- } getOrder
118
+ }getOrder
115
119
  getOrder
116
120
  if (confirmCartRes.result.order?.uuid) {
117
121
  onNavigationRedirect('OrderDetails', { orderId: confirmCartRes.result.order.uuid, isFromCheckout: true })
@@ -81,7 +81,7 @@ const CustomerName = (props: Props): React.ReactElement => {
81
81
  <OButton
82
82
  text={t('SKIP', 'Skip')}
83
83
  onClick={onSkip}
84
- textStyle={{ color: theme.colors.primary, fontSize: 18 }}
84
+ textStyle={{ color: theme.colors.primary, fontSize: 20 }}
85
85
  parentStyle={{
86
86
  height: orientationState?.orientation === PORTRAIT
87
87
  ? 50 : 100
@@ -4,6 +4,7 @@ import { OIcon, OButton, OText } from '../shared'
4
4
  import { ImageStyle, TextStyle, View, Platform, TouchableOpacity } from 'react-native'
5
5
  import { useConfig, useLanguage, useOrder } from 'ordering-components/native'
6
6
  import { useTheme } from 'styled-components/native'
7
+
7
8
  const Wrapper = styled.View`
8
9
  background-color: ${(props: any) => props.theme.colors.white};
9
10
  padding: 10px 0px 20px 0px;
@@ -65,28 +66,27 @@ const NavBar = (props: Props) => {
65
66
 
66
67
  return (
67
68
  <Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
68
- {(props?.onActionLeft) && (
69
+ {(props?.onActionLeft || props?.leftImg) && (
69
70
  <OButton
70
- imgLeftSrc={props.leftImg}
71
+ imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
71
72
  imgRightSrc={null}
72
73
  style={{ ...btnBackArrow, ...props.btnStyle }}
73
74
  onClick={props.onActionLeft}
74
- imgLeftStyle={props.imgLeftStyle}
75
- {...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
75
+ imgLeftStyle= {props.imgLeftStyle}
76
76
  />)
77
77
  }
78
78
  <TitleTopWrapper>
79
79
  {props.withIcon
80
80
  ? (
81
- <OIcon
82
- url={props.icon}
83
- style={{
84
- borderColor: theme.colors.lightGray,
85
- borderRadius: 20,
86
- }}
87
- width={60}
88
- height={60}
89
- />
81
+ <OIcon
82
+ url={props.icon}
83
+ style={{
84
+ borderColor: theme.colors.lightGray,
85
+ borderRadius: 20,
86
+ }}
87
+ width={60}
88
+ height={60}
89
+ />
90
90
  )
91
91
  : null
92
92
  }
@@ -134,7 +134,7 @@ const NavBar = (props: Props) => {
134
134
  </View>
135
135
  )}
136
136
 
137
- {props.rightComponent}
137
+ { props.rightComponent }
138
138
  </Wrapper>
139
139
  )
140
140
  }
@@ -95,7 +95,7 @@ interface Props {
95
95
  style?: ViewStyle;
96
96
  bgImage: ImageSourcePropType;
97
97
  innerStyle?: ViewStyle;
98
- icon?: ImageSourcePropType;
98
+ icon: ImageSourcePropType;
99
99
  iconStyle?: ImageStyle;
100
100
  callToActionText: string;
101
101
  callToActionTextStyle?: TextStyle;
@@ -15,8 +15,6 @@ import { Container } from '../../layouts/Container'
15
15
  import NavBar from '../NavBar'
16
16
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
17
17
  import GridContainer from '../../layouts/GridContainer'
18
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
19
- import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
20
18
 
21
19
  const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
22
20
  const {
@@ -29,7 +27,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
29
27
  callback
30
28
  } = props
31
29
 
32
- const theme = useTheme();
30
+ const theme = useTheme();
33
31
  const [, t] = useLanguage();
34
32
  const [orientationState] = useDeviceOrientation();
35
33
  const [orderState] = useOrder()
@@ -47,7 +45,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
47
45
  }
48
46
 
49
47
  useEffect(() => {
50
- if (isCardCliked) {
48
+ if(isCardCliked){
51
49
  callback?.()
52
50
  setIsCardClicked(false)
53
51
  setIsLoadingCard(null)
@@ -85,13 +83,13 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
85
83
  style={cardStyle}
86
84
  isDisabled={isCardCliked}
87
85
  isLoading={isLoadingCard === 'Eat In'}
88
- title={t('EAT_IN', 'Eat In')}
86
+ title={t('EAT_IN','Eat In')}
89
87
  description={t('EAT_IN_DESCRIPTION', 'We are very glad to have you here. Bon appetit!')}
90
88
  bgImage={theme.images.general.eatIn}
91
- VectorIcon={() => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />}
89
+ icon={theme.images.general.pushPin}
92
90
  callToActionText={t('START_MY_ORDER', 'Start my order')}
93
91
  onClick={() => {
94
- if (_eatIn?.value !== orderState?.options?.type) {
92
+ if(_eatIn?.value !== orderState?.options?.type){
95
93
  handleChangeOrderType(_eatIn?.value);
96
94
  setIsCardClicked(true)
97
95
  setIsLoadingCard('Eat In')
@@ -108,15 +106,15 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
108
106
 
109
107
  <OptionCard
110
108
  style={cardStyle}
111
- title={t('TAKE_OUT', 'Take out')}
109
+ title={t('TAKE_OUT','Take out')}
112
110
  isDisabled={isCardCliked}
113
111
  isLoading={isLoadingCard === 'Take out'}
114
112
  description={t('TAKE_OUT_DESCRIPTION', 'You are very welcome anytime you visit us!')}
115
113
  bgImage={theme.images.general.takeOut}
116
- VectorIcon={() => <AntDesignIcon name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />}
114
+ icon={theme.images.general.shoppingCart}
117
115
  callToActionText={t('START_MY_ORDER', 'Start my order')}
118
116
  onClick={() => {
119
- if (_takeOut?.value !== orderState?.options?.type) {
117
+ if(_takeOut?.value !== orderState?.options?.type){
120
118
  handleChangeOrderType(_takeOut?.value);
121
119
  setIsCardClicked(true)
122
120
  setIsLoadingCard('Take out')