ordering-ui-react-native 0.15.31 → 0.15.33-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 +4 -2
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessController/index.tsx +8 -2
- package/src/components/BusinessTypeFilter/index.tsx +4 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -3
- 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 +2 -2
- package/src/components/PaymentOptions/index.tsx +9 -16
- 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/StripeElementsForm/index.tsx +27 -48
- 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/config.json +0 -2
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +5 -11
- 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 +38 -86
- 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 +32 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
- 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 +52 -49
- package/themes/business/src/components/OrdersOption/index.tsx +57 -50
- package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
- 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/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +7 -8
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- 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/OrderDetails/index.tsx +167 -67
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- 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 +184 -1
- 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 +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +77 -29
- 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/BusinessListingSearch/index.tsx +125 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +140 -37
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +112 -14
- 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 +98 -72
- package/themes/original/src/components/Cart/index.tsx +21 -17
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +59 -48
- 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 +115 -90
- 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 +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- 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/OrderDetails/index.tsx +56 -33
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- 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/index.tsx +59 -58
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- 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 +9 -21
- 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 +76 -61
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- 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/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SearchBar/index.tsx +4 -1
- 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 +9 -4
- 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 +82 -30
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
- 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 +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +66 -14
- 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 +21 -0
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +115 -9
- package/themes/original/src/utils/index.tsx +28 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -174
|
@@ -2,14 +2,14 @@ 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
|
|
|
10
|
-
import { OptionTitle
|
|
10
|
+
import { OptionTitle } from './styles'
|
|
11
11
|
import { OrdersOptionParams } from '../../types'
|
|
12
|
-
|
|
12
|
+
import { _setStoreData } from '../../providers/StoreUtil';
|
|
13
13
|
import {
|
|
14
14
|
Placeholder,
|
|
15
15
|
PlaceholderLine,
|
|
@@ -33,13 +33,18 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
33
33
|
loadMoreOrders,
|
|
34
34
|
loadOrders,
|
|
35
35
|
setOrdersLength,
|
|
36
|
-
ordersLength
|
|
36
|
+
ordersLength,
|
|
37
|
+
refreshOrders,
|
|
38
|
+
setRefreshOrders,
|
|
39
|
+
reorderState,
|
|
40
|
+
handleReorder,
|
|
41
|
+
handleUpdateOrderList
|
|
37
42
|
} = props
|
|
38
43
|
|
|
39
44
|
const theme = useTheme();
|
|
40
45
|
|
|
41
46
|
const [, t] = useLanguage()
|
|
42
|
-
const [
|
|
47
|
+
const [{ carts }] = useOrder()
|
|
43
48
|
const { showToast } = useToast()
|
|
44
49
|
const { loading, error, orders: values } = orderList
|
|
45
50
|
|
|
@@ -49,26 +54,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
49
54
|
|
|
50
55
|
const orders = customArray || values || []
|
|
51
56
|
|
|
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
57
|
const getOrderStatus = (s: string) => {
|
|
73
58
|
const status = parseInt(s)
|
|
74
59
|
const orderStatus = [
|
|
@@ -95,7 +80,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
95
80
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
|
|
96
81
|
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
|
|
97
82
|
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
|
|
98
|
-
|
|
83
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
|
|
99
84
|
]
|
|
100
85
|
|
|
101
86
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -103,11 +88,34 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
103
88
|
return objectStatus && objectStatus
|
|
104
89
|
}
|
|
105
90
|
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
93
|
+
if (reorderState?.error) {
|
|
94
|
+
if (reorderState?.result?.business_id) {
|
|
95
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
96
|
+
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
|
|
100
|
+
const cartProducts = carts?.[_businessId]?.products
|
|
101
|
+
const available = cartProducts.every((product: any) => product.valid === true)
|
|
102
|
+
const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
|
|
103
|
+
|
|
104
|
+
if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
|
|
105
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
106
|
+
} else {
|
|
107
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
108
|
+
cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
109
|
+
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, [reorderState])
|
|
113
|
+
|
|
106
114
|
useFocusEffect(
|
|
107
115
|
React.useCallback(() => {
|
|
108
|
-
loadOrders()
|
|
116
|
+
loadOrders(false, false, false, true)
|
|
109
117
|
}, [navigation])
|
|
110
|
-
|
|
118
|
+
)
|
|
111
119
|
|
|
112
120
|
useEffect(() => {
|
|
113
121
|
const hasMore = pagination?.totalPages && pagination?.currentPage !== pagination?.totalPages
|
|
@@ -128,23 +136,16 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
128
136
|
}
|
|
129
137
|
}, [orders, activeOrders])
|
|
130
138
|
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if(refreshOrders){
|
|
141
|
+
loadOrders(false, false, false, true)
|
|
142
|
+
setRefreshOrders && setRefreshOrders(false)
|
|
143
|
+
}
|
|
144
|
+
}, [refreshOrders])
|
|
145
|
+
|
|
131
146
|
return (
|
|
132
147
|
<>
|
|
133
|
-
{
|
|
134
|
-
<NoOrdersWrapper>
|
|
135
|
-
<OText size={14} numberOfLines={1}>
|
|
136
|
-
{t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
|
|
137
|
-
</OText>
|
|
138
|
-
<OButton
|
|
139
|
-
text={t('ORDER_NOW', 'Order now')}
|
|
140
|
-
onClick={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
|
|
141
|
-
textStyle={{ color: 'white', fontSize: 14 }}
|
|
142
|
-
style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
|
|
143
|
-
/>
|
|
144
|
-
|
|
145
|
-
</NoOrdersWrapper>
|
|
146
|
-
)}
|
|
147
|
-
{(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
|
|
148
|
+
{(orders.length > 0) && (
|
|
148
149
|
<>
|
|
149
150
|
<OptionTitle>
|
|
150
151
|
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
|
|
@@ -155,18 +156,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
155
156
|
: t('PAST', 'Past'))}
|
|
156
157
|
</OText>
|
|
157
158
|
</OptionTitle>
|
|
158
|
-
{!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
|
|
159
|
-
!loading &&
|
|
160
|
-
orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
|
|
161
|
-
(
|
|
162
|
-
<NotFoundSource
|
|
163
|
-
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
164
|
-
image={imageFails}
|
|
165
|
-
conditioned
|
|
166
|
-
/>
|
|
167
|
-
)}
|
|
168
159
|
</>
|
|
169
160
|
)}
|
|
161
|
+
{!loading && orders.length === 0 && (
|
|
162
|
+
<NotFoundSource
|
|
163
|
+
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
164
|
+
image={imageFails}
|
|
165
|
+
conditioned
|
|
166
|
+
/>
|
|
167
|
+
)}
|
|
170
168
|
{loading && (
|
|
171
169
|
<>
|
|
172
170
|
{!activeOrders ? (
|
|
@@ -204,29 +202,32 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
204
202
|
orders={orders.filter((order: any) => orderStatus.includes(order.status))}
|
|
205
203
|
pagination={pagination}
|
|
206
204
|
loadMoreOrders={loadMoreOrders}
|
|
207
|
-
reorderLoading={
|
|
205
|
+
reorderLoading={reorderState?.loading}
|
|
208
206
|
customArray={customArray}
|
|
209
207
|
getOrderStatus={getOrderStatus}
|
|
210
208
|
onNavigationRedirect={onNavigationRedirect}
|
|
209
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
211
210
|
/>
|
|
212
211
|
) : activeOrders ? (
|
|
213
212
|
<ActiveOrders
|
|
214
213
|
orders={orders.filter((order: any) => orderStatus.includes(order.status))}
|
|
215
214
|
pagination={pagination}
|
|
216
|
-
reorderLoading={
|
|
215
|
+
reorderLoading={reorderState?.loading}
|
|
217
216
|
customArray={customArray}
|
|
218
217
|
getOrderStatus={getOrderStatus}
|
|
219
218
|
onNavigationRedirect={onNavigationRedirect}
|
|
219
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
220
220
|
/>
|
|
221
221
|
) : (
|
|
222
222
|
<PreviousOrders
|
|
223
|
-
reorderLoading={
|
|
223
|
+
reorderLoading={reorderState?.loading}
|
|
224
224
|
orders={orders.filter((order: any) => orderStatus.includes(order.status)).sort((a: any, b: any) => a?.id < b?.id)}
|
|
225
225
|
pagination={pagination}
|
|
226
226
|
loadMoreOrders={loadMoreOrders}
|
|
227
227
|
getOrderStatus={getOrderStatus}
|
|
228
228
|
onNavigationRedirect={onNavigationRedirect}
|
|
229
229
|
handleReorder={handleReorder}
|
|
230
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
230
231
|
/>
|
|
231
232
|
)
|
|
232
233
|
)}
|
|
@@ -239,8 +240,8 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
239
240
|
...props,
|
|
240
241
|
UIComponent: OrdersOptionUI,
|
|
241
242
|
orderStatus: props.preOrders ? [13] : props.activeOrders
|
|
242
|
-
? [0, 3, 4, 7, 8, 9, 14,
|
|
243
|
-
: [1, 2, 5, 6, 10, 11, 12, 16, 17],
|
|
243
|
+
? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
244
|
+
: [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
|
|
244
245
|
useDefualtSessionManager: true,
|
|
245
246
|
}
|
|
246
247
|
|
|
@@ -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
|
|
@@ -32,8 +32,6 @@ import {
|
|
|
32
32
|
import { getIconCard, flatArray } from '../../utils';
|
|
33
33
|
|
|
34
34
|
const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
|
|
35
|
-
const methodsPay = ['google_pay', 'apple_pay']
|
|
36
|
-
const stripeDirectMethods = ['stripe_direct', ...methodsPay]
|
|
37
35
|
// const stripeRedirectOptions = [
|
|
38
36
|
// { name: 'Bancontact', value: 'bancontact' },
|
|
39
37
|
// { name: 'Alipay', value: 'alipay' },
|
|
@@ -56,9 +54,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
56
54
|
handlePaymethodClick,
|
|
57
55
|
handlePaymethodDataChange,
|
|
58
56
|
isOpenMethod,
|
|
59
|
-
handlePaymentMethodClickCustom
|
|
60
|
-
handlePlaceOrder,
|
|
61
|
-
merchantId
|
|
57
|
+
handlePaymentMethodClickCustom
|
|
62
58
|
} = props
|
|
63
59
|
|
|
64
60
|
const theme = useTheme();
|
|
@@ -126,16 +122,12 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
126
122
|
|
|
127
123
|
useEffect(() => {
|
|
128
124
|
if (props.paySelected && props.paySelected?.data) {
|
|
129
|
-
|
|
125
|
+
requestAnimationFrame(() => {
|
|
126
|
+
setPaymethodData && setPaymethodData(props.paySelected?.data)
|
|
127
|
+
})
|
|
130
128
|
}
|
|
131
129
|
}, [props.paySelected])
|
|
132
130
|
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
|
|
135
|
-
handlePlaceOrder()
|
|
136
|
-
}
|
|
137
|
-
}, [paymethodData, paymethodSelected])
|
|
138
|
-
|
|
139
131
|
const renderPaymethods = ({ item }: any) => {
|
|
140
132
|
return (
|
|
141
133
|
<TouchableOpacity
|
|
@@ -164,7 +156,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
164
156
|
)
|
|
165
157
|
}
|
|
166
158
|
|
|
167
|
-
const excludeIds: any = [32]; //exclude paypal & connect & redirect
|
|
159
|
+
const excludeIds: any = [32, 66]; //exclude paypal & connect & redirect
|
|
168
160
|
|
|
169
161
|
return (
|
|
170
162
|
<PMContainer>
|
|
@@ -297,11 +289,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
297
289
|
</KeyboardAvoidingView>
|
|
298
290
|
</OModal>
|
|
299
291
|
|
|
300
|
-
{/* Stripe direct
|
|
292
|
+
{/* Stripe direct */}
|
|
301
293
|
<OModal
|
|
302
294
|
entireModal
|
|
303
295
|
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
304
|
-
open={
|
|
296
|
+
open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
|
|
305
297
|
onClose={() => handlePaymethodClick(null)}
|
|
306
298
|
>
|
|
307
299
|
<KeyboardAvoidingView
|
|
@@ -310,14 +302,10 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
310
302
|
enabled={Platform.OS === 'ios' ? true : false}
|
|
311
303
|
>
|
|
312
304
|
<StripeElementsForm
|
|
313
|
-
cart={cart}
|
|
314
|
-
paymethod={isOpenMethod?.paymethod?.gateway}
|
|
315
|
-
methodsPay={methodsPay}
|
|
316
305
|
businessId={props.businessId}
|
|
317
|
-
publicKey={isOpenMethod?.paymethod?.credentials?.publishable
|
|
306
|
+
publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
318
307
|
handleSource={handlePaymethodDataChange}
|
|
319
|
-
onCancel={() => handlePaymethodClick(
|
|
320
|
-
merchantId={merchantId}
|
|
308
|
+
onCancel={() => handlePaymethodClick(false)}
|
|
321
309
|
/>
|
|
322
310
|
</KeyboardAvoidingView>
|
|
323
311
|
</OModal>
|
|
@@ -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();
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { useLanguage
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useLanguage } from 'ordering-components/native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import {
|
|
5
|
-
import { OButton
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { OButton } from '../shared';
|
|
6
6
|
import {
|
|
7
|
-
Card,
|
|
8
|
-
Logo,
|
|
9
|
-
Information,
|
|
10
|
-
MyOrderOptions,
|
|
11
|
-
Status,
|
|
12
7
|
WrappButton,
|
|
13
8
|
} from './styles';
|
|
14
9
|
import { PreviousOrdersParams } from '../../types';
|
|
15
|
-
import
|
|
10
|
+
import { SingleOrderCard } from '../SingleOrderCard';
|
|
16
11
|
|
|
17
12
|
export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
18
13
|
const {
|
|
@@ -24,150 +19,28 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
24
19
|
handleReorder,
|
|
25
20
|
reorderLoading,
|
|
26
21
|
orderID,
|
|
22
|
+
handleUpdateOrderList
|
|
27
23
|
} = props;
|
|
28
24
|
|
|
29
25
|
const theme = useTheme();
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
logo: {
|
|
34
|
-
borderRadius: 10,
|
|
35
|
-
width: 64,
|
|
36
|
-
height: 64,
|
|
37
|
-
},
|
|
38
|
-
reorderbutton: {
|
|
39
|
-
height: 23,
|
|
40
|
-
paddingLeft: 10,
|
|
41
|
-
paddingRight: 10,
|
|
42
|
-
borderRadius: 23,
|
|
43
|
-
shadowOpacity: 0,
|
|
44
|
-
backgroundColor: theme.colors.primaryContrast,
|
|
45
|
-
borderWidth: 0,
|
|
46
|
-
},
|
|
47
|
-
reorderLoading: {
|
|
48
|
-
width: 80,
|
|
49
|
-
height: 40,
|
|
50
|
-
borderRadius: 10,
|
|
51
|
-
},
|
|
52
|
-
reviewButton: {
|
|
53
|
-
height: 23,
|
|
54
|
-
maxHeight: 23,
|
|
55
|
-
backgroundColor: theme.colors.white,
|
|
56
|
-
alignItems: 'center',
|
|
57
|
-
justifyContent: 'center',
|
|
58
|
-
paddingHorizontal: 10,
|
|
59
|
-
borderRadius: 23,
|
|
60
|
-
borderWidth: 1,
|
|
61
|
-
borderColor: theme.colors.primaryContrast,
|
|
62
|
-
},
|
|
63
|
-
buttonText: {
|
|
64
|
-
color: theme.colors.primary,
|
|
65
|
-
fontSize: 10,
|
|
66
|
-
marginLeft: 2,
|
|
67
|
-
marginRight: 2,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
27
|
const [, t] = useLanguage();
|
|
73
|
-
const [reorderSelected, setReorderSelected] = useState<number | null>(null);
|
|
74
|
-
const [{ parseDate, optimizeImage }] = useUtils();
|
|
75
|
-
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
|
|
76
|
-
|
|
77
|
-
const handleClickViewOrder = (uuid: string) => {
|
|
78
|
-
onNavigationRedirect &&
|
|
79
|
-
onNavigationRedirect('OrderDetails', { orderId: uuid });
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const handleClickOrderReview = (order: any) => {
|
|
83
|
-
onNavigationRedirect &&
|
|
84
|
-
onNavigationRedirect('ReviewOrder', {
|
|
85
|
-
order: {
|
|
86
|
-
id: order?.id,
|
|
87
|
-
business_id: order?.business_id,
|
|
88
|
-
logo: order.business?.logo,
|
|
89
|
-
driver: order?.driver,
|
|
90
|
-
products: order?.products,
|
|
91
|
-
review: order?.review,
|
|
92
|
-
user_review: order?.user_review
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const formatDate = (date: string, option?: any) => {
|
|
98
|
-
return option?.utc ? moment.utc(date).format('DD/MM/YY \u2022 h:m a') : moment(date).format('DD/MM/YY \u2022 h:m a');
|
|
99
|
-
};
|
|
100
28
|
|
|
101
|
-
|
|
102
|
-
setReorderSelected(id);
|
|
103
|
-
handleReorder(id);
|
|
104
|
-
};
|
|
29
|
+
const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
105
30
|
|
|
106
31
|
return (
|
|
107
32
|
<View style={{ marginBottom: 30 }}>
|
|
108
|
-
{orders.map((order: any) => (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
style={styles.logo}
|
|
120
|
-
/>
|
|
121
|
-
</Logo>
|
|
122
|
-
)}
|
|
123
|
-
<Information>
|
|
124
|
-
<OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
|
|
125
|
-
{order.business?.name}
|
|
126
|
-
</OText>
|
|
127
|
-
<OText
|
|
128
|
-
size={10}
|
|
129
|
-
lineHeight={15}
|
|
130
|
-
color={theme.colors.textSecondary}
|
|
131
|
-
style={{ marginVertical: 3 }}
|
|
132
|
-
numberOfLines={1}>
|
|
133
|
-
{order?.delivery_datetime_utc
|
|
134
|
-
? formatDate(order?.delivery_datetime_utc)
|
|
135
|
-
: formatDate(order?.delivery_datetime, { utc: false })}
|
|
136
|
-
</OText>
|
|
137
|
-
<OText
|
|
138
|
-
color={theme.colors.primary}
|
|
139
|
-
size={10}
|
|
140
|
-
lineHeight={15}
|
|
141
|
-
numberOfLines={1}>
|
|
142
|
-
{getOrderStatus(order.status)?.value}
|
|
143
|
-
</OText>
|
|
144
|
-
</Information>
|
|
145
|
-
<Status>
|
|
146
|
-
<OButton
|
|
147
|
-
text={t('REORDER', 'Reorder')}
|
|
148
|
-
imgRightSrc={''}
|
|
149
|
-
textStyle={styles.buttonText}
|
|
150
|
-
style={
|
|
151
|
-
reorderLoading && order.id === reorderSelected
|
|
152
|
-
? styles.reorderLoading
|
|
153
|
-
: styles.reorderbutton
|
|
154
|
-
}
|
|
155
|
-
onClick={() => handleReorderClick(order.id)}
|
|
156
|
-
isLoading={reorderLoading && order.id === reorderSelected}
|
|
157
|
-
/>
|
|
158
|
-
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
159
|
-
!order.review && (
|
|
160
|
-
<TouchableOpacity
|
|
161
|
-
onPress={() => handleClickOrderReview(order)}
|
|
162
|
-
style={styles.reviewButton}>
|
|
163
|
-
<OText size={10} color={theme.colors.primary} numberOfLines={1}>
|
|
164
|
-
{t('REVIEW', 'Review')}
|
|
165
|
-
</OText>
|
|
166
|
-
</TouchableOpacity>
|
|
167
|
-
)}
|
|
168
|
-
</Status>
|
|
169
|
-
</Card>
|
|
170
|
-
</TouchableOpacity>
|
|
33
|
+
{orders.map((order: any, i: number) => (
|
|
34
|
+
<SingleOrderCard
|
|
35
|
+
key={i}
|
|
36
|
+
order={order}
|
|
37
|
+
reorderLoading={reorderLoading}
|
|
38
|
+
handleReorder={handleReorder}
|
|
39
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
40
|
+
getOrderStatus={getOrderStatus}
|
|
41
|
+
pastOrders={pastOrders.includes(order?.status)}
|
|
42
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
43
|
+
/>
|
|
171
44
|
))}
|
|
172
45
|
{pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
173
46
|
<WrappButton>
|