ordering-ui-react-native 0.14.0 → 0.14.4
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 +1 -1
- package/src/components/AppleLogin/index.tsx +11 -5
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/VerifyPhone/index.tsx +1 -1
- package/themes/original/src/components/Checkout/index.tsx +101 -29
- package/themes/original/src/components/Checkout/styles.tsx +13 -0
- package/themes/original/src/components/FacebookLogin/index.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +16 -8
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -1
- package/themes/uber-eats/src/components/ProductForm/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import { appleAuthAndroid, appleAuth } from '@invertase/react-native-apple-authentication';
|
|
4
4
|
import { useConfig, useApi, useLanguage } from 'ordering-components/native'
|
|
@@ -22,7 +22,7 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
22
22
|
const [ordering] = useApi()
|
|
23
23
|
const [, t] = useLanguage()
|
|
24
24
|
const theme = useTheme()
|
|
25
|
-
|
|
25
|
+
const [errors, setError] = useState<any>({type: '', message: ''})
|
|
26
26
|
const buttonText = t('LOGIN_WITH_APPLE', 'Login with Apple');
|
|
27
27
|
|
|
28
28
|
const onAppleButtonPress = async () => {
|
|
@@ -45,16 +45,16 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
45
45
|
identityToken,
|
|
46
46
|
authorizationCode,
|
|
47
47
|
} = appleAuthRequestResponse
|
|
48
|
-
|
|
49
|
-
if (identityToken && authorizationCode) {
|
|
48
|
+
if (identityToken) {
|
|
50
49
|
console.log('auth code: ', authorizationCode)
|
|
51
|
-
handleLoginApple(
|
|
50
|
+
handleLoginApple(identityToken)
|
|
52
51
|
console.warn(`Apple Authentication Completed, ${user}, ${email}`);
|
|
53
52
|
} else {
|
|
54
53
|
handleErrors && handleErrors(t('ERROR_LOGIN_APPLE', 'Error login with apple'))
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
} catch (error: any) {
|
|
57
|
+
setError({ type: 'FROM_APPLE', message: error?.message })
|
|
58
58
|
handleErrors && handleErrors(error.message)
|
|
59
59
|
}
|
|
60
60
|
} else {
|
|
@@ -106,6 +106,7 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
106
106
|
handleErrors && handleErrors(result || t('ERROR_LOGIN_AUTH_APPLE', 'Error login auth with apple'))
|
|
107
107
|
}
|
|
108
108
|
} catch (error: any) {
|
|
109
|
+
setError({ type: 'FROM_API', message: error?.message })
|
|
109
110
|
handleLoading && handleLoading(false)
|
|
110
111
|
handleErrors && handleErrors(error?.message)
|
|
111
112
|
}
|
|
@@ -120,6 +121,11 @@ export const AppleLogin = (props: AppleLoginParams) => {
|
|
|
120
121
|
|
|
121
122
|
return (
|
|
122
123
|
<Container>
|
|
124
|
+
{!!errors?.message && !!errors?.type && (
|
|
125
|
+
<OText>
|
|
126
|
+
{errors?.type} {errors?.message}
|
|
127
|
+
</OText>
|
|
128
|
+
)}
|
|
123
129
|
<AppleButton
|
|
124
130
|
onPress={onAppleButtonPress}
|
|
125
131
|
>
|
|
@@ -55,7 +55,6 @@ import { ActivityIndicator } from 'react-native-paper';
|
|
|
55
55
|
import WebView from 'react-native-webview';
|
|
56
56
|
import Icon from 'react-native-vector-icons/Feather';
|
|
57
57
|
import { OrderCreating } from '../OrderCreating';
|
|
58
|
-
import { Item } from '../../../themes/uber-eats/src/components/UpsellingProducts/styles';
|
|
59
58
|
|
|
60
59
|
const mapConfigs = {
|
|
61
60
|
mapZoom: 16,
|
|
@@ -196,7 +196,7 @@ export const VerifyPhone = (props: any) => {
|
|
|
196
196
|
<WrappCountdown>
|
|
197
197
|
<CountDownContainer color={timer === '00:00' ? theme.colors.error: theme.colors.success}>
|
|
198
198
|
<OText
|
|
199
|
-
size={
|
|
199
|
+
size={28}
|
|
200
200
|
color={timer === '00:00' ? theme.colors.error: theme.colors.success}
|
|
201
201
|
>
|
|
202
202
|
{timer}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
|
-
|
|
4
|
+
import Picker from 'react-native-country-picker-modal';
|
|
5
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
5
6
|
import {
|
|
6
7
|
Checkout as CheckoutController,
|
|
7
8
|
useOrder,
|
|
@@ -22,7 +23,6 @@ import { PaymentOptions } from '../PaymentOptions';
|
|
|
22
23
|
import { DriverTips } from '../DriverTips';
|
|
23
24
|
import { NotFoundSource } from '../NotFoundSource';
|
|
24
25
|
import { UserDetails } from '../UserDetails';
|
|
25
|
-
import { OrderTypeSelector } from '../OrderTypeSelector'
|
|
26
26
|
|
|
27
27
|
import {
|
|
28
28
|
ChContainer,
|
|
@@ -35,7 +35,9 @@ import {
|
|
|
35
35
|
ChErrors,
|
|
36
36
|
ChBusinessDetails,
|
|
37
37
|
ChUserDetails,
|
|
38
|
-
ChCart
|
|
38
|
+
ChCart,
|
|
39
|
+
DeliveryOptionsContainer,
|
|
40
|
+
DeliveryOptionItem
|
|
39
41
|
} from './styles';
|
|
40
42
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
41
43
|
|
|
@@ -74,9 +76,9 @@ const CheckoutUI = (props: any) => {
|
|
|
74
76
|
handlePaymethodChange,
|
|
75
77
|
handlerClickPlaceOrder,
|
|
76
78
|
onNavigationRedirect,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
deliveryOptionSelected,
|
|
80
|
+
instructionsOptions,
|
|
81
|
+
handleChangeDeliveryOption,
|
|
80
82
|
} = props
|
|
81
83
|
|
|
82
84
|
const theme = useTheme();
|
|
@@ -91,9 +93,18 @@ const CheckoutUI = (props: any) => {
|
|
|
91
93
|
justifyContent: 'flex-start',
|
|
92
94
|
paddingLeft: 0,
|
|
93
95
|
},
|
|
96
|
+
paddSection: {
|
|
97
|
+
padding: 20
|
|
98
|
+
},
|
|
94
99
|
pagePadding: {
|
|
95
100
|
paddingLeft: 40,
|
|
96
101
|
paddingRight: 40
|
|
102
|
+
},
|
|
103
|
+
icon: {
|
|
104
|
+
top: 15,
|
|
105
|
+
right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
fontSize: 20
|
|
97
108
|
}
|
|
98
109
|
})
|
|
99
110
|
|
|
@@ -109,6 +120,7 @@ const CheckoutUI = (props: any) => {
|
|
|
109
120
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
110
121
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
111
122
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
123
|
+
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
112
124
|
|
|
113
125
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
114
126
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -118,6 +130,12 @@ const CheckoutUI = (props: any) => {
|
|
|
118
130
|
|
|
119
131
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
120
132
|
|
|
133
|
+
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
134
|
+
return {
|
|
135
|
+
value: option?.id, key: option?.id, label: option?.name
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
|
|
121
139
|
const handlePlaceOrder = () => {
|
|
122
140
|
if (!userErrors.length) {
|
|
123
141
|
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
@@ -131,6 +149,11 @@ const CheckoutUI = (props: any) => {
|
|
|
131
149
|
setIsUserDetailsEdit(true)
|
|
132
150
|
}
|
|
133
151
|
|
|
152
|
+
const changeDeliveryOption = (option: any) => {
|
|
153
|
+
handleChangeDeliveryOption(option)
|
|
154
|
+
setIsDeliveryOptionModalVisible(false)
|
|
155
|
+
}
|
|
156
|
+
|
|
134
157
|
const checkValidationFields = () => {
|
|
135
158
|
setUserErrors([])
|
|
136
159
|
const errors = []
|
|
@@ -307,7 +330,56 @@ const CheckoutUI = (props: any) => {
|
|
|
307
330
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
308
331
|
</ChSection>
|
|
309
332
|
|
|
310
|
-
|
|
333
|
+
{!cartState.loading && deliveryOptionSelected !== undefined && options?.type === 1 && (
|
|
334
|
+
<DeliveryOptionsContainer>
|
|
335
|
+
<OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
|
|
336
|
+
<View
|
|
337
|
+
style={{
|
|
338
|
+
backgroundColor: theme.colors.inputDisabled,
|
|
339
|
+
borderRadius: 7.5,
|
|
340
|
+
marginBottom: 20,
|
|
341
|
+
flex: 1
|
|
342
|
+
}}>
|
|
343
|
+
<Picker
|
|
344
|
+
countryCode={undefined}
|
|
345
|
+
visible={isDeliveryOptionModalVisible}
|
|
346
|
+
onClose={() => setIsDeliveryOptionModalVisible(false)}
|
|
347
|
+
withCountryNameButton
|
|
348
|
+
renderFlagButton={() => (
|
|
349
|
+
<TouchableOpacity onPress={() => setIsDeliveryOptionModalVisible(true)}>
|
|
350
|
+
<DeliveryOptionItem backgroundColor={theme?.colors?.inputDisabled}>
|
|
351
|
+
<OText
|
|
352
|
+
size={14}
|
|
353
|
+
>
|
|
354
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
|
|
355
|
+
</OText>
|
|
356
|
+
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
357
|
+
</DeliveryOptionItem>
|
|
358
|
+
</TouchableOpacity>
|
|
359
|
+
)}
|
|
360
|
+
flatListProps={{
|
|
361
|
+
keyExtractor: (item: any) => item.value,
|
|
362
|
+
data: deliveryOptions || [],
|
|
363
|
+
renderItem: ({ item }: any) => (
|
|
364
|
+
<TouchableOpacity
|
|
365
|
+
onPress={() => changeDeliveryOption(item.value)}
|
|
366
|
+
disabled={
|
|
367
|
+
deliveryOptionSelected === item.value
|
|
368
|
+
}
|
|
369
|
+
>
|
|
370
|
+
<DeliveryOptionItem backgroundColor={deliveryOptionSelected === item.value ? theme.colors.inputDisabled : 'white'}>
|
|
371
|
+
<OText>
|
|
372
|
+
{item.label}
|
|
373
|
+
</OText>
|
|
374
|
+
</DeliveryOptionItem>
|
|
375
|
+
</TouchableOpacity>
|
|
376
|
+
)
|
|
377
|
+
}}
|
|
378
|
+
/>
|
|
379
|
+
</View>
|
|
380
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
381
|
+
</DeliveryOptionsContainer>
|
|
382
|
+
)}
|
|
311
383
|
|
|
312
384
|
{!cartState.loading && (cart?.status === 2 || cart?.status === 4) && (
|
|
313
385
|
<ChSection style={{ paddingBottom: 20 }}>
|
|
@@ -429,27 +501,27 @@ const CheckoutUI = (props: any) => {
|
|
|
429
501
|
)}
|
|
430
502
|
|
|
431
503
|
{!cartState.loading && cart && (
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
504
|
+
<ChSection>
|
|
505
|
+
<ChCart>
|
|
506
|
+
{cartsWithProducts && cart?.products?.length === 0 ? (
|
|
507
|
+
<NotFoundSource
|
|
508
|
+
content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
|
|
509
|
+
btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
|
|
510
|
+
/>
|
|
511
|
+
) : (
|
|
512
|
+
<>
|
|
513
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal}>
|
|
514
|
+
{t('ORDER_SUMMARY', 'Order Summary')}
|
|
515
|
+
</OText>
|
|
516
|
+
<OrderSummary
|
|
517
|
+
cart={cart}
|
|
518
|
+
isCartPending={cart?.status === 2}
|
|
519
|
+
/>
|
|
520
|
+
</>
|
|
521
|
+
)}
|
|
522
|
+
</ChCart>
|
|
523
|
+
</ChSection>
|
|
524
|
+
)}
|
|
453
525
|
|
|
454
526
|
{!cartState.loading && cart && (
|
|
455
527
|
<ChSection style={{ paddingTop: 0, paddingBottom: 20, paddingHorizontal: 20 }}>
|
|
@@ -87,3 +87,16 @@ export const ChErrors = styled.View`
|
|
|
87
87
|
align-items: center;
|
|
88
88
|
margin-bottom: 20px;
|
|
89
89
|
`
|
|
90
|
+
|
|
91
|
+
export const DeliveryOptionsContainer = styled.View`
|
|
92
|
+
flex: 1;
|
|
93
|
+
margin-top: 10px;
|
|
94
|
+
`
|
|
95
|
+
|
|
96
|
+
export const DeliveryOptionItem = styled.View`
|
|
97
|
+
padding: 15px;
|
|
98
|
+
justify-content: ${(props : any) => props.center ? 'center' : 'space-between'};
|
|
99
|
+
align-items: center;
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
background-color: ${(props : any) => props?.backgroundColor ?? '#fff'};
|
|
102
|
+
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, Text } from 'react-native';
|
|
3
|
-
import { AccessToken, LoginManager } from 'react-native-fbsdk';
|
|
3
|
+
import { AccessToken, LoginManager } from 'react-native-fbsdk-next';
|
|
4
4
|
import { useLanguage, useSession, useApi } from 'ordering-components/native';
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
6
6
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
|
@@ -597,6 +597,22 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
597
597
|
</OText>
|
|
598
598
|
</InfoBlock>
|
|
599
599
|
</Customer>
|
|
600
|
+
{order?.delivery_option !== undefined && order?.delivery_type === 1 && (
|
|
601
|
+
<View style={{ marginTop: 15 }}>
|
|
602
|
+
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
603
|
+
{t('DELIVERY_PREFERENCE', 'Delivery Preference')}
|
|
604
|
+
</OText>
|
|
605
|
+
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.delivery_option?.name ?? t('EITHER_WAY', 'Either way')}</OText>
|
|
606
|
+
</View>
|
|
607
|
+
)}
|
|
608
|
+
{order?.comment && (
|
|
609
|
+
<View style={{ marginTop: 15 }}>
|
|
610
|
+
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
611
|
+
{t('COMMENT', 'Comment')}
|
|
612
|
+
</OText>
|
|
613
|
+
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.comment}</OText>
|
|
614
|
+
</View>
|
|
615
|
+
)}
|
|
600
616
|
{order?.driver && (
|
|
601
617
|
<>
|
|
602
618
|
{order?.driver?.location && parseInt(order?.status) === 9 && (
|
|
@@ -810,14 +826,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
810
826
|
</OText>
|
|
811
827
|
</Table>
|
|
812
828
|
</Total>
|
|
813
|
-
{order?.comment && (
|
|
814
|
-
<Table>
|
|
815
|
-
<OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
|
|
816
|
-
<OText style={{ maxWidth: '70%' }}>
|
|
817
|
-
{order?.comment}
|
|
818
|
-
</OText>
|
|
819
|
-
</Table>
|
|
820
|
-
)}
|
|
821
829
|
</OrderBill>
|
|
822
830
|
</OrderContent>
|
|
823
831
|
</>
|
|
@@ -109,7 +109,7 @@ export const OrderBill = styled.View`
|
|
|
109
109
|
export const Total = styled.View`
|
|
110
110
|
border-top-width: 1px;
|
|
111
111
|
border-top-color: ${(props: any) => props.theme.colors.border};
|
|
112
|
-
padding-vertical: 10px
|
|
112
|
+
padding-vertical: 10px;
|
|
113
113
|
`
|
|
114
114
|
|
|
115
115
|
export const Map = styled.View`
|