ordering-ui-react-native 0.17.99 → 0.18.0-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 +9 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +91 -43
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +60 -47
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +24 -10
- package/themes/business/src/utils/index.tsx +29 -2
- 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/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- 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/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -341
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +12 -4
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +44 -39
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +2 -4
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/index.tsx +35 -6
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +36 -24
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +1 -1
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,119 +1,41 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
3
2
|
import {
|
|
4
3
|
UpsellingPage as UpsellingPageController,
|
|
5
|
-
useUtils,
|
|
6
|
-
useLanguage,
|
|
7
4
|
useOrder,
|
|
8
|
-
useConfig
|
|
9
5
|
} from 'ordering-components/native'
|
|
10
|
-
import {
|
|
11
|
-
import { OText, OIcon, OBottomPopup, OButton } from '../shared'
|
|
6
|
+
import { OBottomPopup } from '../shared'
|
|
12
7
|
import { UpsellingProductsParams } from '../../types'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Item,
|
|
17
|
-
Details,
|
|
18
|
-
AddButton,
|
|
19
|
-
CartList,
|
|
20
|
-
CartDivider
|
|
21
|
-
} from './styles'
|
|
22
|
-
import { OrderSummary } from '../OrderSummary';
|
|
23
|
-
import { Cart } from '../Cart';
|
|
24
|
-
import { ScrollView } from 'react-native-gesture-handler';
|
|
25
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
8
|
+
|
|
9
|
+
import { UpsellingLayout } from './UpsellingLayout';
|
|
10
|
+
import { UpsellingContent } from './UpsellingContent';
|
|
26
11
|
|
|
27
12
|
const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
28
13
|
const {
|
|
29
14
|
isCustomMode,
|
|
30
15
|
upsellingProducts,
|
|
31
|
-
business,
|
|
32
16
|
handleUpsellingPage,
|
|
33
|
-
handleCloseUpsellingPage,
|
|
34
17
|
openUpselling,
|
|
35
18
|
canOpenUpselling,
|
|
36
19
|
setCanOpenUpselling,
|
|
37
|
-
isFromCart
|
|
38
|
-
onNavigationRedirect,
|
|
39
|
-
onGoBack
|
|
20
|
+
isFromCart
|
|
40
21
|
} = props
|
|
41
22
|
|
|
42
|
-
const theme = useTheme();
|
|
43
|
-
|
|
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
|
-
})
|
|
87
|
-
|
|
88
|
-
const [modalIsOpen, setModalIsOpen] = useState(false)
|
|
89
23
|
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)
|
|
96
|
-
|
|
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
|
|
101
24
|
|
|
102
25
|
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
26
|
const cartProducts = cart?.products?.length
|
|
105
|
-
|
|
106
|
-
|
|
27
|
+
? cart?.products.map((product: any) => product.id)
|
|
28
|
+
: []
|
|
107
29
|
|
|
108
30
|
const productsList = !upsellingProducts.loading && !upsellingProducts.error
|
|
109
|
-
|
|
31
|
+
? upsellingProducts?.products?.length
|
|
110
32
|
? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
|
|
111
33
|
: (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
|
|
112
|
-
|
|
34
|
+
: []
|
|
113
35
|
|
|
114
36
|
useEffect(() => {
|
|
115
37
|
if (!isCustomMode && !props.products) {
|
|
116
|
-
if (!upsellingProducts
|
|
38
|
+
if (!upsellingProducts?.loading) {
|
|
117
39
|
if (upsellingProducts?.products?.length && !isFromCart) {
|
|
118
40
|
setCanOpenUpselling && setCanOpenUpselling(true)
|
|
119
41
|
} else {
|
|
@@ -121,136 +43,25 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
121
43
|
}
|
|
122
44
|
}
|
|
123
45
|
}
|
|
124
|
-
}, [upsellingProducts
|
|
125
|
-
|
|
126
|
-
const handleFormProduct = (product: any) => {
|
|
127
|
-
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
128
|
-
product: product,
|
|
129
|
-
businessId: product?.api?.businessId,
|
|
130
|
-
businessSlug: business.slug,
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
|
|
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
|
-
}
|
|
174
|
-
|
|
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(cart)
|
|
229
|
-
setIsCheckout(true)
|
|
230
|
-
}}
|
|
231
|
-
/>
|
|
232
|
-
</View>
|
|
233
|
-
</>
|
|
234
|
-
)
|
|
235
|
-
}
|
|
46
|
+
}, [upsellingProducts?.loading, upsellingProducts?.products?.length])
|
|
236
47
|
|
|
237
48
|
return (
|
|
238
49
|
<>
|
|
239
50
|
{isCustomMode ? (
|
|
240
|
-
<UpsellingLayout />
|
|
51
|
+
<UpsellingLayout {...props} productsList={productsList} />
|
|
241
52
|
) : (
|
|
242
53
|
<>
|
|
243
54
|
{props.isPage ? (
|
|
244
|
-
<UpsellingContent />
|
|
55
|
+
<UpsellingContent {...props} cart={cart} productsList={productsList} />
|
|
245
56
|
) : (
|
|
246
|
-
canOpenUpselling &&
|
|
57
|
+
canOpenUpselling && (
|
|
247
58
|
<OBottomPopup
|
|
248
59
|
title={''}
|
|
249
60
|
open={openUpselling}
|
|
250
61
|
onClose={() => handleUpsellingPage(cart)}
|
|
251
62
|
isStatusBar
|
|
252
63
|
>
|
|
253
|
-
<UpsellingContent />
|
|
64
|
+
<UpsellingContent {...props} productsList={productsList} />
|
|
254
65
|
</OBottomPopup>
|
|
255
66
|
)
|
|
256
67
|
)}
|
|
@@ -59,3 +59,22 @@ export const CartDivider = styled.View`
|
|
|
59
59
|
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
60
60
|
margin: 20px -40px 0;
|
|
61
61
|
`
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export const TopActionsHeader = styled.TouchableOpacity`
|
|
65
|
+
height: 60px;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
min-width: 30px;
|
|
68
|
+
padding-right: 15px;
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export const TopHeader = styled.View`
|
|
72
|
+
width: 100%;
|
|
73
|
+
flex-direction: row;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
z-index: 1;
|
|
77
|
+
height: 60px;
|
|
78
|
+
min-height: 60px;
|
|
79
|
+
`
|
|
80
|
+
|
|
@@ -34,7 +34,8 @@ const UserDetailsUI = (props: any) => {
|
|
|
34
34
|
isCheckout,
|
|
35
35
|
handleSendVerifyCode,
|
|
36
36
|
verifyPhoneState,
|
|
37
|
-
setFormState
|
|
37
|
+
setFormState,
|
|
38
|
+
setIsOpen
|
|
38
39
|
} = props
|
|
39
40
|
|
|
40
41
|
const theme = useTheme();
|
|
@@ -209,6 +210,7 @@ const UserDetailsUI = (props: any) => {
|
|
|
209
210
|
isCheckout={isCheckout}
|
|
210
211
|
setWillVerifyOtpState={setWillVerifyOtpState}
|
|
211
212
|
setIsSubmit={setIsSubmit}
|
|
213
|
+
setIsOpen={setIsOpen}
|
|
212
214
|
/>
|
|
213
215
|
)}
|
|
214
216
|
</UDContainer>
|
|
@@ -7,10 +7,14 @@ import { SignupForm } from '../SignupForm'
|
|
|
7
7
|
|
|
8
8
|
import { UDForm, UDLoader, UDWrapper, WrapperPhone } from './styles';
|
|
9
9
|
|
|
10
|
-
import { OText, OButton, OInput, OModal } from '../shared';
|
|
10
|
+
import { OText, OButton, OInput, OModal, OIcon } from '../shared';
|
|
11
|
+
import { OAlert } from '../../../../../src/components/shared'
|
|
11
12
|
|
|
12
13
|
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
13
14
|
import { sortInputFields } from '../../utils';
|
|
15
|
+
import { ListItem } from '../UserProfile/styles';
|
|
16
|
+
import moment from 'moment';
|
|
17
|
+
import { DatePickerUI } from '../DatePicker';
|
|
14
18
|
|
|
15
19
|
export const UserFormDetailsUI = (props: any) => {
|
|
16
20
|
const {
|
|
@@ -29,7 +33,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
29
33
|
hideUpdateButton,
|
|
30
34
|
setWillVerifyOtpState,
|
|
31
35
|
handlePlaceOrderAsGuest,
|
|
32
|
-
isCheckout
|
|
36
|
+
isCheckout,
|
|
37
|
+
setIsOpen,
|
|
38
|
+
handleRemoveAccount,
|
|
39
|
+
isProfile
|
|
33
40
|
} = props;
|
|
34
41
|
|
|
35
42
|
const theme = useTheme();
|
|
@@ -76,6 +83,8 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
76
83
|
const [isValid, setIsValid] = useState(false)
|
|
77
84
|
const [isChanged, setIsChanged] = useState(false)
|
|
78
85
|
const [isModalOpen, setIsModalOpen] = useState(false)
|
|
86
|
+
const [birthdate, setBirthdate] = useState(user?.birthdate ?? null)
|
|
87
|
+
const [showDatePicker, setShowDatePicker] = useState(false)
|
|
79
88
|
const [phoneInputData, setPhoneInputData] = useState({
|
|
80
89
|
error: '',
|
|
81
90
|
phone: {
|
|
@@ -83,16 +92,19 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
83
92
|
cellphone: null,
|
|
84
93
|
},
|
|
85
94
|
});
|
|
95
|
+
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
86
96
|
|
|
97
|
+
const isAdmin = user?.level === 0
|
|
87
98
|
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
99
|
+
const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
|
|
88
100
|
|
|
89
101
|
const handleSuccessSignup = (user: any) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
login({
|
|
103
|
+
user,
|
|
104
|
+
token: user?.session?.access_token
|
|
105
|
+
})
|
|
106
|
+
handlePlaceOrderAsGuest && handlePlaceOrderAsGuest()
|
|
107
|
+
}
|
|
96
108
|
|
|
97
109
|
const getInputRules = (field: any) => {
|
|
98
110
|
const rules: any = {
|
|
@@ -199,9 +211,23 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
199
211
|
handleChangeInput(countryCode, true);
|
|
200
212
|
}
|
|
201
213
|
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
const _handleChangeDate = (date: any) => {
|
|
215
|
+
setBirthdate(date)
|
|
216
|
+
const _birthdate = moment(date).format('YYYY-MM-DD')
|
|
217
|
+
handleChangeInput({ target: { name: 'birthdate', value: _birthdate } })
|
|
218
|
+
setShowDatePicker(false)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const onRemoveAccount = () => {
|
|
222
|
+
setConfirm({
|
|
223
|
+
open: true,
|
|
224
|
+
content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
|
|
225
|
+
title: t('ACCOUNT_ALERT', 'Account alert'),
|
|
226
|
+
handleOnAccept: () => {
|
|
227
|
+
setConfirm({ ...confirm, open: false })
|
|
228
|
+
handleRemoveAccount && handleRemoveAccount(user?.id)
|
|
229
|
+
}
|
|
230
|
+
})
|
|
205
231
|
}
|
|
206
232
|
|
|
207
233
|
useEffect(() => {
|
|
@@ -223,6 +249,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
223
249
|
if (!formState?.loading && formState?.result?.error) {
|
|
224
250
|
formState.result?.result &&
|
|
225
251
|
showToast(ToastType.Error, formState.result?.result[0]);
|
|
252
|
+
if (isCheckout) {
|
|
253
|
+
setIsOpen && setIsOpen(false)
|
|
254
|
+
cleanFormState && cleanFormState({ changes: {} })
|
|
255
|
+
}
|
|
226
256
|
}
|
|
227
257
|
}, [formState?.loading]);
|
|
228
258
|
|
|
@@ -250,6 +280,14 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
250
280
|
}
|
|
251
281
|
}, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
|
|
252
282
|
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
if (!validationFields.loading && birthdate) {
|
|
285
|
+
setValue('birthdate', formState?.result?.result
|
|
286
|
+
? formState?.result?.result?.birthdate
|
|
287
|
+
: formState?.changes?.birthdate ?? (user && user?.birthdate) ?? '')
|
|
288
|
+
}
|
|
289
|
+
}, [validationFields, birthdate])
|
|
290
|
+
|
|
253
291
|
useEffect(() => {
|
|
254
292
|
if (!requiredFields || formState?.changes?.length === 0) return
|
|
255
293
|
const _isValid = requiredFields.every((key: any) => formState?.changes[key])
|
|
@@ -341,7 +379,21 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
341
379
|
</React.Fragment>
|
|
342
380
|
),
|
|
343
381
|
)}
|
|
344
|
-
|
|
382
|
+
{showInputBirthday && (
|
|
383
|
+
<WrapperPhone>
|
|
384
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
385
|
+
{t('BIRTHDATE', 'Birthdate')}
|
|
386
|
+
</OText>
|
|
387
|
+
<TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
|
|
388
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ alignSelf: 'flex-start' }}>
|
|
389
|
+
{birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
|
|
390
|
+
</OText>
|
|
391
|
+
</TouchableOpacity>
|
|
392
|
+
{showDatePicker && (
|
|
393
|
+
<DatePickerUI birthdate={birthdate} handleChangeDate={_handleChangeDate} />
|
|
394
|
+
)}
|
|
395
|
+
</WrapperPhone>
|
|
396
|
+
)}
|
|
345
397
|
{!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
|
|
346
398
|
<WrapperPhone>
|
|
347
399
|
<OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
|
|
@@ -406,6 +458,12 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
406
458
|
)}
|
|
407
459
|
</UDWrapper>
|
|
408
460
|
)}
|
|
461
|
+
{isProfile && (
|
|
462
|
+
<ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
|
|
463
|
+
<OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
464
|
+
<OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
|
|
465
|
+
</ListItem>
|
|
466
|
+
)}
|
|
409
467
|
{validationFields?.loading && (
|
|
410
468
|
<UDLoader>
|
|
411
469
|
<OText size={12}>{t('LOADING', 'Loading')}</OText>
|
|
@@ -424,8 +482,8 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
424
482
|
? t('UPDATING', 'Updating...')
|
|
425
483
|
: t('UPDATE', 'Update')
|
|
426
484
|
}
|
|
427
|
-
bgColor={theme.colors.
|
|
428
|
-
textStyle={{ color: theme.colors.
|
|
485
|
+
bgColor={theme.colors.primary}
|
|
486
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
429
487
|
borderColor={theme.colors.primary}
|
|
430
488
|
isDisabled={formState.loading}
|
|
431
489
|
imgRightSrc={null}
|
|
@@ -441,16 +499,29 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
441
499
|
formState.loading
|
|
442
500
|
? t('UPDATING', 'Updating...')
|
|
443
501
|
: ((isCheckout && !!user?.guest_id)
|
|
444
|
-
|
|
445
|
-
|
|
502
|
+
? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
|
|
503
|
+
: t('CONTINUE', 'Continue'))
|
|
446
504
|
}
|
|
447
|
-
bgColor={theme.colors.
|
|
448
|
-
textStyle={{
|
|
505
|
+
bgColor={theme.colors.primary}
|
|
506
|
+
textStyle={{
|
|
507
|
+
color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
|
|
508
|
+
fontSize: 14
|
|
509
|
+
}}
|
|
449
510
|
borderColor={theme.colors.primary}
|
|
450
511
|
isDisabled={!user?.guest_id && (formState.loading || !isValid)}
|
|
451
512
|
imgRightSrc={null}
|
|
452
|
-
style={{
|
|
453
|
-
|
|
513
|
+
style={{
|
|
514
|
+
borderRadius: 7.6,
|
|
515
|
+
shadowOpacity: 0,
|
|
516
|
+
width: '100%',
|
|
517
|
+
borderWidth: 1,
|
|
518
|
+
marginTop: 20,
|
|
519
|
+
marginBottom: 20,
|
|
520
|
+
backgroundColor: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.lightGray : theme.colors.primary,
|
|
521
|
+
borderColor: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.white : theme.colors.primary,
|
|
522
|
+
opacity: !user?.guest_id && (formState.loading || !isValid) ? 0.3 : 1,
|
|
523
|
+
}}
|
|
524
|
+
onClick={!user?.guest_id ? handleSubmit(onSubmit) : () => setIsModalOpen(true)}
|
|
454
525
|
/>
|
|
455
526
|
)}
|
|
456
527
|
{isCheckout && !!user?.guest_id && (
|
|
@@ -462,7 +533,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
462
533
|
open={isModalOpen}
|
|
463
534
|
onClose={() => setIsModalOpen(false)}
|
|
464
535
|
>
|
|
465
|
-
<ScrollView style={{ paddingHorizontal: 20, width: '100%'}}>
|
|
536
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
466
537
|
<SignupForm
|
|
467
538
|
handleSuccessSignup={handleSuccessSignup}
|
|
468
539
|
isGuest
|
|
@@ -472,7 +543,14 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
472
543
|
/>
|
|
473
544
|
</ScrollView>
|
|
474
545
|
</OModal>
|
|
546
|
+
<OAlert
|
|
547
|
+
open={confirm.open}
|
|
548
|
+
title={confirm.title}
|
|
549
|
+
content={confirm.content}
|
|
550
|
+
onAccept={confirm.handleOnAccept}
|
|
551
|
+
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
552
|
+
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
553
|
+
/>
|
|
475
554
|
</>
|
|
476
555
|
);
|
|
477
556
|
};
|
|
478
|
-
|
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
} from './styles';
|
|
36
36
|
import { useWindowDimensions } from 'react-native';
|
|
37
37
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
38
|
-
import styled from 'styled-components';
|
|
39
38
|
import ToggleSwitch from 'toggle-switch-react-native';
|
|
40
39
|
|
|
41
40
|
const ProfileListUI = (props: ProfileParams) => {
|
|
@@ -60,7 +59,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
60
59
|
const hideSession = theme?.bar_menu?.components?.sessions?.hidden
|
|
61
60
|
const hidePromotions = theme?.bar_menu?.components?.promotions?.hidden
|
|
62
61
|
const hideAddressList = theme?.profile?.components?.address_list?.hidden
|
|
63
|
-
const showLanguages =
|
|
62
|
+
const showLanguages = theme?.profile?.components?.languages?.hidden
|
|
64
63
|
const showNotifications = !theme?.profile?.components?.notification_settings?.hidden
|
|
65
64
|
const langPickerStyle = StyleSheet.create({
|
|
66
65
|
inputAndroid: {
|
|
@@ -102,7 +101,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
102
101
|
marginEnd: 14
|
|
103
102
|
},
|
|
104
103
|
pagePadding: {
|
|
105
|
-
paddingHorizontal:
|
|
104
|
+
paddingHorizontal: 20
|
|
106
105
|
},
|
|
107
106
|
messageIconStyle: {
|
|
108
107
|
fontSize: 18,
|
|
@@ -118,8 +117,6 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
118
117
|
const [, { showToast }] = useToast();
|
|
119
118
|
const { errors } = useForm();
|
|
120
119
|
|
|
121
|
-
const isAdmin = user?.level === 0
|
|
122
|
-
|
|
123
120
|
const { height } = useWindowDimensions();
|
|
124
121
|
const { top, bottom } = useSafeAreaInsets();
|
|
125
122
|
|
|
@@ -153,19 +150,8 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
153
150
|
|
|
154
151
|
const detailProps = {
|
|
155
152
|
goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
|
|
156
|
-
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const onRemoveAccount = () => {
|
|
160
|
-
setConfirm({
|
|
161
|
-
open: true,
|
|
162
|
-
content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
|
|
163
|
-
title: t('ACCOUNT_ALERT', 'Account alert'),
|
|
164
|
-
handleOnAccept: () => {
|
|
165
|
-
setConfirm({ ...confirm, open: false })
|
|
166
|
-
handleRemoveAccount && handleRemoveAccount(user?.id)
|
|
167
|
-
}
|
|
168
|
-
})
|
|
153
|
+
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params),
|
|
154
|
+
handleRemoveAccount
|
|
169
155
|
}
|
|
170
156
|
|
|
171
157
|
useEffect(() => {
|
|
@@ -175,7 +161,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
175
161
|
}, [removeAccountState])
|
|
176
162
|
|
|
177
163
|
return (
|
|
178
|
-
<View style={{ flex: 1, height:
|
|
164
|
+
<View style={{ flex: 1, height: '100%', paddingTop: 20 }}>
|
|
179
165
|
<CenterView style={styles.pagePadding}>
|
|
180
166
|
{user?.photo && !hideProfileImage && (
|
|
181
167
|
<View style={styles.photo}>
|
|
@@ -238,11 +224,11 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
238
224
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
|
|
239
225
|
</ListItem>
|
|
240
226
|
)}
|
|
241
|
-
{
|
|
227
|
+
{showNotifications && (
|
|
242
228
|
<ListItem onPress={() => navigation.navigate('Notifications', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
243
229
|
<NotificationBadge style={{ borderRadius: 100 / 2 }} />
|
|
244
230
|
<Ionicons name='notifications-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
245
|
-
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('
|
|
231
|
+
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MARKETING_NOTIFICATIONS', 'Marketing notifications')}
|
|
246
232
|
</OText>
|
|
247
233
|
<NotificationsWrapper>
|
|
248
234
|
<ToggleSwitch
|
|
@@ -275,17 +261,13 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
275
261
|
)}
|
|
276
262
|
</Actions>
|
|
277
263
|
|
|
278
|
-
<Actions>
|
|
264
|
+
<Actions style={{ paddingTop: height * .02 }}>
|
|
279
265
|
{!showLanguages && (
|
|
280
266
|
<LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
|
|
281
267
|
)}
|
|
282
268
|
<View style={{ height: 17 }} />
|
|
283
269
|
<LogoutButton color={theme.colors.textNormal} text={t('LOGOUT', 'Logout')} />
|
|
284
270
|
<View style={{ height: 17 }} />
|
|
285
|
-
<ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
|
|
286
|
-
<OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
287
|
-
<OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
|
|
288
|
-
</ListItem>
|
|
289
271
|
</Actions>
|
|
290
272
|
</ListWrap>
|
|
291
273
|
<OAlert
|