ordering-ui-react-native 0.21.16 → 0.21.18
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
CHANGED
|
@@ -73,23 +73,23 @@ export const DriverSchedule = (props: any) => {
|
|
|
73
73
|
<View style={{ padding: 30 }}>
|
|
74
74
|
{driverSchedule.map((item: any, i: number) => (
|
|
75
75
|
<DayContainer key={daysOfWeek[i]}>
|
|
76
|
-
<View style={{
|
|
76
|
+
<View style={{ flex: 1 }}>
|
|
77
77
|
<OText size={22} weight={700}>{daysOfWeek[i]}</OText>
|
|
78
78
|
<OText size={14}>{parseDate(getNextDate(i), { outputFormat: 'YYYY-MM-DD' })}</OText>
|
|
79
79
|
</View>
|
|
80
|
-
<View style={{
|
|
80
|
+
<View style={{ flex: 1 }}>
|
|
81
81
|
<>
|
|
82
82
|
{item?.enabled ? (
|
|
83
|
-
<View>
|
|
83
|
+
<View style={{ width: '100%' }}>
|
|
84
84
|
{item?.lapses.map((lapse: any, i: number) => (
|
|
85
85
|
<View key={`${daysOfWeek[i]}_${i}`} style={{ marginTop: 3, marginBottom: 20, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
86
|
-
<OText size={18} style={{
|
|
86
|
+
<OText size={18} style={{ flex: 1 }}>
|
|
87
87
|
{scheduleFormatted(lapse.open)}
|
|
88
88
|
</OText>
|
|
89
89
|
<OText size={18} style={{ width: 15 }}>
|
|
90
90
|
-
|
|
91
91
|
</OText>
|
|
92
|
-
<OText size={18} style={{
|
|
92
|
+
<OText size={18} style={{ flex: 1, textAlign: 'right' }}>
|
|
93
93
|
{scheduleFormatted(lapse.close)}
|
|
94
94
|
</OText>
|
|
95
95
|
</View>
|
|
@@ -88,7 +88,7 @@ export const OrdersGroupedItem = (props: any) => {
|
|
|
88
88
|
adjustsFontSizeToFit
|
|
89
89
|
>
|
|
90
90
|
{orders[0]?.delivery_datetime_utc
|
|
91
|
-
? parseDate(orders[0]?.delivery_datetime_utc
|
|
91
|
+
? parseDate(orders[0]?.delivery_datetime_utc)
|
|
92
92
|
: parseDate(orders[0]?.delivery_datetime, { utc: false })}
|
|
93
93
|
</OText>
|
|
94
94
|
</View>
|
|
@@ -44,11 +44,11 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
44
44
|
useLoginByCellphone,
|
|
45
45
|
useLoginByEmail,
|
|
46
46
|
loginTab,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
otpType,
|
|
48
|
+
setOtpType,
|
|
49
|
+
generateOtpCode,
|
|
50
|
+
useLoginOtpEmail,
|
|
51
|
+
useLoginOtpCellphone,
|
|
52
52
|
} = props;
|
|
53
53
|
|
|
54
54
|
const theme = useTheme()
|
|
@@ -82,31 +82,32 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
const isOtpEmail = loginTab === 'otp' && otpType === 'email'
|
|
85
|
-
|
|
85
|
+
const isOtpCellphone = loginTab === 'otp' && otpType === 'cellphone'
|
|
86
|
+
const isDeviceLoginEnabled = configs?.device_code_login_enabled?.value === '1'
|
|
86
87
|
|
|
87
88
|
const mainLogin = (values) => {
|
|
88
89
|
if (loginTab === 'otp') {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
90
|
+
if (phoneInputData.error && (loginTab !== 'otp' || (otpType === 'cellphone' && loginTab === 'otp'))) {
|
|
91
|
+
showToast(ToastType.Error, t('INVALID_PHONE_NUMBER', 'Invalid phone number'));
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
if (loginTab === 'otp') {
|
|
95
|
+
generateOtpCode({
|
|
96
|
+
...values,
|
|
97
|
+
...phoneInputData.phone
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
setWillVerifyOtpState(true)
|
|
101
|
+
} else {
|
|
102
|
+
if (phoneInputData.error) {
|
|
103
|
+
showToast(ToastType.Error, phoneInputData.error);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
handleButtonLoginClick({
|
|
107
|
+
...values,
|
|
108
|
+
...phoneInputData.phone,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
const onSubmit = (values: any) => {
|
|
@@ -199,23 +200,23 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
199
200
|
borderColor: theme.colors.inputSignup,
|
|
200
201
|
},
|
|
201
202
|
borderStyleBase: {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
203
|
+
width: 30,
|
|
204
|
+
height: 45
|
|
205
|
+
},
|
|
206
|
+
borderStyleHighLighted: {
|
|
207
|
+
borderColor: "#03DAC6",
|
|
208
|
+
},
|
|
209
|
+
underlineStyleBase: {
|
|
210
|
+
width: 45,
|
|
211
|
+
height: 60,
|
|
212
|
+
borderWidth: 1,
|
|
213
|
+
fontSize: 16
|
|
214
|
+
},
|
|
215
|
+
underlineStyleHighLighted: {
|
|
216
|
+
borderColor: theme.colors.primary,
|
|
217
|
+
color: theme.colors.primary,
|
|
218
|
+
fontSize: 16
|
|
219
|
+
},
|
|
219
220
|
});
|
|
220
221
|
|
|
221
222
|
useEffect(() => {
|
|
@@ -311,32 +312,32 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
311
312
|
};
|
|
312
313
|
|
|
313
314
|
const handleChangeOtpType = (type: string) => {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
315
|
+
handleChangeTab('otp', type)
|
|
316
|
+
setOtpType(type)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const handleLoginOtp = (code: string) => {
|
|
320
|
+
handleButtonLoginClick({ code })
|
|
321
|
+
setWillVerifyOtpState(false)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const closeAlert = () => {
|
|
325
|
+
setAlertState({
|
|
326
|
+
open: false,
|
|
327
|
+
title: '',
|
|
328
|
+
content: []
|
|
329
|
+
})
|
|
330
|
+
}
|
|
330
331
|
|
|
331
332
|
useEffect(() => {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
333
|
+
if (checkPhoneCodeState?.result?.error) {
|
|
334
|
+
setAlertState({
|
|
335
|
+
open: true,
|
|
336
|
+
content: t(checkPhoneCodeState?.result?.error, checkPhoneCodeState?.result?.error),
|
|
337
|
+
title: ''
|
|
338
|
+
})
|
|
339
|
+
}
|
|
340
|
+
}, [checkPhoneCodeState])
|
|
340
341
|
|
|
341
342
|
useEffect(() => {
|
|
342
343
|
const projectInputTimeout = setTimeout(() => {
|
|
@@ -346,9 +347,12 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
346
347
|
project: projectName
|
|
347
348
|
})
|
|
348
349
|
}
|
|
350
|
+
if (isDeviceLoginEnabled) {
|
|
351
|
+
props.handleChangeTab('device_code')
|
|
352
|
+
}
|
|
349
353
|
}, 1500)
|
|
350
354
|
return () => clearTimeout(projectInputTimeout);
|
|
351
|
-
}, [projectName])
|
|
355
|
+
}, [projectName, isDeviceLoginEnabled])
|
|
352
356
|
|
|
353
357
|
const logo = (
|
|
354
358
|
<LogoWrapper>
|
|
@@ -442,7 +446,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
442
446
|
</View>
|
|
443
447
|
)}
|
|
444
448
|
|
|
445
|
-
{(Number(useLoginByEmail) + Number(useLoginOtpEmail) + Number(useLoginOtpCellphone) > 1) && (
|
|
449
|
+
{!isDeviceLoginEnabled && (Number(useLoginByEmail) + Number(useLoginOtpEmail) + Number(useLoginOtpCellphone) > 1) && (
|
|
446
450
|
<LoginWith>
|
|
447
451
|
<ScrollView
|
|
448
452
|
ref={scrollRefTab}
|
|
@@ -553,7 +557,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
553
557
|
style={{
|
|
554
558
|
width: '100%',
|
|
555
559
|
borderBottomColor:
|
|
556
|
-
|
|
560
|
+
isOtpCellphone
|
|
557
561
|
? theme.colors.black
|
|
558
562
|
: theme.colors.border,
|
|
559
563
|
borderBottomWidth: 2,
|
|
@@ -592,8 +596,29 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
592
596
|
)}
|
|
593
597
|
/>
|
|
594
598
|
)}
|
|
595
|
-
|
|
596
|
-
|
|
599
|
+
{isDeviceLoginEnabled && (
|
|
600
|
+
<Controller
|
|
601
|
+
control={control}
|
|
602
|
+
render={({ onChange, value }: any) => (
|
|
603
|
+
<OInput
|
|
604
|
+
placeholder={t('DEVICE_CODE', 'Device Code')}
|
|
605
|
+
style={styles.inputStyle}
|
|
606
|
+
value={value}
|
|
607
|
+
inputStyle={{ textAlign: 'center' }}
|
|
608
|
+
onChange={(val: any) => onChange(val)}
|
|
609
|
+
/>
|
|
610
|
+
)}
|
|
611
|
+
name="device_code"
|
|
612
|
+
rules={{
|
|
613
|
+
required: t(
|
|
614
|
+
'VALIDATION_ERROR_DEVICE_CODE_REQUIRED',
|
|
615
|
+
'The field DEVICE_CODE is required',
|
|
616
|
+
).replace('_attribute_', t('DEVICE_CODE', 'Device Code')),
|
|
617
|
+
}}
|
|
618
|
+
defaultValue=""
|
|
619
|
+
/>
|
|
620
|
+
)}
|
|
621
|
+
{!isDeviceLoginEnabled && ((useLoginByEmail && loginTab === 'email') || (loginTab === 'otp' && otpType === 'email')) && (
|
|
597
622
|
<Controller
|
|
598
623
|
control={control}
|
|
599
624
|
render={({ onChange, value }: any) => (
|
|
@@ -628,7 +653,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
628
653
|
/>
|
|
629
654
|
)}
|
|
630
655
|
|
|
631
|
-
{((useLoginByCellphone && loginTab === 'cellphone') || (loginTab === 'otp' && otpType === 'cellphone')) && (
|
|
656
|
+
{!isDeviceLoginEnabled && ((useLoginByCellphone && loginTab === 'cellphone') || (loginTab === 'otp' && otpType === 'cellphone')) && (
|
|
632
657
|
<View style={{ marginBottom: 20 }}>
|
|
633
658
|
<PhoneInputNumber
|
|
634
659
|
data={phoneInputData}
|
|
@@ -642,7 +667,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
642
667
|
</View>
|
|
643
668
|
)}
|
|
644
669
|
|
|
645
|
-
{loginTab !== 'otp' && (
|
|
670
|
+
{!isDeviceLoginEnabled && loginTab !== 'otp' && (
|
|
646
671
|
<Controller
|
|
647
672
|
control={control}
|
|
648
673
|
render={({ onChange, value }: any) => (
|
|
@@ -732,26 +757,26 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
732
757
|
)}
|
|
733
758
|
</View>
|
|
734
759
|
<OModal
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
760
|
+
open={willVerifyOtpState}
|
|
761
|
+
onClose={() => setWillVerifyOtpState(false)}
|
|
762
|
+
entireModal
|
|
763
|
+
title={t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
|
|
764
|
+
>
|
|
765
|
+
<Otp
|
|
766
|
+
willVerifyOtpState={willVerifyOtpState}
|
|
767
|
+
setWillVerifyOtpState={setWillVerifyOtpState}
|
|
768
|
+
handleLoginOtp={handleLoginOtp}
|
|
769
|
+
onSubmit={onSubmit}
|
|
770
|
+
setAlertState={setAlertState}
|
|
771
|
+
/>
|
|
772
|
+
</OModal>
|
|
773
|
+
<Alert
|
|
774
|
+
open={alertState.open}
|
|
775
|
+
content={alertState.content}
|
|
776
|
+
title={alertState.title || ''}
|
|
777
|
+
onAccept={closeAlert}
|
|
778
|
+
onClose={closeAlert}
|
|
779
|
+
/>
|
|
755
780
|
</View>
|
|
756
781
|
);
|
|
757
782
|
};
|