ordering-ui-react-native 0.18.90 → 0.18.92

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.18.90",
3
+ "version": "0.18.92",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -83,6 +83,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
83
83
 
84
84
  const validStatusComplete = [9, 19, 23]
85
85
 
86
+ const pendingOrderStatus = [1, 4, 7, 13]
87
+
86
88
  const logisticOrderStatus = [4, 6, 7]
87
89
 
88
90
  const showFloatButtonsPickUp: any = {
@@ -325,7 +327,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
325
327
  };
326
328
 
327
329
  const handleArrowBack: any = () => {
328
- if (alertState?.open && !isAllowedDriverRejectOrder) {
330
+ if (alertState?.open && !isAllowedDriverRejectOrder && !pendingOrderStatus.includes(order?.status)) {
329
331
  setAlertState({
330
332
  ...alertState,
331
333
  open: false
@@ -385,7 +387,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
385
387
  }, [props.order?.loading]);
386
388
 
387
389
  useEffect(() => {
388
- if (order?.driver === null && session?.user?.level === 4) {
390
+ if (!order?.driver_id && session?.user?.level === 4) {
389
391
  setAlertState({
390
392
  open: true,
391
393
  content: [
@@ -525,7 +527,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
525
527
  </View>
526
528
  )}
527
529
 
528
- {(!!props.order?.error || props.order?.error) && (
530
+ {(!!props.order?.error || props.order?.error?.length > 0) && (
529
531
  <NotFoundSource
530
532
  btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
531
533
  content={
@@ -94,8 +94,7 @@ export const OrderItem = (props: any) => {
94
94
  });
95
95
 
96
96
  const getDelayMinutes = (order: any) => {
97
- const offset = 300
98
- const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
97
+ const cdtToutc = moment(order?.delivery_datetime).utc().format('YYYY-MM-DD HH:mm:ss')
99
98
  const _delivery = order?.delivery_datetime_utc
100
99
  ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
101
100
  : parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
@@ -229,10 +229,11 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
229
229
  )}
230
230
  {(!isCustomLayout) && !hideBusinessOffer && (
231
231
  getBusinessOffer((business?.offers)) &&
232
- <OfferBox>
232
+ <OfferBox isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}>
233
233
  <OText
234
234
  size={10}
235
235
  weight={'400'}
236
+ color={theme.colors.textThird}
236
237
  numberOfLines={2}
237
238
  ellipsizeMode='tail'
238
239
  lineHeight={13}
@@ -34,8 +34,8 @@ export const Metadata = styled.View`
34
34
 
35
35
  export const BusinessState = styled.View`
36
36
  position: absolute;
37
- top: 13px;
38
- end: 18px;
37
+ top: 15px;
38
+ right: 15px;
39
39
  `
40
40
 
41
41
  export const BusinessLogo = styled.View`
@@ -85,10 +85,9 @@ export const RibbonBox = styled.View`
85
85
  export const OfferBox = styled.View`
86
86
  position: absolute;
87
87
  z-index: 1;
88
- top: 20px;
89
- right: 10px;
90
88
  border-radius: 50px;
91
- color: ${(props: any) => props.theme.colors.textThird};
89
+ top: 15px;
90
+ right: ${(props: any) => props.isClosed ? '110px' : '15px'};
92
91
  background: ${(props: any) => props.theme.colors.inputBorderColor};
93
92
  padding: 3px 8px;
94
93
  max-width: 180px;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
- useLanguage, useUtils
4
+ useLanguage, useUtils, useConfig,
5
5
  } from 'ordering-components/native';
6
6
  import { useTheme } from 'styled-components/native';
7
7
  import { OIcon, OText } from '../shared';
@@ -22,31 +22,27 @@ import { GoogleMap } from '../GoogleMap';
22
22
  import { WebView } from 'react-native-webview';
23
23
  import { formatUrlVideo } from '../../utils'
24
24
  import { ScheduleAccordion } from '../ScheduleAccordion';
25
+ import moment from 'moment';
25
26
  const BusinessInformationUI = (props: BusinessInformationParams) => {
26
27
  const { businessState, businessSchedule, businessLocation } = props;
27
28
 
28
29
  const theme = useTheme();
29
30
  const [, t] = useLanguage();
30
31
  const [{ optimizeImage }] = useUtils();
32
+ const [{ configs }] = useConfig()
31
33
 
32
34
  const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
33
35
  const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
34
36
  const hideVideos = theme?.business_view?.components?.information?.components?.videos?.hidden
35
37
  const hideImages = theme?.business_view?.components?.information?.components?.images?.hidden
36
38
  const hideAddress = theme?.business_view?.components?.information?.components?.address?.hidden
39
+ const formatTime = configs?.general_hour_format?.value
40
+
41
+ const checkTime = (val: number) => (val < 10 ? `0${val}` : val);
42
+ const timeFormated = (time: any) => {
43
+ return moment(`1900-01-01 ${checkTime(time.hour)}:${checkTime(time.minute)}`).format(formatTime)
44
+ }
37
45
 
38
- const scheduleFormatted = ({
39
- hour,
40
- minute,
41
- }: {
42
- hour: number | string;
43
- minute: number | string;
44
- }) => {
45
- const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
46
- const zz = hour > 12 ? 'PM' : 'AM';
47
- const h = parseInt(`${hour}`);
48
- return `${h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}`;
49
- };
50
46
  const businessCoordinate = {
51
47
  lat: businessState?.business?.location?.lat,
52
48
  lng: businessState?.business?.location?.lng,
@@ -121,7 +117,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
121
117
  <ScheduleBlock key={i}>
122
118
  <ScheduleAccordion
123
119
  weekIndex={i}
124
- scheduleFormatted={scheduleFormatted}
120
+ timeFormated={timeFormated}
125
121
  schedule={schedule}
126
122
  />
127
123
  </ScheduleBlock>
@@ -572,7 +572,7 @@ const CheckoutUI = (props: any) => {
572
572
  data: deliveryOptions || [],
573
573
  renderItem: ({ item }: any) => (
574
574
  <TouchableOpacity
575
- onPress={() => changeDeliveryOption(item.value)}
575
+ onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
576
576
  disabled={
577
577
  deliveryOptionSelected === item.value
578
578
  }
@@ -200,7 +200,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
200
200
 
201
201
  return (
202
202
  <>
203
- {!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
203
+ {!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && ordersLength?.preordersLength === 0 && !activeOrders && !preOrders && (
204
204
  <NoOrdersWrapper>
205
205
  <NotFoundSource
206
206
  hideImage
@@ -13,7 +13,7 @@ import { OIcon, OText } from '../shared';
13
13
  export const ScheduleAccordion = (props: any) => {
14
14
 
15
15
  const {
16
- scheduleFormatted,
16
+ timeFormated,
17
17
  schedule,
18
18
  weekIndex
19
19
  } = props
@@ -52,9 +52,9 @@ export const ScheduleAccordion = (props: any) => {
52
52
  {schedule?.lapses?.map((lapse: any) => (
53
53
  schedule?.enabled ?
54
54
  <OText mBottom={16}>
55
- {scheduleFormatted(lapse.open) +
55
+ {timeFormated(lapse.open) +
56
56
  ' - ' +
57
- scheduleFormatted(lapse.close)}
57
+ timeFormated(lapse.close)}
58
58
  </OText>
59
59
  :
60
60
  <OText color={theme.colors.red} mBottom={16}>
@@ -143,7 +143,7 @@ const WalletsUI = (props: any) => {
143
143
  btnStyle={{ paddingLeft: 0 }}
144
144
  hideArrowLeft={!hideWalletsTheme}
145
145
  />
146
- {isChewLayout && (
146
+ {isChewLayout && !openHistory && (
147
147
  <OButton
148
148
  text={t('WALLET_HISTORY', 'Wallet history')}
149
149
  bgColor={theme.colors.white}