ordering-ui-react-native 0.21.22 → 0.21.23
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 +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +3 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +22 -5
- package/themes/original/src/components/Checkout/index.tsx +10 -0
- package/themes/original/src/components/OrderDetails/index.tsx +11 -2
package/package.json
CHANGED
|
@@ -45,7 +45,9 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
45
45
|
},
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const soundSrc = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
|
|
49
|
+
|
|
50
|
+
const notificationSound = new Sound(soundSrc, '', () => { });
|
|
49
51
|
|
|
50
52
|
let _timeout: any = null
|
|
51
53
|
let times = 0
|
|
@@ -45,6 +45,7 @@ import { ProfessionalFilter } from '../ProfessionalFilter';
|
|
|
45
45
|
import { ServiceForm } from '../ServiceForm';
|
|
46
46
|
import { BusinessesListing } from '../BusinessesListing/Layout/Original'
|
|
47
47
|
import { PageBanner } from '../PageBanner'
|
|
48
|
+
import { NavBack } from 'ordering-ui-react-native/src/components/OrderDetails/styles';
|
|
48
49
|
|
|
49
50
|
const PIXELS_TO_SCROLL = 2000
|
|
50
51
|
|
|
@@ -72,7 +73,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
72
73
|
handleUpdateProfessionals,
|
|
73
74
|
handleChangeProfessionalSelected,
|
|
74
75
|
onBusinessClick,
|
|
75
|
-
businessSingleId
|
|
76
|
+
businessSingleId,
|
|
77
|
+
productModal
|
|
76
78
|
} = props
|
|
77
79
|
|
|
78
80
|
const insets = useSafeAreaInsets()
|
|
@@ -143,8 +145,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
143
145
|
|
|
144
146
|
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
145
147
|
const isQuickAddProduct = configs?.add_product_with_one_click?.value === '1'
|
|
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) || []
|
|
146
149
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
147
150
|
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
151
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 165 : 100
|
|
148
152
|
const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
|
|
149
153
|
|
|
150
154
|
const onRedirect = (route: string, params?: any) => {
|
|
@@ -189,7 +193,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
189
193
|
onRedirect('ProductDetails', {
|
|
190
194
|
product: product,
|
|
191
195
|
businessSlug: business.slug,
|
|
192
|
-
businessId: business.id,
|
|
196
|
+
businessId: business.id || product?.category?.business_id,
|
|
193
197
|
productAddedToCartLength
|
|
194
198
|
})
|
|
195
199
|
}
|
|
@@ -386,6 +390,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
386
390
|
}
|
|
387
391
|
}, [])
|
|
388
392
|
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
if (!business && !loading && !error) {
|
|
395
|
+
showToast(ToastType.Error, t('BUSINESS_NOT_FOUND', 'Business not found'))
|
|
396
|
+
navigation.navigate('BusinessList')
|
|
397
|
+
}
|
|
398
|
+
}, [business, error, loading])
|
|
399
|
+
|
|
400
|
+
useEffect(() => {
|
|
401
|
+
if (productModal?.product && !productModal?.loading && !productModal?.error) {
|
|
402
|
+
onProductClick(props?.productModal?.product)
|
|
403
|
+
}
|
|
404
|
+
}, [productModal])
|
|
405
|
+
|
|
389
406
|
return (
|
|
390
407
|
<>
|
|
391
408
|
<View style={{ flex: 1, backgroundColor: backgroundColor }}>
|
|
@@ -473,8 +490,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
473
490
|
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
474
491
|
<FiltProductsContainer
|
|
475
492
|
style={{
|
|
476
|
-
height: Dimensions.get('window').height -
|
|
477
|
-
top: Platform.OS === 'ios' ? searchBarHeight + insets.top : searchBarHeight
|
|
493
|
+
height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 55 : 0),
|
|
494
|
+
top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight,
|
|
478
495
|
}}
|
|
479
496
|
contentContainerStyle={{ flexGrow: 1 }}
|
|
480
497
|
>
|
|
@@ -513,7 +530,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
513
530
|
</FiltProductsContainer>
|
|
514
531
|
)}
|
|
515
532
|
{isOpenFiltProducts && (
|
|
516
|
-
<BackgroundGray isIos={Platform.OS === 'ios'}
|
|
533
|
+
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
517
534
|
)}
|
|
518
535
|
<IOScrollView
|
|
519
536
|
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
|
|
@@ -377,6 +377,16 @@ const CheckoutUI = (props: any) => {
|
|
|
377
377
|
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
378
378
|
}, [])
|
|
379
379
|
|
|
380
|
+
useEffect(() => {
|
|
381
|
+
if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
|
|
382
|
+
const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
|
|
383
|
+
if (error) {
|
|
384
|
+
showToast(ToastType.Error, cartState?.error || cartState.cart)
|
|
385
|
+
navigation.navigate('BusinessList')
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}, [cartState?.error, cartState?.cart, cartState?.loading])
|
|
389
|
+
|
|
380
390
|
return (
|
|
381
391
|
<>
|
|
382
392
|
<Container noPadding>
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
OrderDetails as OrderDetailsConTableoller,
|
|
8
8
|
useUtils,
|
|
9
9
|
useOrder,
|
|
10
|
-
useConfig
|
|
10
|
+
useConfig,
|
|
11
|
+
useToast,
|
|
12
|
+
ToastType
|
|
11
13
|
} from 'ordering-components/native';
|
|
12
14
|
import { useTheme } from 'styled-components/native';
|
|
13
15
|
import { showLocation } from 'react-native-map-link';
|
|
@@ -65,7 +67,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
65
67
|
} = props;
|
|
66
68
|
|
|
67
69
|
const theme = useTheme();
|
|
68
|
-
|
|
70
|
+
const [, { showToast }] = useToast()
|
|
69
71
|
const styles = StyleSheet.create({
|
|
70
72
|
rowDirection: {
|
|
71
73
|
flexDirection: 'row',
|
|
@@ -336,6 +338,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
336
338
|
}
|
|
337
339
|
}, [driverLocation]);
|
|
338
340
|
|
|
341
|
+
useEffect(() => {
|
|
342
|
+
if (props?.order?.error && !props?.order?.loading) {
|
|
343
|
+
showToast(ToastType.Error, props?.order?.error)
|
|
344
|
+
navigation.navigate('BusinessList')
|
|
345
|
+
}
|
|
346
|
+
}, [props?.order?.error, props?.order?.loading])
|
|
347
|
+
|
|
339
348
|
return (
|
|
340
349
|
<OrderDetailsContainer
|
|
341
350
|
keyboardShouldPersistTaps="handled"
|