ordering-ui-react-native 0.14.84 → 0.14.86-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -3
- package/src/DeliveryApp.tsx +34 -2
- package/src/assets/images/no-network.png +0 -0
- package/src/components/BusinessTypeFilter/index.tsx +9 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Cart/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +65 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +29 -6
- package/src/components/OrdersOption/index.tsx +4 -2
- package/src/components/PaymentOptions/index.tsx +7 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/providers/AlertProvider.tsx +4 -1
- package/src/theme.json +2 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +196 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- package/themes/business/src/components/NetworkError/index.tsx +61 -0
- package/themes/business/src/components/NetworkError/styles.tsx +11 -0
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +354 -54
- package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
- package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
- package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
- package/themes/business/src/types/index.tsx +4 -0
- package/themes/business/src/utils/index.tsx +12 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/doordash/src/components/OrderDetails/index.tsx +3 -1
- package/themes/doordash/src/components/OrdersOption/index.tsx +4 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/instacart/src/components/OrderDetails/index.tsx +3 -1
- package/themes/instacart/src/components/OrdersOption/index.tsx +4 -2
- package/themes/kiosk/index.tsx +2 -0
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- 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/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
- package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- 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/ProductForm/index.tsx +172 -124
- 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/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +4 -0
- package/themes/original/index.tsx +26 -6
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
- package/themes/original/src/components/BusinessController/index.tsx +3 -3
- package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
- package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
- package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
- package/themes/original/src/components/BusinessesListing/index.tsx +23 -22
- package/themes/original/src/components/Cart/index.tsx +43 -10
- package/themes/original/src/components/Checkout/index.tsx +54 -17
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
- package/themes/original/src/components/LastOrder/index.tsx +3 -1
- package/themes/original/src/components/LoginForm/index.tsx +83 -68
- package/themes/original/src/components/MessageListing/index.tsx +4 -2
- package/themes/original/src/components/Messages/index.tsx +19 -21
- package/themes/original/src/components/MomentOption/index.tsx +127 -152
- package/themes/original/src/components/MomentOption/styles.tsx +42 -18
- package/themes/original/src/components/NetworkError/index.tsx +61 -0
- package/themes/original/src/components/NetworkError/styles.tsx +11 -0
- package/themes/original/src/components/OrderDetails/index.tsx +106 -113
- package/themes/original/src/components/OrderProgress/index.tsx +6 -5
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +20 -42
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
- package/themes/original/src/components/ProductForm/index.tsx +35 -20
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
- package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
- package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
- package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
- package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
- package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +13 -6
- package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
- package/themes/original/src/types/index.tsx +47 -10
- package/themes/single-business/src/components/LastOrder/index.tsx +3 -1
- package/themes/single-business/src/components/OrderDetails/index.tsx +15 -0
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/single-business/src/components/OrdersOption/index.tsx +4 -2
- package/themes/single-business/src/utils/index.tsx +7 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/uber-eats/src/components/OrderDetails/index.tsx +3 -1
- package/themes/uber-eats/src/components/OrdersOption/index.tsx +4 -2
- package/src/components/StripeMethodForm/index.tsx +0 -163
|
@@ -39,7 +39,8 @@ import {
|
|
|
39
39
|
ChCart,
|
|
40
40
|
DeliveryOptionsContainer,
|
|
41
41
|
DeliveryOptionItem,
|
|
42
|
-
WalletPaymentOptionContainer
|
|
42
|
+
WalletPaymentOptionContainer,
|
|
43
|
+
CartHeader
|
|
43
44
|
} from './styles';
|
|
44
45
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
45
46
|
|
|
@@ -131,9 +132,11 @@ const CheckoutUI = (props: any) => {
|
|
|
131
132
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
132
133
|
const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
|
|
133
134
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
|
|
136
|
+
const placeSpotTypes = [3, 4]
|
|
136
137
|
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
138
|
+
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
139
|
+
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place)
|
|
137
140
|
|
|
138
141
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
139
142
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -149,6 +152,12 @@ const CheckoutUI = (props: any) => {
|
|
|
149
152
|
}
|
|
150
153
|
})
|
|
151
154
|
|
|
155
|
+
const handleMomentClick = () => {
|
|
156
|
+
if (isPreOrder) {
|
|
157
|
+
navigation.navigate('MomentOption')
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
152
161
|
const handlePlaceOrder = () => {
|
|
153
162
|
if (!userErrors.length) {
|
|
154
163
|
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
@@ -193,8 +202,8 @@ const CheckoutUI = (props: any) => {
|
|
|
193
202
|
if (
|
|
194
203
|
!user?.cellphone &&
|
|
195
204
|
((validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
196
|
-
|
|
197
|
-
|
|
205
|
+
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
206
|
+
configs?.verification_phone_required?.value === '1')
|
|
198
207
|
) {
|
|
199
208
|
errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
|
|
200
209
|
}
|
|
@@ -260,7 +269,7 @@ const CheckoutUI = (props: any) => {
|
|
|
260
269
|
/>
|
|
261
270
|
</CHMomentWrapper>
|
|
262
271
|
<CHMomentWrapper
|
|
263
|
-
onPress={() =>
|
|
272
|
+
onPress={() => handleMomentClick()}
|
|
264
273
|
disabled={loading}
|
|
265
274
|
>
|
|
266
275
|
<OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
|
|
@@ -268,11 +277,13 @@ const CheckoutUI = (props: any) => {
|
|
|
268
277
|
? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
269
278
|
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
270
279
|
</OText>
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
280
|
+
{isPreOrder && (
|
|
281
|
+
<OIcon
|
|
282
|
+
src={theme.images.general.arrow_down}
|
|
283
|
+
width={10}
|
|
284
|
+
style={{ marginStart: 8 }}
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
276
287
|
</CHMomentWrapper>
|
|
277
288
|
</ChHeader>
|
|
278
289
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
|
|
@@ -535,7 +546,6 @@ const CheckoutUI = (props: any) => {
|
|
|
535
546
|
onNavigationRedirect={onNavigationRedirect}
|
|
536
547
|
paySelected={paymethodSelected}
|
|
537
548
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
538
|
-
handlePlaceOrder={handlePlaceOrder}
|
|
539
549
|
/>
|
|
540
550
|
</ChPaymethods>
|
|
541
551
|
</ChSection>
|
|
@@ -561,9 +571,28 @@ const CheckoutUI = (props: any) => {
|
|
|
561
571
|
/>
|
|
562
572
|
) : (
|
|
563
573
|
<>
|
|
564
|
-
<
|
|
565
|
-
|
|
566
|
-
|
|
574
|
+
<CartHeader>
|
|
575
|
+
<OText
|
|
576
|
+
size={16}
|
|
577
|
+
lineHeight={24}
|
|
578
|
+
color={theme.colors.textNormal}
|
|
579
|
+
style={{ fontWeight: '500' }}
|
|
580
|
+
>
|
|
581
|
+
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
582
|
+
</OText>
|
|
583
|
+
<TouchableOpacity
|
|
584
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
585
|
+
>
|
|
586
|
+
<OText
|
|
587
|
+
size={10}
|
|
588
|
+
lineHeight={15}
|
|
589
|
+
color={theme.colors.primary}
|
|
590
|
+
style={{ textDecorationLine: 'underline' }}
|
|
591
|
+
>
|
|
592
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
593
|
+
</OText>
|
|
594
|
+
</TouchableOpacity>
|
|
595
|
+
</CartHeader>
|
|
567
596
|
{props.isFranchiseApp && (
|
|
568
597
|
<TouchableOpacity
|
|
569
598
|
onPress={() => setOpenChangeStore(true)}
|
|
@@ -619,6 +648,14 @@ const CheckoutUI = (props: any) => {
|
|
|
619
648
|
{t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')}
|
|
620
649
|
</OText>
|
|
621
650
|
)}
|
|
651
|
+
{placeSpotTypes.includes(options?.type) && !cart?.place && (
|
|
652
|
+
<OText
|
|
653
|
+
color={theme.colors.error}
|
|
654
|
+
size={12}
|
|
655
|
+
>
|
|
656
|
+
{t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
|
|
657
|
+
</OText>
|
|
658
|
+
)}
|
|
622
659
|
</ChErrors>
|
|
623
660
|
</View>
|
|
624
661
|
)}
|
|
@@ -638,8 +675,8 @@ const CheckoutUI = (props: any) => {
|
|
|
638
675
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
639
676
|
<FloatingButton
|
|
640
677
|
handleClick={() => handlePlaceOrder()}
|
|
641
|
-
isSecondaryBtn={
|
|
642
|
-
disabled={
|
|
678
|
+
isSecondaryBtn={isDisabledButtonPlace}
|
|
679
|
+
disabled={isDisabledButtonPlace}
|
|
643
680
|
btnText={cart?.subtotal >= cart?.minimum
|
|
644
681
|
? (
|
|
645
682
|
placing
|
|
@@ -105,3 +105,10 @@ export const DeliveryOptionItem = styled.View`
|
|
|
105
105
|
flex-direction: row;
|
|
106
106
|
background-color: ${(props : any) => props?.backgroundColor ?? '#fff'};
|
|
107
107
|
`;
|
|
108
|
+
|
|
109
|
+
export const CartHeader = styled.View`
|
|
110
|
+
align-items: center;
|
|
111
|
+
flex-direction: row;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
margin-bottom: 10px;
|
|
114
|
+
`
|
|
@@ -63,7 +63,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
63
63
|
return (
|
|
64
64
|
<DTContainer>
|
|
65
65
|
<DTWrapperTips>
|
|
66
|
-
{driverTipsOptions.map((option: any, i: number) => (
|
|
66
|
+
{driverTipsOptions.map((option: any, i: number) => (
|
|
67
67
|
<TouchableOpacity
|
|
68
68
|
key={i}
|
|
69
69
|
onPress={() => handlerChangeOption(option)}
|
|
@@ -65,18 +65,6 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
65
65
|
}
|
|
66
66
|
}, [formState])
|
|
67
67
|
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (Object.keys(errors).length > 0) {
|
|
70
|
-
// Convert all errors in one string to show in toast provider
|
|
71
|
-
const list = Object.values(errors)
|
|
72
|
-
let stringError = ''
|
|
73
|
-
list.map((item: any, i: number) => {
|
|
74
|
-
stringError += (i + 1) === list.length ? `- ${item.message}` : `- ${item.message}\n`
|
|
75
|
-
})
|
|
76
|
-
showToast(ToastType.Error, stringError)
|
|
77
|
-
}
|
|
78
|
-
}, [errors])
|
|
79
|
-
|
|
80
68
|
return (
|
|
81
69
|
<Container>
|
|
82
70
|
<NavBar
|
|
@@ -100,6 +88,14 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
100
88
|
{t('FORGOT_PASSWORD_TEXT_MESSAGE', "Enter your email address and we'll sent a link to reset your password.")}
|
|
101
89
|
</OText>
|
|
102
90
|
<FormInput>
|
|
91
|
+
{errors?.email && (
|
|
92
|
+
<OText
|
|
93
|
+
size={14}
|
|
94
|
+
color={theme.colors.danger5}
|
|
95
|
+
weight={'normal'}>
|
|
96
|
+
{errors?.email?.message}{errors?.email?.type === 'required' && '*'}
|
|
97
|
+
</OText>
|
|
98
|
+
)}
|
|
103
99
|
<Controller
|
|
104
100
|
control={control}
|
|
105
101
|
render={({ onChange, value }: any) => (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
BusinessList as BusinessesListingController,
|
|
4
4
|
useLanguage,
|
|
@@ -18,7 +18,9 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
18
18
|
const {
|
|
19
19
|
businessesList,
|
|
20
20
|
onBusinessClick,
|
|
21
|
-
navigation
|
|
21
|
+
navigation,
|
|
22
|
+
isLoading,
|
|
23
|
+
getBusinesses
|
|
22
24
|
} = props;
|
|
23
25
|
|
|
24
26
|
const [, t] = useLanguage()
|
|
@@ -26,6 +28,11 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
26
28
|
|
|
27
29
|
const windowWidth = Dimensions.get('window').width;
|
|
28
30
|
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (businessesList?.loading || !isLoading) return
|
|
33
|
+
getBusinesses(true)
|
|
34
|
+
}, [isLoading])
|
|
35
|
+
|
|
29
36
|
return (
|
|
30
37
|
<>
|
|
31
38
|
<ListWrapper>
|
|
@@ -91,7 +91,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
91
91
|
{ key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
|
|
92
92
|
{ key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
|
|
93
93
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
|
|
94
|
-
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') }
|
|
94
|
+
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
|
|
95
|
+
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
|
|
96
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
|
|
95
97
|
]
|
|
96
98
|
|
|
97
99
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -67,7 +67,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
67
67
|
const [, t] = useLanguage();
|
|
68
68
|
const [{ configs }] = useConfig();
|
|
69
69
|
const [, { login }] = useSession();
|
|
70
|
-
const { control, handleSubmit, errors } = useForm();
|
|
70
|
+
const { control, handleSubmit, errors, reset, register, setValue } = useForm();
|
|
71
71
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
72
72
|
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
73
73
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
@@ -91,7 +91,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
91
91
|
inputStyle: {
|
|
92
92
|
marginBottom: 28,
|
|
93
93
|
borderWidth: 1,
|
|
94
|
-
borderColor: theme.colors.border,
|
|
94
|
+
// borderColor: theme.colors.border,
|
|
95
95
|
borderRadius: 7.6,
|
|
96
96
|
},
|
|
97
97
|
line: {
|
|
@@ -189,33 +189,21 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
189
189
|
}, [verifyPhoneState]);
|
|
190
190
|
|
|
191
191
|
useEffect(() => {
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
208
|
-
'The field Mobile phone is required.',
|
|
209
|
-
),
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
list.map((item: any, i: number) => {
|
|
213
|
-
stringError +=
|
|
214
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
215
|
-
});
|
|
216
|
-
showToast(ToastType.Error, stringError);
|
|
217
|
-
}
|
|
218
|
-
}, [errors]);
|
|
192
|
+
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
193
|
+
else setValue('cellphone', '')
|
|
194
|
+
}, [phoneInputData?.phone?.cellphone])
|
|
195
|
+
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
register('cellphone', {
|
|
198
|
+
required: loginTab === 'cellphone'
|
|
199
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
200
|
+
: null
|
|
201
|
+
})
|
|
202
|
+
}, [register])
|
|
203
|
+
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
reset()
|
|
206
|
+
}, [loginTab])
|
|
219
207
|
|
|
220
208
|
return (
|
|
221
209
|
<Container>
|
|
@@ -284,43 +272,58 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
284
272
|
{(useLoginByCellphone || useLoginByEmail) && (
|
|
285
273
|
<FormInput>
|
|
286
274
|
{useLoginByEmail && loginTab === 'email' && (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
handleChangeInputEmail(e, onChange);
|
|
296
|
-
}}
|
|
297
|
-
value={value}
|
|
298
|
-
autoCapitalize="none"
|
|
299
|
-
autoCorrect={false}
|
|
300
|
-
type="email-address"
|
|
301
|
-
autoCompleteType="email"
|
|
302
|
-
returnKeyType="next"
|
|
303
|
-
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
304
|
-
blurOnSubmit={false}
|
|
305
|
-
forwardRef={emailRef}
|
|
306
|
-
/>
|
|
275
|
+
<>
|
|
276
|
+
{errors?.email && (
|
|
277
|
+
<OText
|
|
278
|
+
size={14}
|
|
279
|
+
color={theme.colors.danger5}
|
|
280
|
+
weight={'normal'}>
|
|
281
|
+
{errors?.email?.message}{errors?.email?.type === 'required' && '*'}
|
|
282
|
+
</OText>
|
|
307
283
|
)}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
284
|
+
<Controller
|
|
285
|
+
control={control}
|
|
286
|
+
render={({ onChange, value }: any) => (
|
|
287
|
+
<OInput
|
|
288
|
+
placeholder={t('EMAIL', 'Email')}
|
|
289
|
+
style={loginStyle.inputStyle}
|
|
290
|
+
icon={theme.images.general.email}
|
|
291
|
+
onChange={(e: any) => {
|
|
292
|
+
handleChangeInputEmail(e, onChange);
|
|
293
|
+
}}
|
|
294
|
+
value={value}
|
|
295
|
+
autoCapitalize="none"
|
|
296
|
+
autoCorrect={false}
|
|
297
|
+
type="email-address"
|
|
298
|
+
autoCompleteType="email"
|
|
299
|
+
returnKeyType="next"
|
|
300
|
+
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
301
|
+
blurOnSubmit={false}
|
|
302
|
+
forwardRef={emailRef}
|
|
303
|
+
borderColor={errors?.email ? theme.colors.danger5 : theme.colors.border}
|
|
304
|
+
/>
|
|
305
|
+
)}
|
|
306
|
+
name="email"
|
|
307
|
+
rules={{
|
|
308
|
+
required: {
|
|
309
|
+
value: true,
|
|
310
|
+
message: t(
|
|
311
|
+
'VALIDATION_ERROR_EMAIL_REQUIRED',
|
|
312
|
+
'The field Email is required',
|
|
313
|
+
).replace('_attribute_', t('EMAIL', 'Email'))
|
|
314
|
+
},
|
|
315
|
+
pattern: {
|
|
316
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
317
|
+
message: t(
|
|
318
|
+
'INVALID_ERROR_EMAIL',
|
|
319
|
+
'Invalid email address',
|
|
320
|
+
).replace('_attribute_', t('EMAIL', 'Email')),
|
|
321
|
+
}
|
|
322
|
+
}}
|
|
323
|
+
defaultValue=""
|
|
324
|
+
/>
|
|
325
|
+
</>
|
|
326
|
+
|
|
324
327
|
)}
|
|
325
328
|
{useLoginByCellphone && loginTab === 'cellphone' && (
|
|
326
329
|
<View style={{ marginBottom: 28 }}>
|
|
@@ -331,10 +334,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
331
334
|
returnKeyType: 'next',
|
|
332
335
|
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
333
336
|
}}
|
|
337
|
+
isStartValidation={errors?.cellphone}
|
|
334
338
|
/>
|
|
335
339
|
</View>
|
|
336
340
|
)}
|
|
337
|
-
|
|
341
|
+
{errors?.password && (
|
|
342
|
+
<OText
|
|
343
|
+
size={14}
|
|
344
|
+
color={theme.colors.danger5}
|
|
345
|
+
weight={'normal'}>
|
|
346
|
+
{errors?.password?.message}{errors?.password?.type === 'required' && '*'}
|
|
347
|
+
</OText>
|
|
348
|
+
)}
|
|
338
349
|
<Controller
|
|
339
350
|
control={control}
|
|
340
351
|
render={({ onChange, value }: any) => (
|
|
@@ -366,14 +377,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
366
377
|
returnKeyType="done"
|
|
367
378
|
onSubmitEditing={handleSubmit(onSubmit)}
|
|
368
379
|
blurOnSubmit
|
|
380
|
+
borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
|
|
369
381
|
/>
|
|
370
382
|
)}
|
|
371
383
|
name="password"
|
|
372
384
|
rules={{
|
|
373
|
-
required:
|
|
385
|
+
required: {
|
|
386
|
+
value: true,
|
|
387
|
+
message: t(
|
|
374
388
|
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
375
389
|
'The field Password is required',
|
|
376
|
-
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
390
|
+
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
391
|
+
}
|
|
377
392
|
}}
|
|
378
393
|
defaultValue=""
|
|
379
394
|
/>
|
|
@@ -73,7 +73,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
73
73
|
{ key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
|
|
74
74
|
{ key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
|
|
75
75
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
|
|
76
|
-
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') }
|
|
76
|
+
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
|
|
77
|
+
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
|
|
78
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
|
|
77
79
|
]
|
|
78
80
|
|
|
79
81
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -218,7 +220,7 @@ export const OrderListing = (props: OrdersOptionParams) => {
|
|
|
218
220
|
const OrderListingProps = {
|
|
219
221
|
...props,
|
|
220
222
|
UIComponent: OrdersOptionUI,
|
|
221
|
-
orderStatus: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21],
|
|
223
|
+
orderStatus: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
222
224
|
useDefualtSessionManager: true,
|
|
223
225
|
paginationSettings: {
|
|
224
226
|
initialPage: 1,
|
|
@@ -35,6 +35,8 @@ const ORDER_STATUS: any = {
|
|
|
35
35
|
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
36
36
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
37
37
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
38
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
39
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
const filterSpecialStatus = ['prepared_in', 'delivered_in']
|
|
@@ -95,28 +97,18 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
const handleImagePicker = () => {
|
|
98
|
-
launchImageLibrary({ mediaType: 'photo', maxHeight:
|
|
99
|
-
if (response
|
|
100
|
-
|
|
101
|
-
} else if (response
|
|
102
|
-
console.log('ImagePicker Error: ', response.errorMessage);
|
|
100
|
+
launchImageLibrary({ mediaType: 'photo', maxHeight: 2048, maxWidth: 2048, includeBase64: true }, (response: any) => {
|
|
101
|
+
if (response?.didCancel) {
|
|
102
|
+
showToast(ToastType.Error, t('IMAGE_CANCELLED', 'User cancelled image picker'));
|
|
103
|
+
} else if (response?.errorMessage) {
|
|
103
104
|
showToast(ToastType.Error, response.errorMessage);
|
|
104
105
|
} else {
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} else {
|
|
110
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
111
|
-
}
|
|
106
|
+
if (response?.assets?.length > 0) {
|
|
107
|
+
const image = response?.assets[0]
|
|
108
|
+
const url = `data:${image.type};base64,${image.base64}`
|
|
109
|
+
setImage && setImage(url);
|
|
112
110
|
} else {
|
|
113
|
-
|
|
114
|
-
const image = response?.assets[0]
|
|
115
|
-
const url = `data:${image.type};base64,${image.base64}`
|
|
116
|
-
setImage && setImage(url);
|
|
117
|
-
} else {
|
|
118
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
119
|
-
}
|
|
111
|
+
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
114
|
});
|
|
@@ -235,7 +227,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
235
227
|
{image && (
|
|
236
228
|
<TouchableOpacity
|
|
237
229
|
style={{ position: 'absolute', top: -5, right: -5, borderColor: theme.colors.backgroundDark, backgroundColor: theme.colors.white, borderRadius: 25 }}
|
|
238
|
-
onPress={
|
|
230
|
+
onPress={removeImage}
|
|
239
231
|
>
|
|
240
232
|
<MaterialCommunityIcon name='close-circle-outline' color={theme.colors.backgroundDark} size={24} />
|
|
241
233
|
</TouchableOpacity>
|
|
@@ -543,9 +535,15 @@ const styles = StyleSheet.create({
|
|
|
543
535
|
})
|
|
544
536
|
|
|
545
537
|
export const Messages = (props: MessagesParams) => {
|
|
538
|
+
const [allMessages, setAllMessages] = useState(props.messages)
|
|
546
539
|
const MessagesProps = {
|
|
547
540
|
...props,
|
|
548
|
-
UIComponent: MessagesUI
|
|
541
|
+
UIComponent: MessagesUI,
|
|
542
|
+
messages: allMessages,
|
|
543
|
+
setMessages: (values: any) => {
|
|
544
|
+
props.setMessages && props.setMessages(values)
|
|
545
|
+
setAllMessages(values)
|
|
546
|
+
}
|
|
549
547
|
}
|
|
550
548
|
return <MessagesController {...MessagesProps} />
|
|
551
549
|
}
|