ordering-ui-react-native 0.17.74 → 0.17.75-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 (231) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -25
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +149 -118
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +37 -21
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +102 -40
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +17 -15
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +139 -174
  41. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  43. package/themes/business/src/components/StoresList/index.tsx +3 -4
  44. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  45. package/themes/business/src/components/shared/OLink.tsx +9 -2
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/components/shared/OText.tsx +6 -1
  48. package/themes/business/src/types/index.tsx +25 -10
  49. package/themes/business/src/utils/index.tsx +29 -2
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  54. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  55. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  59. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/original/index.tsx +1 -1
  62. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  63. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  64. package/themes/original/src/components/AddressList/index.tsx +25 -24
  65. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  66. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  67. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  68. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  69. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  70. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  71. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  72. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  73. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  74. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  75. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  76. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  77. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  78. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  79. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  80. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  81. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  82. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  83. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -557
  85. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  86. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  89. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  90. package/themes/original/src/components/Cart/index.tsx +76 -79
  91. package/themes/original/src/components/CartContent/index.tsx +117 -20
  92. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  93. package/themes/original/src/components/Checkout/index.tsx +281 -54
  94. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  95. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  96. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  97. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  98. package/themes/original/src/components/Favorite/index.tsx +2 -6
  99. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  100. package/themes/original/src/components/FloatingButton/index.tsx +10 -13
  101. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +7 -3
  103. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  104. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +19 -6
  105. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  106. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  107. package/themes/original/src/components/Help/index.tsx +2 -2
  108. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  109. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  110. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  111. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  112. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  113. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  114. package/themes/original/src/components/Home/index.tsx +13 -4
  115. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  117. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  118. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  119. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  120. package/themes/original/src/components/Messages/index.tsx +14 -7
  121. package/themes/original/src/components/MomentOption/index.tsx +193 -90
  122. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  123. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  125. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  126. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  127. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  128. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  129. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  130. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  131. package/themes/original/src/components/NavBar/index.tsx +20 -17
  132. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  133. package/themes/original/src/components/Notifications/index.tsx +42 -52
  134. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  135. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  136. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  137. package/themes/original/src/components/OrderDetails/index.tsx +28 -233
  138. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  139. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  140. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  141. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  142. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  143. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  144. package/themes/original/src/components/OrdersOption/index.tsx +67 -85
  145. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  146. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  147. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  148. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  149. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +77 -34
  152. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  153. package/themes/original/src/components/ProductForm/index.tsx +104 -29
  154. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  155. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  156. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  157. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  158. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  159. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  160. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  161. package/themes/original/src/components/Promotions/index.tsx +2 -2
  162. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  163. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  164. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  165. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  166. package/themes/original/src/components/Sessions/index.tsx +11 -8
  167. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  168. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  169. package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
  170. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  171. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  172. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  173. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  174. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  175. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  176. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  177. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  178. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  179. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  180. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  181. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  182. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  183. package/themes/original/src/components/UserProfileForm/index.tsx +17 -21
  184. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  185. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  186. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  187. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  188. package/themes/original/src/components/Wallets/index.tsx +56 -33
  189. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  190. package/themes/original/src/components/shared/OButton.tsx +6 -2
  191. package/themes/original/src/components/shared/OInput.tsx +6 -1
  192. package/themes/original/src/components/shared/OModal.tsx +3 -3
  193. package/themes/original/src/types/index.tsx +39 -10
  194. package/themes/original/src/utils/index.tsx +273 -1
  195. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  196. package/src/navigators/BottomNavigator.tsx +0 -117
  197. package/src/navigators/CheckoutNavigator.tsx +0 -66
  198. package/src/navigators/HomeNavigator.tsx +0 -202
  199. package/src/navigators/NavigationRef.tsx +0 -7
  200. package/src/navigators/RootNavigator.tsx +0 -269
  201. package/src/pages/Account.tsx +0 -34
  202. package/src/pages/AddressForm.tsx +0 -62
  203. package/src/pages/AddressList.tsx +0 -24
  204. package/src/pages/BusinessProductsList.tsx +0 -81
  205. package/src/pages/BusinessesListing.tsx +0 -43
  206. package/src/pages/CartList.tsx +0 -49
  207. package/src/pages/Checkout.tsx +0 -101
  208. package/src/pages/ForgotPassword.tsx +0 -24
  209. package/src/pages/Help.tsx +0 -23
  210. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  211. package/src/pages/HelpGuide.tsx +0 -23
  212. package/src/pages/HelpOrder.tsx +0 -23
  213. package/src/pages/Home.tsx +0 -36
  214. package/src/pages/IntroductoryTutorial.tsx +0 -170
  215. package/src/pages/Login.tsx +0 -47
  216. package/src/pages/MomentOption.tsx +0 -30
  217. package/src/pages/MultiCheckout.tsx +0 -31
  218. package/src/pages/MultiOrdersDetails.tsx +0 -27
  219. package/src/pages/MyOrders.tsx +0 -40
  220. package/src/pages/NetworkError.tsx +0 -24
  221. package/src/pages/NotFound.tsx +0 -22
  222. package/src/pages/OrderDetails.tsx +0 -25
  223. package/src/pages/ProductDetails.tsx +0 -55
  224. package/src/pages/Profile.tsx +0 -36
  225. package/src/pages/ReviewDriver.tsx +0 -30
  226. package/src/pages/ReviewOrder.tsx +0 -32
  227. package/src/pages/ReviewProducts.tsx +0 -30
  228. package/src/pages/Sessions.tsx +0 -22
  229. package/src/pages/Signup.tsx +0 -53
  230. package/src/pages/SpinnerLoader.tsx +0 -10
  231. package/src/pages/Splash.tsx +0 -21
@@ -1,8 +1,9 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, Vibration } from 'react-native';
1
+ import React, { useState, useEffect, useCallback } from 'react';
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,
@@ -52,6 +56,8 @@ import { OrderSummary } from '../OrderSummary';
52
56
  import { getTypesText } from '../../utils';
53
57
  import { CartStoresListing } from '../CartStoresListing';
54
58
  import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
59
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
60
+ const { useDeviceOrientation } = DeviceOrientationMethods
55
61
 
56
62
  const mapConfigs = {
57
63
  mapZoom: 16,
@@ -78,6 +84,7 @@ const CheckoutUI = (props: any) => {
78
84
  placing,
79
85
  cartState,
80
86
  cartUuid,
87
+ loyaltyPlansState,
81
88
  businessDetails,
82
89
  paymethodSelected,
83
90
  handlePaymethodChange,
@@ -88,7 +95,8 @@ const CheckoutUI = (props: any) => {
88
95
  handleChangeDeliveryOption,
89
96
  currency,
90
97
  merchantId,
91
- setPlaceSpotNumber
98
+ setPlaceSpotNumber,
99
+ maxDate
92
100
  } = props
93
101
 
94
102
  const theme = useTheme();
@@ -128,12 +136,17 @@ const CheckoutUI = (props: any) => {
128
136
 
129
137
  const [, { showToast }] = useToast();
130
138
  const [, t] = useLanguage();
131
- const [{ user, token }] = useSession();
139
+ const [{ user, token }, { login }] = useSession();
132
140
  const [ordering] = useApi()
133
141
  const [{ configs }] = useConfig();
134
142
  const [{ parsePrice, parseDate }] = useUtils();
135
143
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
136
144
  const [validationFields] = useValidationFields();
145
+ const [events] = useEvent()
146
+ const [orientationState] = useDeviceOrientation();
147
+ const [isReadMore, setIsReadMore] = useState(false)
148
+ const [lengthMore, setLengthMore] = useState(false)
149
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
137
150
 
138
151
  const [errorCash, setErrorCash] = useState(false);
139
152
  const [userErrors, setUserErrors] = useState<any>([]);
@@ -145,7 +158,13 @@ const CheckoutUI = (props: any) => {
145
158
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
146
159
  const [isOpen, setIsOpen] = useState(false)
147
160
  const [requiredFields, setRequiredFields] = useState<any>([])
148
-
161
+ const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
162
+ const [allowedGuest, setAllowedGuest] = useState(false)
163
+ const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
164
+ const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
165
+ const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
166
+ const cardsMethods = ['credomatic']
167
+ const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
149
168
  const placeSpotTypes = [3, 4, 5]
150
169
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
151
170
  const isGiftCardCart = !cart?.business_id
@@ -154,7 +173,15 @@ const CheckoutUI = (props: any) => {
154
173
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
155
174
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
156
175
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
157
- const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
176
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
177
+ const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
178
+ const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
179
+ const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
180
+ const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
181
+
182
+ const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
183
+ const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
184
+ const methodsPay = ['google_pay', 'apple_pay']
158
185
 
159
186
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
160
187
  const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
@@ -162,12 +189,18 @@ const CheckoutUI = (props: any) => {
162
189
  return acc = acc + item?.summary?.tax
163
190
  return acc = acc
164
191
  }, cart?.subtotal)
192
+
193
+ const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
194
+
165
195
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
166
196
  placing || errorCash || subtotalWithTaxes < cart?.minimum ||
197
+ (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
167
198
  (options.type === 1 &&
168
199
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
169
200
  validationFields?.fields?.checkout?.driver_tip?.required &&
170
- (Number(cart?.driver_tip) <= 0))
201
+ (Number(cart?.driver_tip) <= 0)) ||
202
+ (validateCommentsCartField)
203
+ || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
171
204
 
172
205
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
173
206
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -177,6 +210,9 @@ const CheckoutUI = (props: any) => {
177
210
 
178
211
  const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
179
212
 
213
+ const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
214
+ const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
215
+ const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
180
216
  const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
181
217
  return {
182
218
  value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
@@ -189,9 +225,36 @@ const CheckoutUI = (props: any) => {
189
225
  }
190
226
  }
191
227
 
228
+ const vibrateApp = (impact?: string) => {
229
+ const options = {
230
+ enableVibrateFallback: true,
231
+ ignoreAndroidSystemSettings: false
232
+ };
233
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
234
+ }
235
+
236
+ const handleSuccessSignup = (user: any) => {
237
+ login({
238
+ user,
239
+ token: user?.session?.access_token
240
+ })
241
+ openModal?.isGuest && handlePlaceOrderAsGuest()
242
+ setOpenModal({ ...openModal, signup: false, isGuest: false })
243
+ }
244
+
245
+ const handleSuccessLogin = (user: any) => {
246
+ if (user) setOpenModal({ ...openModal, login: false })
247
+ }
248
+
192
249
  const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
193
- if (!userErrors.length && !requiredFields?.length || forcePlace) {
194
- handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
250
+ if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
251
+ setOpenModal({ ...openModal, signup: true, isGuest: true })
252
+ return
253
+ }
254
+
255
+ if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
256
+ vibrateApp()
257
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
195
258
  return
196
259
  }
197
260
  if (requiredFields?.length) {
@@ -206,6 +269,11 @@ const CheckoutUI = (props: any) => {
206
269
  setIsUserDetailsEdit(true)
207
270
  }
208
271
 
272
+ const handlePlaceOrderAsGuest = () => {
273
+ setIsOpen(false)
274
+ handlerClickPlaceOrder && handlerClickPlaceOrder()
275
+ }
276
+
209
277
  const handlePaymentMethodClick = (paymethod: any) => {
210
278
  setShowGateway({ closedByUser: false, open: true })
211
279
  setWebviewPaymethod(paymethod)
@@ -224,7 +292,7 @@ const CheckoutUI = (props: any) => {
224
292
  const checkValidationFields = () => {
225
293
  setUserErrors([])
226
294
  const errors = []
227
- const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
295
+ const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
228
296
  const _requiredFields: any = []
229
297
 
230
298
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
@@ -272,7 +340,7 @@ const CheckoutUI = (props: any) => {
272
340
  useEffect(() => {
273
341
  if (cart?.products?.length === 0) {
274
342
  if (cart?.business?.slug) {
275
- onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
343
+ onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
276
344
  } else {
277
345
  onNavigationRedirect('Wallets')
278
346
  }
@@ -298,6 +366,24 @@ const CheckoutUI = (props: any) => {
298
366
  )
299
367
  }
300
368
 
369
+ useEffect(() => {
370
+ cart && events.emit('checkout_started', cart)
371
+ }, [])
372
+
373
+ useEffect(() => {
374
+ if (cart?.paymethod_data?.gateway === 'credomatic') {
375
+ if (cart?.paymethod_data?.status === 2) {
376
+ setShowGateway({ ...showGateway, open: true })
377
+ } else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
378
+ setShowGateway({ ...showGateway, open: false })
379
+ }
380
+ }
381
+ }, [cart?.paymethod_data])
382
+
383
+ const onTextLayout = useCallback((e: any) => {
384
+ setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
385
+ }, [])
386
+
301
387
  return (
302
388
  <>
303
389
  <Container noPadding>
@@ -305,11 +391,12 @@ const CheckoutUI = (props: any) => {
305
391
  <NavBar
306
392
  title={t('CHECKOUT', 'Checkout')}
307
393
  titleAlign={'center'}
308
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
394
+ onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
309
395
  showCall={false}
310
- btnStyle={{ paddingLeft: 0 }}
396
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
311
397
  titleWrapStyle={{ paddingHorizontal: 0 }}
312
398
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
399
+ style={{ marginTop: 20 }}
313
400
  />
314
401
  </View>
315
402
  <ChContainer style={styles.pagePadding}>
@@ -352,7 +439,7 @@ const CheckoutUI = (props: any) => {
352
439
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
353
440
  </ChSection>
354
441
 
355
- {!isGiftCardCart && (
442
+ {!isGiftCardCart && !hideBusinessDetails && (
356
443
  <ChSection>
357
444
  <ChBusinessDetails>
358
445
  {
@@ -383,9 +470,30 @@ const CheckoutUI = (props: any) => {
383
470
  <OText size={12} lineHeight={18} weight={'400'}>
384
471
  {businessDetails?.business?.cellphone}
385
472
  </OText>
386
- <OText size={12} lineHeight={18} weight={'400'}>
387
- {businessDetails?.business?.address}
388
- </OText>
473
+ {!hideBusinessAddress && (
474
+ <OText size={12} lineHeight={18} weight={'400'}>
475
+ {businessDetails?.business?.address}
476
+ </OText>
477
+ )}
478
+ {businessDetails?.business?.address_notes && (
479
+ <>
480
+ <OText
481
+ size={12}
482
+ lineHeight={18}
483
+ numberOfLines={isReadMore ? 20 : 3}
484
+ onTextLayout={onTextLayout}
485
+ >
486
+ {businessDetails?.business?.address_notes}
487
+ </OText>
488
+ {lengthMore && (
489
+ <TouchableOpacity
490
+ onPress={() => setIsReadMore(!isReadMore)}
491
+ >
492
+ <OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
493
+ </TouchableOpacity>
494
+ )}
495
+ </>
496
+ )}
389
497
  </View>
390
498
  </>
391
499
  )}
@@ -401,33 +509,63 @@ const CheckoutUI = (props: any) => {
401
509
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
402
510
  </ChSection>
403
511
  )}
512
+ {!hideCustomerDetails && (
404
513
 
405
- <ChSection>
406
- <ChUserDetails>
407
- {cartState.loading ? (
408
- <Placeholder Animation={Fade}>
409
- <PlaceholderLine height={20} />
410
- <PlaceholderLine height={12} />
411
- <PlaceholderLine height={12} />
412
- <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
413
- </Placeholder>
414
- ) : (
415
- <UserDetails
416
- isUserDetailsEdit={isUserDetailsEdit}
417
- HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
418
- cartStatus={cart?.status}
419
- businessId={cart?.business_id}
420
- useValidationFields
421
- useDefualtSessionManager
422
- useSessionUser
423
- isCheckout
424
- phoneUpdate={phoneUpdate}
425
- togglePhoneUpdate={togglePhoneUpdate}
426
- />
427
- )}
428
- </ChUserDetails>
429
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
430
- </ChSection>
514
+ <ChSection>
515
+ <ChUserDetails>
516
+ {cartState.loading ? (
517
+ <Placeholder Animation={Fade}>
518
+ <PlaceholderLine height={20} />
519
+ <PlaceholderLine height={12} />
520
+ <PlaceholderLine height={12} />
521
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
522
+ </Placeholder>
523
+ ) : (
524
+ (user?.guest_id && !allowedGuest) ? (
525
+ <View>
526
+ <HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
527
+ <OButton
528
+ text={t('SIGN_UP', 'Sign up')}
529
+ textStyle={{ color: theme.colors.white }}
530
+ style={{ borderRadius: 7.6, marginTop: 20 }}
531
+ onClick={() => setOpenModal({ ...openModal, signup: true })}
532
+ />
533
+ <OButton
534
+ text={t('LOGIN', 'Login')}
535
+ textStyle={{ color: theme.colors.primary }}
536
+ bgColor={theme.colors.white}
537
+ borderColor={theme.colors.primary}
538
+ style={{ borderRadius: 7.6, marginTop: 20 }}
539
+ onClick={() => setOpenModal({ ...openModal, login: true })}
540
+ />
541
+ <OButton
542
+ text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
543
+ textStyle={{ color: theme.colors.black }}
544
+ bgColor={theme.colors.white}
545
+ borderColor={theme.colors.black}
546
+ style={{ borderRadius: 7.6, marginTop: 20 }}
547
+ onClick={() => setAllowedGuest(true)}
548
+ />
549
+ </View>
550
+ ) : (
551
+ <UserDetails
552
+ isUserDetailsEdit={isUserDetailsEdit}
553
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
554
+ cartStatus={cart?.status}
555
+ businessId={cart?.business_id}
556
+ useValidationFields
557
+ useDefualtSessionManager
558
+ useSessionUser
559
+ isCheckout
560
+ phoneUpdate={phoneUpdate}
561
+ togglePhoneUpdate={togglePhoneUpdate}
562
+ />
563
+ )
564
+ )}
565
+ </ChUserDetails>
566
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
567
+ </ChSection>
568
+ )}
431
569
 
432
570
  {options?.type === 1 && !isGiftCardCart && (
433
571
  <DeliveryOptionsContainer>
@@ -470,7 +608,7 @@ const CheckoutUI = (props: any) => {
470
608
  data: deliveryOptions || [],
471
609
  renderItem: ({ item }: any) => (
472
610
  <TouchableOpacity
473
- onPress={() => changeDeliveryOption(item.value)}
611
+ onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
474
612
  disabled={
475
613
  deliveryOptionSelected === item.value
476
614
  }
@@ -508,7 +646,7 @@ const CheckoutUI = (props: any) => {
508
646
  </ChSection>
509
647
  )}
510
648
 
511
- {!isGiftCardCart && (
649
+ {!isGiftCardCart && !hideBusinessMap && (
512
650
  <ChSection>
513
651
  <ChAddress>
514
652
  {(businessDetails?.loading || cartState.loading) ? (
@@ -519,7 +657,7 @@ const CheckoutUI = (props: any) => {
519
657
  ) : (
520
658
  <AddressDetails
521
659
  navigation={navigation}
522
- location={businessDetails?.business?.location}
660
+ location={options?.address?.location}
523
661
  businessLogo={businessDetails?.business?.logo}
524
662
  isCartPending={cart?.status === 2}
525
663
  uuid={cartUuid}
@@ -548,13 +686,14 @@ const CheckoutUI = (props: any) => {
548
686
  <DriverTips
549
687
  uuid={cartUuid}
550
688
  businessId={cart?.business_id}
551
- driverTipsOptions={driverTipsOptions}
552
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
689
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
690
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
553
691
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
554
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
692
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
555
693
  ? cart?.driver_tip
556
694
  : cart?.driver_tip_rate}
557
695
  useOrderContext
696
+ cart={cart}
558
697
  />
559
698
  </ChDriverTips>
560
699
  </ChSection>
@@ -577,7 +716,7 @@ const CheckoutUI = (props: any) => {
577
716
  cart={cart}
578
717
  isDisabled={cart?.status === 2}
579
718
  businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
580
- isLoading={!isGiftCardCart ? businessDetails.loading : false}
719
+ isLoading={!isGiftCardCart ? businessDetails.loading : false}
581
720
  paymethods={businessDetails?.business?.paymethods}
582
721
  onPaymentChange={handlePaymethodChange}
583
722
  errorCash={errorCash}
@@ -587,6 +726,12 @@ const CheckoutUI = (props: any) => {
587
726
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
588
727
  handlePlaceOrder={handlePlaceOrder}
589
728
  merchantId={merchantId}
729
+ setMethodPaySupported={setMethodPaySupported}
730
+ methodPaySupported={methodPaySupported}
731
+ placeByMethodPay={placeByMethodPay}
732
+ setPlaceByMethodPay={setPlaceByMethodPay}
733
+ cardList={cardList}
734
+ setCardList={setCardList}
590
735
  />
591
736
  </ChPaymethods>
592
737
  </ChSection>
@@ -596,6 +741,7 @@ const CheckoutUI = (props: any) => {
596
741
  <WalletPaymentOptionContainer>
597
742
  <PaymentOptionWallet
598
743
  cart={cart}
744
+ loyaltyPlansState={loyaltyPlansState}
599
745
  businessId={cart?.business_id}
600
746
  businessConfigs={businessDetails?.business?.configs}
601
747
  />
@@ -665,6 +811,12 @@ const CheckoutUI = (props: any) => {
665
811
  isCartPending={cart?.status === 2}
666
812
  onNavigationRedirect={onNavigationRedirect}
667
813
  placeSpotTypes={placeSpotTypes}
814
+ businessConfigs={businessConfigs}
815
+ maxDate={maxDate}
816
+ loyaltyRewardRate={
817
+ creditPointPlanOnBusiness?.accumulation_rate ??
818
+ (!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
819
+ }
668
820
  />
669
821
  </>
670
822
  )}
@@ -674,7 +826,7 @@ const CheckoutUI = (props: any) => {
674
826
 
675
827
  {!cartState.loading && cart && (
676
828
  <View>
677
- <ChErrors style={{ marginBottom: 10 }}>
829
+ <ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
678
830
  {!cart?.valid_address && cart?.status !== 2 && (
679
831
  <OText
680
832
  color={theme.colors.error}
@@ -701,6 +853,14 @@ const CheckoutUI = (props: any) => {
701
853
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
702
854
  </OText>
703
855
  )}
856
+ {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
857
+ <OText
858
+ color={theme.colors.error}
859
+ size={12}
860
+ >
861
+ {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
862
+ </OText>
863
+ )}
704
864
  {options.type === 1 &&
705
865
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
706
866
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -712,6 +872,15 @@ const CheckoutUI = (props: any) => {
712
872
  {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
713
873
  </OText>
714
874
  )}
875
+
876
+ {validateCommentsCartField && (
877
+ <OText
878
+ color={theme.colors.error}
879
+ size={12}
880
+ >
881
+ {t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
882
+ </OText>
883
+ )}
715
884
  </ChErrors>
716
885
  </View>
717
886
  )}
@@ -744,18 +913,52 @@ const CheckoutUI = (props: any) => {
744
913
  togglePhoneUpdate={togglePhoneUpdate}
745
914
  requiredFields={requiredFields}
746
915
  hideUpdateButton
916
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
747
917
  onClose={() => {
748
918
  setIsOpen(false)
749
919
  handlePlaceOrder(null, true)
750
920
  }}
921
+ setIsOpen={setIsOpen}
751
922
  />
752
923
  </View>
753
924
  </OModal>
925
+ <OModal
926
+ open={openModal.signup}
927
+ onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
928
+ >
929
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
930
+ <SignupForm
931
+ handleSuccessSignup={handleSuccessSignup}
932
+ isGuest
933
+ signupButtonText={t('SIGNUP', 'Signup')}
934
+ useSignupByEmail
935
+ useChekoutFileds
936
+ />
937
+ </ScrollView>
938
+ </OModal>
939
+ <OModal
940
+ open={openModal.login}
941
+ onClose={() => setOpenModal({ ...openModal, login: false })}
942
+ >
943
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
944
+ <LoginForm
945
+ handleSuccessLogin={handleSuccessLogin}
946
+ isGuest
947
+ loginButtonText={t('LOGIN', 'Login')}
948
+ loginButtonBackground={theme.colors.primary}
949
+ />
950
+ </ScrollView>
951
+ </OModal>
754
952
  </ChContainer>
755
953
  </Container>
756
954
  {!cartState.loading && cart && cart?.status !== 2 && (
757
955
  <FloatingButton
758
- handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
956
+ handleClick={
957
+ isDisabledButtonPlace
958
+ ? () => vibrateApp()
959
+ : methodsPay.includes(paymethodSelected?.gateway)
960
+ ? () => setPlaceByMethodPay(true)
961
+ : () => handlePlaceOrder(null)}
759
962
  isSecondaryBtn={isDisabledButtonPlace}
760
963
  disabled={isDisabledButtonPlace}
761
964
  btnText={subtotalWithTaxes >= cart?.minimum
@@ -798,6 +1001,29 @@ const CheckoutUI = (props: any) => {
798
1001
  locationId={'L1NGAY5M6KJRX'}
799
1002
  />
800
1003
  )}
1004
+ {cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
1005
+ <PaymentOptionsWebView
1006
+ title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
1007
+ onNavigationRedirect={onNavigationRedirect}
1008
+ uri={credomaticUrl}
1009
+ user={user}
1010
+ cart={cart}
1011
+ additionalParams={{
1012
+ type: 'auth',
1013
+ key_id: credomaticKeyId,
1014
+ hash: cart?.paymethod_data?.result?.hash,
1015
+ time: cart?.paymethod_data?.result?.time,
1016
+ amount: cart?.total,
1017
+ orderid: cart?.uuid,
1018
+ ccnumber: cardList?.cards?.[0]?.number,
1019
+ ccexp: cardList?.cards?.[0]?.expiryString,
1020
+ cvv: cardList?.cards?.[0]?.cvc,
1021
+ redirect: credomaticUrl
1022
+ }}
1023
+ webviewPaymethod={webviewPaymethod}
1024
+ setShowGateway={setShowGateway}
1025
+ />
1026
+ )}
801
1027
  </>
802
1028
  )
803
1029
  }
@@ -824,7 +1050,8 @@ export const Checkout = (props: any) => {
824
1050
  const getOrder = async (cartId: any) => {
825
1051
  try {
826
1052
  let result: any = {}
827
- const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
1053
+ const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
1054
+ const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
828
1055
  if (cart) {
829
1056
  result = { ...cart }
830
1057
  } else {
@@ -47,7 +47,7 @@ export const CitiesControl = (props: any) => {
47
47
  return (
48
48
  <Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
49
49
  <View>
50
- {cities?.map((city: any) => (
50
+ {cities?.map((city: any) => city?.enabled && (
51
51
  <CityElement
52
52
  key={city?.id}
53
53
  activeOpacity={1}
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { StyleSheet, Alert, Text } from 'react-native';
3
- import { CouponControl as CouponController, useLanguage } from 'ordering-components/native';
3
+ import { CouponControl as CouponController, useLanguage, useEvent } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
6
6
  CContainer,
@@ -18,11 +18,13 @@ const CouponControlUI = (props: any) => {
18
18
  handleRemoveCouponClick,
19
19
  onChangeInputCoupon,
20
20
  confirm,
21
- setConfirm
21
+ setConfirm,
22
+ cart
22
23
  } = props
23
24
 
24
25
  const [, t] = useLanguage()
25
26
  const theme = useTheme();
27
+ const [events] = useEvent()
26
28
 
27
29
  const styles = StyleSheet.create({
28
30
  inputsStyle: {
@@ -45,6 +47,11 @@ const CouponControlUI = (props: any) => {
45
47
  setConfirm({ ...confirm, open: false, error: false })
46
48
  }
47
49
 
50
+ const onButtonApplyClick = () => {
51
+ events.emit('coupon_entered', { ...cart, coupon: couponInput })
52
+ handleButtonApplyClick()
53
+ }
54
+
48
55
  useEffect(() => {
49
56
  if (confirm.content) {
50
57
  Alert.alert(
@@ -94,7 +101,7 @@ const CouponControlUI = (props: any) => {
94
101
  inputStyle={{ fontSize: 12 }}
95
102
  />
96
103
  <OButton
97
- onClick={() => handleButtonApplyClick()}
104
+ onClick={() => onButtonApplyClick()}
98
105
  bgColor={theme.colors.primary}
99
106
  borderColor={theme.colors.primary}
100
107
  textStyle={{ color: 'white', fontSize: 12 }}