ordering-ui-react-native 0.18.55 → 0.18.56-crash-driver-1

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 (266) hide show
  1. package/package.json +6 -4
  2. package/src/components/BusinessInformation/index.tsx +10 -9
  3. package/src/components/PaymentOptionsWebView/index.tsx +30 -8
  4. package/src/components/PhoneInputNumber/index.tsx +6 -2
  5. package/src/components/StripeMethodForm/index.tsx +60 -55
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +6 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +48 -19
  18. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  21. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  22. package/themes/business/src/components/Home/index.tsx +5 -1
  23. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  24. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  25. package/themes/business/src/components/LoginForm/index.tsx +2 -2
  26. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  27. package/themes/business/src/components/MapView/index.tsx +28 -17
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
  35. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  36. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
  37. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  38. package/themes/business/src/components/OrderSummary/index.tsx +245 -82
  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 +125 -48
  42. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  43. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  44. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +43 -41
  46. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  48. package/themes/business/src/components/PreviousOrders/index.tsx +195 -221
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  50. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  51. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  52. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  53. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  56. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  57. package/themes/business/src/components/Sessions/index.tsx +187 -0
  58. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  59. package/themes/business/src/components/StoresList/index.tsx +4 -3
  60. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  61. package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
  62. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  63. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  64. package/themes/business/src/components/shared/OInput.tsx +2 -0
  65. package/themes/business/src/hooks/useLocation.tsx +5 -4
  66. package/themes/business/src/types/index.tsx +21 -1
  67. package/themes/business/src/utils/index.tsx +5 -0
  68. package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
  69. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  70. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  71. package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
  72. package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
  73. package/themes/original/index.tsx +11 -3
  74. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  75. package/themes/original/src/components/AddressForm/index.tsx +41 -20
  76. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  77. package/themes/original/src/components/AddressList/index.tsx +22 -11
  78. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  79. package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
  80. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  83. package/themes/original/src/components/BusinessController/index.tsx +40 -43
  84. package/themes/original/src/components/BusinessController/styles.tsx +12 -12
  85. package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
  86. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  88. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  89. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +57 -361
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  93. package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
  94. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  98. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +30 -404
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
  106. package/themes/original/src/components/Cart/index.tsx +51 -40
  107. package/themes/original/src/components/CartContent/index.tsx +98 -54
  108. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  109. package/themes/original/src/components/Checkout/index.tsx +308 -75
  110. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  112. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  113. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  114. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  115. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  116. package/themes/original/src/components/Favorite/index.tsx +8 -4
  117. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  120. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  121. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  122. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  126. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  127. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  128. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  129. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  131. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  132. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  133. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  134. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  135. package/themes/original/src/components/GoogleMap/index.tsx +52 -5
  136. package/themes/original/src/components/Help/index.tsx +7 -0
  137. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  138. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  139. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  140. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  141. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  142. package/themes/original/src/components/Home/index.tsx +3 -2
  143. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  144. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  145. package/themes/original/src/components/LoginForm/Otp/index.tsx +79 -25
  146. package/themes/original/src/components/LoginForm/index.tsx +38 -14
  147. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  148. package/themes/original/src/components/Messages/index.tsx +9 -3
  149. package/themes/original/src/components/Messages/styles.tsx +1 -1
  150. package/themes/original/src/components/MomentOption/index.tsx +20 -5
  151. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  152. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  153. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +48 -15
  154. package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
  155. package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
  157. package/themes/original/src/components/MyOrders/index.tsx +37 -39
  158. package/themes/original/src/components/NavBar/index.tsx +15 -14
  159. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  160. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  161. package/themes/original/src/components/Notifications/index.tsx +9 -8
  162. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  163. package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
  164. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
  165. package/themes/original/src/components/OrderDetails/index.tsx +718 -667
  166. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  167. package/themes/original/src/components/OrderProgress/index.tsx +50 -14
  168. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  169. package/themes/original/src/components/OrderSummary/index.tsx +26 -34
  170. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
  171. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  173. package/themes/original/src/components/OrdersOption/index.tsx +14 -6
  174. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  175. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
  177. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  178. package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
  179. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  180. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  181. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  182. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  183. package/themes/original/src/components/ProductForm/index.tsx +193 -267
  184. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  185. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
  186. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  187. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  188. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  189. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  190. package/themes/original/src/components/Promotions/index.tsx +13 -11
  191. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  192. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  193. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  194. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  195. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  196. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  197. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  198. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  199. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  200. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  201. package/themes/original/src/components/Sessions/index.tsx +5 -0
  202. package/themes/original/src/components/SignupForm/index.tsx +76 -60
  203. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
  204. package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
  205. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
  206. package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
  207. package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
  208. package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
  209. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  210. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  211. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  212. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  213. package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
  214. package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
  215. package/themes/original/src/components/UserProfile/index.tsx +5 -4
  216. package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
  217. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  218. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  219. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  220. package/themes/original/src/components/Wallets/index.tsx +35 -49
  221. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  222. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  223. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  224. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  225. package/themes/original/src/components/shared/OButton.tsx +5 -5
  226. package/themes/original/src/components/shared/OInput.tsx +7 -4
  227. package/themes/original/src/components/shared/OModal.tsx +12 -14
  228. package/themes/original/src/layouts/Container.tsx +5 -3
  229. package/themes/original/src/types/index.tsx +13 -2
  230. package/themes/original/src/utils/index.tsx +124 -22
  231. package/src/navigators/BottomNavigator.tsx +0 -117
  232. package/src/navigators/CheckoutNavigator.tsx +0 -66
  233. package/src/navigators/HomeNavigator.tsx +0 -202
  234. package/src/navigators/NavigationRef.tsx +0 -7
  235. package/src/navigators/RootNavigator.tsx +0 -269
  236. package/src/pages/Account.tsx +0 -34
  237. package/src/pages/AddressForm.tsx +0 -62
  238. package/src/pages/AddressList.tsx +0 -24
  239. package/src/pages/BusinessProductsList.tsx +0 -81
  240. package/src/pages/BusinessesListing.tsx +0 -43
  241. package/src/pages/CartList.tsx +0 -49
  242. package/src/pages/Checkout.tsx +0 -101
  243. package/src/pages/ForgotPassword.tsx +0 -24
  244. package/src/pages/Help.tsx +0 -23
  245. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  246. package/src/pages/HelpGuide.tsx +0 -23
  247. package/src/pages/HelpOrder.tsx +0 -23
  248. package/src/pages/Home.tsx +0 -36
  249. package/src/pages/IntroductoryTutorial.tsx +0 -170
  250. package/src/pages/Login.tsx +0 -47
  251. package/src/pages/MomentOption.tsx +0 -30
  252. package/src/pages/MultiCheckout.tsx +0 -31
  253. package/src/pages/MultiOrdersDetails.tsx +0 -27
  254. package/src/pages/MyOrders.tsx +0 -40
  255. package/src/pages/NetworkError.tsx +0 -24
  256. package/src/pages/NotFound.tsx +0 -22
  257. package/src/pages/OrderDetails.tsx +0 -25
  258. package/src/pages/ProductDetails.tsx +0 -55
  259. package/src/pages/Profile.tsx +0 -36
  260. package/src/pages/ReviewDriver.tsx +0 -30
  261. package/src/pages/ReviewOrder.tsx +0 -32
  262. package/src/pages/ReviewProducts.tsx +0 -30
  263. package/src/pages/Sessions.tsx +0 -22
  264. package/src/pages/Signup.tsx +0 -53
  265. package/src/pages/SpinnerLoader.tsx +0 -10
  266. package/src/pages/Splash.tsx +0 -21
@@ -11,6 +11,8 @@ import {
11
11
  useToast,
12
12
  useLanguage,
13
13
  useUtils,
14
+ useConfig,
15
+ useValidationFields
14
16
  } from 'ordering-components/native';
15
17
  import {
16
18
  CenterView,
@@ -23,6 +25,7 @@ import { LogoutButton } from '../LogoutButton';
23
25
  import { LanguageSelector } from '../LanguageSelector';
24
26
  import { UserFormDetailsUI } from '../UserFormDetails';
25
27
  import { DriverSchedule } from '../DriverSchedule'
28
+ import { PrinterSettings } from '../PrinterSettings'
26
29
  import ToggleSwitch from 'toggle-switch-react-native';
27
30
  import { UDWrapper } from '../UserFormDetails/styles';
28
31
  import {
@@ -39,7 +42,6 @@ import { NotFoundSource } from '../NotFoundSource';
39
42
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
40
43
  const ProfileUI = (props: ProfileParams) => {
41
44
  const {
42
- navigation,
43
45
  formState,
44
46
  isEdit,
45
47
  validationFields,
@@ -47,19 +49,21 @@ const ProfileUI = (props: ProfileParams) => {
47
49
  toggleIsEdit,
48
50
  cleanFormState,
49
51
  handleToggleAvalaibleStatusDriver,
50
- userState,
51
- isAvailableLoading,
52
- isAlsea
52
+ isAlsea,
53
+ isShowDriverStatus,
54
+ navigation
53
55
  } = props;
54
56
 
55
- const [{ user }] = useSession();
56
- const [state, t] = useLanguage();
57
+ const [{ user, sessionLoading }] = useSession();
58
+ const [, t] = useLanguage();
57
59
  const [, { showToast }] = useToast();
58
60
  const [{ optimizeImage }] = useUtils();
61
+ const [{ configs }] = useConfig();
62
+ const [{ loading }, { loadOriginalValidationFields }] = useValidationFields()
59
63
  const { errors } = useForm();
60
64
  const theme = useTheme();
61
65
 
62
- const [phoneInputData, setPhoneInputData] = useState({
66
+ const [phoneInputData, setPhoneInputData] = useState<any>({
63
67
  error: '',
64
68
  phone: {
65
69
  country_phone_code: null,
@@ -67,17 +71,15 @@ const ProfileUI = (props: ProfileParams) => {
67
71
  },
68
72
  });
69
73
  const [phoneUpdate, setPhoneUpdate] = useState(false);
74
+ const [userState, setUserState] = useState(props.userState)
70
75
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
71
76
  const [phoneToShow, setPhoneToShow] = useState('');
72
77
  const [openModal, setOpenModal] = useState(false)
73
-
78
+ const allowDriverUpdateData = user?.level !== 4 || configs?.allow_driver_update_data?.value === "1"
74
79
  useEffect(() => {
75
80
  if (phoneInputData.phone.cellphone) {
76
- const codeNumberPhone = phoneInputData.phone.cellphone.slice(0, 3);
77
- const numberPhone = phoneInputData.phone.cellphone.slice(
78
- 3,
79
- phoneInputData.phone.cellphone?.length,
80
- );
81
+ const codeNumberPhone = phoneInputData.phone.country_phone_code
82
+ const numberPhone = phoneInputData.phone.cellphone
81
83
  setPhoneToShow(`(${codeNumberPhone}) ${numberPhone}`);
82
84
  }
83
85
  }, [phoneInputData.phone.cellphone]);
@@ -115,14 +117,15 @@ const ProfileUI = (props: ProfileParams) => {
115
117
  maxWidth: 200,
116
118
  includeBase64: true,
117
119
  },
118
- (response: any) => {
119
- if (response.didCancel) {
120
+ (image: any) => {
121
+ const response = image?.assets?.[0];
122
+ if (response?.didCancel) {
120
123
  console.log('User cancelled image picker');
121
- } else if (response.errorMessage) {
124
+ } else if (response?.errorMessage) {
122
125
  console.log('ImagePicker Error: ', response.errorMessage);
123
126
  showToast(ToastType.Error, response.errorMessage);
124
127
  } else {
125
- if (response.uri) {
128
+ if (response?.uri) {
126
129
  const url = `data:${response.type};base64,${response.base64}`;
127
130
  handleButtonUpdateClick(null, true, url);
128
131
  } else {
@@ -206,6 +209,22 @@ const ProfileUI = (props: ProfileParams) => {
206
209
  }
207
210
  }, [user?.country_phone_code]);
208
211
 
212
+ useEffect(() => {
213
+ setUserState({ ...userState, ...props.userState })
214
+ }, [props.userState])
215
+
216
+ useEffect(() => {
217
+ if (!user?.id) return
218
+
219
+ setUserState({
220
+ ...userState,
221
+ result: {
222
+ error: true,
223
+ result: user
224
+ }
225
+ })
226
+ }, [user, props.isFocused])
227
+
209
228
  const styles = StyleSheet.create({
210
229
  label: {
211
230
  color: theme.colors.textGray,
@@ -242,19 +261,21 @@ const ProfileUI = (props: ProfileParams) => {
242
261
 
243
262
  return (
244
263
  <>
245
- {validationFields?.error && (
264
+ {validationFields?.error && !loading && (
246
265
  <NotFoundSource
247
266
  content={
248
- validationFields?.error[0] ||
249
- validationFields?.error[0]?.message ||
267
+ validationFields?.error?.[0] ||
268
+ validationFields?.error?.[0]?.message ||
250
269
  t('NETWORK_ERROR', 'Network Error')
251
270
  }
252
271
  image={theme.images.general.notFound}
253
272
  conditioned={false}
273
+ onClickButton={() => loadOriginalValidationFields({ forceLoading: true })}
274
+ btnTitle={t('REFRESH_PROFILE', 'Refresh profile')}
254
275
  />
255
276
  )}
256
277
 
257
- {(formState?.loading || state?.loading) && !validationFields.error && (
278
+ {(formState?.loading || sessionLoading) && !validationFields.error && (
258
279
  <View
259
280
  style={{
260
281
  backgroundColor: theme.colors.backgroundLight,
@@ -325,7 +346,7 @@ const ProfileUI = (props: ProfileParams) => {
325
346
  </View>
326
347
  )}
327
348
 
328
- {!formState?.loading && !state?.loading && !validationFields.error && (
349
+ {!(formState?.loading || sessionLoading) && !validationFields.error && (
329
350
  <ScrollView showsVerticalScrollIndicator={false} style={{ flex: 1 }}>
330
351
  <CenterView>
331
352
  <OIcon
@@ -335,14 +356,15 @@ const ProfileUI = (props: ProfileParams) => {
335
356
  height={150}
336
357
  style={{ borderRadius: 7.2 }}
337
358
  />
338
-
339
- <OIconButton
340
- icon={theme.images.general.camera}
341
- borderColor={theme.colors.clear}
342
- iconStyle={{ width: 21, height: 21 }}
343
- style={{ maxWidth: 40 }}
344
- onClick={() => handleImagePicker()}
345
- />
359
+ {allowDriverUpdateData && (
360
+ <OIconButton
361
+ icon={theme.images.general.camera}
362
+ borderColor={theme.colors.clear}
363
+ iconStyle={{ width: 21, height: 21 }}
364
+ style={{ maxWidth: 40 }}
365
+ onClick={() => handleImagePicker()}
366
+ />
367
+ )}
346
368
  </CenterView>
347
369
 
348
370
  {user?.level === 4 && (
@@ -353,29 +375,33 @@ const ProfileUI = (props: ProfileParams) => {
353
375
  adjustsFontSizeToFit
354
376
  style={{ ...styles.label, paddingHorizontal: 0 }}>
355
377
  {t(
356
- 'AVAILABLE_TO_RECEIVE_ORDERS',
357
- 'Available to receive orders',
378
+ `${!isShowDriverStatus ? 'NOT_' : ''}AVAILABLE_TO_RECEIVE_ORDERS`,
379
+ `${!isShowDriverStatus ? 'You are not ' : ''}Available to receive orders`
358
380
  )}
359
381
  </OText>
360
382
  </View>
361
383
 
362
- {userState.loadingDriver ? (
363
- <ActivityIndicator size="small" color={theme.colors.primary} />
364
- ) : (
365
- <ToggleSwitch
366
- isOn={userState?.result?.result?.available}
367
- onColor={theme.colors.primary}
368
- offColor={theme.colors.offColor}
369
- size="small"
370
- onToggle={() =>
371
- handleToggleAvalaibleStatusDriver &&
372
- handleToggleAvalaibleStatusDriver(
373
- !userState?.result?.result?.available,
374
- )
375
- }
376
- disabled={userState?.loading}
377
- animationSpeed={200}
378
- />
384
+ {isShowDriverStatus && (
385
+ <>
386
+ {userState.loadingDriver ? (
387
+ <ActivityIndicator size="small" color={theme.colors.primary} />
388
+ ) : (
389
+ <ToggleSwitch
390
+ isOn={userState?.result?.result?.available}
391
+ onColor={theme.colors.primary}
392
+ offColor={theme.colors.offColor}
393
+ size="small"
394
+ onToggle={() =>
395
+ handleToggleAvalaibleStatusDriver &&
396
+ handleToggleAvalaibleStatusDriver(
397
+ !userState?.result?.result?.available,
398
+ )
399
+ }
400
+ disabled={userState?.loading}
401
+ animationSpeed={200}
402
+ />
403
+ )}
404
+ </>
379
405
  )}
380
406
  </EnabledStatusDriver>
381
407
  )}
@@ -438,7 +464,6 @@ const ProfileUI = (props: ProfileParams) => {
438
464
  />
439
465
 
440
466
  <OText style={styles.label}>{t('PHONE', 'Phone')}</OText>
441
-
442
467
  <OInput
443
468
  isSecured={true}
444
469
  placeholder={
@@ -464,7 +489,7 @@ const ProfileUI = (props: ProfileParams) => {
464
489
  />
465
490
  </View>
466
491
  )}
467
- {!validationFields.loading && !isEdit && (
492
+ {!validationFields.loading && !isEdit && allowDriverUpdateData && (
468
493
  <EditButton>
469
494
  <OButton
470
495
  text={t('EDIT', 'Edit')}
@@ -478,7 +503,7 @@ const ProfileUI = (props: ProfileParams) => {
478
503
  />
479
504
  </EditButton>
480
505
  )}
481
- {!!user?.schedule && (
506
+ {!props.isBusinessApp ? (
482
507
  <Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
483
508
  <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
484
509
  <OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
@@ -490,7 +515,30 @@ const ProfileUI = (props: ProfileParams) => {
490
515
  marginTop: 10
491
516
  }} />
492
517
  </Pressable>
518
+ ) : (
519
+ <Pressable style={{ marginBottom: 10 }} onPress={() => navigation.navigate('PrinterSetup')}>
520
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
521
+ <OText size={16}>{t('PRINTER_SETTINGS', 'Printer Settings')}</OText>
522
+ <AntDesignIcon size={18} name='right' />
523
+ </View>
524
+ <View style={{
525
+ borderBottomColor: theme.colors.tabBar,
526
+ borderBottomWidth: 1,
527
+ marginTop: 10
528
+ }} />
529
+ </Pressable>
493
530
  )}
531
+ <Pressable style={{ marginBottom: 10 }} onPress={() => navigation.navigate('Sessions')}>
532
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
533
+ <OText size={16}>{t('SESSIONS', 'Sessions')}</OText>
534
+ <AntDesignIcon size={18} name='right' />
535
+ </View>
536
+ <View style={{
537
+ borderBottomColor: theme.colors.tabBar,
538
+ borderBottomWidth: 1,
539
+ marginTop: 10
540
+ }} />
541
+ </Pressable>
494
542
  <Actions>
495
543
  <LanguageSelector />
496
544
 
@@ -502,7 +550,9 @@ const ProfileUI = (props: ProfileParams) => {
502
550
  entireModal
503
551
  hideIcons
504
552
  >
505
- <DriverSchedule schedule={user?.schedule} />
553
+ {!props.isBusinessApp && (
554
+ <DriverSchedule schedule={user?.schedule} />
555
+ )}
506
556
  </OModal>
507
557
  </ScrollView>
508
558
  )}
@@ -0,0 +1,171 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useUtils, WebsocketStatus as WebsocketStatusController } from 'ordering-components/native'
3
+ import { TouchableOpacity, View, StyleSheet } from 'react-native'
4
+ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
5
+ import { useTheme } from 'styled-components/native'
6
+ import RNRestart from 'react-native-restart'
7
+ import { OModal, OButton, OText, OIcon } from '../shared'
8
+
9
+ import {
10
+ Container,
11
+ ModalContainer,
12
+ ModalTitle,
13
+ StatusItemWrapper,
14
+ StatusText
15
+ } from './styles'
16
+
17
+ const SocketStatusUI = (props: any) => {
18
+ const {
19
+ socketStatus,
20
+ connectedDate
21
+ } = props
22
+
23
+ const theme = useTheme()
24
+ const [, t] = useLanguage()
25
+ const [{ parseDate }] = useUtils()
26
+ const [openModal, setOpenModal] = useState(false)
27
+
28
+ const styles = StyleSheet.create({
29
+ btnBackArrow: {
30
+ borderWidth: 0,
31
+ width: 32,
32
+ height: 32,
33
+ tintColor: theme.colors.textGray,
34
+ backgroundColor: theme.colors.clear,
35
+ borderColor: theme.colors.clear,
36
+ shadowColor: theme.colors.clear,
37
+ paddingLeft: 0,
38
+ paddingRight: 0,
39
+ marginBottom: 30,
40
+ marginTop: 30
41
+ },
42
+ })
43
+
44
+ const getStatusColor = (status: number) => {
45
+ switch (status) {
46
+ case 0:
47
+ return '#FF9922';
48
+ case 1:
49
+ return '#00D27A';
50
+ case 2:
51
+ return '#E63757';
52
+ default:
53
+ return '#FF9922';
54
+ }
55
+ }
56
+
57
+ return (
58
+ <Container>
59
+ <TouchableOpacity
60
+ style={{
61
+ flexDirection: 'row',
62
+ alignItems: 'center',
63
+ justifyContent: 'center',
64
+ backgroundColor: theme.colors.inputChat,
65
+ borderRadius: 7.6,
66
+ marginVertical: 10,
67
+ paddingVertical: 10,
68
+ paddingHorizontal: 15,
69
+ }}
70
+ activeOpacity={0.6}
71
+ onPress={() => setOpenModal(true)}
72
+ >
73
+ <OText
74
+ style={{ color: theme.colors.backArrow, fontSize: 16, marginBottom: 0, lineHeight: 16 }}
75
+ >
76
+ {t('CONNECTION_STATUS_SHORT', 'Status')}
77
+ </OText>
78
+ <MaterialIcon
79
+ name='circle'
80
+ size={12}
81
+ color={getStatusColor(socketStatus)}
82
+ style={{ marginLeft: 8 }}
83
+ />
84
+ </TouchableOpacity>
85
+
86
+ <OModal
87
+ open={openModal}
88
+ onClose={() => setOpenModal(false)}
89
+ entireModal
90
+ customClose
91
+ >
92
+ <ModalContainer nestedScrollEnabled={true}>
93
+ <TouchableOpacity
94
+ onPress={() => setOpenModal(false)}
95
+ style={styles.btnBackArrow}
96
+ >
97
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
98
+ </TouchableOpacity>
99
+ <View>
100
+ <ModalTitle>{t('CONNECTION_STATUS', 'Connection status')}</ModalTitle>
101
+ <OText style={{ marginBottom: 20 }}>
102
+ {t('LAST_UPDATE', 'Last update')}: {parseDate(connectedDate)}
103
+ </OText>
104
+ <StatusItemWrapper>
105
+ <MaterialIcon
106
+ name='circle'
107
+ size={12}
108
+ color={getStatusColor(1)}
109
+ style={{ marginTop: 10, marginHorizontal: 8 }}
110
+ />
111
+ <View style={{ marginLeft: 16 }}>
112
+ <StatusText>{t('OK', 'Ok')}</StatusText>
113
+ <OText style={{ color: theme.colors.backArrow, fontSize: 14 }}>{t('WEBSOCKET_OK', 'The websocket works normally.')}</OText>
114
+ </View>
115
+ </StatusItemWrapper>
116
+ <StatusItemWrapper>
117
+ <MaterialIcon
118
+ name='circle'
119
+ size={12}
120
+ color={getStatusColor(0)}
121
+ style={{ marginTop: 10, marginHorizontal: 8 }}
122
+ />
123
+ <View style={{ marginLeft: 16 }}>
124
+ <StatusText>{t('CONNECTING', 'Connecting')}</StatusText>
125
+ <OText style={{ color: theme.colors.backArrow, fontSize: 14 }}>{t('WEBSOCKET_CONNECTING', 'The websocket is connecting.')}</OText>
126
+ </View>
127
+ </StatusItemWrapper>
128
+ <StatusItemWrapper>
129
+ <MaterialIcon
130
+ name='circle'
131
+ size={12}
132
+ color={getStatusColor(2)}
133
+ style={{ marginTop: 10, marginHorizontal: 8 }}
134
+ />
135
+ <View style={{ marginLeft: 16 }}>
136
+ <StatusText>{t('DISCONNECTED', 'Disconnected')}</StatusText>
137
+ <OText style={{ color: theme.colors.backArrow, fontSize: 14 }}>{t('WEBSOCKET_DISCONNECTED', 'The server is slow, please reload.')}</OText>
138
+ </View>
139
+ </StatusItemWrapper>
140
+
141
+ <View style={{ flexDirection: 'row', marginTop: 50 }}>
142
+ <OButton
143
+ onClick={() => setOpenModal(false)}
144
+ bgColor={theme.colors.white}
145
+ borderColor={theme.colors.primary}
146
+ textStyle={{ color: theme.colors.primary }}
147
+ style={{ borderRadius: 8, height: 48 }}
148
+ text={t('CLOSE', 'Close')}
149
+ />
150
+ <OButton
151
+ onClick={() => RNRestart.Restart()}
152
+ borderColor={theme.colors.primary}
153
+ textStyle={{ color: theme.colors.white }}
154
+ style={{ borderRadius: 8, marginLeft: 16, height: 48 }}
155
+ text={t('UPDATE', 'Update')}
156
+ />
157
+ </View>
158
+ </View>
159
+ </ModalContainer>
160
+ </OModal>
161
+ </Container>
162
+ )
163
+ }
164
+
165
+ export const WebsocketStatus = (props: any) => {
166
+ const socketProps = {
167
+ ...props,
168
+ UIComponent: SocketStatusUI
169
+ }
170
+ return <WebsocketStatusController {...socketProps} />
171
+ }
@@ -0,0 +1,28 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ display: flex;
5
+ flex-direction: column;
6
+ `
7
+ export const ModalContainer = styled.ScrollView`
8
+ padding: 0px 30px;
9
+ `
10
+ export const ModalTitle = styled.Text`
11
+ font-family: Poppins;
12
+ font-style: normal;
13
+ font-weight: bold;
14
+ font-size: 20px;
15
+ color: ${(props: any) => props.theme.colors.textGray};
16
+ margin-bottom: 10px;
17
+ `
18
+ export const StatusItemWrapper = styled.View`
19
+ flex-direction: row;
20
+ margin-bottom: 16px;
21
+ `
22
+ export const StatusText = styled.Text`
23
+ font-family: Poppins;
24
+ font-style: normal;
25
+ font-weight: 500;
26
+ font-size: 18px;
27
+ color: ${(props: any) => props.theme.colors.textGray};
28
+ `
@@ -64,6 +64,7 @@ interface Props extends TextInputProps {
64
64
  onSubmitEditing?: any;
65
65
  blurOnSubmit?: any;
66
66
  color?: any;
67
+ isValueSync?: boolean
67
68
  }
68
69
 
69
70
  const OInput = (props: Props): React.ReactElement => {
@@ -118,6 +119,7 @@ const OInput = (props: Props): React.ReactElement => {
118
119
  selectionColor={props.selectionColor}
119
120
  color={props.color}
120
121
  maxLength={props.maxLength || 1000}
122
+ value={props.isValueSync && props.value}
121
123
  />
122
124
 
123
125
  {props.iconRight && (
@@ -48,8 +48,8 @@ export const useLocation = () => {
48
48
  GeoLocation.getCurrentPosition(
49
49
  ({ coords }) => {
50
50
  resolve({
51
- latitude: coords.latitude,
52
- longitude: coords.longitude,
51
+ latitude: typeof coords.latitude === 'number' && !Number.isNaN(coords.latitude) ? coords.latitude : 0,
52
+ longitude: typeof coords.longitude === 'number' && !Number.isNaN(coords.longitude) ? coords.longitude : 0,
53
53
  speed: coords.speed,
54
54
  });
55
55
  },
@@ -63,9 +63,10 @@ export const useLocation = () => {
63
63
  watchId.current = GeoLocation.watchPosition(
64
64
  ({ coords }) => {
65
65
  if (!isMounted.current) return;
66
+ if (typeof coords.latitude !== 'number' || typeof coords.longitude !== 'number') return
66
67
  const location: Location = {
67
- latitude: coords.latitude,
68
- longitude: coords.longitude,
68
+ latitude: coords.latitude || 0,
69
+ longitude: coords.longitude || 0,
69
70
  speed: coords.speed,
70
71
  };
71
72
  setUserLocation(location);
@@ -57,6 +57,9 @@ export interface ProfileParams {
57
57
  showField?: any;
58
58
  isRequiredField?: any;
59
59
  isAlsea?: boolean;
60
+ isShowDriverStatus?: boolean;
61
+ isFocused?: boolean;
62
+ isBusinessApp?: boolean;
60
63
  }
61
64
 
62
65
  export interface AddressListParams {
@@ -172,6 +175,7 @@ export interface BusinessControllerParams {
172
175
  isBusinessOpen?: boolean;
173
176
  businessWillCloseSoonMinutes?: number;
174
177
  updateBusiness?: (id: any, value: any) => {};
178
+ navigation?: any;
175
179
  }
176
180
  export interface BusinessProductsListingParams {
177
181
  navigation?: any;
@@ -300,6 +304,7 @@ export interface OrdersOptionParams {
300
304
  filtered?: any;
301
305
  handleClickOrder?: any;
302
306
  orderGroupStatusCustom?: {
307
+ active?: Array<number>;
303
308
  pending?: Array<number>;
304
309
  inProgress?: Array<number>;
305
310
  completed?: Array<number>;
@@ -365,6 +370,12 @@ export interface PreviousMessagesParams {
365
370
  loadMessages?: (id: any) => {};
366
371
  handleReorder?: (order: any) => {};
367
372
  onNavigationRedirect?: (route: string, params?: any) => {};
373
+ getOrders?: any;
374
+ loading?: boolean;
375
+ reload?: boolean;
376
+ tabs?: any;
377
+ loadMore: any
378
+ error?: boolean
368
379
  }
369
380
  export interface OrderDetailsParams {
370
381
  handleUpdateLocationDriver?: () => {};
@@ -381,7 +392,7 @@ export interface OrderDetailsParams {
381
392
  urlToShare?: string;
382
393
  messages?: any;
383
394
  handleAssignDriver?: (id: any) => {};
384
- handleChangeOrderStatus?: (status: any) => {};
395
+ handleChangeOrderStatus?: (status: any, isAcceptOrReject: any) => {};
385
396
  order?: any;
386
397
  isFromRoot?: any;
387
398
  handleOrderRedirect?: () => {};
@@ -485,6 +496,7 @@ export interface FloatingButtonParams {
485
496
  firstColorCustom?: string;
486
497
  secondColorCustom?: string;
487
498
  paddingBottomIos?: any;
499
+ isHideRejectButtons?: boolean
488
500
  }
489
501
  export interface MomentOptionParams {
490
502
  navigation: any;
@@ -619,3 +631,11 @@ export interface OrderDetailsLogisticParams {
619
631
  orderAssingId: number,
620
632
  order: any
621
633
  }
634
+
635
+ export interface SessionsParams {
636
+ navigation: any,
637
+ sessionsList: any,
638
+ actionState: any,
639
+ handleDeleteSession: any,
640
+ handleDeleteAllSessions: any
641
+ }
@@ -146,6 +146,11 @@ export const transformCountryCode = (countryCode: number) => {
146
146
  return code?.countryCode;
147
147
  };
148
148
 
149
+ export const findExitingCode = (countryCode: string) => {
150
+ const code = CODES.find((code: any) => code.countryCode === (countryCode || '').toUpperCase())
151
+ return code?.countryCode
152
+ }
153
+
149
154
  /**
150
155
  * Function to check if a number is decimal or not
151
156
  * @param {*} value number to check if decimal or not
@@ -31,7 +31,8 @@ const CheckoutUI = (props: any) => {
31
31
  paymethodSelected,
32
32
  handlePaymethodChange,
33
33
  handlerClickPlaceOrder,
34
- onNavigationRedirect
34
+ onNavigationRedirect,
35
+ isKiosk
35
36
  } = props
36
37
 
37
38
  const [errorCash, setErrorCash] = useState(false);
@@ -68,6 +69,7 @@ const CheckoutUI = (props: any) => {
68
69
  isLoading={cartState.loading || businessDetails.loading}
69
70
  paymethods={businessDetails?.business?.paymethods}
70
71
  setErrorCash={setErrorCash}
72
+ isKiosk={isKiosk}
71
73
  />
72
74
  </>
73
75
  )
@@ -84,7 +86,7 @@ export const Checkout = (props: any) => {
84
86
  const [, { showToast }] = useToast();
85
87
  const [{ token }] = useSession();
86
88
  const [ordering] = useApi();
87
- const [,{ confirmCart }] = useOrder();
89
+ const [, { confirmCart }] = useOrder();
88
90
 
89
91
  const [cartState, setCartState] = useState<any>({ loading: true, error: [], cart: null });
90
92
 
@@ -109,7 +111,7 @@ export const Checkout = (props: any) => {
109
111
  const confirmCartRes = await confirmCart(cartUuid)
110
112
  if (confirmCartRes.error) {
111
113
  showToast(ToastType.Error, confirmCartRes.error.message)
112
- }getOrder
114
+ } getOrder
113
115
  getOrder
114
116
  if (confirmCartRes.result.order?.uuid) {
115
117
  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: 20 }}
84
+ textStyle={{ color: theme.colors.primary, fontSize: 18 }}
85
85
  parentStyle={{
86
86
  height: orientationState?.orientation === PORTRAIT
87
87
  ? 50 : 100