ordering-ui-react-native 0.16.39 → 0.16.40-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 (202) hide show
  1. package/package.json +7 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrdersOption/index.tsx +54 -56
  16. package/src/components/PaymentOptions/index.tsx +298 -345
  17. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  18. package/src/components/ReviewDriver/index.tsx +1 -1
  19. package/src/components/ReviewOrder/index.tsx +1 -1
  20. package/src/components/ReviewProducts/index.tsx +11 -0
  21. package/src/components/SignupForm/index.tsx +15 -0
  22. package/src/components/SingleProductReview/index.tsx +8 -5
  23. package/src/components/StripeElementsForm/index.tsx +25 -16
  24. package/src/components/VerifyPhone/styles.tsx +1 -2
  25. package/src/components/shared/OBottomPopup.tsx +6 -2
  26. package/src/index.tsx +2 -0
  27. package/src/pages/BusinessesListing.tsx +7 -6
  28. package/src/pages/OrderDetails.tsx +1 -1
  29. package/src/pages/ReviewDriver.tsx +2 -2
  30. package/src/pages/ReviewOrder.tsx +2 -2
  31. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  32. package/src/utils/index.tsx +2 -1
  33. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  34. package/themes/business/src/components/Chat/index.tsx +38 -30
  35. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  36. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  37. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  38. package/themes/business/src/components/MapView/index.tsx +12 -1
  39. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  40. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  41. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  42. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  43. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  44. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  45. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  46. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  47. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  49. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  50. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  52. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  53. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  54. package/themes/business/src/components/PreviousOrders/index.tsx +22 -24
  55. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  56. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  57. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  58. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  59. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  60. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  61. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  62. package/themes/business/src/types/index.tsx +15 -9
  63. package/themes/business/src/utils/index.tsx +10 -0
  64. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  65. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  66. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  67. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  68. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  69. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  70. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  71. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  72. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  73. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  74. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  75. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  76. package/themes/kiosk/src/types/index.d.ts +2 -0
  77. package/themes/original/index.tsx +4 -0
  78. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  79. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  80. package/themes/original/src/components/AddressList/index.tsx +1 -1
  81. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  82. package/themes/original/src/components/BusinessBasicInformation/index.tsx +260 -176
  83. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  84. package/themes/original/src/components/BusinessController/index.tsx +216 -113
  85. package/themes/original/src/components/BusinessController/styles.tsx +1 -8
  86. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  87. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  90. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  91. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  92. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -104
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  98. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  99. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +260 -109
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  104. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  105. package/themes/original/src/components/Cart/index.tsx +54 -16
  106. package/themes/original/src/components/Cart/styles.tsx +4 -0
  107. package/themes/original/src/components/CartContent/index.tsx +22 -16
  108. package/themes/original/src/components/Checkout/index.tsx +110 -116
  109. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  110. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  112. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  113. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  114. package/themes/original/src/components/FavoriteList/index.tsx +19 -0
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  119. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  120. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  121. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  122. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  123. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  124. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -73
  125. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  126. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  127. package/themes/original/src/components/Messages/index.tsx +17 -17
  128. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  129. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  130. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  132. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  133. package/themes/original/src/components/NavBar/index.tsx +15 -9
  134. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  135. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  136. package/themes/original/src/components/Notifications/index.tsx +148 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  138. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  139. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  140. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  141. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  142. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  143. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  144. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  145. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  146. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  147. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  148. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  150. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  151. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  152. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  153. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  154. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  155. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  156. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  157. package/themes/original/src/components/ProductForm/index.tsx +639 -664
  158. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  159. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  160. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  161. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  162. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  164. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  165. package/themes/original/src/components/Promotions/index.tsx +232 -219
  166. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  167. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  168. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  169. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  170. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  171. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  172. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  173. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  174. package/themes/original/src/components/SignupForm/index.tsx +184 -127
  175. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  176. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  177. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  178. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  179. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  180. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  182. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  183. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  184. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  185. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  186. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  187. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  188. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  189. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  190. package/themes/original/src/components/Wallets/index.tsx +176 -164
  191. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  192. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  193. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  194. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  195. package/themes/original/src/components/shared/OButton.tsx +10 -3
  196. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  197. package/themes/original/src/components/shared/OInput.tsx +13 -3
  198. package/themes/original/src/layouts/Container.tsx +13 -9
  199. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  200. package/themes/original/src/types/index.tsx +82 -29
  201. package/themes/original/src/utils/index.tsx +121 -10
  202. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -12,7 +12,7 @@ export const Container = styled.View`
12
12
  width: 100%;
13
13
  justify-content: space-between;
14
14
  background-color: #FFF;
15
- z-index: 1000;
15
+ z-index: 9999;
16
16
  justify-content: space-between;
17
17
  `
18
18
 
@@ -1,17 +1,16 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
3
- import Geolocation from '@react-native-community/geolocation'
4
2
  import Geocoder from 'react-native-geocoding'
5
- import { GpsButtonStyle } from './styles'
6
- import { View } from 'react-native'
7
- import { OText } from '../shared'
8
3
  import { ActivityIndicator } from 'react-native-paper'
4
+ import Geolocation from '@react-native-community/geolocation'
5
+ import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
6
+
7
+ import { OText } from '../shared'
8
+ import { GpsButtonStyle } from './styles'
9
9
 
10
10
  export const GPSButton = (props: any) => {
11
11
  const {
12
12
  handleGPS,
13
13
  apiKey,
14
- googleReady,
15
14
  IconButton,
16
15
  IconLoadingButton
17
16
  } = props
@@ -56,25 +55,27 @@ export const GPSButton = (props: any) => {
56
55
  })
57
56
  }
58
57
 
59
- const getCurrentPosition = async () => {
58
+ const getCurrentPosition = async () => {
60
59
  let trackingStatus = await getTrackingStatus()
61
- if (trackingStatus === 'not-determined') {
62
- trackingStatus = await requestTrackingPermission()
63
- }
64
- if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
65
- setLoading(true);
60
+ if (trackingStatus === 'not-determined') {
61
+ trackingStatus = await requestTrackingPermission()
62
+ }
63
+ if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
64
+ setLoading(true)
66
65
  Geolocation.getCurrentPosition((pos) => {
67
- geoCodePosition(pos.coords);
66
+ geoCodePosition(pos.coords)
68
67
  }, (err) => {
69
68
  setLoading(false);
70
- console.log(err);
71
- });
69
+ console.log(`ERROR(${err.code}): ${err.message}`)
70
+ }, {
71
+ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
72
+ })
72
73
  }
73
- }
74
+ }
74
75
 
75
- useEffect(() => {
76
- Geocoder.init(apiKey);
77
- }, [])
76
+ useEffect(() => {
77
+ Geocoder.init(apiKey);
78
+ }, [])
78
79
 
79
80
  return (
80
81
  <GpsButtonStyle
@@ -1,6 +1,6 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const GpsButtonStyle = styled.TouchableOpacity`
4
- width: 30px;
5
- height: 30px;
6
- `
4
+ width: 16px;
5
+ height: 16px;
6
+ `
@@ -32,6 +32,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
32
32
  latitudeDelta: 0.0010,
33
33
  longitudeDelta: 0.0010 * ASPECT_RATIO
34
34
  })
35
+ const [MARKERS, SETMARKERS] = useState(locations)
35
36
  let mapRef = useRef<any>(null)
36
37
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
37
38
 
@@ -41,12 +42,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
41
42
  ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
42
43
  ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
43
44
  }
44
- const MARKERS = locations && locations.map((location: { lat: number, lng: number }) => {
45
- return {
46
- latitude: location.lat,
47
- longitude: location.lng
48
- }
49
- })
45
+
50
46
  const geocodePosition = (pos: { latitude: number, longitude: number }) => {
51
47
  Geocoder.from({
52
48
  latitude: pos.latitude,
@@ -93,7 +89,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
93
89
  return
94
90
  }
95
91
 
96
- if (distance <= maxLimitLocation) {
92
+ const _maxLimitLocation = typeof maxLimitLocation === 'string' ? parseInt(maxLimitLocation, 10) : maxLimitLocation
93
+
94
+ if (distance <= _maxLimitLocation) {
97
95
  setMarkerPosition(curPos)
98
96
  setRegion({ ...region, longitude: curPos.longitude, latitude: curPos.latitude })
99
97
  } else {
@@ -147,7 +145,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
147
145
  }
148
146
 
149
147
  const fitAllMarkers = () => {
150
- mapRef.current.fitToCoordinates(MARKERS, {
148
+ mapRef.current.fitToCoordinates(MARKERS?.map(location => ({ latitude: location.lat, longitude: location.lng })), {
151
149
  edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
152
150
  animated: true,
153
151
  });
@@ -157,6 +155,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
157
155
  Geocoder.init(googleMapsApiKey)
158
156
  }, [])
159
157
 
158
+ useEffect(() => {
159
+ mapRef.current.animateToRegion({
160
+ ...region,
161
+ latitude: location?.lat,
162
+ longitude: location?.lng,
163
+ })
164
+ }, [location])
160
165
 
161
166
  useEffect(() => {
162
167
  if (saveLocation) {
@@ -170,6 +175,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
170
175
  fitAllMarkers()
171
176
  }
172
177
  }, 1000)
178
+ if (locations) {
179
+ SETMARKERS(locations)
180
+ }
173
181
  return () => clearInterval(interval)
174
182
  }, [locations])
175
183
 
@@ -189,16 +197,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
189
197
  >
190
198
  {locations ? (
191
199
  <>
192
- {MARKERS && MARKERS.map((location: { latitude: number, longitude: number }, i: number) => (
200
+ {MARKERS && MARKERS.map((location: { lat: number, lng: number }, i: number) => (
193
201
  <React.Fragment key={i}>
194
202
  {
195
203
  <Marker
196
204
  zIndex={i}
197
- coordinate={location}
198
- title={locations[i]?.title}
205
+ coordinate={{ latitude: location.lat ?? 0, longitude: location.lng ?? 0 }}
206
+ title={MARKERS[i]?.title}
199
207
  >
200
208
  <View>
201
- <OIcon url={locations[i].icon} width={50} height={50} />
209
+ <OIcon url={MARKERS[i].icon} width={50} height={50} />
202
210
  </View>
203
211
  </Marker>
204
212
  }
@@ -1,12 +1,15 @@
1
1
  import React from 'react'
2
+ import { Platform } from 'react-native'
2
3
  import { useLanguage } from 'ordering-components/native'
3
4
  import { HelpAccountAndPaymentParams } from '../../types'
4
5
  import { OText, OButton, OIcon } from '../shared'
5
6
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet } from 'react-native'
7
+ import { StyleSheet, TouchableOpacity } from 'react-native'
8
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
7
9
 
8
10
  import {
9
- Content
11
+ Content,
12
+ HeaderWrapper
10
13
  } from './styles'
11
14
 
12
15
  export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
@@ -37,13 +40,25 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
37
40
 
38
41
  return (
39
42
  <>
40
- <OButton
41
- imgLeftSrc={theme.images.general.arrow_left}
42
- imgRightSrc={null}
43
- style={styles.btnBackArrow}
44
- onClick={() => goToBack()}
45
- />
46
- <OText size={22} weight={600}>{t('ACCOUNT_PAYMENT_OPTIONS', 'Account and Payment Options')}</OText>
43
+ <HeaderWrapper>
44
+ <OButton
45
+ imgRightSrc={null}
46
+ style={styles.btnBackArrow}
47
+ onClick={() => goToBack()}
48
+ icon={AntDesignIcon}
49
+ iconProps={{
50
+ name: 'arrowleft',
51
+ size: 26
52
+ }}
53
+ />
54
+ <OText
55
+ size={24}
56
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
57
+ color={theme.colors.textNormal}
58
+ >
59
+ {t('ACCOUNT_PAYMENT_OPTIONS', 'Account and Payment Options')}
60
+ </OText>
61
+ </HeaderWrapper>
47
62
  <Content>
48
63
  <OText mBottom={20}>
49
64
  -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vel in congue nisl, nisi. Mauris, condimentum auctor sed cras cursus arcu pellentesque.
@@ -65,4 +80,4 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
65
80
  </Content>
66
81
  </>
67
82
  )
68
- }
83
+ }
@@ -4,3 +4,7 @@ export const Content = styled.View`
4
4
  padding-vertical: 20px;
5
5
  margin-bottom: 20px;
6
6
  `
7
+ export const HeaderWrapper = styled.View`
8
+ padding: 10px 20px 20px 0;
9
+ flex-direction: row;
10
+ `
@@ -3,10 +3,12 @@ import { useLanguage } from 'ordering-components/native'
3
3
  import { HelpGuideParams } from '../../types'
4
4
  import { OText, OButton, OIcon } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet } from 'react-native'
6
+ import { StyleSheet, TouchableOpacity } from 'react-native'
7
+ import NavBar from '../NavBar'
7
8
  import {
8
9
  Content
9
10
  } from './styles'
11
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
10
12
 
11
13
  export const HelpGuide = (props: HelpGuideParams) => {
12
14
  const {
@@ -36,13 +38,12 @@ export const HelpGuide = (props: HelpGuideParams) => {
36
38
 
37
39
  return (
38
40
  <>
39
- <OButton
40
- imgLeftSrc={theme.images.general.arrow_left}
41
- imgRightSrc={null}
42
- style={styles.btnBackArrow}
43
- onClick={() => goToBack()}
41
+ <NavBar
42
+ title={t('GUIDE_TO_ORDERING', 'Guide to Ordering')}
43
+ onActionLeft={goToBack}
44
+ btnStyle={{ paddingLeft: 0 }}
45
+ showCall={false}
44
46
  />
45
- <OText size={22} weight={600}>{t('GUIDE_TO_ORDERING', 'Guide to Ordering')}</OText>
46
47
  <Content>
47
48
  <OText mBottom={15}>
48
49
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Blandit mauris varius faucibus varius condimentum morbi pretium mus. Aliquam bibendum erat venenatis feugiat sed.
@@ -64,4 +65,4 @@ export const HelpGuide = (props: HelpGuideParams) => {
64
65
  </Content>
65
66
  </>
66
67
  )
67
- }
68
+ }
@@ -3,8 +3,10 @@ import { useLanguage } from 'ordering-components/native'
3
3
  import { HelpOrderParams } from '../../types'
4
4
  import { OText, OButton, OIcon } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet } from 'react-native'
6
+ import { StyleSheet, TouchableOpacity } from 'react-native'
7
7
  import { WebView } from 'react-native-webview'
8
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
+ import NavBar from '../NavBar'
8
10
 
9
11
  import {
10
12
  Content
@@ -41,13 +43,12 @@ export const HelpOrder = (props: HelpOrderParams) => {
41
43
 
42
44
  return (
43
45
  <>
44
- <OButton
45
- imgLeftSrc={theme.images.general.arrow_left}
46
- imgRightSrc={null}
47
- style={styles.btnBackArrow}
48
- onClick={() => goToBack()}
46
+ <NavBar
47
+ title={t('HELP_WITH_ORDER', 'Help with an order')}
48
+ onActionLeft={goToBack}
49
+ btnStyle={{ paddingLeft: 0 }}
50
+ showCall={false}
49
51
  />
50
- <OText size={22} weight={600}>{t('HELP_WITH_ORDER', 'Help with an order')}</OText>
51
52
  <Content>
52
53
  <OText mBottom={20}>
53
54
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vel in congue nisl, nisi. Mauris, condimentum auctor sed cras cursus arcu pellentesque. Sed tempus et, cursus ultricies nisl nisl, in eros.
@@ -76,4 +77,4 @@ export const HelpOrder = (props: HelpOrderParams) => {
76
77
  </Content>
77
78
  </>
78
79
  )
79
- }
80
+ }
@@ -1,7 +1,7 @@
1
- import React from 'react'
2
- import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
1
+ import React, { useState } from 'react'
2
+ import { LanguageSelector as LanguageSelectorController, useOrder, useLanguage } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
- import { Platform, StyleSheet, View } from 'react-native'
4
+ import { StyleSheet, View } from 'react-native'
5
5
 
6
6
  import RNPickerSelect from 'react-native-picker-select'
7
7
  import { Container, DummyContainer } from './styles'
@@ -9,9 +9,17 @@ import { LanguageSelectorParams } from '../../types'
9
9
  import { OIcon } from '../shared'
10
10
 
11
11
  const LanguageSelectorUI = (props: LanguageSelectorParams) => {
12
+ const {
13
+ languagesState,
14
+ currentLanguage,
15
+ handleChangeLanguage,
16
+ iconColor,
17
+ pickerStyle
18
+ } = props
12
19
 
13
20
  const [orderState] = useOrder()
14
-
21
+ const [state] = useLanguage()
22
+ const [languagePressed, setLanguagePressed] = useState(currentLanguage)
15
23
  const theme = useTheme();
16
24
 
17
25
  const _pickerStyle = StyleSheet.create({
@@ -41,14 +49,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
41
49
  color: theme.colors.secundaryContrast
42
50
  }
43
51
  })
44
-
45
- const {
46
- languagesState,
47
- currentLanguage,
48
- handleChangeLanguage,
49
- iconColor,
50
- pickerStyle
51
- } = props
52
+
53
+ const changeLanguage = (lang : string) => {
54
+ setLanguagePressed(lang)
55
+ handleChangeLanguage(lang)
56
+ }
52
57
 
53
58
  const _languages = languagesState?.languages?.map((language: any) => {
54
59
  return {
@@ -67,14 +72,14 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
67
72
  <>
68
73
  {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
69
74
  <RNPickerSelect
70
- onValueChange={handleChangeLanguage}
75
+ onValueChange={changeLanguage}
71
76
  items={_languages || []}
72
77
  value={currentLanguage}
73
78
  style={pickerStyle ? pickerStyle : _pickerStyle}
74
79
  useNativeAndroidPickerStyle={false}
75
80
  placeholder={{}}
76
81
  Icon={() => <View style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} /></View>}
77
- disabled={orderState.loading}
82
+ disabled={orderState.loading || state.loading || state?.language?.code !== languagePressed}
78
83
  />
79
84
  </>
80
85
  ) : <DummyContainer />}
@@ -1,91 +1,113 @@
1
- import React, { useEffect } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { formatSeconds } from '../../../utils'
3
3
  import { StyleSheet, TouchableOpacity } from 'react-native';
4
4
  import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
5
5
  import { useLanguage } from 'ordering-components/native';
6
6
  import { OTPContainer } from './styles';
7
7
  import { OText, OButton } from '../../shared';
8
- import OTPInputView from '@twotalltotems/react-native-otp-input'
8
+ import OtpInputs from 'react-native-otp-inputs';
9
9
  import { useTheme } from 'styled-components/native';
10
10
  import { otpParams } from '../../../types'
11
11
 
12
12
  export const Otp = (props: otpParams) => {
13
- const {
14
- willVerifyOtpState,
15
- setWillVerifyOtpState,
16
- onSubmit,
17
- handleLoginOtp,
18
- setAlertState,
19
- pinCount
20
- } = props
13
+ const {
14
+ willVerifyOtpState,
15
+ setWillVerifyOtpState,
16
+ onSubmit,
17
+ handleLoginOtp,
18
+ setAlertState,
19
+ pinCount
20
+ } = props
21
21
 
22
- const theme = useTheme();
23
- const [, t] = useLanguage();
24
- const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
25
- 600, willVerifyOtpState)
22
+ const theme = useTheme();
23
+ const [, t] = useLanguage();
24
+ const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
25
+ 600, willVerifyOtpState)
26
26
 
27
+ const [code, setCode] = useState('')
27
28
 
28
- const handleOnSubmit = () => {
29
- setAlertState({
30
- open: true,
31
- title: t('CODE_SENT', 'The code has been sent'),
32
- })
33
- resetOtpLeftTime()
34
- onSubmit()
29
+
30
+ const handleOnSubmit = () => {
31
+ setAlertState({
32
+ open: true,
33
+ title: t('CODE_SENT', 'The code has been sent'),
34
+ })
35
+ resetOtpLeftTime()
36
+ onSubmit()
37
+ }
38
+
39
+ useEffect(() => {
40
+ if (otpLeftTime === 0) {
41
+ setAlertState({
42
+ open: true,
43
+ title: t('TIME_IS_UP', 'Time is up'),
44
+ content: t('PLEASE_RESEND_CODE', 'Please resend code again')
45
+ })
35
46
  }
47
+ }, [otpLeftTime])
36
48
 
37
- useEffect(() => {
38
- if (otpLeftTime === 0) {
39
- setAlertState({
40
- open: true,
41
- title: t('TIME_IS_UP', 'Time is up'),
42
- content: t('PLEASE_RESEND_CODE', 'Please resend code again')
43
- })
44
- }
45
- }, [otpLeftTime])
49
+ useEffect(() => {
50
+ if (code?.length === (pinCount || 6)) {
51
+ handleLoginOtp(code)
52
+ }
53
+ }, [code])
46
54
 
47
- const loginStyle = StyleSheet.create({
48
- underlineStyleBase: {
49
- width: 45,
50
- height: 60,
51
- borderWidth: 1,
52
- fontSize: 16
53
- },
54
- underlineStyleHighLighted: {
55
- borderColor: theme.colors.primary,
56
- color: theme.colors.primary,
57
- fontSize: 16
58
- },
59
- });
55
+ const loginStyle = StyleSheet.create({
56
+ container: {
57
+ width: '100%',
58
+ flexDirection: 'row',
59
+ justifyContent: 'space-between',
60
+ marginVertical: 30
61
+ },
62
+ focusStyles: {
63
+ borderColor: theme.colors.primary,
64
+ borderWidth: 1,
65
+ borderRadius: 8
66
+ },
67
+ underlineStyleBase: {
68
+ width: 45,
69
+ height: 50,
70
+ borderWidth: 1,
71
+ fontSize: 16,
72
+ borderRadius: 8,
73
+ borderColor: theme.colors.lightGray,
74
+ textAlign: 'center'
75
+ },
76
+ underlineStyleHighLighted: {
77
+ borderColor: theme.colors.primary,
78
+ color: theme.colors.primary,
79
+ fontSize: 16
80
+ },
81
+ });
60
82
 
61
- return (
62
- <>
63
- <OTPContainer>
64
- <OText size={24}>
65
- {formatSeconds(otpLeftTime)}
66
- </OText>
67
- <OTPInputView
68
- style={{ width: '100%', height: 150 }}
69
- pinCount={pinCount || 6}
70
- codeInputFieldStyle={loginStyle.underlineStyleBase}
71
- codeInputHighlightStyle={loginStyle.underlineStyleHighLighted}
72
- onCodeFilled={(code: string) => handleLoginOtp(code)}
73
- selectionColor={theme.colors.primary}
74
- />
75
- <TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
76
- <OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
77
- {t('RESEND_CODE', 'Resend code')}
78
- </OText>
79
- </TouchableOpacity>
80
- <OButton
81
- onClick={() => setWillVerifyOtpState(false)}
82
- bgColor={theme.colors.white}
83
- borderColor={theme.colors.primary}
84
- textStyle={{ color: theme.colors.primary }}
85
- style={{ borderRadius: 8, width: '100%' }}
86
- text={t('CANCEL', 'Cancel')}
87
- />
88
- </OTPContainer>
89
- </>
90
- )
83
+ return (
84
+ <>
85
+ <OTPContainer>
86
+ <OText size={24}>
87
+ {formatSeconds(otpLeftTime)}
88
+ </OText>
89
+ <OtpInputs
90
+ autofillFromClipboard
91
+ numberOfInputs={pinCount || 6}
92
+ style={loginStyle.container}
93
+ inputStyles={loginStyle.underlineStyleBase}
94
+ focusStyles={loginStyle.focusStyles}
95
+ handleChange={setCode}
96
+ />
97
+ <TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
98
+ <OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
99
+ {t('RESEND_CODE', 'Resend code')}
100
+ </OText>
101
+ </TouchableOpacity>
102
+ <OButton
103
+ onClick={() => setWillVerifyOtpState(false)}
104
+ bgColor={theme.colors.white}
105
+ borderColor={theme.colors.primary}
106
+ textStyle={{ color: theme.colors.primary }}
107
+ style={{ borderRadius: 8, width: '100%' }}
108
+ text={t('CANCEL', 'Cancel')}
109
+ />
110
+ </OTPContainer>
111
+ </>
112
+ )
91
113
  }