ordering-ui-react-native 0.16.71 → 0.16.72-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 +6 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +19 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- 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/Messages/index.tsx +2 -2
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +298 -345
- package/src/components/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/utils/index.tsx +2 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +31 -31
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/LoginForm/index.tsx +111 -74
- package/themes/business/src/components/MapView/index.tsx +14 -3
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
- package/themes/business/src/components/OrdersOption/index.tsx +63 -73
- 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/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
- 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/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +14 -3
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- 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/ProductForm/index.tsx +1 -14
- 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 +6 -0
- package/themes/original/src/components/AddressDetails/index.tsx +10 -8
- package/themes/original/src/components/AddressForm/index.tsx +153 -137
- package/themes/original/src/components/AddressList/index.tsx +18 -18
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +47 -22
- package/themes/original/src/components/BusinessController/index.tsx +101 -70
- package/themes/original/src/components/BusinessController/styles.tsx +14 -9
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
- 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 +87 -142
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
- 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 +41 -62
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +560 -496
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +83 -92
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +7 -6
- package/themes/original/src/components/Cart/index.tsx +75 -42
- package/themes/original/src/components/CartContent/index.tsx +80 -18
- package/themes/original/src/components/CartContent/styles.tsx +11 -1
- package/themes/original/src/components/Checkout/index.tsx +92 -105
- package/themes/original/src/components/Checkout/styles.tsx +4 -3
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/DriverTips/index.tsx +47 -37
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +7 -4
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +70 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +10 -1
- package/themes/original/src/components/Help/index.tsx +7 -7
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +12 -11
- package/themes/original/src/components/HelpGuide/styles.tsx +5 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -20
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +98 -41
- package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
- package/themes/original/src/components/MessageListing/index.tsx +7 -40
- package/themes/original/src/components/Messages/index.tsx +35 -20
- package/themes/original/src/components/MomentOption/index.tsx +17 -11
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
- package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +86 -20
- package/themes/original/src/components/NavBar/index.tsx +7 -6
- 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 +144 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/index.tsx +100 -215
- package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
- package/themes/original/src/components/OrderProgress/index.tsx +79 -100
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +97 -88
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +22 -8
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +212 -253
- package/themes/original/src/components/ProductForm/styles.tsx +5 -8
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +17 -9
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
- package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
- package/themes/original/src/components/Promotions/index.tsx +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +7 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +328 -264
- package/themes/original/src/components/SignupForm/index.tsx +134 -89
- package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +84 -80
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +5 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +19 -28
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- 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 +176 -164
- package/themes/original/src/components/Wallets/styles.tsx +12 -8
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
- package/themes/original/src/components/shared/OButton.tsx +9 -4
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +35 -5
- package/themes/original/src/utils/index.tsx +305 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,242 +1,271 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
UpsellingPage as UpsellingPageController,
|
|
5
|
+
useUtils,
|
|
6
|
+
useLanguage,
|
|
7
|
+
useOrder,
|
|
8
|
+
useConfig
|
|
8
9
|
} from 'ordering-components/native'
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
10
11
|
import { OText, OIcon, OBottomPopup, OButton } from '../shared'
|
|
11
12
|
import { UpsellingProductsParams } from '../../types'
|
|
12
13
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
Container,
|
|
15
|
+
UpsellingContainer,
|
|
16
|
+
Item,
|
|
17
|
+
Details,
|
|
18
|
+
AddButton,
|
|
19
|
+
CartList,
|
|
20
|
+
CartDivider
|
|
20
21
|
} from './styles'
|
|
21
22
|
import { OrderSummary } from '../OrderSummary';
|
|
23
|
+
import { Cart } from '../Cart';
|
|
22
24
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
23
25
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
24
26
|
|
|
25
27
|
const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
const {
|
|
29
|
+
isCustomMode,
|
|
30
|
+
upsellingProducts,
|
|
31
|
+
business,
|
|
32
|
+
handleUpsellingPage,
|
|
33
|
+
handleCloseUpsellingPage,
|
|
34
|
+
openUpselling,
|
|
35
|
+
canOpenUpselling,
|
|
36
|
+
setCanOpenUpselling,
|
|
37
|
+
isFromCart,
|
|
38
|
+
onNavigationRedirect,
|
|
39
|
+
onGoBack
|
|
40
|
+
} = props
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
const theme = useTheme();
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
44
|
+
const styles = StyleSheet.create({
|
|
45
|
+
imageStyle: {
|
|
46
|
+
width: 73,
|
|
47
|
+
height: 73,
|
|
48
|
+
resizeMode: 'cover',
|
|
49
|
+
borderRadius: 7.6,
|
|
50
|
+
},
|
|
51
|
+
closeUpsellingButton: {
|
|
52
|
+
borderRadius: 7.6,
|
|
53
|
+
borderColor: theme.colors.primary,
|
|
54
|
+
backgroundColor: theme.colors.primary,
|
|
55
|
+
borderWidth: 1,
|
|
56
|
+
alignSelf: 'center',
|
|
57
|
+
height: 44,
|
|
58
|
+
shadowOpacity: 0,
|
|
59
|
+
width: '80%',
|
|
60
|
+
},
|
|
61
|
+
cancelBtn: {
|
|
62
|
+
paddingHorizontal: 18,
|
|
63
|
+
borderWidth: 1,
|
|
64
|
+
borderRadius: 7.6,
|
|
65
|
+
borderColor: theme.colors.textSecondary,
|
|
66
|
+
height: 38
|
|
67
|
+
},
|
|
68
|
+
headerItem: {
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
marginVertical: 2,
|
|
72
|
+
marginHorizontal: 20,
|
|
73
|
+
},
|
|
74
|
+
btnBackArrow: {
|
|
75
|
+
borderWidth: 0,
|
|
76
|
+
width: 26,
|
|
77
|
+
height: 26,
|
|
78
|
+
backgroundColor: theme.colors.clear,
|
|
79
|
+
borderColor: theme.colors.clear,
|
|
80
|
+
shadowColor: theme.colors.clear,
|
|
81
|
+
paddingLeft: 0,
|
|
82
|
+
paddingRight: 0,
|
|
83
|
+
marginLeft: 20,
|
|
84
|
+
marginBottom: 10
|
|
85
|
+
},
|
|
86
|
+
})
|
|
79
87
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
const [modalIsOpen, setModalIsOpen] = useState(false)
|
|
89
|
+
const [{ carts }] = useOrder()
|
|
90
|
+
const [{ parsePrice }] = useUtils()
|
|
91
|
+
const [{ configs }] = useConfig()
|
|
92
|
+
const [, t] = useLanguage()
|
|
93
|
+
const { bottom } = useSafeAreaInsets()
|
|
94
|
+
const [isCheckout, setIsCheckout] = useState(false)
|
|
95
|
+
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
98
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
99
|
+
const showCartList = isChewLayout
|
|
100
|
+
const commentDelayTime = isChewLayout ? 500 : null
|
|
91
101
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
const cart = carts?.[`businessId:${props.businessId}`] ?? {}
|
|
103
|
+
const cartList = (carts && Object.values(carts).filter((_cart: any) => _cart?.products?.length > 0 && _cart.uuid !== cart?.uuid)) || []
|
|
104
|
+
const cartProducts = cart?.products?.length
|
|
105
|
+
? cart?.products.map((product: any) => product.id)
|
|
106
|
+
: []
|
|
97
107
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
} else {
|
|
104
|
-
handleUpsellingPage && handleUpsellingPage()
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}, [upsellingProducts.loading, upsellingProducts?.products.length])
|
|
108
|
+
const productsList = !upsellingProducts.loading && !upsellingProducts.error
|
|
109
|
+
? upsellingProducts?.products?.length
|
|
110
|
+
? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
|
|
111
|
+
: (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
|
|
112
|
+
: []
|
|
109
113
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!isCustomMode && !props.products) {
|
|
116
|
+
if (!upsellingProducts.loading) {
|
|
117
|
+
if (upsellingProducts?.products?.length && !isFromCart) {
|
|
118
|
+
setCanOpenUpselling && setCanOpenUpselling(true)
|
|
119
|
+
} else {
|
|
120
|
+
handleUpsellingPage && handleUpsellingPage()
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, [upsellingProducts.loading, upsellingProducts?.products.length])
|
|
117
125
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
>
|
|
126
|
-
{
|
|
127
|
-
!upsellingProducts.loading && (
|
|
128
|
-
<>
|
|
129
|
-
{
|
|
130
|
-
!upsellingProducts.error ? productsList.map((product: any, i: number) => (
|
|
131
|
-
<Item key={`${product.id}_${i}`}>
|
|
132
|
-
<View style={{ flexBasis: '57%' }}>
|
|
133
|
-
<Details>
|
|
134
|
-
<OText size={12} lineHeight={18} numberOfLines={1} ellipsizeMode='tail'>{product.name}</OText>
|
|
135
|
-
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>{parsePrice(product.price)}</OText>
|
|
136
|
-
</Details>
|
|
137
|
-
<AddButton onPress={() => handleFormProduct(product)}>
|
|
138
|
-
<OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
|
|
139
|
-
</AddButton>
|
|
140
|
-
</View>
|
|
141
|
-
<View>
|
|
142
|
-
<OIcon url={product.images} style={styles.imageStyle} />
|
|
143
|
-
</View>
|
|
144
|
-
</Item>
|
|
145
|
-
)) : (
|
|
146
|
-
<OText>
|
|
147
|
-
{upsellingProducts.message}
|
|
148
|
-
</OText>
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
</>
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
</UpsellingContainer>
|
|
155
|
-
</Container>
|
|
156
|
-
)
|
|
157
|
-
}
|
|
126
|
+
const handleFormProduct = (product: any) => {
|
|
127
|
+
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
128
|
+
product: product,
|
|
129
|
+
businessId: product?.api?.businessId,
|
|
130
|
+
businessSlug: business.slug,
|
|
131
|
+
})
|
|
132
|
+
}
|
|
158
133
|
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
handleUpsellingPage()
|
|
200
|
-
setIsCheckout(true)
|
|
201
|
-
}}
|
|
202
|
-
/>
|
|
203
|
-
</View>
|
|
204
|
-
</>
|
|
205
|
-
)
|
|
206
|
-
}
|
|
134
|
+
const UpsellingLayout = () => {
|
|
135
|
+
return (
|
|
136
|
+
<Container>
|
|
137
|
+
<UpsellingContainer
|
|
138
|
+
horizontal
|
|
139
|
+
showsHorizontalScrollIndicator={false}
|
|
140
|
+
contentContainerStyle={{ paddingHorizontal: Platform.OS === 'ios' ? 40 : 0 }}
|
|
141
|
+
>
|
|
142
|
+
{
|
|
143
|
+
!upsellingProducts.loading && (
|
|
144
|
+
<>
|
|
145
|
+
{
|
|
146
|
+
!upsellingProducts.error ? productsList.map((product: any, i: number) => (
|
|
147
|
+
<Item key={`${product.id}_${i}`}>
|
|
148
|
+
<View style={{ flexBasis: '57%' }}>
|
|
149
|
+
<Details>
|
|
150
|
+
<OText size={12} lineHeight={18} numberOfLines={1} ellipsizeMode='tail'>{product.name}</OText>
|
|
151
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>{parsePrice(product.price)}</OText>
|
|
152
|
+
</Details>
|
|
153
|
+
<AddButton onPress={() => handleFormProduct(product)}>
|
|
154
|
+
<OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
|
|
155
|
+
</AddButton>
|
|
156
|
+
</View>
|
|
157
|
+
<View>
|
|
158
|
+
<OIcon url={product?.images || theme?.images?.dummies?.product} style={styles.imageStyle} />
|
|
159
|
+
</View>
|
|
160
|
+
</Item>
|
|
161
|
+
)) : (
|
|
162
|
+
<OText>
|
|
163
|
+
{upsellingProducts.message}
|
|
164
|
+
</OText>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
</>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
</UpsellingContainer>
|
|
171
|
+
</Container>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
207
174
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
175
|
+
const UpsellingContent = () => {
|
|
176
|
+
return (
|
|
177
|
+
<>
|
|
178
|
+
<View style={{ ...styles.headerItem, flex: 1, marginTop: Platform.OS == 'ios' ? 35 : 14 }}>
|
|
179
|
+
<TouchableOpacity onPress={() => onGoBack()} style={styles.btnBackArrow}>
|
|
180
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
181
|
+
</TouchableOpacity>
|
|
182
|
+
</View>
|
|
183
|
+
<ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|
|
184
|
+
{productsList.length > 0 &&
|
|
185
|
+
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
186
|
+
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
187
|
+
<UpsellingLayout />
|
|
188
|
+
</View>
|
|
189
|
+
}
|
|
190
|
+
<View style={{ paddingHorizontal: 40 }}>
|
|
191
|
+
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
192
|
+
<OrderSummary
|
|
193
|
+
cart={cart}
|
|
194
|
+
commentDelayTime={commentDelayTime}
|
|
195
|
+
isCartPending={cart?.status === 2}
|
|
196
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
197
|
+
/>
|
|
198
|
+
</View>
|
|
199
|
+
{showCartList && cartList.map((cart: any, i: number) => (
|
|
200
|
+
<CartList key={i}>
|
|
201
|
+
<Cart
|
|
202
|
+
cart={cart}
|
|
203
|
+
cartuuid={cart.uuid}
|
|
204
|
+
hideUpselling
|
|
205
|
+
singleBusiness={props.singleBusiness}
|
|
206
|
+
isFranchiseApp={props.isFranchiseApp}
|
|
207
|
+
isCartsLoading={isCartsLoading}
|
|
208
|
+
setIsCartsLoading={setIsCartsLoading}
|
|
209
|
+
isMultiCheckout={isMultiCheckout}
|
|
210
|
+
onNavigationRedirect={props.onNavigationRedirect}
|
|
211
|
+
/>
|
|
212
|
+
<CartDivider />
|
|
213
|
+
</CartList>
|
|
214
|
+
))}
|
|
215
|
+
</ScrollView>
|
|
216
|
+
<View
|
|
217
|
+
style={{
|
|
218
|
+
alignItems: 'center',
|
|
219
|
+
bottom: props.isPage ? Platform.OS === 'ios' ? 0 : 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
<OButton
|
|
223
|
+
imgRightSrc=''
|
|
224
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
225
|
+
style={{ ...styles.closeUpsellingButton }}
|
|
226
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
227
|
+
onClick={() => {
|
|
228
|
+
handleUpsellingPage()
|
|
229
|
+
setIsCheckout(true)
|
|
230
|
+
}}
|
|
231
|
+
/>
|
|
232
|
+
</View>
|
|
233
|
+
</>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<>
|
|
239
|
+
{isCustomMode ? (
|
|
240
|
+
<UpsellingLayout />
|
|
241
|
+
) : (
|
|
242
|
+
<>
|
|
243
|
+
{props.isPage ? (
|
|
244
|
+
<UpsellingContent />
|
|
245
|
+
) : (
|
|
246
|
+
canOpenUpselling && !modalIsOpen && (
|
|
247
|
+
<OBottomPopup
|
|
248
|
+
title={''}
|
|
249
|
+
open={openUpselling}
|
|
250
|
+
onClose={() => handleUpsellingPage()}
|
|
251
|
+
isStatusBar
|
|
252
|
+
>
|
|
253
|
+
<UpsellingContent />
|
|
254
|
+
</OBottomPopup>
|
|
255
|
+
)
|
|
256
|
+
)}
|
|
257
|
+
</>
|
|
258
|
+
)}
|
|
259
|
+
</>
|
|
260
|
+
)
|
|
232
261
|
}
|
|
233
262
|
|
|
234
263
|
export const UpsellingProducts = (props: UpsellingProductsParams) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
264
|
+
const upsellingProductsProps = {
|
|
265
|
+
...props,
|
|
266
|
+
UIComponent: UpsellingProductsUI
|
|
267
|
+
}
|
|
268
|
+
return (
|
|
269
|
+
<UpsellingPageController {...upsellingProductsProps} />
|
|
270
|
+
)
|
|
242
271
|
}
|
|
@@ -47,4 +47,15 @@ export const TopBar = styled.View`
|
|
|
47
47
|
export const TopActions = styled.TouchableOpacity`
|
|
48
48
|
height: 44px;
|
|
49
49
|
justify-content: center;
|
|
50
|
-
`;
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export const CartList = styled.ScrollView`
|
|
53
|
+
padding: 10px 40px;
|
|
54
|
+
overflow: visible;
|
|
55
|
+
`
|
|
56
|
+
|
|
57
|
+
export const CartDivider = styled.View`
|
|
58
|
+
height: 8px;
|
|
59
|
+
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
60
|
+
margin: 20px -40px 0;
|
|
61
|
+
`
|
|
@@ -152,9 +152,11 @@ const UserDetailsUI = (props: any) => {
|
|
|
152
152
|
{!(validationFields.loading || formState.loading) && (
|
|
153
153
|
<UDContainer>
|
|
154
154
|
<UDHeader>
|
|
155
|
-
|
|
156
|
-
{
|
|
157
|
-
|
|
155
|
+
{props.HeaderTitle ?? (
|
|
156
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
|
|
157
|
+
{t('CUSTOMER_DETAILS', 'Customer Details')}
|
|
158
|
+
</OText>
|
|
159
|
+
)}
|
|
158
160
|
{cartStatus !== 2 && !requiredFields && (
|
|
159
161
|
!isEdit ? (
|
|
160
162
|
<EditBtn onPress={() => toggleIsEdit()} activeOpacity={0.7}>
|
|
@@ -10,7 +10,6 @@ import { OText, OButton, OInput } from '../shared';
|
|
|
10
10
|
|
|
11
11
|
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
12
12
|
import { sortInputFields } from '../../utils';
|
|
13
|
-
import CheckBox from '@react-native-community/checkbox';
|
|
14
13
|
|
|
15
14
|
export const UserFormDetailsUI = (props: any) => {
|
|
16
15
|
const {
|
|
@@ -18,7 +17,6 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
18
17
|
formState,
|
|
19
18
|
showField,
|
|
20
19
|
requiredFields,
|
|
21
|
-
onClose,
|
|
22
20
|
setIsSubmit,
|
|
23
21
|
cleanFormState,
|
|
24
22
|
onCloseProfile,
|
|
@@ -29,12 +27,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
29
27
|
phoneUpdate,
|
|
30
28
|
hideUpdateButton,
|
|
31
29
|
setWillVerifyOtpState,
|
|
32
|
-
handleChangePromotions,
|
|
33
30
|
} = props;
|
|
34
31
|
|
|
35
32
|
const theme = useTheme();
|
|
36
33
|
|
|
37
|
-
|
|
38
34
|
const styles = StyleSheet.create({
|
|
39
35
|
btnOutline: {
|
|
40
36
|
backgroundColor: '#FFF',
|
|
@@ -64,10 +60,6 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
64
60
|
paddingStart: 0,
|
|
65
61
|
paddingBottom: 0,
|
|
66
62
|
marginBottom: -0,
|
|
67
|
-
},
|
|
68
|
-
checkBoxStyle: {
|
|
69
|
-
width: 25,
|
|
70
|
-
height: 25,
|
|
71
63
|
}
|
|
72
64
|
});
|
|
73
65
|
|
|
@@ -79,7 +71,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
79
71
|
const [{ user }] = useSession();
|
|
80
72
|
const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
|
|
81
73
|
const [isValid, setIsValid] = useState(false)
|
|
82
|
-
|
|
74
|
+
const [isChanged, setIsChanged] = useState(false)
|
|
83
75
|
const [phoneInputData, setPhoneInputData] = useState({
|
|
84
76
|
error: '',
|
|
85
77
|
phone: {
|
|
@@ -243,10 +235,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
243
235
|
|
|
244
236
|
useEffect(() => {
|
|
245
237
|
if (!requiredFields || formState?.changes?.length === 0) return
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
238
|
+
const _isValid = requiredFields.every((key: any) => formState?.changes[key])
|
|
239
|
+
setIsValid(_isValid)
|
|
240
|
+
}, [formState?.changes, requiredFields])
|
|
241
|
+
|
|
250
242
|
return (
|
|
251
243
|
<>
|
|
252
244
|
<UDForm>
|
|
@@ -333,7 +325,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
333
325
|
),
|
|
334
326
|
)}
|
|
335
327
|
|
|
336
|
-
{!!showInputPhoneNumber &&((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
|
|
328
|
+
{!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
|
|
337
329
|
<WrapperPhone>
|
|
338
330
|
<OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
|
|
339
331
|
<PhoneInputNumber
|
|
@@ -395,39 +387,6 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
395
387
|
defaultValue=''
|
|
396
388
|
/>
|
|
397
389
|
)}
|
|
398
|
-
{!requiredFields && (
|
|
399
|
-
<Controller
|
|
400
|
-
control={control}
|
|
401
|
-
render={({ onChange, value }: any) => (
|
|
402
|
-
<TouchableOpacity
|
|
403
|
-
style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
|
|
404
|
-
onPress={() => {
|
|
405
|
-
onChange(!value)
|
|
406
|
-
handleChangePromotions(!value)
|
|
407
|
-
}}
|
|
408
|
-
>
|
|
409
|
-
<CheckBox
|
|
410
|
-
value={value}
|
|
411
|
-
boxType={'square'}
|
|
412
|
-
tintColors={{
|
|
413
|
-
true: theme.colors.primary,
|
|
414
|
-
false: theme.colors.disabled
|
|
415
|
-
}}
|
|
416
|
-
tintColor={theme.colors.disabled}
|
|
417
|
-
onCheckColor={theme.colors.primary}
|
|
418
|
-
onTintColor={theme.colors.primary}
|
|
419
|
-
style={Platform.OS === 'ios' && styles.checkBoxStyle}
|
|
420
|
-
/>
|
|
421
|
-
<OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
|
|
422
|
-
</TouchableOpacity>
|
|
423
|
-
)}
|
|
424
|
-
name='promotions'
|
|
425
|
-
defaultValue={formState?.result?.result
|
|
426
|
-
? !!formState?.result?.result?.settings?.notification?.newsletter
|
|
427
|
-
: !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
|
|
428
|
-
/>
|
|
429
|
-
)}
|
|
430
|
-
|
|
431
390
|
</UDWrapper>
|
|
432
391
|
)}
|
|
433
392
|
{validationFields?.loading && (
|
|
@@ -478,4 +437,3 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
478
437
|
</>
|
|
479
438
|
);
|
|
480
439
|
};
|
|
481
|
-
|