ordering-ui-react-native 0.21.80 → 0.21.82

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.21.80",
3
+ "version": "0.21.82",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -16,7 +16,8 @@ import {
16
16
  useApi,
17
17
  useEvent,
18
18
  useLanguage,
19
- useSession
19
+ useSession,
20
+ useConfig
20
21
  } from 'ordering-components/native'
21
22
 
22
23
  import { OIcon, OText } from '../shared'
@@ -95,9 +96,14 @@ const NewOrderNotificationUI = (props: any) => {
95
96
  const [events] = useEvent()
96
97
  const [{ user, token }] = useSession()
97
98
  const [ordering] = useApi()
99
+ const [{ configs }] = useConfig()
98
100
  const { getCurrentLocation } = useLocation()
99
101
  const [currentEvent, setCurrentEvent] = useState<any>(null)
100
102
 
103
+ const orderStatus = !!isBusinessApp
104
+ ? configs?.notification_business_states?.value.split('|').map((value: any) => Number(value)) || []
105
+ : configs?.notification_driver_states?.value.split('|').map((value: any) => Number(value)) || []
106
+
101
107
  const handleEventNotification = async (evtType: number, value: any) => {
102
108
  if (value?.driver) {
103
109
  try {
@@ -105,18 +111,26 @@ const NewOrderNotificationUI = (props: any) => {
105
111
  await fetch(`${ordering.root}/users/${user.id}/locations`, {
106
112
  method: 'POST',
107
113
  body: JSON.stringify({
108
- location: JSON.stringify({ location: `{lat: ${location.latitude}, lng: ${location.longitude}}` })
114
+ location: JSON.stringify({
115
+ location: `{
116
+ lat: ${location.latitude},
117
+ lng: ${location.longitude}
118
+ }`
119
+ })
109
120
  }),
110
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
121
+ headers: {
122
+ 'Content-Type': 'application/json',
123
+ Authorization: `Bearer ${token}`
124
+ }
111
125
  })
112
126
  } catch { }
113
127
  const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
114
128
  const assignedSecondsDiff = duration.asSeconds()
115
- if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
129
+ if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status && orderStatus.includes(value.status)) {
116
130
  setCurrentEvent({ evt: 2, orderId: value?.id ?? value?.order_id })
117
131
  }
118
132
  }
119
- if ((evtType === 3 && (value.status !== 8 || !value?.driver) && !value.uuid) || value?.author_id === user.id) return
133
+ if (!orderStatus.includes(value.status) || value?.author_id === user.id) return
120
134
  setCurrentEvent({
121
135
  evt: evtType,
122
136
  orderId: value?.driver
@@ -247,7 +247,7 @@ export const BusinessBasicInformation = (
247
247
  <View style={styles.tiktokIcon}>
248
248
  <OIcon
249
249
  src={theme.images.general.tiktok}
250
- style={{ width: 10, height: 12 }}
250
+ style={{ width: 10, height: 12, bottom: 1 }}
251
251
  cover
252
252
  />
253
253
  </View>