ordering-ui-react-native 0.17.50 → 0.17.51-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 (220) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/PhoneInputNumber/index.tsx +6 -2
  7. package/src/components/StripeMethodForm/index.tsx +136 -102
  8. package/src/components/VerifyPhone/styles.tsx +1 -2
  9. package/src/components/shared/OToast.tsx +4 -4
  10. package/src/types/index.tsx +5 -0
  11. package/src/utils/index.tsx +7 -1
  12. package/themes/business/index.tsx +2 -0
  13. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  14. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +125 -113
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +29 -2
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  21. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  22. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  23. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  24. package/themes/business/src/components/MapView/index.tsx +10 -10
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +31 -5
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +93 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  30. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  31. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  32. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  33. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  34. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  36. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  38. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  39. package/themes/business/src/components/ReviewCustomer/index.tsx +29 -14
  40. package/themes/business/src/components/StoresList/index.tsx +2 -2
  41. package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
  42. package/themes/business/src/components/shared/OLink.tsx +33 -13
  43. package/themes/business/src/components/shared/OModal.tsx +16 -9
  44. package/themes/business/src/components/shared/OText.tsx +8 -2
  45. package/themes/business/src/types/index.tsx +32 -2
  46. package/themes/business/src/utils/index.tsx +44 -1
  47. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  49. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  51. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  52. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  53. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  54. package/themes/kiosk/src/components/LoginForm/index.tsx +480 -156
  55. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  59. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  60. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  61. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  62. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  63. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  64. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  65. package/themes/kiosk/src/types/index.d.ts +13 -0
  66. package/themes/kiosk/src/utils/index.tsx +15 -0
  67. package/themes/original/index.tsx +4 -0
  68. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  69. package/themes/original/src/components/AddressForm/index.tsx +79 -44
  70. package/themes/original/src/components/AddressList/index.tsx +27 -22
  71. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  72. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  73. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  74. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +160 -91
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  77. package/themes/original/src/components/BusinessController/index.tsx +122 -68
  78. package/themes/original/src/components/BusinessController/styles.tsx +23 -4
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  81. package/themes/original/src/components/BusinessInformation/index.tsx +110 -108
  82. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +352 -326
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  85. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  86. package/themes/original/src/components/BusinessProductsList/index.tsx +23 -14
  87. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  88. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +668 -514
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  91. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +95 -80
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -11
  95. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  96. package/themes/original/src/components/Cart/index.tsx +100 -67
  97. package/themes/original/src/components/CartContent/index.tsx +115 -19
  98. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  99. package/themes/original/src/components/Checkout/index.tsx +367 -174
  100. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  101. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  102. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  103. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  104. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  105. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  106. package/themes/original/src/components/Favorite/index.tsx +8 -9
  107. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  108. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  109. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  110. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  111. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  112. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  113. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  114. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  115. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  116. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  117. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  118. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  119. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  120. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  121. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  122. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  123. package/themes/original/src/components/Help/index.tsx +8 -8
  124. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  125. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  126. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  127. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  128. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  129. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  130. package/themes/original/src/components/Home/index.tsx +13 -4
  131. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  132. package/themes/original/src/components/LoginForm/Otp/index.tsx +55 -13
  133. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  134. package/themes/original/src/components/LoginForm/index.tsx +64 -26
  135. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  136. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  137. package/themes/original/src/components/Messages/index.tsx +32 -10
  138. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  139. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  140. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
  141. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  142. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  143. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  144. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  145. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  146. package/themes/original/src/components/MyOrders/index.tsx +77 -52
  147. package/themes/original/src/components/NavBar/index.tsx +18 -18
  148. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  149. package/themes/original/src/components/Notifications/index.tsx +46 -50
  150. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  151. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  152. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  153. package/themes/original/src/components/OrderDetails/index.tsx +190 -358
  154. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  155. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  156. package/themes/original/src/components/OrderProgress/index.tsx +93 -114
  157. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  158. package/themes/original/src/components/OrderSummary/index.tsx +85 -57
  159. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  160. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  161. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  162. package/themes/original/src/components/OrdersOption/index.tsx +76 -66
  163. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  164. package/themes/original/src/components/PageBanner/index.tsx +107 -40
  165. package/themes/original/src/components/PageBanner/styles.tsx +4 -1
  166. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  167. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  168. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  169. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  170. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  171. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  172. package/themes/original/src/components/ProductForm/index.tsx +114 -36
  173. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  174. package/themes/original/src/components/ProductItemAccordion/index.tsx +22 -19
  175. package/themes/original/src/components/ProductOptionSubOption/index.tsx +24 -14
  176. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +3 -4
  177. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  178. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  179. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  180. package/themes/original/src/components/Promotions/index.tsx +234 -220
  181. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  182. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  183. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  184. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  185. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  186. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  187. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  188. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  189. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  190. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  191. package/themes/original/src/components/Sessions/index.tsx +11 -8
  192. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  193. package/themes/original/src/components/SignupForm/index.tsx +43 -20
  194. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  195. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  196. package/themes/original/src/components/SingleProductCard/index.tsx +72 -34
  197. package/themes/original/src/components/SingleProductCard/styles.tsx +22 -4
  198. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  199. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  200. package/themes/original/src/components/StripeElementsForm/index.tsx +67 -34
  201. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  202. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  203. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  204. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  205. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  206. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  207. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  208. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  209. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  210. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  211. package/themes/original/src/components/Wallets/index.tsx +67 -24
  212. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  213. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  214. package/themes/original/src/components/shared/OButton.tsx +6 -2
  215. package/themes/original/src/components/shared/OInput.tsx +16 -2
  216. package/themes/original/src/components/shared/OModal.tsx +3 -3
  217. package/themes/original/src/layouts/Container.tsx +1 -1
  218. package/themes/original/src/types/index.tsx +40 -11
  219. package/themes/original/src/utils/index.tsx +375 -58
  220. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,8 +1,9 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager } from 'react-native';
2
+ import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
4
  import Picker from 'react-native-country-picker-modal';
5
5
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
6
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
6
7
  import {
7
8
  Checkout as CheckoutController,
8
9
  useOrder,
@@ -14,9 +15,10 @@ import {
14
15
  useConfig,
15
16
  useToast,
16
17
  ToastType,
18
+ useEvent
17
19
  } from 'ordering-components/native';
18
20
  import { useTheme } from 'styled-components/native';
19
- import { OText, OIcon, OModal } from '../shared';
21
+ import { OText, OIcon, OModal, OButton } from '../shared';
20
22
 
21
23
  import { AddressDetails } from '../AddressDetails';
22
24
  import { PaymentOptions } from '../PaymentOptions';
@@ -25,6 +27,8 @@ import { NotFoundSource } from '../NotFoundSource';
25
27
  import { UserDetails } from '../UserDetails';
26
28
  import { PaymentOptionWallet } from '../PaymentOptionWallet';
27
29
  import { PlaceSpot } from '../PlaceSpot'
30
+ import { SignupForm } from '../SignupForm'
31
+ import { LoginForm } from '../LoginForm'
28
32
 
29
33
  import {
30
34
  ChContainer,
@@ -49,7 +53,7 @@ import { FloatingButton } from '../FloatingButton';
49
53
  import { Container } from '../../layouts/Container';
50
54
  import NavBar from '../NavBar';
51
55
  import { OrderSummary } from '../OrderSummary';
52
- import { getTypesText } from '../../utils';
56
+ import { getTypesText, vibrateApp } from '../../utils';
53
57
  import { CartStoresListing } from '../CartStoresListing';
54
58
  import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
55
59
 
@@ -78,6 +82,7 @@ const CheckoutUI = (props: any) => {
78
82
  placing,
79
83
  cartState,
80
84
  cartUuid,
85
+ loyaltyPlansState,
81
86
  businessDetails,
82
87
  paymethodSelected,
83
88
  handlePaymethodChange,
@@ -87,7 +92,9 @@ const CheckoutUI = (props: any) => {
87
92
  instructionsOptions,
88
93
  handleChangeDeliveryOption,
89
94
  currency,
90
- merchantId
95
+ merchantId,
96
+ setPlaceSpotNumber,
97
+ maxDate
91
98
  } = props
92
99
 
93
100
  const theme = useTheme();
@@ -127,12 +134,13 @@ const CheckoutUI = (props: any) => {
127
134
 
128
135
  const [, { showToast }] = useToast();
129
136
  const [, t] = useLanguage();
130
- const [{ user, token }] = useSession();
137
+ const [{ user, token }, { login }] = useSession();
131
138
  const [ordering] = useApi()
132
139
  const [{ configs }] = useConfig();
133
140
  const [{ parsePrice, parseDate }] = useUtils();
134
141
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
135
142
  const [validationFields] = useValidationFields();
143
+ const [events] = useEvent()
136
144
 
137
145
  const [errorCash, setErrorCash] = useState(false);
138
146
  const [userErrors, setUserErrors] = useState<any>([]);
@@ -144,23 +152,48 @@ const CheckoutUI = (props: any) => {
144
152
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
145
153
  const [isOpen, setIsOpen] = useState(false)
146
154
  const [requiredFields, setRequiredFields] = useState<any>([])
147
-
155
+ const [openModal, setOpenModal] = useState({ login: false, signup: false })
156
+ const [allowedGuest, setAllowedGuest] = useState(false)
157
+ const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
158
+ const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
159
+ const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
160
+ const cardsMethods = ['credomatic']
148
161
  const placeSpotTypes = [3, 4, 5]
149
162
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
163
+ const isGiftCardCart = !cart?.business_id
150
164
  const businessConfigs = businessDetails?.business?.configs ?? []
151
165
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
152
166
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
153
167
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
154
168
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
169
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
170
+ const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
171
+ const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
172
+ const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
173
+ const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
174
+
175
+ const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
176
+ const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
177
+ const methodsPay = ['google_pay', 'apple_pay']
155
178
 
156
179
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
180
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
181
+ if (item?.type === 1)
182
+ return acc = acc + item?.summary?.tax
183
+ return acc = acc
184
+ }, cart?.subtotal)
185
+
186
+ const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
187
+
157
188
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
158
- placing || errorCash || cart?.subtotal < cart?.minimum ||
159
- // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
189
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
190
+ (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
160
191
  (options.type === 1 &&
161
192
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
162
193
  validationFields?.fields?.checkout?.driver_tip?.required &&
163
- (Number(cart?.driver_tip) <= 0))
194
+ (Number(cart?.driver_tip) <= 0)) ||
195
+ (validateCommentsCartField)
196
+ || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
164
197
 
165
198
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
166
199
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -170,6 +203,9 @@ const CheckoutUI = (props: any) => {
170
203
 
171
204
  const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
172
205
 
206
+ const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
207
+ const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
208
+ const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
173
209
  const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
174
210
  return {
175
211
  value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
@@ -182,9 +218,30 @@ const CheckoutUI = (props: any) => {
182
218
  }
183
219
  }
184
220
 
221
+ const vibrateApp = (impact?: string) => {
222
+ const options = {
223
+ enableVibrateFallback: true,
224
+ ignoreAndroidSystemSettings: false
225
+ };
226
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
227
+ }
228
+
229
+ const handleSuccessSignup = (user: any) => {
230
+ login({
231
+ user,
232
+ token: user?.session?.access_token
233
+ })
234
+ setOpenModal({ ...openModal, signup: false })
235
+ }
236
+
237
+ const handleSuccessLogin = (user: any) => {
238
+ if (user) setOpenModal({ ...openModal, login: false })
239
+ }
240
+
185
241
  const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
186
- if (!userErrors.length && !requiredFields?.length || forcePlace) {
187
- handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
242
+ if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
243
+ vibrateApp()
244
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
188
245
  return
189
246
  }
190
247
  if (requiredFields?.length) {
@@ -199,6 +256,11 @@ const CheckoutUI = (props: any) => {
199
256
  setIsUserDetailsEdit(true)
200
257
  }
201
258
 
259
+ const handlePlaceOrderAsGuest = () => {
260
+ setIsOpen(false)
261
+ handlerClickPlaceOrder && handlerClickPlaceOrder()
262
+ }
263
+
202
264
  const handlePaymentMethodClick = (paymethod: any) => {
203
265
  setShowGateway({ closedByUser: false, open: true })
204
266
  setWebviewPaymethod(paymethod)
@@ -262,13 +324,13 @@ const CheckoutUI = (props: any) => {
262
324
  }
263
325
  }, [errors])
264
326
 
265
- // useEffect(() => {
266
- // handlePaymethodChange(null)
267
- // }, [cart?.total])
268
-
269
327
  useEffect(() => {
270
328
  if (cart?.products?.length === 0) {
271
- onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
329
+ if (cart?.business?.slug) {
330
+ onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
331
+ } else {
332
+ onNavigationRedirect('Wallets')
333
+ }
272
334
  }
273
335
  }, [cart?.products])
274
336
 
@@ -276,6 +338,35 @@ const CheckoutUI = (props: any) => {
276
338
  onFailPaypal()
277
339
  }, [showGateway.closedByUser])
278
340
 
341
+ const HeaderTitle = (props: any) => {
342
+ const { text } = props
343
+ return (
344
+ <OText
345
+ size={16}
346
+ lineHeight={24}
347
+ weight={'500'}
348
+ mBottom={props.mb ?? 10}
349
+ color={theme.colors.textNormal}
350
+ >
351
+ {text}
352
+ </OText>
353
+ )
354
+ }
355
+
356
+ useEffect(() => {
357
+ cart && events.emit('checkout_started', cart)
358
+ }, [])
359
+
360
+ useEffect(() => {
361
+ if (cart?.paymethod_data?.gateway === 'credomatic') {
362
+ if (cart?.paymethod_data?.status === 2) {
363
+ setShowGateway({ ...showGateway, open: true })
364
+ } else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
365
+ setShowGateway({ ...showGateway, open: false })
366
+ }
367
+ }
368
+ }, [cart?.paymethod_data])
369
+
279
370
  return (
280
371
  <>
281
372
  <Container noPadding>
@@ -283,23 +374,31 @@ const CheckoutUI = (props: any) => {
283
374
  <NavBar
284
375
  title={t('CHECKOUT', 'Checkout')}
285
376
  titleAlign={'center'}
286
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
377
+ onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
287
378
  showCall={false}
288
- btnStyle={{ paddingLeft: 0 }}
379
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
289
380
  titleWrapStyle={{ paddingHorizontal: 0 }}
290
381
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
382
+ style={{ marginTop: 20 }}
291
383
  />
292
384
  </View>
293
385
  <ChContainer style={styles.pagePadding}>
294
386
  <ChSection style={{ paddingTop: 0 }}>
295
387
  <ChHeader>
296
- {/* <OrderTypeSelector configTypes={configTypes} /> */}
297
- <CHMomentWrapper onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
298
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(options?.type || 1), 'Delivery')}</OText>
388
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
389
+ <OText
390
+ size={12}
391
+ numberOfLines={1}
392
+ ellipsizeMode={'tail'}
393
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
394
+ >
395
+ {t(getTypesText(options?.type || 1), 'Delivery')}
396
+ </OText>
299
397
  <OIcon
300
398
  src={theme.images.general.arrow_down}
301
399
  width={10}
302
400
  style={{ marginStart: 8 }}
401
+ {...(isChewLayout && { color: 'white' })}
303
402
  />
304
403
  </CHMomentWrapper>
305
404
  <CHMomentWrapper
@@ -323,85 +422,116 @@ const CheckoutUI = (props: any) => {
323
422
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
324
423
  </ChSection>
325
424
 
326
- <ChSection>
327
- <ChBusinessDetails>
328
- {
329
- (businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
330
- !businessDetails?.error &&
331
- (
425
+ {!isGiftCardCart && !hideBusinessDetails && (
426
+ <ChSection>
427
+ <ChBusinessDetails>
428
+ {
429
+ (businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
430
+ !businessDetails?.error &&
431
+ (
432
+ <Placeholder Animation={Fade}>
433
+ <PlaceholderLine height={20} />
434
+ <PlaceholderLine height={12} />
435
+ <PlaceholderLine height={12} />
436
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
437
+ </Placeholder>
438
+ )}
439
+ {
440
+ !cartState.loading &&
441
+ businessDetails?.business &&
442
+ Object.values(businessDetails?.business).length > 0 &&
443
+ (
444
+ <>
445
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
446
+ <View>
447
+ <OText size={12} lineHeight={18} weight={'400'}>
448
+ {businessDetails?.business?.name}
449
+ </OText>
450
+ <OText size={12} lineHeight={18} weight={'400'}>
451
+ {businessDetails?.business?.email}
452
+ </OText>
453
+ <OText size={12} lineHeight={18} weight={'400'}>
454
+ {businessDetails?.business?.cellphone}
455
+ </OText>
456
+ {!hideBusinessAddress && (
457
+ <OText size={12} lineHeight={18} weight={'400'}>
458
+ {businessDetails?.business?.address}
459
+ </OText>
460
+ )}
461
+ </View>
462
+ </>
463
+ )}
464
+ {businessDetails?.error && businessDetails?.error?.length > 0 && (
465
+ <View>
466
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
467
+ <NotFoundSource
468
+ content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
469
+ />
470
+ </View>
471
+ )}
472
+ </ChBusinessDetails>
473
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
474
+ </ChSection>
475
+ )}
476
+ {!hideCustomerDetails && (
477
+
478
+ <ChSection>
479
+ <ChUserDetails>
480
+ {cartState.loading ? (
332
481
  <Placeholder Animation={Fade}>
333
482
  <PlaceholderLine height={20} />
334
483
  <PlaceholderLine height={12} />
335
484
  <PlaceholderLine height={12} />
336
485
  <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
337
486
  </Placeholder>
338
- )}
339
- {
340
- !cartState.loading &&
341
- businessDetails?.business &&
342
- Object.values(businessDetails?.business).length > 0 &&
343
- (
344
- <>
345
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10} color={theme.colors.textNormal}>
346
- {t('BUSINESS_DETAILS', 'Business Details')}
347
- </OText>
487
+ ) : (
488
+ (user?.guest_id && !allowedGuest) ? (
348
489
  <View>
349
- <OText size={12} lineHeight={18} weight={'400'}>
350
- {businessDetails?.business?.name}
351
- </OText>
352
- <OText size={12} lineHeight={18} weight={'400'}>
353
- {businessDetails?.business?.email}
354
- </OText>
355
- <OText size={12} lineHeight={18} weight={'400'}>
356
- {businessDetails?.business?.cellphone}
357
- </OText>
358
- <OText size={12} lineHeight={18} weight={'400'}>
359
- {businessDetails?.business?.address}
360
- </OText>
490
+ <HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
491
+ <OButton
492
+ text={t('SIGN_UP', 'Sign up')}
493
+ textStyle={{ color: theme.colors.white }}
494
+ style={{ borderRadius: 7.6, marginTop: 20 }}
495
+ onClick={() => setOpenModal({ ...openModal, signup: true })}
496
+ />
497
+ <OButton
498
+ text={t('LOGIN', 'Login')}
499
+ textStyle={{ color: theme.colors.primary }}
500
+ bgColor={theme.colors.white}
501
+ borderColor={theme.colors.primary}
502
+ style={{ borderRadius: 7.6, marginTop: 20 }}
503
+ onClick={() => setOpenModal({ ...openModal, login: true })}
504
+ />
505
+ <OButton
506
+ text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
507
+ textStyle={{ color: theme.colors.black }}
508
+ bgColor={theme.colors.white}
509
+ borderColor={theme.colors.black}
510
+ style={{ borderRadius: 7.6, marginTop: 20 }}
511
+ onClick={() => setAllowedGuest(true)}
512
+ />
361
513
  </View>
362
- </>
514
+ ) : (
515
+ <UserDetails
516
+ isUserDetailsEdit={isUserDetailsEdit}
517
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
518
+ cartStatus={cart?.status}
519
+ businessId={cart?.business_id}
520
+ useValidationFields
521
+ useDefualtSessionManager
522
+ useSessionUser
523
+ isCheckout
524
+ phoneUpdate={phoneUpdate}
525
+ togglePhoneUpdate={togglePhoneUpdate}
526
+ />
527
+ )
363
528
  )}
364
- {businessDetails?.error && businessDetails?.error?.length > 0 && (
365
- <View>
366
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
367
- {t('BUSINESS_DETAILS', 'Business Details')}
368
- </OText>
369
- <NotFoundSource
370
- content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
371
- />
372
- </View>
373
- )}
374
- </ChBusinessDetails>
375
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
376
- </ChSection>
377
-
378
- <ChSection>
379
- <ChUserDetails>
380
- {cartState.loading ? (
381
- <Placeholder Animation={Fade}>
382
- <PlaceholderLine height={20} />
383
- <PlaceholderLine height={12} />
384
- <PlaceholderLine height={12} />
385
- <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
386
- </Placeholder>
387
- ) : (
388
- <UserDetails
389
- isUserDetailsEdit={isUserDetailsEdit}
390
- cartStatus={cart?.status}
391
- businessId={cart?.business_id}
392
- useValidationFields
393
- useDefualtSessionManager
394
- useSessionUser
395
- isCheckout
396
- phoneUpdate={phoneUpdate}
397
- togglePhoneUpdate={togglePhoneUpdate}
398
- />
399
- )}
400
- </ChUserDetails>
401
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
402
- </ChSection>
529
+ </ChUserDetails>
530
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
531
+ </ChSection>
532
+ )}
403
533
 
404
- {options?.type === 1 && (
534
+ {options?.type === 1 && !isGiftCardCart && (
405
535
  <DeliveryOptionsContainer>
406
536
  {cartState.loading || deliveryOptionSelected === undefined ? (
407
537
  <View style={{ height: 110 }}>
@@ -411,8 +541,8 @@ const CheckoutUI = (props: any) => {
411
541
  </Placeholder>
412
542
  </View>
413
543
  ) : (
414
- <>
415
- <OText size={16} color={theme.colors.textNormal} mBottom={10}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
544
+ <ChSection>
545
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
416
546
  <View
417
547
  style={{
418
548
  backgroundColor: theme.colors.inputDisabled,
@@ -431,7 +561,7 @@ const CheckoutUI = (props: any) => {
431
561
  <OText
432
562
  size={14}
433
563
  >
434
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
564
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
435
565
  </OText>
436
566
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
437
567
  </DeliveryOptionItem>
@@ -442,7 +572,7 @@ const CheckoutUI = (props: any) => {
442
572
  data: deliveryOptions || [],
443
573
  renderItem: ({ item }: any) => (
444
574
  <TouchableOpacity
445
- onPress={() => changeDeliveryOption(item.value)}
575
+ onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
446
576
  disabled={
447
577
  deliveryOptionSelected === item.value
448
578
  }
@@ -458,7 +588,7 @@ const CheckoutUI = (props: any) => {
458
588
  />
459
589
  </View>
460
590
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
461
- </>
591
+ </ChSection>
462
592
  )}
463
593
 
464
594
  </DeliveryOptionsContainer>
@@ -480,50 +610,30 @@ const CheckoutUI = (props: any) => {
480
610
  </ChSection>
481
611
  )}
482
612
 
483
- {/* <ChSection>
484
- <ChTotal>
485
- {
486
- (
487
- <>
488
- <OIcon
489
- url={businessLogo || businessDetails?.business?.logo}
490
- width={80}
491
- height={80}
492
- borderRadius={80}
493
- />
494
- <View style={{ marginLeft: 10, width: '85%' }}>
495
- <OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
496
- {businessName || businessDetails?.business?.name}
497
- </OText>
498
- <OText size={22}>
499
- {cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
500
- </OText>
501
- </View>
502
- </>
503
- )}
504
- </ChTotal>
505
- </ChSection> */}
506
- <ChSection>
507
- <ChAddress>
508
- {(businessDetails?.loading || cartState.loading) ? (
509
- <Placeholder Animation={Fade}>
510
- <PlaceholderLine height={20} style={{ marginBottom: 50 }} />
511
- <PlaceholderLine height={100} />
512
- </Placeholder>
513
- ) : (
514
- <AddressDetails
515
- navigation={navigation}
516
- location={businessDetails?.business?.location}
517
- businessLogo={businessDetails?.business?.logo}
518
- isCartPending={cart?.status === 2}
519
- uuid={cartUuid}
520
- apiKey={configs?.google_maps_api_key?.value}
521
- mapConfigs={mapConfigs}
522
- />
523
- )}
524
- </ChAddress>
525
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
526
- </ChSection>
613
+ {!isGiftCardCart && !hideBusinessMap && (
614
+ <ChSection>
615
+ <ChAddress>
616
+ {(businessDetails?.loading || cartState.loading) ? (
617
+ <Placeholder Animation={Fade}>
618
+ <PlaceholderLine height={20} style={{ marginBottom: 50 }} />
619
+ <PlaceholderLine height={100} />
620
+ </Placeholder>
621
+ ) : (
622
+ <AddressDetails
623
+ navigation={navigation}
624
+ location={options?.address?.location}
625
+ businessLogo={businessDetails?.business?.logo}
626
+ isCartPending={cart?.status === 2}
627
+ uuid={cartUuid}
628
+ apiKey={configs?.google_maps_api_key?.value}
629
+ mapConfigs={mapConfigs}
630
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
631
+ />
632
+ )}
633
+ </ChAddress>
634
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
635
+ </ChSection>
636
+ )}
527
637
 
528
638
  {!cartState.loading &&
529
639
  cart &&
@@ -532,22 +642,22 @@ const CheckoutUI = (props: any) => {
532
642
  cart?.status !== 2 &&
533
643
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
534
644
  driverTipsOptions && driverTipsOptions?.length > 0 &&
645
+ !isGiftCardCart &&
535
646
  (
536
647
  <ChSection>
537
648
  <ChDriverTips>
538
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
539
- {t('DRIVER_TIPS', 'Driver Tips')}
540
- </OText>
649
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
541
650
  <DriverTips
542
651
  uuid={cartUuid}
543
652
  businessId={cart?.business_id}
544
- driverTipsOptions={driverTipsOptions}
545
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
653
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
654
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
546
655
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
547
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
656
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
548
657
  ? cart?.driver_tip
549
658
  : cart?.driver_tip_rate}
550
659
  useOrderContext
660
+ cart={cart}
551
661
  />
552
662
  </ChDriverTips>
553
663
  </ChSection>
@@ -556,9 +666,7 @@ const CheckoutUI = (props: any) => {
556
666
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
557
667
  <ChSection>
558
668
  <ChPaymethods>
559
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
560
- {t('PAYMENT_METHOD', 'Payment Method')}
561
- </OText>
669
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
562
670
  {!cartState.loading && cart?.status === 4 && (
563
671
  <OText
564
672
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -571,8 +679,8 @@ const CheckoutUI = (props: any) => {
571
679
  <PaymentOptions
572
680
  cart={cart}
573
681
  isDisabled={cart?.status === 2}
574
- businessId={businessDetails?.business?.id}
575
- isLoading={businessDetails.loading}
682
+ businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
683
+ isLoading={!isGiftCardCart ? businessDetails.loading : false}
576
684
  paymethods={businessDetails?.business?.paymethods}
577
685
  onPaymentChange={handlePaymethodChange}
578
686
  errorCash={errorCash}
@@ -582,6 +690,12 @@ const CheckoutUI = (props: any) => {
582
690
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
583
691
  handlePlaceOrder={handlePlaceOrder}
584
692
  merchantId={merchantId}
693
+ setMethodPaySupported={setMethodPaySupported}
694
+ methodPaySupported={methodPaySupported}
695
+ placeByMethodPay={placeByMethodPay}
696
+ setPlaceByMethodPay={setPlaceByMethodPay}
697
+ cardList={cardList}
698
+ setCardList={setCardList}
585
699
  />
586
700
  </ChPaymethods>
587
701
  </ChSection>
@@ -591,6 +705,7 @@ const CheckoutUI = (props: any) => {
591
705
  <WalletPaymentOptionContainer>
592
706
  <PaymentOptionWallet
593
707
  cart={cart}
708
+ loyaltyPlansState={loyaltyPlansState}
594
709
  businessId={cart?.business_id}
595
710
  businessConfigs={businessDetails?.business?.configs}
596
711
  />
@@ -598,7 +713,7 @@ const CheckoutUI = (props: any) => {
598
713
  )}
599
714
 
600
715
 
601
- {!cartState.loading && placeSpotsEnabled && (
716
+ {!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
602
717
  <>
603
718
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
604
719
  <PlaceSpot
@@ -606,6 +721,7 @@ const CheckoutUI = (props: any) => {
606
721
  isInputMode
607
722
  cart={cart}
608
723
  spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
724
+ setPlaceSpotNumber={setPlaceSpotNumber}
609
725
  vehicleDefault={cart?.vehicle}
610
726
  />
611
727
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
@@ -623,25 +739,21 @@ const CheckoutUI = (props: any) => {
623
739
  ) : (
624
740
  <>
625
741
  <CartHeader>
626
- <OText
627
- size={16}
628
- lineHeight={24}
629
- color={theme.colors.textNormal}
630
- >
631
- {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
632
- </OText>
633
- <TouchableOpacity
634
- onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
635
- >
636
- <OText
637
- size={10}
638
- lineHeight={15}
639
- color={theme.colors.primary}
640
- style={{ textDecorationLine: 'underline' }}
742
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
743
+ {!isGiftCardCart && (
744
+ <TouchableOpacity
745
+ onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
641
746
  >
642
- {t('ADD_PRODUCTS', 'Add products')}
643
- </OText>
644
- </TouchableOpacity>
747
+ <OText
748
+ size={12}
749
+ lineHeight={15}
750
+ color={theme.colors.primary}
751
+ style={{ textDecorationLine: 'underline' }}
752
+ >
753
+ {t('ADD_PRODUCTS', 'Add products')}
754
+ </OText>
755
+ </TouchableOpacity>
756
+ )}
645
757
  </CartHeader>
646
758
  {isBusinessChangeEnabled && (
647
759
  <TouchableOpacity
@@ -651,7 +763,7 @@ const CheckoutUI = (props: any) => {
651
763
  <OText
652
764
  size={12}
653
765
  lineHeight={18}
654
- color={theme.colors.textSecondary}
766
+ color={theme.colors.primary}
655
767
  style={{ textDecorationLine: 'underline' }}
656
768
  >
657
769
  {t('CHANGE_STORE', 'Change store')}
@@ -663,6 +775,12 @@ const CheckoutUI = (props: any) => {
663
775
  isCartPending={cart?.status === 2}
664
776
  onNavigationRedirect={onNavigationRedirect}
665
777
  placeSpotTypes={placeSpotTypes}
778
+ businessConfigs={businessConfigs}
779
+ maxDate={maxDate}
780
+ loyaltyRewardRate={
781
+ creditPointPlanOnBusiness?.accumulation_rate ??
782
+ (!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
783
+ }
666
784
  />
667
785
  </>
668
786
  )}
@@ -672,7 +790,7 @@ const CheckoutUI = (props: any) => {
672
790
 
673
791
  {!cartState.loading && cart && (
674
792
  <View>
675
- <ChErrors style={{ marginBottom: 10 }}>
793
+ <ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
676
794
  {!cart?.valid_address && cart?.status !== 2 && (
677
795
  <OText
678
796
  color={theme.colors.error}
@@ -699,6 +817,14 @@ const CheckoutUI = (props: any) => {
699
817
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
700
818
  </OText>
701
819
  )}
820
+ {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
821
+ <OText
822
+ color={theme.colors.error}
823
+ size={12}
824
+ >
825
+ {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
826
+ </OText>
827
+ )}
702
828
  {options.type === 1 &&
703
829
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
704
830
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -710,6 +836,15 @@ const CheckoutUI = (props: any) => {
710
836
  {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
711
837
  </OText>
712
838
  )}
839
+
840
+ {validateCommentsCartField && (
841
+ <OText
842
+ color={theme.colors.error}
843
+ size={12}
844
+ >
845
+ {t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
846
+ </OText>
847
+ )}
713
848
  </ChErrors>
714
849
  </View>
715
850
  )}
@@ -742,21 +877,55 @@ const CheckoutUI = (props: any) => {
742
877
  togglePhoneUpdate={togglePhoneUpdate}
743
878
  requiredFields={requiredFields}
744
879
  hideUpdateButton
880
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
745
881
  onClose={() => {
746
882
  setIsOpen(false)
747
883
  handlePlaceOrder(null, true)
748
884
  }}
885
+ setIsOpen={setIsOpen}
749
886
  />
750
887
  </View>
751
888
  </OModal>
889
+ <OModal
890
+ open={openModal.signup}
891
+ onClose={() => setOpenModal({ ...openModal, signup: false })}
892
+ >
893
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
894
+ <SignupForm
895
+ handleSuccessSignup={handleSuccessSignup}
896
+ isGuest
897
+ signupButtonText={t('SIGNUP', 'Signup')}
898
+ useSignupByEmail
899
+ useChekoutFileds
900
+ />
901
+ </ScrollView>
902
+ </OModal>
903
+ <OModal
904
+ open={openModal.login}
905
+ onClose={() => setOpenModal({ ...openModal, login: false })}
906
+ >
907
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
908
+ <LoginForm
909
+ handleSuccessLogin={handleSuccessLogin}
910
+ isGuest
911
+ loginButtonText={t('LOGIN', 'Login')}
912
+ loginButtonBackground={theme.colors.primary}
913
+ />
914
+ </ScrollView>
915
+ </OModal>
752
916
  </ChContainer>
753
917
  </Container>
754
918
  {!cartState.loading && cart && cart?.status !== 2 && (
755
919
  <FloatingButton
756
- handleClick={() => handlePlaceOrder(null)}
920
+ handleClick={
921
+ isDisabledButtonPlace
922
+ ? () => vibrateApp()
923
+ : methodsPay.includes(paymethodSelected?.gateway)
924
+ ? () => setPlaceByMethodPay(true)
925
+ : () => handlePlaceOrder(null)}
757
926
  isSecondaryBtn={isDisabledButtonPlace}
758
927
  disabled={isDisabledButtonPlace}
759
- btnText={cart?.subtotal >= cart?.minimum
928
+ btnText={subtotalWithTaxes >= cart?.minimum
760
929
  ? (
761
930
  placing
762
931
  ? t('PLACING', 'Placing')
@@ -796,6 +965,29 @@ const CheckoutUI = (props: any) => {
796
965
  locationId={'L1NGAY5M6KJRX'}
797
966
  />
798
967
  )}
968
+ {cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
969
+ <PaymentOptionsWebView
970
+ title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
971
+ onNavigationRedirect={onNavigationRedirect}
972
+ uri={credomaticUrl}
973
+ user={user}
974
+ cart={cart}
975
+ additionalParams={{
976
+ type: 'auth',
977
+ key_id: credomaticKeyId,
978
+ hash: cart?.paymethod_data?.result?.hash,
979
+ time: cart?.paymethod_data?.result?.time,
980
+ amount: cart?.total,
981
+ orderid: cart?.uuid,
982
+ ccnumber: cardList?.cards?.[0]?.number,
983
+ ccexp: cardList?.cards?.[0]?.expiryString,
984
+ cvv: cardList?.cards?.[0]?.cvc,
985
+ redirect: credomaticUrl
986
+ }}
987
+ webviewPaymethod={webviewPaymethod}
988
+ setShowGateway={setShowGateway}
989
+ />
990
+ )}
799
991
  </>
800
992
  )
801
993
  }
@@ -822,7 +1014,8 @@ export const Checkout = (props: any) => {
822
1014
  const getOrder = async (cartId: any) => {
823
1015
  try {
824
1016
  let result: any = {}
825
- const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
1017
+ const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
1018
+ const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
826
1019
  if (cart) {
827
1020
  result = { ...cart }
828
1021
  } else {