ordering-ui-react-native 0.18.74 → 0.18.76
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/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +52 -5
- package/themes/original/src/components/LoginForm/index.tsx +10 -12
- package/themes/original/src/components/OrderDetails/index.tsx +1 -1
- package/themes/original/src/components/OrderProgress/index.tsx +25 -7
- package/themes/original/src/components/OrderSummary/index.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -1
- package/themes/original/src/types/index.tsx +2 -0
package/package.json
CHANGED
|
@@ -523,7 +523,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
523
523
|
))
|
|
524
524
|
}
|
|
525
525
|
{
|
|
526
|
-
order?.summary?.delivery_price
|
|
526
|
+
typeof order?.summary?.delivery_price === 'number' && (
|
|
527
527
|
<Table>
|
|
528
528
|
<OText mBottom={4}>
|
|
529
529
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { formatSeconds } from '../../../utils'
|
|
3
|
-
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { StyleSheet, TouchableOpacity, View, Platform } from 'react-native';
|
|
4
4
|
import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
|
|
5
5
|
import { useLanguage } from 'ordering-components/native';
|
|
6
6
|
import { OTPContainer } from './styles';
|
|
7
|
-
import { OText, OButton } from '../../shared';
|
|
7
|
+
import { OText, OButton, OIcon } from '../../shared';
|
|
8
8
|
import OtpInputs from 'react-native-otp-inputs';
|
|
9
9
|
import { useTheme } from 'styled-components/native';
|
|
10
10
|
import { otpParams } from '../../../types'
|
|
@@ -16,7 +16,9 @@ export const Otp = (props: otpParams) => {
|
|
|
16
16
|
onSubmit,
|
|
17
17
|
handleLoginOtp,
|
|
18
18
|
setAlertState,
|
|
19
|
-
pinCount
|
|
19
|
+
pinCount,
|
|
20
|
+
otpError,
|
|
21
|
+
setOtpError
|
|
20
22
|
} = props
|
|
21
23
|
|
|
22
24
|
const theme = useTheme();
|
|
@@ -26,6 +28,7 @@ export const Otp = (props: otpParams) => {
|
|
|
26
28
|
|
|
27
29
|
const [code, setCode] = useState('')
|
|
28
30
|
const inputRef = useRef<any>()
|
|
31
|
+
|
|
29
32
|
const handleOnSubmit = () => {
|
|
30
33
|
setAlertState({
|
|
31
34
|
open: true,
|
|
@@ -35,6 +38,16 @@ export const Otp = (props: otpParams) => {
|
|
|
35
38
|
onSubmit()
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
const handleChangeCode = (code : string) => {
|
|
42
|
+
setCode(code)
|
|
43
|
+
setOtpError(null)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const handleCloseOtp = () => {
|
|
47
|
+
setWillVerifyOtpState(false)
|
|
48
|
+
setOtpError(null)
|
|
49
|
+
}
|
|
50
|
+
|
|
38
51
|
useEffect(() => {
|
|
39
52
|
if (otpLeftTime === 0) {
|
|
40
53
|
setAlertState({
|
|
@@ -73,11 +86,36 @@ export const Otp = (props: otpParams) => {
|
|
|
73
86
|
color: theme.colors.primary,
|
|
74
87
|
fontSize: 16
|
|
75
88
|
},
|
|
89
|
+
wrapperIcon: {
|
|
90
|
+
marginTop: Platform.OS === 'ios' ? 40 : 12,
|
|
91
|
+
marginBottom: 20,
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
paddingRight: 35
|
|
95
|
+
},
|
|
96
|
+
closeContainer: {
|
|
97
|
+
width: '100%',
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
}
|
|
76
100
|
});
|
|
77
101
|
|
|
78
102
|
return (
|
|
79
103
|
<>
|
|
80
104
|
<OTPContainer>
|
|
105
|
+
<View
|
|
106
|
+
style={loginStyle.closeContainer}>
|
|
107
|
+
<TouchableOpacity onPress={() => handleCloseOtp()} style={loginStyle.wrapperIcon}>
|
|
108
|
+
<OIcon
|
|
109
|
+
src={theme.images.general.close}
|
|
110
|
+
width={22}
|
|
111
|
+
/>
|
|
112
|
+
</TouchableOpacity>
|
|
113
|
+
<OText size={22} style={{
|
|
114
|
+
marginTop: 5
|
|
115
|
+
}}>
|
|
116
|
+
{t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
|
|
117
|
+
</OText>
|
|
118
|
+
</View>
|
|
81
119
|
<OText size={24}>
|
|
82
120
|
{formatSeconds(otpLeftTime)}
|
|
83
121
|
</OText>
|
|
@@ -87,15 +125,24 @@ export const Otp = (props: otpParams) => {
|
|
|
87
125
|
numberOfInputs={pinCount || 6}
|
|
88
126
|
style={loginStyle.container}
|
|
89
127
|
inputStyles={loginStyle.underlineStyleBase}
|
|
90
|
-
handleChange={
|
|
128
|
+
handleChange={handleChangeCode}
|
|
91
129
|
/>
|
|
130
|
+
{!!otpError && (
|
|
131
|
+
<OText
|
|
132
|
+
color={theme?.colors?.error}
|
|
133
|
+
size={20}
|
|
134
|
+
mBottom={10}
|
|
135
|
+
>
|
|
136
|
+
{t(otpError, otpError)}
|
|
137
|
+
</OText>
|
|
138
|
+
)}
|
|
92
139
|
<TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
|
|
93
140
|
<OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
|
|
94
141
|
{t('RESEND_CODE', 'Resend code')}
|
|
95
142
|
</OText>
|
|
96
143
|
</TouchableOpacity>
|
|
97
144
|
<OButton
|
|
98
|
-
onClick={() =>
|
|
145
|
+
onClick={() => handleCloseOtp()}
|
|
99
146
|
bgColor={theme.colors.white}
|
|
100
147
|
borderColor={theme.colors.primary}
|
|
101
148
|
textStyle={{ color: theme.colors.primary }}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { StyleSheet, View, Keyboard } from 'react-native';
|
|
2
|
+
import { StyleSheet, View, Keyboard, Modal } from 'react-native';
|
|
3
3
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
4
4
|
import { useForm, Controller } from 'react-hook-form';
|
|
5
5
|
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
@@ -97,6 +97,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
97
97
|
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
98
98
|
const [alertState, setAlertState] = useState({ open: false, title: '', content: [] })
|
|
99
99
|
const [tabLayouts, setTabLayouts] = useState<any>({})
|
|
100
|
+
const [otpError, setOtpError] = useState(null)
|
|
100
101
|
const tabsRef = useRef<any>(null)
|
|
101
102
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
102
103
|
const theme = useTheme();
|
|
@@ -270,11 +271,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
270
271
|
if (logged) {
|
|
271
272
|
setWillVerifyOtpState(false)
|
|
272
273
|
} else {
|
|
273
|
-
|
|
274
|
-
open: true,
|
|
275
|
-
title: '',
|
|
276
|
-
content: t('OTP_CODE_INCORRECT', 'Otp code incorrect')
|
|
277
|
-
})
|
|
274
|
+
setOtpError(t('OTP_CODE_INCORRECT', 'Otp code incorrect'))
|
|
278
275
|
}
|
|
279
276
|
}
|
|
280
277
|
|
|
@@ -851,20 +848,21 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
851
848
|
onClose={() => setIsModalVisible(false)}
|
|
852
849
|
/>
|
|
853
850
|
</OModal>
|
|
854
|
-
<
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
title={t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
|
|
851
|
+
<Modal
|
|
852
|
+
visible={willVerifyOtpState}
|
|
853
|
+
onDismiss={() => setWillVerifyOtpState(false)}
|
|
854
|
+
animationType='slide'
|
|
859
855
|
>
|
|
860
856
|
<Otp
|
|
861
857
|
willVerifyOtpState={willVerifyOtpState}
|
|
858
|
+
otpError={otpError}
|
|
859
|
+
setOtpError={setOtpError}
|
|
862
860
|
setWillVerifyOtpState={setWillVerifyOtpState}
|
|
863
861
|
handleLoginOtp={handleLoginOtp}
|
|
864
862
|
onSubmit={onSubmit}
|
|
865
863
|
setAlertState={setAlertState}
|
|
866
864
|
/>
|
|
867
|
-
</
|
|
865
|
+
</Modal>
|
|
868
866
|
<Alert
|
|
869
867
|
open={alertState.open}
|
|
870
868
|
content={alertState.content}
|
|
@@ -934,7 +934,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
934
934
|
</Table>
|
|
935
935
|
))
|
|
936
936
|
}
|
|
937
|
-
{order?.summary?.delivery_price
|
|
937
|
+
{typeof order?.summary?.delivery_price === 'number' && (
|
|
938
938
|
<Table>
|
|
939
939
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
940
940
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
|
|
@@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
OrderList,
|
|
4
4
|
useLanguage,
|
|
5
|
-
useUtils
|
|
5
|
+
useUtils,
|
|
6
|
+
useConfig
|
|
6
7
|
} from 'ordering-components/native'
|
|
7
8
|
import { useTheme } from 'styled-components/native';
|
|
8
9
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
@@ -34,10 +35,12 @@ const OrderProgressUI = (props: any) => {
|
|
|
34
35
|
const theme = useTheme();
|
|
35
36
|
|
|
36
37
|
const [, t] = useLanguage()
|
|
37
|
-
const [{ optimizeImage, parseTime }] = useUtils()
|
|
38
|
+
const [{ optimizeImage, parseTime, parseDate }] = useUtils()
|
|
39
|
+
const [{ configs }] = useConfig()
|
|
38
40
|
const [lastOrder, setLastOrder] = useState<any>(null)
|
|
39
41
|
const imageFails = theme.images.general.emptyActiveOrders
|
|
40
42
|
const [initialLoaded, setInitialLoaded] = useState(false)
|
|
43
|
+
const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
41
44
|
|
|
42
45
|
const styles = StyleSheet.create({
|
|
43
46
|
main: {
|
|
@@ -84,7 +87,15 @@ const OrderProgressUI = (props: any) => {
|
|
|
84
87
|
useEffect(() => {
|
|
85
88
|
if (orderList?.orders.length > 0) {
|
|
86
89
|
const sortedOrders = orderList.orders.sort((a: any, b: any) => a.id > b.id ? -1 : 1)
|
|
87
|
-
|
|
90
|
+
const orderInProgress = sortedOrders.find((order: any) => (statusToShow.includes(order.status)))
|
|
91
|
+
|
|
92
|
+
let _lastOrder = null
|
|
93
|
+
if (orderInProgress) {
|
|
94
|
+
_lastOrder = orderInProgress
|
|
95
|
+
} else {
|
|
96
|
+
_lastOrder = sortedOrders[0]
|
|
97
|
+
}
|
|
98
|
+
setLastOrder(_lastOrder)
|
|
88
99
|
}
|
|
89
100
|
}, [orderList?.orders])
|
|
90
101
|
|
|
@@ -135,8 +146,10 @@ const OrderProgressUI = (props: any) => {
|
|
|
135
146
|
fontWeight: 'bold',
|
|
136
147
|
marginBottom: 3
|
|
137
148
|
}}
|
|
138
|
-
>{t('ORDER_IN_PROGRESS', 'Order in progress')}</OText>
|
|
139
|
-
|
|
149
|
+
>{statusToShow.includes(lastOrder?.status) ? t('ORDER_IN_PROGRESS', 'Order in progress') : t('ORDER', 'Order')}</OText>
|
|
150
|
+
{statusToShow.includes(lastOrder?.status) && (
|
|
151
|
+
<OText size={11} numberOfLines={1} ellipsizeMode='tail'>{t('RESTAURANT_PREPARING_YOUR_ORDER', 'The restaurant is preparing your order')}</OText>
|
|
152
|
+
)}
|
|
140
153
|
<TouchableOpacity onPress={() => handleGoToOrder('MyOrders')}>
|
|
141
154
|
<View style={styles.navigationButton}>
|
|
142
155
|
<OText size={11} color={theme.colors.primary}>{t('GO_TO_MY_ORDERS', 'Go to my orders')}</OText>
|
|
@@ -157,13 +170,18 @@ const OrderProgressUI = (props: any) => {
|
|
|
157
170
|
<ProgressTextWrapper>
|
|
158
171
|
<OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
159
172
|
<TimeWrapper>
|
|
160
|
-
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
173
|
+
<OText size={11}>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
|
|
161
174
|
<OText size={11}>
|
|
162
175
|
{lastOrder?.delivery_datetime_utc
|
|
163
|
-
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: '
|
|
176
|
+
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: configs?.general_hour_format?.value || 'HH:mm' })
|
|
164
177
|
: parseTime(lastOrder?.delivery_datetime, { utc: false })}
|
|
165
178
|
-
|
|
166
179
|
<OrderEta order={lastOrder} outputFormat='hh:mm A' />
|
|
180
|
+
{statusToShow.includes(lastOrder?.status) ? (
|
|
181
|
+
<OrderEta order={lastOrder} outputFormat={configs?.general_hour_format?.value || 'HH:mm'} />
|
|
182
|
+
) : (
|
|
183
|
+
parseDate(lastOrder?.reporting_data?.at[`status:${lastOrder.status}`], { outputFormat: configs?.general_hour_format?.value })
|
|
184
|
+
)}
|
|
167
185
|
</OText>
|
|
168
186
|
</TimeWrapper>
|
|
169
187
|
</ProgressTextWrapper>
|
|
@@ -245,7 +245,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
245
245
|
</OSTable>
|
|
246
246
|
))
|
|
247
247
|
}
|
|
248
|
-
{orderState?.options?.type === 1 &&
|
|
248
|
+
{orderState?.options?.type === 1 && !hideDeliveryFee && (
|
|
249
249
|
<OSTable>
|
|
250
250
|
<OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
251
251
|
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
@@ -169,7 +169,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
return (
|
|
172
|
-
<InView style={{ minHeight: hideAddButton ? 125 : 190 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
|
|
172
|
+
<InView style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
|
|
173
173
|
{isIntersectionObserver ? (
|
|
174
174
|
<CardAnimation
|
|
175
175
|
onClick={() => handleClickproduct()}
|
|
@@ -182,7 +182,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
182
182
|
<View style={{ flexDirection: logoPosition === 'left' ? 'row-reverse' : 'row' }}>
|
|
183
183
|
{productAddedToCartLength > 0 && (
|
|
184
184
|
<QuantityContainer businessSingleId={businessSingleId} style={[styles.quantityContainer, {
|
|
185
|
-
transform: [{ translateX: 25 }, { translateY: -25 }],
|
|
185
|
+
transform: [{ translateX: logoPosition === 'right' ? 25 : -25 }, { translateY: -25 }],
|
|
186
186
|
}]}>
|
|
187
187
|
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
188
188
|
</QuantityContainer>
|