ordering-ui-react-native 0.22.67-release → 0.22.68-release

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.
@@ -203,9 +203,9 @@ export const MyOrders = (props: any) => {
203
203
  setOrdersLength={setOrdersLength}
204
204
  />
205
205
  )}
206
-
206
+
207
207
  {selectedOption === 'giftCards' && (
208
- <View style={{ paddingHorizontal: 20 }}>
208
+ <View style={{ paddingHorizontal: 20 }}>
209
209
  <GiftCardOrdersList
210
210
  onNavigationRedirect={props?.onNavigationRedirect}
211
211
  />
@@ -534,7 +534,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
534
534
  <LinearGradient
535
535
  start={{ x: 0.0, y: 0.0 }}
536
536
  end={{
537
- x: progressBarObjt(order?.status)?.percentage || 0,
537
+ x: progressBarObjt(order?.status, t)?.percentage || 0,
538
538
  y: 0,
539
539
  }}
540
540
  locations={[0.9999, 0.9999]}
@@ -547,7 +547,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
547
547
  lineHeight={24}
548
548
  weight={'600'}
549
549
  color={theme.colors.textNormal}>
550
- {progressBarObjt(order?.status)?.value}
550
+ {progressBarObjt(order?.status, t)?.value}
551
551
  </OText>
552
552
  </>
553
553
  )}
@@ -114,7 +114,7 @@ const OrderProgressUI = (props: any) => {
114
114
  setInitialLoaded(true)
115
115
  }, [orderList.loading, initialLoaded])
116
116
 
117
- const progressBarObjt = (s: any) => lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp(s) : getOrderStatus(s, t)
117
+ const progressBarObjt = (s: any) => lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp(s, t) : getOrderStatus(s, t)
118
118
 
119
119
  return (
120
120
  <>
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import {
3
- OrderTypeControl,
4
- useLanguage,
5
- useOrder,
3
+ OrderTypeControl,
4
+ useLanguage,
5
+ useOrder,
6
6
  } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native';
8
8
  import { Platform, View } from 'react-native'
@@ -14,133 +14,132 @@ import { ORDER_TYPES } from '../../config/constants';
14
14
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
15
15
 
16
16
  const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
17
- const {
18
- navigation,
19
- handleChangeOrderType,
20
- handleChangeType,
21
- typeSelected,
22
- defaultValue,
23
- configTypes,
24
- orderTypes,
25
- setOrderTypeValue,
26
- isChewLayout,
27
- chewOrderTypes
28
- } = props
17
+ const {
18
+ navigation,
19
+ handleChangeOrderType,
20
+ handleChangeType,
21
+ typeSelected,
22
+ defaultValue,
23
+ configTypes,
24
+ orderTypes,
25
+ setOrderTypeValue,
26
+ isChewLayout,
27
+ chewOrderTypes
28
+ } = props
29
29
 
30
- const theme = useTheme();
31
- const [orderState] = useOrder();
32
- const [, t] = useLanguage();
33
- const _orderTypes = orderTypes.filter((type: any) => configTypes?.includes(type.value));
34
- const orderTypeTitle = (type: string) => theme?.header?.components?.order_types?.components?.[type]?.components?.title
35
- const orderTypeDescription = (type: string) => theme?.header?.components?.order_types?.components?.[type]?.components?.description
36
- const orderTypeCallAction = (type: string) => theme?.header?.components?.order_types?.components?.[type]?.components?.call_to_action
37
- const items = _orderTypes.map((type) => {
38
- return {
39
- value: type.value,
40
- label: t(type.content, type.content),
41
- description: t(type.description, 'Lorem ipsum dolor sit amet, consectetur.')
42
- }
43
- })
30
+ const theme = useTheme();
31
+ const [orderState] = useOrder();
32
+ const [, t] = useLanguage();
33
+ const _orderTypes = orderTypes.filter((type: any) => configTypes?.includes(type.value));
34
+ const orderTypeTitle = (type: string) => theme?.header?.components?.order_types?.components?.[type]?.components?.title
35
+ const orderTypeDescription = (type: string) => theme?.header?.components?.order_types?.components?.[type]?.components?.description
36
+ const orderTypeCallAction = (type: string) => theme?.header?.components?.order_types?.components?.[type]?.components?.call_to_action
37
+ const items = _orderTypes.map((type) => {
38
+ return {
39
+ value: type.value,
40
+ label: orderTypeTitle(type.value) || t(type.content, type.content),
41
+ description: orderTypeDescription(type.value) || t(type.description, 'Lorem ipsum dolor sit amet, consectetur.')
42
+ }
43
+ })
44
44
 
45
- const goToBack = () => !orderState?.loading && navigation?.canGoBack() && navigation.goBack();
45
+ const goToBack = () => !orderState?.loading && navigation?.canGoBack() && navigation.goBack();
46
46
 
47
- const handleChangeOrderTypeCallback = (orderType: number) => {
48
- if (!orderState.loading) {
49
- setOrderTypeValue && setOrderTypeValue(orderType)
50
- handleChangeOrderType(orderType)
51
- if (!isChewLayout) {
52
- goToBack();
53
- }
54
- }
55
- }
47
+ const handleChangeOrderTypeCallback = (orderType: number) => {
48
+ if (!orderState.loading) {
49
+ setOrderTypeValue && setOrderTypeValue(orderType)
50
+ handleChangeOrderType(orderType)
51
+ if (!isChewLayout) {
52
+ goToBack();
53
+ }
54
+ }
55
+ }
56
56
 
57
- useEffect(() => {
58
- handleChangeType && handleChangeType(typeSelected)
59
- }, [typeSelected])
57
+ useEffect(() => {
58
+ handleChangeType && handleChangeType(typeSelected)
59
+ }, [typeSelected])
60
60
 
61
- return (
62
- <Wrapper>
63
- {isChewLayout ? (
64
- <View>
65
- <OTabs
66
- horizontal
67
- showsHorizontalScrollIndicator={false}
68
- >
69
- {chewOrderTypes?.map((type: any) => (
70
- <TabBtn
71
- key={type.value}
72
- onPress={() => handleChangeOrderTypeCallback(type.value)}
73
- >
74
- <OTab
75
- style={{
76
- borderBottomColor:
77
- type.value === typeSelected
78
- ? theme.colors.textNormal
79
- : theme.colors.border,
80
- }}>
81
- <OText
82
- size={14}
83
- color={
84
- type.value === typeSelected
85
- ? theme.colors.textNormal
86
- : theme.colors.disabled
87
- }
88
- weight={type.value === typeSelected ? 'bold' : 'normal'}>
89
- {type.name}
90
- </OText>
91
- </OTab>
92
- </TabBtn>
93
- ))}
94
- </OTabs>
95
- </View>
96
- ) : (
97
- <>
98
- <NavBar
99
- onActionLeft={() => goToBack()}
100
- btnStyle={{ paddingLeft: 0, width: 50 }}
101
- paddingTop={Platform.OS === 'ios' ? 10 : 0}
102
- style={{ paddingBottom: 0 }}
103
- title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
104
- titleAlign={'center'}
105
- titleStyle={{ fontSize: 14 }}
106
- noMargin
107
- />
108
- {
109
- items.length > 0 && (
110
- <ListWrapper>
111
- {
112
- items && items.map((item: any, idx: number) =>
113
- <OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
114
- <BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{ opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4 }}>
115
- <MaskCont>
116
- <OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
117
- <OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
118
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
119
- <OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
120
- <AntDesignIcon name='arrowleft' size={26} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
121
- </View>
122
- </MaskCont>
123
- </BgImage>
124
- </OrderTypeWrapper>
125
- )
126
- }
127
- </ListWrapper>
128
- )
129
- }
130
- </>
131
- )}
61
+ return (
62
+ <Wrapper>
63
+ {isChewLayout ? (
64
+ <View>
65
+ <OTabs
66
+ horizontal
67
+ showsHorizontalScrollIndicator={false}
68
+ >
69
+ {chewOrderTypes?.map((type: any) => (
70
+ <TabBtn
71
+ key={type.value}
72
+ onPress={() => handleChangeOrderTypeCallback(type.value)}
73
+ >
74
+ <OTab
75
+ style={{
76
+ borderBottomColor:
77
+ type.value === typeSelected
78
+ ? theme.colors.textNormal
79
+ : theme.colors.border,
80
+ }}>
81
+ <OText
82
+ size={14}
83
+ color={
84
+ type.value === typeSelected
85
+ ? theme.colors.textNormal
86
+ : theme.colors.disabled
87
+ }
88
+ weight={type.value === typeSelected ? 'bold' : 'normal'}>
89
+ {type.name}
90
+ </OText>
91
+ </OTab>
92
+ </TabBtn>
93
+ ))}
94
+ </OTabs>
95
+ </View>
96
+ ) : (
97
+ <>
98
+ <NavBar
99
+ onActionLeft={() => goToBack()}
100
+ btnStyle={{ paddingLeft: 0, width: 50 }}
101
+ paddingTop={Platform.OS === 'ios' ? 10 : 0}
102
+ style={{ paddingBottom: 0 }}
103
+ title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
104
+ titleAlign={'center'}
105
+ noMargin
106
+ />
107
+ {
108
+ items.length > 0 && (
109
+ <ListWrapper>
110
+ {
111
+ items && items.map((item: any, idx: number) =>
112
+ <OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
113
+ <BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{ opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4 }}>
114
+ <MaskCont>
115
+ <OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
116
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
117
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
118
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{orderTypeCallAction(item?.value) || t('START_MY_ORDER', 'Start my order')}</OText>
119
+ <AntDesignIcon name='arrowleft' size={26} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
120
+ </View>
121
+ </MaskCont>
122
+ </BgImage>
123
+ </OrderTypeWrapper>
124
+ )
125
+ }
126
+ </ListWrapper>
127
+ )
128
+ }
129
+ </>
130
+ )}
132
131
 
133
- </Wrapper>
134
- )
132
+ </Wrapper>
133
+ )
135
134
  }
136
135
 
137
136
  export const OrderTypeSelector = (props: any) => {
138
137
 
139
- const orderTypeProps = {
140
- ...props,
141
- UIComponent: OrderTypeSelectorUI,
142
- orderTypes: props.orderTypes || ORDER_TYPES
143
- }
138
+ const orderTypeProps = {
139
+ ...props,
140
+ UIComponent: OrderTypeSelectorUI,
141
+ orderTypes: props.orderTypes || ORDER_TYPES
142
+ }
144
143
 
145
- return <OrderTypeControl {...orderTypeProps} />
144
+ return <OrderTypeControl {...orderTypeProps} />
146
145
  }