ordering-ui-react-native 0.15.40 → 0.15.42-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 +8 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessController/index.tsx +8 -2
- package/src/components/BusinessTypeFilter/index.tsx +4 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +2 -2
- package/src/components/PaymentOptions/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +3 -1
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeMethodForm/index.tsx +1 -2
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +5 -2
- package/src/utils/index.tsx +68 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- 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/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -18
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
- package/themes/business/src/components/OrdersOption/index.tsx +57 -50
- package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +5 -1
- 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/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +99 -26
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +8 -9
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +3 -0
- package/themes/original/index.tsx +180 -1
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +50 -12
- package/themes/original/src/components/BusinessController/styles.tsx +27 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +116 -26
- 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/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
- package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
- package/themes/original/src/components/Cart/index.tsx +60 -43
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +50 -33
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +91 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +287 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +394 -155
- package/themes/original/src/components/LoginForm/styles.tsx +7 -4
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +6 -1
- 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/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/OrderDetails/index.tsx +55 -37
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +3 -3
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +133 -41
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +19 -15
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
- package/themes/original/src/components/ProductForm/index.tsx +74 -66
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/SearchBar/index.tsx +10 -4
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +79 -6
- package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +95 -32
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +5 -96
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +62 -8
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- 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/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- 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 +132 -9
- package/themes/original/src/utils/index.tsx +28 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -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,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useConfig
|
|
13
13
|
} from 'ordering-components/native'
|
|
14
14
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
15
|
+
import Alert from '../../providers/AlertProvider'
|
|
15
16
|
import { BusinessBasicInformation } from '../BusinessBasicInformation'
|
|
16
17
|
import { SearchBar } from '../SearchBar'
|
|
17
18
|
import { BusinessProductsCategories } from '../BusinessProductsCategories'
|
|
@@ -22,13 +23,16 @@ import {
|
|
|
22
23
|
TopHeader,
|
|
23
24
|
WrapSearchBar,
|
|
24
25
|
WrapContent,
|
|
25
|
-
BusinessProductsListingContainer
|
|
26
|
+
BusinessProductsListingContainer,
|
|
27
|
+
FiltProductsContainer,
|
|
28
|
+
ContainerSafeAreaView,
|
|
29
|
+
BackgroundGray
|
|
26
30
|
} from './styles'
|
|
27
31
|
import { FloatingButton } from '../FloatingButton'
|
|
28
32
|
import { UpsellingRedirect } from './UpsellingRedirect'
|
|
29
33
|
import Animated from 'react-native-reanimated'
|
|
30
34
|
|
|
31
|
-
const PIXELS_TO_SCROLL =
|
|
35
|
+
const PIXELS_TO_SCROLL = 2000
|
|
32
36
|
|
|
33
37
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
34
38
|
const {
|
|
@@ -45,7 +49,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
45
49
|
errorQuantityProducts,
|
|
46
50
|
header,
|
|
47
51
|
logo,
|
|
52
|
+
alertState,
|
|
53
|
+
setAlertState,
|
|
54
|
+
multiRemoveProducts,
|
|
48
55
|
getNextProducts,
|
|
56
|
+
handleUpdateProducts
|
|
49
57
|
} = props
|
|
50
58
|
|
|
51
59
|
const theme = useTheme();
|
|
@@ -92,9 +100,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
92
100
|
const [categoriesLayout, setCategoriesLayout] = useState<any>({})
|
|
93
101
|
const [productListLayout, setProductListLayout] = useState<any>(null)
|
|
94
102
|
const [isCategoryClicked, setCategoryClicked] = useState(false)
|
|
103
|
+
const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
|
|
95
104
|
|
|
105
|
+
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
96
106
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
97
|
-
|
|
107
|
+
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
108
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
|
|
98
109
|
const onRedirect = (route: string, params?: any) => {
|
|
99
110
|
navigation.navigate(route, params)
|
|
100
111
|
}
|
|
@@ -113,13 +124,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
113
124
|
}
|
|
114
125
|
|
|
115
126
|
const handleUpsellingPage = () => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
if (isCheckoutMultiBusinessEnabled) {
|
|
128
|
+
onRedirect('CheckoutNavigator', {
|
|
129
|
+
screen: 'MultiCheckout'
|
|
130
|
+
})
|
|
131
|
+
} else {
|
|
132
|
+
onRedirect('CheckoutNavigator', {
|
|
133
|
+
screen: 'CheckoutPage',
|
|
134
|
+
cartUuid: currentCart?.uuid,
|
|
135
|
+
businessLogo: logo,
|
|
136
|
+
businessName: business?.name,
|
|
137
|
+
cartTotal: currentCart?.total
|
|
138
|
+
})
|
|
139
|
+
}
|
|
123
140
|
setOpenUpselling(false)
|
|
124
141
|
}
|
|
125
142
|
|
|
@@ -164,25 +181,41 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
164
181
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
165
182
|
}
|
|
166
183
|
|
|
184
|
+
const adjustBusiness = async (adjustBusinessId: number) => {
|
|
185
|
+
const _carts = orderState?.carts?.[adjustBusinessId]
|
|
186
|
+
const products = _carts?.products
|
|
187
|
+
const unavailableProducts = products.filter((product: any) => product.valid !== true)
|
|
188
|
+
const alreadyRemoved = await _retrieveStoreData('already-removed')
|
|
189
|
+
_removeStoreData('already-removed')
|
|
190
|
+
if (unavailableProducts.length > 0) {
|
|
191
|
+
multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (alreadyRemoved === 'removed') {
|
|
196
|
+
setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
167
200
|
const removeCartByReOrder = async () => {
|
|
168
|
-
const
|
|
169
|
-
if (currentCart &&
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
showToast(ToastType.Info, t('PRODUCT_REMOVED', 'Products removed from cart'))
|
|
201
|
+
const adjustBusinessId = await _retrieveStoreData('adjust-cart-products')
|
|
202
|
+
if (currentCart && adjustBusinessId) {
|
|
203
|
+
_removeStoreData('adjust-cart-products')
|
|
204
|
+
adjustBusiness(adjustBusinessId)
|
|
173
205
|
}
|
|
174
206
|
}
|
|
175
207
|
|
|
176
208
|
useEffect(() => {
|
|
177
209
|
removeCartByReOrder()
|
|
178
|
-
}, [])
|
|
210
|
+
}, [currentCart])
|
|
179
211
|
|
|
180
212
|
return (
|
|
181
|
-
<
|
|
213
|
+
<ContainerSafeAreaView
|
|
182
214
|
style={{ flex: 1 }}
|
|
215
|
+
isOpenFiltProducts={isOpenFiltProducts}
|
|
183
216
|
>
|
|
184
217
|
<Animated.View style={{ position: 'relative' }}>
|
|
185
|
-
<TopHeader>
|
|
218
|
+
<TopHeader isIos={Platform.OS === 'ios'}>
|
|
186
219
|
{!isOpenSearchBar && (
|
|
187
220
|
<>
|
|
188
221
|
<View style={{ ...styles.headerItem, flex: 1 }}>
|
|
@@ -220,6 +253,47 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
220
253
|
)}
|
|
221
254
|
</TopHeader>
|
|
222
255
|
</Animated.View>
|
|
256
|
+
|
|
257
|
+
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
258
|
+
<FiltProductsContainer
|
|
259
|
+
style={{
|
|
260
|
+
height: Dimensions.get('window').height - filtProductsHeight
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
<View style={{ padding: 20, backgroundColor: theme.colors.white }}>
|
|
264
|
+
<BusinessProductsList
|
|
265
|
+
categories={[
|
|
266
|
+
{ id: null, name: t('ALL', 'All') },
|
|
267
|
+
{ id: 'featured', name: t('FEATURED', 'Featured') },
|
|
268
|
+
...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
|
|
269
|
+
]}
|
|
270
|
+
category={categorySelected}
|
|
271
|
+
categoryState={categoryState}
|
|
272
|
+
businessId={business.id}
|
|
273
|
+
errors={errors}
|
|
274
|
+
onProductClick={onProductClick}
|
|
275
|
+
handleSearchRedirect={handleSearchRedirect}
|
|
276
|
+
featured={featuredProducts}
|
|
277
|
+
searchValue={searchValue}
|
|
278
|
+
handleClearSearch={handleChangeSearch}
|
|
279
|
+
errorQuantityProducts={errorQuantityProducts}
|
|
280
|
+
handleCancelSearch={handleCancel}
|
|
281
|
+
categoriesLayout={categoriesLayout}
|
|
282
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
283
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
284
|
+
setCategoriesLayout={setCategoriesLayout}
|
|
285
|
+
currentCart={currentCart}
|
|
286
|
+
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
287
|
+
onClickCategory={handleChangeCategory}
|
|
288
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
289
|
+
isFiltMode
|
|
290
|
+
/>
|
|
291
|
+
</View>
|
|
292
|
+
</FiltProductsContainer>
|
|
293
|
+
)}
|
|
294
|
+
{isOpenFiltProducts && (
|
|
295
|
+
<BackgroundGray />
|
|
296
|
+
)}
|
|
223
297
|
<BusinessProductsListingContainer
|
|
224
298
|
stickyHeaderIndices={[2]}
|
|
225
299
|
style={styles.mainContainer}
|
|
@@ -254,6 +328,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
254
328
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
255
329
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
256
330
|
setCategoryClicked={setCategoryClicked}
|
|
331
|
+
|
|
257
332
|
/>
|
|
258
333
|
)}
|
|
259
334
|
</>
|
|
@@ -281,8 +356,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
281
356
|
errorQuantityProducts={errorQuantityProducts}
|
|
282
357
|
handleCancelSearch={handleCancel}
|
|
283
358
|
categoriesLayout={categoriesLayout}
|
|
359
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
360
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
284
361
|
setCategoriesLayout={setCategoriesLayout}
|
|
285
362
|
currentCart={currentCart}
|
|
363
|
+
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
364
|
+
onClickCategory={handleChangeCategory}
|
|
365
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
286
366
|
/>
|
|
287
367
|
</WrapContent>
|
|
288
368
|
</>
|
|
@@ -304,6 +384,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
304
384
|
categoryState={categoryState}
|
|
305
385
|
isBusinessLoading={loading}
|
|
306
386
|
errorQuantityProducts={errorQuantityProducts}
|
|
387
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
307
388
|
/>
|
|
308
389
|
</WrapContent>
|
|
309
390
|
</>
|
|
@@ -312,16 +393,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
312
393
|
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
313
394
|
<FloatingButton
|
|
314
395
|
btnText={
|
|
315
|
-
|
|
316
|
-
? t('
|
|
317
|
-
:
|
|
396
|
+
openUpselling
|
|
397
|
+
? t('LOADING', 'Loading')
|
|
398
|
+
: currentCart?.subtotal >= currentCart?.minimum
|
|
399
|
+
? t('VIEW_ORDER', 'View Order')
|
|
400
|
+
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
318
401
|
}
|
|
319
|
-
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
|
|
402
|
+
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
320
403
|
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
321
404
|
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
322
|
-
btnLeftValue={currentCart?.products
|
|
405
|
+
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
323
406
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
324
|
-
disabled={currentCart?.subtotal < currentCart?.minimum}
|
|
407
|
+
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
325
408
|
handleClick={() => setOpenUpselling(true)}
|
|
326
409
|
/>
|
|
327
410
|
)}
|
|
@@ -340,7 +423,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
340
423
|
onRedirect={onRedirect}
|
|
341
424
|
/>
|
|
342
425
|
)}
|
|
343
|
-
|
|
426
|
+
<Alert
|
|
427
|
+
open={alertState?.open || false}
|
|
428
|
+
title=''
|
|
429
|
+
content={[t('NOT_AVAILABLE_PRODUCTS', 'These products are not available.')]}
|
|
430
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
431
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
432
|
+
/>
|
|
433
|
+
</ContainerSafeAreaView>
|
|
344
434
|
)
|
|
345
435
|
}
|
|
346
436
|
|
|
@@ -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
|
|
|
@@ -45,7 +45,6 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
45
45
|
const renderTypes = ({ item }: any) => {
|
|
46
46
|
return (
|
|
47
47
|
<TouchableOpacity
|
|
48
|
-
key={item.id}
|
|
49
48
|
onPress={() => handleChangeBusinessType(item.id)}
|
|
50
49
|
style={{
|
|
51
50
|
height: 34,
|
|
@@ -103,7 +102,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
103
102
|
showsHorizontalScrollIndicator={false}
|
|
104
103
|
data={typesState?.types}
|
|
105
104
|
renderItem={renderTypes}
|
|
106
|
-
keyExtractor={(type) => type.name}
|
|
105
|
+
keyExtractor={(type, index) => `${type.name}_${index}`}
|
|
107
106
|
/>
|
|
108
107
|
<TouchableOpacity
|
|
109
108
|
style={{ marginLeft: 15 }}
|