ordering-ui-react-native 0.17.5 → 0.17.6-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 (213) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +11 -4
  4. package/src/components/BusinessInformation/styles.tsx +2 -2
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/OrderCreating/index.tsx +1 -21
  7. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  8. package/src/components/SingleProductReview/index.tsx +7 -4
  9. package/src/components/StripeMethodForm/index.tsx +6 -14
  10. package/src/components/VerifyPhone/styles.tsx +1 -2
  11. package/src/components/shared/OToast.tsx +4 -4
  12. package/src/utils/index.tsx +7 -1
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  15. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  16. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  17. package/themes/business/src/components/Chat/index.tsx +118 -107
  18. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  21. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  22. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  23. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  24. package/themes/business/src/components/MapView/index.tsx +18 -7
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +43 -50
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  30. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  31. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  32. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  33. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  34. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -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 +41 -24
  40. package/themes/business/src/components/StoresList/index.tsx +2 -2
  41. package/themes/business/src/components/shared/OLink.tsx +33 -13
  42. package/themes/business/src/components/shared/OModal.tsx +16 -9
  43. package/themes/business/src/components/shared/OText.tsx +8 -2
  44. package/themes/business/src/types/index.tsx +33 -2
  45. package/themes/business/src/utils/index.tsx +51 -0
  46. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  48. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  50. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  51. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  52. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  54. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  59. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  60. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  61. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  62. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  63. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  64. package/themes/kiosk/src/types/index.d.ts +13 -0
  65. package/themes/kiosk/src/utils/index.tsx +15 -0
  66. package/themes/original/index.tsx +8 -0
  67. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  68. package/themes/original/src/components/AddressForm/index.tsx +41 -16
  69. package/themes/original/src/components/AddressList/index.tsx +26 -21
  70. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  71. package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
  72. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
  74. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
  75. package/themes/original/src/components/BusinessController/index.tsx +145 -68
  76. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  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 +24 -23
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
  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/index.tsx +617 -490
  86. package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
  87. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  88. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  92. package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
  93. package/themes/original/src/components/Cart/index.tsx +88 -43
  94. package/themes/original/src/components/CartContent/index.tsx +102 -3
  95. package/themes/original/src/components/CartContent/styles.tsx +15 -1
  96. package/themes/original/src/components/Checkout/index.tsx +311 -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 -37
  102. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  103. package/themes/original/src/components/Favorite/index.tsx +7 -4
  104. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  105. package/themes/original/src/components/FavoriteList/index.tsx +70 -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/styles.ts +3 -3
  109. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  110. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  111. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  112. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +178 -0
  114. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  116. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  117. package/themes/original/src/components/Help/index.tsx +8 -8
  118. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  119. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  120. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  121. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  123. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  124. package/themes/original/src/components/Home/index.tsx +13 -4
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  127. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  128. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  129. package/themes/original/src/components/LoginForm/index.tsx +43 -19
  130. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  131. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  132. package/themes/original/src/components/Messages/index.tsx +32 -10
  133. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  134. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  135. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +117 -96
  136. package/themes/original/src/components/MultiCheckout/index.tsx +248 -83
  137. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  139. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  140. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  141. package/themes/original/src/components/NavBar/index.tsx +6 -11
  142. package/themes/original/src/components/Notifications/index.tsx +144 -0
  143. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  144. package/themes/original/src/components/OrderDetails/OrderEta.tsx +61 -0
  145. package/themes/original/src/components/OrderDetails/index.tsx +262 -347
  146. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  147. package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
  148. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  149. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  150. package/themes/original/src/components/OrderSummary/index.tsx +68 -29
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  154. package/themes/original/src/components/OrdersOption/index.tsx +101 -89
  155. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  156. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  157. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  158. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  159. package/themes/original/src/components/PaymentOptions/index.tsx +3 -3
  160. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  161. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  162. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  163. package/themes/original/src/components/ProductForm/index.tsx +240 -261
  164. package/themes/original/src/components/ProductForm/styles.tsx +4 -7
  165. package/themes/original/src/components/ProductItemAccordion/index.tsx +197 -138
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  168. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  169. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  170. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  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 +7 -4
  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 +377 -270
  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 +79 -66
  185. package/themes/original/src/components/SingleOrderCard/index.tsx +148 -62
  186. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
  187. package/themes/original/src/components/SingleProductCard/index.tsx +111 -56
  188. package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
  189. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  190. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  191. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  192. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  193. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
  194. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  195. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  196. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  197. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  198. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  199. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  200. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  201. package/themes/original/src/components/Wallets/index.tsx +31 -17
  202. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  203. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  204. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  205. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  206. package/themes/original/src/components/shared/OButton.tsx +6 -2
  207. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  208. package/themes/original/src/components/shared/OInput.tsx +10 -1
  209. package/themes/original/src/components/shared/OModal.tsx +3 -3
  210. package/themes/original/src/layouts/Container.tsx +13 -9
  211. package/themes/original/src/types/index.tsx +47 -9
  212. package/themes/original/src/utils/index.tsx +375 -58
  213. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,5 +1,5 @@
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'
@@ -14,9 +14,10 @@ import {
14
14
  useConfig,
15
15
  useToast,
16
16
  ToastType,
17
+ useEvent
17
18
  } from 'ordering-components/native';
18
19
  import { useTheme } from 'styled-components/native';
19
- import { OText, OIcon, OModal } from '../shared';
20
+ import { OText, OIcon, OModal, OButton } from '../shared';
20
21
 
21
22
  import { AddressDetails } from '../AddressDetails';
22
23
  import { PaymentOptions } from '../PaymentOptions';
@@ -25,6 +26,8 @@ import { NotFoundSource } from '../NotFoundSource';
25
26
  import { UserDetails } from '../UserDetails';
26
27
  import { PaymentOptionWallet } from '../PaymentOptionWallet';
27
28
  import { PlaceSpot } from '../PlaceSpot'
29
+ import { SignupForm } from '../SignupForm'
30
+ import { LoginForm } from '../LoginForm'
28
31
 
29
32
  import {
30
33
  ChContainer,
@@ -49,7 +52,7 @@ import { FloatingButton } from '../FloatingButton';
49
52
  import { Container } from '../../layouts/Container';
50
53
  import NavBar from '../NavBar';
51
54
  import { OrderSummary } from '../OrderSummary';
52
- import { getTypesText } from '../../utils';
55
+ import { getTypesText, vibrateApp } from '../../utils';
53
56
  import { CartStoresListing } from '../CartStoresListing';
54
57
  import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
55
58
 
@@ -78,6 +81,7 @@ const CheckoutUI = (props: any) => {
78
81
  placing,
79
82
  cartState,
80
83
  cartUuid,
84
+ loyaltyPlansState,
81
85
  businessDetails,
82
86
  paymethodSelected,
83
87
  handlePaymethodChange,
@@ -87,7 +91,9 @@ const CheckoutUI = (props: any) => {
87
91
  instructionsOptions,
88
92
  handleChangeDeliveryOption,
89
93
  currency,
90
- merchantId
94
+ merchantId,
95
+ setPlaceSpotNumber,
96
+ maxDate
91
97
  } = props
92
98
 
93
99
  const theme = useTheme();
@@ -118,19 +124,22 @@ const CheckoutUI = (props: any) => {
118
124
  paddingHorizontal: 40,
119
125
  width: '100%'
120
126
  },
121
- wrapperNavbar: Platform.OS === 'ios'
122
- ? { paddingVertical: 0, paddingHorizontal: 40 }
123
- : { paddingVertical: 20, paddingHorizontal: 40 }
127
+ wrapperNavbar: {
128
+ paddingVertical: 0,
129
+ paddingHorizontal: 40,
130
+ marginVertical: 2
131
+ }
124
132
  })
125
133
 
126
134
  const [, { showToast }] = useToast();
127
135
  const [, t] = useLanguage();
128
- const [{ user, token }] = useSession();
136
+ const [{ user, token }, { login }] = useSession();
129
137
  const [ordering] = useApi()
130
138
  const [{ configs }] = useConfig();
131
139
  const [{ parsePrice, parseDate }] = useUtils();
132
140
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
133
141
  const [validationFields] = useValidationFields();
142
+ const [events] = useEvent()
134
143
 
135
144
  const [errorCash, setErrorCash] = useState(false);
136
145
  const [userErrors, setUserErrors] = useState<any>([]);
@@ -142,23 +151,42 @@ const CheckoutUI = (props: any) => {
142
151
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
143
152
  const [isOpen, setIsOpen] = useState(false)
144
153
  const [requiredFields, setRequiredFields] = useState<any>([])
154
+ const [openModal, setOpenModal] = useState({ login: false, signup: false })
155
+ const [allowedGuest, setAllowedGuest] = useState(false)
145
156
 
146
157
  const placeSpotTypes = [3, 4, 5]
147
158
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
159
+ const isGiftCardCart = !cart?.business_id
148
160
  const businessConfigs = businessDetails?.business?.configs ?? []
149
161
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
150
162
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
151
163
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
152
164
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
165
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
166
+ const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
167
+ const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
168
+ const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
169
+ const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
170
+
171
+ const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
172
+ const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
153
173
 
154
174
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
175
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
176
+ if (item?.type === 1)
177
+ return acc = acc + item?.summary?.tax
178
+ return acc = acc
179
+ }, cart?.subtotal)
180
+
181
+ const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
182
+
155
183
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
156
- placing || errorCash || cart?.subtotal < cart?.minimum ||
157
- // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
184
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
158
185
  (options.type === 1 &&
159
186
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
160
187
  validationFields?.fields?.checkout?.driver_tip?.required &&
161
- (Number(cart?.driver_tip) <= 0))
188
+ (Number(cart?.driver_tip) <= 0)) ||
189
+ (validateCommentsCartField)
162
190
 
163
191
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
164
192
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -180,8 +208,21 @@ const CheckoutUI = (props: any) => {
180
208
  }
181
209
  }
182
210
 
183
- const handlePlaceOrder = (confirmPayment: any) => {
184
- if (!userErrors.length && !requiredFields?.length) {
211
+ const handleSuccessSignup = (user: any) => {
212
+ login({
213
+ user,
214
+ token: user?.session?.access_token
215
+ })
216
+ setOpenModal({ ...openModal, signup: false })
217
+ }
218
+
219
+ const handleSuccessLogin = (user: any) => {
220
+ if (user) setOpenModal({ ...openModal, login: false })
221
+ }
222
+
223
+ const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
224
+ if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
225
+ vibrateApp()
185
226
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
186
227
  return
187
228
  }
@@ -197,6 +238,11 @@ const CheckoutUI = (props: any) => {
197
238
  setIsUserDetailsEdit(true)
198
239
  }
199
240
 
241
+ const handlePlaceOrderAsGuest = () => {
242
+ setIsOpen(false)
243
+ handlerClickPlaceOrder && handlerClickPlaceOrder()
244
+ }
245
+
200
246
  const handlePaymentMethodClick = (paymethod: any) => {
201
247
  setShowGateway({ closedByUser: false, open: true })
202
248
  setWebviewPaymethod(paymethod)
@@ -215,7 +261,7 @@ const CheckoutUI = (props: any) => {
215
261
  const checkValidationFields = () => {
216
262
  setUserErrors([])
217
263
  const errors = []
218
- const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
264
+ const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
219
265
  const _requiredFields: any = []
220
266
 
221
267
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
@@ -260,13 +306,13 @@ const CheckoutUI = (props: any) => {
260
306
  }
261
307
  }, [errors])
262
308
 
263
- // useEffect(() => {
264
- // handlePaymethodChange(null)
265
- // }, [cart?.total])
266
-
267
309
  useEffect(() => {
268
310
  if (cart?.products?.length === 0) {
269
- onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
311
+ if (cart?.business?.slug) {
312
+ onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
313
+ } else {
314
+ onNavigationRedirect('Wallets')
315
+ }
270
316
  }
271
317
  }, [cart?.products])
272
318
 
@@ -274,6 +320,25 @@ const CheckoutUI = (props: any) => {
274
320
  onFailPaypal()
275
321
  }, [showGateway.closedByUser])
276
322
 
323
+ const HeaderTitle = (props: any) => {
324
+ const { text } = props
325
+ return (
326
+ <OText
327
+ size={16}
328
+ lineHeight={24}
329
+ weight={'500'}
330
+ mBottom={props.mb ?? 10}
331
+ color={theme.colors.textNormal}
332
+ >
333
+ {text}
334
+ </OText>
335
+ )
336
+ }
337
+
338
+ useEffect(() => {
339
+ cart && events.emit('checkout_started', cart)
340
+ }, [])
341
+
277
342
  return (
278
343
  <>
279
344
  <Container noPadding>
@@ -281,24 +346,31 @@ const CheckoutUI = (props: any) => {
281
346
  <NavBar
282
347
  title={t('CHECKOUT', 'Checkout')}
283
348
  titleAlign={'center'}
284
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
349
+ onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
285
350
  showCall={false}
286
- btnStyle={{ paddingLeft: 0 }}
287
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
351
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
288
352
  titleWrapStyle={{ paddingHorizontal: 0 }}
289
353
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
354
+ style={{ marginTop: 20 }}
290
355
  />
291
356
  </View>
292
357
  <ChContainer style={styles.pagePadding}>
293
358
  <ChSection style={{ paddingTop: 0 }}>
294
359
  <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>
360
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
361
+ <OText
362
+ size={12}
363
+ numberOfLines={1}
364
+ ellipsizeMode={'tail'}
365
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
366
+ >
367
+ {t(getTypesText(options?.type || 1), 'Delivery')}
368
+ </OText>
298
369
  <OIcon
299
370
  src={theme.images.general.arrow_down}
300
371
  width={10}
301
372
  style={{ marginStart: 8 }}
373
+ {...(isChewLayout && { color: 'white' })}
302
374
  />
303
375
  </CHMomentWrapper>
304
376
  <CHMomentWrapper
@@ -322,85 +394,116 @@ const CheckoutUI = (props: any) => {
322
394
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
323
395
  </ChSection>
324
396
 
325
- <ChSection>
326
- <ChBusinessDetails>
327
- {
328
- (businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
329
- !businessDetails?.error &&
330
- (
397
+ {!isGiftCardCart && !hideBusinessDetails && (
398
+ <ChSection>
399
+ <ChBusinessDetails>
400
+ {
401
+ (businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
402
+ !businessDetails?.error &&
403
+ (
404
+ <Placeholder Animation={Fade}>
405
+ <PlaceholderLine height={20} />
406
+ <PlaceholderLine height={12} />
407
+ <PlaceholderLine height={12} />
408
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
409
+ </Placeholder>
410
+ )}
411
+ {
412
+ !cartState.loading &&
413
+ businessDetails?.business &&
414
+ Object.values(businessDetails?.business).length > 0 &&
415
+ (
416
+ <>
417
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
418
+ <View>
419
+ <OText size={12} lineHeight={18} weight={'400'}>
420
+ {businessDetails?.business?.name}
421
+ </OText>
422
+ <OText size={12} lineHeight={18} weight={'400'}>
423
+ {businessDetails?.business?.email}
424
+ </OText>
425
+ <OText size={12} lineHeight={18} weight={'400'}>
426
+ {businessDetails?.business?.cellphone}
427
+ </OText>
428
+ {!hideBusinessAddress && (
429
+ <OText size={12} lineHeight={18} weight={'400'}>
430
+ {businessDetails?.business?.address}
431
+ </OText>
432
+ )}
433
+ </View>
434
+ </>
435
+ )}
436
+ {businessDetails?.error && businessDetails?.error?.length > 0 && (
437
+ <View>
438
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
439
+ <NotFoundSource
440
+ content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
441
+ />
442
+ </View>
443
+ )}
444
+ </ChBusinessDetails>
445
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
446
+ </ChSection>
447
+ )}
448
+ {!hideCustomerDetails && (
449
+
450
+ <ChSection>
451
+ <ChUserDetails>
452
+ {cartState.loading ? (
331
453
  <Placeholder Animation={Fade}>
332
454
  <PlaceholderLine height={20} />
333
455
  <PlaceholderLine height={12} />
334
456
  <PlaceholderLine height={12} />
335
457
  <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
336
458
  </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}>
345
- {t('BUSINESS_DETAILS', 'Business Details')}
346
- </OText>
459
+ ) : (
460
+ (user?.guest_id && !allowedGuest) ? (
347
461
  <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>
462
+ <HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
463
+ <OButton
464
+ text={t('SIGN_UP', 'Sign up')}
465
+ textStyle={{ color: theme.colors.white }}
466
+ style={{ borderRadius: 7.6, marginTop: 20 }}
467
+ onClick={() => setOpenModal({ ...openModal, signup: true })}
468
+ />
469
+ <OButton
470
+ text={t('LOGIN', 'Login')}
471
+ textStyle={{ color: theme.colors.primary }}
472
+ bgColor={theme.colors.white}
473
+ borderColor={theme.colors.primary}
474
+ style={{ borderRadius: 7.6, marginTop: 20 }}
475
+ onClick={() => setOpenModal({ ...openModal, login: true })}
476
+ />
477
+ <OButton
478
+ text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
479
+ textStyle={{ color: theme.colors.black }}
480
+ bgColor={theme.colors.white}
481
+ borderColor={theme.colors.black}
482
+ style={{ borderRadius: 7.6, marginTop: 20 }}
483
+ onClick={() => setAllowedGuest(true)}
484
+ />
360
485
  </View>
361
- </>
486
+ ) : (
487
+ <UserDetails
488
+ isUserDetailsEdit={isUserDetailsEdit}
489
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
490
+ cartStatus={cart?.status}
491
+ businessId={cart?.business_id}
492
+ useValidationFields
493
+ useDefualtSessionManager
494
+ useSessionUser
495
+ isCheckout
496
+ phoneUpdate={phoneUpdate}
497
+ togglePhoneUpdate={togglePhoneUpdate}
498
+ />
499
+ )
362
500
  )}
363
- {businessDetails?.error && businessDetails?.error?.length > 0 && (
364
- <View>
365
- <OText size={16} lineHeight={24} weight={'500'}>
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>
501
+ </ChUserDetails>
502
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
503
+ </ChSection>
504
+ )}
402
505
 
403
- {options?.type === 1 && (
506
+ {options?.type === 1 && !isGiftCardCart && (
404
507
  <DeliveryOptionsContainer>
405
508
  {cartState.loading || deliveryOptionSelected === undefined ? (
406
509
  <View style={{ height: 110 }}>
@@ -410,8 +513,8 @@ const CheckoutUI = (props: any) => {
410
513
  </Placeholder>
411
514
  </View>
412
515
  ) : (
413
- <>
414
- <OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
516
+ <ChSection>
517
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
415
518
  <View
416
519
  style={{
417
520
  backgroundColor: theme.colors.inputDisabled,
@@ -430,7 +533,7 @@ const CheckoutUI = (props: any) => {
430
533
  <OText
431
534
  size={14}
432
535
  >
433
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
536
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
434
537
  </OText>
435
538
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
436
539
  </DeliveryOptionItem>
@@ -457,7 +560,7 @@ const CheckoutUI = (props: any) => {
457
560
  />
458
561
  </View>
459
562
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
460
- </>
563
+ </ChSection>
461
564
  )}
462
565
 
463
566
  </DeliveryOptionsContainer>
@@ -479,50 +582,30 @@ const CheckoutUI = (props: any) => {
479
582
  </ChSection>
480
583
  )}
481
584
 
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>
585
+ {!isGiftCardCart && !hideBusinessMap && (
586
+ <ChSection>
587
+ <ChAddress>
588
+ {(businessDetails?.loading || cartState.loading) ? (
589
+ <Placeholder Animation={Fade}>
590
+ <PlaceholderLine height={20} style={{ marginBottom: 50 }} />
591
+ <PlaceholderLine height={100} />
592
+ </Placeholder>
593
+ ) : (
594
+ <AddressDetails
595
+ navigation={navigation}
596
+ location={options?.address?.location}
597
+ businessLogo={businessDetails?.business?.logo}
598
+ isCartPending={cart?.status === 2}
599
+ uuid={cartUuid}
600
+ apiKey={configs?.google_maps_api_key?.value}
601
+ mapConfigs={mapConfigs}
602
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
603
+ />
604
+ )}
605
+ </ChAddress>
606
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
607
+ </ChSection>
608
+ )}
526
609
 
527
610
  {!cartState.loading &&
528
611
  cart &&
@@ -531,22 +614,22 @@ const CheckoutUI = (props: any) => {
531
614
  cart?.status !== 2 &&
532
615
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
533
616
  driverTipsOptions && driverTipsOptions?.length > 0 &&
617
+ !isGiftCardCart &&
534
618
  (
535
619
  <ChSection>
536
620
  <ChDriverTips>
537
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
538
- {t('DRIVER_TIPS', 'Driver Tips')}
539
- </OText>
621
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
540
622
  <DriverTips
541
623
  uuid={cartUuid}
542
624
  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)}
625
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
626
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
545
627
  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)
628
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
547
629
  ? cart?.driver_tip
548
630
  : cart?.driver_tip_rate}
549
631
  useOrderContext
632
+ cart={cart}
550
633
  />
551
634
  </ChDriverTips>
552
635
  </ChSection>
@@ -555,9 +638,7 @@ const CheckoutUI = (props: any) => {
555
638
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
556
639
  <ChSection>
557
640
  <ChPaymethods>
558
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
559
- {t('PAYMENT_METHOD', 'Payment Method')}
560
- </OText>
641
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
561
642
  {!cartState.loading && cart?.status === 4 && (
562
643
  <OText
563
644
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -570,8 +651,8 @@ const CheckoutUI = (props: any) => {
570
651
  <PaymentOptions
571
652
  cart={cart}
572
653
  isDisabled={cart?.status === 2}
573
- businessId={businessDetails?.business?.id}
574
- isLoading={businessDetails.loading}
654
+ businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
655
+ isLoading={!isGiftCardCart ? businessDetails.loading : false}
575
656
  paymethods={businessDetails?.business?.paymethods}
576
657
  onPaymentChange={handlePaymethodChange}
577
658
  errorCash={errorCash}
@@ -590,6 +671,7 @@ const CheckoutUI = (props: any) => {
590
671
  <WalletPaymentOptionContainer>
591
672
  <PaymentOptionWallet
592
673
  cart={cart}
674
+ loyaltyPlansState={loyaltyPlansState}
593
675
  businessId={cart?.business_id}
594
676
  businessConfigs={businessDetails?.business?.configs}
595
677
  />
@@ -597,7 +679,7 @@ const CheckoutUI = (props: any) => {
597
679
  )}
598
680
 
599
681
 
600
- {!cartState.loading && placeSpotsEnabled && (
682
+ {!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
601
683
  <>
602
684
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
603
685
  <PlaceSpot
@@ -605,6 +687,7 @@ const CheckoutUI = (props: any) => {
605
687
  isInputMode
606
688
  cart={cart}
607
689
  spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
690
+ setPlaceSpotNumber={setPlaceSpotNumber}
608
691
  vehicleDefault={cart?.vehicle}
609
692
  />
610
693
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
@@ -622,26 +705,21 @@ const CheckoutUI = (props: any) => {
622
705
  ) : (
623
706
  <>
624
707
  <CartHeader>
625
- <OText
626
- size={16}
627
- lineHeight={24}
628
- color={theme.colors.textNormal}
629
- style={{ fontWeight: '500' }}
630
- >
631
- {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
632
- </OText>
633
- <TouchableOpacity
634
- onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
635
- >
636
- <OText
637
- size={10}
638
- lineHeight={15}
639
- color={theme.colors.primary}
640
- style={{ textDecorationLine: 'underline' }}
708
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
709
+ {!isGiftCardCart && (
710
+ <TouchableOpacity
711
+ onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
641
712
  >
642
- {t('ADD_PRODUCTS', 'Add products')}
643
- </OText>
644
- </TouchableOpacity>
713
+ <OText
714
+ size={12}
715
+ lineHeight={15}
716
+ color={theme.colors.primary}
717
+ style={{ textDecorationLine: 'underline' }}
718
+ >
719
+ {t('ADD_PRODUCTS', 'Add products')}
720
+ </OText>
721
+ </TouchableOpacity>
722
+ )}
645
723
  </CartHeader>
646
724
  {isBusinessChangeEnabled && (
647
725
  <TouchableOpacity
@@ -651,7 +729,7 @@ const CheckoutUI = (props: any) => {
651
729
  <OText
652
730
  size={12}
653
731
  lineHeight={18}
654
- color={theme.colors.textSecondary}
732
+ color={theme.colors.primary}
655
733
  style={{ textDecorationLine: 'underline' }}
656
734
  >
657
735
  {t('CHANGE_STORE', 'Change store')}
@@ -663,6 +741,12 @@ const CheckoutUI = (props: any) => {
663
741
  isCartPending={cart?.status === 2}
664
742
  onNavigationRedirect={onNavigationRedirect}
665
743
  placeSpotTypes={placeSpotTypes}
744
+ businessConfigs={businessConfigs}
745
+ maxDate={maxDate}
746
+ loyaltyRewardRate={
747
+ creditPointPlanOnBusiness?.accumulation_rate ??
748
+ (!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
749
+ }
666
750
  />
667
751
  </>
668
752
  )}
@@ -672,7 +756,7 @@ const CheckoutUI = (props: any) => {
672
756
 
673
757
  {!cartState.loading && cart && (
674
758
  <View>
675
- <ChErrors style={{ marginBottom: 10 }}>
759
+ <ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
676
760
  {!cart?.valid_address && cart?.status !== 2 && (
677
761
  <OText
678
762
  color={theme.colors.error}
@@ -699,6 +783,14 @@ const CheckoutUI = (props: any) => {
699
783
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
700
784
  </OText>
701
785
  )}
786
+ {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
787
+ <OText
788
+ color={theme.colors.error}
789
+ size={12}
790
+ >
791
+ {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
792
+ </OText>
793
+ )}
702
794
  {options.type === 1 &&
703
795
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
704
796
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -710,6 +802,15 @@ const CheckoutUI = (props: any) => {
710
802
  {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
711
803
  </OText>
712
804
  )}
805
+
806
+ {validateCommentsCartField && (
807
+ <OText
808
+ color={theme.colors.error}
809
+ size={12}
810
+ >
811
+ {t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
812
+ </OText>
813
+ )}
713
814
  </ChErrors>
714
815
  </View>
715
816
  )}
@@ -742,18 +843,50 @@ const CheckoutUI = (props: any) => {
742
843
  togglePhoneUpdate={togglePhoneUpdate}
743
844
  requiredFields={requiredFields}
744
845
  hideUpdateButton
745
- onClose={() => setIsOpen(false)}
846
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
847
+ onClose={() => {
848
+ setIsOpen(false)
849
+ handlePlaceOrder(null, true)
850
+ }}
851
+ setIsOpen={setIsOpen}
746
852
  />
747
853
  </View>
748
854
  </OModal>
855
+ <OModal
856
+ open={openModal.signup}
857
+ onClose={() => setOpenModal({ ...openModal, signup: false })}
858
+ >
859
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
860
+ <SignupForm
861
+ handleSuccessSignup={handleSuccessSignup}
862
+ isGuest
863
+ signupButtonText={t('SIGNUP', 'Signup')}
864
+ useSignupByEmail
865
+ useChekoutFileds
866
+ />
867
+ </ScrollView>
868
+ </OModal>
869
+ <OModal
870
+ open={openModal.login}
871
+ onClose={() => setOpenModal({ ...openModal, login: false })}
872
+ >
873
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
874
+ <LoginForm
875
+ handleSuccessLogin={handleSuccessLogin}
876
+ isGuest
877
+ loginButtonText={t('LOGIN', 'Login')}
878
+ loginButtonBackground={theme.colors.primary}
879
+ />
880
+ </ScrollView>
881
+ </OModal>
749
882
  </ChContainer>
750
883
  </Container>
751
884
  {!cartState.loading && cart && cart?.status !== 2 && (
752
885
  <FloatingButton
753
- handleClick={() => handlePlaceOrder(null)}
886
+ handleClick={isDisabledButtonPlace ? () => vibrateApp() : () => handlePlaceOrder(null)}
754
887
  isSecondaryBtn={isDisabledButtonPlace}
755
888
  disabled={isDisabledButtonPlace}
756
- btnText={cart?.subtotal >= cart?.minimum
889
+ btnText={subtotalWithTaxes >= cart?.minimum
757
890
  ? (
758
891
  placing
759
892
  ? t('PLACING', 'Placing')