ordering-ui-react-native 0.21.13 → 0.21.15

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.13",
3
+ "version": "0.21.15",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -19,6 +19,8 @@ import { BusinessBasicInformation } from '../BusinessBasicInformation'
19
19
  import { BusinessInformationParams } from '../../types'
20
20
  import { GoogleMap } from '../GoogleMap'
21
21
  import { useTheme } from 'styled-components/native';
22
+ import moment from 'moment';
23
+
22
24
  const BusinessInformationUI = (props: BusinessInformationParams) => {
23
25
  const {
24
26
  businessState,
@@ -38,14 +40,13 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
38
40
  t('FRIDAY_ABBREVIATION', 'Fri'),
39
41
  t('SATURDAY_ABBREVIATION', 'Sat')
40
42
  ]
41
- const is12hours = configs?.format_time?.value?.includes('12')
42
43
 
43
- const scheduleFormatted = ({ hour, minute } : { hour : number | string, minute : number | string}) => {
44
- const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
45
- const zz = hour === 0 ? t('AM', 'AM') : hour >= 12 ? t('PM', 'PM') : t('AM', 'AM');
46
- const h = parseInt(`${hour}`);
47
- return is12hours ? `${h === 0 ? 12 : h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}` : `${checkTime(hour)}:${checkTime(minute)}`;
48
- }
44
+ const formatTime = configs?.general_hour_format?.value
45
+
46
+ const checkTime = (val: number) => (val < 10 ? `0${val}` : val);
47
+ const timeFormated = (time: any) => {
48
+ return moment(`1900-01-01 ${checkTime(time.hour)}:${checkTime(time.minute)}`).format(formatTime)
49
+ }
49
50
 
50
51
  return (
51
52
  <BusinessInformationContainer>
@@ -105,13 +106,13 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
105
106
  {schedule.enabled ? (
106
107
  schedule.lapses.map( (time: any, k: number) => (
107
108
  <React.Fragment key={k}>
108
- <OText>{scheduleFormatted(time.open)}</OText>
109
+ <OText>{timeFormated(time.open)}</OText>
109
110
  <OText mBottom={10} style={{
110
111
  padding: 3,
111
112
  borderBottomColor: theme.colors.primary,
112
113
  borderBottomWidth: 1
113
114
  }}
114
- >{scheduleFormatted(time.close)}</OText>
115
+ >{timeFormated(time.close)}</OText>
115
116
  </React.Fragment>
116
117
  ))) : ( <OText>{t('CLOSED', 'Closed')}</OText>)}
117
118
  </ScheduleBlock>
@@ -107,8 +107,12 @@ export const OrderHistory = (props: any) => {
107
107
  ellipsizeMode='tail'
108
108
  >
109
109
  {t('ORDER_PLACED', 'Order placed')} {' '}
110
- {t('VIA', 'Via')}{' '}
111
- {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
110
+ {!props.hideViaText && (
111
+ <>
112
+ {t('VIA', 'Via')}{' '}
113
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
114
+ </>
115
+ )}
112
116
  </OText>
113
117
  <OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
114
118
  </View>
@@ -1066,6 +1066,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1066
1066
  >
1067
1067
  <OrderHistory
1068
1068
  order={order}
1069
+ hideViaText={props.hideViaText}
1069
1070
  messages={messages}
1070
1071
  enableReview={(
1071
1072
  parseInt(order?.status) === 1 ||
@@ -437,6 +437,7 @@ export interface OrderDetailsParams {
437
437
  onNavigationRedirect?: any,
438
438
  reorderState?: any,
439
439
  handleReorder?: any,
440
+ hideViaText?: boolean,
440
441
  }
441
442
  export interface ProductItemAccordionParams {
442
443
  key?: any;
@@ -581,7 +582,7 @@ export interface BusinessPreorderParams {
581
582
  handleBusinessClick: (value: any) => {};
582
583
  getActualSchedule?: any;
583
584
  cateringPreorder?: boolean;
584
- preorderLeadTime?: number
585
+ preorderLeadTime?: number
585
586
  }
586
587
  export interface BusinessMenuListParams {
587
588
  menu: any;