ordering-ui-react-native 0.15.71 → 0.15.72
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/AddressList/index.tsx +29 -17
- package/themes/original/src/components/BusinessProductsList/index.tsx +34 -32
- package/themes/original/src/components/BusinessProductsListing/index.tsx +55 -9
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +13 -9
- package/themes/original/src/components/Cart/index.tsx +17 -11
- package/themes/original/src/components/Checkout/index.tsx +1 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/OrderTypeSelector/index.tsx +3 -1
- package/themes/original/src/components/OrdersOption/index.tsx +11 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +3 -2
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +26 -26
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- package/themes/original/src/components/SingleProductCard/index.tsx +9 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -70
- package/themes/original/src/components/UserFormDetails/index.tsx +21 -19
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/Wallets/index.tsx +17 -4
- package/themes/original/src/types/index.tsx +8 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
2
|
import { AddressList as AddressListController, useLanguage, useOrder, useSession } from 'ordering-components/native'
|
|
3
3
|
import { AddressListContainer, AddressItem } from './styles'
|
|
4
|
-
import { Platform, StyleSheet, View } from 'react-native'
|
|
4
|
+
import { Platform, RefreshControl, StyleSheet, View } from 'react-native'
|
|
5
5
|
import { OButton, OText, OAlert, OModal, OIcon } from '../shared'
|
|
6
6
|
import { Container } from '../../layouts/Container'
|
|
7
7
|
import { AddressListParams } from '../../types'
|
|
@@ -27,7 +27,8 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
27
27
|
actionStatus,
|
|
28
28
|
isFromBusinesses,
|
|
29
29
|
isFromProductsList,
|
|
30
|
-
afterSignup
|
|
30
|
+
afterSignup,
|
|
31
|
+
loadAddresses
|
|
31
32
|
} = props
|
|
32
33
|
|
|
33
34
|
const theme = useTheme();
|
|
@@ -35,6 +36,7 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
35
36
|
const [orderState] = useOrder()
|
|
36
37
|
const [, t] = useLanguage()
|
|
37
38
|
const [{ auth }] = useSession()
|
|
39
|
+
const [refreshing] = useState(false);
|
|
38
40
|
|
|
39
41
|
const [isProfile, setIsProfile] = useState(isFromProfile || route?.params?.isFromProfile);
|
|
40
42
|
|
|
@@ -121,6 +123,12 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
121
123
|
})
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
const handleOnRefresh = () => {
|
|
127
|
+
if (!addressList.loading) {
|
|
128
|
+
loadAddresses();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
124
132
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
125
133
|
const onNavigationRedirect = (route: string, params?: any) => navigation.navigate(route, params)
|
|
126
134
|
|
|
@@ -135,22 +143,26 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
135
143
|
}, [])
|
|
136
144
|
|
|
137
145
|
return (
|
|
138
|
-
<Container
|
|
146
|
+
<Container
|
|
147
|
+
noPadding
|
|
148
|
+
refreshControl={
|
|
149
|
+
<RefreshControl
|
|
150
|
+
refreshing={refreshing}
|
|
151
|
+
onRefresh={() => handleOnRefresh()}
|
|
152
|
+
/>
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
{isProfile && (
|
|
156
|
+
<NavBar
|
|
157
|
+
title={t('SAVED_PLACES', 'My saved places')}
|
|
158
|
+
titleAlign={'center'}
|
|
159
|
+
onActionLeft={goToBack}
|
|
160
|
+
showCall={false}
|
|
161
|
+
style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 20 }}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
139
164
|
{(!addressList.loading || (isFromProductsList || isFromBusinesses || isFromProfile || isProfile)) && (
|
|
140
165
|
<AddressListContainer>
|
|
141
|
-
{isProfile && (
|
|
142
|
-
<NavBar
|
|
143
|
-
title={t('SAVED_PLACES', 'My saved places')}
|
|
144
|
-
titleAlign={'center'}
|
|
145
|
-
onActionLeft={() => goToBack()}
|
|
146
|
-
showCall={false}
|
|
147
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
148
|
-
paddingTop={0}
|
|
149
|
-
isVertical
|
|
150
|
-
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
151
|
-
titleStyle={{ marginLeft: 0, marginRight: 0 }}
|
|
152
|
-
/>
|
|
153
|
-
)}
|
|
154
166
|
{
|
|
155
167
|
route &&
|
|
156
168
|
(
|
|
@@ -172,7 +184,7 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
172
184
|
titleStyle={{ marginLeft: 0, marginRight: 0 }}
|
|
173
185
|
/>
|
|
174
186
|
)}
|
|
175
|
-
{addressList.loading && (
|
|
187
|
+
{addressList.loading && addressList?.addresses?.length === 0 && (
|
|
176
188
|
<>
|
|
177
189
|
{[...Array(5)].map((item, i) => (
|
|
178
190
|
<Placeholder key={i} style={{ paddingVertical: 20 }} Animation={Fade}>
|
|
@@ -32,7 +32,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
32
32
|
setSubcategoriesSelected,
|
|
33
33
|
subcategoriesSelected,
|
|
34
34
|
onClickCategory,
|
|
35
|
-
lazyLoadProductsRecommended
|
|
35
|
+
lazyLoadProductsRecommended,
|
|
36
|
+
isFiltMode
|
|
36
37
|
} = props;
|
|
37
38
|
|
|
38
39
|
const [, t] = useLanguage();
|
|
@@ -48,24 +49,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
48
49
|
setCategoriesLayout(_categoriesLayout)
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
const onClickSubcategory = (subCategory
|
|
52
|
+
const onClickSubcategory = (subCategory: any, parentCategory: any) => {
|
|
52
53
|
if (parentCategory && lazyLoadProductsRecommended) {
|
|
53
54
|
onClickCategory(parentCategory)
|
|
54
55
|
}
|
|
55
56
|
if (!subCategory) {
|
|
56
|
-
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory
|
|
57
|
+
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory: any) => _subcategory?.parent_category_id !== parentCategory?.id))
|
|
57
58
|
return
|
|
58
59
|
}
|
|
59
|
-
const categoryFounded = subcategoriesSelected.find((_subcategory
|
|
60
|
+
const categoryFounded = subcategoriesSelected.find((_subcategory: any) => subCategory?.id === _subcategory?.id)
|
|
60
61
|
if (categoryFounded) {
|
|
61
|
-
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory
|
|
62
|
+
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory: any) => subCategory?.id !== _subcategory?.id))
|
|
62
63
|
} else {
|
|
63
64
|
setSubcategoriesSelected?.([...subcategoriesSelected, subCategory])
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
const SubcategoriesComponent = ({ category }
|
|
68
|
-
const allsubcategorySelected = !subcategoriesSelected?.some((subcategory
|
|
68
|
+
const SubcategoriesComponent = ({ category }: any) => {
|
|
69
|
+
const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
|
|
69
70
|
|
|
70
71
|
return (
|
|
71
72
|
<SubCategoriesContainer>
|
|
@@ -80,8 +81,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
80
81
|
textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
|
|
81
82
|
/>
|
|
82
83
|
</ContainerButton>
|
|
83
|
-
{category?.subcategories?.map((subcategory
|
|
84
|
-
const isSubcategorySelected = subcategoriesSelected?.find((_subcategory
|
|
84
|
+
{category?.subcategories?.map((subcategory: any) => {
|
|
85
|
+
const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
|
|
85
86
|
return (
|
|
86
87
|
<ContainerButton
|
|
87
88
|
key={subcategory?.id}
|
|
@@ -112,21 +113,21 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
112
113
|
</HeaderWrapper>
|
|
113
114
|
{category.id &&
|
|
114
115
|
categoryState.products
|
|
115
|
-
?.filter((product
|
|
116
|
-
!subcategoriesSelected.find((subcategory
|
|
117
|
-
subcategoriesSelected?.some((subcategory
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
116
|
+
?.filter((product: any) =>
|
|
117
|
+
!subcategoriesSelected.find((subcategory: any) => subcategory?.parent_category_id === category?.id) ||
|
|
118
|
+
subcategoriesSelected?.some((subcategory: any) => subcategory.id === product?.category_id))
|
|
119
|
+
?.sort((a: any, b: any) => a.rank - b.rank)
|
|
120
|
+
?.map((product: any, i : number) => (
|
|
121
|
+
<SingleProductCard
|
|
122
|
+
key={'prod_' + product.id + `_${i}`}
|
|
123
|
+
isSoldOut={product.inventoried && !product.quantity}
|
|
124
|
+
product={product}
|
|
125
|
+
businessId={businessId}
|
|
126
|
+
onProductClick={() => onProductClick(product)}
|
|
127
|
+
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
128
|
+
/>
|
|
129
|
+
))
|
|
130
|
+
}
|
|
130
131
|
{!category.id &&
|
|
131
132
|
featured &&
|
|
132
133
|
categoryState?.products?.find((product: any) => product.featured) && (
|
|
@@ -141,7 +142,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
141
142
|
(product: any, i: any) =>
|
|
142
143
|
product.featured && (
|
|
143
144
|
<SingleProductCard
|
|
144
|
-
key={'feat_' + product.id}
|
|
145
|
+
key={'feat_' + product.id + `_${i}`}
|
|
145
146
|
isSoldOut={product.inventoried && !product.quantity}
|
|
146
147
|
product={product}
|
|
147
148
|
businessId={businessId}
|
|
@@ -156,16 +157,16 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
156
157
|
|
|
157
158
|
{!category?.id && categories.filter(category => category?.id !== null).map((category, i, _categories) => {
|
|
158
159
|
const _products = !isUseParentCategory
|
|
159
|
-
? categoryState?.products?.filter((product
|
|
160
|
-
: categoryState?.products?.filter((product
|
|
160
|
+
? categoryState?.products?.filter((product: any) => product?.category_id === category?.id) ?? []
|
|
161
|
+
: categoryState?.products?.filter((product: any) => category?.children?.some((cat: any) => cat.category_id === product?.category_id)) ?? []
|
|
161
162
|
const products = subcategoriesSelected?.length > 0
|
|
162
|
-
? _products?.filter((product
|
|
163
|
-
!subcategoriesSelected.find((subcategory
|
|
164
|
-
subcategoriesSelected?.some((subcategory
|
|
163
|
+
? _products?.filter((product: any) =>
|
|
164
|
+
!subcategoriesSelected.find((subcategory: any) => subcategory?.parent_category_id === category?.id) ||
|
|
165
|
+
subcategoriesSelected?.some((subcategory: any) => subcategory.id === product?.category_id))
|
|
165
166
|
: _products
|
|
166
167
|
|
|
167
168
|
const shortCategoryDescription = category?.description?.length > 80 ? `${category?.description?.substring(0, 80)}...` : category?.description
|
|
168
|
-
|
|
169
|
+
|
|
169
170
|
return (
|
|
170
171
|
<React.Fragment key={'cat_' + category.id}>
|
|
171
172
|
{products.length > 0 && (
|
|
@@ -226,7 +227,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
226
227
|
</OText>
|
|
227
228
|
</View>
|
|
228
229
|
)}
|
|
229
|
-
{category?.subcategories?.length > 0 && (
|
|
230
|
+
{category?.subcategories?.length > 0 && !isFiltMode && (
|
|
230
231
|
<SubcategoriesComponent category={category} />
|
|
231
232
|
)}
|
|
232
233
|
<>
|
|
@@ -272,6 +273,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
272
273
|
!isBusinessLoading &&
|
|
273
274
|
categoryState.products.length === 0 &&
|
|
274
275
|
!errors &&
|
|
276
|
+
!isFiltMode &&
|
|
275
277
|
!(
|
|
276
278
|
(searchValue && errorQuantityProducts) ||
|
|
277
279
|
(!searchValue && !errorQuantityProducts)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet, SafeAreaView } from 'react-native'
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import {
|
|
5
5
|
BusinessAndProductList,
|
|
@@ -22,13 +22,16 @@ import {
|
|
|
22
22
|
TopHeader,
|
|
23
23
|
WrapSearchBar,
|
|
24
24
|
WrapContent,
|
|
25
|
-
BusinessProductsListingContainer
|
|
25
|
+
BusinessProductsListingContainer,
|
|
26
|
+
FiltProductsContainer,
|
|
27
|
+
ContainerSafeAreaView,
|
|
28
|
+
BackgroundGray
|
|
26
29
|
} from './styles'
|
|
27
30
|
import { FloatingButton } from '../FloatingButton'
|
|
28
31
|
import { UpsellingRedirect } from './UpsellingRedirect'
|
|
29
32
|
import Animated from 'react-native-reanimated'
|
|
30
33
|
|
|
31
|
-
const PIXELS_TO_SCROLL =
|
|
34
|
+
const PIXELS_TO_SCROLL = 2000
|
|
32
35
|
|
|
33
36
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
34
37
|
const {
|
|
@@ -95,7 +98,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
95
98
|
const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
|
|
96
99
|
|
|
97
100
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
98
|
-
|
|
101
|
+
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
102
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
|
|
99
103
|
const onRedirect = (route: string, params?: any) => {
|
|
100
104
|
navigation.navigate(route, params)
|
|
101
105
|
}
|
|
@@ -179,11 +183,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
179
183
|
}, [])
|
|
180
184
|
|
|
181
185
|
return (
|
|
182
|
-
<
|
|
186
|
+
<ContainerSafeAreaView
|
|
183
187
|
style={{ flex: 1 }}
|
|
188
|
+
isOpenFiltProducts={isOpenFiltProducts}
|
|
184
189
|
>
|
|
185
190
|
<Animated.View style={{ position: 'relative' }}>
|
|
186
|
-
<TopHeader>
|
|
191
|
+
<TopHeader isIos={Platform.OS === 'ios'}>
|
|
187
192
|
{!isOpenSearchBar && (
|
|
188
193
|
<>
|
|
189
194
|
<View style={{ ...styles.headerItem, flex: 1 }}>
|
|
@@ -221,6 +226,46 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
221
226
|
)}
|
|
222
227
|
</TopHeader>
|
|
223
228
|
</Animated.View>
|
|
229
|
+
|
|
230
|
+
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
231
|
+
<FiltProductsContainer
|
|
232
|
+
style={{
|
|
233
|
+
height: Dimensions.get('window').height - filtProductsHeight
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
<View style={{ padding: 20, backgroundColor: theme.colors.white }}>
|
|
237
|
+
<BusinessProductsList
|
|
238
|
+
categories={[
|
|
239
|
+
{ id: null, name: t('ALL', 'All') },
|
|
240
|
+
{ id: 'featured', name: t('FEATURED', 'Featured') },
|
|
241
|
+
...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
|
|
242
|
+
]}
|
|
243
|
+
category={categorySelected}
|
|
244
|
+
categoryState={categoryState}
|
|
245
|
+
businessId={business.id}
|
|
246
|
+
errors={errors}
|
|
247
|
+
onProductClick={onProductClick}
|
|
248
|
+
handleSearchRedirect={handleSearchRedirect}
|
|
249
|
+
featured={featuredProducts}
|
|
250
|
+
searchValue={searchValue}
|
|
251
|
+
handleClearSearch={handleChangeSearch}
|
|
252
|
+
errorQuantityProducts={errorQuantityProducts}
|
|
253
|
+
handleCancelSearch={handleCancel}
|
|
254
|
+
categoriesLayout={categoriesLayout}
|
|
255
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
256
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
257
|
+
setCategoriesLayout={setCategoriesLayout}
|
|
258
|
+
currentCart={currentCart}
|
|
259
|
+
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
260
|
+
onClickCategory={handleChangeCategory}
|
|
261
|
+
isFiltMode
|
|
262
|
+
/>
|
|
263
|
+
</View>
|
|
264
|
+
</FiltProductsContainer>
|
|
265
|
+
)}
|
|
266
|
+
{isOpenFiltProducts && (
|
|
267
|
+
<BackgroundGray />
|
|
268
|
+
)}
|
|
224
269
|
<BusinessProductsListingContainer
|
|
225
270
|
stickyHeaderIndices={[2]}
|
|
226
271
|
style={styles.mainContainer}
|
|
@@ -255,7 +300,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
255
300
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
256
301
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
257
302
|
setCategoryClicked={setCategoryClicked}
|
|
258
|
-
|
|
303
|
+
|
|
259
304
|
/>
|
|
260
305
|
)}
|
|
261
306
|
</>
|
|
@@ -288,6 +333,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
288
333
|
setCategoriesLayout={setCategoriesLayout}
|
|
289
334
|
currentCart={currentCart}
|
|
290
335
|
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
336
|
+
onClickCategory={handleChangeCategory}
|
|
291
337
|
/>
|
|
292
338
|
</WrapContent>
|
|
293
339
|
</>
|
|
@@ -326,7 +372,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
326
372
|
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
327
373
|
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
328
374
|
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
329
|
-
btnLeftValue={currentCart?.products
|
|
375
|
+
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
330
376
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
331
377
|
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
332
378
|
handleClick={() => setOpenUpselling(true)}
|
|
@@ -347,7 +393,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
347
393
|
onRedirect={onRedirect}
|
|
348
394
|
/>
|
|
349
395
|
)}
|
|
350
|
-
</
|
|
396
|
+
</ContainerSafeAreaView>
|
|
351
397
|
)
|
|
352
398
|
}
|
|
353
399
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
|
+
export const ContainerSafeAreaView = styled.SafeAreaView`
|
|
4
|
+
`
|
|
5
|
+
|
|
3
6
|
export const WrapHeader = styled.View`
|
|
4
7
|
position: relative;
|
|
5
8
|
`
|
|
@@ -11,6 +14,7 @@ export const TopHeader = styled.View`
|
|
|
11
14
|
z-index: 1;
|
|
12
15
|
height: 60px;
|
|
13
16
|
min-height: 60px;
|
|
17
|
+
margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
|
|
14
18
|
`
|
|
15
19
|
export const AddressInput = styled.TouchableOpacity`
|
|
16
20
|
flex: 1;
|
|
@@ -33,3 +37,21 @@ export const BusinessProductsListingContainer = styled.ScrollView`
|
|
|
33
37
|
margin-bottom: 50px;
|
|
34
38
|
`}
|
|
35
39
|
`
|
|
40
|
+
|
|
41
|
+
export const FiltProductsContainer = styled.ScrollView`
|
|
42
|
+
position: absolute;
|
|
43
|
+
width: 100%;
|
|
44
|
+
z-index: 2000;
|
|
45
|
+
top: ${(props : any) => props.isIos ? '40px': '80px'};
|
|
46
|
+
margin-top: 20px;
|
|
47
|
+
`
|
|
48
|
+
|
|
49
|
+
export const BackgroundGray = styled.View`
|
|
50
|
+
flex: 1;
|
|
51
|
+
height: 100%;
|
|
52
|
+
background-color: rgba(0,0,0,0.5);
|
|
53
|
+
position: absolute;
|
|
54
|
+
margin-top: 100px;
|
|
55
|
+
z-index: 100;
|
|
56
|
+
width: 100%;
|
|
57
|
+
`
|
|
@@ -45,7 +45,6 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
45
45
|
const renderTypes = ({ item }: any) => {
|
|
46
46
|
return (
|
|
47
47
|
<TouchableOpacity
|
|
48
|
-
key={item.id}
|
|
49
48
|
onPress={() => handleChangeBusinessType(item.id)}
|
|
50
49
|
style={{
|
|
51
50
|
height: 34,
|
|
@@ -103,7 +102,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
103
102
|
showsHorizontalScrollIndicator={false}
|
|
104
103
|
data={typesState?.types}
|
|
105
104
|
renderItem={renderTypes}
|
|
106
|
-
keyExtractor={(type) => type.name}
|
|
105
|
+
keyExtractor={(type, index) => `${type.name}_${index}`}
|
|
107
106
|
/>
|
|
108
107
|
<TouchableOpacity
|
|
109
108
|
style={{ marginLeft: 15 }}
|
|
@@ -47,7 +47,7 @@ import { getTypesText, convertToRadian } from '../../utils';
|
|
|
47
47
|
import { OrderProgress } from '../OrderProgress';
|
|
48
48
|
import { useFocusEffect, useIsFocused } from '@react-navigation/native';
|
|
49
49
|
|
|
50
|
-
const PIXELS_TO_SCROLL =
|
|
50
|
+
const PIXELS_TO_SCROLL = 2000;
|
|
51
51
|
|
|
52
52
|
const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
53
53
|
const {
|
|
@@ -116,7 +116,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
116
116
|
const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
|
|
117
117
|
const [isFarAway, setIsFarAway] = useState(false)
|
|
118
118
|
const [businessTypes, setBusinessTypes] = useState(null)
|
|
119
|
-
|
|
119
|
+
const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
|
|
120
120
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
121
121
|
Number(configs?.max_days_preorder?.value) > 0
|
|
122
122
|
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
@@ -203,6 +203,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
203
203
|
})
|
|
204
204
|
}, [orderState?.options?.address?.location])
|
|
205
205
|
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if(!orderState?.loading){
|
|
208
|
+
setOrderTypeValue(orderState?.options?.type)
|
|
209
|
+
}
|
|
210
|
+
}, [orderState?.options?.type])
|
|
211
|
+
|
|
206
212
|
useFocusEffect(
|
|
207
213
|
useCallback(() => {
|
|
208
214
|
resetInactivityTimeout()
|
|
@@ -257,8 +263,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
257
263
|
)}
|
|
258
264
|
<OrderControlContainer>
|
|
259
265
|
<View style={styles.wrapperOrderOptions}>
|
|
260
|
-
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
261
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
266
|
+
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
|
|
267
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
262
268
|
<OIcon
|
|
263
269
|
src={theme.images.general.arrow_down}
|
|
264
270
|
width={10}
|
|
@@ -273,7 +279,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
273
279
|
numberOfLines={1}
|
|
274
280
|
ellipsizeMode="tail"
|
|
275
281
|
color={theme.colors.textSecondary}>
|
|
276
|
-
{orderState.options?.
|
|
282
|
+
{orderState.options?.moment
|
|
277
283
|
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
278
284
|
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
279
285
|
</OText>
|
|
@@ -325,7 +331,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
325
331
|
{featuredBusiness.map((bAry: any, idx) => (
|
|
326
332
|
<View key={'f-listing_' + idx}>
|
|
327
333
|
<BusinessFeaturedController
|
|
328
|
-
key={bAry[0].id}
|
|
329
334
|
business={bAry[0]}
|
|
330
335
|
isBusinessOpen={bAry[0]?.open}
|
|
331
336
|
handleCustomClick={handleBusinessClick}
|
|
@@ -333,7 +338,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
333
338
|
/>
|
|
334
339
|
{bAry.length > 1 && (
|
|
335
340
|
<BusinessFeaturedController
|
|
336
|
-
key={bAry[1].id}
|
|
337
341
|
business={bAry[1]}
|
|
338
342
|
isBusinessOpen={bAry[1]?.open}
|
|
339
343
|
handleCustomClick={handleBusinessClick}
|
|
@@ -372,9 +376,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
372
376
|
/>
|
|
373
377
|
)}
|
|
374
378
|
{businessesList.businesses?.map(
|
|
375
|
-
(business: any) => (
|
|
379
|
+
(business: any, i : number) => (
|
|
376
380
|
<BusinessController
|
|
377
|
-
key={business.id}
|
|
381
|
+
key={`${business.id}_` + i}
|
|
378
382
|
business={business}
|
|
379
383
|
isBusinessOpen={business.open}
|
|
380
384
|
handleCustomClick={handleBusinessClick}
|
|
@@ -166,9 +166,9 @@ const CartUI = (props: any) => {
|
|
|
166
166
|
handleClickCheckout={() => setOpenUpselling(true)}
|
|
167
167
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
|
|
168
168
|
>
|
|
169
|
-
{cart?.products?.length > 0 && cart?.products.map((product: any) => (
|
|
169
|
+
{cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
|
|
170
170
|
<ProductItemAccordion
|
|
171
|
-
key={product.code}
|
|
171
|
+
key={`${product.code}_${i}`}
|
|
172
172
|
isCartPending={isCartPending}
|
|
173
173
|
isCartProduct
|
|
174
174
|
product={product}
|
|
@@ -202,8 +202,8 @@ const CartUI = (props: any) => {
|
|
|
202
202
|
</OSTable>
|
|
203
203
|
)}
|
|
204
204
|
{
|
|
205
|
-
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
|
|
206
|
-
<OSTable key={offer.id}>
|
|
205
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
|
|
206
|
+
<OSTable key={`${offer.id}_${i}`}>
|
|
207
207
|
<OSRow>
|
|
208
208
|
<OText size={12} lineHeight={18}>{offer.name}</OText>
|
|
209
209
|
{offer.rate_type === 1 && (
|
|
@@ -234,8 +234,8 @@ const CartUI = (props: any) => {
|
|
|
234
234
|
</OSTable>
|
|
235
235
|
)}
|
|
236
236
|
{
|
|
237
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
238
|
-
<OSTable key={tax.id}>
|
|
237
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
238
|
+
<OSTable key={`${tax.id}_${i}`}>
|
|
239
239
|
<OSRow>
|
|
240
240
|
<OText size={12} lineHeight={18} numberOfLines={1} >
|
|
241
241
|
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
@@ -250,8 +250,8 @@ const CartUI = (props: any) => {
|
|
|
250
250
|
))
|
|
251
251
|
}
|
|
252
252
|
{
|
|
253
|
-
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
|
|
254
|
-
<OSTable key={fee
|
|
253
|
+
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
|
|
254
|
+
<OSTable key={`${fee.id}_${i}`}>
|
|
255
255
|
<OSRow>
|
|
256
256
|
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
257
257
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
@@ -293,8 +293,8 @@ const CartUI = (props: any) => {
|
|
|
293
293
|
</OSTable>
|
|
294
294
|
)}
|
|
295
295
|
{
|
|
296
|
-
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
297
|
-
<OSTable key={offer.id}>
|
|
296
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
297
|
+
<OSTable key={`${offer.id}_${i}`}>
|
|
298
298
|
<OSRow>
|
|
299
299
|
<OText size={12} lineHeight={18}>{offer.name}</OText>
|
|
300
300
|
{offer.rate_type === 1 && (
|
|
@@ -409,7 +409,7 @@ const CartUI = (props: any) => {
|
|
|
409
409
|
)}
|
|
410
410
|
</OSBill>
|
|
411
411
|
)}
|
|
412
|
-
{cart?.valid_products
|
|
412
|
+
{cart?.valid_products ? (
|
|
413
413
|
<CheckoutAction>
|
|
414
414
|
<OButton
|
|
415
415
|
text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
@@ -428,6 +428,12 @@ const CartUI = (props: any) => {
|
|
|
428
428
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
429
429
|
/>
|
|
430
430
|
</CheckoutAction>
|
|
431
|
+
) : (
|
|
432
|
+
<View style={{ alignItems: 'center', width: '100%' }}>
|
|
433
|
+
<OText size={12} color={theme.colors.red} style={{ textAlign: 'center', marginTop: 5 }}>
|
|
434
|
+
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
435
|
+
</OText>
|
|
436
|
+
</View>
|
|
431
437
|
)}
|
|
432
438
|
</BusinessItemAccordion>
|
|
433
439
|
|
|
@@ -649,7 +649,7 @@ const CheckoutUI = (props: any) => {
|
|
|
649
649
|
color={theme.colors.error}
|
|
650
650
|
size={12}
|
|
651
651
|
>
|
|
652
|
-
{t('
|
|
652
|
+
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
653
653
|
</OText>
|
|
654
654
|
)}
|
|
655
655
|
{placeSpotTypes.includes(options?.type) && !cart?.place && (
|
|
@@ -36,7 +36,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
36
36
|
loadOrders,
|
|
37
37
|
setSelectedOrderId,
|
|
38
38
|
setOrderList,
|
|
39
|
-
setOpenMessges
|
|
39
|
+
setOpenMessges,
|
|
40
|
+
setRefreshOrders,
|
|
41
|
+
refreshOrders
|
|
40
42
|
} = props
|
|
41
43
|
|
|
42
44
|
const theme = useTheme();
|
|
@@ -99,6 +101,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
99
101
|
setOrderList(orderList)
|
|
100
102
|
}, [orderList, loading])
|
|
101
103
|
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if(refreshOrders){
|
|
106
|
+
loadOrders(false, false, false, true)
|
|
107
|
+
setRefreshOrders && setRefreshOrders(false)
|
|
108
|
+
}
|
|
109
|
+
}, [refreshOrders])
|
|
110
|
+
|
|
102
111
|
return (
|
|
103
112
|
<>
|
|
104
113
|
{!loading && orders.length === 0 && (
|
|
@@ -19,7 +19,8 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
19
19
|
typeSelected,
|
|
20
20
|
defaultValue,
|
|
21
21
|
configTypes,
|
|
22
|
-
orderTypes
|
|
22
|
+
orderTypes,
|
|
23
|
+
setOrderTypeValue
|
|
23
24
|
} = props
|
|
24
25
|
|
|
25
26
|
const theme = useTheme();
|
|
@@ -39,6 +40,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
39
40
|
|
|
40
41
|
const handleChangeOrderTypeCallback = (orderType: number) => {
|
|
41
42
|
if (!orderState.loading) {
|
|
43
|
+
setOrderTypeValue && setOrderTypeValue(orderType)
|
|
42
44
|
handleChangeOrderType(orderType)
|
|
43
45
|
goToBack();
|
|
44
46
|
}
|
|
@@ -33,7 +33,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
33
33
|
loadMoreOrders,
|
|
34
34
|
loadOrders,
|
|
35
35
|
setOrdersLength,
|
|
36
|
-
ordersLength
|
|
36
|
+
ordersLength,
|
|
37
|
+
refreshOrders,
|
|
38
|
+
setRefreshOrders
|
|
37
39
|
} = props
|
|
38
40
|
|
|
39
41
|
const theme = useTheme();
|
|
@@ -105,7 +107,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
105
107
|
|
|
106
108
|
useFocusEffect(
|
|
107
109
|
React.useCallback(() => {
|
|
108
|
-
loadOrders()
|
|
110
|
+
loadOrders(false, false, false, true)
|
|
109
111
|
}, [navigation])
|
|
110
112
|
)
|
|
111
113
|
|
|
@@ -128,6 +130,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
128
130
|
}
|
|
129
131
|
}, [orders, activeOrders])
|
|
130
132
|
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if(refreshOrders){
|
|
135
|
+
loadOrders(false, false, false, true)
|
|
136
|
+
setRefreshOrders && setRefreshOrders(false)
|
|
137
|
+
}
|
|
138
|
+
}, [refreshOrders])
|
|
139
|
+
|
|
131
140
|
return (
|
|
132
141
|
<>
|
|
133
142
|
{!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
|
|
@@ -100,12 +100,13 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
100
100
|
<Container
|
|
101
101
|
key={wallet.id}
|
|
102
102
|
isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
|
|
103
|
+
onPress={() => handleOnChange(idx, wallet)}
|
|
104
|
+
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
|
|
103
105
|
>
|
|
104
106
|
<SectionLeft>
|
|
105
107
|
<CheckBox
|
|
106
108
|
value={checkedState[idx]}
|
|
107
|
-
|
|
108
|
-
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0 }
|
|
109
|
+
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
|
|
109
110
|
boxType={'square'}
|
|
110
111
|
tintColors={{
|
|
111
112
|
true: theme.colors.primary,
|
|
@@ -292,20 +292,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
292
292
|
let _videoId = keys[keys.length - 1]
|
|
293
293
|
|
|
294
294
|
if (_videoId.includes('watch')) {
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
const __url = _videoId.split('=')[1]
|
|
296
|
+
_videoId = __url
|
|
297
297
|
} else if (_videoId.includes('?')) {
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
const __url = _videoId.split('?')[0]
|
|
299
|
+
_videoId = __url
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
if (_videoId.search(/&/i) >= 0) {
|
|
303
|
-
|
|
303
|
+
_videoId = _videoId.split('&')[0]
|
|
304
304
|
} else if (_videoId.search(/\?/i) >= 0) {
|
|
305
|
-
|
|
305
|
+
_videoId = _videoId.split('?')[0]
|
|
306
306
|
}
|
|
307
307
|
if ((_videoId.length === 11)) {
|
|
308
|
-
|
|
308
|
+
videoList.push(_videoId)
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
}
|
|
@@ -326,25 +326,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
326
326
|
|
|
327
327
|
const ExtraOptions = ({ eID, options }: any) => (
|
|
328
328
|
<>
|
|
329
|
-
{product?.ingredients.length > 0 && (
|
|
330
|
-
<TouchableOpacity
|
|
331
|
-
key={`eopt_all_00`}
|
|
332
|
-
onPress={() => setSelectedOpt(-1)}
|
|
333
|
-
style={[
|
|
334
|
-
styles.extraItem,
|
|
335
|
-
{
|
|
336
|
-
borderBottomColor:
|
|
337
|
-
selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
|
|
338
|
-
},
|
|
339
|
-
]}>
|
|
340
|
-
<OText
|
|
341
|
-
color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
|
|
342
|
-
size={selOpt == -1 ? 14 : 12}
|
|
343
|
-
weight={selOpt == -1 ? '600' : 'normal'}>
|
|
344
|
-
{t('INGREDIENTS', 'Ingredients')}
|
|
345
|
-
</OText>
|
|
346
|
-
</TouchableOpacity>
|
|
347
|
-
)}
|
|
348
329
|
{options.map(({ id, name, respect_to, suboptions }: any) => (
|
|
349
330
|
<React.Fragment key={`cont_key_${id}`}>
|
|
350
331
|
{respect_to == null && suboptions?.length > 0 && (
|
|
@@ -665,6 +646,25 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
665
646
|
{t('ALL', 'All')}
|
|
666
647
|
</OText>
|
|
667
648
|
</TouchableOpacity>
|
|
649
|
+
{product?.ingredients.length > 0 && (
|
|
650
|
+
<TouchableOpacity
|
|
651
|
+
key={`eopt_all_00`}
|
|
652
|
+
onPress={() => setSelectedOpt(-1)}
|
|
653
|
+
style={[
|
|
654
|
+
styles.extraItem,
|
|
655
|
+
{
|
|
656
|
+
borderBottomColor:
|
|
657
|
+
selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
|
|
658
|
+
},
|
|
659
|
+
]}>
|
|
660
|
+
<OText
|
|
661
|
+
color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
|
|
662
|
+
size={selOpt == -1 ? 14 : 12}
|
|
663
|
+
weight={selOpt == -1 ? '600' : 'normal'}>
|
|
664
|
+
{t('INGREDIENTS', 'Ingredients')}
|
|
665
|
+
</OText>
|
|
666
|
+
</TouchableOpacity>
|
|
667
|
+
)}
|
|
668
668
|
{product?.extras.map((extra: any) =>
|
|
669
669
|
<ExtraOptions key={extra.id} options={extra.options} />
|
|
670
670
|
)}
|
|
@@ -130,9 +130,11 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
130
130
|
</>
|
|
131
131
|
)}
|
|
132
132
|
</PositionControl>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
{price > 0 && (
|
|
134
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
135
|
+
+ {parsePrice(price)}
|
|
136
|
+
</OText>
|
|
137
|
+
)}
|
|
136
138
|
</Container>
|
|
137
139
|
{showMessage && <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</OText>}
|
|
138
140
|
</View>
|
|
@@ -13,9 +13,14 @@ import { OText, OIcon } from '../shared';
|
|
|
13
13
|
import FastImage from 'react-native-fast-image'
|
|
14
14
|
import { shape } from '../../utils';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
function SingleProductCardPropsAreEqual(prevProps : any, nextProps : any) {
|
|
17
|
+
return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
|
|
18
|
+
prevProps.isSoldOut === nextProps.isSoldOut &&
|
|
19
|
+
prevProps.productAddedToCartLength === nextProps.productAddedToCartLength
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const SingleProductCard = React.memo((props: SingleProductCardParams) => {
|
|
17
23
|
const {
|
|
18
|
-
businessId,
|
|
19
24
|
product,
|
|
20
25
|
isSoldOut,
|
|
21
26
|
onProductClick,
|
|
@@ -148,7 +153,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
148
153
|
weight={'400'}
|
|
149
154
|
color={theme.colors.white}
|
|
150
155
|
numberOfLines={2}
|
|
151
|
-
|
|
156
|
+
ellipsizeMode='tail'
|
|
152
157
|
lineHeight={13}
|
|
153
158
|
>
|
|
154
159
|
{product?.ribbon?.text}
|
|
@@ -181,4 +186,4 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
181
186
|
)}
|
|
182
187
|
</CardContainer>
|
|
183
188
|
);
|
|
184
|
-
};
|
|
189
|
+
}, SingleProductCardPropsAreEqual);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
UpsellingPage as UpsellingPageController,
|
|
5
5
|
useUtils,
|
|
6
6
|
useLanguage,
|
|
7
|
-
|
|
7
|
+
useOrder
|
|
8
8
|
} from 'ordering-components/native'
|
|
9
9
|
import { useTheme } from 'styled-components/native';
|
|
10
10
|
import { OText, OIcon, OBottomPopup, OButton } from '../shared'
|
|
@@ -62,7 +62,19 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
62
62
|
borderRadius: 7.6,
|
|
63
63
|
borderColor: theme.colors.textSecondary,
|
|
64
64
|
height: 38
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
headerItem: {
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
marginVertical: 2,
|
|
70
|
+
marginHorizontal: 20,
|
|
71
|
+
},
|
|
72
|
+
btnBackArrow: {
|
|
73
|
+
borderWidth: 0,
|
|
74
|
+
backgroundColor: theme.colors.clear,
|
|
75
|
+
shadowColor: theme.colors.clear,
|
|
76
|
+
padding: 40,
|
|
77
|
+
},
|
|
66
78
|
})
|
|
67
79
|
|
|
68
80
|
const [modalIsOpen, setModalIsOpen] = useState(false)
|
|
@@ -77,11 +89,11 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
77
89
|
? cart?.products.map((product: any) => product.id)
|
|
78
90
|
: []
|
|
79
91
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
const productsList = !upsellingProducts.loading && !upsellingProducts.error
|
|
93
|
+
? upsellingProducts?.products?.length
|
|
94
|
+
? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
|
|
95
|
+
: (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
|
|
96
|
+
: []
|
|
85
97
|
|
|
86
98
|
useEffect(() => {
|
|
87
99
|
if (!isCustomMode && !props.products) {
|
|
@@ -100,10 +112,10 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
100
112
|
}, [cart, isCheckout])
|
|
101
113
|
|
|
102
114
|
const handleFormProduct = (product: any) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
115
|
+
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
116
|
+
product: product,
|
|
117
|
+
businessId: product?.api?.businessId,
|
|
118
|
+
businessSlug: business.slug,
|
|
107
119
|
})
|
|
108
120
|
}
|
|
109
121
|
|
|
@@ -119,8 +131,8 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
119
131
|
!upsellingProducts.loading && (
|
|
120
132
|
<>
|
|
121
133
|
{
|
|
122
|
-
!upsellingProducts.error ? productsList.map((product: any) => (
|
|
123
|
-
<Item key={product.id}>
|
|
134
|
+
!upsellingProducts.error ? productsList.map((product: any, i: number) => (
|
|
135
|
+
<Item key={`${product.id}_${i}`}>
|
|
124
136
|
<View style={{ flexBasis: '57%' }}>
|
|
125
137
|
<Details>
|
|
126
138
|
<OText size={12} lineHeight={18} numberOfLines={1} ellipsizeMode='tail'>{product.name}</OText>
|
|
@@ -148,50 +160,54 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
148
160
|
)
|
|
149
161
|
}
|
|
150
162
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
const UpsellingContent = () => {
|
|
164
|
+
return (
|
|
165
|
+
<>
|
|
166
|
+
<View style={{ ...styles.headerItem, flex: 1 }}>
|
|
167
|
+
<OButton
|
|
168
|
+
imgLeftSrc={theme.images.general.arrow_left}
|
|
169
|
+
imgRightSrc={null}
|
|
170
|
+
style={styles.btnBackArrow}
|
|
171
|
+
onClick={() => onGoBack()}
|
|
172
|
+
imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
|
|
173
|
+
/>
|
|
174
|
+
</View>
|
|
175
|
+
<ScrollView style={{ marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|
|
160
176
|
{productsList.length > 0 &&
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
177
|
+
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
178
|
+
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
179
|
+
<UpsellingLayout />
|
|
180
|
+
</View>
|
|
181
|
+
}
|
|
182
|
+
<View style={{ paddingHorizontal: 40 }}>
|
|
183
|
+
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
184
|
+
<OrderSummary
|
|
185
|
+
cart={cart}
|
|
186
|
+
isCartPending={cart?.status === 2}
|
|
187
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
188
|
+
/>
|
|
189
|
+
</View>
|
|
190
|
+
</ScrollView>
|
|
191
|
+
<View
|
|
192
|
+
style={{
|
|
193
|
+
alignItems: 'center',
|
|
194
|
+
bottom: props.isPage ? Platform.OS === 'ios' ? 0 : 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
<OButton
|
|
198
|
+
imgRightSrc=''
|
|
199
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
200
|
+
style={{ ...styles.closeUpsellingButton }}
|
|
201
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
202
|
+
onClick={() => {
|
|
203
|
+
handleUpsellingPage()
|
|
204
|
+
setIsCheckout(true)
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
</View>
|
|
208
|
+
</>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
195
211
|
|
|
196
212
|
return (
|
|
197
213
|
<>
|
|
@@ -199,20 +215,20 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
199
215
|
<UpsellingLayout />
|
|
200
216
|
) : (
|
|
201
217
|
<>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
218
|
+
{props.isPage ? (
|
|
219
|
+
<UpsellingContent />
|
|
220
|
+
) : (
|
|
221
|
+
canOpenUpselling && !modalIsOpen && (
|
|
222
|
+
<OBottomPopup
|
|
223
|
+
title={''}
|
|
224
|
+
open={openUpselling}
|
|
225
|
+
onClose={() => handleUpsellingPage()}
|
|
226
|
+
isStatusBar
|
|
227
|
+
>
|
|
228
|
+
<UpsellingContent />
|
|
229
|
+
</OBottomPopup>
|
|
230
|
+
)
|
|
231
|
+
)}
|
|
216
232
|
</>
|
|
217
233
|
)}
|
|
218
234
|
</>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Platform, StyleSheet,
|
|
2
|
+
import { Platform, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useSession, useLanguage, ToastType, useToast, useConfig } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { useForm, Controller } from 'react-hook-form';
|
|
@@ -182,7 +182,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
182
182
|
handleChangeInput(phoneNumber, true);
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
const changeCountry = (country
|
|
185
|
+
const changeCountry = (country: any) => {
|
|
186
186
|
let countryCode = {
|
|
187
187
|
country_code: {
|
|
188
188
|
name: 'country_code',
|
|
@@ -325,7 +325,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
325
325
|
<PhoneInputNumber
|
|
326
326
|
data={phoneInputData}
|
|
327
327
|
handleData={(val: any) => handleChangePhoneNumber(val)}
|
|
328
|
-
changeCountry={(val
|
|
328
|
+
changeCountry={(val: any) => changeCountry(val)}
|
|
329
329
|
defaultValue={phoneUpdate ? '' : user?.cellphone}
|
|
330
330
|
defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
|
|
331
331
|
boxStyle={styles.phoneSelect}
|
|
@@ -379,16 +379,18 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
379
379
|
rules={getInputRules({ name: 'password', code: 'password' })}
|
|
380
380
|
defaultValue=''
|
|
381
381
|
/>
|
|
382
|
-
<
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
382
|
+
<Controller
|
|
383
|
+
control={control}
|
|
384
|
+
render={({ onChange, value }: any) => (
|
|
385
|
+
<TouchableOpacity
|
|
386
|
+
style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
|
|
387
|
+
onPress={() => {
|
|
388
|
+
onChange(!value)
|
|
389
|
+
handleChangePromotions(!value)
|
|
390
|
+
}}
|
|
391
|
+
>
|
|
386
392
|
<CheckBox
|
|
387
393
|
value={value}
|
|
388
|
-
onValueChange={newValue => {
|
|
389
|
-
onChange(newValue)
|
|
390
|
-
handleChangePromotions(newValue)
|
|
391
|
-
}}
|
|
392
394
|
boxType={'square'}
|
|
393
395
|
tintColors={{
|
|
394
396
|
true: theme.colors.primary,
|
|
@@ -399,14 +401,14 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
399
401
|
onTintColor={theme.colors.primary}
|
|
400
402
|
style={Platform.OS === 'ios' && styles.checkBoxStyle}
|
|
401
403
|
/>
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
404
|
+
<OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
|
|
405
|
+
</TouchableOpacity>
|
|
406
|
+
)}
|
|
407
|
+
name='promotions'
|
|
408
|
+
defaultValue={formState?.result?.result
|
|
409
|
+
? !!formState?.result?.result?.settings?.notification?.newsletter
|
|
410
|
+
: !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
|
|
411
|
+
/>
|
|
410
412
|
</UDWrapper>
|
|
411
413
|
)}
|
|
412
414
|
{validationFields?.loading && (
|
|
@@ -56,7 +56,8 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
56
56
|
},
|
|
57
57
|
pagePadding: {
|
|
58
58
|
paddingLeft: 40,
|
|
59
|
-
paddingRight: 40
|
|
59
|
+
paddingRight: 40,
|
|
60
|
+
justifyContent: 'center',
|
|
60
61
|
},
|
|
61
62
|
navBarStyle: {
|
|
62
63
|
paddingLeft: 40,
|
|
@@ -205,8 +206,8 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
205
206
|
},
|
|
206
207
|
});
|
|
207
208
|
handleSendVerifyCode({
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
cellphone: cellphone,
|
|
210
|
+
country_phone_code: countryPhoneCode
|
|
210
211
|
})
|
|
211
212
|
}
|
|
212
213
|
}
|
|
@@ -277,15 +278,16 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
277
278
|
|
|
278
279
|
return (
|
|
279
280
|
<>
|
|
281
|
+
<NavBar
|
|
282
|
+
title={t('ACCOUNT', 'Account')}
|
|
283
|
+
titleAlign={'center'}
|
|
284
|
+
onActionLeft={() => navigation.goBack()}
|
|
285
|
+
showCall={false}
|
|
286
|
+
style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 30 }}
|
|
287
|
+
/>
|
|
280
288
|
<KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
|
|
281
289
|
<Container noPadding>
|
|
282
|
-
|
|
283
|
-
onActionLeft={() => navigation.goBack()}
|
|
284
|
-
btnStyle={{ paddingStart: 0 }}
|
|
285
|
-
title={t('ACCOUNT', 'Account')}
|
|
286
|
-
isVertical
|
|
287
|
-
style={styles.navBarStyle}
|
|
288
|
-
/>
|
|
290
|
+
|
|
289
291
|
<CenterView style={styles.pagePadding}>
|
|
290
292
|
<View style={styles.photo}>
|
|
291
293
|
{user?.photo ? (
|
|
@@ -305,7 +307,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
305
307
|
icon={theme.images.general.camera}
|
|
306
308
|
borderColor={theme.colors.clear}
|
|
307
309
|
iconStyle={{ width: 20, height: 20 }}
|
|
308
|
-
style={{ maxWidth: 40, position: 'absolute',
|
|
310
|
+
style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
|
|
309
311
|
onClick={() => handleImagePicker()}
|
|
310
312
|
/>
|
|
311
313
|
</CenterView>
|
|
@@ -326,13 +328,13 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
326
328
|
entireModal
|
|
327
329
|
>
|
|
328
330
|
<VerifyPhone
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
331
|
+
phone={phoneInputData.phone}
|
|
332
|
+
verifyPhoneState={verifyPhoneState}
|
|
333
|
+
checkPhoneCodeState={checkPhoneCodeState}
|
|
334
|
+
handleCheckPhoneCode={handleCheckPhoneCode}
|
|
335
|
+
setCheckPhoneCodeState={setCheckPhoneCodeState}
|
|
336
|
+
handleVerifyCodeClick={handleVerifyCodeClick}
|
|
337
|
+
onClose={() => setIsModalVisible(false)}
|
|
336
338
|
/>
|
|
337
339
|
</OModal>
|
|
338
340
|
</>
|
|
@@ -35,7 +35,10 @@ const WalletsUI = (props: any) => {
|
|
|
35
35
|
transactionsList,
|
|
36
36
|
setWalletSelected,
|
|
37
37
|
isWalletCashEnabled,
|
|
38
|
-
isWalletPointsEnabled
|
|
38
|
+
isWalletPointsEnabled,
|
|
39
|
+
getWallets,
|
|
40
|
+
refreshWallets,
|
|
41
|
+
setRefreshWallets
|
|
39
42
|
} = props
|
|
40
43
|
|
|
41
44
|
const [, t] = useLanguage()
|
|
@@ -95,6 +98,13 @@ const WalletsUI = (props: any) => {
|
|
|
95
98
|
}
|
|
96
99
|
}, [configs])
|
|
97
100
|
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if(refreshWallets){
|
|
103
|
+
getWallets()
|
|
104
|
+
setRefreshWallets && setRefreshWallets(false)
|
|
105
|
+
}
|
|
106
|
+
}, [refreshWallets])
|
|
107
|
+
|
|
98
108
|
return (
|
|
99
109
|
<Container>
|
|
100
110
|
<NavBar
|
|
@@ -111,14 +121,17 @@ const WalletsUI = (props: any) => {
|
|
|
111
121
|
walletList.wallets?.length > 0 &&
|
|
112
122
|
(
|
|
113
123
|
<>
|
|
114
|
-
<OTabs
|
|
124
|
+
<OTabs
|
|
125
|
+
horizontal
|
|
126
|
+
showsHorizontalScrollIndicator={false}
|
|
127
|
+
>
|
|
115
128
|
{walletList.wallets?.map((wallet: any) => walletName[wallet.type]?.isActive && (
|
|
116
129
|
<Pressable
|
|
117
130
|
key={wallet.id}
|
|
118
131
|
onPress={() => handleChangeTab(wallet)}
|
|
119
132
|
>
|
|
120
|
-
<OTab>
|
|
121
|
-
<OText size={18}
|
|
133
|
+
<OTab isSelected={tabSelected === wallet.type}>
|
|
134
|
+
<OText size={18}>
|
|
122
135
|
{walletName[wallet.type]?.name}
|
|
123
136
|
</OText>
|
|
124
137
|
</OTab>
|
|
@@ -59,6 +59,7 @@ export interface AddressListParams {
|
|
|
59
59
|
isFromProductsList?: boolean;
|
|
60
60
|
afterSignup?: boolean;
|
|
61
61
|
isFromCheckout?: boolean
|
|
62
|
+
loadAddresses: () => void
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
export interface AddressFormParams {
|
|
@@ -164,7 +165,7 @@ export interface BusinessTypeFilterParams {
|
|
|
164
165
|
setBusinessTypes?: any
|
|
165
166
|
}
|
|
166
167
|
export interface BusinessControllerParams {
|
|
167
|
-
key?: number;
|
|
168
|
+
key?: string | number;
|
|
168
169
|
business?: any;
|
|
169
170
|
handleCustomClick?: any;
|
|
170
171
|
orderType?: any;
|
|
@@ -247,7 +248,8 @@ export interface BusinessProductsListParams {
|
|
|
247
248
|
setSubcategoriesSelected?: any,
|
|
248
249
|
subcategoriesSelected?: any,
|
|
249
250
|
onClickCategory?: any,
|
|
250
|
-
lazyLoadProductsRecommended?: boolean
|
|
251
|
+
lazyLoadProductsRecommended?: boolean,
|
|
252
|
+
isFiltMode?: boolean
|
|
251
253
|
}
|
|
252
254
|
export interface SingleProductCardParams {
|
|
253
255
|
businessId: any,
|
|
@@ -303,7 +305,9 @@ export interface OrdersOptionParams {
|
|
|
303
305
|
ordersLength: { activeOrdersLength: number, previousOrdersLength: number },
|
|
304
306
|
setSelectedOrderId?: any,
|
|
305
307
|
setOpenMessges?: any,
|
|
306
|
-
loadMoreStatus?: boolean
|
|
308
|
+
loadMoreStatus?: boolean,
|
|
309
|
+
refreshOrders?: boolean,
|
|
310
|
+
setRefreshOrders?: (value : boolean) => void
|
|
307
311
|
}
|
|
308
312
|
export interface ActiveOrdersParams {
|
|
309
313
|
orders?: any,
|
|
@@ -489,6 +493,7 @@ export interface OrderTypeSelectParams {
|
|
|
489
493
|
defaultValue?: number;
|
|
490
494
|
configTypes?: Array<any>;
|
|
491
495
|
orderTypes: Array<any>;
|
|
496
|
+
setOrderTypeValue?: (value : number) => any
|
|
492
497
|
}
|
|
493
498
|
export interface UpsellingProductsParams {
|
|
494
499
|
isCustomMode?: boolean;
|