ordering-ui-react-native 0.15.57 → 0.15.58-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 +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessTypeFilter/index.tsx +3 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeMethodForm/index.tsx +1 -2
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +42 -90
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +41 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +5 -2
- package/themes/business/src/components/PreviousOrders/index.tsx +2 -2
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +6 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +11 -12
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/index.tsx +22 -8
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +7 -6
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +9 -13
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
- package/themes/original/src/components/BusinessController/index.tsx +48 -11
- package/themes/original/src/components/BusinessController/styles.tsx +27 -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/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +51 -53
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +105 -22
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +126 -65
- package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
- package/themes/original/src/components/Cart/index.tsx +60 -41
- package/themes/original/src/components/Checkout/index.tsx +48 -32
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +11 -11
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +135 -49
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +130 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -36
- package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +70 -62
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/SearchBar/index.tsx +10 -4
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +237 -126
- package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +5 -96
- package/themes/original/src/components/UserFormDetails/index.tsx +25 -26
- package/themes/original/src/components/UserProfile/index.tsx +52 -5
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/types/index.tsx +189 -35
- package/themes/original/src/utils/index.tsx +85 -2
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -10,6 +10,7 @@ import { View, ScrollView } from 'react-native';
|
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
12
|
import { shape } from '../../utils'
|
|
13
|
+
import { CategoryDescriptionMemoized } from './CategoryDescription';
|
|
13
14
|
|
|
14
15
|
const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
15
16
|
const {
|
|
@@ -32,7 +33,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
32
33
|
setSubcategoriesSelected,
|
|
33
34
|
subcategoriesSelected,
|
|
34
35
|
onClickCategory,
|
|
35
|
-
lazyLoadProductsRecommended
|
|
36
|
+
lazyLoadProductsRecommended,
|
|
37
|
+
handleUpdateProducts,
|
|
38
|
+
isFiltMode
|
|
36
39
|
} = props;
|
|
37
40
|
|
|
38
41
|
const [, t] = useLanguage();
|
|
@@ -48,24 +51,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
48
51
|
setCategoriesLayout(_categoriesLayout)
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
const onClickSubcategory = (subCategory
|
|
54
|
+
const onClickSubcategory = (subCategory: any, parentCategory: any) => {
|
|
52
55
|
if (parentCategory && lazyLoadProductsRecommended) {
|
|
53
56
|
onClickCategory(parentCategory)
|
|
54
57
|
}
|
|
55
58
|
if (!subCategory) {
|
|
56
|
-
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory
|
|
59
|
+
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory: any) => _subcategory?.parent_category_id !== parentCategory?.id))
|
|
57
60
|
return
|
|
58
61
|
}
|
|
59
|
-
const categoryFounded = subcategoriesSelected.find((_subcategory
|
|
62
|
+
const categoryFounded = subcategoriesSelected.find((_subcategory: any) => subCategory?.id === _subcategory?.id)
|
|
60
63
|
if (categoryFounded) {
|
|
61
|
-
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory
|
|
64
|
+
setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory: any) => subCategory?.id !== _subcategory?.id))
|
|
62
65
|
} else {
|
|
63
66
|
setSubcategoriesSelected?.([...subcategoriesSelected, subCategory])
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
const SubcategoriesComponent = ({ category }
|
|
68
|
-
const allsubcategorySelected = !subcategoriesSelected?.some((subcategory
|
|
70
|
+
const SubcategoriesComponent = ({ category }: any) => {
|
|
71
|
+
const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
|
|
69
72
|
|
|
70
73
|
return (
|
|
71
74
|
<SubCategoriesContainer>
|
|
@@ -80,8 +83,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
80
83
|
textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
|
|
81
84
|
/>
|
|
82
85
|
</ContainerButton>
|
|
83
|
-
{category?.subcategories?.map((subcategory
|
|
84
|
-
const isSubcategorySelected = subcategoriesSelected?.find((_subcategory
|
|
86
|
+
{category?.subcategories?.map((subcategory: any) => {
|
|
87
|
+
const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
|
|
85
88
|
return (
|
|
86
89
|
<ContainerButton
|
|
87
90
|
key={subcategory?.id}
|
|
@@ -102,7 +105,6 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
102
105
|
)
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
|
|
106
108
|
return (
|
|
107
109
|
<ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
|
|
108
110
|
<HeaderWrapper>
|
|
@@ -112,21 +114,23 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
112
114
|
</HeaderWrapper>
|
|
113
115
|
{category.id &&
|
|
114
116
|
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
|
-
|
|
117
|
+
?.filter((product: any) =>
|
|
118
|
+
!subcategoriesSelected.find((subcategory: any) => subcategory?.parent_category_id === category?.id) ||
|
|
119
|
+
subcategoriesSelected?.some((subcategory: any) => subcategory.id === product?.category_id))
|
|
120
|
+
?.sort((a: any, b: any) => a.rank - b.rank)
|
|
121
|
+
?.map((product: any, i: number) => (
|
|
122
|
+
<SingleProductCard
|
|
123
|
+
key={'prod_' + product.id + `_${i}`}
|
|
124
|
+
isSoldOut={product.inventoried && !product.quantity}
|
|
125
|
+
product={product}
|
|
126
|
+
businessId={businessId}
|
|
127
|
+
categoryState={categoryState}
|
|
128
|
+
onProductClick={() => onProductClick(product)}
|
|
129
|
+
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
130
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
131
|
+
/>
|
|
132
|
+
))
|
|
133
|
+
}
|
|
130
134
|
{!category.id &&
|
|
131
135
|
featured &&
|
|
132
136
|
categoryState?.products?.find((product: any) => product.featured) && (
|
|
@@ -141,11 +145,13 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
141
145
|
(product: any, i: any) =>
|
|
142
146
|
product.featured && (
|
|
143
147
|
<SingleProductCard
|
|
144
|
-
key={'feat_' + product.id}
|
|
148
|
+
key={'feat_' + product.id + `_${i}`}
|
|
145
149
|
isSoldOut={product.inventoried && !product.quantity}
|
|
146
150
|
product={product}
|
|
147
151
|
businessId={businessId}
|
|
152
|
+
categoryState={categoryState}
|
|
148
153
|
onProductClick={onProductClick}
|
|
154
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
149
155
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
150
156
|
/>
|
|
151
157
|
),
|
|
@@ -156,12 +162,12 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
156
162
|
|
|
157
163
|
{!category?.id && categories.filter(category => category?.id !== null).map((category, i, _categories) => {
|
|
158
164
|
const _products = !isUseParentCategory
|
|
159
|
-
? categoryState?.products?.filter((product
|
|
160
|
-
: categoryState?.products?.filter((product
|
|
165
|
+
? categoryState?.products?.filter((product: any) => product?.category_id === category?.id) ?? []
|
|
166
|
+
: categoryState?.products?.filter((product: any) => category?.children?.some((cat: any) => cat.category_id === product?.category_id)) ?? []
|
|
161
167
|
const products = subcategoriesSelected?.length > 0
|
|
162
|
-
? _products?.filter((product
|
|
163
|
-
!subcategoriesSelected.find((subcategory
|
|
164
|
-
subcategoriesSelected?.some((subcategory
|
|
168
|
+
? _products?.filter((product: any) =>
|
|
169
|
+
!subcategoriesSelected.find((subcategory: any) => subcategory?.parent_category_id === category?.id) ||
|
|
170
|
+
subcategoriesSelected?.some((subcategory: any) => subcategory.id === product?.category_id))
|
|
165
171
|
: _products
|
|
166
172
|
|
|
167
173
|
const shortCategoryDescription = category?.description?.length > 80 ? `${category?.description?.substring(0, 80)}...` : category?.description
|
|
@@ -211,7 +217,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
211
217
|
{category?.description?.length > 80 && (
|
|
212
218
|
<OButton
|
|
213
219
|
style={{ height: 15, paddingRight: 0, paddingLeft: 0, borderWidth: 0 }}
|
|
214
|
-
text={t('
|
|
220
|
+
text={t('VIEW_MORE', 'View more')}
|
|
215
221
|
parentStyle={{ padding: 0 }}
|
|
216
222
|
onClick={() => setOpenDescription(category)}
|
|
217
223
|
bgColor='transparent'
|
|
@@ -224,19 +230,21 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
224
230
|
/>
|
|
225
231
|
)}
|
|
226
232
|
</OText>
|
|
227
|
-
{category?.subcategories?.length > 0 && (
|
|
228
|
-
<SubcategoriesComponent category={category} />
|
|
229
|
-
)}
|
|
230
233
|
</View>
|
|
231
234
|
)}
|
|
235
|
+
{category?.subcategories?.length > 0 && !isFiltMode && (
|
|
236
|
+
<SubcategoriesComponent category={category} />
|
|
237
|
+
)}
|
|
232
238
|
<>
|
|
233
239
|
{products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
|
|
234
240
|
<SingleProductCard
|
|
235
|
-
key={i}
|
|
241
|
+
key={`${product?.id}_${i}`}
|
|
236
242
|
isSoldOut={product.inventoried && !product.quantity}
|
|
237
243
|
businessId={businessId}
|
|
238
244
|
product={product}
|
|
245
|
+
categoryState={categoryState}
|
|
239
246
|
onProductClick={onProductClick}
|
|
247
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
240
248
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
241
249
|
/>
|
|
242
250
|
))}
|
|
@@ -272,6 +280,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
272
280
|
!isBusinessLoading &&
|
|
273
281
|
categoryState.products.length === 0 &&
|
|
274
282
|
!errors &&
|
|
283
|
+
!isFiltMode &&
|
|
275
284
|
!(
|
|
276
285
|
(searchValue && errorQuantityProducts) ||
|
|
277
286
|
(!searchValue && !errorQuantityProducts)
|
|
@@ -311,23 +320,12 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
311
320
|
<OText>{e}</OText>
|
|
312
321
|
</ErrorMessage>
|
|
313
322
|
))}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
{!!openDescription?.image && (
|
|
321
|
-
<OIcon
|
|
322
|
-
url={optimizeImage(openDescription?.image, 'h_100,c_limit')}
|
|
323
|
-
width={240}
|
|
324
|
-
height={240}
|
|
325
|
-
style={{ borderRadius: 7.6 }}
|
|
326
|
-
/>
|
|
327
|
-
)}
|
|
328
|
-
<OText mBottom={40}>{openDescription?.description}</OText>
|
|
329
|
-
</ScrollView>
|
|
330
|
-
</OModal>
|
|
323
|
+
{!!openDescription && (
|
|
324
|
+
<CategoryDescriptionMemoized
|
|
325
|
+
openDescription={openDescription}
|
|
326
|
+
setOpenDescription={setOpenDescription}
|
|
327
|
+
/>
|
|
328
|
+
)}
|
|
331
329
|
</ProductsContainer>
|
|
332
330
|
);
|
|
333
331
|
};
|
|
@@ -18,15 +18,12 @@ export const RibbonBox = styled.View`
|
|
|
18
18
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
19
19
|
padding: 2px 8px;
|
|
20
20
|
max-width: 180px;
|
|
21
|
-
|
|
22
21
|
${(props: any) => props.bgColor && css`
|
|
23
22
|
background-color: ${props.bgColor};
|
|
24
23
|
`}
|
|
25
|
-
|
|
26
24
|
${(props: any) => props.isRoundRect && css`
|
|
27
25
|
border-radius: 7.6px;
|
|
28
26
|
`}
|
|
29
|
-
|
|
30
27
|
${(props: any) => props.isCapsule && css`
|
|
31
28
|
border-radius: 50px;
|
|
32
29
|
`}
|
|
@@ -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,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useConfig
|
|
13
13
|
} from 'ordering-components/native'
|
|
14
14
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
15
|
+
import Alert from '../../providers/AlertProvider'
|
|
15
16
|
import { BusinessBasicInformation } from '../BusinessBasicInformation'
|
|
16
17
|
import { SearchBar } from '../SearchBar'
|
|
17
18
|
import { BusinessProductsCategories } from '../BusinessProductsCategories'
|
|
@@ -22,13 +23,16 @@ import {
|
|
|
22
23
|
TopHeader,
|
|
23
24
|
WrapSearchBar,
|
|
24
25
|
WrapContent,
|
|
25
|
-
BusinessProductsListingContainer
|
|
26
|
+
BusinessProductsListingContainer,
|
|
27
|
+
FiltProductsContainer,
|
|
28
|
+
ContainerSafeAreaView,
|
|
29
|
+
BackgroundGray
|
|
26
30
|
} from './styles'
|
|
27
31
|
import { FloatingButton } from '../FloatingButton'
|
|
28
32
|
import { UpsellingRedirect } from './UpsellingRedirect'
|
|
29
33
|
import Animated from 'react-native-reanimated'
|
|
30
34
|
|
|
31
|
-
const PIXELS_TO_SCROLL =
|
|
35
|
+
const PIXELS_TO_SCROLL = 2000
|
|
32
36
|
|
|
33
37
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
34
38
|
const {
|
|
@@ -45,7 +49,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
45
49
|
errorQuantityProducts,
|
|
46
50
|
header,
|
|
47
51
|
logo,
|
|
52
|
+
alertState,
|
|
53
|
+
setAlertState,
|
|
54
|
+
multiRemoveProducts,
|
|
48
55
|
getNextProducts,
|
|
56
|
+
handleUpdateProducts
|
|
49
57
|
} = props
|
|
50
58
|
|
|
51
59
|
const theme = useTheme();
|
|
@@ -94,8 +102,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
94
102
|
const [isCategoryClicked, setCategoryClicked] = useState(false)
|
|
95
103
|
const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
|
|
96
104
|
|
|
105
|
+
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
97
106
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
98
|
-
|
|
107
|
+
const isOpenFiltProducts = isOpenSearchBar && !!searchValue
|
|
108
|
+
const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
|
|
99
109
|
const onRedirect = (route: string, params?: any) => {
|
|
100
110
|
navigation.navigate(route, params)
|
|
101
111
|
}
|
|
@@ -114,13 +124,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
114
124
|
}
|
|
115
125
|
|
|
116
126
|
const handleUpsellingPage = () => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
if (isCheckoutMultiBusinessEnabled) {
|
|
128
|
+
onRedirect('CheckoutNavigator', {
|
|
129
|
+
screen: 'MultiCheckout'
|
|
130
|
+
})
|
|
131
|
+
} else {
|
|
132
|
+
onRedirect('CheckoutNavigator', {
|
|
133
|
+
screen: 'CheckoutPage',
|
|
134
|
+
cartUuid: currentCart?.uuid,
|
|
135
|
+
businessLogo: logo,
|
|
136
|
+
businessName: business?.name,
|
|
137
|
+
cartTotal: currentCart?.total
|
|
138
|
+
})
|
|
139
|
+
}
|
|
124
140
|
setOpenUpselling(false)
|
|
125
141
|
}
|
|
126
142
|
|
|
@@ -165,25 +181,41 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
165
181
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
166
182
|
}
|
|
167
183
|
|
|
184
|
+
const adjustBusiness = async (adjustBusinessId: number) => {
|
|
185
|
+
const _carts = orderState?.carts?.[adjustBusinessId]
|
|
186
|
+
const products = _carts?.products
|
|
187
|
+
const unavailableProducts = products.filter((product: any) => product.valid !== true)
|
|
188
|
+
const alreadyRemoved = await _retrieveStoreData('already-removed')
|
|
189
|
+
_removeStoreData('already-removed')
|
|
190
|
+
if (unavailableProducts.length > 0) {
|
|
191
|
+
multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (alreadyRemoved === 'removed') {
|
|
196
|
+
setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
168
200
|
const removeCartByReOrder = async () => {
|
|
169
|
-
const
|
|
170
|
-
if (currentCart &&
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
showToast(ToastType.Info, t('PRODUCT_REMOVED', 'Products removed from cart'))
|
|
201
|
+
const adjustBusinessId = await _retrieveStoreData('adjust-cart-products')
|
|
202
|
+
if (currentCart && adjustBusinessId) {
|
|
203
|
+
_removeStoreData('adjust-cart-products')
|
|
204
|
+
adjustBusiness(adjustBusinessId)
|
|
174
205
|
}
|
|
175
206
|
}
|
|
176
207
|
|
|
177
208
|
useEffect(() => {
|
|
178
209
|
removeCartByReOrder()
|
|
179
|
-
}, [])
|
|
210
|
+
}, [currentCart])
|
|
180
211
|
|
|
181
212
|
return (
|
|
182
|
-
<
|
|
213
|
+
<ContainerSafeAreaView
|
|
183
214
|
style={{ flex: 1 }}
|
|
215
|
+
isOpenFiltProducts={isOpenFiltProducts}
|
|
184
216
|
>
|
|
185
217
|
<Animated.View style={{ position: 'relative' }}>
|
|
186
|
-
<TopHeader>
|
|
218
|
+
<TopHeader isIos={Platform.OS === 'ios'}>
|
|
187
219
|
{!isOpenSearchBar && (
|
|
188
220
|
<>
|
|
189
221
|
<View style={{ ...styles.headerItem, flex: 1 }}>
|
|
@@ -221,6 +253,47 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
221
253
|
)}
|
|
222
254
|
</TopHeader>
|
|
223
255
|
</Animated.View>
|
|
256
|
+
|
|
257
|
+
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
258
|
+
<FiltProductsContainer
|
|
259
|
+
style={{
|
|
260
|
+
height: Dimensions.get('window').height - filtProductsHeight
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
<View style={{ padding: 20, backgroundColor: theme.colors.white }}>
|
|
264
|
+
<BusinessProductsList
|
|
265
|
+
categories={[
|
|
266
|
+
{ id: null, name: t('ALL', 'All') },
|
|
267
|
+
{ id: 'featured', name: t('FEATURED', 'Featured') },
|
|
268
|
+
...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
|
|
269
|
+
]}
|
|
270
|
+
category={categorySelected}
|
|
271
|
+
categoryState={categoryState}
|
|
272
|
+
businessId={business.id}
|
|
273
|
+
errors={errors}
|
|
274
|
+
onProductClick={onProductClick}
|
|
275
|
+
handleSearchRedirect={handleSearchRedirect}
|
|
276
|
+
featured={featuredProducts}
|
|
277
|
+
searchValue={searchValue}
|
|
278
|
+
handleClearSearch={handleChangeSearch}
|
|
279
|
+
errorQuantityProducts={errorQuantityProducts}
|
|
280
|
+
handleCancelSearch={handleCancel}
|
|
281
|
+
categoriesLayout={categoriesLayout}
|
|
282
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
283
|
+
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
284
|
+
setCategoriesLayout={setCategoriesLayout}
|
|
285
|
+
currentCart={currentCart}
|
|
286
|
+
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
287
|
+
onClickCategory={handleChangeCategory}
|
|
288
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
289
|
+
isFiltMode
|
|
290
|
+
/>
|
|
291
|
+
</View>
|
|
292
|
+
</FiltProductsContainer>
|
|
293
|
+
)}
|
|
294
|
+
{isOpenFiltProducts && (
|
|
295
|
+
<BackgroundGray />
|
|
296
|
+
)}
|
|
224
297
|
<BusinessProductsListingContainer
|
|
225
298
|
stickyHeaderIndices={[2]}
|
|
226
299
|
style={styles.mainContainer}
|
|
@@ -255,7 +328,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
255
328
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
256
329
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
257
330
|
setCategoryClicked={setCategoryClicked}
|
|
258
|
-
|
|
331
|
+
|
|
259
332
|
/>
|
|
260
333
|
)}
|
|
261
334
|
</>
|
|
@@ -288,6 +361,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
288
361
|
setCategoriesLayout={setCategoriesLayout}
|
|
289
362
|
currentCart={currentCart}
|
|
290
363
|
setSubcategoriesSelected={setSubcategoriesSelected}
|
|
364
|
+
onClickCategory={handleChangeCategory}
|
|
365
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
291
366
|
/>
|
|
292
367
|
</WrapContent>
|
|
293
368
|
</>
|
|
@@ -309,6 +384,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
309
384
|
categoryState={categoryState}
|
|
310
385
|
isBusinessLoading={loading}
|
|
311
386
|
errorQuantityProducts={errorQuantityProducts}
|
|
387
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
312
388
|
/>
|
|
313
389
|
</WrapContent>
|
|
314
390
|
</>
|
|
@@ -326,7 +402,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
326
402
|
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
327
403
|
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
328
404
|
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
329
|
-
btnLeftValue={currentCart?.products
|
|
405
|
+
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
330
406
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
331
407
|
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
332
408
|
handleClick={() => setOpenUpselling(true)}
|
|
@@ -347,7 +423,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
347
423
|
onRedirect={onRedirect}
|
|
348
424
|
/>
|
|
349
425
|
)}
|
|
350
|
-
|
|
426
|
+
<Alert
|
|
427
|
+
open={alertState?.open || false}
|
|
428
|
+
title=''
|
|
429
|
+
content={[t('NOT_AVAILABLE_PRODUCTS', 'These products are not available.')]}
|
|
430
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
431
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
432
|
+
/>
|
|
433
|
+
</ContainerSafeAreaView>
|
|
351
434
|
)
|
|
352
435
|
}
|
|
353
436
|
|
|
@@ -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
|
+
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
BusinessReviews as BusinessReviewController,
|
|
4
4
|
useLanguage,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { BusinessReviewsParams } from '../../types';
|
|
23
23
|
import { ProgressBar, TouchableRipple } from 'react-native-paper';
|
|
24
24
|
import moment from 'moment';
|
|
25
|
+
import { setLocalMoment } from '../../utils';
|
|
25
26
|
|
|
26
27
|
const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
27
28
|
const { businessState, reviewsList } = props;
|
|
@@ -99,6 +100,10 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
99
100
|
</View>
|
|
100
101
|
);
|
|
101
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setLocalMoment(moment, t)
|
|
105
|
+
}, [])
|
|
106
|
+
|
|
102
107
|
return (
|
|
103
108
|
<BusinessReviewsContainer>
|
|
104
109
|
<BusinessReviewContent
|
|
@@ -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 }}
|