ordering-ui-react-native 0.17.90 → 0.17.91

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.90",
3
+ "version": "0.17.91",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -131,7 +131,7 @@ export const OrderCreating = (props: any) => {
131
131
  <OText size={14}>{address}</OText>
132
132
  </LocationWrapper>
133
133
  )}
134
- {cart && (
134
+ {cart && !orderState?.options?.moment && (
135
135
  <DeliveryWrapper>
136
136
  <DeliveryContentWrapper>
137
137
  <SimpleIcon
@@ -175,4 +175,4 @@ export const OrderCreating = (props: any) => {
175
175
  )}
176
176
  </OrderCreatingContainer>
177
177
  )
178
- }
178
+ }
@@ -95,7 +95,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
95
95
  upper: {
96
96
  flex: 1,
97
97
  zIndex: 1001,
98
- paddingTop: isPage ? 30 : 80,
98
+ paddingTop: isPage ? 30 : 50,
99
99
  marginBottom: 10,
100
100
  backgroundColor: theme.colors.backgroundPage
101
101
  },
@@ -418,7 +418,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
418
418
  </Header>
419
419
 
420
420
  {action === 'accept' && (
421
- <View style={{ height: 400, justifyContent: 'center' }}>
421
+ <View style={{ height: 300, justifyContent: 'center' }}>
422
422
  <Timer onPress={() => openTimerIOnput()}>
423
423
  <OText weight="600" style={{ textAlign: 'center' }} size={55}>
424
424
  {hour}
@@ -1,6 +1,6 @@
1
- import React, { useEffect } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { formatSeconds } from '../../../utils'
3
- import { StyleSheet, TouchableOpacity } from 'react-native';
3
+ import { StyleSheet, TouchableOpacity, Alert } 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';
@@ -16,11 +16,13 @@ export const Otp = (props: otpParams) => {
16
16
  onSubmit,
17
17
  handleLoginOtp,
18
18
  setAlertState,
19
- pinCount
19
+ pinCount,
20
+ formState
20
21
  } = props
21
22
 
22
23
  const theme = useTheme();
23
24
  const [, t] = useLanguage();
25
+ const [code, setCode] = useState('')
24
26
  const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
25
27
  600, willVerifyOtpState)
26
28
 
@@ -44,6 +46,30 @@ export const Otp = (props: otpParams) => {
44
46
  }
45
47
  }, [otpLeftTime])
46
48
 
49
+ useEffect(() => {
50
+ if (!formState?.loading && formState?.result?.error) {
51
+ Alert.alert(
52
+ t('ERROR', 'Error'),
53
+ typeof formState.result?.result === 'string'
54
+ ? formState.result?.result
55
+ : formState.result?.result[0],
56
+ [
57
+ {
58
+ text: t('ACCEPT', 'Accept'),
59
+ onPress: () => {},
60
+ style: 'cancel'
61
+ },
62
+ ],
63
+ { cancelable: false }
64
+ )
65
+
66
+ if (code.length === (pinCount || 6)) {
67
+ setCode('')
68
+ }
69
+
70
+ }
71
+ }, [formState])
72
+
47
73
  const loginStyle = StyleSheet.create({
48
74
  underlineStyleBase: {
49
75
  width: 45,
@@ -72,6 +98,8 @@ export const Otp = (props: otpParams) => {
72
98
  onCodeFilled={(code: string) => handleLoginOtp(code)}
73
99
  selectionColor={theme.colors.primary}
74
100
  editable
101
+ code={code}
102
+ onCodeChanged={(code: string) => setCode(code)}
75
103
  />
76
104
  <TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
77
105
  <OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
@@ -280,7 +280,6 @@ const LoginFormUI = (props: LoginParams) => {
280
280
 
281
281
  const handleLoginOtp = (code: string) => {
282
282
  handleButtonLoginClick({ code })
283
- setWillVerifyOtpState(false)
284
283
  }
285
284
 
286
285
  const closeAlert = () => {
@@ -329,27 +328,17 @@ const LoginFormUI = (props: LoginParams) => {
329
328
  showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
330
329
  return
331
330
  }
332
- formState?.result?.result &&
333
- showToast(
334
- ToastType.Error,
335
- loginTab === 'email' && typeof formState.result?.result === 'string'
336
- ? getTraduction(formState.result?.result)
337
- : loginTab === 'email' &&
338
- typeof formState.result?.result !== 'string'
339
- ? getTraduction(formState.result?.result[0])
340
- : loginTab === 'cellphone' &&
341
- typeof formState.result?.result === 'string'
342
- ? getTraduction(formState.result?.result).replace(
343
- t('USER', 'user').toLowerCase(),
344
- t('PHONE_NUMER', 'Phone number'),
345
- )
346
- : getTraduction(formState.result?.result[0]).replace(
347
- t('USER', 'user').toLowerCase(),
348
- t('PHONE_NUMER', 'Phone number'),
349
- ),
350
- );
331
+ formState.result?.result && showToast(
332
+ ToastType.Error,
333
+ typeof formState.result?.result === 'string'
334
+ ? formState.result?.result
335
+ : formState.result?.result[0]
336
+ )
351
337
  setSubmitted(false)
352
338
  }
339
+ if (!formState?.loading && !formState?.result?.error) {
340
+ setWillVerifyOtpState(false)
341
+ }
353
342
  }, [formState]);
354
343
 
355
344
  useEffect(() => {
@@ -929,6 +918,7 @@ const LoginFormUI = (props: LoginParams) => {
929
918
  handleLoginOtp={handleLoginOtp}
930
919
  onSubmit={handleLogin}
931
920
  setAlertState={setAlertState}
921
+ formState={formState}
932
922
  />
933
923
  </OModal>
934
924
  <Alert
@@ -36,7 +36,8 @@ export interface otpParams {
36
36
  setWillVerifyOtpState: (val : boolean) => void,
37
37
  onSubmit: () => void,
38
38
  handleLoginOtp: (code : string) => void,
39
- setAlertState: any
39
+ setAlertState: any,
40
+ formState?: any
40
41
  }
41
42
  export interface ProfileParams {
42
43
  navigation?: any;
@@ -116,10 +116,6 @@ const LoginFormUI = (props: LoginParams) => {
116
116
  }
117
117
 
118
118
  if (values?.project_name) {
119
- setOrdering({
120
- ...ordering,
121
- project: values?.project_name
122
- })
123
119
  _setStoreData('project_name', values?.project_name)
124
120
  setFormsStateValues({
125
121
  ...formsStateValues,
@@ -315,9 +315,11 @@ const CartUI = (props: any) => {
315
315
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
316
316
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
317
317
  </TouchableOpacity>
318
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
319
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
320
- </TouchableOpacity>
318
+ {!offer?.type && (
319
+ <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
320
+ <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
321
+ </TouchableOpacity>
322
+ )}
321
323
  </OSRow>
322
324
  <OText size={12} lineHeight={18}>
323
325
  - {parsePrice(offer?.summary?.discount)}
@@ -352,6 +354,12 @@ const CartUI = (props: any) => {
352
354
  </OSTable>
353
355
  ))
354
356
  }
357
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && (
358
+ <OSTable>
359
+ <OText size={12} lineHeight={18}>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</OText>
360
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
361
+ </OSTable>
362
+ )}
355
363
  {cart?.driver_tip > 0 && !hideDriverTip && (
356
364
  <OSTable>
357
365
  <OText size={12} lineHeight={18}>