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