ordering-ui-react-native 0.22.67-release → 0.22.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 +1 -1
- package/src/DeliveryApp.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +0 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +1 -0
- package/themes/original/src/components/Favorite/index.tsx +5 -1
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/Messages/index.tsx +561 -561
- package/themes/original/src/components/MyOrders/index.tsx +2 -2
- package/themes/original/src/components/OrderDetails/index.tsx +2 -2
- package/themes/original/src/components/OrderProgress/index.tsx +1 -1
- package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -121
- package/themes/original/src/components/OrdersOption/index.tsx +325 -322
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +57 -56
- package/themes/original/src/components/ServiceForm/index.tsx +1 -1
- package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
- package/themes/original/src/components/shared/OInput.tsx +98 -94
- package/themes/original/src/providers/AlertProvider.tsx +1 -1
- package/themes/original/src/utils/index.tsx +32 -45
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import React, { useState, useEffect } from 'react'
|
|
2
3
|
import { View } from 'react-native'
|
|
3
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
@@ -45,7 +46,7 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
45
46
|
new Array(walletsState.result?.length).fill(false)
|
|
46
47
|
);
|
|
47
48
|
|
|
48
|
-
const creditBalance: any = (wallet: any) => ` = ${parsePrice(wallet.balance / wallet.redemption_rate)}`
|
|
49
|
+
const creditBalance: any = (wallet: any) => ` = ${parsePrice(wallet.balance / wallet.redemption_rate, { isTruncable: true })}`
|
|
49
50
|
|
|
50
51
|
const walletName: any = {
|
|
51
52
|
cash: {
|
|
@@ -87,65 +88,65 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
87
88
|
{!walletsState.loading &&
|
|
88
89
|
!walletsState.error &&
|
|
89
90
|
walletsState.result?.length > 0 &&
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
91
|
+
(
|
|
92
|
+
<>
|
|
93
|
+
{walletsState.result?.map((wallet: any, idx: any) => wallet.valid && wallet.balance >= 0 && walletName[wallet.type]?.isActive && (
|
|
94
|
+
<Container
|
|
95
|
+
key={wallet.id}
|
|
96
|
+
isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
|
|
97
|
+
onPress={() => handleOnChange(idx, wallet)}
|
|
98
|
+
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
|
|
99
|
+
>
|
|
100
|
+
<SectionLeft>
|
|
101
|
+
{checkedState[idx] ? (
|
|
102
|
+
<MaterialCommunityIcons
|
|
103
|
+
name="checkbox-marked"
|
|
104
|
+
size={25}
|
|
105
|
+
color={theme.colors.primary}
|
|
106
|
+
/>
|
|
107
|
+
) : (
|
|
108
|
+
<MaterialCommunityIcons
|
|
109
|
+
name="checkbox-blank-outline"
|
|
110
|
+
size={25}
|
|
111
|
+
color={theme.colors.disabled}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
114
|
+
<View style={{ alignItems: 'baseline', marginLeft: 5 }}>
|
|
115
|
+
<View>
|
|
116
|
+
<OText
|
|
117
|
+
style={((cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0) ? {
|
|
118
|
+
color: theme.colors.disabled
|
|
119
|
+
} : {}}
|
|
120
|
+
>
|
|
121
|
+
{walletName[wallet.type]?.name}
|
|
122
|
+
</OText>
|
|
123
|
+
</View>
|
|
122
124
|
</View>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{parsePrice(wallet?.balance)}
|
|
130
|
-
</OText>
|
|
131
|
-
)}
|
|
132
|
-
{wallet.type === 'credit_point' && (
|
|
133
|
-
<OText>
|
|
134
|
-
<OText color={theme.colors.primary} weight='bold'>
|
|
135
|
-
{`${wallet?.balance} ${t('POINTS', 'Points')}`}
|
|
125
|
+
</SectionLeft>
|
|
126
|
+
|
|
127
|
+
<View style={{ maxWidth: '35%', alignItems: 'flex-end' }}>
|
|
128
|
+
{wallet.type === 'cash' && (
|
|
129
|
+
<OText>
|
|
130
|
+
{parsePrice(wallet?.balance, { isTruncable: true })}
|
|
136
131
|
</OText>
|
|
132
|
+
)}
|
|
133
|
+
{wallet.type === 'credit_point' && (
|
|
137
134
|
<OText>
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
<OText color={theme.colors.primary} weight='bold'>
|
|
136
|
+
{`${wallet?.balance} ${t('POINTS', 'Points')}`}
|
|
137
|
+
</OText>
|
|
138
|
+
<OText>
|
|
139
|
+
{wallet?.balance > 0
|
|
140
|
+
? creditBalance(wallet)
|
|
141
|
+
: null}
|
|
142
|
+
</OText>
|
|
141
143
|
</OText>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
</
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
)}
|
|
144
|
+
)}
|
|
145
|
+
</View>
|
|
146
|
+
</Container>
|
|
147
|
+
))}
|
|
148
|
+
</>
|
|
149
|
+
)}
|
|
149
150
|
|
|
150
151
|
{walletsState?.loading && (
|
|
151
152
|
<View>
|
|
@@ -143,7 +143,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
143
143
|
const valid = busyTimes.some(item => {
|
|
144
144
|
return (moment.utc(item?.start).local().valueOf() <= moment(selectedMoment).valueOf() &&
|
|
145
145
|
moment(selectedMoment).valueOf() < moment.utc(item?.end).local().valueOf()) ||
|
|
146
|
-
(moment.utc(item?.start).local().valueOf() < moment(selectedMoment).
|
|
146
|
+
(moment.utc(item?.start).local().valueOf() < moment(selectedMoment).valueOf() &&
|
|
147
147
|
moment(selectedMoment).add(duration, 'minutes').valueOf() < moment.utc(item?.end).local().valueOf())
|
|
148
148
|
})
|
|
149
149
|
return valid
|
|
@@ -3,7 +3,7 @@ import { ImageSourcePropType, ImageStyle, ViewStyle, TextInputProps, TextStyle }
|
|
|
3
3
|
import styled from 'styled-components/native';
|
|
4
4
|
import OIcon from './OIcon';
|
|
5
5
|
import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
|
|
6
|
-
import { useTheme } from 'styled-components/native';
|
|
6
|
+
import { useTheme, css } from 'styled-components/native';
|
|
7
7
|
|
|
8
8
|
const Input = styled.TextInput`
|
|
9
9
|
flex-grow: 1;
|
|
@@ -14,33 +14,33 @@ const Input = styled.TextInput`
|
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
16
|
interface Props extends TextInputProps {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
17
|
+
bgColor?: string;
|
|
18
|
+
borderColor?: string;
|
|
19
|
+
isRequired?: boolean;
|
|
20
|
+
requiredMsg?: string;
|
|
21
|
+
isDisabled?: boolean;
|
|
22
|
+
isSecured?: boolean;
|
|
23
|
+
style?: ViewStyle;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
icon?: ImageSourcePropType | string;
|
|
26
|
+
iconRight?: ImageSourcePropType;
|
|
27
|
+
iconColor?: string;
|
|
28
|
+
iconRightColor?: string;
|
|
29
|
+
iconStyle?: ImageStyle;
|
|
30
|
+
iconRightStyle?: ImageStyle;
|
|
31
|
+
iconCustomRight?: any;
|
|
32
|
+
value?: string;
|
|
33
|
+
onChange?: any;
|
|
34
|
+
name?: string;
|
|
35
|
+
type?: string;
|
|
36
|
+
multiline?: boolean;
|
|
37
|
+
vertorIcon?: string;
|
|
38
|
+
vectorIconColor?: string;
|
|
39
|
+
forwardRef?: any;
|
|
40
|
+
inputStyle?: TextStyle;
|
|
41
|
+
wrapperRef?: any;
|
|
42
|
+
onPress?: any;
|
|
43
|
+
isFocusHighlight?: boolean
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const Wrapper = styled.Pressable`
|
|
@@ -53,81 +53,85 @@ const Wrapper = styled.Pressable`
|
|
|
53
53
|
align-items: center;
|
|
54
54
|
justify-content: center;
|
|
55
55
|
width: 100%;
|
|
56
|
+
${(props: any) => props?.borderRadius && css`
|
|
57
|
+
border-radius: ${typeof props?.borderRadius === 'string' ? props?.borderRadius : `${props?.borderRadius}px`};
|
|
58
|
+
`}
|
|
56
59
|
`;
|
|
57
60
|
|
|
58
61
|
const OInput = (props: Props): React.ReactElement => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
62
|
+
const theme = useTheme();
|
|
63
|
+
const [inputFocused, setInputFocused] = React.useState(false)
|
|
64
|
+
return (
|
|
65
|
+
<Wrapper
|
|
66
|
+
onPress={() => { props.forwardRef?.current?.focus?.(); props.onPress && props.onPress() }}
|
|
67
|
+
style={{
|
|
68
|
+
backgroundColor: props.bgColor,
|
|
69
|
+
borderColor: !props.isFocusHighlight
|
|
70
|
+
? props.borderColor
|
|
71
|
+
: inputFocused ? theme.colors.primary : theme.colors.border,
|
|
72
|
+
...props.style,
|
|
73
|
+
borderRadius: parseInt(theme?.general?.components?.inputs?.borderRadius) || props.style?.borderRadius
|
|
74
|
+
}}>
|
|
75
|
+
{props.icon ? (
|
|
76
|
+
<OIcon
|
|
77
|
+
src={props.icon}
|
|
78
|
+
color={props.iconColor}
|
|
79
|
+
width={16}
|
|
80
|
+
height={20}
|
|
81
|
+
style={{ marginRight: 10, ...props.iconStyle }}
|
|
82
|
+
/>
|
|
83
|
+
) : null}
|
|
84
|
+
{props.vertorIcon && (
|
|
85
|
+
<MaterialIcon name={props?.vertorIcon} size={20} color={props?.vectorIconColor} style={{ marginHorizontal: 10 }} />
|
|
86
|
+
)}
|
|
87
|
+
<Input
|
|
88
|
+
autoFocus={props?.autoFocus}
|
|
89
|
+
name={props.name}
|
|
90
|
+
secureTextEntry={props.isSecured}
|
|
91
|
+
onChangeText={(txt: any) => props.name ? props.onChange({ target: { name: props.name, value: txt } }) : props.onChange(txt)}
|
|
92
|
+
defaultValue={props.value}
|
|
93
|
+
placeholder={props.placeholder ? props.placeholder : ''}
|
|
94
|
+
keyboardType={props.type || 'default'}
|
|
95
|
+
multiline={props.multiline}
|
|
96
|
+
scrollEnabled={props.multiline}
|
|
97
|
+
editable={!props.isDisabled}
|
|
98
|
+
autoCapitalize={props.autoCapitalize}
|
|
99
|
+
autoCompleteType={props.autoCompleteType}
|
|
100
|
+
autoCorrect={props.autoCorrect}
|
|
101
|
+
returnKeyType={props.returnKeyType}
|
|
102
|
+
onSubmitEditing={props.onSubmitEditing}
|
|
103
|
+
blurOnSubmit={props.blurOnSubmit}
|
|
104
|
+
ref={(e: any) => {
|
|
105
|
+
props.forwardRef && (props.forwardRef.current = e)
|
|
106
|
+
}}
|
|
107
|
+
style={{
|
|
104
108
|
...(theme?.general?.components?.inputs?.color && {
|
|
105
109
|
color: theme?.general?.components?.inputs?.color
|
|
106
110
|
}),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
...props?.inputStyle
|
|
112
|
+
}}
|
|
113
|
+
onFocus={() => setInputFocused(true)}
|
|
114
|
+
onBlur={() => setInputFocused(false)}
|
|
115
|
+
/>
|
|
116
|
+
{props.iconRight && (
|
|
117
|
+
<OIcon
|
|
118
|
+
src={props.iconRight}
|
|
119
|
+
color={props.iconRightColor}
|
|
120
|
+
width={16}
|
|
121
|
+
height={16}
|
|
122
|
+
style={{ ...props.iconRightStyle }}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
{props.iconCustomRight}
|
|
126
|
+
</Wrapper>
|
|
127
|
+
);
|
|
124
128
|
};
|
|
125
129
|
|
|
126
130
|
OInput.defaultProps = {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
iconColor: '#959595',
|
|
132
|
+
bgColor: 'white',
|
|
133
|
+
borderColor: 'white',
|
|
134
|
+
isFocusHighlight: false
|
|
131
135
|
};
|
|
132
136
|
|
|
133
137
|
export default OInput;
|
|
@@ -28,7 +28,7 @@ const Alert = (props: Props) => {
|
|
|
28
28
|
show={open}
|
|
29
29
|
showProgress={false}
|
|
30
30
|
title={title}
|
|
31
|
-
message={getTraduction(content?.[0])}
|
|
31
|
+
message={getTraduction(content?.[0], t)}
|
|
32
32
|
closeOnTouchOutside={true}
|
|
33
33
|
closeOnHardwareBackPress={false}
|
|
34
34
|
showConfirmButton={true}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useLanguage } from 'ordering-components/native';
|
|
3
2
|
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
4
3
|
import { CODES } from 'ordering-components/native'
|
|
5
4
|
import { ORDER_TYPES } from '../config/constants';
|
|
6
5
|
import { useTheme } from 'styled-components/native';
|
|
7
|
-
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
8
|
-
|
|
9
|
-
const [languageState, t] = useLanguage();
|
|
10
6
|
const theme = useTheme()
|
|
11
7
|
|
|
12
8
|
export const flatArray = (arr: any) => [].concat(...arr)
|
|
@@ -20,8 +16,7 @@ export const orderTypeList = ['delivery', 'pickup', 'eatin', 'curbside', 'drivet
|
|
|
20
16
|
* Function to return the traduction depending of a key 't'
|
|
21
17
|
* @param {string} key for traduction
|
|
22
18
|
*/
|
|
23
|
-
export const getTraduction = (key: string) => {
|
|
24
|
-
const [, t] = useLanguage()
|
|
19
|
+
export const getTraduction = (key: string, t: any) => {
|
|
25
20
|
const keyList: any = {
|
|
26
21
|
// Add the key and traduction that you need below
|
|
27
22
|
ERROR_ORDER_WITHOUT_CART: 'The order was placed without a cart',
|
|
@@ -131,32 +126,34 @@ export const monthsEnum: any = {
|
|
|
131
126
|
Dec: 'MONTHSHORT12',
|
|
132
127
|
}
|
|
133
128
|
|
|
134
|
-
export const locale = {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
129
|
+
export const locale = (languageState: any, t: any) => {
|
|
130
|
+
return {
|
|
131
|
+
name: languageState?.language?.code?.slice(0, 2),
|
|
132
|
+
config: {
|
|
133
|
+
months: [
|
|
134
|
+
t('MONTH1', 'January'),
|
|
135
|
+
t('MONTH2', 'February'),
|
|
136
|
+
t('MONTH3', 'March'),
|
|
137
|
+
t('MONTH4', 'April'),
|
|
138
|
+
t('MONTH5', 'May'),
|
|
139
|
+
t('MONTH6', 'June'),
|
|
140
|
+
t('MONTH7', 'July'),
|
|
141
|
+
t('MONTH8', 'August'),
|
|
142
|
+
t('MONTH9', 'September'),
|
|
143
|
+
t('MONTH10', 'October'),
|
|
144
|
+
t('MONTH11', 'November'),
|
|
145
|
+
t('MONTH12', 'December')
|
|
146
|
+
],
|
|
147
|
+
weekdaysShort: [
|
|
148
|
+
t('DAYSHORT7', 'Sun'),
|
|
149
|
+
t('DAYSHORT1', 'Mon'),
|
|
150
|
+
t('DAYSHORT2', 'Tue'),
|
|
151
|
+
t('DAYSHORT3', 'Wed'),
|
|
152
|
+
t('DAYSHORT4', 'Thu'),
|
|
153
|
+
t('DAYSHORT5', 'Fri'),
|
|
154
|
+
t('DAYSHORT6', 'Sat')
|
|
155
|
+
],
|
|
156
|
+
}
|
|
160
157
|
}
|
|
161
158
|
};
|
|
162
159
|
|
|
@@ -366,7 +363,7 @@ export const priceList = [
|
|
|
366
363
|
{ level: '5', content: '$$$$$' }
|
|
367
364
|
]
|
|
368
365
|
|
|
369
|
-
export const getLogisticTag = (status: any) => {
|
|
366
|
+
export const getLogisticTag = (status: any, t: any) => {
|
|
370
367
|
const keyList: any = {
|
|
371
368
|
0: t('PENDING', 'Pending'),
|
|
372
369
|
1: t('IN_PROGRESS', 'In progress'),
|
|
@@ -377,7 +374,7 @@ export const getLogisticTag = (status: any) => {
|
|
|
377
374
|
return keyList[status] ? keyList[status] : t('UNKNOWN', 'Unknown')
|
|
378
375
|
}
|
|
379
376
|
|
|
380
|
-
export const getOrderStatus = (s: string, t
|
|
377
|
+
export const getOrderStatus = (s: string, t: any) => {
|
|
381
378
|
const status = parseInt(s);
|
|
382
379
|
const orderStatus = [
|
|
383
380
|
{
|
|
@@ -594,7 +591,7 @@ export const getOrderStatus = (s: string, t?: any) => {
|
|
|
594
591
|
return objectStatus && objectStatus;
|
|
595
592
|
}
|
|
596
593
|
|
|
597
|
-
export const getOrderStatuPickUp = (s: any) => {
|
|
594
|
+
export const getOrderStatuPickUp = (s: any, t: any) => {
|
|
598
595
|
const status = parseInt(s);
|
|
599
596
|
const orderStatus = [
|
|
600
597
|
{
|
|
@@ -744,13 +741,3 @@ export const lightenDarkenColor = (color: any) => {
|
|
|
744
741
|
return false
|
|
745
742
|
}
|
|
746
743
|
}
|
|
747
|
-
|
|
748
|
-
export const vibrateApp = (impact?: string) => {
|
|
749
|
-
const options = {
|
|
750
|
-
enableVibrateFallback: true,
|
|
751
|
-
ignoreAndroidSystemSettings: false
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
755
|
-
|
|
756
|
-
}
|