ordering-ui-react-native 0.16.37-release → 0.16.38-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/themes/original/src/components/AddressDetails/index.tsx +9 -7
- package/themes/original/src/components/AddressForm/index.tsx +7 -1
- package/themes/original/src/components/BusinessController/index.tsx +66 -40
- package/themes/original/src/components/BusinessController/styles.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +31 -13
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +9 -8
- package/themes/original/src/components/Checkout/index.tsx +36 -53
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/MyOrders/index.tsx +52 -50
- package/themes/original/src/components/ProductForm/styles.tsx +2 -4
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -8
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
- package/themes/original/src/components/Promotions/index.tsx +232 -219
- package/themes/original/src/components/Promotions/styles.tsx +7 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +17 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +1 -0
- package/themes/original/src/components/UserDetails/index.tsx +5 -3
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/layouts/Container.tsx +1 -1
- package/themes/original/src/types/index.tsx +4 -0
package/package.json
CHANGED
|
@@ -24,13 +24,15 @@ const AddressDetailsUI = (props: any) => {
|
|
|
24
24
|
return (
|
|
25
25
|
<ADContainer>
|
|
26
26
|
<ADHeader>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
{props.HeaderTitle ?? (
|
|
28
|
+
<OText
|
|
29
|
+
size={16}
|
|
30
|
+
lineHeight={24}
|
|
31
|
+
color={theme.colors.textNormal}
|
|
32
|
+
>
|
|
33
|
+
{t('DELIVERY_ADDRESS', 'Delivery address')}
|
|
34
|
+
</OText>
|
|
35
|
+
)}
|
|
34
36
|
</ADHeader>
|
|
35
37
|
{!!apiKey && (
|
|
36
38
|
<ADMap
|
|
@@ -65,6 +65,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
65
65
|
} = props;
|
|
66
66
|
|
|
67
67
|
const theme = useTheme();
|
|
68
|
+
const [autoCompleteInputFocused, setAutoCompleteInputFocused] = useState(false)
|
|
68
69
|
|
|
69
70
|
const tagsName = [
|
|
70
71
|
{ icon: theme.images.general.tag_home, value: 'home' },
|
|
@@ -104,6 +105,12 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
104
105
|
end: 0,
|
|
105
106
|
top: 12,
|
|
106
107
|
zIndex: 1002,
|
|
108
|
+
right: autoCompleteInputFocused && (
|
|
109
|
+
!!address?.address ||
|
|
110
|
+
!!formState.changes?.address ||
|
|
111
|
+
!!addressState.address.address
|
|
112
|
+
) ? 30 : 15,
|
|
113
|
+
width: 16
|
|
107
114
|
},
|
|
108
115
|
wrapperNavbar: Platform.OS === 'ios'
|
|
109
116
|
? { paddingVertical: 0, paddingHorizontal: 40 }
|
|
@@ -138,7 +145,6 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
138
145
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
139
146
|
const [isSignUpEffect, setIsSignUpEffect] = useState(false);
|
|
140
147
|
const [hasEditing, setAddressEditing] = useState(false);
|
|
141
|
-
const [autoCompleteInputFocused, setAutoCompleteInputFocused] = useState(false)
|
|
142
148
|
|
|
143
149
|
const googleInput: any = useRef(null);
|
|
144
150
|
const internalNumberRef: any = useRef(null);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ToastType
|
|
12
12
|
} from 'ordering-components/native';
|
|
13
13
|
import { OIcon, OText } from '../shared';
|
|
14
|
-
import { StyleSheet, View } from 'react-native';
|
|
14
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
15
15
|
import { InView } from 'react-native-intersection-observer'
|
|
16
16
|
import { BusinessControllerParams } from '../../types';
|
|
17
17
|
import { convertHoursToMinutes, shape } from '../../utils';
|
|
@@ -40,6 +40,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
40
40
|
navigation,
|
|
41
41
|
isBusinessOpen,
|
|
42
42
|
style,
|
|
43
|
+
isCustomLayout,
|
|
43
44
|
businessHeader,
|
|
44
45
|
businessFeatured,
|
|
45
46
|
businessLogo,
|
|
@@ -51,6 +52,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
51
52
|
handleFavoriteBusiness,
|
|
52
53
|
enableIntersection
|
|
53
54
|
} = props;
|
|
55
|
+
|
|
54
56
|
const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
|
|
55
57
|
const [, { showToast }] = useToast()
|
|
56
58
|
const [orderState] = useOrder();
|
|
@@ -58,14 +60,19 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
58
60
|
const [configState] = useConfig();
|
|
59
61
|
const [, t] = useLanguage();
|
|
60
62
|
const theme = useTheme()
|
|
63
|
+
const windowHeight = Dimensions.get('window').height
|
|
61
64
|
const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
|
|
62
65
|
|
|
66
|
+
const textSize = isCustomLayout ? 12 : 10
|
|
67
|
+
const cardHeight = windowHeight * 0.3
|
|
68
|
+
|
|
63
69
|
const styles = StyleSheet.create({
|
|
64
70
|
container: {
|
|
65
71
|
marginVertical: 20,
|
|
66
72
|
borderRadius: 7.6,
|
|
67
73
|
width: '100%',
|
|
68
|
-
position: 'relative'
|
|
74
|
+
position: 'relative',
|
|
75
|
+
height: cardHeight
|
|
69
76
|
},
|
|
70
77
|
headerStyle: {
|
|
71
78
|
borderTopLeftRadius: 7.6,
|
|
@@ -159,11 +166,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
159
166
|
<InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeInterSection(inView)}>
|
|
160
167
|
{isIntersectionObserver ? (
|
|
161
168
|
<CardAnimation
|
|
169
|
+
style={[style, styles.container]}
|
|
162
170
|
onClick={() => handleBusinessClick(business)}
|
|
163
|
-
style={[
|
|
164
|
-
style,
|
|
165
|
-
styles.container
|
|
166
|
-
]}
|
|
167
171
|
>
|
|
168
172
|
{business?.ribbon?.enabled && (
|
|
169
173
|
<RibbonBox
|
|
@@ -185,7 +189,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
185
189
|
)}
|
|
186
190
|
<BusinessHero>
|
|
187
191
|
<FastImage
|
|
188
|
-
style={{ height: 120 }}
|
|
192
|
+
style={{ height: isCustomLayout ? cardHeight * 0.66 : 120 }}
|
|
189
193
|
source={(businessHeader || business?.header) ? {
|
|
190
194
|
uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
|
|
191
195
|
priority: FastImage.priority.normal,
|
|
@@ -211,7 +215,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
211
215
|
</BusinessState>
|
|
212
216
|
</BusinessHero>
|
|
213
217
|
<BusinessContent>
|
|
214
|
-
<BusinessInfo>
|
|
218
|
+
<BusinessInfo style={isCustomLayout && { position: 'absolute', bottom: 85, left: 15 }}>
|
|
215
219
|
<BusinessLogo style={styles.businessLogo}>
|
|
216
220
|
<FastImage
|
|
217
221
|
style={{ width: 56, height: 56 }}
|
|
@@ -222,38 +226,60 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
222
226
|
resizeMode={FastImage.resizeMode.cover}
|
|
223
227
|
/>
|
|
224
228
|
</BusinessLogo>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
<
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
229
|
+
{!isCustomLayout && (
|
|
230
|
+
<ReviewAndFavorite>
|
|
231
|
+
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
|
|
232
|
+
<Reviews>
|
|
233
|
+
<OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
|
|
234
|
+
<OText size={10} style={{ lineHeight: 15 }}>
|
|
235
|
+
{parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
|
|
236
|
+
</OText>
|
|
237
|
+
</Reviews>
|
|
238
|
+
)}
|
|
239
|
+
<LottieAnimation
|
|
240
|
+
type='favorite'
|
|
241
|
+
onClick={handleChangeFavorite}
|
|
242
|
+
initialValue={business?.favorite ? 0.75 : 0}
|
|
243
|
+
toValue={business?.favorite ? 0 : 0.75}
|
|
244
|
+
disableAnimation={!auth}
|
|
245
|
+
iconProps={{ color: theme.colors.danger5, size: 18 }}
|
|
246
|
+
isActive={business?.favorite}
|
|
247
|
+
/>
|
|
248
|
+
</ReviewAndFavorite>
|
|
249
|
+
)}
|
|
244
250
|
</BusinessInfo>
|
|
245
|
-
<
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
251
|
+
<View style={isCustomLayout && { width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5 }}>
|
|
252
|
+
<OText
|
|
253
|
+
size={textSize + 2}
|
|
254
|
+
style={{ lineHeight: 18, marginBottom: 6 }}
|
|
255
|
+
weight={'500'}>
|
|
256
|
+
{business?.name}
|
|
257
|
+
</OText>
|
|
258
|
+
{isCustomLayout && (
|
|
259
|
+
<ReviewAndFavorite>
|
|
260
|
+
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
|
|
261
|
+
<Reviews>
|
|
262
|
+
<OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
|
|
263
|
+
<OText size={10} style={{ lineHeight: 15 }}>
|
|
264
|
+
{parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
|
|
265
|
+
</OText>
|
|
266
|
+
</Reviews>
|
|
267
|
+
)}
|
|
268
|
+
<LottieAnimation
|
|
269
|
+
type='favorite'
|
|
270
|
+
onClick={handleChangeFavorite}
|
|
271
|
+
initialValue={business?.favorite ? 0.75 : 0}
|
|
272
|
+
toValue={business?.favorite ? 0 : 0.75}
|
|
273
|
+
disableAnimation={!auth}
|
|
274
|
+
iconProps={{ color: theme.colors.danger5, size: 18 }}
|
|
275
|
+
isActive={business?.favorite}
|
|
276
|
+
/>
|
|
277
|
+
</ReviewAndFavorite>
|
|
278
|
+
)}
|
|
279
|
+
</View>
|
|
280
|
+
<OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={isCustomLayout ? 1 : 2}>
|
|
252
281
|
{business?.address}
|
|
253
282
|
</OText>
|
|
254
|
-
{/* <BusinessCategory>
|
|
255
|
-
<OText>{getBusinessType()}</OText>
|
|
256
|
-
</BusinessCategory> */}
|
|
257
283
|
<Metadata>
|
|
258
284
|
{!isBusinessOpen ? (
|
|
259
285
|
<View style={styles.closed}>
|
|
@@ -264,16 +290,16 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
264
290
|
) : (
|
|
265
291
|
<View style={styles.bullet}>
|
|
266
292
|
{orderState?.options?.type === 1 && (
|
|
267
|
-
<OText size={
|
|
293
|
+
<OText size={textSize} color={theme.colors.textSecondary}>
|
|
268
294
|
{`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
|
|
269
295
|
</OText>
|
|
270
296
|
)}
|
|
271
|
-
<OText size={
|
|
297
|
+
<OText size={textSize} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
|
|
272
298
|
orderState?.options?.type === 1
|
|
273
299
|
? (businessDeliveryTime ?? business?.delivery_time)
|
|
274
300
|
: (businessPickupTime ?? business?.pickup_time),
|
|
275
301
|
)} \u2022 `}</OText>
|
|
276
|
-
<OText size={
|
|
302
|
+
<OText size={textSize} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
|
|
277
303
|
</View>
|
|
278
304
|
)}
|
|
279
305
|
</Metadata>
|
|
@@ -9,7 +9,7 @@ export const BusinessHero = styled.View`
|
|
|
9
9
|
|
|
10
10
|
export const BusinessContent = styled.View`
|
|
11
11
|
padding-horizontal: 18px;
|
|
12
|
-
padding-bottom:
|
|
12
|
+
padding-bottom: 10px;
|
|
13
13
|
border-bottom-left-radius: 7.6px;
|
|
14
14
|
border-bottom-right-radius: 7.6px;
|
|
15
15
|
border-width: 1px;
|
|
@@ -52,7 +52,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
52
52
|
brandList,
|
|
53
53
|
onNavigationRedirect,
|
|
54
54
|
handleUpdateBusinessList,
|
|
55
|
-
handleUpdateProducts
|
|
55
|
+
handleUpdateProducts,
|
|
56
|
+
brandId
|
|
56
57
|
} = props
|
|
57
58
|
|
|
58
59
|
const screenHeight = Dimensions.get('window').height;
|
|
@@ -75,6 +76,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
75
76
|
{ text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
|
|
76
77
|
]
|
|
77
78
|
|
|
79
|
+
const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
|
|
80
|
+
|
|
78
81
|
const priceList = [
|
|
79
82
|
{ level: '1', content: '$' },
|
|
80
83
|
{ level: '2', content: '$$' },
|
|
@@ -96,7 +99,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
96
99
|
width: '100%'
|
|
97
100
|
},
|
|
98
101
|
searchInput: {
|
|
99
|
-
fontSize:
|
|
102
|
+
fontSize: 12,
|
|
100
103
|
},
|
|
101
104
|
productsContainer: {
|
|
102
105
|
marginTop: 20
|
|
@@ -230,6 +233,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
230
233
|
<SearchWrapper>
|
|
231
234
|
<SearchBar
|
|
232
235
|
lazyLoad
|
|
236
|
+
{...(isChewLayout && { height: 55 })}
|
|
233
237
|
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
|
|
234
238
|
placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
|
|
235
239
|
onSearch={(val: string) => handleChangeTermValue(val)}
|
|
@@ -253,6 +257,13 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
253
257
|
onNavigationRedirect={onNavigationRedirect}
|
|
254
258
|
BusinessControllerSkeletons={BusinessControllerSkeletons}
|
|
255
259
|
businessPaginationProps={paginationProps}
|
|
260
|
+
franchiseId={brandId}
|
|
261
|
+
hideBackBtn
|
|
262
|
+
titleStyle={{
|
|
263
|
+
paddingHorizontal: 0,
|
|
264
|
+
marginTop: 0,
|
|
265
|
+
marginLeft: 0
|
|
266
|
+
}}
|
|
256
267
|
/>
|
|
257
268
|
)}
|
|
258
269
|
|
|
@@ -261,19 +272,26 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
261
272
|
{t('BUSINESSES', 'Businesses')}
|
|
262
273
|
</OText>
|
|
263
274
|
</OptionTitle>
|
|
264
|
-
<ScrollView horizontal>
|
|
275
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
265
276
|
{businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
|
|
266
|
-
<
|
|
277
|
+
<View
|
|
267
278
|
key={business.id}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
279
|
+
style={{
|
|
280
|
+
width: screenWidth - 120,
|
|
281
|
+
marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
|
|
282
|
+
}}
|
|
283
|
+
>
|
|
284
|
+
<BusinessController
|
|
285
|
+
business={business}
|
|
286
|
+
isBusinessOpen={business.open}
|
|
287
|
+
enableIntersection={false}
|
|
288
|
+
handleCustomClick={() => onBusinessClick(business)}
|
|
289
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
290
|
+
orderType={orderState?.options?.type}
|
|
291
|
+
/>
|
|
292
|
+
</View>
|
|
276
293
|
))}
|
|
294
|
+
{console.log(screenWidth)}
|
|
277
295
|
{!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
|
|
278
296
|
<LoadMoreBusinessContainer>
|
|
279
297
|
<OButton
|
|
@@ -370,7 +388,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
370
388
|
</View>
|
|
371
389
|
</Placeholder>
|
|
372
390
|
<Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
|
|
373
|
-
<View style={{ flexDirection: 'row-reverse' }}>
|
|
391
|
+
<View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
|
|
374
392
|
<PlaceholderLine
|
|
375
393
|
width={24}
|
|
376
394
|
height={70}
|
|
@@ -313,10 +313,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
313
313
|
key={business?.id}
|
|
314
314
|
onPress={() => handleBusinessClick && handleBusinessClick(business)}
|
|
315
315
|
style={{
|
|
316
|
-
width:
|
|
317
|
-
height:
|
|
318
|
-
|
|
319
|
-
borderBottomWidth: business?.slug === actualSlug ? 2 : 0,
|
|
316
|
+
width: 60,
|
|
317
|
+
height: 60,
|
|
318
|
+
borderRadius: 8,
|
|
320
319
|
marginRight: 5
|
|
321
320
|
}}
|
|
322
321
|
>
|
|
@@ -325,8 +324,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
325
324
|
width: 56,
|
|
326
325
|
height: 56,
|
|
327
326
|
marginRight: 20,
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
borderRadius: 8,
|
|
328
|
+
borderColor: theme.colors.primary,
|
|
329
|
+
borderWidth: business?.slug === actualSlug ? 2 : 0
|
|
330
330
|
}}
|
|
331
331
|
source={{
|
|
332
332
|
uri: business?.logo,
|
|
@@ -369,8 +369,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
369
369
|
>
|
|
370
370
|
{isChewLayout && (
|
|
371
371
|
<View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
372
|
-
<OText size={
|
|
373
|
-
{t('WELCOME', 'Welcome')} {user?.name}
|
|
372
|
+
<OText size={24} weight={700} color={theme.colors?.white}>
|
|
373
|
+
{t('WELCOME', 'Welcome')} {user?.name}
|
|
374
374
|
</OText>
|
|
375
375
|
</View>
|
|
376
376
|
)}
|
|
@@ -571,6 +571,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
571
571
|
<BusinessController
|
|
572
572
|
key={`${business.id}_` + i}
|
|
573
573
|
enableIntersection
|
|
574
|
+
isCustomLayout={isChewLayout}
|
|
574
575
|
business={business}
|
|
575
576
|
isBusinessOpen={business.open}
|
|
576
577
|
handleCustomClick={handleBusinessClick}
|
|
@@ -152,6 +152,7 @@ const CheckoutUI = (props: any) => {
|
|
|
152
152
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
153
153
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
154
154
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
155
|
+
const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
|
|
155
156
|
|
|
156
157
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
157
158
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
@@ -161,7 +162,6 @@ const CheckoutUI = (props: any) => {
|
|
|
161
162
|
}, cart?.subtotal)
|
|
162
163
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
163
164
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
164
|
-
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
165
165
|
(options.type === 1 &&
|
|
166
166
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
167
167
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -267,10 +267,6 @@ const CheckoutUI = (props: any) => {
|
|
|
267
267
|
}
|
|
268
268
|
}, [errors])
|
|
269
269
|
|
|
270
|
-
// useEffect(() => {
|
|
271
|
-
// handlePaymethodChange(null)
|
|
272
|
-
// }, [cart?.total])
|
|
273
|
-
|
|
274
270
|
useEffect(() => {
|
|
275
271
|
if (cart?.products?.length === 0) {
|
|
276
272
|
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
@@ -281,6 +277,21 @@ const CheckoutUI = (props: any) => {
|
|
|
281
277
|
onFailPaypal()
|
|
282
278
|
}, [showGateway.closedByUser])
|
|
283
279
|
|
|
280
|
+
const HeaderTitle = (props: any) => {
|
|
281
|
+
const { text } = props
|
|
282
|
+
return (
|
|
283
|
+
<OText
|
|
284
|
+
size={16}
|
|
285
|
+
lineHeight={24}
|
|
286
|
+
weight={'500'}
|
|
287
|
+
mBottom={props.mb ?? 10}
|
|
288
|
+
color={theme.colors.textNormal}
|
|
289
|
+
>
|
|
290
|
+
{text}
|
|
291
|
+
</OText>
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
|
|
284
295
|
return (
|
|
285
296
|
<>
|
|
286
297
|
<Container noPadding>
|
|
@@ -298,13 +309,20 @@ const CheckoutUI = (props: any) => {
|
|
|
298
309
|
<ChContainer style={styles.pagePadding}>
|
|
299
310
|
<ChSection style={{ paddingTop: 0 }}>
|
|
300
311
|
<ChHeader>
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
312
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
313
|
+
<OText
|
|
314
|
+
size={12}
|
|
315
|
+
numberOfLines={1}
|
|
316
|
+
ellipsizeMode={'tail'}
|
|
317
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
318
|
+
>
|
|
319
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
320
|
+
</OText>
|
|
304
321
|
<OIcon
|
|
305
322
|
src={theme.images.general.arrow_down}
|
|
306
323
|
width={10}
|
|
307
324
|
style={{ marginStart: 8 }}
|
|
325
|
+
{...(isChewLayout && { color: 'white' })}
|
|
308
326
|
/>
|
|
309
327
|
</CHMomentWrapper>
|
|
310
328
|
<CHMomentWrapper
|
|
@@ -347,9 +365,7 @@ const CheckoutUI = (props: any) => {
|
|
|
347
365
|
Object.values(businessDetails?.business).length > 0 &&
|
|
348
366
|
(
|
|
349
367
|
<>
|
|
350
|
-
<
|
|
351
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
352
|
-
</OText>
|
|
368
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
353
369
|
<View>
|
|
354
370
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
355
371
|
{businessDetails?.business?.name}
|
|
@@ -368,9 +384,7 @@ const CheckoutUI = (props: any) => {
|
|
|
368
384
|
)}
|
|
369
385
|
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
370
386
|
<View>
|
|
371
|
-
<
|
|
372
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
373
|
-
</OText>
|
|
387
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
374
388
|
<NotFoundSource
|
|
375
389
|
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
376
390
|
/>
|
|
@@ -392,6 +406,7 @@ const CheckoutUI = (props: any) => {
|
|
|
392
406
|
) : (
|
|
393
407
|
<UserDetails
|
|
394
408
|
isUserDetailsEdit={isUserDetailsEdit}
|
|
409
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
395
410
|
cartStatus={cart?.status}
|
|
396
411
|
businessId={cart?.business_id}
|
|
397
412
|
useValidationFields
|
|
@@ -416,8 +431,8 @@ const CheckoutUI = (props: any) => {
|
|
|
416
431
|
</Placeholder>
|
|
417
432
|
</View>
|
|
418
433
|
) : (
|
|
419
|
-
|
|
420
|
-
<
|
|
434
|
+
<ChSection>
|
|
435
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
421
436
|
<View
|
|
422
437
|
style={{
|
|
423
438
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -463,7 +478,7 @@ const CheckoutUI = (props: any) => {
|
|
|
463
478
|
/>
|
|
464
479
|
</View>
|
|
465
480
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
466
|
-
|
|
481
|
+
</ChSection>
|
|
467
482
|
)}
|
|
468
483
|
|
|
469
484
|
</DeliveryOptionsContainer>
|
|
@@ -485,29 +500,6 @@ const CheckoutUI = (props: any) => {
|
|
|
485
500
|
</ChSection>
|
|
486
501
|
)}
|
|
487
502
|
|
|
488
|
-
{/* <ChSection>
|
|
489
|
-
<ChTotal>
|
|
490
|
-
{
|
|
491
|
-
(
|
|
492
|
-
<>
|
|
493
|
-
<OIcon
|
|
494
|
-
url={businessLogo || businessDetails?.business?.logo}
|
|
495
|
-
width={80}
|
|
496
|
-
height={80}
|
|
497
|
-
borderRadius={80}
|
|
498
|
-
/>
|
|
499
|
-
<View style={{ marginLeft: 10, width: '85%' }}>
|
|
500
|
-
<OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
|
|
501
|
-
{businessName || businessDetails?.business?.name}
|
|
502
|
-
</OText>
|
|
503
|
-
<OText size={22}>
|
|
504
|
-
{cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
|
|
505
|
-
</OText>
|
|
506
|
-
</View>
|
|
507
|
-
</>
|
|
508
|
-
)}
|
|
509
|
-
</ChTotal>
|
|
510
|
-
</ChSection> */}
|
|
511
503
|
<ChSection>
|
|
512
504
|
<ChAddress>
|
|
513
505
|
{(businessDetails?.loading || cartState.loading) ? (
|
|
@@ -524,6 +516,7 @@ const CheckoutUI = (props: any) => {
|
|
|
524
516
|
uuid={cartUuid}
|
|
525
517
|
apiKey={configs?.google_maps_api_key?.value}
|
|
526
518
|
mapConfigs={mapConfigs}
|
|
519
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
527
520
|
/>
|
|
528
521
|
)}
|
|
529
522
|
</ChAddress>
|
|
@@ -540,9 +533,7 @@ const CheckoutUI = (props: any) => {
|
|
|
540
533
|
(
|
|
541
534
|
<ChSection>
|
|
542
535
|
<ChDriverTips>
|
|
543
|
-
<
|
|
544
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
545
|
-
</OText>
|
|
536
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
546
537
|
<DriverTips
|
|
547
538
|
uuid={cartUuid}
|
|
548
539
|
businessId={cart?.business_id}
|
|
@@ -561,9 +552,7 @@ const CheckoutUI = (props: any) => {
|
|
|
561
552
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
562
553
|
<ChSection>
|
|
563
554
|
<ChPaymethods>
|
|
564
|
-
<
|
|
565
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
566
|
-
</OText>
|
|
555
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
567
556
|
{!cartState.loading && cart?.status === 4 && (
|
|
568
557
|
<OText
|
|
569
558
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -628,13 +617,7 @@ const CheckoutUI = (props: any) => {
|
|
|
628
617
|
) : (
|
|
629
618
|
<>
|
|
630
619
|
<CartHeader>
|
|
631
|
-
<
|
|
632
|
-
size={16}
|
|
633
|
-
lineHeight={24}
|
|
634
|
-
color={theme.colors.textNormal}
|
|
635
|
-
>
|
|
636
|
-
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
637
|
-
</OText>
|
|
620
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
638
621
|
<TouchableOpacity
|
|
639
622
|
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
640
623
|
>
|
|
@@ -6,7 +6,7 @@ export const ChContainer = styled.View`
|
|
|
6
6
|
`
|
|
7
7
|
|
|
8
8
|
export const ChSection = styled.View`
|
|
9
|
-
padding-top:
|
|
9
|
+
padding-top: 20px;
|
|
10
10
|
`
|
|
11
11
|
|
|
12
12
|
export const ChHeader = styled.View`
|
|
@@ -40,7 +40,9 @@ export const ChMoment = styled(ChAddress)`
|
|
|
40
40
|
`
|
|
41
41
|
|
|
42
42
|
export const CHMomentWrapper = styled.TouchableOpacity`
|
|
43
|
-
background-color: ${(props: any) => props.
|
|
43
|
+
background-color: ${(props: any) => props.isCustomColor
|
|
44
|
+
? props.theme.colors.primary
|
|
45
|
+
: props.theme.colors.backgroundGray100};
|
|
44
46
|
border-radius: 7.6px;
|
|
45
47
|
font-size: 12px;
|
|
46
48
|
max-width: 240px;
|