ordering-ui-react-native 0.15.10-release → 0.15.12-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.
- package/package.json +1 -1
- package/src/components/OrderDetails/index.tsx +2 -2
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +9 -9
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +123 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/kiosk/src/components/Cart/index.tsx +99 -25
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/OrderDetails/index.tsx +134 -39
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +10 -8
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +20 -1
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/Cart/index.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +26 -26
- package/themes/original/src/components/Promotions/index.tsx +233 -0
- package/themes/original/src/components/Promotions/styles.tsx +58 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +39 -18
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -1
- package/themes/original/src/components/Wallets/index.tsx +58 -4
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { PromotionsController, useLanguage, useUtils, useEvent } from 'ordering-components/native'
|
|
3
|
+
import {
|
|
4
|
+
PromotionsContainer,
|
|
5
|
+
SingleOfferContainer,
|
|
6
|
+
OfferInformation,
|
|
7
|
+
SearchBarContainer,
|
|
8
|
+
SingleBusinessOffer,
|
|
9
|
+
AvailableBusinesses,
|
|
10
|
+
OfferData,
|
|
11
|
+
Code,
|
|
12
|
+
BusinessInfo
|
|
13
|
+
} from './styles'
|
|
14
|
+
import { SearchBar } from '../SearchBar'
|
|
15
|
+
import NavBar from '../NavBar'
|
|
16
|
+
import { useTheme } from 'styled-components/native';
|
|
17
|
+
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
18
|
+
import { Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
19
|
+
import { NotFoundSource } from '../NotFoundSource'
|
|
20
|
+
import { View, StyleSheet, ScrollView } from 'react-native'
|
|
21
|
+
import FastImage from 'react-native-fast-image'
|
|
22
|
+
import { PromotionParams } from '../../types'
|
|
23
|
+
const PromotionsUI = (props: PromotionParams) => {
|
|
24
|
+
const {
|
|
25
|
+
navigation,
|
|
26
|
+
offersState,
|
|
27
|
+
handleSearchValue,
|
|
28
|
+
searchValue,
|
|
29
|
+
offerSelected,
|
|
30
|
+
setOfferSelected
|
|
31
|
+
} = props
|
|
32
|
+
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
productStyle: {
|
|
37
|
+
width: 75,
|
|
38
|
+
height: 75,
|
|
39
|
+
borderRadius: 7.6
|
|
40
|
+
},
|
|
41
|
+
buttonStyle: {
|
|
42
|
+
width: 55,
|
|
43
|
+
height: 25,
|
|
44
|
+
paddingLeft: 0,
|
|
45
|
+
paddingRight: 0
|
|
46
|
+
},
|
|
47
|
+
offerTitle: {
|
|
48
|
+
fontSize: 12
|
|
49
|
+
},
|
|
50
|
+
offerDescription: {
|
|
51
|
+
color: '#909BA9',
|
|
52
|
+
fontSize: 10
|
|
53
|
+
},
|
|
54
|
+
offerExtraInfo: {
|
|
55
|
+
fontSize: 10
|
|
56
|
+
},
|
|
57
|
+
modalButtonStyle: {
|
|
58
|
+
width: 100,
|
|
59
|
+
height: 35,
|
|
60
|
+
paddingLeft: 0,
|
|
61
|
+
paddingRight: 0,
|
|
62
|
+
borderRadius: 7.6
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const [, t] = useLanguage()
|
|
67
|
+
const [{ parseDate, parsePrice, optimizeImage }] = useUtils()
|
|
68
|
+
const [openModal, setOpenModal] = useState(false)
|
|
69
|
+
|
|
70
|
+
const handleClickOffer = (offer: any) => {
|
|
71
|
+
setOpenModal(true)
|
|
72
|
+
setOfferSelected(offer)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const handleBusinessClick = (store: any) => {
|
|
76
|
+
setOpenModal(false)
|
|
77
|
+
navigation.navigate('Business', { store: store.slug })
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const filteredOffers = offersState?.offers?.filter((offer: any) => offer.name.toLowerCase().includes(searchValue.toLowerCase()))
|
|
81
|
+
const targetString = offerSelected?.target === 1
|
|
82
|
+
? t('SUBTOTAL', 'Subtotal')
|
|
83
|
+
: offerSelected?.target === 2
|
|
84
|
+
? t('DELIVERY_FEE', 'Delivery fee')
|
|
85
|
+
: t('SERVICE_FEE', 'Service fee')
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<PromotionsContainer>
|
|
89
|
+
<NavBar
|
|
90
|
+
onActionLeft={() => navigation.goBack()}
|
|
91
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
92
|
+
paddingTop={20}
|
|
93
|
+
style={{ paddingBottom: 0, flexDirection: 'column', alignItems: 'flex-start' }}
|
|
94
|
+
title={t('PROMOTIONS', 'Promotions')}
|
|
95
|
+
titleAlign={'center'}
|
|
96
|
+
titleStyle={{ fontSize: 16, marginRight: 0, marginLeft: 0, marginBottom: 10 }}
|
|
97
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
98
|
+
/>
|
|
99
|
+
<SearchBarContainer>
|
|
100
|
+
<SearchBar
|
|
101
|
+
placeholder={t('SEARCH_OFFERS', 'Search offers')}
|
|
102
|
+
onSearch={handleSearchValue}
|
|
103
|
+
/>
|
|
104
|
+
</SearchBarContainer>
|
|
105
|
+
|
|
106
|
+
{offersState?.loading && (
|
|
107
|
+
<>
|
|
108
|
+
{[...Array(5).keys()].map((key, i) => (
|
|
109
|
+
<Placeholder key={i} style={{ flexDirection: 'row', marginBottom: 20 }}>
|
|
110
|
+
<PlaceholderLine height={10} width={45} />
|
|
111
|
+
<PlaceholderLine height={10} width={60} />
|
|
112
|
+
<PlaceholderLine height={10} width={75} />
|
|
113
|
+
</Placeholder>
|
|
114
|
+
))}
|
|
115
|
+
</>
|
|
116
|
+
)}
|
|
117
|
+
{((!offersState?.loading && filteredOffers?.length === 0) || offersState?.error) && (
|
|
118
|
+
<NotFoundSource
|
|
119
|
+
content={offersState?.error || t('NOT_FOUND_OFFERS', 'Not found offers')}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
<ScrollView>
|
|
123
|
+
{!offersState?.loading && offersState.offers?.length > 0 && filteredOffers?.map((offer: any) => (
|
|
124
|
+
<SingleOfferContainer key={offer.id}>
|
|
125
|
+
<OfferInformation>
|
|
126
|
+
<OText style={styles.offerTitle} numberOfLines={2}>{offer?.name}</OText>
|
|
127
|
+
{offer?.description && (
|
|
128
|
+
<OText style={styles.offerDescription} numberOfLines={2}>{offer?.description}</OText>
|
|
129
|
+
)}
|
|
130
|
+
<OText style={styles.offerExtraInfo}>
|
|
131
|
+
{t('EXPIRES', 'Expires')} {parseDate(offer?.end, { outputFormat: 'MMM DD, YYYY' })}
|
|
132
|
+
</OText>
|
|
133
|
+
<AvailableBusinesses>
|
|
134
|
+
<OText style={styles.offerExtraInfo} numberOfLines={1}>
|
|
135
|
+
{t('APPLY_FOR', 'Apply for')}:
|
|
136
|
+
{offer.businesses.map((business: any, i: number) => (
|
|
137
|
+
<React.Fragment key={i}>{' '}{business?.name}{i + 1 < offer.businesses?.length ? ',' : ''}</React.Fragment>
|
|
138
|
+
))}
|
|
139
|
+
</OText>
|
|
140
|
+
</AvailableBusinesses>
|
|
141
|
+
</OfferInformation>
|
|
142
|
+
<OButton
|
|
143
|
+
onClick={() => handleClickOffer(offer)}
|
|
144
|
+
text={t('VIEW', 'View')}
|
|
145
|
+
style={styles.buttonStyle}
|
|
146
|
+
textStyle={{ fontSize: 10, color: '#fff', flexWrap: 'nowrap' }}
|
|
147
|
+
/>
|
|
148
|
+
</SingleOfferContainer>
|
|
149
|
+
))}
|
|
150
|
+
</ScrollView>
|
|
151
|
+
<OModal
|
|
152
|
+
open={openModal}
|
|
153
|
+
onClose={() => setOpenModal(false)}
|
|
154
|
+
entireModal
|
|
155
|
+
|
|
156
|
+
title={``}
|
|
157
|
+
>
|
|
158
|
+
<View style={{ padding: 20 }}>
|
|
159
|
+
<OText style={{ alignSelf: 'center', fontWeight: '700' }} mBottom={20}>
|
|
160
|
+
{offerSelected?.name} / {t('VALUE_OF_OFFER', 'Value of offer')}: {offerSelected?.rate_type === 1 ? `${offerSelected?.rate}%` : `${parsePrice(offerSelected?.rate)}`}
|
|
161
|
+
</OText>
|
|
162
|
+
<OfferData>
|
|
163
|
+
{offerSelected?.type === 2 && (
|
|
164
|
+
<Code>
|
|
165
|
+
<OText>{t('YOUR_CODE', 'Your code')}</OText>
|
|
166
|
+
<OText color={theme.colors.primary}>{offerSelected.coupon}</OText>
|
|
167
|
+
</Code>
|
|
168
|
+
)}
|
|
169
|
+
<OText>{t('APPLIES_TO', 'Applies to')}: {targetString}</OText>
|
|
170
|
+
{offerSelected?.auto && (
|
|
171
|
+
<OText>{t('OFFER_AUTOMATIC', 'This offer applies automatic')}</OText>
|
|
172
|
+
)}
|
|
173
|
+
{offerSelected?.minimum && (
|
|
174
|
+
<OText>{t('MINIMUM_PURCHASE_FOR_OFFER', 'Minimum purchase for use this offer')}: {parsePrice(offerSelected?.minimum)}</OText>
|
|
175
|
+
)}
|
|
176
|
+
{offerSelected?.max_discount && (
|
|
177
|
+
<OText>{t('MAX_DISCOUNT_ALLOWED', 'Max discount allowed')}: {parsePrice(offerSelected?.max_discount)}</OText>
|
|
178
|
+
)}
|
|
179
|
+
{offerSelected?.description && (
|
|
180
|
+
<OText>{offerSelected?.description}</OText>
|
|
181
|
+
)}
|
|
182
|
+
</OfferData>
|
|
183
|
+
<OText style={{ marginTop: 10, marginBottom: 10 }}>
|
|
184
|
+
{t('AVAILABLE_BUSINESSES_FOR_OFFER', 'Available businesses for this offer')}:
|
|
185
|
+
</OText>
|
|
186
|
+
<ScrollView style={{ height: '75%' }}>
|
|
187
|
+
{offerSelected?.businesses?.map((business: any) => {
|
|
188
|
+
return (
|
|
189
|
+
<SingleBusinessOffer key={business.id}>
|
|
190
|
+
{business?.logo ? (
|
|
191
|
+
<FastImage
|
|
192
|
+
style={styles.productStyle}
|
|
193
|
+
source={{
|
|
194
|
+
uri: optimizeImage(business?.logo, 'h_250,c_limit'),
|
|
195
|
+
priority: FastImage.priority.normal,
|
|
196
|
+
}}
|
|
197
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
198
|
+
/>
|
|
199
|
+
) : (
|
|
200
|
+
<OIcon
|
|
201
|
+
src={theme?.images?.dummies?.product}
|
|
202
|
+
style={styles.productStyle}
|
|
203
|
+
/>
|
|
204
|
+
)}
|
|
205
|
+
<BusinessInfo>
|
|
206
|
+
<OText style={{ maxWidth: '60%' }}>{business.name}</OText>
|
|
207
|
+
<OButton
|
|
208
|
+
onClick={() => handleBusinessClick(business)}
|
|
209
|
+
text={t('GO_TO_BUSINESSS', 'Go to business')}
|
|
210
|
+
style={styles.modalButtonStyle}
|
|
211
|
+
textStyle={{ fontSize: 10, color: '#fff' }}
|
|
212
|
+
/>
|
|
213
|
+
</BusinessInfo>
|
|
214
|
+
</SingleBusinessOffer>
|
|
215
|
+
)
|
|
216
|
+
})}
|
|
217
|
+
</ScrollView>
|
|
218
|
+
</View>
|
|
219
|
+
</OModal>
|
|
220
|
+
</PromotionsContainer>
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export const Promotions = (props: PromotionParams) => {
|
|
225
|
+
const PromotionsProps = {
|
|
226
|
+
...props,
|
|
227
|
+
UIComponent: PromotionsUI
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<PromotionsController {...PromotionsProps} />
|
|
232
|
+
)
|
|
233
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const PromotionsContainer = styled.View`
|
|
4
|
+
width: 100%;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const SingleOfferContainer = styled.View`
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
width: 100%;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
align-items: center;
|
|
12
|
+
margin-bottom: 20px;
|
|
13
|
+
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const OfferInformation = styled.View`
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
max-width: 75%;
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
export const SearchBarContainer = styled.View`
|
|
22
|
+
display: flex;
|
|
23
|
+
width: 100%;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
margin-bottom: 20px;
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
export const SingleBusinessOffer = styled.View`
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
`
|
|
31
|
+
|
|
32
|
+
export const AvailableBusinesses = styled.View`
|
|
33
|
+
flex-direction: row;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
`
|
|
36
|
+
|
|
37
|
+
export const OfferData = styled.View`
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
`
|
|
42
|
+
|
|
43
|
+
export const Code = styled.View`
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
align-items: center;
|
|
47
|
+
margin-bottom: 10px;
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export const ValueOfOffer = styled.View``
|
|
51
|
+
|
|
52
|
+
export const BusinessInfo = styled.View`
|
|
53
|
+
flex: 1;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
align-items: center;
|
|
57
|
+
margin-left: 10px;
|
|
58
|
+
`
|
|
@@ -7,10 +7,11 @@ import {
|
|
|
7
7
|
} from 'ordering-components/native';
|
|
8
8
|
import { useTheme } from 'styled-components/native';
|
|
9
9
|
import { SingleProductCardParams } from '../../types';
|
|
10
|
-
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
|
|
10
|
+
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
|
|
11
11
|
import { StyleSheet } from 'react-native';
|
|
12
12
|
import { OText, OIcon } from '../shared';
|
|
13
13
|
import FastImage from 'react-native-fast-image'
|
|
14
|
+
import { shape } from '../../utils';
|
|
14
15
|
|
|
15
16
|
export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
16
17
|
const {
|
|
@@ -46,8 +47,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
46
47
|
productStyle: {
|
|
47
48
|
width: 75,
|
|
48
49
|
height: 75,
|
|
49
|
-
borderRadius: 7.6
|
|
50
|
-
marginStart: 12
|
|
50
|
+
borderRadius: 7.6
|
|
51
51
|
},
|
|
52
52
|
quantityContainer: {
|
|
53
53
|
position: 'absolute',
|
|
@@ -136,21 +136,42 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
136
136
|
{product?.description}
|
|
137
137
|
</OText>
|
|
138
138
|
</CardInfo>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
139
|
+
<LogoWrapper>
|
|
140
|
+
{product?.ribbon?.enabled && (
|
|
141
|
+
<RibbonBox
|
|
142
|
+
bgColor={product?.ribbon?.color}
|
|
143
|
+
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
144
|
+
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
145
|
+
>
|
|
146
|
+
<OText
|
|
147
|
+
size={10}
|
|
148
|
+
weight={'400'}
|
|
149
|
+
color={theme.colors.white}
|
|
150
|
+
numberOfLines={2}
|
|
151
|
+
ellipsizeMode='tail'
|
|
152
|
+
lineHeight={13}
|
|
153
|
+
>
|
|
154
|
+
{product?.ribbon?.text}
|
|
155
|
+
</OText>
|
|
156
|
+
</RibbonBox>
|
|
157
|
+
)}
|
|
158
|
+
{product?.images ? (
|
|
159
|
+
<FastImage
|
|
160
|
+
style={styles.productStyle}
|
|
161
|
+
source={{
|
|
162
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
163
|
+
priority: FastImage.priority.normal,
|
|
164
|
+
}}
|
|
165
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
166
|
+
/>
|
|
167
|
+
) : (
|
|
168
|
+
<OIcon
|
|
169
|
+
src={theme?.images?.dummies?.product}
|
|
170
|
+
style={styles.productStyle}
|
|
171
|
+
/>
|
|
172
|
+
)}
|
|
173
|
+
</LogoWrapper>
|
|
174
|
+
|
|
154
175
|
{(isSoldOut || maxProductQuantity <= 0) && (
|
|
155
176
|
<SoldOut>
|
|
156
177
|
<OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const CardContainer = styled.TouchableOpacity`
|
|
4
4
|
flex: 1;
|
|
@@ -31,3 +31,30 @@ export const PricesContainer = styled.View`
|
|
|
31
31
|
flex-direction: row;
|
|
32
32
|
align-items: center;
|
|
33
33
|
`
|
|
34
|
+
|
|
35
|
+
export const LogoWrapper = styled.View`
|
|
36
|
+
position: relative;
|
|
37
|
+
margin-left: 12px;
|
|
38
|
+
`
|
|
39
|
+
|
|
40
|
+
export const RibbonBox = styled.View`
|
|
41
|
+
position: absolute;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
top: -4px;
|
|
44
|
+
right: -4px;
|
|
45
|
+
background-color: ${(props: any) => props.theme.colors.primary};
|
|
46
|
+
padding: 1px 8px;
|
|
47
|
+
max-width: 60px;
|
|
48
|
+
|
|
49
|
+
${(props: any) => props.bgColor && css`
|
|
50
|
+
background-color: ${props.bgColor};
|
|
51
|
+
`}
|
|
52
|
+
|
|
53
|
+
${(props: any) => props.isRoundRect && css`
|
|
54
|
+
border-radius: 7.6px;
|
|
55
|
+
`}
|
|
56
|
+
|
|
57
|
+
${(props: any) => props.isCapsule && css`
|
|
58
|
+
border-radius: 50px;
|
|
59
|
+
`}
|
|
60
|
+
`
|
|
@@ -16,6 +16,7 @@ import { LogoutButton } from '../LogoutButton'
|
|
|
16
16
|
import { LanguageSelector } from '../LanguageSelector'
|
|
17
17
|
import MessageCircle from 'react-native-vector-icons/AntDesign'
|
|
18
18
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
19
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
19
20
|
import FastImage from 'react-native-fast-image'
|
|
20
21
|
|
|
21
22
|
import {
|
|
@@ -101,7 +102,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
101
102
|
const { top, bottom } = useSafeAreaInsets();
|
|
102
103
|
|
|
103
104
|
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
104
|
-
|
|
105
|
+
const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
|
|
105
106
|
const onRedirect = (route: string, params?: any) => {
|
|
106
107
|
navigation.navigate(route, params)
|
|
107
108
|
}
|
|
@@ -178,6 +179,12 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
178
179
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('WALLETS', 'Wallets')}</OText>
|
|
179
180
|
</ListItem>
|
|
180
181
|
)}
|
|
182
|
+
{IsPromotionsEnabled && (
|
|
183
|
+
<ListItem onPress={() => onRedirect('Promotions', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
184
|
+
<MaterialIcons name='local-offer' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
185
|
+
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('PROMOTIONS', 'Promotions')}</OText>
|
|
186
|
+
</ListItem>
|
|
187
|
+
)}
|
|
181
188
|
<ListItem onPress={() => navigation.navigate('Help', {})} activeOpacity={0.7}>
|
|
182
189
|
<OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
183
190
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
2
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
|
+
import FastImage from 'react-native-fast-image'
|
|
5
6
|
import {
|
|
6
7
|
WalletList,
|
|
7
8
|
useLanguage,
|
|
@@ -15,7 +16,10 @@ import {
|
|
|
15
16
|
TransactionsWrapper,
|
|
16
17
|
OTabs,
|
|
17
18
|
OTab,
|
|
18
|
-
SectionContent
|
|
19
|
+
SectionContent,
|
|
20
|
+
LoyaltyContent,
|
|
21
|
+
LoyaltyWrapp,
|
|
22
|
+
LoyaltyImg
|
|
19
23
|
} from './styles'
|
|
20
24
|
|
|
21
25
|
import NavBar from '../NavBar'
|
|
@@ -27,6 +31,7 @@ const WalletsUI = (props: any) => {
|
|
|
27
31
|
const {
|
|
28
32
|
navigation,
|
|
29
33
|
walletList,
|
|
34
|
+
userLoyaltyLevel,
|
|
30
35
|
transactionsList,
|
|
31
36
|
setWalletSelected,
|
|
32
37
|
isWalletCashEnabled,
|
|
@@ -38,12 +43,27 @@ const WalletsUI = (props: any) => {
|
|
|
38
43
|
const [{ parsePrice }] = useUtils()
|
|
39
44
|
const [{ configs }] = useConfig()
|
|
40
45
|
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
logoStyle: {
|
|
48
|
+
width: 120,
|
|
49
|
+
height: 120,
|
|
50
|
+
borderRadius: 8,
|
|
51
|
+
borderWidth: 1,
|
|
52
|
+
borderColor: theme.colors.border,
|
|
53
|
+
flexDirection: 'column',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
41
59
|
const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
|
|
42
60
|
|
|
43
61
|
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
|
|
44
62
|
|
|
45
63
|
const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
|
|
46
64
|
|
|
65
|
+
const loyaltyLevel = Object.keys(userLoyaltyLevel.loyaltyLevel ?? {}).length > 0 && userLoyaltyLevel.loyaltyLevel
|
|
66
|
+
|
|
47
67
|
const walletName: any = {
|
|
48
68
|
cash: {
|
|
49
69
|
name: t('CASH_WALLET', 'Cash Wallet'),
|
|
@@ -86,6 +106,7 @@ const WalletsUI = (props: any) => {
|
|
|
86
106
|
/>
|
|
87
107
|
|
|
88
108
|
{!walletList.loading &&
|
|
109
|
+
!userLoyaltyLevel.loading &&
|
|
89
110
|
!walletList.error &&
|
|
90
111
|
walletList.wallets?.length > 0 &&
|
|
91
112
|
(
|
|
@@ -106,6 +127,39 @@ const WalletsUI = (props: any) => {
|
|
|
106
127
|
</OTabs>
|
|
107
128
|
|
|
108
129
|
<SectionContent>
|
|
130
|
+
{!!loyaltyLevel && (
|
|
131
|
+
<LoyaltyContent>
|
|
132
|
+
<LoyaltyWrapp>
|
|
133
|
+
<OText size={20}>
|
|
134
|
+
{`${t('LOYALTY_LEVEL_TITLE', 'Your level is')}:`}
|
|
135
|
+
</OText>
|
|
136
|
+
{loyaltyLevel.image ? (
|
|
137
|
+
<FastImage
|
|
138
|
+
style={styles.logoStyle}
|
|
139
|
+
source={{
|
|
140
|
+
uri: loyaltyLevel.image,
|
|
141
|
+
priority: FastImage.priority.high,
|
|
142
|
+
cache:FastImage.cacheControl.web
|
|
143
|
+
}}
|
|
144
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
145
|
+
/>
|
|
146
|
+
) : (
|
|
147
|
+
<LoyaltyImg
|
|
148
|
+
source={theme.images.dummies.loyaltyLevel}
|
|
149
|
+
resizeMode='contain'
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
152
|
+
<OText
|
|
153
|
+
size={22}
|
|
154
|
+
weight='bold'
|
|
155
|
+
style={{ textTransform: 'uppercase' }}
|
|
156
|
+
color={theme.colors.primary}
|
|
157
|
+
>
|
|
158
|
+
{loyaltyLevel.name}
|
|
159
|
+
</OText>
|
|
160
|
+
</LoyaltyWrapp>
|
|
161
|
+
</LoyaltyContent>
|
|
162
|
+
)}
|
|
109
163
|
<BalanceElement>
|
|
110
164
|
<OText size={20} style={{fontWeight: '600'}}>
|
|
111
165
|
{currentWalletSelected?.type === 'cash'
|
|
@@ -172,7 +226,7 @@ const WalletsUI = (props: any) => {
|
|
|
172
226
|
</>
|
|
173
227
|
)}
|
|
174
228
|
|
|
175
|
-
{walletList?.loading && (
|
|
229
|
+
{(walletList?.loading || userLoyaltyLevel.loading) && (
|
|
176
230
|
<>
|
|
177
231
|
<View>
|
|
178
232
|
<Placeholder Animation={Fade}>
|
|
@@ -196,7 +250,7 @@ const WalletsUI = (props: any) => {
|
|
|
196
250
|
</>
|
|
197
251
|
)}
|
|
198
252
|
|
|
199
|
-
{!walletList?.loading && (walletList?.error || !walletList?.wallets?.length) && (
|
|
253
|
+
{!walletList?.loading && !userLoyaltyLevel.loading && (walletList?.error || !walletList?.wallets?.length) && (
|
|
200
254
|
<NotFoundSource
|
|
201
255
|
content={walletList?.error
|
|
202
256
|
? t('ERROR_NOT_FOUND_WALLETS', 'Sorry, an error has occurred')
|
|
@@ -41,3 +41,24 @@ export const OTabs = styled.View`
|
|
|
41
41
|
export const OTab = styled.View`
|
|
42
42
|
padding-horizontal: 10px;
|
|
43
43
|
`;
|
|
44
|
+
|
|
45
|
+
export const LoyaltyContent = styled.View`
|
|
46
|
+
width: 100%;
|
|
47
|
+
margin-bottom: 20px;
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export const LoyaltyWrapp = styled.View`
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
`
|
|
55
|
+
|
|
56
|
+
export const LoyaltyImg = styled.ImageBackground`
|
|
57
|
+
position: relative;
|
|
58
|
+
height: 150px;
|
|
59
|
+
width: 100%;
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
align-items: center;
|
|
64
|
+
`
|
|
@@ -58,7 +58,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
58
58
|
btnStyle={{ paddingLeft: 0 }}
|
|
59
59
|
paddingTop={0}
|
|
60
60
|
style={{ paddingBottom: 0 }}
|
|
61
|
-
title={t('
|
|
61
|
+
title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
|
|
62
62
|
titleAlign={'center'}
|
|
63
63
|
titleStyle={{ fontSize: 14 }}
|
|
64
64
|
/>
|