ordering-ui-react-native 0.18.0 → 0.18.1-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 (263) hide show
  1. package/package.json +9 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +4 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  16. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  17. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  18. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  19. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  20. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  21. package/themes/business/src/components/Chat/index.tsx +163 -123
  22. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  23. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  24. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  25. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  26. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  27. package/themes/business/src/components/MapView/index.tsx +14 -10
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +91 -43
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  35. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  36. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  37. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  38. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  39. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  40. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  41. package/themes/business/src/components/OrdersOption/index.tsx +60 -47
  42. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  43. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  44. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  45. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  46. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  47. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  48. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  49. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  50. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  51. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  52. package/themes/business/src/components/StoresList/index.tsx +6 -5
  53. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  54. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  55. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  56. package/themes/business/src/components/shared/OModal.tsx +16 -9
  57. package/themes/business/src/types/index.tsx +25 -10
  58. package/themes/business/src/utils/index.tsx +29 -2
  59. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  61. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  63. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  64. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  65. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  66. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  67. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  68. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  69. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  70. package/themes/original/index.tsx +7 -3
  71. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  72. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  73. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  74. package/themes/original/src/components/AddressList/index.tsx +5 -8
  75. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  76. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  77. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  78. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  79. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  80. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  81. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  82. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  83. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  84. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  85. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  86. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -341
  90. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  91. package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
  92. package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
  93. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  96. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  99. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  107. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  108. package/themes/original/src/components/Cart/index.tsx +49 -47
  109. package/themes/original/src/components/CartContent/index.tsx +99 -38
  110. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  111. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  112. package/themes/original/src/components/Checkout/index.tsx +324 -43
  113. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  114. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  115. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  116. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  117. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  118. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  119. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  120. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  121. package/themes/original/src/components/Favorite/index.tsx +4 -9
  122. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  123. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  124. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  125. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  126. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  127. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  128. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  129. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  131. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  132. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  133. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  134. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  135. package/themes/original/src/components/Home/index.tsx +14 -5
  136. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  137. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  138. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  139. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  140. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  141. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  142. package/themes/original/src/components/Messages/index.tsx +15 -4
  143. package/themes/original/src/components/Messages/styles.tsx +1 -1
  144. package/themes/original/src/components/MomentOption/index.tsx +43 -38
  145. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  146. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  148. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  149. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  150. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  151. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  152. package/themes/original/src/components/NavBar/index.tsx +20 -13
  153. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  154. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  155. package/themes/original/src/components/Notifications/index.tsx +2 -4
  156. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  157. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  159. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  160. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  161. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  162. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  163. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  164. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  165. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  166. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  167. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  169. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  170. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  171. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  172. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  173. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  174. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  175. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  176. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  177. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  178. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  179. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  180. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  181. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  182. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  183. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  184. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  185. package/themes/original/src/components/ProfessionalProfile/index.tsx +35 -6
  186. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  187. package/themes/original/src/components/Promotions/index.tsx +6 -6
  188. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  189. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  190. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  191. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  192. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  193. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  194. package/themes/original/src/components/ServiceForm/index.tsx +36 -24
  195. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  196. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  197. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  198. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  199. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  200. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  201. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  202. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  205. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  206. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  207. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  208. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  209. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  210. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  211. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  212. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  213. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  214. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  215. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  216. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  217. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  218. package/themes/original/src/components/Wallets/index.tsx +48 -60
  219. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  220. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  221. package/themes/original/src/components/shared/OButton.tsx +3 -3
  222. package/themes/original/src/components/shared/OInput.tsx +4 -5
  223. package/themes/original/src/components/shared/OModal.tsx +15 -17
  224. package/themes/original/src/layouts/Container.tsx +1 -1
  225. package/themes/original/src/types/index.tsx +28 -6
  226. package/themes/original/src/utils/index.tsx +180 -13
  227. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  228. package/src/navigators/BottomNavigator.tsx +0 -117
  229. package/src/navigators/CheckoutNavigator.tsx +0 -66
  230. package/src/navigators/HomeNavigator.tsx +0 -202
  231. package/src/navigators/NavigationRef.tsx +0 -7
  232. package/src/navigators/RootNavigator.tsx +0 -269
  233. package/src/pages/Account.tsx +0 -34
  234. package/src/pages/AddressForm.tsx +0 -62
  235. package/src/pages/AddressList.tsx +0 -24
  236. package/src/pages/BusinessProductsList.tsx +0 -81
  237. package/src/pages/BusinessesListing.tsx +0 -43
  238. package/src/pages/CartList.tsx +0 -49
  239. package/src/pages/Checkout.tsx +0 -101
  240. package/src/pages/ForgotPassword.tsx +0 -24
  241. package/src/pages/Help.tsx +0 -23
  242. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  243. package/src/pages/HelpGuide.tsx +0 -23
  244. package/src/pages/HelpOrder.tsx +0 -23
  245. package/src/pages/Home.tsx +0 -36
  246. package/src/pages/IntroductoryTutorial.tsx +0 -170
  247. package/src/pages/Login.tsx +0 -47
  248. package/src/pages/MomentOption.tsx +0 -30
  249. package/src/pages/MultiCheckout.tsx +0 -31
  250. package/src/pages/MultiOrdersDetails.tsx +0 -27
  251. package/src/pages/MyOrders.tsx +0 -40
  252. package/src/pages/NetworkError.tsx +0 -24
  253. package/src/pages/NotFound.tsx +0 -22
  254. package/src/pages/OrderDetails.tsx +0 -25
  255. package/src/pages/ProductDetails.tsx +0 -55
  256. package/src/pages/Profile.tsx +0 -36
  257. package/src/pages/ReviewDriver.tsx +0 -30
  258. package/src/pages/ReviewOrder.tsx +0 -32
  259. package/src/pages/ReviewProducts.tsx +0 -30
  260. package/src/pages/Sessions.tsx +0 -22
  261. package/src/pages/Signup.tsx +0 -53
  262. package/src/pages/SpinnerLoader.tsx +0 -10
  263. package/src/pages/Splash.tsx +0 -21
@@ -47,10 +47,10 @@ export const getTraduction = (key: string, t: any) => {
47
47
  */
48
48
  export const convertHoursToMinutes = (time: any) => {
49
49
  const [, t] = useLanguage()
50
- if (!time) return '0min'
50
+ if (!time) return `0 ${t('TIME_MIN', 'min')}`
51
51
  const [hour, minute] = time.split(':')
52
52
  const result = (parseInt(hour, 10) * 60) + parseInt(minute, 10)
53
- return `${result}${t('MIN', 'min')}`
53
+ return `${result}${t('TIME_MIN', 'min')}`
54
54
  }
55
55
 
56
56
  export const getIconCard = (brand: string, size: number) => {
@@ -154,6 +154,11 @@ export const transformCountryCode = (countryCode : number) => {
154
154
  return code?.countryCode
155
155
  }
156
156
 
157
+ export const verifyCountryCode = (countryCode : string) => {
158
+ const code = CODES.find((code : any) => code.countryCode === (countryCode || '').toUpperCase())
159
+ return code?.countryCode
160
+ }
161
+
157
162
  /**
158
163
  * Function to check if a number is decimal or not
159
164
  * @param {*} value number to check if decimal or not
@@ -1,6 +1,7 @@
1
1
  //Components
2
2
  import { AcceptOrRejectOrder } from './src/components/AcceptOrRejectOrder';
3
3
  import { BusinessController } from './src/components/BusinessController';
4
+ import { BusinessProductList } from './src/components/BusinessProductList';
4
5
  import { Chat } from './src/components/Chat';
5
6
  import { FloatingButton } from './src/components/FloatingButton';
6
7
  import { ForgotPasswordForm } from './src/components/ForgotPasswordForm';
@@ -41,6 +42,7 @@ import { MapViewUI as MapView } from './src/components/MapView'
41
42
  import { NewOrderNotification } from './src/components/NewOrderNotification';
42
43
  import { DriverSchedule } from './src/components/DriverSchedule';
43
44
  import { ScheduleBlocked } from './src/components/ScheduleBlocked';
45
+ import { OrderDetailsLogistic } from './src/components/OrderDetailsLogistic'
44
46
  //OComponents
45
47
  import {
46
48
  OText,
@@ -69,6 +71,7 @@ export {
69
71
  //Components
70
72
  AcceptOrRejectOrder,
71
73
  BusinessController,
74
+ BusinessProductList,
72
75
  Chat,
73
76
  DriverMap,
74
77
  FloatingButton,
@@ -110,6 +113,7 @@ export {
110
113
  VerifyPhone,
111
114
  DriverSchedule,
112
115
  ScheduleBlocked,
116
+ OrderDetailsLogistic,
113
117
  //OComponents
114
118
  OAlert,
115
119
  OButton,
@@ -7,13 +7,14 @@ import {
7
7
  View,
8
8
  KeyboardAvoidingView,
9
9
  TextInput,
10
- StyleSheet
10
+ StyleSheet,
11
+ TouchableOpacity
11
12
  } from 'react-native';
12
13
  import { useTheme } from 'styled-components/native';
13
14
  import SelectDropdown from 'react-native-select-dropdown'
14
15
  import { useLanguage } from 'ordering-components/native';
15
16
  import { Content, Timer, TimeField, Header, Comments, CommentsButtonGroup, TopActions } from './styles';
16
- import { OText, OButton, OTextarea, OIconButton } from '../shared';
17
+ import { OText, OButton, OTextarea, OIcon } from '../shared';
17
18
  import { AcceptOrRejectOrderParams } from '../../types';
18
19
 
19
20
  import { orderCommentList } from '../../../../../src/utils'
@@ -95,7 +96,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
95
96
  upper: {
96
97
  flex: 1,
97
98
  zIndex: 1001,
98
- paddingTop: isPage ? 30 : 50,
99
+ paddingTop: isPage ? 30 : 40,
99
100
  marginBottom: 10,
100
101
  backgroundColor: theme.colors.backgroundPage
101
102
  },
@@ -109,7 +110,18 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
109
110
  bottom: {
110
111
  textAlignVertical: "center",
111
112
  textAlign: "center",
112
- }
113
+ },
114
+ btnBackArrow: {
115
+ borderWidth: 0,
116
+ width: 32,
117
+ height: 32,
118
+ tintColor: theme.colors.textGray,
119
+ backgroundColor: theme.colors.clear,
120
+ borderColor: theme.colors.clear,
121
+ shadowColor: theme.colors.clear,
122
+ paddingLeft: 0,
123
+ paddingRight: 0
124
+ },
113
125
  })
114
126
 
115
127
  const handleFocus = () => {
@@ -203,7 +215,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
203
215
  status: 7,
204
216
  },
205
217
  rejectByBusiness: {
206
- comment: comments,
218
+ reasons: comments,
207
219
  status: 5,
208
220
  },
209
221
  acceptByDriver: {
@@ -211,22 +223,22 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
211
223
  status: 8,
212
224
  },
213
225
  rejectByDriver: {
214
- comment: comments,
226
+ reasons: comments,
215
227
  status: 6,
216
228
  reject_reason: rejectReason
217
229
  },
218
230
  pickupFailedByDriver: {
219
- comment: comments,
231
+ reasons: comments,
220
232
  status: 10,
221
233
  reject_reason: rejectReason
222
234
  },
223
235
  deliveryFailedByDriver: {
224
- comment: comments,
236
+ reasons: comments,
225
237
  status: 12,
226
238
  reject_reason: rejectReason
227
239
  },
228
240
  orderNotReady: {
229
- comment: comments,
241
+ reasons: comments,
230
242
  status: 14,
231
243
  reject_reason: rejectReason
232
244
  },
@@ -295,22 +307,17 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
295
307
  }, [])
296
308
 
297
309
  return (
298
- <KeyboardAvoidingView style={{ flex: 1 }}>
310
+ <KeyboardAvoidingView
311
+ enabled
312
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
313
+ style={{ flex: 1 }}
314
+ >
299
315
  <View style={styles.parent}>
300
316
  <View style={styles.upper}>
301
317
  <TopActions>
302
- <OIconButton
303
- icon={theme.images.general.arrow_left}
304
- borderColor={theme.colors.clear}
305
- iconStyle={{ width: 20, height: 20 }}
306
- style={{
307
- maxWidth: 40,
308
- height: 35,
309
- justifyContent: 'flex-end',
310
- marginBottom: 10,
311
- }}
312
- onClick={() => handleArrowBack()}
313
- />
318
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
319
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
320
+ </TouchableOpacity>
314
321
  <OText
315
322
  size={20}
316
323
  color={theme.colors.textGray}
@@ -339,7 +346,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
339
346
  )}
340
347
  </OText>
341
348
 
342
- {numberToShow ? (
349
+ {!!numberToShow ? (
343
350
  <OButton
344
351
  bgColor="transparent"
345
352
  borderColor={theme.colors.primary}
@@ -508,7 +515,10 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
508
515
  <View
509
516
  style={{
510
517
  ...styles.bottomParent,
511
- marginBottom: (keyboardState.height === 0) ? isPage ? 0 : 30 : keyboardState.height - (isPage ? 20 : -10)
518
+ marginBottom: Platform.OS === 'ios'
519
+ ? 30 : (keyboardState.height === 0)
520
+ ? isPage ? 0 : 30
521
+ : keyboardState.height - (isPage ? 20 : -10)
512
522
  }}
513
523
  >
514
524
  <OButton
@@ -518,8 +528,8 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
518
528
  imgRightSrc={null}
519
529
  style={{ borderRadius: 7, height: 45 }}
520
530
  parentStyle={{ width: '100%' }}
521
- textStyle={{color: '#FFF', fontSize: 18 }}
522
- isDisabled={!rejectReason && showTextArea}
531
+ textStyle={{ color: '#FFF', fontSize: 18 }}
532
+ isDisabled={showTextArea && !comments}
523
533
  onClick={() => handleAcceptOrReject()}
524
534
  />
525
535
  </View>
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { StyleSheet, View, ActivityIndicator } from 'react-native';
2
+ import { StyleSheet, View, ActivityIndicator, TouchableOpacity } from 'react-native';
3
3
  import ToggleSwitch from 'toggle-switch-react-native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
@@ -14,7 +14,7 @@ import { OIcon, OText } from '../shared';
14
14
  import { BusinessControllerParams } from '../../types';
15
15
 
16
16
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
17
- const { businessState, updateBusiness, isUpdateStore, setIsUpdateStore } =
17
+ const { businessState, updateBusiness, isUpdateStore, setIsUpdateStore, navigation } =
18
18
  props;
19
19
 
20
20
  const { loading, business, error } = businessState;
@@ -93,21 +93,18 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
93
93
  <>
94
94
  {business && (
95
95
  <Card key={business?.id}>
96
- <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}>
97
- <Logo style={styles.logo}>
98
- <OIcon
99
- url={optimizeImage(business?.logo, 'h_300,c_limit')}
100
- src={!business?.logo && theme?.images?.dummies?.businessLogo}
101
- style={styles.icon}
102
- />
103
- </Logo>
104
-
105
- <View
106
- style={{
107
- flex: 1,
108
- flexDirection: 'row',
109
- alignItems: 'flex-start',
110
- }}>
96
+ <View style={{ flexDirection: 'row', flex: 1 }}>
97
+ <TouchableOpacity
98
+ style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}
99
+ onPress={() => navigation && business?.slug && navigation.navigate('BusinessProductListing', { slug: business?.slug })}
100
+ >
101
+ <Logo style={styles.logo}>
102
+ <OIcon
103
+ url={optimizeImage(business?.logo, 'h_300,c_limit')}
104
+ src={!business?.logo && theme?.images?.dummies?.businessLogo}
105
+ style={styles.icon}
106
+ />
107
+ </Logo>
111
108
  <Information>
112
109
  <View style={styles.header}>
113
110
  <OText style={styles.title} numberOfLines={1}>
@@ -123,7 +120,12 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
123
120
  {business?.zipcode}
124
121
  </OText>
125
122
  </Information>
123
+ </TouchableOpacity>
126
124
 
125
+ <View
126
+ style={{
127
+ alignItems: 'flex-start',
128
+ }}>
127
129
  {loading && isUpdateStore ? (
128
130
  <ActivityIndicator size="small" color={theme.colors.primary} />
129
131
  ) : (
@@ -0,0 +1,63 @@
1
+ import { OText } from "../shared"
2
+ import React, { useState } from "react"
3
+ import { View } from "react-native"
4
+ import { TouchableOpacity } from "react-native-gesture-handler"
5
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
6
+ import ToggleSwitch from 'toggle-switch-react-native';
7
+ import { useTheme } from 'styled-components/native';
8
+ import { CategoryTab } from './styles'
9
+
10
+ export const AccordionDropdown = (props: any) => {
11
+ const { category, IterateCategories, handlerClickCategory, updateCategory } = props
12
+
13
+ const theme = useTheme();
14
+ const [isOpen, setIsOpen] = useState(false)
15
+
16
+ const handleSwitch = (enabled: boolean, categoryId: any) => {
17
+ updateCategory && updateCategory(categoryId, { enabled })
18
+ };
19
+
20
+ return (
21
+ <View style={{ marginLeft: !!category?.parent_category_id ? 10 : 0 }}>
22
+ <CategoryTab>
23
+ <View style={{ flexDirection: 'row', alignItems: 'center', flex: 1, marginRight: 5 }}>
24
+ <TouchableOpacity onPress={() => setIsOpen(prev => !prev)} style={{ marginRight: 10 }}>
25
+ <AntDesignIcon
26
+ name={isOpen ? 'caretdown' : 'caretright'}
27
+ size={14}
28
+ />
29
+ </TouchableOpacity>
30
+ <TouchableOpacity onPress={() => handlerClickCategory(category)} style={{ flex: 1 }}>
31
+ <OText numberOfLines={1}>
32
+ {category.name}
33
+ </OText>
34
+ </TouchableOpacity>
35
+ </View>
36
+ <View>
37
+ <ToggleSwitch
38
+ isOn={category?.enabled}
39
+ onColor={theme.colors.primary}
40
+ offColor={theme.colors.offColor}
41
+ size="small"
42
+ onToggle={(value: boolean) => handleSwitch(value, category.id)}
43
+ // disabled={loading}
44
+ animationSpeed={200}
45
+ />
46
+ </View>
47
+ </CategoryTab>
48
+ {
49
+ isOpen && (
50
+ <View>
51
+ <IterateCategories
52
+ list={category.subcategories}
53
+ isSub
54
+ currentCat={category}
55
+ handlerClickCategory={handlerClickCategory}
56
+ updateCategory={updateCategory}
57
+ />
58
+ </View>
59
+ )
60
+ }
61
+ </View>
62
+ )
63
+ }
@@ -0,0 +1,108 @@
1
+ import React from "react"
2
+ import { View, TouchableOpacity } from "react-native"
3
+ import { OText } from "../shared"
4
+ import ToggleSwitch from 'toggle-switch-react-native';
5
+ import { AccordionDropdown } from './AccordionDropdown'
6
+ import { useTheme } from 'styled-components/native';
7
+ import { CategoryTab } from './styles'
8
+
9
+ export const IterateCategories = (props: any) => {
10
+ const { list, currentCat, isSub, handlerClickCategory, updateCategory } = props
11
+
12
+ const theme = useTheme();
13
+
14
+ const handleSwitch = (enabled: boolean, categoryId: any) => {
15
+ updateCategory && updateCategory(categoryId, { enabled })
16
+ };
17
+
18
+ return (
19
+ <>
20
+ {list?.length > 0 && list.map((category: any, i: number) => (
21
+ <View key={`${category?.id}_${i}`}>
22
+ {(category?.subcategories?.length > 0 || isSub) ? (
23
+ <>
24
+ {category?.subcategories?.length > 0 && (
25
+ <>
26
+ <View>
27
+ <AccordionDropdown
28
+ category={category}
29
+ IterateCategories={IterateCategories}
30
+ handlerClickCategory={handlerClickCategory}
31
+ updateCategory={updateCategory}
32
+ />
33
+ </View>
34
+ </>
35
+ )}
36
+ {isSub && !category?.subcategories?.length && (
37
+ <CategoryTab isSpace={!!category?.parent_category_id}>
38
+ <TouchableOpacity
39
+ style={{ flex: 1, marginRight: 5 }}
40
+ onPress={() => handlerClickCategory(category)}
41
+ >
42
+ <OText numberOfLines={1}>
43
+ {category.name}
44
+ </OText>
45
+ </TouchableOpacity>
46
+ <View>
47
+ <ToggleSwitch
48
+ isOn={category?.enabled}
49
+ onColor={theme.colors.primary}
50
+ offColor={theme.colors.offColor}
51
+ size="small"
52
+ onToggle={(value: boolean) => handleSwitch(value, category.id)}
53
+ // disabled={loading}
54
+ animationSpeed={200}
55
+ />
56
+ </View>
57
+ </CategoryTab>
58
+ )}
59
+ </>
60
+ ) : (
61
+ <CategoryTab
62
+ isSpace={!!category?.parent_category_id}
63
+ >
64
+ <TouchableOpacity onPress={() => handlerClickCategory(category)} style={{ flex: 1, marginRight: 5 }}>
65
+ <OText numberOfLines={1}>
66
+ {category.name}
67
+ </OText>
68
+ </TouchableOpacity>
69
+ <View>
70
+ <ToggleSwitch
71
+ isOn={category?.enabled}
72
+ onColor={theme.colors.primary}
73
+ offColor={theme.colors.offColor}
74
+ size="small"
75
+ onToggle={(value: boolean) => handleSwitch(value, category.id)}
76
+ // disabled={loading}
77
+ animationSpeed={200}
78
+ />
79
+ </View>
80
+ </CategoryTab>
81
+ )}
82
+ </View>
83
+ ))}
84
+ {list && list?.length === 0 && isSub && (
85
+ <CategoryTab
86
+ isSpace={!!currentCat?.parent_category_id}
87
+ >
88
+ <TouchableOpacity onPress={() => handlerClickCategory(currentCat)} style={{ flex: 1, marginRight: 5 }}>
89
+ <OText numberOfLines={1}>
90
+ {currentCat.name}
91
+ </OText>
92
+ </TouchableOpacity>
93
+ <View>
94
+ <ToggleSwitch
95
+ isOn={currentCat?.enabled}
96
+ onColor={theme.colors.primary}
97
+ offColor={theme.colors.offColor}
98
+ size="small"
99
+ onToggle={(value: boolean) => handleSwitch(value, currentCat.id)}
100
+ // disabled={loading}
101
+ animationSpeed={200}
102
+ />
103
+ </View>
104
+ </CategoryTab>
105
+ )}
106
+ </>
107
+ )
108
+ }
@@ -0,0 +1,196 @@
1
+ import React, { useCallback } from 'react'
2
+ import { StyleSheet, View, TouchableOpacity } from 'react-native'
3
+ import { useTheme } from 'styled-components/native';
4
+ import { OIcon, OText } from '../shared';
5
+ import { NotFoundSource } from '../NotFoundSource';
6
+ import ToggleSwitch from 'toggle-switch-react-native';
7
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
8
+ import { SearchBar } from '../SearchBar';
9
+ import { IOScrollView } from 'react-native-intersection-observer';
10
+ import {
11
+ useLanguage,
12
+ useUtils,
13
+ ToastType,
14
+ useToast,
15
+ } from 'ordering-components/native'
16
+
17
+ const PIXELS_TO_SCROLL = 2000
18
+
19
+ export const ProductList = (props: any) => {
20
+ const { productsList, onClose, updateProduct, searchValue, handleChangeSearch, getCategoryProducts } = props
21
+
22
+ const { loading, products, error } = productsList
23
+
24
+ const theme = useTheme()
25
+ const [{ optimizeImage }] = useUtils();
26
+ const [, { showToast }] = useToast()
27
+ const [, t] = useLanguage()
28
+
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ flex: 1,
32
+ marginBottom: 0
33
+ },
34
+ header: {
35
+ flexDirection: 'row',
36
+ justifyContent: 'space-between',
37
+ marginBottom: 10,
38
+ },
39
+ btnBackArrow: {
40
+ borderWidth: 0,
41
+ width: 32,
42
+ height: 32,
43
+ tintColor: theme.colors.textGray,
44
+ backgroundColor: theme.colors.clear,
45
+ borderColor: theme.colors.clear,
46
+ shadowColor: theme.colors.clear,
47
+ paddingLeft: 0,
48
+ paddingRight: 0
49
+ },
50
+ sectionTitle: {
51
+ fontStyle: 'normal',
52
+ fontWeight: '600',
53
+ fontSize: 20,
54
+ color: theme.colors.textGray,
55
+ },
56
+ logo: {
57
+ padding: 2,
58
+ borderRadius: 18,
59
+ shadowColor: '#000',
60
+ shadowOffset: {
61
+ width: 0,
62
+ height: 1.5,
63
+ },
64
+ shadowOpacity: 0.21,
65
+ shadowRadius: 3,
66
+ elevation: 7,
67
+ },
68
+ icon: {
69
+ borderRadius: 7.6,
70
+ width: 35,
71
+ height: 35,
72
+ marginRight: 5
73
+ },
74
+ borderStyle: {
75
+ borderColor: theme.colors.red,
76
+ borderWidth: 0,
77
+ borderRadius: 10,
78
+ },
79
+ });
80
+
81
+ const handleSwitch = (enabled: boolean, categoryId: any, productId: any) => {
82
+ updateProduct && updateProduct(categoryId, productId, { enabled })
83
+ };
84
+
85
+ const handleScroll = ({ nativeEvent }: any) => {
86
+ const y = nativeEvent.contentOffset.y;
87
+ const height = nativeEvent.contentSize.height;
88
+ const hasMore = !(
89
+ productsList.pagination.totalPages === productsList.pagination.currentPage
90
+ );
91
+
92
+ if (y + PIXELS_TO_SCROLL > height && !productsList.loading && hasMore && productsList?.products?.length > 0) {
93
+ getCategoryProducts(false)
94
+ showToast(ToastType.Info, t('LOADING_MORE_PRODUCTS', 'Loading more products'))
95
+ }
96
+ };
97
+
98
+ return (
99
+ <View style={{ flex: 1, paddingHorizontal: 20, paddingVertical: 20 }}>
100
+ <View style={styles.header}>
101
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
102
+ <TouchableOpacity
103
+ onPress={onClose}
104
+ style={styles.btnBackArrow}
105
+ >
106
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
107
+ </TouchableOpacity>
108
+ <OText style={styles.sectionTitle}>{t('PRODUCTS', 'Products')}</OText>
109
+ </View>
110
+ <View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
111
+ <SearchBar
112
+ borderStyle={styles.borderStyle}
113
+ onSearch={handleChangeSearch}
114
+ searchValue={searchValue}
115
+ lazyLoad
116
+ isCancelXButtonShow={!!searchValue}
117
+ onCancel={() => handleChangeSearch('')}
118
+ placeholder={t('SEARCH', 'Search')}
119
+ containerStyle={{ width: 180 }}
120
+ />
121
+ </View>
122
+ </View>
123
+ <IOScrollView
124
+ style={styles.container}
125
+ onScroll={handleScroll}
126
+ scrollEventThrottle={16}
127
+ bounces={false}
128
+ >
129
+ {!loading && products?.length === 0 && (
130
+ <NotFoundSource
131
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
132
+ image={theme.images.general.notFound}
133
+ conditioned={false}
134
+ />
135
+ )}
136
+ {!loading && products?.length > 0 && (
137
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
138
+ {products.map((product: any, i: number) => (
139
+ <View
140
+ key={i}
141
+ style={{
142
+ flexDirection: 'row',
143
+ justifyContent: 'space-between',
144
+ borderBottomColor: theme.colors.borderTops,
145
+ borderBottomWidth: 1,
146
+ paddingVertical: 15
147
+ }}
148
+ >
149
+ <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', marginRight: 36 }}>
150
+ <OIcon
151
+ url={optimizeImage(product?.images, 'h_300,c_limit')}
152
+ src={!product?.images && theme?.images?.dummies?.businessLogo}
153
+ style={styles.icon}
154
+ />
155
+ <OText numberOfLines={2} size={12} ellipsizeMode='tail'>{product?.name}</OText>
156
+ </View>
157
+ <ToggleSwitch
158
+ isOn={product?.enabled}
159
+ onColor={theme.colors.primary}
160
+ offColor={theme.colors.offColor}
161
+ size="small"
162
+ onToggle={(value: boolean) => handleSwitch(value, product?.category_id, product.id)}
163
+ disabled={loading}
164
+ animationSpeed={200}
165
+ />
166
+ </View>
167
+ ))}
168
+ </View>
169
+ )}
170
+ {loading && (
171
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
172
+ {[...Array(6)].map((item, i) => (
173
+ <Placeholder key={i} Animation={Fade}>
174
+ <View
175
+ style={{
176
+ flex: 1,
177
+ flexDirection: 'row',
178
+ justifyContent: 'space-between',
179
+ alignItems: 'center',
180
+ marginBottom: 10,
181
+ borderBottomColor: theme.colors.borderTops,
182
+ borderBottomWidth: 1,
183
+ paddingVertical: 10
184
+ }}
185
+ >
186
+ <PlaceholderLine width={50} />
187
+ <PlaceholderLine width={20} />
188
+ </View>
189
+ </Placeholder>
190
+ ))}
191
+ </View>
192
+ )}
193
+ </IOScrollView>
194
+ </View>
195
+ )
196
+ }