ordering-ui-react-native 0.15.46 → 0.15.49

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.15.46",
3
+ "version": "0.15.49",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -102,12 +102,13 @@ export const PreviousOrders = (props: any) => {
102
102
  const getDelayMinutes = (order: any) => {
103
103
  // targetMin = delivery_datetime + eta_time - now()
104
104
  const offset = 300
105
- const cdtToutc = parseDate(moment(order?.delivery_datetime).add(offset, 'minutes'))
105
+ const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
106
106
  const _delivery = order?.delivery_datetime_utc
107
107
  ? parseDate(order?.delivery_datetime_utc)
108
108
  : parseDate(cdtToutc)
109
109
  const _eta = order?.eta_time
110
- return moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'minutes')
110
+ const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
111
+ return Math.ceil(diffTimeAsSeconds / 60)
111
112
  }
112
113
 
113
114
  const displayDelayedTime = (order: any) => {
@@ -128,9 +129,10 @@ export const PreviousOrders = (props: any) => {
128
129
  return finalTaget
129
130
  }
130
131
 
131
- const getStatusClassName = (minutes: any) => {
132
- if (isNaN(Number(minutes))) return 0
133
- return minutes > 0 ? 'in_time' : minutes === 0 ? 'at_risk' : 'delayed'
132
+ const getStatusClassName = (minutes: number) => {
133
+ if (isNaN(Number(minutes))) return 'in_time'
134
+ const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
135
+ return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
134
136
  }
135
137
 
136
138
  useEffect(() => {
@@ -446,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
446
446
  </WrapperIngredients>
447
447
  </View>
448
448
  )}
449
- {product?.extras.map((extra: any) => extra.options.map((option: any) => {
449
+ {product?.extras.map((extra: any) => extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
450
450
  const currentState = productCart.options[`id:${option.id}`] || {}
451
451
  return (
452
452
  <React.Fragment key={option.id}>
@@ -460,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
460
460
  >
461
461
  <WrapperSubOption style={{ backgroundColor: isError(option.id) }}>
462
462
  {
463
- option.suboptions.map((suboption: any) => {
463
+ option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map((suboption: any) => {
464
464
  const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {}
465
465
  const balance = productCart.options[`id:${option.id}`]?.balance || 0
466
466
  return (
@@ -188,7 +188,7 @@ const OrderProgressUI = (props: any) => {
188
188
  <ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
189
189
  </ProgressContentWrapper>
190
190
  <ProgressTextWrapper>
191
- <OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
191
+ <OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
192
192
  <TimeWrapper>
193
193
  <OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
194
194
  <OText size={11}>
@@ -20,6 +20,7 @@ export const ProgressTextWrapper = styled.View`
20
20
  flex-direction: row;
21
21
  justify-content: space-between;
22
22
  align-items: center;
23
+ width: 100%;
23
24
  `
24
25
 
25
26
  export const OrderInfoWrapper = styled.View`
@@ -695,7 +695,7 @@ export const ProductOptionsUI = (props: any) => {
695
695
  </View>
696
696
  )}
697
697
  {product?.extras.map((extra: any) =>
698
- extra.options.map((option: any) => {
698
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
699
699
  const currentState =
700
700
  productCart.options[`id:${option.id}`] || {};
701
701
  return (
@@ -711,7 +711,7 @@ export const ProductOptionsUI = (props: any) => {
711
711
  backgroundColor: isError(option.id),
712
712
  borderRadius: 7.6
713
713
  }}>
714
- {option.suboptions.map(
714
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
715
715
  (suboption: any) => {
716
716
  const currentState =
717
717
  productCart.options[
@@ -779,7 +779,7 @@ export const ProductOptionsUI = (props: any) => {
779
779
  ) : (
780
780
  <>
781
781
  {product?.extras.map((extra: any) =>
782
- extra.options.map((option: any) => {
782
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
783
783
  if (
784
784
  option.id == selOpt ||
785
785
  (hasRespected(
@@ -804,7 +804,7 @@ export const ProductOptionsUI = (props: any) => {
804
804
  option.id,
805
805
  ),
806
806
  }}>
807
- {option.suboptions.map(
807
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
808
808
  (suboption: any) => {
809
809
  const currentState =
810
810
  productCart.options[
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Platform } from 'react-native';
2
3
  import OText from './OText';
3
4
 
4
5
  const HeaderTitle = (props: any) => {
@@ -7,7 +8,7 @@ const HeaderTitle = (props: any) => {
7
8
  <OText
8
9
  size={24}
9
10
  style={style ?? {
10
- marginTop: 30,
11
+ marginTop: Platform.OS === 'android' ? 50 : 30,
11
12
  paddingHorizontal: 40,
12
13
  textTransform: 'capitalize'
13
14
  }}