ordering-ui-react-native 0.16.14 → 0.16.15-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 +7 -4
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +10 -8
- package/src/components/BusinessInformation/index.tsx +22 -0
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/LoginForm/index.tsx +118 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +335 -365
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +143 -61
- package/src/components/SingleProductReview/index.tsx +8 -5
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/index.tsx +2 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/theme.json +0 -1
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/types/index.tsx +13 -9
- package/src/utils/index.tsx +0 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +42 -34
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- package/themes/business/src/components/LoginForm/index.tsx +111 -74
- package/themes/business/src/components/MapView/index.tsx +1 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +65 -21
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
- package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OModal.tsx +40 -37
- package/themes/business/src/types/index.tsx +14 -9
- package/themes/business/src/utils/index.tsx +10 -0
- 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 +2 -1
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- 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/LoginForm/index.tsx +121 -10
- package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +18 -0
- package/themes/original/src/components/AddressForm/index.tsx +136 -133
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +173 -108
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +53 -53
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -181
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +100 -495
- package/themes/original/src/components/Cart/index.tsx +81 -36
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +22 -16
- package/themes/original/src/components/Checkout/index.tsx +106 -66
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- package/themes/original/src/components/DriverTips/index.tsx +4 -4
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -0
- package/themes/original/src/components/Favorite/styles.tsx +1 -0
- package/themes/original/src/components/FavoriteList/index.tsx +143 -94
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GoogleMap/index.tsx +20 -12
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
- package/themes/original/src/components/HelpGuide/index.tsx +8 -3
- package/themes/original/src/components/HelpOrder/index.tsx +8 -3
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
- package/themes/original/src/components/LoginForm/index.tsx +79 -42
- package/themes/original/src/components/Messages/index.tsx +17 -17
- package/themes/original/src/components/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- 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 +304 -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 +262 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +177 -27
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/NavBar/index.tsx +11 -5
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +148 -0
- package/themes/original/src/components/Notifications/styles.tsx +17 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +187 -49
- package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderProgress/index.tsx +8 -2
- package/themes/original/src/components/OrderSummary/index.tsx +1 -34
- package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +126 -37
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
- package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/ProductForm/index.tsx +712 -655
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +170 -128
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +10 -5
- package/themes/original/src/components/ServiceForm/index.tsx +631 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/SignupForm/index.tsx +301 -158
- package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
- package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
- package/themes/original/src/components/UserDetails/index.tsx +32 -18
- package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
- package/themes/original/src/components/UserProfile/index.tsx +57 -29
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +174 -162
- package/themes/original/src/components/Wallets/styles.tsx +10 -8
- package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
- package/themes/original/src/components/shared/OButton.tsx +10 -3
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +164 -46
- package/themes/original/src/utils/index.tsx +77 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,44 +1,56 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
useLanguage,
|
|
4
4
|
useConfig,
|
|
5
5
|
useOrder,
|
|
6
6
|
useUtils,
|
|
7
|
+
useSession,
|
|
8
|
+
ToastType,
|
|
9
|
+
useToast,
|
|
7
10
|
SingleProductCard as SingleProductCardController
|
|
8
11
|
} from 'ordering-components/native';
|
|
9
12
|
import { useTheme } from 'styled-components/native';
|
|
10
13
|
import { SingleProductCardParams } from '../../types';
|
|
11
14
|
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
|
|
12
|
-
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
13
|
-
import {
|
|
15
|
+
import { StyleSheet, View, TouchableOpacity, Image, Animated } from 'react-native';
|
|
16
|
+
import { InView } from 'react-native-intersection-observer'
|
|
17
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
18
|
+
import { OButton, OIcon, OText } from '../shared';
|
|
14
19
|
import FastImage from 'react-native-fast-image'
|
|
15
20
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
16
21
|
import { shape } from '../../utils';
|
|
17
22
|
|
|
18
|
-
function SingleProductCardPropsAreEqual(prevProps
|
|
19
|
-
return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
function SingleProductCardPropsAreEqual(prevProps: any, nextProps: any) {
|
|
24
|
+
return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
|
|
25
|
+
prevProps.isSoldOut === nextProps.isSoldOut &&
|
|
26
|
+
prevProps.productAddedToCartLength === nextProps.productAddedToCartLength &&
|
|
27
|
+
prevProps.categoryState === nextProps.categoryState
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
const
|
|
30
|
+
const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
25
31
|
const {
|
|
26
32
|
product,
|
|
27
33
|
isSoldOut,
|
|
28
34
|
onProductClick,
|
|
29
35
|
productAddedToCartLength,
|
|
30
36
|
style,
|
|
31
|
-
handleFavoriteProduct
|
|
37
|
+
handleFavoriteProduct,
|
|
38
|
+
enableIntersection,
|
|
39
|
+
navigation,
|
|
40
|
+
businessId,
|
|
41
|
+
isPreviously
|
|
32
42
|
} = props;
|
|
33
43
|
|
|
34
44
|
const theme = useTheme();
|
|
45
|
+
const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
|
|
35
46
|
|
|
36
47
|
const styles = StyleSheet.create({
|
|
37
48
|
container: {
|
|
38
49
|
borderWidth: 1,
|
|
39
50
|
borderRadius: 7.6,
|
|
40
51
|
borderColor: theme.colors.border,
|
|
41
|
-
marginBottom:
|
|
52
|
+
marginBottom: 25,
|
|
53
|
+
minHeight: hideAddButton ? 100 : 165
|
|
42
54
|
},
|
|
43
55
|
titleWrapper: {
|
|
44
56
|
flexDirection: 'row',
|
|
@@ -64,8 +76,8 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
|
|
|
64
76
|
},
|
|
65
77
|
quantityContainer: {
|
|
66
78
|
position: 'absolute',
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
right: 0,
|
|
80
|
+
top: 0,
|
|
69
81
|
width: 25,
|
|
70
82
|
height: 25,
|
|
71
83
|
textAlign: 'center',
|
|
@@ -81,11 +93,13 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
|
|
|
81
93
|
}
|
|
82
94
|
});
|
|
83
95
|
|
|
84
|
-
|
|
85
96
|
const [, t] = useLanguage();
|
|
86
97
|
const [stateConfig] = useConfig();
|
|
87
|
-
const [{
|
|
88
|
-
const [
|
|
98
|
+
const [{ auth }] = useSession()
|
|
99
|
+
const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
|
|
100
|
+
const [orderState] = useOrder()
|
|
101
|
+
const [, { showToast }] = useToast()
|
|
102
|
+
const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
|
|
89
103
|
|
|
90
104
|
const editMode = typeof product?.code !== 'undefined';
|
|
91
105
|
|
|
@@ -112,110 +126,184 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
|
|
|
112
126
|
);
|
|
113
127
|
|
|
114
128
|
const handleChangeFavorite = () => {
|
|
115
|
-
|
|
129
|
+
if (auth) {
|
|
130
|
+
handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
|
|
131
|
+
} else {
|
|
132
|
+
navigation && navigation.navigate('Login');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const handleChangeIntersection = () => {
|
|
137
|
+
if (enableIntersection) {
|
|
138
|
+
setIsIntersectionObserver(true);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const handleClickproduct = () => {
|
|
143
|
+
if (productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order) {
|
|
144
|
+
showToast(ToastType.Error, t('PRODUCT_ON_MAXIMUM_ORDER', 'The product is on maximum order'))
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
onProductClick?.(product)
|
|
116
148
|
}
|
|
117
149
|
|
|
118
150
|
return (
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
<InView style={{ minHeight: hideAddButton ? 125 : 190 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
|
|
152
|
+
{isIntersectionObserver ? (
|
|
153
|
+
<CardContainer
|
|
154
|
+
showAddButton={!hideAddButton}
|
|
155
|
+
style={[
|
|
156
|
+
styles.container,
|
|
157
|
+
(isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
|
|
158
|
+
(style && { ...style }),
|
|
159
|
+
]}
|
|
160
|
+
onPress={() => handleClickproduct()}
|
|
161
|
+
>
|
|
162
|
+
<View style={{ flexDirection: 'row' }}>
|
|
163
|
+
{productAddedToCartLength > 0 && (
|
|
164
|
+
<QuantityContainer style={[styles.quantityContainer, {
|
|
165
|
+
transform: [{ translateX: 25 }, { translateY: hideAddButton ? -25 : -55 }],
|
|
166
|
+
}]}>
|
|
167
|
+
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
168
|
+
</QuantityContainer>
|
|
169
|
+
)}
|
|
170
|
+
<CardInfo>
|
|
171
|
+
<View style={styles.titleWrapper}>
|
|
172
|
+
<OText
|
|
173
|
+
size={12}
|
|
174
|
+
weight={'500'}
|
|
175
|
+
numberOfLines={1}
|
|
176
|
+
ellipsizeMode="tail"
|
|
177
|
+
style={{ ...styles.line18, flex: 1 }}>
|
|
178
|
+
{product?.name}
|
|
179
|
+
</OText>
|
|
180
|
+
{!isPreviously && (
|
|
181
|
+
<TouchableOpacity
|
|
182
|
+
onPress={handleChangeFavorite}
|
|
183
|
+
>
|
|
184
|
+
<IconAntDesign
|
|
185
|
+
name={product?.favorite ? 'heart' : 'hearto'}
|
|
186
|
+
color={theme.colors.danger5}
|
|
187
|
+
size={18}
|
|
188
|
+
/>
|
|
189
|
+
</TouchableOpacity>
|
|
190
|
+
)}
|
|
191
|
+
</View>
|
|
192
|
+
<PricesContainer>
|
|
193
|
+
{!!product?.price && (
|
|
194
|
+
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
195
|
+
)}
|
|
196
|
+
{product?.offer_price !== null && !!product?.in_offer && (
|
|
197
|
+
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
198
|
+
)}
|
|
199
|
+
</PricesContainer>
|
|
200
|
+
<OText
|
|
201
|
+
size={10}
|
|
202
|
+
numberOfLines={!isPreviously ? 2 : 1}
|
|
203
|
+
ellipsizeMode="tail"
|
|
204
|
+
color={theme.colors.textSecondary}
|
|
205
|
+
style={styles.line15}>
|
|
206
|
+
{product?.description}
|
|
207
|
+
</OText>
|
|
208
|
+
{isPreviously && (
|
|
209
|
+
<OText
|
|
210
|
+
size={10}
|
|
211
|
+
numberOfLines={1}
|
|
212
|
+
ellipsizeMode="tail"
|
|
213
|
+
color={theme.colors.primary}
|
|
214
|
+
style={styles.line15}>
|
|
215
|
+
{t('LAST_ORDERED_ON', 'Last ordered on')} {parseDate(product?.last_ordered_date, { outputFormat: 'MMM DD, YYYY' })}
|
|
216
|
+
</OText>
|
|
217
|
+
)}
|
|
218
|
+
</CardInfo>
|
|
219
|
+
<LogoWrapper>
|
|
220
|
+
{!!product?.ribbon?.enabled && (
|
|
221
|
+
<RibbonBox
|
|
222
|
+
bgColor={product?.ribbon?.color}
|
|
223
|
+
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
224
|
+
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
225
|
+
>
|
|
226
|
+
<OText
|
|
227
|
+
size={10}
|
|
228
|
+
weight={'400'}
|
|
229
|
+
color={theme.colors.white}
|
|
230
|
+
numberOfLines={2}
|
|
231
|
+
ellipsizeMode='tail'
|
|
232
|
+
lineHeight={13}
|
|
233
|
+
>
|
|
234
|
+
{product?.ribbon?.text}
|
|
235
|
+
</OText>
|
|
236
|
+
</RibbonBox>
|
|
237
|
+
)}
|
|
238
|
+
{product?.images ? (
|
|
239
|
+
<FastImage
|
|
240
|
+
style={styles.productStyle}
|
|
241
|
+
source={{
|
|
242
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
243
|
+
priority: FastImage.priority.normal,
|
|
244
|
+
}}
|
|
245
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
246
|
+
/>
|
|
247
|
+
) : (
|
|
248
|
+
<OIcon
|
|
249
|
+
src={theme?.images?.dummies?.product}
|
|
250
|
+
style={styles.productStyle}
|
|
251
|
+
/>
|
|
252
|
+
)}
|
|
253
|
+
</LogoWrapper>
|
|
254
|
+
|
|
255
|
+
{(isSoldOut || maxProductQuantity <= 0) && (
|
|
256
|
+
<SoldOut>
|
|
257
|
+
<OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
|
|
258
|
+
{t('SOLD_OUT', 'SOLD OUT')}
|
|
259
|
+
</OText>
|
|
260
|
+
</SoldOut>
|
|
261
|
+
)}
|
|
262
|
+
</View>
|
|
263
|
+
{!hideAddButton && (
|
|
264
|
+
<OButton
|
|
265
|
+
onClick={() => handleClickproduct()}
|
|
266
|
+
style={{
|
|
267
|
+
width: '100%',
|
|
268
|
+
borderRadius: 7.6,
|
|
269
|
+
marginTop: 10,
|
|
270
|
+
|
|
271
|
+
}}
|
|
272
|
+
bgColor={isSoldOut ? '#B8B8B8' : theme?.colors?.white}
|
|
273
|
+
borderColor={theme?.colors.primary}
|
|
274
|
+
textStyle={{ color: theme.colors.primary }}
|
|
275
|
+
text={t('ADD', 'Add')}
|
|
150
276
|
/>
|
|
151
|
-
</TouchableOpacity>
|
|
152
|
-
</View>
|
|
153
|
-
<PricesContainer>
|
|
154
|
-
<OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
|
|
155
|
-
{product?.offer_price !== null && product?.in_offer && (
|
|
156
|
-
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
157
277
|
)}
|
|
158
|
-
</
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
color={theme.colors.white}
|
|
179
|
-
numberOfLines={2}
|
|
180
|
-
ellipsizeMode='tail'
|
|
181
|
-
lineHeight={13}
|
|
182
|
-
>
|
|
183
|
-
{product?.ribbon?.text}
|
|
184
|
-
</OText>
|
|
185
|
-
</RibbonBox>
|
|
186
|
-
)}
|
|
187
|
-
{product?.images ? (
|
|
188
|
-
<FastImage
|
|
189
|
-
style={styles.productStyle}
|
|
190
|
-
source={{
|
|
191
|
-
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
192
|
-
priority: FastImage.priority.normal,
|
|
193
|
-
}}
|
|
194
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
195
|
-
/>
|
|
196
|
-
) : (
|
|
197
|
-
<OIcon
|
|
198
|
-
src={theme?.images?.dummies?.product}
|
|
199
|
-
style={styles.productStyle}
|
|
200
|
-
/>
|
|
201
|
-
)}
|
|
202
|
-
</LogoWrapper>
|
|
203
|
-
|
|
204
|
-
{(isSoldOut || maxProductQuantity <= 0) && (
|
|
205
|
-
<SoldOut>
|
|
206
|
-
<OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
|
|
207
|
-
{t('SOLD_OUT', 'SOLD OUT')}
|
|
208
|
-
</OText>
|
|
209
|
-
</SoldOut>
|
|
278
|
+
</CardContainer>
|
|
279
|
+
) : (
|
|
280
|
+
<View style={{ marginBottom: 28, padding: 12, height: hideAddButton ? 125 : 165 }}>
|
|
281
|
+
<Placeholder style={{ padding: 5 }} Animation={Fade}>
|
|
282
|
+
<View style={{ flexDirection: 'row' }}>
|
|
283
|
+
<Placeholder style={{ paddingVertical: 10, flex: 1 }}>
|
|
284
|
+
<PlaceholderLine width={60} style={{ marginBottom: 15 }} />
|
|
285
|
+
<PlaceholderLine width={20} />
|
|
286
|
+
</Placeholder>
|
|
287
|
+
<PlaceholderLine
|
|
288
|
+
width={24}
|
|
289
|
+
height={70}
|
|
290
|
+
style={{ marginLeft: 10, marginBottom: 10 }}
|
|
291
|
+
/>
|
|
292
|
+
</View>
|
|
293
|
+
<PlaceholderLine
|
|
294
|
+
height={52}
|
|
295
|
+
/>
|
|
296
|
+
</Placeholder>
|
|
297
|
+
</View>
|
|
210
298
|
)}
|
|
211
|
-
</
|
|
299
|
+
</InView>
|
|
212
300
|
);
|
|
213
|
-
}
|
|
301
|
+
}, SingleProductCardPropsAreEqual);
|
|
214
302
|
|
|
215
|
-
export const SingleProductCard =
|
|
303
|
+
export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
216
304
|
const singleProductCardProps = {
|
|
217
305
|
...props,
|
|
218
|
-
UIComponent:
|
|
306
|
+
UIComponent: SingleProductCardUI
|
|
219
307
|
}
|
|
220
308
|
return <SingleProductCardController {...singleProductCardProps} />
|
|
221
|
-
}
|
|
309
|
+
}
|
|
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components/native'
|
|
|
2
2
|
|
|
3
3
|
export const CardContainer = styled.TouchableOpacity`
|
|
4
4
|
flex: 1;
|
|
5
|
-
flex-direction: row;
|
|
5
|
+
flex-direction: ${(props : any) => props.showAddButton ? 'column' : 'row'};
|
|
6
6
|
justify-content: space-between;
|
|
7
7
|
align-items: center;
|
|
8
8
|
padding: 12px;
|
|
@@ -23,7 +23,7 @@ export const SoldOut = styled.View`
|
|
|
23
23
|
`
|
|
24
24
|
|
|
25
25
|
export const QuantityContainer = styled.View`
|
|
26
|
-
background: ${({ theme }
|
|
26
|
+
background: ${({ theme }: any) => theme.colors.primary};
|
|
27
27
|
align-items: center;
|
|
28
28
|
justify-content: center;
|
|
29
29
|
`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { useLanguage } from 'ordering-components/native'
|
|
3
|
-
import { OText, OButton, OInput } from '../shared'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
3
|
+
import { OText, OButton, OInput, OIcon } from '../shared'
|
|
4
4
|
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
5
5
|
import AntDesignIcons from 'react-native-vector-icons/AntDesign'
|
|
6
6
|
import { useTheme } from 'styled-components/native'
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
LikeHandsActionContainer,
|
|
15
15
|
LikeHandsButton,
|
|
16
16
|
CommentsButtonGroup,
|
|
17
|
+
LogoWrapper,
|
|
17
18
|
} from './styles'
|
|
19
|
+
import FastImage from 'react-native-fast-image'
|
|
18
20
|
|
|
19
21
|
export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
20
22
|
const {
|
|
@@ -25,6 +27,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
25
27
|
|
|
26
28
|
const [, t] = useLanguage()
|
|
27
29
|
const theme = useTheme()
|
|
30
|
+
const [{ optimizeImage }] = useUtils()
|
|
28
31
|
|
|
29
32
|
const styles = StyleSheet.create({
|
|
30
33
|
inputTextArea: {
|
|
@@ -40,6 +43,12 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
40
43
|
justifyContent: 'center',
|
|
41
44
|
marginVertical: 10,
|
|
42
45
|
},
|
|
46
|
+
productStyle: {
|
|
47
|
+
width: 80,
|
|
48
|
+
height: 80,
|
|
49
|
+
marginLeft: 'auto',
|
|
50
|
+
marginRight: 'auto'
|
|
51
|
+
}
|
|
43
52
|
})
|
|
44
53
|
|
|
45
54
|
const [comments, setComments] = useState<Array<any>>([])
|
|
@@ -100,6 +109,24 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
100
109
|
return (
|
|
101
110
|
<>
|
|
102
111
|
<ProductContainer>
|
|
112
|
+
<LogoWrapper>
|
|
113
|
+
{product?.images ? (
|
|
114
|
+
<FastImage
|
|
115
|
+
style={styles.productStyle}
|
|
116
|
+
source={{
|
|
117
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
118
|
+
priority: FastImage.priority.normal,
|
|
119
|
+
}}
|
|
120
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
121
|
+
/>
|
|
122
|
+
) : (
|
|
123
|
+
<OIcon
|
|
124
|
+
src={theme?.images?.dummies?.product}
|
|
125
|
+
width={80}
|
|
126
|
+
height={80}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</LogoWrapper>
|
|
103
130
|
<ProductHeader>
|
|
104
131
|
<OText numberOfLines={1} style={{ flex: 1 }} color={theme.colors.textNormal}>{product?.name}</OText>
|
|
105
132
|
<LikeHandsActionContainer>
|
|
@@ -129,7 +156,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
129
156
|
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
130
157
|
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
131
158
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
132
|
-
onClick={() => handleChangeComment(commentItem)
|
|
159
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
133
160
|
/>
|
|
134
161
|
))}
|
|
135
162
|
</CommentsButtonGroup>
|
|
@@ -15,6 +15,18 @@ export const LikeHandsActionContainer = styled.View`
|
|
|
15
15
|
flex-direction: row;
|
|
16
16
|
`
|
|
17
17
|
|
|
18
|
+
export const LogoWrapper = styled.View`
|
|
19
|
+
shadowRadius: 3;
|
|
20
|
+
shadowOffset: { width: 1, height: 4 };
|
|
21
|
+
elevation: 3;
|
|
22
|
+
borderRadius: 8;
|
|
23
|
+
shadowOpacity: 0.1;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
width: 80;
|
|
26
|
+
marginLeft: auto;
|
|
27
|
+
marginRight: auto;
|
|
28
|
+
`
|
|
29
|
+
|
|
18
30
|
export const LikeHandsButton = styled.TouchableOpacity`
|
|
19
31
|
${(props: any) => props.isLike && css`
|
|
20
32
|
margin-horizontal: 15px;
|
|
@@ -27,7 +27,8 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
27
27
|
paymethod,
|
|
28
28
|
onCancel,
|
|
29
29
|
cart,
|
|
30
|
-
merchantId
|
|
30
|
+
merchantId,
|
|
31
|
+
businessIds
|
|
31
32
|
} = props;
|
|
32
33
|
|
|
33
34
|
const theme = useTheme();
|
|
@@ -60,17 +61,25 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
if (user?.address) {
|
|
63
|
-
billingDetails.
|
|
64
|
+
billingDetails.address = {
|
|
65
|
+
line1: user?.address
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
const createPayMethod = async () => {
|
|
67
|
-
const params: any = {
|
|
70
|
+
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
68
71
|
if (Object.keys(billingDetails).length > 0) {
|
|
69
|
-
params.billingDetails = billingDetails
|
|
72
|
+
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
70
73
|
}
|
|
71
74
|
try {
|
|
72
75
|
setCreatePmLoading(true)
|
|
73
|
-
const { paymentMethod } = await createPaymentMethod(params);
|
|
76
|
+
const { paymentMethod, error } = await createPaymentMethod(params);
|
|
77
|
+
|
|
78
|
+
if (error) {
|
|
79
|
+
setErrors(error?.message);
|
|
80
|
+
setCreatePmLoading(false)
|
|
81
|
+
return
|
|
82
|
+
}
|
|
74
83
|
|
|
75
84
|
setCreatePmLoading(false)
|
|
76
85
|
handleSource && handleSource({
|
|
@@ -93,22 +102,29 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
93
102
|
setErrors(error?.message || error?.toString());
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
|
-
|
|
105
|
+
|
|
97
106
|
const handleSaveCard = async () => {
|
|
98
107
|
setErrors('');
|
|
99
108
|
if (!requirements) {
|
|
100
109
|
createPayMethod();
|
|
101
110
|
return
|
|
102
111
|
}
|
|
103
|
-
const params: any = {
|
|
112
|
+
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
104
113
|
if (Object.keys(billingDetails).length > 0) {
|
|
105
|
-
params.billingDetails = billingDetails
|
|
114
|
+
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
106
115
|
}
|
|
107
116
|
try {
|
|
108
117
|
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|
|
109
118
|
|
|
110
119
|
if (setupIntent?.status === 'Succeeded') {
|
|
111
|
-
|
|
120
|
+
if (businessIds) {
|
|
121
|
+
businessIds.forEach((_businessId: any, index: any) => {
|
|
122
|
+
const _isNewCard = index === 0
|
|
123
|
+
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId, _isNewCard);
|
|
124
|
+
})
|
|
125
|
+
} else {
|
|
126
|
+
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
|
|
127
|
+
}
|
|
112
128
|
}
|
|
113
129
|
|
|
114
130
|
if (error) {
|
|
@@ -40,7 +40,7 @@ export const StripeElementsForm = (props: any) => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const stripeTokenHandler = async (tokenId: string, user: any, businessId: string) => {
|
|
43
|
+
const stripeTokenHandler = async (tokenId: string, user: any, businessId: string, isNewCard: any = true) => {
|
|
44
44
|
try {
|
|
45
45
|
setState({
|
|
46
46
|
...state,
|
|
@@ -60,7 +60,7 @@ export const StripeElementsForm = (props: any) => {
|
|
|
60
60
|
})
|
|
61
61
|
})
|
|
62
62
|
const response = await result.json();
|
|
63
|
-
props.onSelectCard && props.onSelectCard(response.result);
|
|
63
|
+
isNewCard && props.onSelectCard && props.onSelectCard(response.result);
|
|
64
64
|
setState({
|
|
65
65
|
...state,
|
|
66
66
|
loadingAdd: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { Platform, StyleSheet, View } from 'react-native'
|
|
2
|
+
import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
UpsellingPage as UpsellingPageController,
|
|
5
5
|
useUtils,
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
import { OrderSummary } from '../OrderSummary';
|
|
22
22
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
23
23
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
24
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
24
25
|
|
|
25
26
|
const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
26
27
|
const {
|
|
@@ -71,9 +72,15 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
71
72
|
},
|
|
72
73
|
btnBackArrow: {
|
|
73
74
|
borderWidth: 0,
|
|
75
|
+
width: 26,
|
|
76
|
+
height: 26,
|
|
74
77
|
backgroundColor: theme.colors.clear,
|
|
78
|
+
borderColor: theme.colors.clear,
|
|
75
79
|
shadowColor: theme.colors.clear,
|
|
76
|
-
|
|
80
|
+
paddingLeft: 0,
|
|
81
|
+
paddingRight: 0,
|
|
82
|
+
marginLeft: 20,
|
|
83
|
+
marginBottom: 10
|
|
77
84
|
},
|
|
78
85
|
})
|
|
79
86
|
|
|
@@ -161,11 +168,14 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
161
168
|
<>
|
|
162
169
|
<View style={{ ...styles.headerItem, flex: 1, marginTop: Platform.OS == 'ios' ? 35 : 70 }}>
|
|
163
170
|
<OButton
|
|
164
|
-
imgLeftSrc={theme.images.general.arrow_left}
|
|
165
171
|
imgRightSrc={null}
|
|
166
172
|
style={styles.btnBackArrow}
|
|
167
173
|
onClick={() => onGoBack()}
|
|
168
|
-
|
|
174
|
+
icon={AntDesignIcon}
|
|
175
|
+
iconProps={{
|
|
176
|
+
name: 'arrowleft',
|
|
177
|
+
size: 26
|
|
178
|
+
}}
|
|
169
179
|
/>
|
|
170
180
|
</View>
|
|
171
181
|
<ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|