ordering-ui-react-native 0.15.61 → 0.15.63-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 +7 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessInformation/index.tsx +14 -0
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- 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 +6 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/SingleProductReview/index.tsx +1 -1
- 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 +7 -6
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -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 +42 -90
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- 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 +26 -13
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +8 -4
- package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +8 -2
- 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 +11 -12
- 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 +32 -27
- 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 +7 -8
- 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 +1 -0
- package/themes/original/index.tsx +30 -8
- 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 +7 -6
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +7 -12
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +137 -46
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
- package/themes/original/src/components/BusinessController/index.tsx +168 -96
- package/themes/original/src/components/BusinessController/styles.tsx +5 -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 +231 -63
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +52 -53
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +291 -155
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +27 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +107 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +559 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Original/styles.tsx} +11 -3
- package/themes/original/src/components/BusinessesListing/index.tsx +99 -458
- package/themes/original/src/components/Cart/index.tsx +62 -43
- package/themes/original/src/components/Checkout/index.tsx +90 -39
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -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 +11 -11
- 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/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- 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/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- 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/NavBar/index.tsx +4 -4
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +151 -65
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderSummary/index.tsx +6 -6
- 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 +137 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +718 -679
- package/themes/original/src/components/ProductForm/styles.tsx +6 -2
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/Promotions/index.tsx +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +13 -5
- package/themes/original/src/components/ServiceForm/index.tsx +579 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- 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 +237 -126
- package/themes/original/src/components/SingleOrderCard/index.tsx +275 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +150 -84
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +15 -81
- package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
- package/themes/original/src/components/UserProfile/index.tsx +52 -5
- package/themes/original/src/components/UserProfileForm/index.tsx +33 -22
- 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/OBottomPopup.tsx +44 -13
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +186 -35
- package/themes/original/src/utils/index.tsx +96 -2
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -6,10 +6,11 @@ import { OText, OButton } 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 = [
|
|
@@ -103,9 +97,51 @@ 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
|
+
product?.business.slug && product?.business.header && product?.business.logo) {
|
|
103
|
+
onNavigationRedirect('ProductDetails', {
|
|
104
|
+
isRedirect: 'business',
|
|
105
|
+
businessId: product?.businessId,
|
|
106
|
+
categoryId: product?.category_id,
|
|
107
|
+
productId: product?.product_id,
|
|
108
|
+
business: {
|
|
109
|
+
store: product?.business.slug,
|
|
110
|
+
header: product?.business.header,
|
|
111
|
+
logo: product?.business.logo,
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
} else {
|
|
115
|
+
showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
121
|
+
if (reorderState?.error) {
|
|
122
|
+
if (reorderState?.result?.business_id) {
|
|
123
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
124
|
+
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
|
|
128
|
+
const cartProducts = carts?.[_businessId]?.products
|
|
129
|
+
const available = cartProducts.every((product: any) => product.valid === true)
|
|
130
|
+
const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
|
|
131
|
+
|
|
132
|
+
if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
|
|
133
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
134
|
+
} else {
|
|
135
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
136
|
+
cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
137
|
+
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, [reorderState])
|
|
141
|
+
|
|
106
142
|
useFocusEffect(
|
|
107
143
|
React.useCallback(() => {
|
|
108
|
-
loadOrders()
|
|
144
|
+
loadOrders(false, false, false, true)
|
|
109
145
|
}, [navigation])
|
|
110
146
|
)
|
|
111
147
|
|
|
@@ -126,7 +162,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
126
162
|
} else if (!preOrders) {
|
|
127
163
|
setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
|
|
128
164
|
}
|
|
129
|
-
}, [orders, activeOrders])
|
|
165
|
+
}, [orders, activeOrders, preOrders])
|
|
166
|
+
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (refreshOrders) {
|
|
169
|
+
loadOrders(false, false, false, true)
|
|
170
|
+
setRefreshOrders && setRefreshOrders(false)
|
|
171
|
+
}
|
|
172
|
+
}, [refreshOrders])
|
|
130
173
|
|
|
131
174
|
return (
|
|
132
175
|
<>
|
|
@@ -144,9 +187,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
144
187
|
|
|
145
188
|
</NoOrdersWrapper>
|
|
146
189
|
)}
|
|
147
|
-
{(ordersLength
|
|
190
|
+
{(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
|
|
148
191
|
<>
|
|
149
|
-
<OptionTitle>
|
|
192
|
+
<OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
|
|
150
193
|
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
|
|
151
194
|
{titleContent || (activeOrders
|
|
152
195
|
? t('ACTIVE', 'Active')
|
|
@@ -155,7 +198,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
155
198
|
: t('PAST', 'Past'))}
|
|
156
199
|
</OText>
|
|
157
200
|
</OptionTitle>
|
|
158
|
-
{!(ordersLength
|
|
201
|
+
{!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
|
|
159
202
|
!loading &&
|
|
160
203
|
orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
|
|
161
204
|
(
|
|
@@ -167,7 +210,51 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
167
210
|
)}
|
|
168
211
|
</>
|
|
169
212
|
)}
|
|
170
|
-
{
|
|
213
|
+
{isBusiness && !!businessesSearchList && businessLoading && (
|
|
214
|
+
<ScrollView horizontal>
|
|
215
|
+
<BusinessControllerSkeletons />
|
|
216
|
+
</ScrollView>
|
|
217
|
+
)}
|
|
218
|
+
{isBusiness && businessOrderIds?.length > 0 && (
|
|
219
|
+
<PreviousBusinessOrdered
|
|
220
|
+
businessId={businessOrderIds}
|
|
221
|
+
businessLoading={businessLoading}
|
|
222
|
+
setBusinessLoading={setBusinessLoading}
|
|
223
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
224
|
+
isLoadingOrders={loading}
|
|
225
|
+
isBusinessesSearchList={!!businessesSearchList}
|
|
226
|
+
/>
|
|
227
|
+
)}
|
|
228
|
+
|
|
229
|
+
{isProducts && (
|
|
230
|
+
<PreviousProductsOrdered
|
|
231
|
+
products={products}
|
|
232
|
+
onProductClick={onProductClick}
|
|
233
|
+
isBusinessesSearchList={!!businessesSearchList}
|
|
234
|
+
/>
|
|
235
|
+
)}
|
|
236
|
+
{(loading && isProducts) && (
|
|
237
|
+
<>
|
|
238
|
+
{[...Array(4).keys()].map(
|
|
239
|
+
(item, i) => (
|
|
240
|
+
<Placeholder key={i} style={{ padding: 5, paddingLeft: 40 }} Animation={Fade}>
|
|
241
|
+
<View style={{ flexDirection: 'row' }}>
|
|
242
|
+
<PlaceholderLine
|
|
243
|
+
width={24}
|
|
244
|
+
height={70}
|
|
245
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
246
|
+
/>
|
|
247
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
248
|
+
<PlaceholderLine width={60} style={{ marginBottom: 25 }} />
|
|
249
|
+
<PlaceholderLine width={20} />
|
|
250
|
+
</Placeholder>
|
|
251
|
+
</View>
|
|
252
|
+
</Placeholder>
|
|
253
|
+
),
|
|
254
|
+
)}
|
|
255
|
+
</>
|
|
256
|
+
)}
|
|
257
|
+
{loading && !hideOrders && (
|
|
171
258
|
<>
|
|
172
259
|
{!activeOrders ? (
|
|
173
260
|
<Placeholder style={{ marginTop: 30 }} Animation={Fade}>
|
|
@@ -198,35 +285,38 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
198
285
|
)}
|
|
199
286
|
</>
|
|
200
287
|
)}
|
|
201
|
-
{!loading && !error && orders.length > 0 && (
|
|
288
|
+
{!loading && !error && orders.length > 0 && !hideOrders && (
|
|
202
289
|
preOrders ? (
|
|
203
290
|
<ActiveOrders
|
|
204
291
|
orders={orders.filter((order: any) => orderStatus.includes(order.status))}
|
|
205
292
|
pagination={pagination}
|
|
206
293
|
loadMoreOrders={loadMoreOrders}
|
|
207
|
-
reorderLoading={
|
|
294
|
+
reorderLoading={reorderState?.loading}
|
|
208
295
|
customArray={customArray}
|
|
209
296
|
getOrderStatus={getOrderStatus}
|
|
210
297
|
onNavigationRedirect={onNavigationRedirect}
|
|
298
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
211
299
|
/>
|
|
212
300
|
) : activeOrders ? (
|
|
213
301
|
<ActiveOrders
|
|
214
302
|
orders={orders.filter((order: any) => orderStatus.includes(order.status))}
|
|
215
303
|
pagination={pagination}
|
|
216
|
-
reorderLoading={
|
|
304
|
+
reorderLoading={reorderState?.loading}
|
|
217
305
|
customArray={customArray}
|
|
218
306
|
getOrderStatus={getOrderStatus}
|
|
219
307
|
onNavigationRedirect={onNavigationRedirect}
|
|
308
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
220
309
|
/>
|
|
221
310
|
) : (
|
|
222
311
|
<PreviousOrders
|
|
223
|
-
reorderLoading={
|
|
312
|
+
reorderLoading={reorderState?.loading}
|
|
224
313
|
orders={orders.filter((order: any) => orderStatus.includes(order.status)).sort((a: any, b: any) => a?.id < b?.id)}
|
|
225
314
|
pagination={pagination}
|
|
226
315
|
loadMoreOrders={loadMoreOrders}
|
|
227
316
|
getOrderStatus={getOrderStatus}
|
|
228
317
|
onNavigationRedirect={onNavigationRedirect}
|
|
229
318
|
handleReorder={handleReorder}
|
|
319
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
230
320
|
/>
|
|
231
321
|
)
|
|
232
322
|
)}
|
|
@@ -235,13 +325,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
235
325
|
}
|
|
236
326
|
|
|
237
327
|
export const OrdersOption = (props: OrdersOptionParams) => {
|
|
328
|
+
const getAllOrders = props.activeOrders && props.pastOrders && props.preOrders
|
|
329
|
+
|
|
238
330
|
const MyOrdersProps = {
|
|
239
331
|
...props,
|
|
240
332
|
UIComponent: OrdersOptionUI,
|
|
241
|
-
orderStatus:
|
|
242
|
-
? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
243
|
-
:
|
|
333
|
+
orderStatus: getAllOrders
|
|
334
|
+
? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
|
335
|
+
: props.preOrders ? [13] : props.activeOrders
|
|
336
|
+
? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
337
|
+
: [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
|
|
244
338
|
useDefualtSessionManager: true,
|
|
339
|
+
paginationSettings: {
|
|
340
|
+
initialPage: 1,
|
|
341
|
+
pageSize: getAllOrders ? 30 : 10,
|
|
342
|
+
controlType: 'infinity'
|
|
343
|
+
}
|
|
245
344
|
}
|
|
246
345
|
|
|
247
346
|
return <OrderList {...MyOrdersProps} />
|
|
@@ -1,7 +1,10 @@
|
|
|
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
|
+
${(props : any) => props.titleContent && css`
|
|
6
|
+
margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
|
|
7
|
+
`}
|
|
5
8
|
`
|
|
6
9
|
|
|
7
10
|
export const NoOrdersWrapper = styled.View`
|
|
@@ -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,
|
|
@@ -41,13 +41,6 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
41
41
|
const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
42
42
|
const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
43
43
|
|
|
44
|
-
const styles = StyleSheet.create({
|
|
45
|
-
checkBoxStyle: {
|
|
46
|
-
width: 25,
|
|
47
|
-
height: 25,
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
44
|
const [checkedState, setCheckedState] = useState(
|
|
52
45
|
new Array(walletsState.result?.length).fill(false)
|
|
53
46
|
);
|
|
@@ -100,22 +93,23 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
100
93
|
<Container
|
|
101
94
|
key={wallet.id}
|
|
102
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}
|
|
103
98
|
>
|
|
104
99
|
<SectionLeft>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/>
|
|
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
|
+
)}
|
|
119
113
|
<View style={{ alignItems: 'baseline', marginLeft: 5 }}>
|
|
120
114
|
<View>
|
|
121
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) {
|
|
@@ -80,6 +82,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
80
82
|
return theme.images.general.stripes
|
|
81
83
|
case 'stripe_redirect':
|
|
82
84
|
return theme.images.general.stripesb
|
|
85
|
+
case 'apple_pay':
|
|
86
|
+
return theme.images.general.applePayMark
|
|
83
87
|
default:
|
|
84
88
|
return theme.images.general.creditCard
|
|
85
89
|
}
|
|
@@ -98,18 +102,18 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
98
102
|
// ]
|
|
99
103
|
|
|
100
104
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
if (cart?.balance > 0) {
|
|
106
|
+
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
107
|
+
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
108
|
+
handlePaymentMethodClickCustom(paymethod)
|
|
109
|
+
}
|
|
110
|
+
handlePaymethodClick(paymethod, isPopupMethod)
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
showToast(
|
|
110
114
|
ToastType.Error,
|
|
111
115
|
t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
|
|
112
|
-
|
|
116
|
+
;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
useEffect(() => {
|
|
@@ -134,39 +138,56 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
134
138
|
|
|
135
139
|
useEffect(() => {
|
|
136
140
|
if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
|
|
137
|
-
|
|
141
|
+
handlePlaceOrder(confirmApplePayPayment)
|
|
138
142
|
}
|
|
139
143
|
}, [paymethodData, paymethodSelected])
|
|
140
144
|
|
|
141
145
|
const renderPaymethods = ({ item }: any) => {
|
|
142
146
|
return (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
key={item.id}
|
|
148
|
-
isDisabled={isDisabled}
|
|
149
|
-
isActive={paymethodSelected?.id === item.id}
|
|
150
|
-
>
|
|
151
|
-
<OIcon
|
|
152
|
-
src={getPayIcon(item.gateway)}
|
|
153
|
-
width={20}
|
|
154
|
-
height={20}
|
|
155
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
156
|
-
/>
|
|
157
|
-
<OText
|
|
158
|
-
size={10}
|
|
159
|
-
style={{ margin: 0, marginTop: 4 }}
|
|
160
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
147
|
+
<>
|
|
148
|
+
{item?.gateway === 'apple_pay' ? (
|
|
149
|
+
<TouchableOpacity
|
|
150
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
161
151
|
>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
152
|
+
<OIcon
|
|
153
|
+
src={getPayIcon(item.gateway)}
|
|
154
|
+
width={70}
|
|
155
|
+
height={70}
|
|
156
|
+
style={{ marginRight: 10 }}
|
|
157
|
+
/>
|
|
158
|
+
</TouchableOpacity>
|
|
159
|
+
) : (
|
|
160
|
+
<TouchableOpacity
|
|
161
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
162
|
+
>
|
|
163
|
+
{console.log(item?.gateway)}
|
|
164
|
+
<PMItem
|
|
165
|
+
key={item.id}
|
|
166
|
+
isDisabled={isDisabled}
|
|
167
|
+
isActive={paymethodSelected?.id === item.id}
|
|
168
|
+
>
|
|
169
|
+
<OIcon
|
|
170
|
+
src={getPayIcon(item.gateway)}
|
|
171
|
+
width={20}
|
|
172
|
+
height={20}
|
|
173
|
+
color={item?.gateway === 'apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
174
|
+
/>
|
|
175
|
+
<OText
|
|
176
|
+
size={10}
|
|
177
|
+
style={{ margin: 0, marginTop: 4 }}
|
|
178
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
179
|
+
>
|
|
180
|
+
{t(item.gateway.toUpperCase(), item.name)}
|
|
181
|
+
</OText>
|
|
182
|
+
</PMItem>
|
|
183
|
+
</TouchableOpacity>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
|
|
166
187
|
)
|
|
167
188
|
}
|
|
168
189
|
|
|
169
|
-
const excludeIds: any = [32]; //exclude paypal & connect & redirect
|
|
190
|
+
const excludeIds: any = [32, 66]; //exclude paypal & connect & redirect
|
|
170
191
|
|
|
171
192
|
return (
|
|
172
193
|
<PMContainer>
|
|
@@ -214,7 +235,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
214
235
|
|
|
215
236
|
{paymethodSelected?.gateway === 'cash' && (
|
|
216
237
|
<PaymentOptionCash
|
|
217
|
-
orderTotal={cart.total}
|
|
238
|
+
orderTotal={cart.balance ?? cart.total}
|
|
218
239
|
defaultValue={paymethodSelected?.data?.cash}
|
|
219
240
|
onChangeData={handlePaymethodDataChange}
|
|
220
241
|
setErrorCash={props.setErrorCash}
|
|
@@ -22,9 +22,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
22
22
|
textStyle,
|
|
23
23
|
flagStyle,
|
|
24
24
|
noDropIcon,
|
|
25
|
-
|
|
26
|
-
isStartValidation
|
|
27
|
-
changeCountry
|
|
25
|
+
isDisabled,
|
|
26
|
+
isStartValidation
|
|
28
27
|
} = props
|
|
29
28
|
|
|
30
29
|
const theme = useTheme();
|
|
@@ -59,7 +58,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
useEffect(() => {
|
|
62
|
-
if ((defaultValue && userphoneNumber) || defaultValue
|
|
61
|
+
if ((defaultValue && userphoneNumber) || !defaultValue) {
|
|
63
62
|
if (userphoneNumber) {
|
|
64
63
|
const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
|
|
65
64
|
const callingCode = phoneInput.current?.getCallingCode();
|
|
@@ -107,16 +106,11 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
107
106
|
)}
|
|
108
107
|
<PhoneInput
|
|
109
108
|
ref={phoneInput}
|
|
110
|
-
|
|
109
|
+
disabled={isDisabled}
|
|
111
110
|
defaultValue={userphoneNumber || defaultValue}
|
|
112
|
-
defaultCode={defaultCode ?
|
|
113
|
-
!isNaN(defaultCode)
|
|
114
|
-
? transformCountryCode(defaultCode)
|
|
115
|
-
: defaultCode
|
|
116
|
-
: configs?.default_country_code?.value}
|
|
111
|
+
defaultCode={defaultCode ? transformCountryCode(defaultCode) : configs?.default_country_code?.value}
|
|
117
112
|
onChangeFormattedText={(text: string) => handleChangeNumber(text)}
|
|
118
113
|
withDarkTheme
|
|
119
|
-
onChangeCountry={(country) => changeCountry?.(country)}
|
|
120
114
|
countryPickerProps={{ withAlphaFilter: true }}
|
|
121
115
|
textContainerStyle={{ ...style.input, ...inputStyle ? inputStyle : {} }}
|
|
122
116
|
textInputStyle={textStyle}
|