ordering-ui-react-native 0.14.73 → 0.14.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.14.73",
3
+ "version": "0.14.76",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -45,7 +45,7 @@ const BusinessesListingUI = (props: any) => {
45
45
  </OText>
46
46
  <OText
47
47
  size={WIDTH_SCREEN * 0.014}
48
- color={theme.colors.paleGray}
48
+ color={theme.colors.letterGray}
49
49
  style={{
50
50
  paddingHorizontal: 15,
51
51
  paddingBottom: 40
@@ -9,7 +9,7 @@ import { _clearStoreData, _retrieveStoreData } from '../../../../../src/provider
9
9
  const LogoutButtonUI = (props: any) => {
10
10
  const { handleLogoutClick, formState, ButtonUI } = props
11
11
 
12
- const [theme] = useTheme();
12
+ const theme = useTheme();
13
13
  const [, { setStateValues }] = useOrder();
14
14
  const [, { showToast }] = useToast();
15
15
  const [, t] = useLanguage();
@@ -1,15 +1,15 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Modal } from 'react-native';
3
- import { useLanguage, LogoutAction, useApi, useSession } from 'ordering-components/native';
4
-
3
+ import { useLanguage, LogoutAction, useApi, useSession, useBusiness, useOrder } from 'ordering-components/native';
5
4
  import { useForm, Controller } from 'react-hook-form';
6
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
+ import { useTheme } from 'styled-components/native';
7
7
 
8
8
  import NavBar from '../NavBar';
9
9
  import { OSBody, OSContainer, OSContent } from './styles';
10
10
  import { OButton, OInput, OText } from '../shared';
11
11
  import { useDeviceOrientation, PORTRAIT } from '../../../../../src/hooks/DeviceOrientation';
12
- import { useTheme } from 'styled-components/native';
12
+ import { _clearStoreData, _retrieveStoreData } from '../../../../../src/providers/StoreUtil'
13
13
 
14
14
  const LogoutPopupUI = (props: Props) => {
15
15
  const {
@@ -19,13 +19,15 @@ const LogoutPopupUI = (props: Props) => {
19
19
  } = props;
20
20
 
21
21
  const theme = useTheme();
22
+ const [, { setStateValues }] = useOrder();
22
23
  const [ordering] = useApi();
23
24
  const [{ token }] = useSession();
24
25
  const [, t] = useLanguage();
26
+ const [, { setBusiness }] = useBusiness();
25
27
  const [orientationState] = useDeviceOrientation();
26
28
  const { control, handleSubmit, errors } = useForm();
27
29
  const [passwordSee, setPasswordSee] = useState(false);
28
- const [logoutState, setLogoutState] = useState({ loading: false, error: false, result: [] })
30
+ const [logoutState, setLogoutState] = useState<any>({ loading: false, error: false, result: [] })
29
31
 
30
32
  const fetchPassword = async (body: any) => {
31
33
  try {
@@ -43,12 +45,12 @@ const LogoutPopupUI = (props: Props) => {
43
45
  result
44
46
  })
45
47
  return { error, result }
46
- } catch (e) {
48
+ } catch (e: any) {
47
49
  setLogoutState({
48
50
  ...logoutState,
49
51
  loading: false,
50
52
  error: true,
51
- result: e
53
+ result: [e?.message]
52
54
  })
53
55
  }
54
56
  }
@@ -56,7 +58,17 @@ const LogoutPopupUI = (props: Props) => {
56
58
  const onSubmit = async (values: any) => {
57
59
  const result = await fetchPassword(values)
58
60
  if (result?.result === 'OK') {
59
- handleLogoutClick();
61
+ const res: any = await handleLogoutClick();
62
+ if (res) {
63
+ _clearStoreData({ excludedKeys: ['isTutorial'] })
64
+ setBusiness({})
65
+ setStateValues({
66
+ options: {
67
+ moment: null
68
+ },
69
+ carts: {},
70
+ })
71
+ }
60
72
  onClose();
61
73
  }
62
74
  }
@@ -110,7 +110,8 @@ const OrderProgressUI = (props: any) => {
110
110
  const deliveryTime = order?.delivery_datetime_utc
111
111
  ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm' })
112
112
  : parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD HH:mm' })
113
- const [hour, minute] = time.split(':')
113
+ const hour = time?.split(':')?.[0]
114
+ const minute = time?.split(':')?.[1]
114
115
  const result = time ? (parseInt(hour, 10) * 60) + parseInt(minute, 10) : 0
115
116
  const returnedDate = moment(deliveryTime).add(result, 'minutes').format('hh:mm A')
116
117
  return returnedDate
@@ -90,7 +90,7 @@ const OInput = (props: Props): React.ReactElement => {
90
90
  onSubmitEditing={props.onSubmitEditing}
91
91
  blurOnSubmit={props.blurOnSubmit}
92
92
  ref={(e : any) => {
93
- props.forwardRef.current = e
93
+ props.forwardRef && (props.forwardRef.current = e)
94
94
  }}
95
95
  style={props?.inputStyle}
96
96
  />