ordering-ui-react-native 0.21.55 → 0.21.56-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -9
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +2 -1
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +30 -15
- package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
- package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +43 -24
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +35 -21
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersOption/index.tsx +229 -112
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +29 -19
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +4 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +22 -5
- package/themes/business/src/utils/index.tsx +5 -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/Checkout/index.tsx +6 -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/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +6 -2
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +18 -10
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +316 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +94 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +48 -359
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -16
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +29 -14
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +26 -9
- package/themes/original/src/components/CartContent/index.tsx +60 -45
- package/themes/original/src/components/Checkout/index.tsx +106 -64
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DatePicker/index.tsx +18 -2
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +9 -11
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/Home/index.tsx +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -19
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +124 -63
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- package/themes/original/src/components/NetworkError/index.tsx +2 -8
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/Notifications/index.tsx +2 -4
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +5 -7
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +47 -6
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +16 -19
- package/themes/original/src/components/ProductForm/index.tsx +123 -112
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +65 -67
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +12 -36
- package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +88 -91
- package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +7 -4
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +8 -7
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/layouts/Container.tsx +4 -2
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -214,11 +214,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
214
214
|
text={t('VIEW_MORE', 'View more')}
|
|
215
215
|
parentStyle={{ padding: 0 }}
|
|
216
216
|
onClick={() => setOpenDescription(category)}
|
|
217
|
-
bgColor=
|
|
217
|
+
bgColor={theme.colors.white}
|
|
218
|
+
borderColor={theme.colors.primary}
|
|
218
219
|
textStyle={{
|
|
219
220
|
fontSize: 12,
|
|
220
221
|
borderBottomWidth: 1,
|
|
221
|
-
borderBottomColor: theme.colors.primary,
|
|
222
222
|
color: theme.colors.primary
|
|
223
223
|
}}
|
|
224
224
|
/>
|
|
@@ -237,7 +237,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
237
237
|
{products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
|
|
238
238
|
<SingleProductCard
|
|
239
239
|
key={`${product?.id}_${i}`}
|
|
240
|
-
enableIntersection={!isFiltMode}
|
|
240
|
+
// enableIntersection={!isFiltMode}
|
|
241
241
|
isSoldOut={product.inventoried && !product.quantity}
|
|
242
242
|
businessId={businessId}
|
|
243
243
|
product={product}
|
|
@@ -18,15 +18,12 @@ 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
|
`}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler } from 'react-native'
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler, ScrollView, Vibration } 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';
|
|
@@ -148,7 +148,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
148
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) || []
|
|
149
149
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
150
150
|
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
151
|
-
const filtProductsHeight = Platform.OS === 'ios' ?
|
|
151
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 65 : 30
|
|
152
152
|
const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
|
|
153
153
|
|
|
154
154
|
const onRedirect = (route: string, params?: any) => {
|
|
@@ -190,13 +190,17 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
190
190
|
setOpenService(true)
|
|
191
191
|
return
|
|
192
192
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
193
|
+
if (product?.enabled) {
|
|
194
|
+
onRedirect('ProductDetails', {
|
|
195
|
+
product: product,
|
|
196
|
+
businessSlug: business.slug,
|
|
197
|
+
businessId: business.id || product?.category?.business_id,
|
|
198
|
+
productAddedToCartLength,
|
|
199
|
+
isRedirect: false
|
|
200
|
+
})
|
|
201
|
+
} else {
|
|
202
|
+
showToast(ToastType.Error, t('PRODUCT_NOT_FOUND', 'Product not found'))
|
|
203
|
+
}
|
|
200
204
|
}
|
|
201
205
|
events.emit('product_clicked', product)
|
|
202
206
|
}
|
|
@@ -377,6 +381,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
377
381
|
setViewedCategory(_viewedCategory)
|
|
378
382
|
events.emit('product_list_viewed', _viewedCategory)
|
|
379
383
|
}
|
|
384
|
+
} else {
|
|
385
|
+
if (business.categories) {
|
|
386
|
+
const categoryAll: any = {}
|
|
387
|
+
categoryAll.business_id = business.id
|
|
388
|
+
categoryAll.id = null
|
|
389
|
+
categoryAll.name = 'All'
|
|
390
|
+
events.emit('product_list_viewed', categoryAll)
|
|
391
|
+
}
|
|
380
392
|
}
|
|
381
393
|
}, [business?.lazy_load_products_recommended, selectedCategoryId, categorySelected?.id, viewedCategory])
|
|
382
394
|
|
|
@@ -491,8 +503,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
491
503
|
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
492
504
|
<FiltProductsContainer
|
|
493
505
|
style={{
|
|
494
|
-
height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ?
|
|
495
|
-
top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight,
|
|
506
|
+
height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 10 : 0),
|
|
507
|
+
top: Platform.OS === 'ios' ? viewOrderButtonVisible ? (searchBarHeight - 10) + insets.top + 10 : (searchBarHeight - 10) + insets.top : searchBarHeight,
|
|
496
508
|
}}
|
|
497
509
|
contentContainerStyle={{ flexGrow: 1 }}
|
|
498
510
|
>
|
|
@@ -530,7 +542,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
530
542
|
</View>
|
|
531
543
|
</FiltProductsContainer>
|
|
532
544
|
)}
|
|
533
|
-
<
|
|
545
|
+
<ScrollView
|
|
534
546
|
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
|
|
535
547
|
style={{
|
|
536
548
|
...styles.mainContainer,
|
|
@@ -658,7 +670,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
658
670
|
{isOpenFiltProducts && (
|
|
659
671
|
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
660
672
|
)}
|
|
661
|
-
</
|
|
673
|
+
</ScrollView>
|
|
662
674
|
{viewOrderButtonVisible && (
|
|
663
675
|
<View style={{ marginBottom: 0 }}>
|
|
664
676
|
<FloatingButton
|
|
@@ -675,7 +687,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
675
687
|
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
676
688
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
677
689
|
disabled={subtotalWithTaxes < currentCart?.minimum || openUpselling}
|
|
678
|
-
handleClick={() =>
|
|
690
|
+
handleClick={() => {
|
|
691
|
+
Vibration.vibrate(100)
|
|
692
|
+
setOpenUpselling(true)
|
|
693
|
+
}}
|
|
679
694
|
/>
|
|
680
695
|
</View>
|
|
681
696
|
)}
|
|
@@ -26,9 +26,9 @@ import { BusinessTypeFilterParams } from '../../types';
|
|
|
26
26
|
const windowWidth = Dimensions.get('window').width;
|
|
27
27
|
|
|
28
28
|
export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
29
|
-
const {
|
|
30
|
-
typesState,
|
|
31
|
-
currentTypeSelected,
|
|
29
|
+
const {
|
|
30
|
+
typesState,
|
|
31
|
+
currentTypeSelected,
|
|
32
32
|
handleChangeBusinessType,
|
|
33
33
|
setBusinessTypes,
|
|
34
34
|
isAppoint
|
|
@@ -38,13 +38,13 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
38
38
|
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
|
|
41
|
-
const defaultImage = (name
|
|
41
|
+
const defaultImage = (name: string) => theme.images?.categories?.[name.toLowerCase().replace(' ', '')]
|
|
42
42
|
|
|
43
43
|
useEffect(() => {
|
|
44
|
-
if(typesState?.types?.length > 0){
|
|
45
|
-
|
|
44
|
+
if (typesState?.types?.length > 0) {
|
|
45
|
+
setBusinessTypes && setBusinessTypes(typesState?.types)
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
}, [typesState])
|
|
48
48
|
|
|
49
49
|
const handleChangeServiceType = (serviceId: any) => {
|
|
50
50
|
if (serviceId === currentTypeSelected) {
|
|
@@ -119,10 +119,11 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
119
119
|
<OButton
|
|
120
120
|
key={i}
|
|
121
121
|
bgColor={(currentTypeSelected === businessType?.id) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
122
|
+
borderColor={(currentTypeSelected === businessType?.id) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
122
123
|
onClick={() => handleChangeServiceType(businessType?.id)}
|
|
123
124
|
text={`${businessType?.name} ${(currentTypeSelected === businessType?.id) ? ' X' : ''}`}
|
|
124
125
|
style={styles.businessType}
|
|
125
|
-
textStyle={{ fontSize: 10, color: (currentTypeSelected === businessType?.id) ? theme.colors.
|
|
126
|
+
textStyle={{ fontSize: 10, color: (currentTypeSelected === businessType?.id) ? theme.colors.white : theme.colors.textNormal }}
|
|
126
127
|
/>
|
|
127
128
|
))}
|
|
128
129
|
</ServiceWrapper>
|
|
@@ -392,10 +392,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
392
392
|
<OButton
|
|
393
393
|
key={i}
|
|
394
394
|
bgColor={(priceLevelSelected === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
395
|
+
borderColor={(priceLevelSelected === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
395
396
|
onClick={() => handleChangePriceLevel(price?.level)}
|
|
396
397
|
text={`${price.content} ${(priceLevelSelected === price?.level) ? ' X' : ''}`}
|
|
397
398
|
style={styles.priceLevel}
|
|
398
|
-
textStyle={{ fontSize: 10, color: (priceLevelSelected === price?.level) ? theme.colors.backgroundLight : theme.colors.
|
|
399
|
+
textStyle={{ fontSize: 10, color: (priceLevelSelected === price?.level) ? theme.colors.backgroundLight : theme.colors.black }}
|
|
399
400
|
/>
|
|
400
401
|
))}
|
|
401
402
|
</ScrollView>
|
|
@@ -168,7 +168,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
168
168
|
setFeaturedBusinesses(ary);
|
|
169
169
|
}
|
|
170
170
|
resetInactivityTimeout()
|
|
171
|
-
}, [businessesList.loading])
|
|
171
|
+
}, [businessesList.loading, businessesList?.businesses])
|
|
172
172
|
|
|
173
173
|
const handleOnRefresh = () => {
|
|
174
174
|
if (!businessesList.loading) {
|
|
@@ -19,7 +19,7 @@ import { CouponControl } from '../CouponControl';
|
|
|
19
19
|
import { OButton, OInput, OModal, OText } from '../shared';
|
|
20
20
|
import { UpsellingProducts } from '../UpsellingProducts';
|
|
21
21
|
import { verifyDecimals } from '../../utils';
|
|
22
|
-
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
22
|
+
import { ActivityIndicator, TouchableOpacity, View, Vibration } from 'react-native';
|
|
23
23
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
@@ -114,6 +114,7 @@ const CartUI = (props: any) => {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
const handleUpsellingPage = (individualCart: any) => {
|
|
117
|
+
Vibration.vibrate(100)
|
|
117
118
|
const isProductCartParam = !!individualCart?.products?.length
|
|
118
119
|
setOpenUpselling(false)
|
|
119
120
|
setCanOpenUpselling(false)
|
|
@@ -121,7 +122,7 @@ const CartUI = (props: any) => {
|
|
|
121
122
|
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
122
123
|
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
123
124
|
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
|
|
124
|
-
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
125
|
+
if (cartsAvailable.length === 1 || !isMultiCheckout || !cart?.business_id) {
|
|
125
126
|
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
126
127
|
onNavigationRedirect('CheckoutNavigator', {
|
|
127
128
|
screen: 'CheckoutPage',
|
|
@@ -196,6 +197,19 @@ const CartUI = (props: any) => {
|
|
|
196
197
|
return acc = acc
|
|
197
198
|
}, cart?.subtotal)
|
|
198
199
|
|
|
200
|
+
const handleClickCheckout = () => {
|
|
201
|
+
Vibration.vibrate(100)
|
|
202
|
+
if (cart?.business_id) {
|
|
203
|
+
setOpenUpselling(true)
|
|
204
|
+
} else {
|
|
205
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
206
|
+
screen: 'CheckoutPage',
|
|
207
|
+
cartUuid: cart?.uuid,
|
|
208
|
+
cartTotal: cart?.total
|
|
209
|
+
}, true)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
199
213
|
useEffect(() => {
|
|
200
214
|
const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
|
|
201
215
|
const currentDate = new Date()
|
|
@@ -211,7 +225,7 @@ const CartUI = (props: any) => {
|
|
|
211
225
|
|
|
212
226
|
return (
|
|
213
227
|
<CContainer>
|
|
214
|
-
{openUpselling && (
|
|
228
|
+
{!!openUpselling && (
|
|
215
229
|
<UpsellingProducts
|
|
216
230
|
handleUpsellingPage={handleUpsellingPage}
|
|
217
231
|
openUpselling={openUpselling}
|
|
@@ -231,8 +245,11 @@ const CartUI = (props: any) => {
|
|
|
231
245
|
handleClearProducts={handleClearProducts}
|
|
232
246
|
handleCartOpen={handleCartOpen}
|
|
233
247
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
234
|
-
handleChangeStore={() =>
|
|
235
|
-
|
|
248
|
+
handleChangeStore={() => {
|
|
249
|
+
Vibration.vibrate(100)
|
|
250
|
+
setOpenChangeStore(true)
|
|
251
|
+
}}
|
|
252
|
+
handleClickCheckout={() => handleClickCheckout()}
|
|
236
253
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
237
254
|
isMultiCheckout={isMultiCheckout}
|
|
238
255
|
isFromUpselling={isFromUpselling}
|
|
@@ -532,7 +549,7 @@ const CartUI = (props: any) => {
|
|
|
532
549
|
/>
|
|
533
550
|
</View>
|
|
534
551
|
)}
|
|
535
|
-
{!isMultiCheckout && (
|
|
552
|
+
{(!isMultiCheckout || !cart?.business_id) && (
|
|
536
553
|
<>
|
|
537
554
|
{cart?.valid_products ? (
|
|
538
555
|
<CheckoutAction>
|
|
@@ -545,11 +562,11 @@ const CartUI = (props: any) => {
|
|
|
545
562
|
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
546
563
|
)}
|
|
547
564
|
bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
565
|
+
borderColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
548
566
|
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
549
|
-
borderColor={theme.colors.primary}
|
|
550
567
|
imgRightSrc={null}
|
|
551
|
-
textStyle={{
|
|
552
|
-
onClick={() =>
|
|
568
|
+
textStyle={{ textAlign: 'center', flex: 1 }}
|
|
569
|
+
onClick={() => handleClickCheckout()}
|
|
553
570
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
554
571
|
/>
|
|
555
572
|
</CheckoutAction>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { Vibration, View } from 'react-native';
|
|
3
3
|
import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
@@ -13,7 +13,8 @@ export const CartContent = (props: any) => {
|
|
|
13
13
|
const {
|
|
14
14
|
onNavigationRedirect,
|
|
15
15
|
singleBusiness,
|
|
16
|
-
businessSlug
|
|
16
|
+
businessSlug,
|
|
17
|
+
navigation
|
|
17
18
|
} = props
|
|
18
19
|
|
|
19
20
|
const theme = useTheme();
|
|
@@ -22,7 +23,7 @@ export const CartContent = (props: any) => {
|
|
|
22
23
|
const [{ parsePrice }] = useUtils();
|
|
23
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
24
25
|
const [cartsOpened, setCartsOpened] = useState([])
|
|
25
|
-
const [{ carts: cartsContext }] = useOrder();
|
|
26
|
+
const [{ carts: cartsContext }, { confirmCart }] = useOrder();
|
|
26
27
|
const cartsList =
|
|
27
28
|
(cartsContext &&
|
|
28
29
|
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
@@ -32,12 +33,13 @@ export const CartContent = (props: any) => {
|
|
|
32
33
|
: cartsList
|
|
33
34
|
const isOrderStateCarts = !!carts
|
|
34
35
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
35
|
-
const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
36
|
+
const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2 && cart?.business_id)
|
|
36
37
|
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
37
38
|
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
38
39
|
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
39
40
|
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
40
41
|
const handleCheckoutRedirect = () => {
|
|
42
|
+
Vibration.vibrate(100)
|
|
41
43
|
if (cartsAvailable.length === 1) {
|
|
42
44
|
onNavigationRedirect('CheckoutNavigator', {
|
|
43
45
|
screen: 'CheckoutPage',
|
|
@@ -71,7 +73,7 @@ export const CartContent = (props: any) => {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
const changeActiveState = useCallback((isClosed
|
|
76
|
+
const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
|
|
75
77
|
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
76
78
|
if (isActive || !isClosed) {
|
|
77
79
|
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
@@ -83,6 +85,20 @@ export const CartContent = (props: any) => {
|
|
|
83
85
|
}
|
|
84
86
|
}, [cartsOpened])
|
|
85
87
|
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const unsuscribe = navigation.addListener('focus', () => {
|
|
90
|
+
const cartsListBlockedByPaypal = carts?.filter((cart: any) => cart?.status === 2 && cart?.paymethod_data?.gateway === 'paypal')
|
|
91
|
+
if (cartsListBlockedByPaypal?.length > 0) {
|
|
92
|
+
cartsListBlockedByPaypal.map(async (cart: any) => {
|
|
93
|
+
await confirmCart(cart?.uuid)
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
return () => {
|
|
98
|
+
return unsuscribe()
|
|
99
|
+
}
|
|
100
|
+
}, [carts, navigation])
|
|
101
|
+
|
|
86
102
|
return (
|
|
87
103
|
<CCContainer
|
|
88
104
|
style={{ paddingHorizontal: 20 }}
|
|
@@ -120,53 +136,52 @@ export const CartContent = (props: any) => {
|
|
|
120
136
|
{isMultiCheckout && (
|
|
121
137
|
<>
|
|
122
138
|
{!!cartsAvailable.length && (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
127
|
-
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
128
|
-
</OText>
|
|
129
|
-
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
130
|
-
{parsePrice(totalCartsFee)}
|
|
131
|
-
</OText>
|
|
132
|
-
</View>
|
|
133
|
-
)}
|
|
134
|
-
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
135
|
-
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
139
|
+
<>
|
|
140
|
+
<ChCartsTotal>
|
|
141
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
136
142
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
137
143
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
138
|
-
{t('
|
|
144
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
139
145
|
</OText>
|
|
140
146
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
141
|
-
{parsePrice(
|
|
147
|
+
{parsePrice(totalCartsFee)}
|
|
142
148
|
</OText>
|
|
143
149
|
</View>
|
|
144
150
|
)}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
152
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
153
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
154
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
155
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
156
|
+
</OText>
|
|
157
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
158
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
159
|
+
</OText>
|
|
160
|
+
</View>
|
|
161
|
+
)}
|
|
162
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
163
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
164
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
165
|
+
</OText>
|
|
166
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
167
|
+
</View>
|
|
168
|
+
<View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
|
|
169
|
+
<OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
|
|
170
|
+
{t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
|
|
171
|
+
</OText>
|
|
172
|
+
</View>
|
|
173
|
+
</ChCartsTotal>
|
|
174
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
175
|
+
<OButton
|
|
176
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
177
|
+
isDisabled={!cartsAvailable.length}
|
|
178
|
+
imgRightSrc={null}
|
|
179
|
+
onClick={() => handleCheckoutRedirect()}
|
|
180
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
181
|
+
/>
|
|
182
|
+
</CheckoutAction>
|
|
183
|
+
</>
|
|
157
184
|
)}
|
|
158
|
-
<CheckoutAction style={{ marginTop: 0 }}>
|
|
159
|
-
<OButton
|
|
160
|
-
text={t('CHECKOUT', 'Checkout')}
|
|
161
|
-
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
162
|
-
isDisabled={!cartsAvailable.length}
|
|
163
|
-
borderColor={theme.colors.primary}
|
|
164
|
-
imgRightSrc={null}
|
|
165
|
-
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
166
|
-
onClick={() => handleCheckoutRedirect()}
|
|
167
|
-
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
168
|
-
/>
|
|
169
|
-
</CheckoutAction>
|
|
170
185
|
</>
|
|
171
186
|
)}
|
|
172
187
|
</>
|