ordering-ui-react-native 0.19.0-testing → 0.19.1

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.19.0-testing",
3
+ "version": "0.19.1",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -215,7 +215,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
215
215
  status: 7,
216
216
  },
217
217
  rejectByBusiness: {
218
- comment: comments,
218
+ reasons: comments,
219
219
  status: 5,
220
220
  },
221
221
  acceptByDriver: {
@@ -223,22 +223,22 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
223
223
  status: 8,
224
224
  },
225
225
  rejectByDriver: {
226
- comment: comments,
226
+ reasons: comments,
227
227
  status: 6,
228
228
  reject_reason: rejectReason
229
229
  },
230
230
  pickupFailedByDriver: {
231
- comment: comments,
231
+ reasons: comments,
232
232
  status: 10,
233
233
  reject_reason: rejectReason
234
234
  },
235
235
  deliveryFailedByDriver: {
236
- comment: comments,
236
+ reasons: comments,
237
237
  status: 12,
238
238
  reject_reason: rejectReason
239
239
  },
240
240
  orderNotReady: {
241
- comment: comments,
241
+ reasons: comments,
242
242
  status: 14,
243
243
  reject_reason: rejectReason
244
244
  },
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { RefreshControl, ScrollView, View } from 'react-native'
3
3
  import { OText } from '../shared'
4
- import { useLanguage, useSession } from 'ordering-components/native'
4
+ import { useLanguage, useSession, useUtils } from 'ordering-components/native'
5
5
  import { DayContainer } from './styles'
6
6
  import { useTheme } from 'styled-components/native'
7
7
  export const DriverSchedule = (props: any) => {
@@ -9,6 +9,7 @@ export const DriverSchedule = (props: any) => {
9
9
  const [, t] = useLanguage()
10
10
  const theme = useTheme()
11
11
  const [, { refreshUserInfo }] = useSession()
12
+ const [{ parseDate }] = useUtils()
12
13
  const [refreshing] = useState(false);
13
14
  const [driverSchedule, setDriverSchedule] = useState([]);
14
15
 
@@ -22,6 +23,12 @@ export const DriverSchedule = (props: any) => {
22
23
  t('SATURDAY_ABBREVIATION', 'Sat')
23
24
  ]
24
25
 
26
+ const getNextDate = (day) => {
27
+ const now = new Date()
28
+ now.setDate(now.getDate() + (day + (7 - now.getDay())) % 7)
29
+ return now
30
+ }
31
+
25
32
  const scheduleFormatted = ({ hour, minute }: any) => {
26
33
  const checkTime = (val: number) => val < 10 ? `0${val}` : val
27
34
  return `${checkTime(hour)}:${checkTime(minute)}`
@@ -66,8 +73,11 @@ export const DriverSchedule = (props: any) => {
66
73
  <View style={{ padding: 30 }}>
67
74
  {driverSchedule.map((item: any, i: number) => (
68
75
  <DayContainer key={daysOfWeek[i]}>
69
- <OText style={{ width: '20%' }} size={22} weight={700}>{daysOfWeek[i]}</OText>
70
- <View style={{ width: '80%', alignItems: 'center' }}>
76
+ <View style={{ width: '30%' }}>
77
+ <OText size={22} weight={700}>{daysOfWeek[i]}</OText>
78
+ <OText size={14}>{parseDate(getNextDate(i), { outputFormat: 'YYYY-MM-DD' })}</OText>
79
+ </View>
80
+ <View style={{ width: '70%', alignItems: 'center' }}>
71
81
  <>
72
82
  {item?.enabled ? (
73
83
  <View>
@@ -45,7 +45,7 @@ const NewOrderNotificationUI = (props: any) => {
45
45
  },
46
46
  }
47
47
 
48
- const notificationSound = new Sound('https://cdn.freesound.org/previews/81/81205_1274366-lq.mp3', '', () => {});
48
+ const notificationSound = new Sound(theme.sounds.notification, '', () => { });
49
49
 
50
50
  let _timeout: any = null
51
51
  let times = 0
@@ -118,7 +118,6 @@ const NewOrderNotificationUI = (props: any) => {
118
118
  }, [])
119
119
 
120
120
  useEffect(() => {
121
- handlePlayNotificationSound()
122
121
  return () => handleCloseEvents()
123
122
  }, [])
124
123
 
@@ -127,7 +126,7 @@ const NewOrderNotificationUI = (props: any) => {
127
126
  <Modal
128
127
  animationType='slide'
129
128
  transparent={true}
130
- visible={true ?? !!currentEvent?.orderId}
129
+ visible={!!currentEvent?.orderId}
131
130
  >
132
131
  <NotificationContainer>
133
132
  <View style={styles.modalView}>
@@ -279,7 +279,7 @@ const CheckoutUI = (props: any) => {
279
279
  const checkValidationFields = () => {
280
280
  setUserErrors([])
281
281
  const errors = []
282
- const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
282
+ const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
283
283
  const _requiredFields: any = []
284
284
 
285
285
  Object.values(validationFields?.fields?.checkout).map((field: any) => {