ordering-ui-react-native 0.15.67 → 0.15.68-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/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +1 -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 +22 -24
- 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 -2
- package/themes/business/index.tsx +4 -0
- 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/DriverSchedule/index.tsx +71 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- 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/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
- package/themes/business/src/components/shared/OModal.tsx +41 -38
- 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 +6 -8
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +304 -158
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +195 -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 +53 -52
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +318 -155
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +32 -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/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +679 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +99 -458
- package/themes/original/src/components/Cart/index.tsx +61 -42
- 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/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 +148 -63
- 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 +79 -35
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- 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 +215 -90
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- 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 +11 -2
- 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 +25 -12
- package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
- package/themes/original/src/components/shared/OButton.tsx +2 -0
- 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 +187 -35
- package/themes/original/src/utils/index.tsx +94 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -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}
|
|
@@ -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,152 +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
|
-
{order.cart && (
|
|
147
|
-
<OButton
|
|
148
|
-
text={t('REORDER', 'Reorder')}
|
|
149
|
-
imgRightSrc={''}
|
|
150
|
-
textStyle={styles.buttonText}
|
|
151
|
-
style={
|
|
152
|
-
reorderLoading && order.id === reorderSelected
|
|
153
|
-
? styles.reorderLoading
|
|
154
|
-
: styles.reorderbutton
|
|
155
|
-
}
|
|
156
|
-
onClick={() => handleReorderClick(order.id)}
|
|
157
|
-
isLoading={reorderLoading && order.id === reorderSelected}
|
|
158
|
-
/>
|
|
159
|
-
)}
|
|
160
|
-
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
161
|
-
!order.review && (
|
|
162
|
-
<TouchableOpacity
|
|
163
|
-
onPress={() => handleClickOrderReview(order)}
|
|
164
|
-
style={styles.reviewButton}>
|
|
165
|
-
<OText size={10} color={theme.colors.primary} numberOfLines={1}>
|
|
166
|
-
{t('REVIEW', 'Review')}
|
|
167
|
-
</OText>
|
|
168
|
-
</TouchableOpacity>
|
|
169
|
-
)}
|
|
170
|
-
</Status>
|
|
171
|
-
</Card>
|
|
172
|
-
</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
|
+
/>
|
|
173
44
|
))}
|
|
174
45
|
{pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
175
46
|
<WrappButton>
|