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
@@ -1,8 +1,13 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
1
+ import React, { useState, useEffect, useCallback, useRef } from 'react';
2
+ import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
+ import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
4
5
  import Picker from 'react-native-country-picker-modal';
5
6
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
7
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { useIsFocused } from '@react-navigation/native';
9
+
10
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
6
11
  import {
7
12
  Checkout as CheckoutController,
8
13
  useOrder,
@@ -44,17 +49,20 @@ import {
44
49
  DeliveryOptionsContainer,
45
50
  DeliveryOptionItem,
46
51
  WalletPaymentOptionContainer,
47
- CartHeader
52
+ CartHeader,
53
+ TopHeader,
54
+ TopActions
48
55
  } from './styles';
49
56
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
50
-
51
57
  import { FloatingButton } from '../FloatingButton';
52
58
  import { Container } from '../../layouts/Container';
53
59
  import NavBar from '../NavBar';
54
60
  import { OrderSummary } from '../OrderSummary';
55
- import { getTypesText, vibrateApp } from '../../utils';
61
+ import { getTypesText } from '../../utils';
56
62
  import { CartStoresListing } from '../CartStoresListing';
57
63
  import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
64
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
65
+ const { useDeviceOrientation } = DeviceOrientationMethods
58
66
 
59
67
  const mapConfigs = {
60
68
  mapZoom: 16,
@@ -93,10 +101,14 @@ const CheckoutUI = (props: any) => {
93
101
  currency,
94
102
  merchantId,
95
103
  setPlaceSpotNumber,
96
- maxDate
104
+ maxDate,
105
+ androidAppId,
106
+ urlscheme,
107
+ checkoutFieldsState
97
108
  } = props
98
109
 
99
110
  const theme = useTheme();
111
+ const isFocused = useIsFocused();
100
112
 
101
113
  const styles = StyleSheet.create({
102
114
  btnBackArrow: {
@@ -112,7 +124,7 @@ const CheckoutUI = (props: any) => {
112
124
  padding: 20
113
125
  },
114
126
  pagePadding: {
115
- paddingHorizontal: 40
127
+ paddingHorizontal: 20
116
128
  },
117
129
  icon: {
118
130
  top: 15,
@@ -121,13 +133,14 @@ const CheckoutUI = (props: any) => {
121
133
  fontSize: 20
122
134
  },
123
135
  detailWrapper: {
124
- paddingHorizontal: 40,
136
+ paddingHorizontal: 20,
125
137
  width: '100%'
126
138
  },
127
139
  wrapperNavbar: {
128
- paddingVertical: 0,
129
- paddingHorizontal: 40,
130
- marginVertical: 2
140
+ paddingVertical: 2,
141
+ paddingHorizontal: 20,
142
+ backgroundColor: theme?.colors?.white,
143
+ borderWidth: 0
131
144
  }
132
145
  })
133
146
 
@@ -140,6 +153,10 @@ const CheckoutUI = (props: any) => {
140
153
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
141
154
  const [validationFields] = useValidationFields();
142
155
  const [events] = useEvent()
156
+ const [orientationState] = useDeviceOrientation();
157
+ const [isReadMore, setIsReadMore] = useState(false)
158
+ const [lengthMore, setLengthMore] = useState(false)
159
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
143
160
 
144
161
  const [errorCash, setErrorCash] = useState(false);
145
162
  const [userErrors, setUserErrors] = useState<any>([]);
@@ -147,17 +164,24 @@ const CheckoutUI = (props: any) => {
147
164
  const [phoneUpdate, setPhoneUpdate] = useState(false);
148
165
  const [openChangeStore, setOpenChangeStore] = useState(false)
149
166
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
150
- const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
167
+ const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
151
168
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
152
169
  const [isOpen, setIsOpen] = useState(false)
153
170
  const [requiredFields, setRequiredFields] = useState<any>([])
154
- const [openModal, setOpenModal] = useState({ login: false, signup: false })
171
+ const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
155
172
  const [allowedGuest, setAllowedGuest] = useState(false)
156
173
  const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
157
174
  const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
175
+ const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
176
+ const [showTitle, setShowTitle] = useState(false)
177
+ const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
178
+ const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
179
+ const containerRef = useRef<any>()
180
+ const cardsMethods = ['credomatic']
181
+ const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
182
+ const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
158
183
  const placeSpotTypes = [3, 4, 5]
159
184
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
160
- const isGiftCardCart = !cart?.business_id
161
185
  const businessConfigs = businessDetails?.business?.configs ?? []
162
186
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
163
187
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
@@ -181,14 +205,21 @@ const CheckoutUI = (props: any) => {
181
205
  }, cart?.subtotal)
182
206
 
183
207
  const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
208
+ const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
209
+ validationFields?.fields?.card?.zipcode?.required &&
210
+ paymethodSelected?.data?.card &&
211
+ !paymethodSelected?.data?.card?.zipcode &&
212
+ paymethodSelected?.gateway === 'stripe'
184
213
 
185
214
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
186
215
  placing || errorCash || subtotalWithTaxes < cart?.minimum ||
187
- (options.type === 1 &&
216
+ (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
217
+ (options.type === 1 && !isGiftCardCart &&
188
218
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
189
219
  validationFields?.fields?.checkout?.driver_tip?.required &&
190
220
  (Number(cart?.driver_tip) <= 0)) ||
191
- (validateCommentsCartField)
221
+ (validateCommentsCartField) ||
222
+ (validateZipcodeCard)
192
223
  || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
193
224
 
194
225
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
@@ -199,6 +230,9 @@ const CheckoutUI = (props: any) => {
199
230
 
200
231
  const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
201
232
 
233
+ const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
234
+ const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
235
+ const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
202
236
  const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
203
237
  return {
204
238
  value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
@@ -211,12 +245,21 @@ const CheckoutUI = (props: any) => {
211
245
  }
212
246
  }
213
247
 
248
+ const vibrateApp = (impact?: string) => {
249
+ const options = {
250
+ enableVibrateFallback: true,
251
+ ignoreAndroidSystemSettings: false
252
+ };
253
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
254
+ }
255
+
214
256
  const handleSuccessSignup = (user: any) => {
215
257
  login({
216
258
  user,
217
259
  token: user?.session?.access_token
218
260
  })
219
- setOpenModal({ ...openModal, signup: false })
261
+ openModal?.isGuest && handlePlaceOrderAsGuest()
262
+ setOpenModal({ ...openModal, signup: false, isGuest: false })
220
263
  }
221
264
 
222
265
  const handleSuccessLogin = (user: any) => {
@@ -224,9 +267,14 @@ const CheckoutUI = (props: any) => {
224
267
  }
225
268
 
226
269
  const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
227
- if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
270
+ if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
271
+ setOpenModal({ ...openModal, signup: true, isGuest: true })
272
+ return
273
+ }
274
+
275
+ if (!userErrors.length && (!requiredFields?.length) || forcePlace) {
228
276
  vibrateApp()
229
- handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
277
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
230
278
  return
231
279
  }
232
280
  if (requiredFields?.length) {
@@ -264,7 +312,6 @@ const CheckoutUI = (props: any) => {
264
312
  const checkValidationFields = () => {
265
313
  setUserErrors([])
266
314
  const errors = []
267
- const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
268
315
  const _requiredFields: any = []
269
316
 
270
317
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
@@ -292,16 +339,46 @@ const CheckoutUI = (props: any) => {
292
339
  setUserErrors(errors)
293
340
  }
294
341
 
342
+ const checkGuestValidationFields = () => {
343
+ const userSelected = user
344
+ const _requiredFields = checkoutFieldsState?.fields
345
+ .filter((field: any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required &&
346
+ !notFields.includes(field?.validation_field?.code) &&
347
+ userSelected && !userSelected[field?.validation_field?.code])
348
+ .map((item: any) => item?.validation_field?.code)
349
+ const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
350
+
351
+ if (
352
+ userSelected &&
353
+ !userSelected?.cellphone &&
354
+ ((guestCheckoutCellPhone?.enabled &&
355
+ guestCheckoutCellPhone?.required) ||
356
+ configs?.verification_phone_required?.value === '1')
357
+ ) {
358
+ _requiredFields.push('cellphone')
359
+ }
360
+ setRequiredFields(_requiredFields)
361
+ }
362
+
295
363
  const togglePhoneUpdate = (val: boolean) => {
296
364
  setPhoneUpdate(val)
297
365
  }
298
366
 
367
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
368
+ setShowTitle(contentOffset.y > 30)
369
+ }
370
+
299
371
  useEffect(() => {
300
- if (validationFields && validationFields?.fields?.checkout) {
372
+ if (validationFields && validationFields?.fields?.checkout && !user?.guest_id) {
301
373
  checkValidationFields()
302
374
  }
303
375
  }, [validationFields, user])
304
376
 
377
+ useEffect(() => {
378
+ if (checkoutFieldsState?.loading || !user?.guest_id) return
379
+ checkGuestValidationFields()
380
+ }, [user, checkoutFieldsState])
381
+
305
382
  useEffect(() => {
306
383
  if (errors) {
307
384
  const errorText = manageErrorsToShow(errors)
@@ -311,13 +388,23 @@ const CheckoutUI = (props: any) => {
311
388
 
312
389
  useEffect(() => {
313
390
  if (cart?.products?.length === 0) {
314
- if (cart?.business?.slug) {
315
- onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
316
- } else {
391
+ if (cart?.business_id !== null) {
392
+ onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
393
+ } else if (isGiftCardCart) {
317
394
  onNavigationRedirect('Wallets')
318
395
  }
319
396
  }
320
- }, [cart?.products])
397
+ }, [cart?.products?.length])
398
+
399
+ useEffect(() => {
400
+ if (cart?.products?.length > 0) {
401
+ if (cart?.uuid && cart?.business_id === null) {
402
+ setIsGiftCardCart(true)
403
+ } else {
404
+ setIsGiftCardCart(false)
405
+ }
406
+ }
407
+ }, [cart?.uuid, cart?.products?.length])
321
408
 
322
409
  useEffect(() => {
323
410
  onFailPaypal()
@@ -342,11 +429,84 @@ const CheckoutUI = (props: any) => {
342
429
  cart && events.emit('checkout_started', cart)
343
430
  }, [])
344
431
 
432
+ useEffect(() => {
433
+ if (cart?.paymethod_data?.gateway === 'credomatic') {
434
+ if (cart?.paymethod_data?.status === 2) {
435
+ setShowGateway({ ...showGateway, open: true })
436
+ } else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
437
+ setShowGateway({ ...showGateway, open: false })
438
+ }
439
+ }
440
+ }, [cart?.paymethod_data])
441
+
442
+ const onTextLayout = useCallback((e: any) => {
443
+ setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
444
+ }, [])
445
+
446
+ useEffect(() => {
447
+ if (!isFocused) return
448
+ if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
449
+ const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
450
+ if (error) {
451
+ showToast(ToastType.Error, cartState?.error || cartState.cart)
452
+ navigation.navigate('BusinessList')
453
+ }
454
+ }
455
+ }, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
456
+
457
+ useEffect(() => {
458
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
459
+ containerRef?.current?.scrollToEnd && containerRef.current.scrollToEnd({ animated: true })
460
+ })
461
+ return () => {
462
+ keyboardDidShowListener.remove()
463
+ }
464
+ }, [])
465
+
466
+ useEffect(() => {
467
+ const onBackFunction = () => {
468
+ if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
469
+ setShowGateway({ open: false, closedByUser: true })
470
+ return true
471
+ } else {
472
+ return false
473
+ }
474
+ }
475
+ BackHandler.addEventListener('hardwareBackPress', onBackFunction)
476
+ return () => {
477
+ BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
478
+ }
479
+ }, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
480
+
345
481
  return (
346
482
  <>
347
- <Container noPadding>
483
+ <SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
484
+ <View style={styles.wrapperNavbar}>
485
+ <TopHeader>
486
+ <TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
487
+ <IconAntDesign
488
+ name='arrowleft'
489
+ size={26}
490
+ />
491
+ </TopActions>
492
+ {showTitle && (
493
+ <OText
494
+ size={16}
495
+ style={{ flex: 1, textAlign: 'center', right: 15 }}
496
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
497
+ numberOfLines={2}
498
+ ellipsizeMode='tail'
499
+ >
500
+ {t('CHECKOUT', 'Checkout')}
501
+ </OText>
502
+ )}
503
+ </TopHeader>
504
+ </View>
505
+ </SafeAreaView>
506
+ <Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
348
507
  <View style={styles.wrapperNavbar}>
349
508
  <NavBar
509
+ hideArrowLeft
350
510
  title={t('CHECKOUT', 'Checkout')}
351
511
  titleAlign={'center'}
352
512
  onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
@@ -358,44 +518,46 @@ const CheckoutUI = (props: any) => {
358
518
  />
359
519
  </View>
360
520
  <ChContainer style={styles.pagePadding}>
361
- <ChSection style={{ paddingTop: 0 }}>
362
- <ChHeader>
363
- <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
364
- <OText
365
- size={12}
366
- numberOfLines={1}
367
- ellipsizeMode={'tail'}
368
- color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
369
- >
370
- {t(getTypesText(options?.type || 1), 'Delivery')}
371
- </OText>
372
- <OIcon
373
- src={theme.images.general.arrow_down}
374
- width={10}
375
- style={{ marginStart: 8 }}
376
- {...(isChewLayout && { color: 'white' })}
377
- />
378
- </CHMomentWrapper>
379
- <CHMomentWrapper
380
- onPress={() => handleMomentClick()}
381
- disabled={loading}
382
- >
383
- <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
384
- {options?.moment
385
- ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
386
- : t('ASAP_ABBREVIATION', 'ASAP')}
387
- </OText>
388
- {isPreOrder && (
521
+ {!isGiftCardCart && (
522
+ <ChSection style={{ paddingTop: 0 }}>
523
+ <ChHeader>
524
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
525
+ <OText
526
+ size={12}
527
+ numberOfLines={1}
528
+ ellipsizeMode={'tail'}
529
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
530
+ >
531
+ {t(getTypesText(options?.type || 1), 'Delivery')}
532
+ </OText>
389
533
  <OIcon
390
534
  src={theme.images.general.arrow_down}
391
535
  width={10}
392
536
  style={{ marginStart: 8 }}
537
+ {...(isChewLayout && { color: 'white' })}
393
538
  />
394
- )}
395
- </CHMomentWrapper>
396
- </ChHeader>
397
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
398
- </ChSection>
539
+ </CHMomentWrapper>
540
+ <CHMomentWrapper
541
+ onPress={() => handleMomentClick()}
542
+ disabled={loading}
543
+ >
544
+ <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
545
+ {options?.moment
546
+ ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
547
+ : t('ASAP_ABBREVIATION', 'ASAP')}
548
+ </OText>
549
+ {isPreOrder && (
550
+ <OIcon
551
+ src={theme.images.general.arrow_down}
552
+ width={10}
553
+ style={{ marginStart: 8 }}
554
+ />
555
+ )}
556
+ </CHMomentWrapper>
557
+ </ChHeader>
558
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
559
+ </ChSection>
560
+ )}
399
561
 
400
562
  {!isGiftCardCart && !hideBusinessDetails && (
401
563
  <ChSection>
@@ -433,6 +595,25 @@ const CheckoutUI = (props: any) => {
433
595
  {businessDetails?.business?.address}
434
596
  </OText>
435
597
  )}
598
+ {businessDetails?.business?.address_notes && (
599
+ <>
600
+ <OText
601
+ size={12}
602
+ lineHeight={18}
603
+ numberOfLines={isReadMore ? 20 : 3}
604
+ onTextLayout={onTextLayout}
605
+ >
606
+ {businessDetails?.business?.address_notes}
607
+ </OText>
608
+ {lengthMore && (
609
+ <TouchableOpacity
610
+ onPress={() => setIsReadMore(!isReadMore)}
611
+ >
612
+ <OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
613
+ </TouchableOpacity>
614
+ )}
615
+ </>
616
+ )}
436
617
  </View>
437
618
  </>
438
619
  )}
@@ -466,13 +647,15 @@ const CheckoutUI = (props: any) => {
466
647
  <OButton
467
648
  text={t('SIGN_UP', 'Sign up')}
468
649
  textStyle={{ color: theme.colors.white }}
650
+ bgColor={theme.colors.primary}
651
+ borderColor={theme.colors.primary}
469
652
  style={{ borderRadius: 7.6, marginTop: 20 }}
470
653
  onClick={() => setOpenModal({ ...openModal, signup: true })}
471
654
  />
472
655
  <OButton
473
656
  text={t('LOGIN', 'Login')}
474
- textStyle={{ color: theme.colors.primary }}
475
- bgColor={theme.colors.white}
657
+ textStyle={{ color: theme.colors.white }}
658
+ bgColor={theme.colors.primary}
476
659
  borderColor={theme.colors.primary}
477
660
  style={{ borderRadius: 7.6, marginTop: 20 }}
478
661
  onClick={() => setOpenModal({ ...openModal, login: true })}
@@ -547,7 +730,7 @@ const CheckoutUI = (props: any) => {
547
730
  data: deliveryOptions || [],
548
731
  renderItem: ({ item }: any) => (
549
732
  <TouchableOpacity
550
- onPress={() => changeDeliveryOption(item.value)}
733
+ onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
551
734
  disabled={
552
735
  deliveryOptionSelected === item.value
553
736
  }
@@ -617,7 +800,7 @@ const CheckoutUI = (props: any) => {
617
800
  cart?.status !== 2 &&
618
801
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
619
802
  driverTipsOptions && driverTipsOptions?.length > 0 &&
620
- !isGiftCardCart &&
803
+ cart?.business_id &&
621
804
  (
622
805
  <ChSection>
623
806
  <ChDriverTips>
@@ -665,10 +848,18 @@ const CheckoutUI = (props: any) => {
665
848
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
666
849
  handlePlaceOrder={handlePlaceOrder}
667
850
  merchantId={merchantId}
851
+ urlscheme={urlscheme}
852
+ androidAppId={androidAppId}
668
853
  setMethodPaySupported={setMethodPaySupported}
669
854
  methodPaySupported={methodPaySupported}
670
855
  placeByMethodPay={placeByMethodPay}
671
856
  setPlaceByMethodPay={setPlaceByMethodPay}
857
+ cardList={cardList}
858
+ setCardList={setCardList}
859
+ requiredFields={requiredFields}
860
+ openUserModal={setIsOpen}
861
+ paymethodClicked={paymethodClicked}
862
+ setPaymethodClicked={setPaymethodClicked}
672
863
  />
673
864
  </ChPaymethods>
674
865
  </ChSection>
@@ -704,7 +895,7 @@ const CheckoutUI = (props: any) => {
704
895
  {!cartState.loading && cart && (
705
896
  <ChSection>
706
897
  <ChCart>
707
- {cartsWithProducts && cart?.products?.length === 0 ? (
898
+ {cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
708
899
  <NotFoundSource
709
900
  content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
710
901
  btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
@@ -782,13 +973,15 @@ const CheckoutUI = (props: any) => {
782
973
  </OText>
783
974
  )}
784
975
 
785
- {!cart?.valid_products && cart?.status !== 2 && (
786
- <OText
787
- color={theme.colors.error}
788
- size={12}
789
- >
790
- {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
791
- </OText>
976
+ {!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
977
+ <>
978
+ <OText
979
+ color={theme.colors.error}
980
+ size={12}
981
+ >
982
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
983
+ </OText>
984
+ </>
792
985
  )}
793
986
  {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
794
987
  <OText
@@ -798,7 +991,7 @@ const CheckoutUI = (props: any) => {
798
991
  {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
799
992
  </OText>
800
993
  )}
801
- {options.type === 1 &&
994
+ {options.type === 1 && !isGiftCardCart &&
802
995
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
803
996
  validationFields?.fields?.checkout?.driver_tip?.required &&
804
997
  (Number(cart?.driver_tip) <= 0) && (
@@ -818,6 +1011,15 @@ const CheckoutUI = (props: any) => {
818
1011
  {t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
819
1012
  </OText>
820
1013
  )}
1014
+
1015
+ {validateZipcodeCard && (
1016
+ <OText
1017
+ color={theme.colors.error}
1018
+ size={12}
1019
+ >
1020
+ {t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
1021
+ </OText>
1022
+ )}
821
1023
  </ChErrors>
822
1024
  </View>
823
1025
  )}
@@ -853,7 +1055,14 @@ const CheckoutUI = (props: any) => {
853
1055
  handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
854
1056
  onClose={() => {
855
1057
  setIsOpen(false)
856
- handlePlaceOrder(null, true)
1058
+ if (paymethodClicked) {
1059
+ setPaymethodClicked({
1060
+ ...paymethodClicked,
1061
+ confirmed: true
1062
+ })
1063
+ } else {
1064
+ handlePlaceOrder(null, true)
1065
+ }
857
1066
  }}
858
1067
  setIsOpen={setIsOpen}
859
1068
  />
@@ -861,7 +1070,7 @@ const CheckoutUI = (props: any) => {
861
1070
  </OModal>
862
1071
  <OModal
863
1072
  open={openModal.signup}
864
- onClose={() => setOpenModal({ ...openModal, signup: false })}
1073
+ onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
865
1074
  >
866
1075
  <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
867
1076
  <SignupForm
@@ -938,6 +1147,29 @@ const CheckoutUI = (props: any) => {
938
1147
  locationId={'L1NGAY5M6KJRX'}
939
1148
  />
940
1149
  )}
1150
+ {cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
1151
+ <PaymentOptionsWebView
1152
+ title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
1153
+ onNavigationRedirect={onNavigationRedirect}
1154
+ uri={credomaticUrl}
1155
+ user={user}
1156
+ cart={cart}
1157
+ additionalParams={{
1158
+ type: 'auth',
1159
+ key_id: credomaticKeyId,
1160
+ hash: cart?.paymethod_data?.result?.hash,
1161
+ time: cart?.paymethod_data?.result?.time,
1162
+ amount: cart?.total,
1163
+ orderid: cart?.uuid,
1164
+ ccnumber: cardList?.cards?.[0]?.number,
1165
+ ccexp: cardList?.cards?.[0]?.expiryString,
1166
+ cvv: cardList?.cards?.[0]?.cvc,
1167
+ redirect: credomaticUrl
1168
+ }}
1169
+ webviewPaymethod={webviewPaymethod}
1170
+ setShowGateway={setShowGateway}
1171
+ />
1172
+ )}
941
1173
  </>
942
1174
  )
943
1175
  }
@@ -964,7 +1196,8 @@ export const Checkout = (props: any) => {
964
1196
  const getOrder = async (cartId: any) => {
965
1197
  try {
966
1198
  let result: any = {}
967
- const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
1199
+ const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
1200
+ const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
968
1201
  if (cart) {
969
1202
  result = { ...cart }
970
1203
  } else {
@@ -113,3 +113,20 @@ export const CartHeader = styled.View`
113
113
  justify-content: space-between;
114
114
  margin-bottom: 10px;
115
115
  `
116
+
117
+ export const TopActions = styled.TouchableOpacity`
118
+ height: 60px;
119
+ justify-content: center;
120
+ min-width: 30px;
121
+ padding-right: 15px;
122
+ `;
123
+
124
+ export const TopHeader = styled.View`
125
+ width: 100%;
126
+ flex-direction: row;
127
+ align-items: center;
128
+ justify-content: space-between;
129
+ z-index: 1;
130
+ height: 60px;
131
+ min-height: 60px;
132
+ `
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 40px;
5
+ padding: 0 20px;
6
6
  justify-content: space-between;
7
7
  padding-bottom: 12px;
8
8