ordering-ui-react-native 0.15.43 → 0.15.45-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 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessTypeFilter/index.tsx +3 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +9 -23
- package/src/components/PaymentOptions/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +3 -1
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeMethodForm/index.tsx +1 -2
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +5 -2
- package/src/utils/index.tsx +68 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +42 -90
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -18
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +159 -91
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +5 -2
- package/themes/business/src/components/PreviousOrders/index.tsx +10 -9
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +5 -1
- 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/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +99 -26
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +8 -9
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +3 -0
- package/themes/original/index.tsx +180 -3
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +70 -41
- package/themes/original/src/components/BusinessController/index.tsx +50 -12
- package/themes/original/src/components/BusinessController/styles.tsx +27 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +8 -6
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +120 -36
- package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
- package/themes/original/src/components/BusinessProductsListing/index.tsx +116 -26
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
- package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
- package/themes/original/src/components/Cart/index.tsx +60 -43
- package/themes/original/src/components/Checkout/index.tsx +50 -33
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +91 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +287 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +394 -155
- package/themes/original/src/components/LoginForm/styles.tsx +7 -4
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/OrderDetails/index.tsx +64 -44
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +3 -3
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +133 -41
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +19 -15
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
- package/themes/original/src/components/ProductForm/index.tsx +74 -66
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/SearchBar/index.tsx +10 -4
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +79 -6
- package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
- package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +5 -96
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +59 -5
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +2 -1
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +132 -9
- package/themes/original/src/utils/index.tsx +19 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ScrollView, StyleSheet, Dimensions } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
ListWrapper
|
|
5
|
+
} from './styles'
|
|
6
|
+
|
|
7
|
+
import { SingleProductCard } from '../../SingleProductCard'
|
|
8
|
+
import { PreviousProductsOrderedParams } from '../../../types'
|
|
9
|
+
|
|
10
|
+
export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) => {
|
|
11
|
+
const {
|
|
12
|
+
products,
|
|
13
|
+
onProductClick,
|
|
14
|
+
isBusinessesSearchList
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const windowWidth = Dimensions.get('window').width;
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
marginBottom: 0,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const ProductList = ({ style }: any) => {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
{products?.map((product: any) => (
|
|
29
|
+
<SingleProductCard
|
|
30
|
+
key={product?.id}
|
|
31
|
+
isSoldOut={(product.inventoried && !product.quantity)}
|
|
32
|
+
product={product}
|
|
33
|
+
businessId={product?.business?.id}
|
|
34
|
+
onProductClick={onProductClick}
|
|
35
|
+
style={style}
|
|
36
|
+
productAddedToCartLength={0}
|
|
37
|
+
/>
|
|
38
|
+
))}
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
<ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
|
|
44
|
+
{isBusinessesSearchList ? (
|
|
45
|
+
<ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
|
|
46
|
+
) : (
|
|
47
|
+
<ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
|
|
48
|
+
<ProductList />
|
|
49
|
+
</ListWrapper>
|
|
50
|
+
)}
|
|
51
|
+
</ScrollView>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -2,14 +2,15 @@ import React, { useState, useEffect } from 'react'
|
|
|
2
2
|
import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { useFocusEffect } from '@react-navigation/native'
|
|
5
|
-
import { OText
|
|
5
|
+
import { OText } from '../shared'
|
|
6
6
|
import { NotFoundSource } from '../NotFoundSource'
|
|
7
7
|
import { ActiveOrders } from '../ActiveOrders'
|
|
8
8
|
import { PreviousOrders } from '../PreviousOrders'
|
|
9
|
-
|
|
9
|
+
import { PreviousBusinessOrdered } from './PreviousBusinessOrdered'
|
|
10
|
+
import { PreviousProductsOrdered } from './PreviousProductsOrdered'
|
|
10
11
|
import { OptionTitle, NoOrdersWrapper } from './styles'
|
|
11
12
|
import { OrdersOptionParams } from '../../types'
|
|
12
|
-
|
|
13
|
+
import { _setStoreData } from '../../providers/StoreUtil';
|
|
13
14
|
import {
|
|
14
15
|
Placeholder,
|
|
15
16
|
PlaceholderLine,
|
|
@@ -33,15 +34,28 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
33
34
|
loadMoreOrders,
|
|
34
35
|
loadOrders,
|
|
35
36
|
setOrdersLength,
|
|
36
|
-
ordersLength
|
|
37
|
+
ordersLength,
|
|
38
|
+
refreshOrders,
|
|
39
|
+
setRefreshOrders,
|
|
40
|
+
reorderState,
|
|
41
|
+
handleReorder,
|
|
42
|
+
handleUpdateOrderList,
|
|
43
|
+
isBusiness,
|
|
44
|
+
isProducts,
|
|
45
|
+
businessOrderIds,
|
|
46
|
+
products,
|
|
47
|
+
businessesSearchList,
|
|
48
|
+
hideOrders,
|
|
49
|
+
BusinessControllerSkeletons,
|
|
37
50
|
} = props
|
|
38
51
|
|
|
39
52
|
const theme = useTheme();
|
|
40
53
|
|
|
41
54
|
const [, t] = useLanguage()
|
|
42
|
-
const [
|
|
43
|
-
const { showToast } = useToast()
|
|
55
|
+
const [{ carts }] = useOrder()
|
|
56
|
+
const [, { showToast }] = useToast()
|
|
44
57
|
const { loading, error, orders: values } = orderList
|
|
58
|
+
const [businessLoading, setBusinessLoading] = useState(true)
|
|
45
59
|
|
|
46
60
|
const imageFails = activeOrders
|
|
47
61
|
? theme.images.general.emptyActiveOrders
|
|
@@ -49,26 +63,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
49
63
|
|
|
50
64
|
const orders = customArray || values || []
|
|
51
65
|
|
|
52
|
-
const [reorderLoading, setReorderLoading] = useState(false)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const handleReorder = async (orderId: number) => {
|
|
56
|
-
setReorderLoading(true)
|
|
57
|
-
try {
|
|
58
|
-
const { error, result } = await reorder(orderId)
|
|
59
|
-
if (!error) {
|
|
60
|
-
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: result.uuid })
|
|
61
|
-
setReorderLoading(false)
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
setReorderLoading(false)
|
|
65
|
-
|
|
66
|
-
} catch (err: any) {
|
|
67
|
-
showToast(ToastType.Error, t('ERROR', err.message))
|
|
68
|
-
setReorderLoading(false)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
66
|
const getOrderStatus = (s: string) => {
|
|
73
67
|
const status = parseInt(s)
|
|
74
68
|
const orderStatus = [
|
|
@@ -95,7 +89,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
95
89
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
|
|
96
90
|
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
|
|
97
91
|
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
|
|
98
|
-
|
|
92
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
|
|
99
93
|
]
|
|
100
94
|
|
|
101
95
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -103,11 +97,46 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
103
97
|
return objectStatus && objectStatus
|
|
104
98
|
}
|
|
105
99
|
|
|
100
|
+
const onProductClick = (product: any) => {
|
|
101
|
+
if (product?.product_id && product?.category_id && product?.businessId) {
|
|
102
|
+
onNavigationRedirect('ProductDetails', {
|
|
103
|
+
productId: product?.product_id,
|
|
104
|
+
categoryId: product?.category_id,
|
|
105
|
+
businessId: product?.businessId,
|
|
106
|
+
})
|
|
107
|
+
} else {
|
|
108
|
+
showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
114
|
+
if (reorderState?.error) {
|
|
115
|
+
if (reorderState?.result?.business_id) {
|
|
116
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
117
|
+
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
|
|
121
|
+
const cartProducts = carts?.[_businessId]?.products
|
|
122
|
+
const available = cartProducts.every((product: any) => product.valid === true)
|
|
123
|
+
const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
|
|
124
|
+
|
|
125
|
+
if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
|
|
126
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
127
|
+
} else {
|
|
128
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
129
|
+
cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
130
|
+
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, [reorderState])
|
|
134
|
+
|
|
106
135
|
useFocusEffect(
|
|
107
136
|
React.useCallback(() => {
|
|
108
|
-
loadOrders()
|
|
137
|
+
loadOrders(false, false, false, true)
|
|
109
138
|
}, [navigation])
|
|
110
|
-
|
|
139
|
+
)
|
|
111
140
|
|
|
112
141
|
useEffect(() => {
|
|
113
142
|
const hasMore = pagination?.totalPages && pagination?.currentPage !== pagination?.totalPages
|
|
@@ -126,7 +155,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
126
155
|
} else if (!preOrders) {
|
|
127
156
|
setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
|
|
128
157
|
}
|
|
129
|
-
}, [orders, activeOrders])
|
|
158
|
+
}, [orders, activeOrders, preOrders])
|
|
159
|
+
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
if (refreshOrders) {
|
|
162
|
+
loadOrders(false, false, false, true)
|
|
163
|
+
setRefreshOrders && setRefreshOrders(false)
|
|
164
|
+
}
|
|
165
|
+
}, [refreshOrders])
|
|
130
166
|
|
|
131
167
|
return (
|
|
132
168
|
<>
|
|
@@ -144,9 +180,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
144
180
|
|
|
145
181
|
</NoOrdersWrapper>
|
|
146
182
|
)}
|
|
147
|
-
{(ordersLength
|
|
183
|
+
{(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
|
|
148
184
|
<>
|
|
149
|
-
<OptionTitle>
|
|
185
|
+
<OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
|
|
150
186
|
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
|
|
151
187
|
{titleContent || (activeOrders
|
|
152
188
|
? t('ACTIVE', 'Active')
|
|
@@ -155,7 +191,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
155
191
|
: t('PAST', 'Past'))}
|
|
156
192
|
</OText>
|
|
157
193
|
</OptionTitle>
|
|
158
|
-
{!(ordersLength
|
|
194
|
+
{!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
|
|
159
195
|
!loading &&
|
|
160
196
|
orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
|
|
161
197
|
(
|
|
@@ -167,7 +203,51 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
167
203
|
)}
|
|
168
204
|
</>
|
|
169
205
|
)}
|
|
170
|
-
{
|
|
206
|
+
{isBusiness && !!businessesSearchList && businessLoading && (
|
|
207
|
+
<ScrollView horizontal>
|
|
208
|
+
<BusinessControllerSkeletons />
|
|
209
|
+
</ScrollView>
|
|
210
|
+
)}
|
|
211
|
+
{isBusiness && businessOrderIds?.length > 0 && (
|
|
212
|
+
<PreviousBusinessOrdered
|
|
213
|
+
businessId={businessOrderIds}
|
|
214
|
+
businessLoading={businessLoading}
|
|
215
|
+
setBusinessLoading={setBusinessLoading}
|
|
216
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
217
|
+
isLoadingOrders={loading}
|
|
218
|
+
isBusinessesSearchList={!!businessesSearchList}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
|
|
222
|
+
{isProducts && (
|
|
223
|
+
<PreviousProductsOrdered
|
|
224
|
+
products={products}
|
|
225
|
+
onProductClick={onProductClick}
|
|
226
|
+
isBusinessesSearchList={!!businessesSearchList}
|
|
227
|
+
/>
|
|
228
|
+
)}
|
|
229
|
+
{(loading && isProducts) && (
|
|
230
|
+
<>
|
|
231
|
+
{[...Array(4).keys()].map(
|
|
232
|
+
(item, i) => (
|
|
233
|
+
<Placeholder key={i} style={{ padding: 5, paddingLeft: 40 }} Animation={Fade}>
|
|
234
|
+
<View style={{ flexDirection: 'row' }}>
|
|
235
|
+
<PlaceholderLine
|
|
236
|
+
width={24}
|
|
237
|
+
height={70}
|
|
238
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
239
|
+
/>
|
|
240
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
241
|
+
<PlaceholderLine width={60} style={{ marginBottom: 25 }} />
|
|
242
|
+
<PlaceholderLine width={20} />
|
|
243
|
+
</Placeholder>
|
|
244
|
+
</View>
|
|
245
|
+
</Placeholder>
|
|
246
|
+
),
|
|
247
|
+
)}
|
|
248
|
+
</>
|
|
249
|
+
)}
|
|
250
|
+
{loading && !hideOrders && (
|
|
171
251
|
<>
|
|
172
252
|
{!activeOrders ? (
|
|
173
253
|
<Placeholder style={{ marginTop: 30 }} Animation={Fade}>
|
|
@@ -198,35 +278,38 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
198
278
|
)}
|
|
199
279
|
</>
|
|
200
280
|
)}
|
|
201
|
-
{!loading && !error && orders.length > 0 && (
|
|
281
|
+
{!loading && !error && orders.length > 0 && !hideOrders && (
|
|
202
282
|
preOrders ? (
|
|
203
283
|
<ActiveOrders
|
|
204
284
|
orders={orders.filter((order: any) => orderStatus.includes(order.status))}
|
|
205
285
|
pagination={pagination}
|
|
206
286
|
loadMoreOrders={loadMoreOrders}
|
|
207
|
-
reorderLoading={
|
|
287
|
+
reorderLoading={reorderState?.loading}
|
|
208
288
|
customArray={customArray}
|
|
209
289
|
getOrderStatus={getOrderStatus}
|
|
210
290
|
onNavigationRedirect={onNavigationRedirect}
|
|
291
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
211
292
|
/>
|
|
212
293
|
) : activeOrders ? (
|
|
213
294
|
<ActiveOrders
|
|
214
295
|
orders={orders.filter((order: any) => orderStatus.includes(order.status))}
|
|
215
296
|
pagination={pagination}
|
|
216
|
-
reorderLoading={
|
|
297
|
+
reorderLoading={reorderState?.loading}
|
|
217
298
|
customArray={customArray}
|
|
218
299
|
getOrderStatus={getOrderStatus}
|
|
219
300
|
onNavigationRedirect={onNavigationRedirect}
|
|
301
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
220
302
|
/>
|
|
221
303
|
) : (
|
|
222
304
|
<PreviousOrders
|
|
223
|
-
reorderLoading={
|
|
305
|
+
reorderLoading={reorderState?.loading}
|
|
224
306
|
orders={orders.filter((order: any) => orderStatus.includes(order.status)).sort((a: any, b: any) => a?.id < b?.id)}
|
|
225
307
|
pagination={pagination}
|
|
226
308
|
loadMoreOrders={loadMoreOrders}
|
|
227
309
|
getOrderStatus={getOrderStatus}
|
|
228
310
|
onNavigationRedirect={onNavigationRedirect}
|
|
229
311
|
handleReorder={handleReorder}
|
|
312
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
230
313
|
/>
|
|
231
314
|
)
|
|
232
315
|
)}
|
|
@@ -235,13 +318,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
235
318
|
}
|
|
236
319
|
|
|
237
320
|
export const OrdersOption = (props: OrdersOptionParams) => {
|
|
321
|
+
const getAllOrders = props.activeOrders && props.pastOrders && props.preOrders
|
|
322
|
+
|
|
238
323
|
const MyOrdersProps = {
|
|
239
324
|
...props,
|
|
240
325
|
UIComponent: OrdersOptionUI,
|
|
241
|
-
orderStatus:
|
|
242
|
-
? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
243
|
-
:
|
|
326
|
+
orderStatus: getAllOrders
|
|
327
|
+
? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
|
328
|
+
: props.preOrders ? [13] : props.activeOrders
|
|
329
|
+
? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
330
|
+
: [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
|
|
244
331
|
useDefualtSessionManager: true,
|
|
332
|
+
paginationSettings: {
|
|
333
|
+
initialPage: 1,
|
|
334
|
+
pageSize: getAllOrders ? 30 : 10,
|
|
335
|
+
controlType: 'infinity'
|
|
336
|
+
}
|
|
245
337
|
}
|
|
246
338
|
|
|
247
339
|
return <OrderList {...MyOrdersProps} />
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const OptionTitle = styled.View`
|
|
4
4
|
margin-top: 24px;
|
|
5
|
-
`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
align-items: center;
|
|
10
|
-
margin-top: 50px;
|
|
5
|
+
${(props : any) => props.titleContent && css`
|
|
6
|
+
margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
|
|
7
|
+
`}
|
|
11
8
|
`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { View } from 'react-native'
|
|
3
3
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
4
4
|
import { useTheme } from 'styled-components/native'
|
|
5
|
-
import
|
|
5
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
6
6
|
import {
|
|
7
7
|
PaymentOptionWallet as PaymentOptionWalletController,
|
|
8
8
|
useLanguage,
|
|
@@ -20,6 +20,7 @@ import { OText } from '../shared'
|
|
|
20
20
|
|
|
21
21
|
const PaymentOptionWalletUI = (props: any) => {
|
|
22
22
|
const {
|
|
23
|
+
businessConfigs,
|
|
23
24
|
businessId,
|
|
24
25
|
walletsState,
|
|
25
26
|
selectWallet,
|
|
@@ -37,12 +38,8 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
37
38
|
const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
|
|
38
39
|
const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
width: 25,
|
|
43
|
-
height: 25,
|
|
44
|
-
}
|
|
45
|
-
});
|
|
41
|
+
const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
42
|
+
const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
46
43
|
|
|
47
44
|
const [checkedState, setCheckedState] = useState(
|
|
48
45
|
new Array(walletsState.result?.length).fill(false)
|
|
@@ -53,11 +50,11 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
53
50
|
const walletName: any = {
|
|
54
51
|
cash: {
|
|
55
52
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
56
|
-
isActive: isWalletCashEnabled
|
|
53
|
+
isActive: isWalletCashEnabled && isBusinessWalletCashEnabled
|
|
57
54
|
},
|
|
58
55
|
credit_point: {
|
|
59
56
|
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
60
|
-
isActive: isWalletPointsEnabled
|
|
57
|
+
isActive: isWalletPointsEnabled && isBusinessWalletPointsEnabled
|
|
61
58
|
}
|
|
62
59
|
}
|
|
63
60
|
|
|
@@ -96,22 +93,23 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
96
93
|
<Container
|
|
97
94
|
key={wallet.id}
|
|
98
95
|
isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
|
|
96
|
+
onPress={() => handleOnChange(idx, wallet)}
|
|
97
|
+
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
|
|
99
98
|
>
|
|
100
99
|
<SectionLeft>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
/>
|
|
100
|
+
{checkedState[idx] ? (
|
|
101
|
+
<MaterialCommunityIcons
|
|
102
|
+
name="checkbox-marked"
|
|
103
|
+
size={25}
|
|
104
|
+
color={theme.colors.primary}
|
|
105
|
+
/>
|
|
106
|
+
) : (
|
|
107
|
+
<MaterialCommunityIcons
|
|
108
|
+
name="checkbox-blank-outline"
|
|
109
|
+
size={25}
|
|
110
|
+
color={theme.colors.disabled}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
115
113
|
<View style={{ alignItems: 'baseline', marginLeft: 5 }}>
|
|
116
114
|
<View>
|
|
117
115
|
<OText
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
PaymentOptions as PaymentOptionsController,
|
|
11
11
|
useLanguage,
|
|
12
|
-
|
|
12
|
+
ToastType,
|
|
13
13
|
useToast,
|
|
14
14
|
} from 'ordering-components/native';
|
|
15
15
|
import { useTheme } from 'styled-components/native';
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
PMCardItemContent
|
|
31
31
|
} from './styles'
|
|
32
32
|
import { getIconCard, flatArray } from '../../utils';
|
|
33
|
+
import { useApplePay } from '@stripe/stripe-react-native';
|
|
33
34
|
|
|
34
35
|
const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
|
|
35
36
|
const methodsPay = ['google_pay', 'apple_pay']
|
|
@@ -62,7 +63,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
62
63
|
} = props
|
|
63
64
|
|
|
64
65
|
const theme = useTheme();
|
|
65
|
-
|
|
66
|
+
const [, { showToast }] = useToast();
|
|
67
|
+
const { confirmApplePayPayment } = useApplePay()
|
|
66
68
|
|
|
67
69
|
const getPayIcon = (method: string) => {
|
|
68
70
|
switch (method) {
|
|
@@ -98,18 +100,18 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
98
100
|
// ]
|
|
99
101
|
|
|
100
102
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
if (cart?.balance > 0) {
|
|
104
|
+
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
105
|
+
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
106
|
+
handlePaymentMethodClickCustom(paymethod)
|
|
107
|
+
}
|
|
108
|
+
handlePaymethodClick(paymethod, isPopupMethod)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
showToast(
|
|
110
112
|
ToastType.Error,
|
|
111
113
|
t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
|
|
112
|
-
|
|
114
|
+
;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
useEffect(() => {
|
|
@@ -126,13 +128,15 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
126
128
|
|
|
127
129
|
useEffect(() => {
|
|
128
130
|
if (props.paySelected && props.paySelected?.data) {
|
|
129
|
-
|
|
131
|
+
requestAnimationFrame(() => {
|
|
132
|
+
setPaymethodData && setPaymethodData(props.paySelected?.data)
|
|
133
|
+
})
|
|
130
134
|
}
|
|
131
135
|
}, [props.paySelected])
|
|
132
136
|
|
|
133
137
|
useEffect(() => {
|
|
134
138
|
if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
|
|
135
|
-
|
|
139
|
+
handlePlaceOrder(confirmApplePayPayment)
|
|
136
140
|
}
|
|
137
141
|
}, [paymethodData, paymethodSelected])
|
|
138
142
|
|
|
@@ -164,7 +168,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
164
168
|
)
|
|
165
169
|
}
|
|
166
170
|
|
|
167
|
-
const excludeIds: any = [32]; //exclude paypal & connect & redirect
|
|
171
|
+
const excludeIds: any = [32, 66]; //exclude paypal & connect & redirect
|
|
168
172
|
|
|
169
173
|
return (
|
|
170
174
|
<PMContainer>
|
|
@@ -58,7 +58,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
useEffect(() => {
|
|
61
|
-
if ((defaultValue && userphoneNumber) || defaultValue
|
|
61
|
+
if ((defaultValue && userphoneNumber) || !defaultValue) {
|
|
62
62
|
if (userphoneNumber) {
|
|
63
63
|
const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
|
|
64
64
|
const callingCode = phoneInput.current?.getCallingCode();
|