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