ordering-ui-react-native 0.16.51 → 0.16.52-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 +6 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +33 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +298 -345
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/index.tsx +2 -0
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/utils/index.tsx +2 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +259 -238
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +40 -32
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
- package/themes/business/src/components/LoginForm/index.tsx +111 -74
- package/themes/business/src/components/MapView/index.tsx +12 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +76 -77
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +332 -244
- package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
- package/themes/business/src/components/ScheduleBlocked/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/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OLink.tsx +24 -12
- package/themes/business/src/components/shared/OText.tsx +3 -2
- package/themes/business/src/types/index.tsx +25 -11
- package/themes/business/src/utils/index.tsx +10 -0
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
- package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
- 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/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +8 -0
- package/themes/original/src/components/AddressDetails/index.tsx +10 -8
- package/themes/original/src/components/AddressForm/index.tsx +157 -140
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessController/index.tsx +192 -91
- package/themes/original/src/components/BusinessController/styles.tsx +14 -9
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +85 -137
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +59 -61
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -83
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +19 -12
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -30
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +299 -148
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -11
- package/themes/original/src/components/BusinessesListing/index.tsx +80 -25
- package/themes/original/src/components/Cart/index.tsx +82 -15
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +27 -17
- package/themes/original/src/components/CartContent/styles.tsx +1 -1
- package/themes/original/src/components/Checkout/index.tsx +114 -118
- package/themes/original/src/components/Checkout/styles.tsx +4 -3
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/DriverTips/index.tsx +4 -4
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/FavoriteList/index.tsx +69 -45
- package/themes/original/src/components/FloatingButton/index.tsx +13 -11
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +20 -12
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
- package/themes/original/src/components/HelpGuide/index.tsx +9 -8
- package/themes/original/src/components/HelpOrder/index.tsx +9 -8
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +98 -41
- package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
- package/themes/original/src/components/Messages/index.tsx +35 -20
- package/themes/original/src/components/MomentOption/index.tsx +8 -6
- package/themes/original/src/components/MultiCart/index.tsx +63 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
- package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
- package/themes/original/src/components/MyOrders/index.tsx +88 -24
- package/themes/original/src/components/NavBar/index.tsx +11 -5
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +148 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/index.tsx +162 -50
- package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderProgress/index.tsx +77 -66
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -35
- package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +91 -53
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +365 -384
- package/themes/original/src/components/ProductForm/styles.tsx +7 -12
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
- package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
- package/themes/original/src/components/Promotions/index.tsx +232 -219
- package/themes/original/src/components/Promotions/styles.tsx +7 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
- package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -0
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +341 -267
- package/themes/original/src/components/SignupForm/index.tsx +134 -89
- package/themes/original/src/components/SingleOrderCard/index.tsx +219 -129
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +180 -104
- package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
- package/themes/original/src/components/UserDetails/index.tsx +5 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +176 -164
- package/themes/original/src/components/Wallets/styles.tsx +12 -8
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
- package/themes/original/src/components/shared/OButton.tsx +10 -3
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +79 -23
- package/themes/original/src/utils/index.tsx +103 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useOrder,
|
|
20
20
|
useConfig,
|
|
21
21
|
useUtils,
|
|
22
|
+
useOrderingTheme
|
|
22
23
|
} from 'ordering-components/native';
|
|
23
24
|
import { useTheme } from 'styled-components/native';
|
|
24
25
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
@@ -31,13 +32,14 @@ import {
|
|
|
31
32
|
HeaderWrapper,
|
|
32
33
|
ListWrapper,
|
|
33
34
|
FeaturedWrapper,
|
|
34
|
-
OrderProgressWrapper,
|
|
35
35
|
FarAwayMessage,
|
|
36
|
-
AddressInputContainer
|
|
36
|
+
AddressInputContainer,
|
|
37
|
+
PreorderInput,
|
|
38
|
+
OrderTypesContainer,
|
|
39
|
+
BusinessLogosContainer
|
|
37
40
|
} from './styles';
|
|
38
41
|
|
|
39
|
-
import {
|
|
40
|
-
import { OIcon, OText } from '../../../shared';
|
|
42
|
+
import { OIcon, OText, OModal } from '../../../shared';
|
|
41
43
|
import { BusinessesListingParams } from '../../../../types';
|
|
42
44
|
import { NotFoundSource } from '../../../NotFoundSource';
|
|
43
45
|
import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
|
|
@@ -46,9 +48,12 @@ import { OrderTypeSelector } from '../../../OrderTypeSelector';
|
|
|
46
48
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
47
49
|
import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
|
|
48
50
|
import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
|
|
49
|
-
import { getTypesText
|
|
51
|
+
import { getTypesText } from '../../../../utils';
|
|
50
52
|
import { OrderProgress } from '../../../OrderProgress';
|
|
51
53
|
import { useFocusEffect, useIsFocused } from '@react-navigation/native';
|
|
54
|
+
import FastImage from 'react-native-fast-image';
|
|
55
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
56
|
+
import { CitiesControl } from '../../../CitiesControl'
|
|
52
57
|
|
|
53
58
|
const PIXELS_TO_SCROLL = 2000;
|
|
54
59
|
|
|
@@ -56,21 +61,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
56
61
|
const {
|
|
57
62
|
navigation,
|
|
58
63
|
businessesList,
|
|
59
|
-
searchValue,
|
|
60
64
|
getBusinesses,
|
|
61
65
|
handleChangeBusinessType,
|
|
62
66
|
handleBusinessClick,
|
|
63
67
|
paginationProps,
|
|
64
|
-
handleChangeSearch,
|
|
65
68
|
businessId,
|
|
66
69
|
isGuestUser,
|
|
67
|
-
handleUpdateBusinessList
|
|
70
|
+
handleUpdateBusinessList,
|
|
71
|
+
citiesState,
|
|
72
|
+
actualSlug,
|
|
73
|
+
logosLayout
|
|
68
74
|
} = props;
|
|
69
75
|
const theme = useTheme();
|
|
76
|
+
const [orderingTheme] = useOrderingTheme()
|
|
70
77
|
const isFocused = useIsFocused();
|
|
71
78
|
const appState = useRef(AppState.currentState)
|
|
72
|
-
const
|
|
79
|
+
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
80
|
+
const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
|
|
73
81
|
const [refreshing] = useState(false);
|
|
82
|
+
const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
|
|
74
83
|
const styles = StyleSheet.create({
|
|
75
84
|
container: {
|
|
76
85
|
marginBottom: 0,
|
|
@@ -114,13 +123,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
114
123
|
backgroundColor: theme.colors.white,
|
|
115
124
|
borderColor: theme.colors.backgroundGray,
|
|
116
125
|
borderWidth: 1,
|
|
117
|
-
}
|
|
126
|
+
},
|
|
127
|
+
buttonCityStyle: {
|
|
128
|
+
backgroundColor: theme.colors.white,
|
|
129
|
+
borderColor: theme.colors.backgroundGray,
|
|
130
|
+
borderRadius: 8,
|
|
131
|
+
marginHorizontal: 40,
|
|
132
|
+
minHeight: 45,
|
|
133
|
+
paddingVertical: 5,
|
|
134
|
+
paddingHorizontal: 20,
|
|
135
|
+
borderWidth: 1,
|
|
136
|
+
justifyContent: 'center'
|
|
137
|
+
},
|
|
138
|
+
businessSkeleton: {
|
|
139
|
+
borderRadius: 8,
|
|
140
|
+
marginRight: 20,
|
|
141
|
+
width: 56,
|
|
142
|
+
height: 56
|
|
143
|
+
},
|
|
118
144
|
});
|
|
119
145
|
|
|
120
146
|
|
|
121
147
|
const [, t] = useLanguage();
|
|
122
148
|
const [{ user, auth }] = useSession();
|
|
123
|
-
const [orderState] = useOrder();
|
|
149
|
+
const [orderState, { changeCityFilter }] = useOrder();
|
|
124
150
|
const [{ configs }] = useConfig();
|
|
125
151
|
const [{ parseDate }] = useUtils();
|
|
126
152
|
|
|
@@ -130,21 +156,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
130
156
|
const [isFarAway, setIsFarAway] = useState(false)
|
|
131
157
|
const [businessTypes, setBusinessTypes] = useState(null)
|
|
132
158
|
const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
|
|
159
|
+
const [isOpenCities, setIsOpenCities] = useState(false)
|
|
133
160
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
134
161
|
Number(configs?.max_days_preorder?.value) > 0
|
|
135
162
|
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
136
163
|
const timerId = useRef<any>(false)
|
|
137
164
|
const [favoriteIds, setFavoriteIds] = useState<any>([])
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
// PanResponder.create({
|
|
141
|
-
// onMoveShouldSetPanResponder: (e, gestureState) => {
|
|
142
|
-
// const { dx, dy } = gestureState;
|
|
143
|
-
// resetInactivityTimeout()
|
|
144
|
-
// return (Math.abs(dx) > 20) || (Math.abs(dy) > 20);
|
|
145
|
-
// },
|
|
146
|
-
// })
|
|
147
|
-
// ).current
|
|
165
|
+
const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
|
|
166
|
+
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
148
167
|
|
|
149
168
|
const handleMomentClick = () => {
|
|
150
169
|
if (isPreorderEnabled) {
|
|
@@ -163,11 +182,16 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
163
182
|
const hasMore = !(
|
|
164
183
|
paginationProps.totalPages === paginationProps.currentPage
|
|
165
184
|
);
|
|
166
|
-
|
|
185
|
+
|
|
186
|
+
if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore && businessesList?.businesses?.length > 0) {
|
|
167
187
|
getBusinesses();
|
|
168
188
|
}
|
|
169
189
|
};
|
|
170
190
|
|
|
191
|
+
const convertToRadian = (value: number) => {
|
|
192
|
+
return value * Math.PI / 180
|
|
193
|
+
}
|
|
194
|
+
|
|
171
195
|
const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
|
|
172
196
|
const R = 6371 // km
|
|
173
197
|
const dLat = convertToRadian(lat2 - lat1)
|
|
@@ -180,10 +204,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
180
204
|
}
|
|
181
205
|
|
|
182
206
|
const resetInactivityTimeout = () => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
207
|
+
if (!logosLayout) {
|
|
208
|
+
clearTimeout(timerId.current)
|
|
209
|
+
timerId.current = setInterval(() => {
|
|
210
|
+
getBusinesses(true)
|
|
211
|
+
}, 120000)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const handleChangeCity = (cityId: number | null) => {
|
|
216
|
+
changeCityFilter(orderState?.options?.city_id === cityId ? null : cityId)
|
|
217
|
+
setIsOpenCities(false)
|
|
187
218
|
}
|
|
188
219
|
|
|
189
220
|
useEffect(() => {
|
|
@@ -224,7 +255,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
224
255
|
}
|
|
225
256
|
|
|
226
257
|
useEffect(() => {
|
|
227
|
-
|
|
258
|
+
if (!logosLayout) {
|
|
259
|
+
checkUserLocation()
|
|
260
|
+
}
|
|
228
261
|
}, [orderState?.options?.address?.location])
|
|
229
262
|
|
|
230
263
|
useEffect(() => {
|
|
@@ -251,8 +284,69 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
251
284
|
setFavoriteIds([...new Set(ids)])
|
|
252
285
|
}, [businessesList?.businesses?.length])
|
|
253
286
|
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
setIsOpenCities(false)
|
|
289
|
+
}, [orderState?.options?.city_id])
|
|
290
|
+
|
|
291
|
+
if (logosLayout) {
|
|
292
|
+
return (
|
|
293
|
+
<BusinessLogosContainer
|
|
294
|
+
horizontal
|
|
295
|
+
showsHorizontalScrollIndicator={false}
|
|
296
|
+
>
|
|
297
|
+
{businessesList?.loading ? (
|
|
298
|
+
<Placeholder Animation={Fade}>
|
|
299
|
+
<View style={{ flexDirection: 'row' }}>
|
|
300
|
+
{[...Array(10).keys()].map(i => (
|
|
301
|
+
<View style={styles.businessSkeleton} key={i}>
|
|
302
|
+
<PlaceholderLine style={{ width: '100%', height: '100%' }} />
|
|
303
|
+
</View>
|
|
304
|
+
))}
|
|
305
|
+
</View>
|
|
306
|
+
</Placeholder>
|
|
307
|
+
) : (
|
|
308
|
+
<>
|
|
309
|
+
{businessesList.businesses
|
|
310
|
+
?.filter(business => business?.open)
|
|
311
|
+
?.map(business => (
|
|
312
|
+
<TouchableOpacity
|
|
313
|
+
key={business?.id}
|
|
314
|
+
onPress={() => handleBusinessClick && handleBusinessClick(business)}
|
|
315
|
+
style={{
|
|
316
|
+
width: 60,
|
|
317
|
+
height: 60,
|
|
318
|
+
borderRadius: 8,
|
|
319
|
+
marginRight: 5
|
|
320
|
+
}}
|
|
321
|
+
>
|
|
322
|
+
<FastImage
|
|
323
|
+
style={{
|
|
324
|
+
width: 56,
|
|
325
|
+
height: 56,
|
|
326
|
+
marginRight: 20,
|
|
327
|
+
borderRadius: 8,
|
|
328
|
+
borderColor: theme.colors.primary,
|
|
329
|
+
borderWidth: business?.slug === actualSlug ? 2 : 0
|
|
330
|
+
}}
|
|
331
|
+
source={{
|
|
332
|
+
uri: business?.logo,
|
|
333
|
+
priority: FastImage.priority.normal,
|
|
334
|
+
}}
|
|
335
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
336
|
+
/>
|
|
337
|
+
</TouchableOpacity>
|
|
338
|
+
))}
|
|
339
|
+
</>
|
|
340
|
+
)}
|
|
341
|
+
</BusinessLogosContainer>
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
|
|
254
345
|
return (
|
|
255
|
-
<
|
|
346
|
+
<IOScrollView
|
|
347
|
+
style={styles.container}
|
|
348
|
+
onScroll={(e) => handleScroll(e)}
|
|
349
|
+
showsVerticalScrollIndicator={false}
|
|
256
350
|
refreshControl={
|
|
257
351
|
<RefreshControl
|
|
258
352
|
refreshing={refreshing}
|
|
@@ -260,9 +354,29 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
260
354
|
/>
|
|
261
355
|
}
|
|
262
356
|
>
|
|
263
|
-
|
|
264
|
-
<
|
|
357
|
+
{enabledPoweredByOrdering && auth && (
|
|
358
|
+
<View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
|
|
359
|
+
<OText>
|
|
360
|
+
Powered By Ordering.co
|
|
361
|
+
</OText>
|
|
362
|
+
</View>
|
|
363
|
+
)}
|
|
364
|
+
<View style={{
|
|
365
|
+
height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
|
|
366
|
+
marginTop: Platform.OS == 'ios' ? 0 : 50,
|
|
367
|
+
backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
|
|
368
|
+
}}
|
|
369
|
+
>
|
|
370
|
+
{isChewLayout && (
|
|
371
|
+
<View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
372
|
+
<OText size={24} weight={700} color={theme.colors?.white}>
|
|
373
|
+
{t('WELCOME', 'Welcome')} {user?.name}
|
|
374
|
+
</OText>
|
|
375
|
+
</View>
|
|
376
|
+
)}
|
|
377
|
+
<Search isChewLayout={isChewLayout}>
|
|
265
378
|
<AddressInput
|
|
379
|
+
isChewLayout={isChewLayout}
|
|
266
380
|
onPress={() =>
|
|
267
381
|
auth
|
|
268
382
|
? navigation.navigate('AddressList', { isFromBusinesses: true })
|
|
@@ -272,104 +386,125 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
272
386
|
isGuestUser: isGuestUser
|
|
273
387
|
})
|
|
274
388
|
}>
|
|
275
|
-
<AddressInputContainer>
|
|
389
|
+
<AddressInputContainer isChewLayout={isChewLayout}>
|
|
276
390
|
<OIcon
|
|
277
391
|
src={theme.images.general.pin}
|
|
278
392
|
color={theme.colors.disabled}
|
|
279
393
|
width={16}
|
|
280
|
-
style={{ marginRight: 10 }}
|
|
394
|
+
style={{ marginRight: isChewLayout ? 0 : 10 }}
|
|
281
395
|
/>
|
|
282
|
-
<OText size={12} numberOfLines={1}>
|
|
396
|
+
<OText size={12} numberOfLines={1} style={{ flex: 1 }}>
|
|
283
397
|
{orderState?.options?.address?.address}
|
|
284
398
|
</OText>
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
399
|
+
{!isChewLayout && (
|
|
400
|
+
<OIcon
|
|
401
|
+
src={theme.images.general.arrow_down}
|
|
402
|
+
width={10}
|
|
403
|
+
style={{ marginStart: 8 }}
|
|
404
|
+
/>
|
|
405
|
+
)}
|
|
290
406
|
</AddressInputContainer>
|
|
291
407
|
</AddressInput>
|
|
292
408
|
</Search>
|
|
293
|
-
{isFarAway && (
|
|
409
|
+
{isFarAway && !isChewLayout && (
|
|
294
410
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
295
411
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
296
412
|
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
297
413
|
</FarAwayMessage>
|
|
298
414
|
)}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
415
|
+
{!isChewLayout ? (
|
|
416
|
+
<OrderControlContainer>
|
|
417
|
+
<View style={styles.wrapperOrderOptions}>
|
|
418
|
+
{isPreOrderSetting && (
|
|
419
|
+
<WrapMomentOption
|
|
420
|
+
onPress={() => handleMomentClick()}>
|
|
421
|
+
<OText
|
|
422
|
+
size={12}
|
|
423
|
+
numberOfLines={1}
|
|
424
|
+
ellipsizeMode="tail"
|
|
425
|
+
color={theme.colors.textSecondary}>
|
|
426
|
+
{orderState.options?.moment
|
|
427
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
428
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
429
|
+
</OText>
|
|
430
|
+
{isPreorderEnabled && (
|
|
431
|
+
<OIcon
|
|
432
|
+
src={theme.images.general.arrow_down}
|
|
433
|
+
width={10}
|
|
434
|
+
style={{ marginStart: 8 }}
|
|
435
|
+
/>
|
|
436
|
+
)}
|
|
437
|
+
</WrapMomentOption>
|
|
438
|
+
)}
|
|
439
|
+
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
|
|
440
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
441
|
+
<OIcon
|
|
442
|
+
src={theme.images.general.arrow_down}
|
|
443
|
+
width={10}
|
|
444
|
+
style={{ marginStart: 8 }}
|
|
445
|
+
/>
|
|
321
446
|
</WrapMomentOption>
|
|
447
|
+
</View>
|
|
448
|
+
</OrderControlContainer>
|
|
449
|
+
) : (
|
|
450
|
+
<>
|
|
451
|
+
{isPreOrderSetting && (
|
|
452
|
+
<View style={{ paddingHorizontal: 30 }}>
|
|
453
|
+
<PreorderInput
|
|
454
|
+
isChewLayout={isChewLayout}
|
|
455
|
+
onPress={() => handleMomentClick()}
|
|
456
|
+
>
|
|
457
|
+
<OText color={theme.colors.textSecondary}>
|
|
458
|
+
{orderState.options?.moment
|
|
459
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
460
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}</OText>
|
|
461
|
+
</PreorderInput>
|
|
462
|
+
</View>
|
|
322
463
|
)}
|
|
323
|
-
|
|
324
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
325
|
-
<OIcon
|
|
326
|
-
src={theme.images.general.arrow_down}
|
|
327
|
-
width={10}
|
|
328
|
-
style={{ marginStart: 8 }}
|
|
329
|
-
/>
|
|
330
|
-
</WrapMomentOption>
|
|
331
|
-
</View>
|
|
332
|
-
</OrderControlContainer>
|
|
333
|
-
</View>
|
|
334
|
-
<HeaderWrapper
|
|
335
|
-
source={theme.images.backgrounds.business_list_header}
|
|
336
|
-
style={{ paddingTop: top + 20 }}
|
|
337
|
-
resizeMode='stretch'
|
|
338
|
-
>
|
|
339
|
-
{!auth && (
|
|
340
|
-
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
341
|
-
<OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
|
|
342
|
-
</TouchableOpacity>
|
|
464
|
+
</>
|
|
343
465
|
)}
|
|
344
|
-
</
|
|
345
|
-
{!
|
|
346
|
-
<
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
466
|
+
</View>
|
|
467
|
+
{!isChewLayout ? (
|
|
468
|
+
<HeaderWrapper
|
|
469
|
+
source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
|
|
470
|
+
style={{ paddingTop: top + 20 }}
|
|
471
|
+
resizeMode='cover'
|
|
472
|
+
>
|
|
473
|
+
{!auth && (
|
|
474
|
+
|
|
475
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
476
|
+
<IconAntDesign name='arrowleft' size={26} />
|
|
477
|
+
</TouchableOpacity>
|
|
478
|
+
)}
|
|
479
|
+
</HeaderWrapper>
|
|
480
|
+
) : (
|
|
481
|
+
<OrderTypesContainer>
|
|
482
|
+
<OrderTypeSelector
|
|
483
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
484
|
+
isChewLayout
|
|
485
|
+
chewOrderTypes={chewOrderTypes}
|
|
486
|
+
handleChangeType={setOrderTypeValue}
|
|
487
|
+
/>
|
|
488
|
+
</OrderTypesContainer>
|
|
365
489
|
)}
|
|
366
|
-
<OrderProgressWrapper>
|
|
367
|
-
<OrderProgress
|
|
368
|
-
{...props}
|
|
369
|
-
isFocused={isFocused}
|
|
370
|
-
/>
|
|
371
|
-
</OrderProgressWrapper>
|
|
372
490
|
|
|
491
|
+
{!hideCities && orderTypeValue === 2 && (
|
|
492
|
+
<View style={{ marginTop: 20 }}>
|
|
493
|
+
<TouchableOpacity
|
|
494
|
+
style={styles.buttonCityStyle}
|
|
495
|
+
onPress={() => setIsOpenCities(true)}
|
|
496
|
+
disabled={orderState?.loading}
|
|
497
|
+
>
|
|
498
|
+
<OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
|
|
499
|
+
{citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
|
|
500
|
+
</OText>
|
|
501
|
+
</TouchableOpacity>
|
|
502
|
+
</View>
|
|
503
|
+
)}
|
|
504
|
+
<OrderProgress
|
|
505
|
+
{...props}
|
|
506
|
+
isFocused={isFocused}
|
|
507
|
+
/>
|
|
373
508
|
{
|
|
374
509
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
375
510
|
<FeaturedWrapper>
|
|
@@ -377,7 +512,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
377
512
|
<ScrollView
|
|
378
513
|
showsHorizontalScrollIndicator={false}
|
|
379
514
|
nestedScrollEnabled
|
|
380
|
-
horizontal
|
|
515
|
+
horizontal
|
|
516
|
+
contentContainerStyle={{ paddingHorizontal: 40 }}
|
|
517
|
+
>
|
|
381
518
|
{featuredBusiness.map((bAry: any, idx) => (
|
|
382
519
|
<View key={'f-listing_' + idx}>
|
|
383
520
|
<BusinessFeaturedController
|
|
@@ -400,19 +537,23 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
400
537
|
</FeaturedWrapper>
|
|
401
538
|
)
|
|
402
539
|
}
|
|
540
|
+
{!isChewLayout && (
|
|
541
|
+
<>
|
|
542
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
543
|
+
{
|
|
544
|
+
!businessId && !props.franchiseId && (
|
|
545
|
+
<HighestRatedBusinesses
|
|
546
|
+
onBusinessClick={handleBusinessClick}
|
|
547
|
+
navigation={navigation}
|
|
548
|
+
favoriteIds={favoriteIds}
|
|
549
|
+
setFavoriteIds={setFavoriteIds}
|
|
550
|
+
/>
|
|
551
|
+
)
|
|
552
|
+
}
|
|
553
|
+
</>
|
|
554
|
+
)}
|
|
403
555
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
404
|
-
{
|
|
405
|
-
!businessId && !props.franchiseId && (
|
|
406
|
-
<HighestRatedBusinesses
|
|
407
|
-
onBusinessClick={handleBusinessClick}
|
|
408
|
-
navigation={navigation}
|
|
409
|
-
favoriteIds={favoriteIds}
|
|
410
|
-
setFavoriteIds={setFavoriteIds}
|
|
411
|
-
/>
|
|
412
|
-
)
|
|
413
|
-
}
|
|
414
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
415
|
-
<ListWrapper>
|
|
556
|
+
<ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
416
557
|
{!businessId && (
|
|
417
558
|
<BusinessTypeFilter
|
|
418
559
|
images={props.images}
|
|
@@ -430,32 +571,31 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
430
571
|
)}
|
|
431
572
|
/>
|
|
432
573
|
)}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
</IOScrollView>
|
|
574
|
+
{businessesList.businesses?.map(
|
|
575
|
+
(business: any, i: number) => (
|
|
576
|
+
<BusinessController
|
|
577
|
+
key={`${business.id}_` + i}
|
|
578
|
+
enableIntersection
|
|
579
|
+
isCustomLayout={isChewLayout}
|
|
580
|
+
business={business}
|
|
581
|
+
isBusinessOpen={business.open}
|
|
582
|
+
handleCustomClick={handleBusinessClick}
|
|
583
|
+
orderType={orderState?.options?.type}
|
|
584
|
+
navigation={navigation}
|
|
585
|
+
businessHeader={business?.header}
|
|
586
|
+
businessFeatured={business?.featured}
|
|
587
|
+
businessLogo={business?.logo}
|
|
588
|
+
businessReviews={business?.reviews}
|
|
589
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
590
|
+
businessDeliveryTime={business?.delivery_time}
|
|
591
|
+
businessPickupTime={business?.pickup_time}
|
|
592
|
+
businessDistance={business?.distance}
|
|
593
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
594
|
+
favoriteIds={favoriteIds}
|
|
595
|
+
setFavoriteIds={setFavoriteIds}
|
|
596
|
+
/>
|
|
597
|
+
)
|
|
598
|
+
)}
|
|
459
599
|
{businessesList.loading && (
|
|
460
600
|
<>
|
|
461
601
|
{[
|
|
@@ -508,7 +648,18 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
508
648
|
</>
|
|
509
649
|
)}
|
|
510
650
|
</ListWrapper>
|
|
511
|
-
|
|
651
|
+
<OModal
|
|
652
|
+
open={isOpenCities}
|
|
653
|
+
onClose={() => setIsOpenCities(false)}
|
|
654
|
+
title={t('SELECT_A_CITY', 'Select a city')}
|
|
655
|
+
>
|
|
656
|
+
<CitiesControl
|
|
657
|
+
cities={citiesState?.cities}
|
|
658
|
+
onClose={() => setIsOpenCities(false)}
|
|
659
|
+
handleChangeCity={handleChangeCity}
|
|
660
|
+
/>
|
|
661
|
+
</OModal>
|
|
662
|
+
</IOScrollView>
|
|
512
663
|
);
|
|
513
664
|
};
|
|
514
665
|
|