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