ordering-ui-react-native 0.15.63 → 0.15.64-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 +7 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessInformation/index.tsx +14 -0
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- 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 +6 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +22 -24
- 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/BusinessesListing.tsx +7 -6
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- 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 +42 -90
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- 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 +26 -13
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +8 -4
- package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +8 -2
- 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 +11 -12
- 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 +32 -27
- 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 +7 -8
- 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 +1 -0
- package/themes/original/index.tsx +30 -8
- 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 +7 -6
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +6 -8
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +305 -159
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +168 -96
- package/themes/original/src/components/BusinessController/styles.tsx +5 -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 +231 -63
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +51 -52
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +317 -155
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +32 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +679 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +99 -458
- package/themes/original/src/components/Cart/index.tsx +61 -42
- package/themes/original/src/components/Checkout/index.tsx +90 -39
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -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 +11 -11
- 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/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- 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/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- 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/NavBar/index.tsx +4 -4
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +150 -64
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderSummary/index.tsx +6 -6
- package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- 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 +137 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +718 -679
- package/themes/original/src/components/ProductForm/styles.tsx +6 -2
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/Promotions/index.tsx +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +13 -5
- package/themes/original/src/components/ServiceForm/index.tsx +579 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- 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 +237 -126
- package/themes/original/src/components/SingleOrderCard/index.tsx +275 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +161 -88
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +15 -81
- package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/UserProfileForm/index.tsx +33 -22
- 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/OBottomPopup.tsx +44 -13
- package/themes/original/src/components/shared/OButton.tsx +2 -0
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +187 -35
- package/themes/original/src/utils/index.tsx +96 -2
- package/themes/single-business/src/components/OrderTypeSelector/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,
|
|
@@ -9,9 +9,11 @@ import {
|
|
|
9
9
|
useUtils,
|
|
10
10
|
ToastType,
|
|
11
11
|
useToast,
|
|
12
|
-
useConfig
|
|
12
|
+
useConfig,
|
|
13
|
+
useOrderingTheme
|
|
13
14
|
} from 'ordering-components/native'
|
|
14
15
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
16
|
+
import Alert from '../../providers/AlertProvider'
|
|
15
17
|
import { BusinessBasicInformation } from '../BusinessBasicInformation'
|
|
16
18
|
import { SearchBar } from '../SearchBar'
|
|
17
19
|
import { BusinessProductsCategories } from '../BusinessProductsCategories'
|
|
@@ -22,13 +24,20 @@ import {
|
|
|
22
24
|
TopHeader,
|
|
23
25
|
WrapSearchBar,
|
|
24
26
|
WrapContent,
|
|
25
|
-
|
|
27
|
+
FiltProductsContainer,
|
|
28
|
+
ContainerSafeAreaView,
|
|
29
|
+
BackgroundGray,
|
|
30
|
+
ProfessionalFilterWrapper,
|
|
31
|
+
NearBusiness
|
|
26
32
|
} from './styles'
|
|
27
33
|
import { FloatingButton } from '../FloatingButton'
|
|
28
34
|
import { UpsellingRedirect } from './UpsellingRedirect'
|
|
29
35
|
import Animated from 'react-native-reanimated'
|
|
36
|
+
import { ProfessionalFilter } from '../ProfessionalFilter';
|
|
37
|
+
import { ServiceForm } from '../ServiceForm';
|
|
38
|
+
import { BusinessesListing } from '../BusinessesListing/Layout/Original'
|
|
30
39
|
|
|
31
|
-
const PIXELS_TO_SCROLL =
|
|
40
|
+
const PIXELS_TO_SCROLL = 2000
|
|
32
41
|
|
|
33
42
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
34
43
|
const {
|
|
@@ -45,10 +54,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
45
54
|
errorQuantityProducts,
|
|
46
55
|
header,
|
|
47
56
|
logo,
|
|
57
|
+
alertState,
|
|
58
|
+
setAlertState,
|
|
59
|
+
multiRemoveProducts,
|
|
48
60
|
getNextProducts,
|
|
61
|
+
handleUpdateProducts,
|
|
62
|
+
professionalSelected,
|
|
63
|
+
handleChangeProfessionalSelected,
|
|
64
|
+
onBusinessClick
|
|
49
65
|
} = props
|
|
50
66
|
|
|
51
67
|
const theme = useTheme();
|
|
68
|
+
const [orderingTheme] = useOrderingTheme()
|
|
52
69
|
const [, t] = useLanguage()
|
|
53
70
|
const [{ auth }] = useSession()
|
|
54
71
|
const [orderState, { clearCart }] = useOrder()
|
|
@@ -56,9 +73,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
56
73
|
const [, { showToast }] = useToast()
|
|
57
74
|
const [{ configs }] = useConfig()
|
|
58
75
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
76
|
+
|
|
77
|
+
const isChewLayout = orderingTheme?.theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
|
|
78
|
+
const showLogo = !orderingTheme?.theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
|
|
79
|
+
const hideBusinessNearCity = orderingTheme?.theme?.business_view?.components?.near_business?.hidden
|
|
80
|
+
|
|
59
81
|
const styles = StyleSheet.create({
|
|
60
82
|
mainContainer: {
|
|
61
|
-
flex: 1
|
|
83
|
+
flex: 1
|
|
62
84
|
},
|
|
63
85
|
BackIcon: {
|
|
64
86
|
paddingRight: 20,
|
|
@@ -93,14 +115,23 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
93
115
|
const [productListLayout, setProductListLayout] = useState<any>(null)
|
|
94
116
|
const [isCategoryClicked, setCategoryClicked] = useState(false)
|
|
95
117
|
const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
|
|
118
|
+
const [openService, setOpenService] = useState(false)
|
|
119
|
+
const [currentProduct, setCurrentProduct] = useState(null)
|
|
96
120
|
|
|
121
|
+
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
97
122
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
98
|
-
|
|
123
|
+
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
124
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
|
|
99
125
|
const onRedirect = (route: string, params?: any) => {
|
|
100
126
|
navigation.navigate(route, params)
|
|
101
127
|
}
|
|
102
128
|
|
|
103
129
|
const onProductClick = (product: any) => {
|
|
130
|
+
if (product?.type === 'service' && professionalSelected) {
|
|
131
|
+
setCurrentProduct(product)
|
|
132
|
+
setOpenService(true)
|
|
133
|
+
return
|
|
134
|
+
}
|
|
104
135
|
onRedirect('ProductDetails', {
|
|
105
136
|
product: product,
|
|
106
137
|
businessSlug: business.slug,
|
|
@@ -114,13 +145,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
114
145
|
}
|
|
115
146
|
|
|
116
147
|
const handleUpsellingPage = () => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
148
|
+
if (isCheckoutMultiBusinessEnabled) {
|
|
149
|
+
onRedirect('CheckoutNavigator', {
|
|
150
|
+
screen: 'MultiCheckout'
|
|
151
|
+
})
|
|
152
|
+
} else {
|
|
153
|
+
onRedirect('CheckoutNavigator', {
|
|
154
|
+
screen: 'CheckoutPage',
|
|
155
|
+
cartUuid: currentCart?.uuid,
|
|
156
|
+
businessLogo: logo,
|
|
157
|
+
businessName: business?.name,
|
|
158
|
+
cartTotal: currentCart?.total
|
|
159
|
+
})
|
|
160
|
+
}
|
|
124
161
|
setOpenUpselling(false)
|
|
125
162
|
}
|
|
126
163
|
|
|
@@ -165,106 +202,101 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
165
202
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
166
203
|
}
|
|
167
204
|
|
|
205
|
+
const adjustBusiness = async (adjustBusinessId: number) => {
|
|
206
|
+
const _carts = orderState?.carts?.[adjustBusinessId]
|
|
207
|
+
const products = _carts?.products
|
|
208
|
+
const unavailableProducts = products.filter((product: any) => product.valid !== true)
|
|
209
|
+
const alreadyRemoved = await _retrieveStoreData('already-removed')
|
|
210
|
+
_removeStoreData('already-removed')
|
|
211
|
+
if (unavailableProducts.length > 0) {
|
|
212
|
+
multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (alreadyRemoved === 'removed') {
|
|
217
|
+
setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
168
221
|
const removeCartByReOrder = async () => {
|
|
169
|
-
const
|
|
170
|
-
if (currentCart &&
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
showToast(ToastType.Info, t('PRODUCT_REMOVED', 'Products removed from cart'))
|
|
222
|
+
const adjustBusinessId = await _retrieveStoreData('adjust-cart-products')
|
|
223
|
+
if (currentCart && adjustBusinessId) {
|
|
224
|
+
_removeStoreData('adjust-cart-products')
|
|
225
|
+
adjustBusiness(adjustBusinessId)
|
|
174
226
|
}
|
|
175
227
|
}
|
|
176
228
|
|
|
177
229
|
useEffect(() => {
|
|
178
230
|
removeCartByReOrder()
|
|
179
|
-
}, [])
|
|
231
|
+
}, [currentCart])
|
|
180
232
|
|
|
181
233
|
return (
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
<TouchableOpacity
|
|
201
|
-
onPress={() => setIsOpenSearchBar(true)}
|
|
202
|
-
style={styles.searchIcon}
|
|
203
|
-
>
|
|
204
|
-
<OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={16} />
|
|
205
|
-
</TouchableOpacity>
|
|
234
|
+
<>
|
|
235
|
+
<ContainerSafeAreaView
|
|
236
|
+
style={{ flex: 1 }}
|
|
237
|
+
isOpenFiltProducts={isOpenFiltProducts}
|
|
238
|
+
>
|
|
239
|
+
<Animated.View style={{ position: 'relative' }}>
|
|
240
|
+
<TopHeader isIos={Platform.OS === 'ios'}>
|
|
241
|
+
{!isOpenSearchBar && (
|
|
242
|
+
<>
|
|
243
|
+
<View style={{ ...styles.headerItem, flex: 1 }}>
|
|
244
|
+
<OButton
|
|
245
|
+
imgLeftSrc={theme.images.general.arrow_left}
|
|
246
|
+
imgRightSrc={null}
|
|
247
|
+
style={styles.btnBackArrow}
|
|
248
|
+
onClick={() => handleBackNavigation()}
|
|
249
|
+
imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 30 }}
|
|
250
|
+
/>
|
|
251
|
+
|
|
206
252
|
</View>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
253
|
+
{!errorQuantityProducts && (
|
|
254
|
+
<View style={{ ...styles.headerItem }}>
|
|
255
|
+
<TouchableOpacity
|
|
256
|
+
onPress={() => setIsOpenSearchBar(true)}
|
|
257
|
+
style={styles.searchIcon}
|
|
258
|
+
>
|
|
259
|
+
<OIcon src={theme.images.general.search} color={theme.colors.textNormal} width={16} />
|
|
260
|
+
</TouchableOpacity>
|
|
261
|
+
</View>
|
|
262
|
+
)}
|
|
263
|
+
</>
|
|
264
|
+
)}
|
|
265
|
+
{isOpenSearchBar && (
|
|
266
|
+
<WrapSearchBar>
|
|
267
|
+
<SearchBar
|
|
268
|
+
autoFocus
|
|
269
|
+
onSearch={handleChangeSearch}
|
|
270
|
+
onCancel={() => handleCancel()}
|
|
271
|
+
isCancelXButtonShow
|
|
272
|
+
noBorderShow
|
|
273
|
+
placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
|
|
274
|
+
lazyLoad={businessState?.business?.lazy_load_products_recommended}
|
|
275
|
+
/>
|
|
276
|
+
</WrapSearchBar>
|
|
277
|
+
)}
|
|
278
|
+
</TopHeader>
|
|
279
|
+
{!hideBusinessNearCity && businessState?.business?.city_id && (
|
|
280
|
+
<NearBusiness>
|
|
281
|
+
<BusinessesListing
|
|
282
|
+
logosLayout
|
|
283
|
+
propsToFetch={['id', 'logo', 'location', 'timezone', 'schedule', 'open', 'slug']}
|
|
284
|
+
cityId={businessState?.business?.city_id}
|
|
285
|
+
onBusinessClick={onBusinessClick}
|
|
286
|
+
actualSlug={businessState?.business?.slug}
|
|
219
287
|
/>
|
|
220
|
-
</
|
|
288
|
+
</NearBusiness>
|
|
221
289
|
)}
|
|
222
|
-
</
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
>
|
|
233
|
-
<BusinessBasicInformation
|
|
234
|
-
navigation={navigation}
|
|
235
|
-
businessState={businessState}
|
|
236
|
-
openBusinessInformation={openBusinessInformation}
|
|
237
|
-
header={header}
|
|
238
|
-
logo={logo}
|
|
239
|
-
isPreOrder={isPreOrder}
|
|
240
|
-
/>
|
|
241
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
242
|
-
{!loading && business?.id && (
|
|
243
|
-
<>
|
|
244
|
-
{!(business?.categories?.length === 0) && (
|
|
245
|
-
<BusinessProductsCategories
|
|
246
|
-
categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
|
|
247
|
-
categorySelected={categorySelected}
|
|
248
|
-
onClickCategory={handleChangeCategory}
|
|
249
|
-
featured={featuredProducts}
|
|
250
|
-
openBusinessInformation={openBusinessInformation}
|
|
251
|
-
scrollViewRef={scrollViewRef}
|
|
252
|
-
productListLayout={productListLayout}
|
|
253
|
-
categoriesLayout={categoriesLayout}
|
|
254
|
-
selectedCategoryId={selectedCategoryId}
|
|
255
|
-
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
256
|
-
setSelectedCategoryId={setSelectedCategoryId}
|
|
257
|
-
setCategoryClicked={setCategoryClicked}
|
|
258
|
-
|
|
259
|
-
/>
|
|
260
|
-
)}
|
|
261
|
-
</>
|
|
262
|
-
)}
|
|
263
|
-
{!loading && business?.id && (
|
|
264
|
-
<>
|
|
265
|
-
<WrapContent
|
|
266
|
-
onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
|
|
267
|
-
>
|
|
290
|
+
</Animated.View>
|
|
291
|
+
|
|
292
|
+
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
293
|
+
<FiltProductsContainer
|
|
294
|
+
isIos={Platform.OS === 'ios'}
|
|
295
|
+
style={{
|
|
296
|
+
height: Dimensions.get('window').height - filtProductsHeight
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
<View style={{ padding: 20, backgroundColor: theme.colors.white }}>
|
|
268
300
|
<BusinessProductsList
|
|
269
301
|
categories={[
|
|
270
302
|
{ id: null, name: t('ALL', 'All') },
|
|
@@ -288,66 +320,196 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
288
320
|
setCategoriesLayout={setCategoriesLayout}
|
|
289
321
|
currentCart={currentCart}
|
|
290
322
|
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
323
|
+
onClickCategory={handleChangeCategory}
|
|
324
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
325
|
+
isFiltMode
|
|
291
326
|
/>
|
|
292
|
-
</
|
|
293
|
-
|
|
327
|
+
</View>
|
|
328
|
+
</FiltProductsContainer>
|
|
294
329
|
)}
|
|
295
|
-
{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
330
|
+
{isOpenFiltProducts && (
|
|
331
|
+
<BackgroundGray />
|
|
332
|
+
)}
|
|
333
|
+
<IOScrollView
|
|
334
|
+
stickyHeaderIndices={[2]}
|
|
335
|
+
style={{
|
|
336
|
+
...styles.mainContainer,
|
|
337
|
+
marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
|
|
338
|
+
50 : 0
|
|
339
|
+
}}
|
|
340
|
+
ref={scrollViewRef}
|
|
341
|
+
onScroll={handlePageScroll}
|
|
342
|
+
onScrollBeginDrag={handleTouchDrag}
|
|
343
|
+
scrollEventThrottle={16}
|
|
344
|
+
>
|
|
345
|
+
<BusinessBasicInformation
|
|
346
|
+
navigation={navigation}
|
|
347
|
+
businessState={businessState}
|
|
348
|
+
openBusinessInformation={openBusinessInformation}
|
|
349
|
+
header={header}
|
|
350
|
+
logo={logo}
|
|
351
|
+
isPreOrder={isPreOrder}
|
|
352
|
+
/>
|
|
353
|
+
{business?.professionals?.length > 0 && (
|
|
354
|
+
<ProfessionalFilterWrapper>
|
|
355
|
+
<OText
|
|
356
|
+
size={16}
|
|
357
|
+
style={{ marginBottom: 16 }}
|
|
358
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
359
|
+
>
|
|
360
|
+
{t('PROFESSIONALS', 'Professionals')}
|
|
361
|
+
</OText>
|
|
362
|
+
<ProfessionalFilter
|
|
363
|
+
professionals={business?.professionals}
|
|
364
|
+
professionalSelected={professionalSelected}
|
|
365
|
+
handleChangeProfessionalSelected={handleChangeProfessionalSelected}
|
|
366
|
+
/>
|
|
367
|
+
</ProfessionalFilterWrapper>
|
|
368
|
+
)}
|
|
369
|
+
<View
|
|
370
|
+
style={{
|
|
371
|
+
height: 8,
|
|
372
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
373
|
+
marginTop: isChewLayout && showLogo ? 10 : 0
|
|
374
|
+
}}
|
|
375
|
+
/>
|
|
376
|
+
{!loading && business?.id && (
|
|
377
|
+
<>
|
|
378
|
+
{!(business?.categories?.length === 0) && (
|
|
379
|
+
<BusinessProductsCategories
|
|
380
|
+
categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
|
|
381
|
+
categorySelected={categorySelected}
|
|
382
|
+
onClickCategory={handleChangeCategory}
|
|
383
|
+
featured={featuredProducts}
|
|
384
|
+
openBusinessInformation={openBusinessInformation}
|
|
385
|
+
scrollViewRef={scrollViewRef}
|
|
386
|
+
productListLayout={productListLayout}
|
|
387
|
+
categoriesLayout={categoriesLayout}
|
|
388
|
+
selectedCategoryId={selectedCategoryId}
|
|
389
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
390
|
+
setSelectedCategoryId={setSelectedCategoryId}
|
|
391
|
+
setCategoryClicked={setCategoryClicked}
|
|
392
|
+
|
|
393
|
+
/>
|
|
394
|
+
)}
|
|
395
|
+
</>
|
|
396
|
+
)}
|
|
397
|
+
{!loading && business?.id && (
|
|
398
|
+
<>
|
|
399
|
+
<WrapContent
|
|
400
|
+
onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
|
|
401
|
+
>
|
|
402
|
+
<BusinessProductsList
|
|
403
|
+
categories={[
|
|
404
|
+
{ id: null, name: t('ALL', 'All') },
|
|
405
|
+
{ id: 'featured', name: t('FEATURED', 'Featured') },
|
|
406
|
+
...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
|
|
407
|
+
]}
|
|
408
|
+
category={categorySelected}
|
|
409
|
+
categoryState={categoryState}
|
|
410
|
+
businessId={business.id}
|
|
411
|
+
errors={errors}
|
|
412
|
+
onProductClick={onProductClick}
|
|
413
|
+
handleSearchRedirect={handleSearchRedirect}
|
|
414
|
+
featured={featuredProducts}
|
|
415
|
+
searchValue={searchValue}
|
|
416
|
+
handleClearSearch={handleChangeSearch}
|
|
417
|
+
errorQuantityProducts={errorQuantityProducts}
|
|
418
|
+
handleCancelSearch={handleCancel}
|
|
419
|
+
categoriesLayout={categoriesLayout}
|
|
420
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
421
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
422
|
+
setCategoriesLayout={setCategoriesLayout}
|
|
423
|
+
currentCart={currentCart}
|
|
424
|
+
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
425
|
+
onClickCategory={handleChangeCategory}
|
|
426
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
427
|
+
/>
|
|
428
|
+
</WrapContent>
|
|
429
|
+
</>
|
|
430
|
+
)}
|
|
431
|
+
{loading && !error && (
|
|
432
|
+
<>
|
|
433
|
+
<BusinessProductsCategories
|
|
307
434
|
categories={[]}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
435
|
+
categorySelected={categorySelected}
|
|
436
|
+
onClickCategory={handleChangeCategory}
|
|
437
|
+
featured={featuredProducts}
|
|
438
|
+
openBusinessInformation={openBusinessInformation}
|
|
439
|
+
loading={loading}
|
|
312
440
|
/>
|
|
313
|
-
|
|
314
|
-
|
|
441
|
+
<WrapContent>
|
|
442
|
+
<BusinessProductsList
|
|
443
|
+
categories={[]}
|
|
444
|
+
category={categorySelected}
|
|
445
|
+
categoryState={categoryState}
|
|
446
|
+
isBusinessLoading={loading}
|
|
447
|
+
errorQuantityProducts={errorQuantityProducts}
|
|
448
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
449
|
+
/>
|
|
450
|
+
</WrapContent>
|
|
451
|
+
</>
|
|
452
|
+
)}
|
|
453
|
+
</BusinessProductsListingContainer>
|
|
454
|
+
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
455
|
+
<FloatingButton
|
|
456
|
+
btnText={
|
|
457
|
+
openUpselling
|
|
458
|
+
? t('LOADING', 'Loading')
|
|
459
|
+
: currentCart?.subtotal >= currentCart?.minimum
|
|
460
|
+
? t('VIEW_ORDER', 'View Order')
|
|
461
|
+
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
462
|
+
}
|
|
463
|
+
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
464
|
+
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
465
|
+
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
466
|
+
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
467
|
+
btnRightValue={parsePrice(currentCart?.total)}
|
|
468
|
+
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
469
|
+
handleClick={() => setOpenUpselling(true)}
|
|
470
|
+
/>
|
|
315
471
|
)}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
472
|
+
{openUpselling && (
|
|
473
|
+
<UpsellingRedirect
|
|
474
|
+
businessId={currentCart?.business_id}
|
|
475
|
+
business={currentCart?.business}
|
|
476
|
+
cartProducts={currentCart?.products}
|
|
477
|
+
cart={currentCart}
|
|
478
|
+
setOpenUpselling={setOpenUpselling}
|
|
479
|
+
handleUpsellingPage={handleUpsellingPage}
|
|
480
|
+
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
481
|
+
openUpselling={openUpselling}
|
|
482
|
+
canOpenUpselling={canOpenUpselling}
|
|
483
|
+
setCanOpenUpselling={setCanOpenUpselling}
|
|
484
|
+
onRedirect={onRedirect}
|
|
485
|
+
/>
|
|
486
|
+
)}
|
|
487
|
+
<Alert
|
|
488
|
+
open={alertState?.open || false}
|
|
489
|
+
title=''
|
|
490
|
+
content={[t('NOT_AVAILABLE_PRODUCTS', 'These products are not available.')]}
|
|
491
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
492
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
333
493
|
/>
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
494
|
+
</ContainerSafeAreaView>
|
|
495
|
+
<OModal
|
|
496
|
+
open={openService}
|
|
497
|
+
onClose={() => setOpenService(false)}
|
|
498
|
+
entireModal
|
|
499
|
+
>
|
|
500
|
+
<ServiceForm
|
|
501
|
+
navigation={navigation}
|
|
502
|
+
product={currentProduct}
|
|
503
|
+
businessSlug={business.slug}
|
|
504
|
+
businessId={business.id}
|
|
505
|
+
professionalList={business?.professionals}
|
|
506
|
+
professionalSelected={professionalSelected}
|
|
507
|
+
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
508
|
+
onSave={() => setOpenService(false)}
|
|
509
|
+
onClose={() => setOpenService(false)}
|
|
348
510
|
/>
|
|
349
|
-
|
|
350
|
-
|
|
511
|
+
</OModal>
|
|
512
|
+
</>
|
|
351
513
|
)
|
|
352
514
|
}
|
|
353
515
|
|
|
@@ -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,31 @@ 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
|
+
`
|
|
58
|
+
|
|
59
|
+
export const ProfessionalFilterWrapper = styled.View`
|
|
60
|
+
padding-left: 40px;
|
|
61
|
+
margin-bottom: 35px;
|
|
62
|
+
`
|
|
63
|
+
|
|
64
|
+
export const NearBusiness = styled.View`
|
|
65
|
+
width: 100%;
|
|
66
|
+
padding-left: 20px;
|
|
67
|
+
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
BusinessReviews as BusinessReviewController,
|
|
4
4
|
useLanguage,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { BusinessReviewsParams } from '../../types';
|
|
23
23
|
import { ProgressBar, TouchableRipple } from 'react-native-paper';
|
|
24
24
|
import moment from 'moment';
|
|
25
|
+
import { setLocalMoment } from '../../utils';
|
|
25
26
|
|
|
26
27
|
const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
27
28
|
const { businessState, reviewsList } = props;
|
|
@@ -99,6 +100,10 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
99
100
|
</View>
|
|
100
101
|
);
|
|
101
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setLocalMoment(moment, t)
|
|
105
|
+
}, [])
|
|
106
|
+
|
|
102
107
|
return (
|
|
103
108
|
<BusinessReviewsContainer>
|
|
104
109
|
<BusinessReviewContent
|