ordering-ui-react-native 0.18.3 → 0.18.4-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 +9 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +1 -1
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +64 -36
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +43 -32
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +15 -17
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- 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/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- 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/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +11 -9
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +26 -7
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const BContainer = styled.View`
|
|
4
|
-
padding: 20px
|
|
5
|
-
`
|
|
6
|
-
|
|
7
|
-
export const WrapHeader = styled.View`
|
|
8
|
-
width: 100%;
|
|
9
|
-
padding-vertical: 20px;
|
|
4
|
+
padding: 20px;
|
|
10
5
|
`
|
|
11
6
|
|
|
12
7
|
export const SearchWrapper = styled.View`
|
|
@@ -53,12 +48,6 @@ export const SingleBusinessContainer = styled.View`
|
|
|
53
48
|
justify-content: space-between;
|
|
54
49
|
`
|
|
55
50
|
|
|
56
|
-
export const LoadMoreBusinessContainer = styled.View`
|
|
57
|
-
align-items: center;
|
|
58
|
-
justify-content: center;
|
|
59
|
-
margin-left: 20px;
|
|
60
|
-
`
|
|
61
|
-
|
|
62
51
|
export const TagsContainer = styled.View`
|
|
63
52
|
padding-bottom: 10px;
|
|
64
53
|
`
|
|
@@ -80,13 +69,6 @@ export const PriceFilterWrapper = styled.View`
|
|
|
80
69
|
margin-bottom: 20px;
|
|
81
70
|
`
|
|
82
71
|
|
|
83
|
-
export const OptionTitle = styled.View`
|
|
84
|
-
margin-top: 24px;
|
|
85
|
-
${(props: any) => props.titleContent && css`
|
|
86
|
-
margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
|
|
87
|
-
`}
|
|
88
|
-
`
|
|
89
|
-
|
|
90
72
|
export const WrapperButtons = styled.View`
|
|
91
73
|
flex-direction: row;
|
|
92
74
|
width: 100%;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useFocusEffect } from '@react-navigation/native'
|
|
2
3
|
import { TouchableOpacity, StyleSheet, View, Dimensions, Platform } from 'react-native'
|
|
3
4
|
import { useLanguage, useUtils, useConfig, useOrder, MomentOption } from 'ordering-components/native'
|
|
4
5
|
import { OButton, OIcon, OText } from '../shared'
|
|
@@ -55,7 +56,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
55
56
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
56
57
|
const [isEnabled, setIsEnabled] = useState(false)
|
|
57
58
|
const { top } = useSafeAreaInsets()
|
|
58
|
-
const is12hours = configs?.
|
|
59
|
+
const is12hours = configs?.general_hour_format?.value?.includes('hh:mm')
|
|
59
60
|
|
|
60
61
|
const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
|
|
61
62
|
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
@@ -63,7 +64,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
63
64
|
container: {
|
|
64
65
|
height: windowHeight,
|
|
65
66
|
paddingVertical: 30,
|
|
66
|
-
paddingHorizontal:
|
|
67
|
+
paddingHorizontal: 20
|
|
67
68
|
},
|
|
68
69
|
businessLogo: {
|
|
69
70
|
backgroundColor: 'white',
|
|
@@ -170,7 +171,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
170
171
|
if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
|
|
171
172
|
let hour = ''
|
|
172
173
|
let meridian = ''
|
|
173
|
-
if (
|
|
174
|
+
if (is12hours) {
|
|
174
175
|
if (i === 0) {
|
|
175
176
|
hour = '12'
|
|
176
177
|
meridian = ' ' + t('AM', 'AM')
|
|
@@ -310,17 +311,18 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
310
311
|
}
|
|
311
312
|
}, [dateSelected])
|
|
312
313
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
useFocusEffect(
|
|
315
|
+
React.useCallback(() => {
|
|
316
|
+
handleAsap && handleAsap()
|
|
317
|
+
}, [])
|
|
318
|
+
)
|
|
316
319
|
|
|
317
320
|
return (
|
|
318
321
|
<>
|
|
319
|
-
<PreOrderContainer contentContainerStyle={{ paddingVertical: 32, paddingHorizontal:
|
|
322
|
+
<PreOrderContainer contentContainerStyle={{ paddingVertical: 32, paddingHorizontal: 20 }}>
|
|
320
323
|
<TouchableOpacity onPress={() => goToBack && goToBack()} style={{ marginBottom: 12 }}>
|
|
321
324
|
<IconAntDesign
|
|
322
325
|
name='close'
|
|
323
|
-
color={theme.colors.textThird}
|
|
324
326
|
size={24}
|
|
325
327
|
style={{ marginLeft: -4 }}
|
|
326
328
|
/>
|
|
@@ -557,7 +559,7 @@ export const BusinessPreorder = (props: any) => {
|
|
|
557
559
|
: null
|
|
558
560
|
|
|
559
561
|
const splitCateringValue = (configName : string) =>
|
|
560
|
-
Object.values(
|
|
562
|
+
Object.values(props?.business?.configs || {})
|
|
561
563
|
?.find(config => config?.key === configName)
|
|
562
564
|
?.value?.split('|')
|
|
563
565
|
?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
|
|
@@ -92,7 +92,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
92
92
|
ref={tabsRef}
|
|
93
93
|
horizontal
|
|
94
94
|
style={{ ...styles.container, borderBottomWidth: loading ? 0 : 1 }}
|
|
95
|
-
contentContainerStyle={{ paddingHorizontal:
|
|
95
|
+
contentContainerStyle={{ paddingHorizontal: 20 }}
|
|
96
96
|
showsHorizontalScrollIndicator={false}
|
|
97
97
|
onScroll={(e: any) => setScrollOffsetX(e.nativeEvent.contentOffset.x)}
|
|
98
98
|
scrollEventThrottle={16}
|
|
@@ -107,8 +107,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
107
107
|
</Placeholder>
|
|
108
108
|
)}
|
|
109
109
|
{!loading &&
|
|
110
|
-
categories &&
|
|
111
|
-
categories.length &&
|
|
110
|
+
categories?.length > 0 &&
|
|
112
111
|
categories.map((category: any) => (
|
|
113
112
|
<Tab
|
|
114
113
|
key={category.id}
|
|
@@ -9,7 +9,7 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
|
9
9
|
import { View, ScrollView } from 'react-native';
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
|
-
import { shape } from '../../utils'
|
|
12
|
+
import { lightenDarkenColor, shape } from '../../utils'
|
|
13
13
|
import { CategoryDescriptionMemoized } from './CategoryDescription';
|
|
14
14
|
import { OrderItAgain } from '../OrderItAgain'
|
|
15
15
|
import { SubcategoriesComponentMemoized } from './SubcategoriesComponent';
|
|
@@ -39,7 +39,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
39
39
|
handleUpdateProducts,
|
|
40
40
|
previouslyProducts,
|
|
41
41
|
isFiltMode,
|
|
42
|
-
navigation
|
|
42
|
+
navigation,
|
|
43
|
+
businessSingleId
|
|
43
44
|
} = props;
|
|
44
45
|
|
|
45
46
|
const [, t] = useLanguage();
|
|
@@ -92,6 +93,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
92
93
|
handleUpdateProducts={handleUpdateProducts}
|
|
93
94
|
currentCart={currentCart}
|
|
94
95
|
searchValue={searchValue}
|
|
96
|
+
businessSingleId={businessSingleId}
|
|
95
97
|
/>
|
|
96
98
|
)}
|
|
97
99
|
{category.id &&
|
|
@@ -104,7 +106,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
104
106
|
<SingleProductCard
|
|
105
107
|
key={'prod_' + product.id + `_${i}`}
|
|
106
108
|
isSoldOut={product.inventoried && !product.quantity}
|
|
107
|
-
enableIntersection={!isFiltMode
|
|
109
|
+
// enableIntersection={!isFiltMode}
|
|
108
110
|
product={product}
|
|
109
111
|
businessId={businessId}
|
|
110
112
|
categoryState={categoryState}
|
|
@@ -112,6 +114,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
112
114
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
113
115
|
handleUpdateProducts={handleUpdateProducts}
|
|
114
116
|
navigation={navigation}
|
|
117
|
+
businessSingleId={businessSingleId}
|
|
115
118
|
/>
|
|
116
119
|
))
|
|
117
120
|
}
|
|
@@ -132,13 +135,14 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
132
135
|
key={'feat_' + product.id + `_${i}`}
|
|
133
136
|
isSoldOut={product.inventoried && !product.quantity}
|
|
134
137
|
product={product}
|
|
135
|
-
enableIntersection={!isFiltMode
|
|
138
|
+
// enableIntersection={!isFiltMode}
|
|
136
139
|
businessId={businessId}
|
|
137
140
|
categoryState={categoryState}
|
|
138
141
|
onProductClick={onProductClick}
|
|
139
142
|
handleUpdateProducts={handleUpdateProducts}
|
|
140
143
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
141
144
|
navigation={navigation}
|
|
145
|
+
businessSingleId={businessSingleId}
|
|
142
146
|
/>
|
|
143
147
|
),
|
|
144
148
|
)}
|
|
@@ -182,13 +186,15 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
182
186
|
{category?.ribbon?.enabled && (
|
|
183
187
|
<RibbonBox
|
|
184
188
|
bgColor={category?.ribbon?.color}
|
|
189
|
+
colorText={lightenDarkenColor(category?.ribbon?.color)}
|
|
190
|
+
borderRibbon={lightenDarkenColor(category?.ribbon?.color)}
|
|
185
191
|
isRoundRect={category?.ribbon?.shape === shape?.rectangleRound}
|
|
186
192
|
isCapsule={category?.ribbon?.shape === shape?.capsuleShape}
|
|
187
193
|
>
|
|
188
194
|
<OText
|
|
189
195
|
size={10}
|
|
190
196
|
weight={'400'}
|
|
191
|
-
color={theme.colors.white}
|
|
197
|
+
color={lightenDarkenColor(category?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
192
198
|
numberOfLines={2}
|
|
193
199
|
ellipsizeMode='tail'
|
|
194
200
|
lineHeight={13}
|
|
@@ -231,7 +237,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
231
237
|
{products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
|
|
232
238
|
<SingleProductCard
|
|
233
239
|
key={`${product?.id}_${i}`}
|
|
234
|
-
enableIntersection={!isFiltMode
|
|
240
|
+
enableIntersection={!isFiltMode}
|
|
235
241
|
isSoldOut={product.inventoried && !product.quantity}
|
|
236
242
|
businessId={businessId}
|
|
237
243
|
product={product}
|
|
@@ -240,6 +246,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
240
246
|
handleUpdateProducts={handleUpdateProducts}
|
|
241
247
|
navigation={navigation}
|
|
242
248
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
249
|
+
businessSingleId={businessSingleId}
|
|
243
250
|
/>
|
|
244
251
|
))}
|
|
245
252
|
</>
|
|
@@ -302,10 +309,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
302
309
|
? t('SEARCH_REDIRECT', 'Go to Businesses')
|
|
303
310
|
: t('CLEAR_FILTERS', 'Clear filters')
|
|
304
311
|
}
|
|
305
|
-
onClickButton={() =>
|
|
312
|
+
onClickButton={!businessSingleId ? () =>
|
|
306
313
|
!searchValue
|
|
307
314
|
? handleSearchRedirect && handleSearchRedirect()
|
|
308
315
|
: handleCancelSearch && handleCancelSearch()
|
|
316
|
+
: null
|
|
309
317
|
}
|
|
310
318
|
/>
|
|
311
319
|
</WrapperNotFound>
|
|
@@ -18,18 +18,23 @@ export const RibbonBox = styled.View`
|
|
|
18
18
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
19
19
|
padding: 2px 8px;
|
|
20
20
|
max-width: 180px;
|
|
21
|
-
|
|
22
21
|
${(props: any) => props.bgColor && css`
|
|
23
22
|
background-color: ${props.bgColor};
|
|
24
23
|
`}
|
|
25
|
-
|
|
26
24
|
${(props: any) => props.isRoundRect && css`
|
|
27
25
|
border-radius: 7.6px;
|
|
28
26
|
`}
|
|
29
|
-
|
|
30
27
|
${(props: any) => props.isCapsule && css`
|
|
31
28
|
border-radius: 50px;
|
|
32
29
|
`}
|
|
30
|
+
|
|
31
|
+
${(props: any) => props.colorText && css`
|
|
32
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
33
|
+
`}
|
|
34
|
+
|
|
35
|
+
${(props: any) => props.borderRibbon && css`
|
|
36
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
37
|
+
`}
|
|
33
38
|
`
|
|
34
39
|
|
|
35
40
|
export const SubCategoriesContainer = styled.View`
|
|
@@ -13,7 +13,7 @@ const UpsellingRedirectUI = (props: any) => {
|
|
|
13
13
|
if (!upsellingProducts.loading) {
|
|
14
14
|
if (upsellingProducts?.products?.length) {
|
|
15
15
|
onRedirect &&
|
|
16
|
-
onRedirect('UpsellingPage', props)
|
|
16
|
+
onRedirect('UpsellingPage', {...props, products: upsellingProducts?.products })
|
|
17
17
|
} else {
|
|
18
18
|
handleUpsellingPage && handleUpsellingPage()
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView,
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler } from 'react-native'
|
|
3
3
|
import { IOScrollView } from 'react-native-intersection-observer'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
useUtils,
|
|
12
12
|
ToastType,
|
|
13
13
|
useToast,
|
|
14
|
-
useConfig
|
|
14
|
+
useConfig,
|
|
15
|
+
useEvent
|
|
15
16
|
} from 'ordering-components/native'
|
|
16
17
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
17
18
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
@@ -24,6 +25,8 @@ import { BusinessProductsListingParams } from '../../types'
|
|
|
24
25
|
import { _retrieveStoreData, _removeStoreData } from '../../providers/StoreUtil';
|
|
25
26
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
26
27
|
import { useIsFocused } from '@react-navigation/native';
|
|
28
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
29
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
27
30
|
|
|
28
31
|
import {
|
|
29
32
|
TopHeader,
|
|
@@ -42,6 +45,7 @@ import { ProfessionalFilter } from '../ProfessionalFilter';
|
|
|
42
45
|
import { ServiceForm } from '../ServiceForm';
|
|
43
46
|
import { BusinessesListing } from '../BusinessesListing/Layout/Original'
|
|
44
47
|
import { PageBanner } from '../PageBanner'
|
|
48
|
+
import { NavBack } from 'ordering-ui-react-native/src/components/OrderDetails/styles';
|
|
45
49
|
|
|
46
50
|
const PIXELS_TO_SCROLL = 2000
|
|
47
51
|
|
|
@@ -68,7 +72,9 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
68
72
|
professionalSelected,
|
|
69
73
|
handleUpdateProfessionals,
|
|
70
74
|
handleChangeProfessionalSelected,
|
|
71
|
-
onBusinessClick
|
|
75
|
+
onBusinessClick,
|
|
76
|
+
businessSingleId,
|
|
77
|
+
productModal
|
|
72
78
|
} = props
|
|
73
79
|
|
|
74
80
|
const insets = useSafeAreaInsets()
|
|
@@ -79,6 +85,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
79
85
|
const [{ parsePrice }] = useUtils()
|
|
80
86
|
const [, { showToast }] = useToast()
|
|
81
87
|
const [{ configs }] = useConfig()
|
|
88
|
+
const [events] = useEvent()
|
|
82
89
|
const isFocused = useIsFocused();
|
|
83
90
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
84
91
|
|
|
@@ -107,7 +114,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
107
114
|
},
|
|
108
115
|
searchIcon: {
|
|
109
116
|
borderWidth: 0,
|
|
110
|
-
padding:
|
|
117
|
+
padding: 10,
|
|
111
118
|
justifyContent: 'center',
|
|
112
119
|
shadowColor: theme.colors.clear,
|
|
113
120
|
},
|
|
@@ -132,31 +139,44 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
132
139
|
const [openService, setOpenService] = useState(false)
|
|
133
140
|
const [currentProduct, setCurrentProduct] = useState(null)
|
|
134
141
|
const [searchBarHeight, setSearchBarHeight] = useState(60)
|
|
142
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
143
|
+
const [viewedCategory, setViewedCategory] = useState<any>(null)
|
|
144
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
135
145
|
|
|
136
146
|
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
137
147
|
const isQuickAddProduct = configs?.add_product_with_one_click?.value === '1'
|
|
138
148
|
const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
|
|
139
|
-
|
|
140
149
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
141
150
|
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
142
|
-
const filtProductsHeight = Platform.OS === 'ios' ?
|
|
151
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 65 : 30
|
|
152
|
+
const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
|
|
153
|
+
|
|
143
154
|
const onRedirect = (route: string, params?: any) => {
|
|
144
155
|
navigation.navigate(route, params)
|
|
145
156
|
}
|
|
157
|
+
const vibrateApp = (impact?: string) => {
|
|
158
|
+
const options = {
|
|
159
|
+
enableVibrateFallback: true,
|
|
160
|
+
ignoreAndroidSystemSettings: false
|
|
161
|
+
};
|
|
162
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
163
|
+
}
|
|
146
164
|
const onProductClick = async (product: any) => {
|
|
147
|
-
if (product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
|
|
165
|
+
if (product.ingredients?.length === 0 && product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
|
|
148
166
|
const isProductAddedToCart = currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)
|
|
149
167
|
const productQuantity = isProductAddedToCart?.quantity
|
|
168
|
+
const minimumPerOrder = product?.minimum_per_order || 1
|
|
150
169
|
const addCurrentProduct = {
|
|
151
170
|
...product,
|
|
152
|
-
quantity:
|
|
171
|
+
quantity: minimumPerOrder
|
|
153
172
|
}
|
|
154
173
|
const updateCurrentProduct = {
|
|
174
|
+
name: product?.name,
|
|
155
175
|
id: product.id,
|
|
156
176
|
code: isProductAddedToCart?.code,
|
|
157
177
|
quantity: productQuantity + 1
|
|
158
178
|
}
|
|
159
|
-
|
|
179
|
+
vibrateApp()
|
|
160
180
|
const cartData = currentCart?.business_id ? currentCart : { business_id: business.id }
|
|
161
181
|
if (isProductAddedToCart) {
|
|
162
182
|
await updateProduct(updateCurrentProduct, cartData, isQuickAddProduct)
|
|
@@ -173,10 +193,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
173
193
|
onRedirect('ProductDetails', {
|
|
174
194
|
product: product,
|
|
175
195
|
businessSlug: business.slug,
|
|
176
|
-
businessId: business.id,
|
|
177
|
-
productAddedToCartLength
|
|
196
|
+
businessId: business.id || product?.category?.business_id,
|
|
197
|
+
productAddedToCartLength,
|
|
198
|
+
isRedirect: false
|
|
178
199
|
})
|
|
179
200
|
}
|
|
201
|
+
events.emit('product_clicked', product)
|
|
180
202
|
}
|
|
181
203
|
|
|
182
204
|
const handleCancel = () => {
|
|
@@ -184,18 +206,23 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
184
206
|
handleChangeSearch('')
|
|
185
207
|
}
|
|
186
208
|
|
|
187
|
-
const handleUpsellingPage = () => {
|
|
209
|
+
const handleUpsellingPage = (cart: any) => {
|
|
210
|
+
const isProductCartParam = !!cart?.products?.length
|
|
188
211
|
setOpenUpselling(false)
|
|
189
212
|
setCanOpenUpselling(false)
|
|
190
|
-
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
191
|
-
|
|
213
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
214
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
215
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart?.uuid : _c)
|
|
216
|
+
if (cartsAvailable.length === 1 || !isCheckoutMultiBusinessEnabled) {
|
|
217
|
+
const cart = isCheckoutMultiBusinessEnabled ? cartsAvailable[0] : currentCart
|
|
218
|
+
|
|
192
219
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
193
220
|
screen: 'CheckoutPage',
|
|
194
|
-
cartUuid:
|
|
195
|
-
businessLogo:
|
|
196
|
-
businessName:
|
|
197
|
-
cartTotal:
|
|
198
|
-
})
|
|
221
|
+
cartUuid: cart?.uuid,
|
|
222
|
+
businessLogo: cart?.business?.logo,
|
|
223
|
+
businessName: cart?.business?.name,
|
|
224
|
+
cartTotal: cart?.total
|
|
225
|
+
}, true)
|
|
199
226
|
} else {
|
|
200
227
|
const groupKeys: any = {}
|
|
201
228
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -211,12 +238,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
211
238
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
212
239
|
screen: 'MultiCheckout',
|
|
213
240
|
checkCarts: true
|
|
214
|
-
})
|
|
241
|
+
}, true)
|
|
215
242
|
} else {
|
|
216
243
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
217
244
|
screen: 'MultiCheckout',
|
|
218
245
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
219
|
-
})
|
|
246
|
+
}, true)
|
|
220
247
|
}
|
|
221
248
|
}
|
|
222
249
|
}
|
|
@@ -229,6 +256,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
229
256
|
|
|
230
257
|
const handlePageScroll = useCallback(({ nativeEvent }: any) => {
|
|
231
258
|
const scrollOffset = nativeEvent.contentOffset.y
|
|
259
|
+
setShowTitle(scrollOffset > 30)
|
|
260
|
+
|
|
232
261
|
if (businessState?.business?.lazy_load_products_recommended) {
|
|
233
262
|
const height = nativeEvent.contentSize.height
|
|
234
263
|
const hasMore = !(categoryState.pagination.totalPages === categoryState.pagination.currentPage)
|
|
@@ -259,7 +288,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
259
288
|
}, []);
|
|
260
289
|
|
|
261
290
|
const handleBackNavigation = () => {
|
|
262
|
-
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
291
|
+
navigation?.canGoBack() && !props.fromMulti ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
263
292
|
}
|
|
264
293
|
|
|
265
294
|
const adjustBusiness = async (adjustBusinessId: number) => {
|
|
@@ -297,12 +326,84 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
297
326
|
}
|
|
298
327
|
}, [isFocused])
|
|
299
328
|
|
|
329
|
+
|
|
330
|
+
useEffect(() => {
|
|
331
|
+
function onKeyboardDidShow(e: KeyboardEvent) {
|
|
332
|
+
setKeyboardHeight(e?.endCoordinates?.height);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function onKeyboardDidHide() {
|
|
336
|
+
setKeyboardHeight(0);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const showSubscription = Keyboard.addListener('keyboardDidShow', onKeyboardDidShow);
|
|
340
|
+
const hideSubscription = Keyboard.addListener('keyboardDidHide', onKeyboardDidHide);
|
|
341
|
+
return () => {
|
|
342
|
+
showSubscription.remove();
|
|
343
|
+
hideSubscription.remove();
|
|
344
|
+
};
|
|
345
|
+
}, []);
|
|
346
|
+
|
|
300
347
|
const subtotalWithTaxes = currentCart?.taxes?.reduce((acc: any, item: any) => {
|
|
301
348
|
if (item?.type === 1)
|
|
302
349
|
return acc = acc + item?.summary?.tax
|
|
303
350
|
return acc = acc
|
|
304
351
|
}, currentCart?.subtotal)
|
|
305
352
|
|
|
353
|
+
const onChangeSearch = (query: any) => {
|
|
354
|
+
handleChangeSearch(query)
|
|
355
|
+
if (query) {
|
|
356
|
+
events.emit('products_searched', query)
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
useEffect(() => {
|
|
361
|
+
let categoryId: any = null
|
|
362
|
+
if (business?.lazy_load_products_recommended) {
|
|
363
|
+
if (categorySelected?.id) {
|
|
364
|
+
categoryId = categorySelected.id
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
if (selectedCategoryId) {
|
|
368
|
+
const originCategoryId = selectedCategoryId.replace('cat_', '')
|
|
369
|
+
if (!isNaN(originCategoryId)) {
|
|
370
|
+
categoryId = Number(originCategoryId)
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (categoryId) {
|
|
375
|
+
const _viewedCategory = business.categories.find(category => category.id === categoryId)
|
|
376
|
+
if (_viewedCategory?.id !== viewedCategory?.id) {
|
|
377
|
+
setViewedCategory(_viewedCategory)
|
|
378
|
+
events.emit('product_list_viewed', _viewedCategory)
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}, [business?.lazy_load_products_recommended, selectedCategoryId, categorySelected?.id, viewedCategory])
|
|
382
|
+
|
|
383
|
+
useEffect(() => {
|
|
384
|
+
const handleArrowBack: any = () => {
|
|
385
|
+
navigation.goBack()
|
|
386
|
+
return true
|
|
387
|
+
}
|
|
388
|
+
BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
|
|
389
|
+
return () => {
|
|
390
|
+
BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
|
|
391
|
+
}
|
|
392
|
+
}, [])
|
|
393
|
+
|
|
394
|
+
useEffect(() => {
|
|
395
|
+
if (!business && !loading && !error) {
|
|
396
|
+
showToast(ToastType.Error, t('BUSINESS_NOT_FOUND', 'Business not found'))
|
|
397
|
+
navigation.navigate('BusinessList')
|
|
398
|
+
}
|
|
399
|
+
}, [business, error, loading])
|
|
400
|
+
|
|
401
|
+
useEffect(() => {
|
|
402
|
+
if (productModal?.product && !productModal?.loading && !productModal?.error) {
|
|
403
|
+
onProductClick(props?.productModal?.product)
|
|
404
|
+
}
|
|
405
|
+
}, [productModal])
|
|
406
|
+
|
|
306
407
|
return (
|
|
307
408
|
<>
|
|
308
409
|
<View style={{ flex: 1, backgroundColor: backgroundColor }}>
|
|
@@ -312,12 +413,29 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
312
413
|
marginTop: Platform.OS === 'ios' ? insets.top : 0
|
|
313
414
|
}}
|
|
314
415
|
onLayout={(event: any) => setSearchBarHeight(event.nativeEvent.layout.height)}
|
|
416
|
+
hideArrow={(businessSingleId && auth)}
|
|
315
417
|
>
|
|
316
418
|
{!isOpenSearchBar && (
|
|
317
419
|
<>
|
|
318
|
-
|
|
319
|
-
<
|
|
320
|
-
|
|
420
|
+
{!(businessSingleId && auth) && (
|
|
421
|
+
<TopActions onPress={() => handleBackNavigation()}>
|
|
422
|
+
<AntDesignIcon
|
|
423
|
+
name='arrowleft'
|
|
424
|
+
size={26}
|
|
425
|
+
/>
|
|
426
|
+
</TopActions>
|
|
427
|
+
)}
|
|
428
|
+
{showTitle && (
|
|
429
|
+
<OText
|
|
430
|
+
size={16}
|
|
431
|
+
style={{ flex: 1, textAlign: 'center' }}
|
|
432
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
433
|
+
numberOfLines={2}
|
|
434
|
+
ellipsizeMode='tail'
|
|
435
|
+
>
|
|
436
|
+
{business?.name}
|
|
437
|
+
</OText>
|
|
438
|
+
)}
|
|
321
439
|
{!errorQuantityProducts && (
|
|
322
440
|
<View style={{ ...styles.headerItem }}>
|
|
323
441
|
<TouchableOpacity
|
|
@@ -334,12 +452,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
334
452
|
<WrapSearchBar>
|
|
335
453
|
<SearchBar
|
|
336
454
|
autoFocus
|
|
337
|
-
onSearch={
|
|
455
|
+
onSearch={onChangeSearch}
|
|
338
456
|
onCancel={() => handleCancel()}
|
|
339
457
|
isCancelXButtonShow
|
|
340
458
|
noBorderShow
|
|
341
459
|
placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
|
|
342
|
-
lazyLoad
|
|
460
|
+
lazyLoad
|
|
343
461
|
/>
|
|
344
462
|
</WrapSearchBar>
|
|
345
463
|
)}
|
|
@@ -373,8 +491,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
373
491
|
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
374
492
|
<FiltProductsContainer
|
|
375
493
|
style={{
|
|
376
|
-
height: Dimensions.get('window').height - filtProductsHeight,
|
|
377
|
-
top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight
|
|
494
|
+
height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 55 : 0),
|
|
495
|
+
top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight,
|
|
378
496
|
}}
|
|
379
497
|
contentContainerStyle={{ flexGrow: 1 }}
|
|
380
498
|
>
|
|
@@ -407,15 +525,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
407
525
|
previouslyProducts={business?.previously_products}
|
|
408
526
|
navigation={navigation}
|
|
409
527
|
isFiltMode
|
|
528
|
+
businessSingleId={businessSingleId}
|
|
410
529
|
/>
|
|
411
530
|
</View>
|
|
412
531
|
</FiltProductsContainer>
|
|
413
532
|
)}
|
|
414
|
-
{isOpenFiltProducts && (
|
|
415
|
-
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
416
|
-
)}
|
|
417
533
|
<IOScrollView
|
|
418
|
-
stickyHeaderIndices={[business?.professionals?.length > 0 ?
|
|
534
|
+
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
|
|
419
535
|
style={{
|
|
420
536
|
...styles.mainContainer,
|
|
421
537
|
marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
|
|
@@ -452,7 +568,9 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
452
568
|
/>
|
|
453
569
|
</ProfessionalFilterWrapper>
|
|
454
570
|
)}
|
|
455
|
-
|
|
571
|
+
{businessState?.business?.id && (
|
|
572
|
+
<PageBanner position='app_business_page' businessId={businessState?.business?.id} navigation={navigation} />
|
|
573
|
+
)}
|
|
456
574
|
<View
|
|
457
575
|
style={{
|
|
458
576
|
height: 8,
|
|
@@ -480,7 +598,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
480
598
|
<>
|
|
481
599
|
<WrapContent
|
|
482
600
|
onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
|
|
483
|
-
style={{ paddingHorizontal:
|
|
601
|
+
style={{ paddingHorizontal: 20 }}
|
|
484
602
|
>
|
|
485
603
|
<BusinessProductsList
|
|
486
604
|
categories={[
|
|
@@ -509,6 +627,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
509
627
|
handleUpdateProducts={handleUpdateProducts}
|
|
510
628
|
navigation={navigation}
|
|
511
629
|
previouslyProducts={business?.previously_products}
|
|
630
|
+
businessSingleId={businessSingleId}
|
|
512
631
|
/>
|
|
513
632
|
</WrapContent>
|
|
514
633
|
</>
|
|
@@ -536,8 +655,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
536
655
|
</WrapContent>
|
|
537
656
|
</>
|
|
538
657
|
)}
|
|
658
|
+
{isOpenFiltProducts && (
|
|
659
|
+
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
660
|
+
)}
|
|
539
661
|
</IOScrollView>
|
|
540
|
-
{
|
|
662
|
+
{viewOrderButtonVisible && (
|
|
541
663
|
<View style={{ marginBottom: 0 }}>
|
|
542
664
|
<FloatingButton
|
|
543
665
|
btnText={
|
|
@@ -588,12 +710,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
588
710
|
<ServiceForm
|
|
589
711
|
navigation={navigation}
|
|
590
712
|
product={currentProduct}
|
|
591
|
-
businessSlug={business
|
|
592
|
-
businessId={business
|
|
713
|
+
businessSlug={business?.slug}
|
|
714
|
+
businessId={business?.id}
|
|
593
715
|
professionalList={business?.professionals}
|
|
594
716
|
professionalSelected={professionalSelected}
|
|
595
717
|
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
596
|
-
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
597
718
|
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
598
719
|
onSave={() => setOpenService(false)}
|
|
599
720
|
onClose={() => setOpenService(false)}
|
|
@@ -607,6 +728,8 @@ export const BusinessProductsListing = (props: BusinessProductsListingParams) =>
|
|
|
607
728
|
const businessProductslistingProps = {
|
|
608
729
|
...props,
|
|
609
730
|
isForceSearch: Platform.OS === 'ios',
|
|
731
|
+
isApp: true,
|
|
732
|
+
isFetchAllProducts: true,
|
|
610
733
|
UIComponent: BusinessProductsListingUI
|
|
611
734
|
}
|
|
612
735
|
return (
|