ordering-ui-react-native 0.16.49 → 0.16.50-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 (205) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessInformation/index.tsx +33 -4
  6. package/src/components/BusinessInformation/styles.tsx +2 -2
  7. package/src/components/BusinessProductsList/index.tsx +10 -10
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +2 -1
  10. package/src/components/LanguageSelector/index.tsx +21 -16
  11. package/src/components/Messages/index.tsx +2 -2
  12. package/src/components/NotificationSetting/index.tsx +85 -0
  13. package/src/components/OrdersOption/index.tsx +54 -56
  14. package/src/components/PaymentOptions/index.tsx +298 -345
  15. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  16. package/src/components/ReviewProducts/index.tsx +11 -0
  17. package/src/components/SingleProductReview/index.tsx +8 -5
  18. package/src/components/StripeElementsForm/index.tsx +25 -16
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OBottomPopup.tsx +6 -2
  21. package/src/components/shared/OToast.tsx +4 -4
  22. package/src/index.tsx +2 -0
  23. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  24. package/src/utils/index.tsx +2 -1
  25. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +259 -238
  26. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  27. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  28. package/themes/business/src/components/Chat/index.tsx +40 -32
  29. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  30. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  31. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  32. package/themes/business/src/components/MapView/index.tsx +12 -1
  33. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  34. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  35. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
  36. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  37. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  38. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  39. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  40. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  43. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  46. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  47. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  48. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  49. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  50. package/themes/business/src/components/PreviousOrders/index.tsx +332 -244
  51. package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
  52. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  53. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  54. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  55. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  56. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  57. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  58. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  59. package/themes/business/src/components/shared/OLink.tsx +24 -12
  60. package/themes/business/src/components/shared/OText.tsx +3 -2
  61. package/themes/business/src/types/index.tsx +25 -11
  62. package/themes/business/src/utils/index.tsx +10 -0
  63. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  64. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  65. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  67. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  68. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  69. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  70. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  71. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  72. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/types/index.d.ts +2 -0
  76. package/themes/original/index.tsx +8 -0
  77. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  78. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  79. package/themes/original/src/components/AddressList/index.tsx +1 -1
  80. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  83. package/themes/original/src/components/BusinessController/index.tsx +203 -94
  84. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  85. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  86. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  87. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  90. package/themes/original/src/components/BusinessListingSearch/index.tsx +85 -137
  91. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  92. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -83
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +19 -12
  98. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +15 -4
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +276 -122
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +48 -11
  103. package/themes/original/src/components/BusinessesListing/index.tsx +82 -28
  104. package/themes/original/src/components/Cart/index.tsx +82 -15
  105. package/themes/original/src/components/Cart/styles.tsx +4 -0
  106. package/themes/original/src/components/CartContent/index.tsx +27 -17
  107. package/themes/original/src/components/CartContent/styles.tsx +1 -1
  108. package/themes/original/src/components/Checkout/index.tsx +114 -118
  109. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  110. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  112. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  113. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  114. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  115. package/themes/original/src/components/FloatingButton/index.tsx +13 -11
  116. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  117. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  118. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  119. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  123. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  124. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +35 -20
  130. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  131. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  133. package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +88 -24
  136. package/themes/original/src/components/NavBar/index.tsx +11 -5
  137. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  138. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  139. package/themes/original/src/components/Notifications/index.tsx +148 -0
  140. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +162 -50
  142. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  143. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  144. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  145. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  146. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  147. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  149. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  150. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  152. package/themes/original/src/components/OrdersOption/index.tsx +91 -53
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  156. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  157. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +645 -664
  160. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  163. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  167. package/themes/original/src/components/Promotions/index.tsx +232 -219
  168. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  169. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  170. package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
  171. package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
  172. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  173. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
  174. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
  175. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  176. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  177. package/themes/original/src/components/ServiceForm/index.tsx +341 -267
  178. package/themes/original/src/components/SignupForm/index.tsx +160 -113
  179. package/themes/original/src/components/SingleOrderCard/index.tsx +219 -129
  180. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  181. package/themes/original/src/components/SingleProductCard/index.tsx +182 -105
  182. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  183. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  184. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  185. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  186. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  187. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  188. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  189. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  190. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  191. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  192. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  193. package/themes/original/src/components/Wallets/index.tsx +176 -164
  194. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  195. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  197. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  198. package/themes/original/src/components/shared/OButton.tsx +10 -3
  199. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  200. package/themes/original/src/components/shared/OInput.tsx +10 -1
  201. package/themes/original/src/layouts/Container.tsx +13 -9
  202. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  203. package/themes/original/src/types/index.tsx +86 -28
  204. package/themes/original/src/utils/index.tsx +103 -58
  205. 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, Vibration } 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'
@@ -24,6 +24,7 @@ import { DriverTips } from '../DriverTips';
24
24
  import { NotFoundSource } from '../NotFoundSource';
25
25
  import { UserDetails } from '../UserDetails';
26
26
  import { PaymentOptionWallet } from '../PaymentOptionWallet';
27
+ import { PlaceSpot } from '../PlaceSpot'
27
28
 
28
29
  import {
29
30
  ChContainer,
@@ -86,7 +87,8 @@ const CheckoutUI = (props: any) => {
86
87
  instructionsOptions,
87
88
  handleChangeDeliveryOption,
88
89
  currency,
89
- merchantId
90
+ merchantId,
91
+ setPlaceSpotNumber
90
92
  } = props
91
93
 
92
94
  const theme = useTheme();
@@ -105,8 +107,7 @@ const CheckoutUI = (props: any) => {
105
107
  padding: 20
106
108
  },
107
109
  pagePadding: {
108
- paddingLeft: 40,
109
- paddingRight: 40
110
+ paddingHorizontal: 40
110
111
  },
111
112
  icon: {
112
113
  top: 15,
@@ -118,9 +119,11 @@ const CheckoutUI = (props: any) => {
118
119
  paddingHorizontal: 40,
119
120
  width: '100%'
120
121
  },
121
- wrapperNavbar: Platform.OS === 'ios'
122
- ? { paddingVertical: 0, paddingHorizontal: 40 }
123
- : { paddingVertical: 20, paddingHorizontal: 40 }
122
+ wrapperNavbar: {
123
+ paddingVertical: 0,
124
+ paddingHorizontal: 40,
125
+ marginVertical: 2
126
+ }
124
127
  })
125
128
 
126
129
  const [, { showToast }] = useToast();
@@ -141,18 +144,25 @@ const CheckoutUI = (props: any) => {
141
144
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
142
145
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
143
146
  const [isOpen, setIsOpen] = useState(false)
144
- const [requiredFields, setRequiredFields] = useState<any>([])
147
+ const [requiredFields, setRequiredFields] = useState<any>([])
145
148
 
146
- const placeSpotTypes = [3, 4]
149
+ const placeSpotTypes = [3, 4, 5]
150
+ const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
147
151
  const businessConfigs = businessDetails?.business?.configs ?? []
148
152
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
149
153
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
150
154
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
151
155
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
156
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
152
157
 
153
158
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
154
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
155
- cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
159
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
160
+ if (item?.type === 1)
161
+ return acc = acc + item?.summary?.tax
162
+ return acc = acc
163
+ }, cart?.subtotal)
164
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
165
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
156
166
  (options.type === 1 &&
157
167
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
158
168
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -178,15 +188,15 @@ const CheckoutUI = (props: any) => {
178
188
  }
179
189
  }
180
190
 
181
- const handlePlaceOrder = (confirmPayment : any) => {
182
- if (!userErrors.length && !requiredFields?.length) {
191
+ const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
192
+ if (!userErrors.length && !requiredFields?.length || forcePlace) {
183
193
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
184
194
  return
185
195
  }
186
196
  if (requiredFields?.length) {
187
- setIsOpen(true)
188
- return
189
- }
197
+ setIsOpen(true)
198
+ return
199
+ }
190
200
  let stringError = ''
191
201
  Object.values(userErrors).map((item: any, i: number) => {
192
202
  stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
@@ -217,7 +227,7 @@ const CheckoutUI = (props: any) => {
217
227
  const _requiredFields: any = []
218
228
 
219
229
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
220
- if (field?.required && !notFields.includes(field.code)) {
230
+ if (field?.required && !notFields.includes(field.code) && field?.enabled) {
221
231
  if (!user[field?.code]) {
222
232
  _requiredFields.push(field?.code)
223
233
  }
@@ -258,10 +268,6 @@ const CheckoutUI = (props: any) => {
258
268
  }
259
269
  }, [errors])
260
270
 
261
- // useEffect(() => {
262
- // handlePaymethodChange(null)
263
- // }, [cart?.total])
264
-
265
271
  useEffect(() => {
266
272
  if (cart?.products?.length === 0) {
267
273
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
@@ -272,6 +278,21 @@ const CheckoutUI = (props: any) => {
272
278
  onFailPaypal()
273
279
  }, [showGateway.closedByUser])
274
280
 
281
+ const HeaderTitle = (props: any) => {
282
+ const { text } = props
283
+ return (
284
+ <OText
285
+ size={16}
286
+ lineHeight={24}
287
+ weight={'500'}
288
+ mBottom={props.mb ?? 10}
289
+ color={theme.colors.textNormal}
290
+ >
291
+ {text}
292
+ </OText>
293
+ )
294
+ }
295
+
275
296
  return (
276
297
  <>
277
298
  <Container noPadding>
@@ -282,7 +303,6 @@ const CheckoutUI = (props: any) => {
282
303
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
283
304
  showCall={false}
284
305
  btnStyle={{ paddingLeft: 0 }}
285
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
286
306
  titleWrapStyle={{ paddingHorizontal: 0 }}
287
307
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
288
308
  />
@@ -290,13 +310,20 @@ const CheckoutUI = (props: any) => {
290
310
  <ChContainer style={styles.pagePadding}>
291
311
  <ChSection style={{ paddingTop: 0 }}>
292
312
  <ChHeader>
293
- {/* <OrderTypeSelector configTypes={configTypes} /> */}
294
- <CHMomentWrapper onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
295
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(options?.type || 1), 'Delivery')}</OText>
313
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
314
+ <OText
315
+ size={12}
316
+ numberOfLines={1}
317
+ ellipsizeMode={'tail'}
318
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
319
+ >
320
+ {t(getTypesText(options?.type || 1), 'Delivery')}
321
+ </OText>
296
322
  <OIcon
297
323
  src={theme.images.general.arrow_down}
298
324
  width={10}
299
325
  style={{ marginStart: 8 }}
326
+ {...(isChewLayout && { color: 'white' })}
300
327
  />
301
328
  </CHMomentWrapper>
302
329
  <CHMomentWrapper
@@ -327,10 +354,10 @@ const CheckoutUI = (props: any) => {
327
354
  !businessDetails?.error &&
328
355
  (
329
356
  <Placeholder Animation={Fade}>
330
- <PlaceholderLine height={20} width={70} />
331
- <PlaceholderLine height={10} width={60} />
332
- <PlaceholderLine height={10} width={60} />
333
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
357
+ <PlaceholderLine height={20} />
358
+ <PlaceholderLine height={12} />
359
+ <PlaceholderLine height={12} />
360
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
334
361
  </Placeholder>
335
362
  )}
336
363
  {
@@ -339,9 +366,7 @@ const CheckoutUI = (props: any) => {
339
366
  Object.values(businessDetails?.business).length > 0 &&
340
367
  (
341
368
  <>
342
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10}>
343
- {t('BUSINESS_DETAILS', 'Business Details')}
344
- </OText>
369
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
345
370
  <View>
346
371
  <OText size={12} lineHeight={18} weight={'400'}>
347
372
  {businessDetails?.business?.name}
@@ -360,9 +385,7 @@ const CheckoutUI = (props: any) => {
360
385
  )}
361
386
  {businessDetails?.error && businessDetails?.error?.length > 0 && (
362
387
  <View>
363
- <OText size={16} lineHeight={24} weight={'500'}>
364
- {t('BUSINESS_DETAILS', 'Business Details')}
365
- </OText>
388
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
366
389
  <NotFoundSource
367
390
  content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
368
391
  />
@@ -376,14 +399,15 @@ const CheckoutUI = (props: any) => {
376
399
  <ChUserDetails>
377
400
  {cartState.loading ? (
378
401
  <Placeholder Animation={Fade}>
379
- <PlaceholderLine height={20} width={70} />
380
- <PlaceholderLine height={10} width={60} />
381
- <PlaceholderLine height={10} width={60} />
382
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
402
+ <PlaceholderLine height={20} />
403
+ <PlaceholderLine height={12} />
404
+ <PlaceholderLine height={12} />
405
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
383
406
  </Placeholder>
384
407
  ) : (
385
408
  <UserDetails
386
409
  isUserDetailsEdit={isUserDetailsEdit}
410
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
387
411
  cartStatus={cart?.status}
388
412
  businessId={cart?.business_id}
389
413
  useValidationFields
@@ -403,13 +427,13 @@ const CheckoutUI = (props: any) => {
403
427
  {cartState.loading || deliveryOptionSelected === undefined ? (
404
428
  <View style={{ height: 110 }}>
405
429
  <Placeholder Animation={Fade}>
406
- <PlaceholderLine height={20} width={70} />
407
- <PlaceholderLine height={40} width={100} />
430
+ <PlaceholderLine height={20} />
431
+ <PlaceholderLine height={40} />
408
432
  </Placeholder>
409
433
  </View>
410
434
  ) : (
411
- <>
412
- <OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
435
+ <ChSection>
436
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
413
437
  <View
414
438
  style={{
415
439
  backgroundColor: theme.colors.inputDisabled,
@@ -428,7 +452,7 @@ const CheckoutUI = (props: any) => {
428
452
  <OText
429
453
  size={14}
430
454
  >
431
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
455
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
432
456
  </OText>
433
457
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
434
458
  </DeliveryOptionItem>
@@ -455,7 +479,7 @@ const CheckoutUI = (props: any) => {
455
479
  />
456
480
  </View>
457
481
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
458
- </>
482
+ </ChSection>
459
483
  )}
460
484
 
461
485
  </DeliveryOptionsContainer>
@@ -477,29 +501,6 @@ const CheckoutUI = (props: any) => {
477
501
  </ChSection>
478
502
  )}
479
503
 
480
- {/* <ChSection>
481
- <ChTotal>
482
- {
483
- (
484
- <>
485
- <OIcon
486
- url={businessLogo || businessDetails?.business?.logo}
487
- width={80}
488
- height={80}
489
- borderRadius={80}
490
- />
491
- <View style={{ marginLeft: 10, width: '85%' }}>
492
- <OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
493
- {businessName || businessDetails?.business?.name}
494
- </OText>
495
- <OText size={22}>
496
- {cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
497
- </OText>
498
- </View>
499
- </>
500
- )}
501
- </ChTotal>
502
- </ChSection> */}
503
504
  <ChSection>
504
505
  <ChAddress>
505
506
  {(businessDetails?.loading || cartState.loading) ? (
@@ -516,6 +517,7 @@ const CheckoutUI = (props: any) => {
516
517
  uuid={cartUuid}
517
518
  apiKey={configs?.google_maps_api_key?.value}
518
519
  mapConfigs={mapConfigs}
520
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
519
521
  />
520
522
  )}
521
523
  </ChAddress>
@@ -532,9 +534,7 @@ const CheckoutUI = (props: any) => {
532
534
  (
533
535
  <ChSection>
534
536
  <ChDriverTips>
535
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
536
- {t('DRIVER_TIPS', 'Driver Tips')}
537
- </OText>
537
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
538
538
  <DriverTips
539
539
  uuid={cartUuid}
540
540
  businessId={cart?.business_id}
@@ -553,9 +553,7 @@ const CheckoutUI = (props: any) => {
553
553
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
554
554
  <ChSection>
555
555
  <ChPaymethods>
556
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
557
- {t('PAYMENT_METHOD', 'Payment Method')}
558
- </OText>
556
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
559
557
  {!cartState.loading && cart?.status === 4 && (
560
558
  <OText
561
559
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -595,6 +593,21 @@ const CheckoutUI = (props: any) => {
595
593
  )}
596
594
 
597
595
 
596
+ {!cartState.loading && placeSpotsEnabled && (
597
+ <>
598
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
599
+ <PlaceSpot
600
+ isCheckout
601
+ isInputMode
602
+ cart={cart}
603
+ spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
604
+ setPlaceSpotNumber={setPlaceSpotNumber}
605
+ vehicleDefault={cart?.vehicle}
606
+ />
607
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
608
+ </>
609
+ )}
610
+
598
611
  {!cartState.loading && cart && (
599
612
  <ChSection>
600
613
  <ChCart>
@@ -606,19 +619,12 @@ const CheckoutUI = (props: any) => {
606
619
  ) : (
607
620
  <>
608
621
  <CartHeader>
609
- <OText
610
- size={16}
611
- lineHeight={24}
612
- color={theme.colors.textNormal}
613
- style={{ fontWeight: '500' }}
614
- >
615
- {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
616
- </OText>
622
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
617
623
  <TouchableOpacity
618
624
  onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
619
625
  >
620
626
  <OText
621
- size={10}
627
+ size={12}
622
628
  lineHeight={15}
623
629
  color={theme.colors.primary}
624
630
  style={{ textDecorationLine: 'underline' }}
@@ -635,7 +641,7 @@ const CheckoutUI = (props: any) => {
635
641
  <OText
636
642
  size={12}
637
643
  lineHeight={18}
638
- color={theme.colors.textSecondary}
644
+ color={theme.colors.primary}
639
645
  style={{ textDecorationLine: 'underline' }}
640
646
  >
641
647
  {t('CHANGE_STORE', 'Change store')}
@@ -646,6 +652,7 @@ const CheckoutUI = (props: any) => {
646
652
  cart={cart}
647
653
  isCartPending={cart?.status === 2}
648
654
  onNavigationRedirect={onNavigationRedirect}
655
+ placeSpotTypes={placeSpotTypes}
649
656
  />
650
657
  </>
651
658
  )}
@@ -682,14 +689,6 @@ const CheckoutUI = (props: any) => {
682
689
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
683
690
  </OText>
684
691
  )}
685
- {placeSpotTypes.includes(options?.type) && !cart?.place && (
686
- <OText
687
- color={theme.colors.error}
688
- size={12}
689
- >
690
- {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
691
- </OText>
692
- )}
693
692
  {options.type === 1 &&
694
693
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
695
694
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -733,7 +732,10 @@ const CheckoutUI = (props: any) => {
733
732
  togglePhoneUpdate={togglePhoneUpdate}
734
733
  requiredFields={requiredFields}
735
734
  hideUpdateButton
736
- onClose={() => setIsOpen(false)}
735
+ onClose={() => {
736
+ setIsOpen(false)
737
+ handlePlaceOrder(null, true)
738
+ }}
737
739
  />
738
740
  </View>
739
741
  </OModal>
@@ -741,10 +743,10 @@ const CheckoutUI = (props: any) => {
741
743
  </Container>
742
744
  {!cartState.loading && cart && cart?.status !== 2 && (
743
745
  <FloatingButton
744
- handleClick={() => handlePlaceOrder(null)}
746
+ handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
745
747
  isSecondaryBtn={isDisabledButtonPlace}
746
748
  disabled={isDisabledButtonPlace}
747
- btnText={cart?.subtotal >= cart?.minimum
749
+ btnText={subtotalWithTaxes >= cart?.minimum
748
750
  ? (
749
751
  placing
750
752
  ? t('PLACING', 'Placing')
@@ -771,19 +773,6 @@ const CheckoutUI = (props: any) => {
771
773
  setShowGateway={setShowGateway}
772
774
  />
773
775
  )}
774
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
775
- <PaymentOptionsWebView
776
- onNavigationRedirect={onNavigationRedirect}
777
- uri={`https://test-square-f50f7.web.app`}
778
- user={user}
779
- token={token}
780
- cart={cart}
781
- currency={currency}
782
- webviewPaymethod={webviewPaymethod}
783
- setShowGateway={setShowGateway}
784
- locationId={'L1NGAY5M6KJRX'}
785
- />
786
- )}
787
776
  </>
788
777
  )
789
778
  }
@@ -809,16 +798,23 @@ export const Checkout = (props: any) => {
809
798
 
810
799
  const getOrder = async (cartId: any) => {
811
800
  try {
812
- setCartState({ ...cartState, loading: true })
813
- const url = `${ordering.root}/carts/${cartId}`
814
- const response = await fetch(url, {
815
- method: 'GET',
816
- headers: {
817
- 'Content-Type': 'application/json',
818
- Authorization: `Bearer ${token}`
819
- }
820
- })
821
- const { result } = await response.json();
801
+ let result: any = {}
802
+ const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
803
+ if (cart) {
804
+ result = { ...cart }
805
+ } else {
806
+ setCartState({ ...cartState, loading: true })
807
+ const url = `${ordering.root}/carts/${cartId}`
808
+ const response = await fetch(url, {
809
+ method: 'GET',
810
+ headers: {
811
+ 'Content-Type': 'application/json',
812
+ Authorization: `Bearer ${token}`
813
+ }
814
+ })
815
+ const content = await response.json();
816
+ result = content.result
817
+ }
822
818
 
823
819
  let publicKey = null
824
820
  try {
@@ -6,7 +6,7 @@ export const ChContainer = styled.View`
6
6
  `
7
7
 
8
8
  export const ChSection = styled.View`
9
- padding-top: 30px;
9
+ padding-top: 20px;
10
10
  `
11
11
 
12
12
  export const ChHeader = styled.View`
@@ -40,7 +40,9 @@ export const ChMoment = styled(ChAddress)`
40
40
  `
41
41
 
42
42
  export const CHMomentWrapper = styled.TouchableOpacity`
43
- background-color: ${(props: any) => props.theme.colors.backgroundGray100};
43
+ background-color: ${(props: any) => props.isCustomColor
44
+ ? props.theme.colors.primary
45
+ : props.theme.colors.backgroundGray100};
44
46
  border-radius: 7.6px;
45
47
  font-size: 12px;
46
48
  max-width: 240px;
@@ -76,7 +78,6 @@ export const ChCart = styled(ChPaymethods)``
76
78
 
77
79
  export const WalletPaymentOptionContainer = styled(ChPaymethods)`
78
80
  padding-bottom: 0;
79
- margin-left: -20px;
80
81
  `
81
82
 
82
83
  export const ChPlaceOrderBtn = styled.View`
@@ -0,0 +1,89 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { StyleSheet, useWindowDimensions, Keyboard, View } from 'react-native';
3
+ import { useLanguage, useOrder } from 'ordering-components/native';
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
+ import { useTheme } from 'styled-components/native';
6
+
7
+ import { OButton, OIcon, OText } from '../shared';
8
+
9
+ import { CityElement, Container } from './styles'
10
+
11
+ export const CitiesControl = (props: any) => {
12
+ const {
13
+ cities,
14
+ onClose,
15
+ handleChangeCity
16
+ } = props;
17
+
18
+ const theme = useTheme();
19
+ const [, t] = useLanguage();
20
+ const [orderState] = useOrder();
21
+ const { height } = useWindowDimensions();
22
+ const { top, bottom } = useSafeAreaInsets();
23
+
24
+ const [isKeyboardShow, setIsKeyboardShow] = useState(false);
25
+ const [cityState, setCityState] = useState(orderState?.options?.city_id)
26
+
27
+ const handleClick = () => {
28
+ cityState !== orderState?.options?.city_id && handleChangeCity(cityState)
29
+ onClose && onClose()
30
+ }
31
+
32
+ useEffect(() => {
33
+ const keyboardDidShowListener = Keyboard.addListener(
34
+ 'keyboardDidShow',
35
+ () => setIsKeyboardShow(true)
36
+ );
37
+ const keyboardDidHideListener = Keyboard.addListener(
38
+ 'keyboardDidHide',
39
+ () => setIsKeyboardShow(false)
40
+ );
41
+ return () => {
42
+ keyboardDidShowListener.remove();
43
+ keyboardDidHideListener.remove();
44
+ };
45
+ }, []);
46
+
47
+ return (
48
+ <Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
49
+ <View>
50
+ {cities?.map((city: any) => (
51
+ <CityElement
52
+ key={city?.id}
53
+ activeOpacity={1}
54
+ disabled={orderState?.loading}
55
+ onPress={() => setCityState(city?.id === cityState ? null : city?.id)}
56
+ >
57
+ <OIcon
58
+ src={cityState === city?.id
59
+ ? theme.images.general.option_checked
60
+ : theme.images.general.option_normal}
61
+ width={16}
62
+ style={{ marginEnd: 24 }}
63
+ />
64
+ <OText color={theme.colors.black}>
65
+ {city?.name}
66
+ </OText>
67
+ </CityElement>
68
+ ))}
69
+ </View>
70
+ <OButton
71
+ text={t('CONTINUE', 'Continue')}
72
+ bgColor={theme.colors.primary}
73
+ borderColor={theme.colors.primary}
74
+ style={styles.btnStyle}
75
+ textStyle={{ color: 'white' }}
76
+ onClick={() => handleClick()}
77
+ />
78
+ </Container>
79
+ )
80
+ }
81
+
82
+ const styles = StyleSheet.create({
83
+ btnStyle: {
84
+ marginTop: 20,
85
+ borderRadius: 8,
86
+ shadowOpacity: 0,
87
+ height: 44
88
+ },
89
+ })
@@ -0,0 +1,17 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ width: 100%;
5
+ padding: 0 40px;
6
+ justify-content: space-between;
7
+ padding-bottom: 12px;
8
+
9
+ ${(props: any) => props.height && css`
10
+ height: ${props.height}px;
11
+ `}
12
+ `
13
+
14
+ export const CityElement = styled.TouchableOpacity`
15
+ padding: 10px;
16
+ flex-direction: row;
17
+ `
@@ -35,8 +35,8 @@ const DriverTipsUI = (props: any) => {
35
35
  const theme = useTheme();
36
36
 
37
37
  const style = StyleSheet.create({
38
- circle: {
39
- borderRadius: 30
38
+ semicircle: {
39
+ borderRadius: 8
40
40
  },
41
41
  inputStyle: {
42
42
  flex: 1,
@@ -75,10 +75,10 @@ const DriverTipsUI = (props: any) => {
75
75
  onPress={() => handlerChangeOption(option)}
76
76
  >
77
77
  <DTCard
78
- style={style.circle}
78
+ style={style.semicircle}
79
79
  isActive={option === optionSelected}
80
80
  >
81
- <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
81
+ <OText size={12} numberOfLines={2} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
82
82
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
83
83
  </OText>
84
84
  </DTCard>
@@ -26,11 +26,12 @@ export const DTCard = styled.View`
26
26
  text-transform: capitalize;
27
27
  min-height: 55px;
28
28
  min-width: 55px;
29
- max-width: 55px;
29
+ max-width: 80px;
30
30
  max-height: 55px;
31
31
  margin-right: 10px;
32
32
  margin-left: 10px;
33
33
  margin-top: 10px;
34
+ padding-horizontal: 10px;
34
35
 
35
36
  ${(props: any) => props.isActive && css`
36
37
  background-color: ${(props: any) => props.theme.colors.primary};