ordering-ui-react-native 0.17.58 → 0.17.59-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 (211) 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 +5 -0
  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 +42 -5
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  24. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  25. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +93 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +64 -63
  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 +19 -18
  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 +30 -15
  40. package/themes/business/src/components/StoresList/index.tsx +3 -4
  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 +28 -12
  46. package/themes/business/src/utils/index.tsx +29 -2
  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/Checkout/index.tsx +6 -0
  51. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  52. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  56. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  57. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  58. package/themes/original/index.tsx +4 -0
  59. package/themes/original/src/components/AddressDetails/index.tsx +28 -10
  60. package/themes/original/src/components/AddressForm/index.tsx +68 -40
  61. package/themes/original/src/components/AddressList/index.tsx +27 -22
  62. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  63. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  64. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  65. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  66. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  67. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  68. package/themes/original/src/components/BusinessController/index.tsx +122 -68
  69. package/themes/original/src/components/BusinessController/styles.tsx +23 -4
  70. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  71. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  72. package/themes/original/src/components/BusinessInformation/index.tsx +110 -108
  73. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  74. package/themes/original/src/components/BusinessListingSearch/index.tsx +352 -326
  75. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  76. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  77. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  78. package/themes/original/src/components/BusinessProductsList/index.tsx +25 -15
  79. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  80. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  81. package/themes/original/src/components/BusinessProductsListing/index.tsx +683 -555
  82. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  83. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  84. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +97 -91
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  87. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  88. package/themes/original/src/components/Cart/index.tsx +77 -50
  89. package/themes/original/src/components/CartContent/index.tsx +117 -20
  90. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  91. package/themes/original/src/components/Checkout/index.tsx +357 -171
  92. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  93. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  94. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  95. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  96. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  97. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  98. package/themes/original/src/components/Favorite/index.tsx +8 -9
  99. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  100. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  101. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  102. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  103. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  104. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  105. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  106. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  107. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  108. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  109. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  110. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  112. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  113. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  114. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  115. package/themes/original/src/components/Help/index.tsx +8 -8
  116. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  117. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  118. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  119. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  120. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  121. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  122. package/themes/original/src/components/Home/index.tsx +13 -4
  123. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  124. package/themes/original/src/components/LoginForm/Otp/index.tsx +55 -13
  125. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  126. package/themes/original/src/components/LoginForm/index.tsx +60 -35
  127. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  128. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  129. package/themes/original/src/components/Messages/index.tsx +32 -10
  130. package/themes/original/src/components/MomentOption/index.tsx +195 -90
  131. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  132. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +153 -49
  134. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  135. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  136. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  138. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  139. package/themes/original/src/components/MyOrders/index.tsx +65 -52
  140. package/themes/original/src/components/NavBar/index.tsx +18 -18
  141. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  142. package/themes/original/src/components/Notifications/index.tsx +46 -50
  143. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  144. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  146. package/themes/original/src/components/OrderDetails/index.tsx +190 -358
  147. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  148. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  149. package/themes/original/src/components/OrderProgress/index.tsx +33 -59
  150. package/themes/original/src/components/OrderSummary/index.tsx +85 -57
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  154. package/themes/original/src/components/OrdersOption/index.tsx +78 -67
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +106 -31
  157. package/themes/original/src/components/PageBanner/styles.tsx +4 -4
  158. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +68 -9
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  163. package/themes/original/src/components/ProductForm/index.tsx +114 -35
  164. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  165. package/themes/original/src/components/ProductItemAccordion/index.tsx +22 -19
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +24 -14
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +3 -4
  168. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  169. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  170. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  171. package/themes/original/src/components/Promotions/index.tsx +234 -220
  172. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  173. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  174. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  175. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  176. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  177. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  178. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  179. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  180. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  181. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  182. package/themes/original/src/components/Sessions/index.tsx +11 -8
  183. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  184. package/themes/original/src/components/SignupForm/index.tsx +44 -29
  185. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  186. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  187. package/themes/original/src/components/SingleProductCard/index.tsx +71 -34
  188. package/themes/original/src/components/SingleProductCard/styles.tsx +21 -4
  189. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  190. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  191. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  192. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  193. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  194. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  195. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  196. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  197. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  198. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  199. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  200. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  201. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  202. package/themes/original/src/components/Wallets/index.tsx +67 -24
  203. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  204. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  205. package/themes/original/src/components/shared/OButton.tsx +6 -2
  206. package/themes/original/src/components/shared/OInput.tsx +6 -1
  207. package/themes/original/src/components/shared/OModal.tsx +3 -3
  208. package/themes/original/src/layouts/Container.tsx +1 -1
  209. package/themes/original/src/types/index.tsx +39 -10
  210. package/themes/original/src/utils/index.tsx +273 -1
  211. 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, Vibration } 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,
@@ -88,7 +93,8 @@ const CheckoutUI = (props: any) => {
88
93
  handleChangeDeliveryOption,
89
94
  currency,
90
95
  merchantId,
91
- setPlaceSpotNumber
96
+ setPlaceSpotNumber,
97
+ maxDate
92
98
  } = props
93
99
 
94
100
  const theme = useTheme();
@@ -128,12 +134,13 @@ const CheckoutUI = (props: any) => {
128
134
 
129
135
  const [, { showToast }] = useToast();
130
136
  const [, t] = useLanguage();
131
- const [{ user, token }] = useSession();
137
+ const [{ user, token }, { login }] = useSession();
132
138
  const [ordering] = useApi()
133
139
  const [{ configs }] = useConfig();
134
140
  const [{ parsePrice, parseDate }] = useUtils();
135
141
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
136
142
  const [validationFields] = useValidationFields();
143
+ const [events] = useEvent()
137
144
 
138
145
  const [errorCash, setErrorCash] = useState(false);
139
146
  const [userErrors, setUserErrors] = useState<any>([]);
@@ -145,14 +152,29 @@ const CheckoutUI = (props: any) => {
145
152
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
146
153
  const [isOpen, setIsOpen] = useState(false)
147
154
  const [requiredFields, setRequiredFields] = useState<any>([])
148
-
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']
149
161
  const placeSpotTypes = [3, 4, 5]
150
162
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
163
+ const isGiftCardCart = !cart?.business_id
151
164
  const businessConfigs = businessDetails?.business?.configs ?? []
152
165
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
153
166
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
154
167
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
155
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']
156
178
 
157
179
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
158
180
  const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
@@ -160,13 +182,18 @@ const CheckoutUI = (props: any) => {
160
182
  return acc = acc + item?.summary?.tax
161
183
  return acc = acc
162
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
+
163
188
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
164
189
  placing || errorCash || subtotalWithTaxes < cart?.minimum ||
165
- // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
190
+ (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
166
191
  (options.type === 1 &&
167
192
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
168
193
  validationFields?.fields?.checkout?.driver_tip?.required &&
169
- (Number(cart?.driver_tip) <= 0))
194
+ (Number(cart?.driver_tip) <= 0)) ||
195
+ (validateCommentsCartField)
196
+ || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
170
197
 
171
198
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
172
199
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -176,6 +203,9 @@ const CheckoutUI = (props: any) => {
176
203
 
177
204
  const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
178
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')}`
179
209
  const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
180
210
  return {
181
211
  value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
@@ -188,9 +218,30 @@ const CheckoutUI = (props: any) => {
188
218
  }
189
219
  }
190
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
+
191
241
  const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
192
- if (!userErrors.length && !requiredFields?.length || forcePlace) {
193
- handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
242
+ if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
243
+ vibrateApp()
244
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
194
245
  return
195
246
  }
196
247
  if (requiredFields?.length) {
@@ -205,6 +256,11 @@ const CheckoutUI = (props: any) => {
205
256
  setIsUserDetailsEdit(true)
206
257
  }
207
258
 
259
+ const handlePlaceOrderAsGuest = () => {
260
+ setIsOpen(false)
261
+ handlerClickPlaceOrder && handlerClickPlaceOrder()
262
+ }
263
+
208
264
  const handlePaymentMethodClick = (paymethod: any) => {
209
265
  setShowGateway({ closedByUser: false, open: true })
210
266
  setWebviewPaymethod(paymethod)
@@ -268,13 +324,13 @@ const CheckoutUI = (props: any) => {
268
324
  }
269
325
  }, [errors])
270
326
 
271
- // useEffect(() => {
272
- // handlePaymethodChange(null)
273
- // }, [cart?.total])
274
-
275
327
  useEffect(() => {
276
328
  if (cart?.products?.length === 0) {
277
- 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
+ }
278
334
  }
279
335
  }, [cart?.products])
280
336
 
@@ -282,6 +338,35 @@ const CheckoutUI = (props: any) => {
282
338
  onFailPaypal()
283
339
  }, [showGateway.closedByUser])
284
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
+
285
370
  return (
286
371
  <>
287
372
  <Container noPadding>
@@ -289,23 +374,31 @@ const CheckoutUI = (props: any) => {
289
374
  <NavBar
290
375
  title={t('CHECKOUT', 'Checkout')}
291
376
  titleAlign={'center'}
292
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
377
+ onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
293
378
  showCall={false}
294
- btnStyle={{ paddingLeft: 0 }}
379
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
295
380
  titleWrapStyle={{ paddingHorizontal: 0 }}
296
381
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
382
+ style={{ marginTop: 20 }}
297
383
  />
298
384
  </View>
299
385
  <ChContainer style={styles.pagePadding}>
300
386
  <ChSection style={{ paddingTop: 0 }}>
301
387
  <ChHeader>
302
- {/* <OrderTypeSelector configTypes={configTypes} /> */}
303
- <CHMomentWrapper onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
304
- <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>
305
397
  <OIcon
306
398
  src={theme.images.general.arrow_down}
307
399
  width={10}
308
400
  style={{ marginStart: 8 }}
401
+ {...(isChewLayout && { color: 'white' })}
309
402
  />
310
403
  </CHMomentWrapper>
311
404
  <CHMomentWrapper
@@ -329,85 +422,116 @@ const CheckoutUI = (props: any) => {
329
422
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
330
423
  </ChSection>
331
424
 
332
- <ChSection>
333
- <ChBusinessDetails>
334
- {
335
- (businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
336
- !businessDetails?.error &&
337
- (
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 ? (
338
481
  <Placeholder Animation={Fade}>
339
482
  <PlaceholderLine height={20} />
340
483
  <PlaceholderLine height={12} />
341
484
  <PlaceholderLine height={12} />
342
485
  <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
343
486
  </Placeholder>
344
- )}
345
- {
346
- !cartState.loading &&
347
- businessDetails?.business &&
348
- Object.values(businessDetails?.business).length > 0 &&
349
- (
350
- <>
351
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10} color={theme.colors.textNormal}>
352
- {t('BUSINESS_DETAILS', 'Business Details')}
353
- </OText>
487
+ ) : (
488
+ (user?.guest_id && !allowedGuest) ? (
354
489
  <View>
355
- <OText size={12} lineHeight={18} weight={'400'}>
356
- {businessDetails?.business?.name}
357
- </OText>
358
- <OText size={12} lineHeight={18} weight={'400'}>
359
- {businessDetails?.business?.email}
360
- </OText>
361
- <OText size={12} lineHeight={18} weight={'400'}>
362
- {businessDetails?.business?.cellphone}
363
- </OText>
364
- <OText size={12} lineHeight={18} weight={'400'}>
365
- {businessDetails?.business?.address}
366
- </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
+ />
367
513
  </View>
368
- </>
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
+ )
369
528
  )}
370
- {businessDetails?.error && businessDetails?.error?.length > 0 && (
371
- <View>
372
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
373
- {t('BUSINESS_DETAILS', 'Business Details')}
374
- </OText>
375
- <NotFoundSource
376
- content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
377
- />
378
- </View>
379
- )}
380
- </ChBusinessDetails>
381
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
382
- </ChSection>
383
-
384
- <ChSection>
385
- <ChUserDetails>
386
- {cartState.loading ? (
387
- <Placeholder Animation={Fade}>
388
- <PlaceholderLine height={20} />
389
- <PlaceholderLine height={12} />
390
- <PlaceholderLine height={12} />
391
- <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
392
- </Placeholder>
393
- ) : (
394
- <UserDetails
395
- isUserDetailsEdit={isUserDetailsEdit}
396
- cartStatus={cart?.status}
397
- businessId={cart?.business_id}
398
- useValidationFields
399
- useDefualtSessionManager
400
- useSessionUser
401
- isCheckout
402
- phoneUpdate={phoneUpdate}
403
- togglePhoneUpdate={togglePhoneUpdate}
404
- />
405
- )}
406
- </ChUserDetails>
407
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
408
- </ChSection>
529
+ </ChUserDetails>
530
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
531
+ </ChSection>
532
+ )}
409
533
 
410
- {options?.type === 1 && (
534
+ {options?.type === 1 && !isGiftCardCart && (
411
535
  <DeliveryOptionsContainer>
412
536
  {cartState.loading || deliveryOptionSelected === undefined ? (
413
537
  <View style={{ height: 110 }}>
@@ -417,8 +541,8 @@ const CheckoutUI = (props: any) => {
417
541
  </Placeholder>
418
542
  </View>
419
543
  ) : (
420
- <>
421
- <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')} />
422
546
  <View
423
547
  style={{
424
548
  backgroundColor: theme.colors.inputDisabled,
@@ -437,7 +561,7 @@ const CheckoutUI = (props: any) => {
437
561
  <OText
438
562
  size={14}
439
563
  >
440
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
564
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
441
565
  </OText>
442
566
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
443
567
  </DeliveryOptionItem>
@@ -448,7 +572,7 @@ const CheckoutUI = (props: any) => {
448
572
  data: deliveryOptions || [],
449
573
  renderItem: ({ item }: any) => (
450
574
  <TouchableOpacity
451
- onPress={() => changeDeliveryOption(item.value)}
575
+ onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
452
576
  disabled={
453
577
  deliveryOptionSelected === item.value
454
578
  }
@@ -464,7 +588,7 @@ const CheckoutUI = (props: any) => {
464
588
  />
465
589
  </View>
466
590
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
467
- </>
591
+ </ChSection>
468
592
  )}
469
593
 
470
594
  </DeliveryOptionsContainer>
@@ -486,50 +610,30 @@ const CheckoutUI = (props: any) => {
486
610
  </ChSection>
487
611
  )}
488
612
 
489
- {/* <ChSection>
490
- <ChTotal>
491
- {
492
- (
493
- <>
494
- <OIcon
495
- url={businessLogo || businessDetails?.business?.logo}
496
- width={80}
497
- height={80}
498
- borderRadius={80}
499
- />
500
- <View style={{ marginLeft: 10, width: '85%' }}>
501
- <OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
502
- {businessName || businessDetails?.business?.name}
503
- </OText>
504
- <OText size={22}>
505
- {cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
506
- </OText>
507
- </View>
508
- </>
509
- )}
510
- </ChTotal>
511
- </ChSection> */}
512
- <ChSection>
513
- <ChAddress>
514
- {(businessDetails?.loading || cartState.loading) ? (
515
- <Placeholder Animation={Fade}>
516
- <PlaceholderLine height={20} style={{ marginBottom: 50 }} />
517
- <PlaceholderLine height={100} />
518
- </Placeholder>
519
- ) : (
520
- <AddressDetails
521
- navigation={navigation}
522
- location={businessDetails?.business?.location}
523
- businessLogo={businessDetails?.business?.logo}
524
- isCartPending={cart?.status === 2}
525
- uuid={cartUuid}
526
- apiKey={configs?.google_maps_api_key?.value}
527
- mapConfigs={mapConfigs}
528
- />
529
- )}
530
- </ChAddress>
531
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
532
- </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
+ )}
533
637
 
534
638
  {!cartState.loading &&
535
639
  cart &&
@@ -538,22 +642,22 @@ const CheckoutUI = (props: any) => {
538
642
  cart?.status !== 2 &&
539
643
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
540
644
  driverTipsOptions && driverTipsOptions?.length > 0 &&
645
+ !isGiftCardCart &&
541
646
  (
542
647
  <ChSection>
543
648
  <ChDriverTips>
544
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
545
- {t('DRIVER_TIPS', 'Driver Tips')}
546
- </OText>
649
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
547
650
  <DriverTips
548
651
  uuid={cartUuid}
549
652
  businessId={cart?.business_id}
550
- driverTipsOptions={driverTipsOptions}
551
- 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}
552
655
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
553
- 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
554
657
  ? cart?.driver_tip
555
658
  : cart?.driver_tip_rate}
556
659
  useOrderContext
660
+ cart={cart}
557
661
  />
558
662
  </ChDriverTips>
559
663
  </ChSection>
@@ -562,9 +666,7 @@ const CheckoutUI = (props: any) => {
562
666
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
563
667
  <ChSection>
564
668
  <ChPaymethods>
565
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
566
- {t('PAYMENT_METHOD', 'Payment Method')}
567
- </OText>
669
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
568
670
  {!cartState.loading && cart?.status === 4 && (
569
671
  <OText
570
672
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -577,8 +679,8 @@ const CheckoutUI = (props: any) => {
577
679
  <PaymentOptions
578
680
  cart={cart}
579
681
  isDisabled={cart?.status === 2}
580
- businessId={businessDetails?.business?.id}
581
- isLoading={businessDetails.loading}
682
+ businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
683
+ isLoading={!isGiftCardCart ? businessDetails.loading : false}
582
684
  paymethods={businessDetails?.business?.paymethods}
583
685
  onPaymentChange={handlePaymethodChange}
584
686
  errorCash={errorCash}
@@ -588,6 +690,12 @@ const CheckoutUI = (props: any) => {
588
690
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
589
691
  handlePlaceOrder={handlePlaceOrder}
590
692
  merchantId={merchantId}
693
+ setMethodPaySupported={setMethodPaySupported}
694
+ methodPaySupported={methodPaySupported}
695
+ placeByMethodPay={placeByMethodPay}
696
+ setPlaceByMethodPay={setPlaceByMethodPay}
697
+ cardList={cardList}
698
+ setCardList={setCardList}
591
699
  />
592
700
  </ChPaymethods>
593
701
  </ChSection>
@@ -597,6 +705,7 @@ const CheckoutUI = (props: any) => {
597
705
  <WalletPaymentOptionContainer>
598
706
  <PaymentOptionWallet
599
707
  cart={cart}
708
+ loyaltyPlansState={loyaltyPlansState}
600
709
  businessId={cart?.business_id}
601
710
  businessConfigs={businessDetails?.business?.configs}
602
711
  />
@@ -604,7 +713,7 @@ const CheckoutUI = (props: any) => {
604
713
  )}
605
714
 
606
715
 
607
- {!cartState.loading && placeSpotsEnabled && (
716
+ {!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
608
717
  <>
609
718
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
610
719
  <PlaceSpot
@@ -630,25 +739,21 @@ const CheckoutUI = (props: any) => {
630
739
  ) : (
631
740
  <>
632
741
  <CartHeader>
633
- <OText
634
- size={16}
635
- lineHeight={24}
636
- color={theme.colors.textNormal}
637
- >
638
- {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
639
- </OText>
640
- <TouchableOpacity
641
- onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
642
- >
643
- <OText
644
- size={12}
645
- lineHeight={15}
646
- color={theme.colors.primary}
647
- 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 })}
648
746
  >
649
- {t('ADD_PRODUCTS', 'Add products')}
650
- </OText>
651
- </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
+ )}
652
757
  </CartHeader>
653
758
  {isBusinessChangeEnabled && (
654
759
  <TouchableOpacity
@@ -670,6 +775,12 @@ const CheckoutUI = (props: any) => {
670
775
  isCartPending={cart?.status === 2}
671
776
  onNavigationRedirect={onNavigationRedirect}
672
777
  placeSpotTypes={placeSpotTypes}
778
+ businessConfigs={businessConfigs}
779
+ maxDate={maxDate}
780
+ loyaltyRewardRate={
781
+ creditPointPlanOnBusiness?.accumulation_rate ??
782
+ (!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
783
+ }
673
784
  />
674
785
  </>
675
786
  )}
@@ -679,7 +790,7 @@ const CheckoutUI = (props: any) => {
679
790
 
680
791
  {!cartState.loading && cart && (
681
792
  <View>
682
- <ChErrors style={{ marginBottom: 10 }}>
793
+ <ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
683
794
  {!cart?.valid_address && cart?.status !== 2 && (
684
795
  <OText
685
796
  color={theme.colors.error}
@@ -706,6 +817,14 @@ const CheckoutUI = (props: any) => {
706
817
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
707
818
  </OText>
708
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
+ )}
709
828
  {options.type === 1 &&
710
829
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
711
830
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -717,6 +836,15 @@ const CheckoutUI = (props: any) => {
717
836
  {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
718
837
  </OText>
719
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
+ )}
720
848
  </ChErrors>
721
849
  </View>
722
850
  )}
@@ -749,18 +877,52 @@ const CheckoutUI = (props: any) => {
749
877
  togglePhoneUpdate={togglePhoneUpdate}
750
878
  requiredFields={requiredFields}
751
879
  hideUpdateButton
880
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
752
881
  onClose={() => {
753
882
  setIsOpen(false)
754
883
  handlePlaceOrder(null, true)
755
884
  }}
885
+ setIsOpen={setIsOpen}
756
886
  />
757
887
  </View>
758
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>
759
916
  </ChContainer>
760
917
  </Container>
761
918
  {!cartState.loading && cart && cart?.status !== 2 && (
762
919
  <FloatingButton
763
- handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
920
+ handleClick={
921
+ isDisabledButtonPlace
922
+ ? () => vibrateApp()
923
+ : methodsPay.includes(paymethodSelected?.gateway)
924
+ ? () => setPlaceByMethodPay(true)
925
+ : () => handlePlaceOrder(null)}
764
926
  isSecondaryBtn={isDisabledButtonPlace}
765
927
  disabled={isDisabledButtonPlace}
766
928
  btnText={subtotalWithTaxes >= cart?.minimum
@@ -803,6 +965,29 @@ const CheckoutUI = (props: any) => {
803
965
  locationId={'L1NGAY5M6KJRX'}
804
966
  />
805
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
+ )}
806
991
  </>
807
992
  )
808
993
  }
@@ -829,7 +1014,8 @@ export const Checkout = (props: any) => {
829
1014
  const getOrder = async (cartId: any) => {
830
1015
  try {
831
1016
  let result: any = {}
832
- 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)
833
1019
  if (cart) {
834
1020
  result = { ...cart }
835
1021
  } else {