ordering-ui-react-native 0.21.91 → 0.21.93

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.91",
3
+ "version": "0.21.93",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -138,7 +138,10 @@ export const Home = (props: any) => {
138
138
  placeholder={t('PROJECT_NAME', 'Project Name')}
139
139
  icon={theme.images.general.project}
140
140
  iconColor={theme.colors.arrowColor}
141
- onChange={(e: any) => onChange(e?.target?.value)}
141
+ onChange={(e: any) => {
142
+ const project = e?.target?.value?.replace(/\s/g, '')
143
+ onChange(project)
144
+ }}
142
145
  selectionColor={theme.colors.primary}
143
146
  color={theme.colors.white}
144
147
  value={value}
@@ -148,6 +151,7 @@ export const Home = (props: any) => {
148
151
  autoCapitalize='none'
149
152
  blurOnSubmit={false}
150
153
  onSubmitEditing={() => handleSubmit(onSubmit)()}
154
+ isValueSync
151
155
  />
152
156
  )}
153
157
  />
@@ -4,7 +4,10 @@ import {
4
4
  View,
5
5
  StyleSheet,
6
6
  Dimensions,
7
- TouchableOpacity
7
+ TouchableOpacity,
8
+ NativeModules,
9
+ PermissionsAndroid,
10
+ Platform
8
11
  } from 'react-native';
9
12
  import { useTheme } from 'styled-components/native'
10
13
  import moment from 'moment'
@@ -32,7 +35,7 @@ const SoundPlayerComponent = (props: any) => {
32
35
 
33
36
  const theme = useTheme()
34
37
  const [count, setCount] = useState(0);
35
-
38
+ const [isEnabledReadStorage, setIsEnabledReadStorage] = useState(true)
36
39
  const URL_SOUND = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
37
40
 
38
41
  useEffect(() => {
@@ -43,15 +46,28 @@ const SoundPlayerComponent = (props: any) => {
43
46
  await new Promise(resolve => setTimeout(resolve, DELAY_SOUND))
44
47
  SoundPlayer.stop()
45
48
  }
46
-
47
- playSound()
49
+ if (NativeModules?.RNSoundPlayer?.playUrl && typeof URL_SOUND === 'string' && isEnabledReadStorage) {
50
+ playSound()
51
+ }
48
52
 
49
53
  return () => {
50
54
  SoundPlayer.stop()
51
55
  clearInterval(id);
52
56
  }
53
- }, [count])
57
+ }, [count, isEnabledReadStorage])
58
+
59
+ useEffect(() => {
60
+ const checkSoundMedia = async () => {
61
+ if (Platform.OS === 'android') {
62
+ const enabled = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE)
63
+ setIsEnabledReadStorage(enabled)
64
+ } else {
65
+ setIsEnabledReadStorage(true)
66
+ }
67
+ }
68
+ checkSoundMedia()
54
69
 
70
+ }, [])
55
71
  return (
56
72
  <Modal
57
73
  animationType='slide'
@@ -64,6 +64,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
64
64
 
65
65
  const { order } = props.order
66
66
 
67
+ const hideTimer = configs?.hidden_driver_eta_time?.value === '1'
67
68
  const isAllowedDriverRejectOrder = configs?.allow_driver_reject_order?.value === '1'
68
69
  const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
69
70
  const theme = useTheme();
@@ -583,7 +584,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
583
584
  secondButton={true}
584
585
  firstColorCustom={theme.colors.red}
585
586
  secondColorCustom={theme.colors.green}
586
- widthButton={isHideRejectButtons ? '100%': '45%'}
587
+ widthButton={isHideRejectButtons ? '100%' : '45%'}
587
588
  isHideRejectButtons={isHideRejectButtons}
588
589
  />
589
590
  )}
@@ -603,7 +604,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
603
604
  secondButton={true}
604
605
  firstColorCustom={theme.colors.red}
605
606
  secondColorCustom={theme.colors.green}
606
- widthButton={isHideRejectButtons ? '100%': '45%'}
607
+ widthButton={isHideRejectButtons ? '100%' : '45%'}
607
608
  isHideRejectButtons={isHideRejectButtons}
608
609
  />
609
610
  </>
@@ -612,13 +613,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
612
613
  <FloatingButton
613
614
  btnText={t('REJECT', 'Reject')}
614
615
  isSecondaryBtn={false}
615
- secondButtonClick={() => (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
616
+ secondButtonClick={() => hideTimer ? handleChangeOrderStatus && handleChangeOrderStatus(8) : (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
616
617
  firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
617
618
  secondBtnText={t('ACCEPT', 'Accept')}
618
619
  secondButton={true}
619
620
  firstColorCustom={theme.colors.red}
620
621
  secondColorCustom={theme.colors.green}
621
- widthButton={isHideRejectButtons ? '100%': '45%'}
622
+ widthButton={isHideRejectButtons ? '100%' : '45%'}
622
623
  isHideRejectButtons={isHideRejectButtons}
623
624
  />
624
625
  )}
@@ -123,6 +123,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
123
123
  backColor: '#E63757'
124
124
  }
125
125
  ]
126
+ const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
126
127
  const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
127
128
  const [openedSelect, setOpenedSelect] = useState('')
128
129
 
@@ -467,7 +468,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
467
468
  nestedScrollEnabled={true}
468
469
  >
469
470
  <TabsContainer>
470
- {(isLogisticActivated && !isBusinessApp) && (
471
+ {(isLogisticActivated && !isBusinessApp && !combineTabs) && (
471
472
  <Pressable
472
473
  style={styles.pressable}
473
474
  onPress={() => setCurrentTabSelected('logisticOrders')}>
@@ -974,7 +975,9 @@ export const Timer = () => {
974
975
 
975
976
  export const OrdersOption = (props: OrdersOptionParams) => {
976
977
  const [, t] = useLanguage();
978
+ const [configState] = useConfig()
977
979
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
980
+ const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
978
981
  const ordersProps = {
979
982
  ...props,
980
983
  UIComponent: OrdersOptionUI,
@@ -1061,32 +1064,52 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1061
1064
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
1062
1065
  }
1063
1066
  ],
1064
- tabs: [
1067
+ tabs: combineTabs ? [
1065
1068
  {
1066
1069
  key: 0,
1067
- text: t('PENDING', 'Pending'),
1068
- tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
1069
- title: 'pending'
1070
+ text: t('ACTIVE', 'Active'),
1071
+ tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
1072
+ title: 'active',
1070
1073
  },
1071
1074
  {
1072
1075
  key: 1,
1073
- text: t('IN_PROGRESS', 'In Progress'),
1074
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1075
- title: 'inProgress',
1076
- },
1077
- {
1078
- key: 2,
1079
1076
  text: t('COMPLETED', 'Completed'),
1080
1077
  tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
1081
1078
  title: 'completed',
1082
1079
  },
1083
1080
  {
1084
- key: 3,
1081
+ key: 2,
1085
1082
  text: t('CANCELLED', 'Cancelled'),
1086
1083
  tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
1087
1084
  title: 'cancelled',
1088
1085
  },
1089
- ]
1086
+ ] :
1087
+ [
1088
+ {
1089
+ key: 0,
1090
+ text: t('PENDING', 'Pending'),
1091
+ tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
1092
+ title: 'pending'
1093
+ },
1094
+ {
1095
+ key: 1,
1096
+ text: t('IN_PROGRESS', 'In Progress'),
1097
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1098
+ title: 'inProgress',
1099
+ },
1100
+ {
1101
+ key: 2,
1102
+ text: t('COMPLETED', 'Completed'),
1103
+ tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
1104
+ title: 'completed',
1105
+ },
1106
+ {
1107
+ key: 3,
1108
+ text: t('CANCELLED', 'Cancelled'),
1109
+ tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
1110
+ title: 'cancelled',
1111
+ },
1112
+ ]
1090
1113
  };
1091
1114
 
1092
1115
  return (<>
@@ -116,7 +116,7 @@ export const SessionsUI = (props: SessionsParams) => {
116
116
  ) : (
117
117
  sessionsList.sessions.length > 0 ? (
118
118
  <SessionsWrapper>
119
- {sessionsList.sessions.map((session: any) => (
119
+ {sessionsList.sessions.reverse().map((session: any) => (
120
120
  <SessionItem key={session.id}>
121
121
  <DurationWrapper>
122
122
  <OText>{parseDate(session.created_at)}</OText>
@@ -64,6 +64,7 @@ interface Props extends TextInputProps {
64
64
  onSubmitEditing?: any;
65
65
  blurOnSubmit?: any;
66
66
  color?: any;
67
+ isValueSync?: boolean
67
68
  }
68
69
 
69
70
  const OInput = (props: Props): React.ReactElement => {
@@ -118,6 +119,7 @@ const OInput = (props: Props): React.ReactElement => {
118
119
  selectionColor={props.selectionColor}
119
120
  color={props.color}
120
121
  maxLength={props.maxLength || 1000}
122
+ value={props.isValueSync && props.value}
121
123
  />
122
124
 
123
125
  {props.iconRight && (
@@ -303,6 +303,7 @@ export interface OrdersOptionParams {
303
303
  filtered?: any;
304
304
  handleClickOrder?: any;
305
305
  orderGroupStatusCustom?: {
306
+ active?: Array<number>;
306
307
  pending?: Array<number>;
307
308
  inProgress?: Array<number>;
308
309
  completed?: Array<number>;
@@ -72,7 +72,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
72
72
  navigation?.canGoBack() && navigation.goBack();
73
73
  return;
74
74
  }
75
- navigation.navigate('BusinessList');
75
+ navigation.navigate('BottomTab');
76
76
  return true
77
77
  }
78
78