ordering-ui-react-native 0.17.97 → 0.17.98-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 +0 -1
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- 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 +209 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- 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 +60 -47
- 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 +198 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +24 -10
- package/themes/business/src/utils/index.tsx +29 -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/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/AddressList/index.tsx +5 -8
- 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 +72 -36
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- 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/BusinessItemAccordion/index.tsx +21 -23
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- 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 +137 -32
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- 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 +36 -403
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +44 -81
- package/themes/original/src/components/CartContent/index.tsx +70 -30
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/Checkout/index.tsx +262 -35
- package/themes/original/src/components/CitiesControl/index.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 +12 -4
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- 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 +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- 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/Home/index.tsx +13 -4
- 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/MomentOption/index.tsx +41 -36
- package/themes/original/src/components/MomentOption/styles.tsx +0 -15
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +12 -1
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +50 -38
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- 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/OrderSummary/index.tsx +59 -56
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/index.tsx +43 -20
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- 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/index.tsx +65 -34
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -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/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +40 -20
- 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/index.tsx +3 -8
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +84 -19
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +7 -25
- 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/Wallets/index.tsx +51 -61
- package/themes/original/src/components/Wallets/styles.tsx +2 -4
- 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 +3 -3
- package/themes/original/src/config/constants.tsx +0 -10
- package/themes/original/src/types/index.tsx +31 -15
- 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,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,
|
|
@@ -68,7 +71,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
68
71
|
professionalSelected,
|
|
69
72
|
handleUpdateProfessionals,
|
|
70
73
|
handleChangeProfessionalSelected,
|
|
71
|
-
onBusinessClick
|
|
74
|
+
onBusinessClick,
|
|
75
|
+
businessSingleId
|
|
72
76
|
} = props
|
|
73
77
|
|
|
74
78
|
const insets = useSafeAreaInsets()
|
|
@@ -79,6 +83,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
79
83
|
const [{ parsePrice }] = useUtils()
|
|
80
84
|
const [, { showToast }] = useToast()
|
|
81
85
|
const [{ configs }] = useConfig()
|
|
86
|
+
const [events] = useEvent()
|
|
82
87
|
const isFocused = useIsFocused();
|
|
83
88
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
84
89
|
|
|
@@ -132,31 +137,42 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
132
137
|
const [openService, setOpenService] = useState(false)
|
|
133
138
|
const [currentProduct, setCurrentProduct] = useState(null)
|
|
134
139
|
const [searchBarHeight, setSearchBarHeight] = useState(60)
|
|
140
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
141
|
+
const [viewedCategory, setViewedCategory] = useState<any>(null)
|
|
142
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
135
143
|
|
|
136
144
|
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
137
145
|
const isQuickAddProduct = configs?.add_product_with_one_click?.value === '1'
|
|
138
|
-
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
146
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
141
147
|
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
142
|
-
const
|
|
148
|
+
const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
|
|
149
|
+
|
|
143
150
|
const onRedirect = (route: string, params?: any) => {
|
|
144
151
|
navigation.navigate(route, params)
|
|
145
152
|
}
|
|
153
|
+
const vibrateApp = (impact?: string) => {
|
|
154
|
+
const options = {
|
|
155
|
+
enableVibrateFallback: true,
|
|
156
|
+
ignoreAndroidSystemSettings: false
|
|
157
|
+
};
|
|
158
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
159
|
+
}
|
|
146
160
|
const onProductClick = async (product: any) => {
|
|
147
|
-
if (product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
|
|
161
|
+
if (product.ingredients?.length === 0 && product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
|
|
148
162
|
const isProductAddedToCart = currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)
|
|
149
163
|
const productQuantity = isProductAddedToCart?.quantity
|
|
164
|
+
const minimumPerOrder = product?.minimum_per_order || 1
|
|
150
165
|
const addCurrentProduct = {
|
|
151
166
|
...product,
|
|
152
|
-
quantity:
|
|
167
|
+
quantity: minimumPerOrder
|
|
153
168
|
}
|
|
154
169
|
const updateCurrentProduct = {
|
|
170
|
+
name: product?.name,
|
|
155
171
|
id: product.id,
|
|
156
172
|
code: isProductAddedToCart?.code,
|
|
157
173
|
quantity: productQuantity + 1
|
|
158
174
|
}
|
|
159
|
-
|
|
175
|
+
vibrateApp()
|
|
160
176
|
const cartData = currentCart?.business_id ? currentCart : { business_id: business.id }
|
|
161
177
|
if (isProductAddedToCart) {
|
|
162
178
|
await updateProduct(updateCurrentProduct, cartData, isQuickAddProduct)
|
|
@@ -177,6 +193,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
177
193
|
productAddedToCartLength
|
|
178
194
|
})
|
|
179
195
|
}
|
|
196
|
+
events.emit('product_clicked', product)
|
|
180
197
|
}
|
|
181
198
|
|
|
182
199
|
const handleCancel = () => {
|
|
@@ -184,18 +201,23 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
184
201
|
handleChangeSearch('')
|
|
185
202
|
}
|
|
186
203
|
|
|
187
|
-
const handleUpsellingPage = () => {
|
|
204
|
+
const handleUpsellingPage = (cart: any) => {
|
|
205
|
+
const isProductCartParam = !!cart?.products?.length
|
|
188
206
|
setOpenUpselling(false)
|
|
189
207
|
setCanOpenUpselling(false)
|
|
190
|
-
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
191
|
-
|
|
208
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
209
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
210
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart?.uuid : _c)
|
|
211
|
+
if (cartsAvailable.length === 1 || !isCheckoutMultiBusinessEnabled) {
|
|
212
|
+
const cart = isCheckoutMultiBusinessEnabled ? cartsAvailable[0] : currentCart
|
|
213
|
+
|
|
192
214
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
193
215
|
screen: 'CheckoutPage',
|
|
194
|
-
cartUuid:
|
|
195
|
-
businessLogo:
|
|
196
|
-
businessName:
|
|
197
|
-
cartTotal:
|
|
198
|
-
})
|
|
216
|
+
cartUuid: cart?.uuid,
|
|
217
|
+
businessLogo: cart?.business?.logo,
|
|
218
|
+
businessName: cart?.business?.name,
|
|
219
|
+
cartTotal: cart?.total
|
|
220
|
+
}, true)
|
|
199
221
|
} else {
|
|
200
222
|
const groupKeys: any = {}
|
|
201
223
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -211,12 +233,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
211
233
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
212
234
|
screen: 'MultiCheckout',
|
|
213
235
|
checkCarts: true
|
|
214
|
-
})
|
|
236
|
+
}, true)
|
|
215
237
|
} else {
|
|
216
238
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
217
239
|
screen: 'MultiCheckout',
|
|
218
240
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
219
|
-
})
|
|
241
|
+
}, true)
|
|
220
242
|
}
|
|
221
243
|
}
|
|
222
244
|
}
|
|
@@ -229,6 +251,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
229
251
|
|
|
230
252
|
const handlePageScroll = useCallback(({ nativeEvent }: any) => {
|
|
231
253
|
const scrollOffset = nativeEvent.contentOffset.y
|
|
254
|
+
setShowTitle(scrollOffset > 30)
|
|
255
|
+
|
|
232
256
|
if (businessState?.business?.lazy_load_products_recommended) {
|
|
233
257
|
const height = nativeEvent.contentSize.height
|
|
234
258
|
const hasMore = !(categoryState.pagination.totalPages === categoryState.pagination.currentPage)
|
|
@@ -259,7 +283,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
259
283
|
}, []);
|
|
260
284
|
|
|
261
285
|
const handleBackNavigation = () => {
|
|
262
|
-
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
286
|
+
navigation?.canGoBack() && !props.fromMulti ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
263
287
|
}
|
|
264
288
|
|
|
265
289
|
const adjustBusiness = async (adjustBusinessId: number) => {
|
|
@@ -297,12 +321,71 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
297
321
|
}
|
|
298
322
|
}, [isFocused])
|
|
299
323
|
|
|
324
|
+
|
|
325
|
+
useEffect(() => {
|
|
326
|
+
function onKeyboardDidShow(e: KeyboardEvent) {
|
|
327
|
+
setKeyboardHeight(e?.endCoordinates?.height);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function onKeyboardDidHide() {
|
|
331
|
+
setKeyboardHeight(0);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const showSubscription = Keyboard.addListener('keyboardDidShow', onKeyboardDidShow);
|
|
335
|
+
const hideSubscription = Keyboard.addListener('keyboardDidHide', onKeyboardDidHide);
|
|
336
|
+
return () => {
|
|
337
|
+
showSubscription.remove();
|
|
338
|
+
hideSubscription.remove();
|
|
339
|
+
};
|
|
340
|
+
}, []);
|
|
341
|
+
|
|
300
342
|
const subtotalWithTaxes = currentCart?.taxes?.reduce((acc: any, item: any) => {
|
|
301
343
|
if (item?.type === 1)
|
|
302
344
|
return acc = acc + item?.summary?.tax
|
|
303
345
|
return acc = acc
|
|
304
346
|
}, currentCart?.subtotal)
|
|
305
347
|
|
|
348
|
+
const onChangeSearch = (query: any) => {
|
|
349
|
+
handleChangeSearch(query)
|
|
350
|
+
if (query) {
|
|
351
|
+
events.emit('products_searched', query)
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
useEffect(() => {
|
|
356
|
+
let categoryId: any = null
|
|
357
|
+
if (business?.lazy_load_products_recommended) {
|
|
358
|
+
if (categorySelected?.id) {
|
|
359
|
+
categoryId = categorySelected.id
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
if (selectedCategoryId) {
|
|
363
|
+
const originCategoryId = selectedCategoryId.replace('cat_', '')
|
|
364
|
+
if (!isNaN(originCategoryId)) {
|
|
365
|
+
categoryId = Number(originCategoryId)
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (categoryId) {
|
|
370
|
+
const _viewedCategory = business.categories.find(category => category.id === categoryId)
|
|
371
|
+
if (_viewedCategory?.id !== viewedCategory?.id) {
|
|
372
|
+
setViewedCategory(_viewedCategory)
|
|
373
|
+
events.emit('product_list_viewed', _viewedCategory)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}, [business?.lazy_load_products_recommended, selectedCategoryId, categorySelected?.id, viewedCategory])
|
|
377
|
+
|
|
378
|
+
useEffect(() => {
|
|
379
|
+
const handleArrowBack: any = () => {
|
|
380
|
+
navigation.goBack()
|
|
381
|
+
return true
|
|
382
|
+
}
|
|
383
|
+
BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
|
|
384
|
+
return () => {
|
|
385
|
+
BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
|
|
386
|
+
}
|
|
387
|
+
}, [])
|
|
388
|
+
|
|
306
389
|
return (
|
|
307
390
|
<>
|
|
308
391
|
<View style={{ flex: 1, backgroundColor: backgroundColor }}>
|
|
@@ -312,12 +395,29 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
312
395
|
marginTop: Platform.OS === 'ios' ? insets.top : 0
|
|
313
396
|
}}
|
|
314
397
|
onLayout={(event: any) => setSearchBarHeight(event.nativeEvent.layout.height)}
|
|
398
|
+
hideArrow={(businessSingleId && auth)}
|
|
315
399
|
>
|
|
316
400
|
{!isOpenSearchBar && (
|
|
317
401
|
<>
|
|
318
|
-
|
|
319
|
-
<
|
|
320
|
-
|
|
402
|
+
{!(businessSingleId && auth) && (
|
|
403
|
+
<TopActions onPress={() => handleBackNavigation()}>
|
|
404
|
+
<AntDesignIcon
|
|
405
|
+
name='arrowleft'
|
|
406
|
+
size={26}
|
|
407
|
+
/>
|
|
408
|
+
</TopActions>
|
|
409
|
+
)}
|
|
410
|
+
{showTitle && (
|
|
411
|
+
<OText
|
|
412
|
+
size={16}
|
|
413
|
+
style={{ flex: 1, textAlign: 'center' }}
|
|
414
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
415
|
+
numberOfLines={2}
|
|
416
|
+
ellipsizeMode='tail'
|
|
417
|
+
>
|
|
418
|
+
{business?.name}
|
|
419
|
+
</OText>
|
|
420
|
+
)}
|
|
321
421
|
{!errorQuantityProducts && (
|
|
322
422
|
<View style={{ ...styles.headerItem }}>
|
|
323
423
|
<TouchableOpacity
|
|
@@ -334,12 +434,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
334
434
|
<WrapSearchBar>
|
|
335
435
|
<SearchBar
|
|
336
436
|
autoFocus
|
|
337
|
-
onSearch={
|
|
437
|
+
onSearch={onChangeSearch}
|
|
338
438
|
onCancel={() => handleCancel()}
|
|
339
439
|
isCancelXButtonShow
|
|
340
440
|
noBorderShow
|
|
341
441
|
placeholder={t('SEARCH_PRODUCTS', 'Search Products')}
|
|
342
|
-
lazyLoad
|
|
442
|
+
lazyLoad
|
|
343
443
|
/>
|
|
344
444
|
</WrapSearchBar>
|
|
345
445
|
)}
|
|
@@ -373,8 +473,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
373
473
|
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
374
474
|
<FiltProductsContainer
|
|
375
475
|
style={{
|
|
376
|
-
height: Dimensions.get('window').height -
|
|
377
|
-
top: Platform.OS === 'ios' ?
|
|
476
|
+
height: Dimensions.get('window').height - (keyboardHeight + (Platform.OS === 'ios' ? 100 : 80)),
|
|
477
|
+
top: Platform.OS === 'ios' ? searchBarHeight + insets.top : searchBarHeight
|
|
378
478
|
}}
|
|
379
479
|
contentContainerStyle={{ flexGrow: 1 }}
|
|
380
480
|
>
|
|
@@ -407,15 +507,16 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
407
507
|
previouslyProducts={business?.previously_products}
|
|
408
508
|
navigation={navigation}
|
|
409
509
|
isFiltMode
|
|
510
|
+
businessSingleId={businessSingleId}
|
|
410
511
|
/>
|
|
411
512
|
</View>
|
|
412
513
|
</FiltProductsContainer>
|
|
413
514
|
)}
|
|
414
515
|
{isOpenFiltProducts && (
|
|
415
|
-
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
516
|
+
<BackgroundGray isIos={Platform.OS === 'ios'} style={{ marginTop: insets.top + 60 }} />
|
|
416
517
|
)}
|
|
417
518
|
<IOScrollView
|
|
418
|
-
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 :
|
|
519
|
+
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
|
|
419
520
|
style={{
|
|
420
521
|
...styles.mainContainer,
|
|
421
522
|
marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
|
|
@@ -448,6 +549,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
448
549
|
professionals={business?.professionals}
|
|
449
550
|
professionalSelected={professionalSelected}
|
|
450
551
|
handleChangeProfessionalSelected={handleChangeProfessionalSelected}
|
|
552
|
+
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
451
553
|
/>
|
|
452
554
|
</ProfessionalFilterWrapper>
|
|
453
555
|
)}
|
|
@@ -508,6 +610,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
508
610
|
handleUpdateProducts={handleUpdateProducts}
|
|
509
611
|
navigation={navigation}
|
|
510
612
|
previouslyProducts={business?.previously_products}
|
|
613
|
+
businessSingleId={businessSingleId}
|
|
511
614
|
/>
|
|
512
615
|
</WrapContent>
|
|
513
616
|
</>
|
|
@@ -536,7 +639,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
536
639
|
</>
|
|
537
640
|
)}
|
|
538
641
|
</IOScrollView>
|
|
539
|
-
{
|
|
642
|
+
{viewOrderButtonVisible && (
|
|
540
643
|
<View style={{ marginBottom: 0 }}>
|
|
541
644
|
<FloatingButton
|
|
542
645
|
btnText={
|
|
@@ -587,8 +690,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
587
690
|
<ServiceForm
|
|
588
691
|
navigation={navigation}
|
|
589
692
|
product={currentProduct}
|
|
590
|
-
businessSlug={business
|
|
591
|
-
businessId={business
|
|
693
|
+
businessSlug={business?.slug}
|
|
694
|
+
businessId={business?.id}
|
|
592
695
|
professionalList={business?.professionals}
|
|
593
696
|
professionalSelected={professionalSelected}
|
|
594
697
|
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
@@ -606,6 +709,8 @@ export const BusinessProductsListing = (props: BusinessProductsListingParams) =>
|
|
|
606
709
|
const businessProductslistingProps = {
|
|
607
710
|
...props,
|
|
608
711
|
isForceSearch: Platform.OS === 'ios',
|
|
712
|
+
isApp: true,
|
|
713
|
+
isFetchAllProducts: true,
|
|
609
714
|
UIComponent: BusinessProductsListingUI
|
|
610
715
|
}
|
|
611
716
|
return (
|
|
@@ -7,7 +7,7 @@ export const TopHeader = styled.View`
|
|
|
7
7
|
width: 100%;
|
|
8
8
|
flex-direction: row;
|
|
9
9
|
align-items: center;
|
|
10
|
-
justify-content: space-between;
|
|
10
|
+
justify-content: ${({ hideArrow }: any) => hideArrow ? 'flex-end' : 'space-between'};
|
|
11
11
|
z-index: 1;
|
|
12
12
|
height: 60px;
|
|
13
13
|
min-height: 60px;
|
|
@@ -42,10 +42,9 @@ export const FiltProductsContainer = styled.ScrollView`
|
|
|
42
42
|
|
|
43
43
|
export const BackgroundGray = styled.View`
|
|
44
44
|
flex: 1;
|
|
45
|
-
height:
|
|
45
|
+
height: 100%;
|
|
46
46
|
background-color: rgba(0,0,0,0.5);
|
|
47
47
|
position: absolute;
|
|
48
|
-
margin-top: 100px;
|
|
49
48
|
z-index: 10000;
|
|
50
49
|
width: 100%;
|
|
51
50
|
`
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
BusinessReviews as BusinessReviewController,
|
|
4
4
|
useLanguage,
|
|
5
5
|
useOrder,
|
|
6
|
+
useUtils
|
|
6
7
|
} from 'ordering-components/native';
|
|
7
8
|
import { useTheme } from 'styled-components/native';
|
|
8
9
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
@@ -30,6 +31,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
30
31
|
const theme = useTheme();
|
|
31
32
|
const [searchReview, setSearchReview] = useState('')
|
|
32
33
|
const [orderState] = useOrder();
|
|
34
|
+
const [{ parseDate }] = useUtils()
|
|
33
35
|
|
|
34
36
|
const styles = StyleSheet.create({
|
|
35
37
|
starIcon: {
|
|
@@ -94,7 +96,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
94
96
|
const ReviewItem = ({ comment, created_at, total }: any) => (
|
|
95
97
|
<View style={{ marginBottom: 30 }}>
|
|
96
98
|
<OText size={12} color={theme.colors.textSecondary}>
|
|
97
|
-
{
|
|
99
|
+
{parseDate(created_at, { outputFormat: 'MMMM D, YYYY • hh:mm A' })}
|
|
98
100
|
</OText>
|
|
99
101
|
<OText size={12} color={theme.colors.textNormal}>{comment}</OText>
|
|
100
102
|
</View>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ListWrapper } from './styles'
|
|
3
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
4
|
+
import { View } from 'react-native'
|
|
5
|
+
|
|
6
|
+
export const FlatListBusinessListFooter = (props : any) => {
|
|
7
|
+
const {
|
|
8
|
+
businessesList,
|
|
9
|
+
paginationProps,
|
|
10
|
+
isChewLayout
|
|
11
|
+
} = props
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
15
|
+
{(businessesList.loading || !businessesList?.fetched) && (
|
|
16
|
+
<>
|
|
17
|
+
{[
|
|
18
|
+
...Array(
|
|
19
|
+
paginationProps.nextPageItems
|
|
20
|
+
? paginationProps.nextPageItems
|
|
21
|
+
: 8,
|
|
22
|
+
).keys(),
|
|
23
|
+
].map((item, i) => (
|
|
24
|
+
<Placeholder
|
|
25
|
+
Animation={Fade}
|
|
26
|
+
key={i}
|
|
27
|
+
style={{ marginBottom: 20 }}>
|
|
28
|
+
<View style={{ width: '100%' }}>
|
|
29
|
+
<PlaceholderLine
|
|
30
|
+
height={200}
|
|
31
|
+
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
32
|
+
/>
|
|
33
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
34
|
+
<View
|
|
35
|
+
style={{
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
}}>
|
|
39
|
+
<PlaceholderLine
|
|
40
|
+
height={25}
|
|
41
|
+
width={40}
|
|
42
|
+
style={{ marginBottom: 10 }}
|
|
43
|
+
/>
|
|
44
|
+
<PlaceholderLine
|
|
45
|
+
height={25}
|
|
46
|
+
width={20}
|
|
47
|
+
style={{ marginBottom: 10 }}
|
|
48
|
+
/>
|
|
49
|
+
</View>
|
|
50
|
+
<PlaceholderLine
|
|
51
|
+
height={20}
|
|
52
|
+
width={30}
|
|
53
|
+
style={{ marginBottom: 10 }}
|
|
54
|
+
/>
|
|
55
|
+
<PlaceholderLine
|
|
56
|
+
height={20}
|
|
57
|
+
width={80}
|
|
58
|
+
style={{ marginBottom: 10 }}
|
|
59
|
+
/>
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
</Placeholder>
|
|
63
|
+
))}
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
</ListWrapper>
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|