ordering-ui-react-native 0.15.9 → 0.15.10-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.
- package/package.json +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +1 -0
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +24 -3
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/types/index.tsx +1 -9
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/Chat/index.tsx +3 -2
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +27 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +70 -116
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -126
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/original/index.tsx +177 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +28 -2
- package/themes/original/src/components/AppleLogin/index.tsx +119 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +95 -44
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +32 -21
- package/themes/original/src/components/BusinessListingSearch/index.tsx +7 -3
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
- package/themes/original/src/components/BusinessProductsList/styles.tsx +32 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessesListing/index.tsx +40 -53
- package/themes/original/src/components/Cart/index.tsx +40 -9
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +47 -31
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/index.tsx +156 -70
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +50 -45
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +104 -126
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +15 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +31 -20
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +17 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +16 -16
- package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +63 -23
- package/themes/original/src/utils/index.tsx +12 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet, SafeAreaView } from 'react-native'
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import {
|
|
5
5
|
BusinessAndProductList,
|
|
@@ -17,17 +17,21 @@ import { SearchBar } from '../SearchBar'
|
|
|
17
17
|
import { BusinessProductsCategories } from '../BusinessProductsCategories'
|
|
18
18
|
import { BusinessProductsList } from '../BusinessProductsList'
|
|
19
19
|
import { BusinessProductsListingParams } from '../../types'
|
|
20
|
+
import { _retrieveStoreData, _removeStoreData } from '../../providers/StoreUtil';
|
|
20
21
|
import {
|
|
21
22
|
TopHeader,
|
|
22
23
|
WrapSearchBar,
|
|
23
24
|
WrapContent,
|
|
24
|
-
BusinessProductsListingContainer
|
|
25
|
+
BusinessProductsListingContainer,
|
|
26
|
+
FiltProductsContainer,
|
|
27
|
+
ContainerSafeAreaView,
|
|
28
|
+
BackgroundGray
|
|
25
29
|
} from './styles'
|
|
26
30
|
import { FloatingButton } from '../FloatingButton'
|
|
27
31
|
import { UpsellingRedirect } from './UpsellingRedirect'
|
|
28
32
|
import Animated from 'react-native-reanimated'
|
|
29
33
|
|
|
30
|
-
const PIXELS_TO_SCROLL =
|
|
34
|
+
const PIXELS_TO_SCROLL = 2000
|
|
31
35
|
|
|
32
36
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
33
37
|
const {
|
|
@@ -50,7 +54,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
50
54
|
const theme = useTheme();
|
|
51
55
|
const [, t] = useLanguage()
|
|
52
56
|
const [{ auth }] = useSession()
|
|
53
|
-
const [orderState] = useOrder()
|
|
57
|
+
const [orderState, { clearCart }] = useOrder()
|
|
54
58
|
const [{ parsePrice }] = useUtils()
|
|
55
59
|
const [, { showToast }] = useToast()
|
|
56
60
|
const [{ configs }] = useConfig()
|
|
@@ -72,6 +76,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
72
76
|
borderWidth: 0,
|
|
73
77
|
backgroundColor: theme.colors.clear,
|
|
74
78
|
shadowColor: theme.colors.clear,
|
|
79
|
+
padding: 40,
|
|
75
80
|
},
|
|
76
81
|
searchIcon: {
|
|
77
82
|
borderWidth: 0,
|
|
@@ -90,32 +95,21 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
90
95
|
const [categoriesLayout, setCategoriesLayout] = useState<any>({})
|
|
91
96
|
const [productListLayout, setProductListLayout] = useState<any>(null)
|
|
92
97
|
const [isCategoryClicked, setCategoryClicked] = useState(false)
|
|
98
|
+
const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
|
|
93
99
|
|
|
94
100
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
95
|
-
|
|
101
|
+
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
102
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
|
|
96
103
|
const onRedirect = (route: string, params?: any) => {
|
|
97
104
|
navigation.navigate(route, params)
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
const onProductClick = (product: any) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
productCart: cartProduct,
|
|
107
|
-
businessSlug: business?.slug,
|
|
108
|
-
categoryId: cartProduct?.category_id,
|
|
109
|
-
productId: cartProduct?.id,
|
|
110
|
-
})
|
|
111
|
-
} else {
|
|
112
|
-
onRedirect('ProductDetails', {
|
|
113
|
-
product: product,
|
|
114
|
-
businessSlug: business.slug,
|
|
115
|
-
businessId: business.id,
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
|
|
108
|
+
onRedirect('ProductDetails', {
|
|
109
|
+
product: product,
|
|
110
|
+
businessSlug: business.slug,
|
|
111
|
+
businessId: business.id,
|
|
112
|
+
})
|
|
119
113
|
}
|
|
120
114
|
|
|
121
115
|
const handleCancel = () => {
|
|
@@ -169,18 +163,32 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
169
163
|
|
|
170
164
|
const handleTouchDrag = useCallback(() => {
|
|
171
165
|
setCategoryClicked(false);
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
}, []);
|
|
167
|
+
|
|
174
168
|
const handleBackNavigation = () => {
|
|
175
169
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
176
170
|
}
|
|
177
171
|
|
|
172
|
+
const removeCartByReOrder = async () => {
|
|
173
|
+
const removeCardId = await _retrieveStoreData('remove-cartId')
|
|
174
|
+
if (currentCart && removeCardId) {
|
|
175
|
+
clearCart(removeCardId)
|
|
176
|
+
_removeStoreData('remove-cartId')
|
|
177
|
+
showToast(ToastType.Info, t('PRODUCT_REMOVED', 'Products removed from cart'))
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
removeCartByReOrder()
|
|
183
|
+
}, [])
|
|
184
|
+
|
|
178
185
|
return (
|
|
179
|
-
<
|
|
186
|
+
<ContainerSafeAreaView
|
|
180
187
|
style={{ flex: 1 }}
|
|
188
|
+
isOpenFiltProducts={isOpenFiltProducts}
|
|
181
189
|
>
|
|
182
190
|
<Animated.View style={{ position: 'relative' }}>
|
|
183
|
-
<TopHeader>
|
|
191
|
+
<TopHeader isIos={Platform.OS === 'ios'}>
|
|
184
192
|
{!isOpenSearchBar && (
|
|
185
193
|
<>
|
|
186
194
|
<View style={{ ...styles.headerItem, flex: 1 }}>
|
|
@@ -218,6 +226,46 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
218
226
|
)}
|
|
219
227
|
</TopHeader>
|
|
220
228
|
</Animated.View>
|
|
229
|
+
|
|
230
|
+
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
231
|
+
<FiltProductsContainer
|
|
232
|
+
style={{
|
|
233
|
+
height: Dimensions.get('window').height - filtProductsHeight
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
<View style={{ padding: 20, backgroundColor: theme.colors.white }}>
|
|
237
|
+
<BusinessProductsList
|
|
238
|
+
categories={[
|
|
239
|
+
{ id: null, name: t('ALL', 'All') },
|
|
240
|
+
{ id: 'featured', name: t('FEATURED', 'Featured') },
|
|
241
|
+
...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
|
|
242
|
+
]}
|
|
243
|
+
category={categorySelected}
|
|
244
|
+
categoryState={categoryState}
|
|
245
|
+
businessId={business.id}
|
|
246
|
+
errors={errors}
|
|
247
|
+
onProductClick={onProductClick}
|
|
248
|
+
handleSearchRedirect={handleSearchRedirect}
|
|
249
|
+
featured={featuredProducts}
|
|
250
|
+
searchValue={searchValue}
|
|
251
|
+
handleClearSearch={handleChangeSearch}
|
|
252
|
+
errorQuantityProducts={errorQuantityProducts}
|
|
253
|
+
handleCancelSearch={handleCancel}
|
|
254
|
+
categoriesLayout={categoriesLayout}
|
|
255
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
256
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
257
|
+
setCategoriesLayout={setCategoriesLayout}
|
|
258
|
+
currentCart={currentCart}
|
|
259
|
+
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
260
|
+
onClickCategory={handleChangeCategory}
|
|
261
|
+
isFiltMode
|
|
262
|
+
/>
|
|
263
|
+
</View>
|
|
264
|
+
</FiltProductsContainer>
|
|
265
|
+
)}
|
|
266
|
+
{isOpenFiltProducts && (
|
|
267
|
+
<BackgroundGray />
|
|
268
|
+
)}
|
|
221
269
|
<BusinessProductsListingContainer
|
|
222
270
|
stickyHeaderIndices={[2]}
|
|
223
271
|
style={styles.mainContainer}
|
|
@@ -251,7 +299,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
251
299
|
selectedCategoryId={selectedCategoryId}
|
|
252
300
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
253
301
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
254
|
-
|
|
302
|
+
setCategoryClicked={setCategoryClicked}
|
|
303
|
+
|
|
255
304
|
/>
|
|
256
305
|
)}
|
|
257
306
|
</>
|
|
@@ -279,8 +328,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
279
328
|
errorQuantityProducts={errorQuantityProducts}
|
|
280
329
|
handleCancelSearch={handleCancel}
|
|
281
330
|
categoriesLayout={categoriesLayout}
|
|
331
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
332
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
282
333
|
setCategoriesLayout={setCategoriesLayout}
|
|
283
334
|
currentCart={currentCart}
|
|
335
|
+
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
336
|
+
onClickCategory={handleChangeCategory}
|
|
284
337
|
/>
|
|
285
338
|
</WrapContent>
|
|
286
339
|
</>
|
|
@@ -310,16 +363,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
310
363
|
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
311
364
|
<FloatingButton
|
|
312
365
|
btnText={
|
|
313
|
-
|
|
314
|
-
? t('
|
|
315
|
-
:
|
|
366
|
+
openUpselling
|
|
367
|
+
? t('LOADING', 'Loading')
|
|
368
|
+
: currentCart?.subtotal >= currentCart?.minimum
|
|
369
|
+
? t('VIEW_ORDER', 'View Order')
|
|
370
|
+
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
316
371
|
}
|
|
317
|
-
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
|
|
372
|
+
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
318
373
|
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
319
374
|
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
320
|
-
btnLeftValue={currentCart?.products
|
|
375
|
+
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
321
376
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
322
|
-
disabled={currentCart?.subtotal < currentCart?.minimum}
|
|
377
|
+
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
323
378
|
handleClick={() => setOpenUpselling(true)}
|
|
324
379
|
/>
|
|
325
380
|
)}
|
|
@@ -329,16 +384,16 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
329
384
|
business={currentCart?.business}
|
|
330
385
|
cartProducts={currentCart?.products}
|
|
331
386
|
cart={currentCart}
|
|
332
|
-
|
|
387
|
+
setOpenUpselling={setOpenUpselling}
|
|
333
388
|
handleUpsellingPage={handleUpsellingPage}
|
|
334
389
|
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
335
390
|
openUpselling={openUpselling}
|
|
336
391
|
canOpenUpselling={canOpenUpselling}
|
|
337
392
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
338
|
-
|
|
393
|
+
onRedirect={onRedirect}
|
|
339
394
|
/>
|
|
340
395
|
)}
|
|
341
|
-
</
|
|
396
|
+
</ContainerSafeAreaView>
|
|
342
397
|
)
|
|
343
398
|
}
|
|
344
399
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
|
+
export const ContainerSafeAreaView = styled.SafeAreaView`
|
|
4
|
+
`
|
|
5
|
+
|
|
3
6
|
export const WrapHeader = styled.View`
|
|
4
7
|
position: relative;
|
|
5
8
|
`
|
|
@@ -11,6 +14,7 @@ export const TopHeader = styled.View`
|
|
|
11
14
|
z-index: 1;
|
|
12
15
|
height: 60px;
|
|
13
16
|
min-height: 60px;
|
|
17
|
+
margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
|
|
14
18
|
`
|
|
15
19
|
export const AddressInput = styled.TouchableOpacity`
|
|
16
20
|
flex: 1;
|
|
@@ -33,3 +37,21 @@ export const BusinessProductsListingContainer = styled.ScrollView`
|
|
|
33
37
|
margin-bottom: 50px;
|
|
34
38
|
`}
|
|
35
39
|
`
|
|
40
|
+
|
|
41
|
+
export const FiltProductsContainer = styled.ScrollView`
|
|
42
|
+
position: absolute;
|
|
43
|
+
width: 100%;
|
|
44
|
+
z-index: 2000;
|
|
45
|
+
top: ${(props : any) => props.isIos ? '40px': '80px'};
|
|
46
|
+
margin-top: 20px;
|
|
47
|
+
`
|
|
48
|
+
|
|
49
|
+
export const BackgroundGray = styled.View`
|
|
50
|
+
flex: 1;
|
|
51
|
+
height: 100%;
|
|
52
|
+
background-color: rgba(0,0,0,0.5);
|
|
53
|
+
position: absolute;
|
|
54
|
+
margin-top: 100px;
|
|
55
|
+
z-index: 100;
|
|
56
|
+
width: 100%;
|
|
57
|
+
`
|
|
@@ -90,33 +90,12 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
90
90
|
</View>
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
-
const ReviewItem = ({ comment, created_at, total
|
|
93
|
+
const ReviewItem = ({ comment, created_at, total }: any) => (
|
|
94
94
|
<View style={{ marginBottom: 30 }}>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
<OIcon
|
|
98
|
-
url={theme.images.dummies.customerPhoto}
|
|
99
|
-
width={38}
|
|
100
|
-
height={38}
|
|
101
|
-
style={{
|
|
102
|
-
borderRadius: 7.6,
|
|
103
|
-
borderWidth: 1,
|
|
104
|
-
borderColor: theme.colors.border,
|
|
105
|
-
marginEnd: 9,
|
|
106
|
-
}}
|
|
107
|
-
/>
|
|
108
|
-
<View>
|
|
109
|
-
<OText size={12} color={theme.colors.textNormal} weight={'500'}>
|
|
110
|
-
{customer?.name || 'Jane Cooper'}
|
|
111
|
-
</OText>
|
|
112
|
-
<OText size={10} color={theme.colors.textSecondary}>
|
|
113
|
-
{moment(created_at).format('MMMM d, yyyy • hh:mm')}
|
|
114
|
-
</OText>
|
|
115
|
-
</View>
|
|
116
|
-
</View>
|
|
117
|
-
<OText size={10} color={theme.colors.textNormal}>
|
|
118
|
-
{comment}
|
|
95
|
+
<OText size={12} color={theme.colors.textSecondary}>
|
|
96
|
+
{moment(created_at).format('MMMM d, yyyy • hh:mm')}
|
|
119
97
|
</OText>
|
|
98
|
+
<OText size={12} color={theme.colors.textNormal}>{comment}</OText>
|
|
120
99
|
</View>
|
|
121
100
|
);
|
|
122
101
|
|
|
@@ -61,7 +61,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
61
61
|
handleChangeSearch,
|
|
62
62
|
businessId
|
|
63
63
|
} = props;
|
|
64
|
-
|
|
65
64
|
const theme = useTheme();
|
|
66
65
|
const isFocused = useIsFocused();
|
|
67
66
|
const appState = useRef(AppState.currentState)
|
|
@@ -120,7 +119,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
120
119
|
|
|
121
120
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
122
121
|
Number(configs?.max_days_preorder?.value) > 0
|
|
123
|
-
|
|
122
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
124
123
|
const timerId = useRef<any>(false)
|
|
125
124
|
// const panResponder = useRef(
|
|
126
125
|
// PanResponder.create({
|
|
@@ -166,25 +165,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
166
165
|
return R * c
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
if (businessesList.businesses.length > 0) {
|
|
171
|
-
const fb = businessesList.businesses.filter((b) => b.featured == true);
|
|
172
|
-
const ary = [];
|
|
173
|
-
while (fb.length > 0) {
|
|
174
|
-
ary.push(fb.splice(0, 2));
|
|
175
|
-
}
|
|
176
|
-
setFeaturedBusinesses(ary);
|
|
177
|
-
}
|
|
178
|
-
}, [businessesList.businesses]);
|
|
179
|
-
|
|
180
168
|
const resetInactivityTimeout = () => {
|
|
181
169
|
clearTimeout(timerId.current)
|
|
182
170
|
timerId.current = setInterval(() => {
|
|
183
171
|
getBusinesses(true)
|
|
184
|
-
},
|
|
172
|
+
}, 120000)
|
|
185
173
|
}
|
|
186
174
|
|
|
187
175
|
useEffect(() => {
|
|
176
|
+
if (!businessesList?.loading) {
|
|
177
|
+
const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
|
|
178
|
+
const ary = [];
|
|
179
|
+
while (fb.length > 0) {
|
|
180
|
+
ary.push(fb.splice(0, 2));
|
|
181
|
+
}
|
|
182
|
+
setFeaturedBusinesses(ary);
|
|
183
|
+
}
|
|
188
184
|
resetInactivityTimeout()
|
|
189
185
|
}, [businessesList.loading])
|
|
190
186
|
|
|
@@ -207,27 +203,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
207
203
|
})
|
|
208
204
|
}, [orderState?.options?.address?.location])
|
|
209
205
|
|
|
210
|
-
useEffect(() => {
|
|
211
|
-
const onFocusApp = (nextAppState: any) => {
|
|
212
|
-
if (
|
|
213
|
-
appState.current.match(/inactive|background/) &&
|
|
214
|
-
nextAppState === "active"
|
|
215
|
-
) {
|
|
216
|
-
getBusinesses(true);
|
|
217
|
-
}
|
|
218
|
-
appState.current = nextAppState;
|
|
219
|
-
setAppStateVisible(appState.current);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
AppState.addEventListener("change", onFocusApp);
|
|
223
|
-
return () => {
|
|
224
|
-
AppState.removeEventListener('change', onFocusApp);
|
|
225
|
-
};
|
|
226
|
-
}, [])
|
|
227
|
-
|
|
228
206
|
useFocusEffect(
|
|
229
207
|
useCallback(() => {
|
|
230
|
-
getBusinesses(true)
|
|
231
208
|
resetInactivityTimeout()
|
|
232
209
|
return () => clearTimeout(timerId.current)
|
|
233
210
|
}, [navigation])
|
|
@@ -288,25 +265,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
288
265
|
style={{ marginStart: 8 }}
|
|
289
266
|
/>
|
|
290
267
|
</WrapMomentOption>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
268
|
+
{isPreOrderSetting && (
|
|
269
|
+
<WrapMomentOption
|
|
270
|
+
onPress={() => handleMomentClick()}>
|
|
271
|
+
<OText
|
|
272
|
+
size={12}
|
|
273
|
+
numberOfLines={1}
|
|
274
|
+
ellipsizeMode="tail"
|
|
275
|
+
color={theme.colors.textSecondary}>
|
|
276
|
+
{orderState.options?.momentß
|
|
277
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
278
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
279
|
+
</OText>
|
|
280
|
+
{isPreorderEnabled && (
|
|
281
|
+
<OIcon
|
|
282
|
+
src={theme.images.general.arrow_down}
|
|
283
|
+
width={10}
|
|
284
|
+
style={{ marginStart: 8 }}
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
287
|
+
</WrapMomentOption>
|
|
288
|
+
)}
|
|
310
289
|
|
|
311
290
|
{!businessId && (
|
|
312
291
|
<SearchBar
|
|
@@ -338,7 +317,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
338
317
|
{
|
|
339
318
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
340
319
|
<FeaturedWrapper>
|
|
341
|
-
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('
|
|
320
|
+
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
|
|
342
321
|
<ScrollView
|
|
343
322
|
showsHorizontalScrollIndicator={false}
|
|
344
323
|
nestedScrollEnabled
|
|
@@ -401,6 +380,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
401
380
|
handleCustomClick={handleBusinessClick}
|
|
402
381
|
orderType={orderState?.options?.type}
|
|
403
382
|
navigation={navigation}
|
|
383
|
+
businessHeader={business?.header}
|
|
384
|
+
businessFeatured={business?.featured}
|
|
385
|
+
businessLogo={business?.logo}
|
|
386
|
+
businessReviews={business?.reviews}
|
|
387
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
388
|
+
businessDeliveryTime={business?.delivery_time}
|
|
389
|
+
businessPickupTime={business?.pickup_time}
|
|
390
|
+
businessDistance={business?.distance}
|
|
404
391
|
/>
|
|
405
392
|
)
|
|
406
393
|
)}
|
|
@@ -24,6 +24,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
26
26
|
import { OAlert } from '../../../../../src/components/shared'
|
|
27
|
+
import { PlaceSpot } from '../PlaceSpot'
|
|
27
28
|
|
|
28
29
|
const CartUI = (props: any) => {
|
|
29
30
|
const {
|
|
@@ -54,12 +55,14 @@ const CartUI = (props: any) => {
|
|
|
54
55
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
55
56
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
56
57
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
58
|
+
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
57
59
|
|
|
58
60
|
const isCartPending = cart?.status === 2
|
|
59
61
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
60
62
|
|
|
61
63
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
62
64
|
const businessId = business?.business_id ?? null
|
|
65
|
+
const placeSpotTypes = [3, 4]
|
|
63
66
|
|
|
64
67
|
const momentFormatted = !orderState?.option?.moment
|
|
65
68
|
? t('RIGHT_NOW', 'Right Now')
|
|
@@ -353,6 +356,24 @@ const CartUI = (props: any) => {
|
|
|
353
356
|
</OText>
|
|
354
357
|
</OSTable>
|
|
355
358
|
</OSTotal>
|
|
359
|
+
{placeSpotTypes.includes(orderState?.options?.type) && (
|
|
360
|
+
<OSTable style={{ marginTop: 15 }}>
|
|
361
|
+
<OText size={14} lineHeight={21} weight={'600'}>
|
|
362
|
+
{t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
|
|
363
|
+
</OText>
|
|
364
|
+
<TouchableOpacity onPress={() => setOpenPlaceModal(true)}>
|
|
365
|
+
<OText
|
|
366
|
+
size={14}
|
|
367
|
+
lineHeight={21}
|
|
368
|
+
weight={'600'}
|
|
369
|
+
color={theme.colors.primary}
|
|
370
|
+
style={{ textDecorationLine: 'underline' }}
|
|
371
|
+
>
|
|
372
|
+
{t('EDIT', 'Edit')}
|
|
373
|
+
</OText>
|
|
374
|
+
</TouchableOpacity>
|
|
375
|
+
</OSTable>
|
|
376
|
+
)}
|
|
356
377
|
{cart?.status !== 2 && (
|
|
357
378
|
<OSTable>
|
|
358
379
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
@@ -425,8 +446,6 @@ const CartUI = (props: any) => {
|
|
|
425
446
|
open={openTaxModal.open}
|
|
426
447
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
427
448
|
entireModal
|
|
428
|
-
title={`${openTaxModal.data?.name ||
|
|
429
|
-
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
|
|
430
449
|
>
|
|
431
450
|
<TaxInformation
|
|
432
451
|
type={openTaxModal.type}
|
|
@@ -434,14 +453,26 @@ const CartUI = (props: any) => {
|
|
|
434
453
|
products={cart?.products}
|
|
435
454
|
/>
|
|
436
455
|
</OModal>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
456
|
+
<OModal
|
|
457
|
+
open={openPlaceModal}
|
|
458
|
+
title={t('CHOOSE_YOUR_SPOT', 'Choose your spot')}
|
|
459
|
+
onClose={() => setOpenPlaceModal(false)}
|
|
460
|
+
entireModal
|
|
461
|
+
>
|
|
462
|
+
<PlaceSpot
|
|
463
|
+
cart={cart}
|
|
464
|
+
isOpenPlaceSpot={openPlaceModal}
|
|
465
|
+
setOpenPlaceModal={setOpenPlaceModal}
|
|
444
466
|
/>
|
|
467
|
+
</OModal>
|
|
468
|
+
<OAlert
|
|
469
|
+
open={confirm.open}
|
|
470
|
+
title={confirm.title}
|
|
471
|
+
content={confirm.content}
|
|
472
|
+
onAccept={confirm.handleOnAccept}
|
|
473
|
+
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
474
|
+
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
475
|
+
/>
|
|
445
476
|
</CContainer>
|
|
446
477
|
)
|
|
447
478
|
}
|
|
@@ -22,9 +22,9 @@ export const CartContent = (props: any) => {
|
|
|
22
22
|
<CCContainer>
|
|
23
23
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
24
24
|
<>
|
|
25
|
-
<OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
25
|
+
{/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
26
26
|
{carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
|
|
27
|
-
</OText>
|
|
27
|
+
</OText> */}
|
|
28
28
|
{carts.map((cart: any, i: number) => (
|
|
29
29
|
<CCList key={i} style={{ overflow: 'visible' }}>
|
|
30
30
|
{cart.products.length > 0 && (
|