ordering-ui-react-native 0.16.15 → 0.16.16-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 +33 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- 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/pages/BusinessesListing.tsx +7 -6
- 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 +12 -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 +27 -21
- 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 +15 -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 +12 -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 +9 -7
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +4 -0
- 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 +280 -175
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -4
- 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 +70 -34
- 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 +2 -2
- package/themes/original/src/components/MultiCheckout/index.tsx +14 -1
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +13 -11
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +31 -19
- package/themes/original/src/components/MyOrders/index.tsx +68 -6
- 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 +209 -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 +100 -106
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
- package/themes/original/src/components/OrdersOption/index.tsx +38 -23
- 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 +15 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
- package/themes/original/src/components/UserDetails/index.tsx +31 -17
- 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 +123 -29
- package/themes/original/src/utils/index.tsx +77 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { Platform, StyleSheet, NativeModules } from 'react-native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import
|
|
4
|
+
import RNRestart from 'react-native-restart'
|
|
5
|
+
import { LanguageSelector as LanguageSelectorController, useOrder, useLanguage } from 'ordering-components/native'
|
|
5
6
|
|
|
6
7
|
import RNPickerSelect from 'react-native-picker-select'
|
|
7
8
|
import { Container, DummyContainer } from './styles'
|
|
8
9
|
import { LanguageSelectorParams } from '../../types'
|
|
9
|
-
import { OIcon } from '../shared'
|
|
10
|
-
import RNRestart from 'react-native-restart'
|
|
11
10
|
|
|
12
11
|
const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
13
12
|
|
|
@@ -19,6 +18,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
19
18
|
} = props
|
|
20
19
|
|
|
21
20
|
const [orderState] = useOrder()
|
|
21
|
+
const [langugageState] = useLanguage()
|
|
22
22
|
const theme = useTheme();
|
|
23
23
|
|
|
24
24
|
const [language, setLanguage] = useState(currentLanguage)
|
|
@@ -70,16 +70,18 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
const changeDirection = async (language: any) => {
|
|
73
|
-
if (language
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
if (language === langugageState?.language?.code) return
|
|
74
|
+
const isArabicLang = language === 'ar'
|
|
75
|
+
const isRTLOn = NativeModules.I18nManager.isRTL
|
|
76
|
+
|
|
77
|
+
if (isArabicLang && !isRTLOn) {
|
|
78
|
+
NativeModules.I18nManager.forceRTL(!isRTLOn)
|
|
79
|
+
RNRestart.Restart();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!isArabicLang && isRTLOn) {
|
|
83
|
+
NativeModules.I18nManager.forceRTL(!isRTLOn)
|
|
84
|
+
RNRestart.Restart();
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -87,11 +89,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
87
89
|
changeDirection(Platform.OS === 'ios' ? language : langCode)
|
|
88
90
|
handleChangeLanguage(Platform.OS === 'ios' ? language : langCode)
|
|
89
91
|
}
|
|
90
|
-
|
|
92
|
+
|
|
91
93
|
useEffect(() => {
|
|
92
94
|
changeDirection(currentLanguage)
|
|
93
95
|
}, [])
|
|
94
|
-
|
|
96
|
+
|
|
95
97
|
return (
|
|
96
98
|
<Container>
|
|
97
99
|
{languagesState?.languages ? (
|
|
@@ -113,8 +115,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
export const LanguageSelector = (props: LanguageSelectorParams) => {
|
|
118
|
+
const [langugageState] = useLanguage()
|
|
119
|
+
|
|
116
120
|
const LanguageProps = {
|
|
117
121
|
...props,
|
|
122
|
+
currentLanguage: langugageState?.language?.code ?? NativeModules.I18nManager.localeIdentifier?.split('_')?.[0] ?? 'en',
|
|
118
123
|
UIComponent: LanguageSelectorUI
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import { Pressable, StyleSheet, View, Keyboard } from 'react-native';
|
|
3
3
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
4
|
+
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
4
5
|
import { useForm, Controller } from 'react-hook-form';
|
|
5
6
|
import { PhoneInputNumber } from '../PhoneInputNumber'
|
|
6
7
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
8
|
+
import Recaptcha from 'react-native-recaptcha-that-works'
|
|
7
9
|
|
|
8
10
|
import {
|
|
9
11
|
LoginForm as LoginFormController,
|
|
@@ -28,7 +30,8 @@ import {
|
|
|
28
30
|
OTab,
|
|
29
31
|
SocialButtons,
|
|
30
32
|
OrSeparator,
|
|
31
|
-
LineSeparator
|
|
33
|
+
LineSeparator,
|
|
34
|
+
RecaptchaButton
|
|
32
35
|
} from './styles';
|
|
33
36
|
|
|
34
37
|
import { _removeStoreData } from '../../providers/StoreUtil';
|
|
@@ -56,7 +59,9 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
56
59
|
handleSendVerifyCode,
|
|
57
60
|
handleCheckPhoneCode,
|
|
58
61
|
onNavigationRedirect,
|
|
59
|
-
notificationState
|
|
62
|
+
notificationState,
|
|
63
|
+
handleReCaptcha,
|
|
64
|
+
enableReCaptcha
|
|
60
65
|
} = props
|
|
61
66
|
|
|
62
67
|
const theme = useTheme()
|
|
@@ -70,6 +75,10 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
70
75
|
marginBottom: 25,
|
|
71
76
|
borderWidth: 1,
|
|
72
77
|
borderColor: theme.colors.disabled
|
|
78
|
+
},
|
|
79
|
+
recaptchaIcon: {
|
|
80
|
+
width: 100,
|
|
81
|
+
height: 100,
|
|
73
82
|
}
|
|
74
83
|
});
|
|
75
84
|
|
|
@@ -89,7 +98,9 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
89
98
|
cellphone: null
|
|
90
99
|
}
|
|
91
100
|
});
|
|
92
|
-
|
|
101
|
+
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
102
|
+
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
103
|
+
const recaptchaRef = useRef<any>({});
|
|
93
104
|
const inputRef = useRef<any>({})
|
|
94
105
|
|
|
95
106
|
const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
|
|
@@ -152,6 +163,40 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
152
163
|
onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''))
|
|
153
164
|
}
|
|
154
165
|
|
|
166
|
+
const handleOpenRecaptcha = () => {
|
|
167
|
+
setRecaptchaVerified(false)
|
|
168
|
+
|
|
169
|
+
if (recaptchaVerified) {
|
|
170
|
+
handleReCaptcha && handleReCaptcha('')
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (!recaptchaConfig?.siteKey) {
|
|
175
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
if (!recaptchaConfig?.baseUrl) {
|
|
179
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
recaptchaRef.current.open()
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const onRecaptchaVerify = (token: any) => {
|
|
187
|
+
setRecaptchaVerified(true)
|
|
188
|
+
handleReCaptcha && handleReCaptcha(token)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
|
|
193
|
+
setRecaptchaConfig({
|
|
194
|
+
siteKey: configs?.security_recaptcha_site_key?.value || null,
|
|
195
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
}, [configs, enableReCaptcha])
|
|
199
|
+
|
|
155
200
|
useEffect(() => {
|
|
156
201
|
if (!formState.loading && formState.result?.error) {
|
|
157
202
|
formState.result?.result && showToast(
|
|
@@ -317,6 +362,48 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
317
362
|
rules={{ required: t('VALIDATION_ERROR_PASSWORD_REQUIRED', 'The field Password is required').replace('_attribute_', t('PASSWORD', 'Password')) }}
|
|
318
363
|
defaultValue=""
|
|
319
364
|
/>
|
|
365
|
+
|
|
366
|
+
{enableReCaptcha && (
|
|
367
|
+
<>
|
|
368
|
+
<TouchableOpacity
|
|
369
|
+
onPress={handleOpenRecaptcha}
|
|
370
|
+
>
|
|
371
|
+
<RecaptchaButton>
|
|
372
|
+
{recaptchaVerified ? (
|
|
373
|
+
<MaterialCommunityIcons
|
|
374
|
+
name="checkbox-marked"
|
|
375
|
+
size={26}
|
|
376
|
+
color={theme.colors.primary}
|
|
377
|
+
/>
|
|
378
|
+
) : (
|
|
379
|
+
<MaterialCommunityIcons
|
|
380
|
+
name="checkbox-blank-outline"
|
|
381
|
+
size={26}
|
|
382
|
+
color={theme.colors.mediumGray}
|
|
383
|
+
/>
|
|
384
|
+
)}
|
|
385
|
+
<OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
|
|
386
|
+
</RecaptchaButton>
|
|
387
|
+
</TouchableOpacity>
|
|
388
|
+
<Recaptcha
|
|
389
|
+
ref={recaptchaRef}
|
|
390
|
+
siteKey={recaptchaConfig?.siteKey}
|
|
391
|
+
baseUrl={recaptchaConfig?.baseUrl}
|
|
392
|
+
onVerify={onRecaptchaVerify}
|
|
393
|
+
onExpire={() => setRecaptchaVerified(false)}
|
|
394
|
+
footerComponent={<OButton
|
|
395
|
+
onClick={() => recaptchaRef.current.close()}
|
|
396
|
+
style={{ borderRadius: 0 }}
|
|
397
|
+
text={t('CLOSE', 'Close')}
|
|
398
|
+
bgColor={theme.colors.primary}
|
|
399
|
+
borderColor={theme.colors.primary}
|
|
400
|
+
textStyle={{ color: 'white' }}
|
|
401
|
+
imgRightSrc={null}
|
|
402
|
+
/>}
|
|
403
|
+
/>
|
|
404
|
+
</>
|
|
405
|
+
)}
|
|
406
|
+
|
|
320
407
|
<OButton
|
|
321
408
|
onClick={handleSubmit(onSubmit)}
|
|
322
409
|
text={loginButtonText}
|
|
@@ -369,13 +456,13 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
369
456
|
}
|
|
370
457
|
|
|
371
458
|
{configs && Object.keys(configs).length > 0 && anySocialButtonActivated && (
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
459
|
+
<ButtonsWrapper>
|
|
460
|
+
<OText size={18} mBottom={10} color={theme.colors.disabled}>
|
|
461
|
+
{t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
|
|
462
|
+
</OText>
|
|
463
|
+
<SocialButtons>
|
|
464
|
+
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
465
|
+
configs?.facebook_id?.value && (
|
|
379
466
|
<FacebookLogin
|
|
380
467
|
notificationState={notificationState}
|
|
381
468
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -383,26 +470,26 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
383
470
|
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
384
471
|
/>
|
|
385
472
|
)}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
473
|
+
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
|
|
474
|
+
<GoogleLogin
|
|
475
|
+
notificationState={notificationState}
|
|
476
|
+
webClientId={configs?.google_login_client_id?.value}
|
|
477
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
478
|
+
handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
|
|
479
|
+
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
480
|
+
/>
|
|
481
|
+
)}
|
|
482
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
|
|
483
|
+
<AppleLogin
|
|
484
|
+
notificationState={notificationState}
|
|
485
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
486
|
+
handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
|
|
487
|
+
handleSuccessApple={handleSuccessApple}
|
|
488
|
+
/>
|
|
489
|
+
)}
|
|
490
|
+
</SocialButtons>
|
|
491
|
+
</ButtonsWrapper>
|
|
492
|
+
)}
|
|
406
493
|
|
|
407
494
|
{onNavigationRedirect && registerButtonText && (
|
|
408
495
|
<ButtonsWrapper>
|
|
@@ -440,6 +527,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
440
527
|
export const LoginForm = (props: any) => {
|
|
441
528
|
const loginProps = {
|
|
442
529
|
...props,
|
|
530
|
+
isRecaptchaEnable: true,
|
|
443
531
|
UIComponent: LoginFormUI,
|
|
444
532
|
handleSuccessLogin: () => _removeStoreData('isGuestUser')
|
|
445
533
|
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useTheme } from 'styled-components/native';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import {
|
|
5
|
+
openSettings,
|
|
6
|
+
checkNotifications
|
|
7
|
+
} from 'react-native-permissions';
|
|
8
|
+
import { useLanguage } from 'ordering-components/native'
|
|
9
|
+
import { OBottomPopup, OButton, OText } from '../shared';
|
|
10
|
+
interface NotificationSettingPropsParams {
|
|
11
|
+
checkNotificationStatus: { open: boolean, checked: boolean };
|
|
12
|
+
setCheckNotificationStatus: (notificationStatus: any) => void;
|
|
13
|
+
}
|
|
14
|
+
export const NotificationSetting = (props: NotificationSettingPropsParams) => {
|
|
15
|
+
const { checkNotificationStatus, setCheckNotificationStatus } = props
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const [, t] = useLanguage();
|
|
18
|
+
|
|
19
|
+
const requestLocationPermission = async () => {
|
|
20
|
+
const notificationStatus = await checkNotifications()
|
|
21
|
+
if (notificationStatus?.status === 'blocked') {
|
|
22
|
+
setCheckNotificationStatus({ open: true, checked: false })
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
setCheckNotificationStatus({ open: false, checked: true })
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const callOpenSettings = () => {
|
|
29
|
+
openSettings().catch(() => console.warn('cannot open settings'));
|
|
30
|
+
setCheckNotificationStatus({ open: false, checked: true })
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
requestLocationPermission()
|
|
35
|
+
}, [])
|
|
36
|
+
return (
|
|
37
|
+
<OBottomPopup
|
|
38
|
+
open={checkNotificationStatus?.open}
|
|
39
|
+
onClose={() => setCheckNotificationStatus({ open: false, checked: true })}
|
|
40
|
+
title={t('ENABLE_NOTIFICATIONS', 'Enable notifications')}
|
|
41
|
+
titleStyle={{ textAlign: 'center' }}
|
|
42
|
+
containerStyle={{ borderRadius: 10, borderTopRightRadius: 10, borderTopLeftRadius: 10 }}
|
|
43
|
+
>
|
|
44
|
+
<View style={styles.container}>
|
|
45
|
+
<View style={styles.textContainer}>
|
|
46
|
+
<OText style={{ textAlign: 'center' }}>
|
|
47
|
+
{t('ACTIVE_NOTIFICATION_TO_RECEIVE_INFORMATION', 'Activate notifications to receive information about your orders')}
|
|
48
|
+
</OText>
|
|
49
|
+
</View>
|
|
50
|
+
<OButton
|
|
51
|
+
text={t('ENABLE_NOTIFICATIONS', 'Enable notifications')}
|
|
52
|
+
bgColor={theme.colors.primary}
|
|
53
|
+
borderColor={theme.colors.primary}
|
|
54
|
+
parentStyle={styles.parentStyle}
|
|
55
|
+
style={styles.button}
|
|
56
|
+
textStyle={{ color: 'white' }}
|
|
57
|
+
onClick={() => callOpenSettings()}
|
|
58
|
+
/>
|
|
59
|
+
</View>
|
|
60
|
+
</OBottomPopup>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const styles = StyleSheet.create({
|
|
65
|
+
container: {
|
|
66
|
+
width: '100%',
|
|
67
|
+
textAlign: 'center'
|
|
68
|
+
},
|
|
69
|
+
textContainer: {
|
|
70
|
+
width: '100%',
|
|
71
|
+
paddingHorizontal: 25,
|
|
72
|
+
paddingBottom: 20
|
|
73
|
+
},
|
|
74
|
+
parentStyle: {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
width: '70%',
|
|
77
|
+
marginLeft: 'auto',
|
|
78
|
+
marginRight: 'auto',
|
|
79
|
+
marginBottom: 25
|
|
80
|
+
|
|
81
|
+
},
|
|
82
|
+
button: {
|
|
83
|
+
borderRadius: 5
|
|
84
|
+
}
|
|
85
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
2
|
-
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager } from 'react-native'
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
5
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
@@ -109,7 +109,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
109
109
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
110
110
|
const [openOrderCreating, setOpenOrderCreating] = useState(false)
|
|
111
111
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
112
|
-
const appState = useRef(AppState.currentState)
|
|
113
112
|
|
|
114
113
|
const { order, loading, businessData, error } = props.order
|
|
115
114
|
|
|
@@ -259,24 +258,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
259
258
|
})
|
|
260
259
|
}, [])
|
|
261
260
|
|
|
262
|
-
useEffect(() => {
|
|
263
|
-
const onFocusApp = (nextAppState: any) => {
|
|
264
|
-
if (
|
|
265
|
-
appState.current.match(/inactive|background/) &&
|
|
266
|
-
nextAppState === "active"
|
|
267
|
-
) {
|
|
268
|
-
getOrder && getOrder()
|
|
269
|
-
}
|
|
270
|
-
appState.current = nextAppState;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
AppState.addEventListener("change", onFocusApp);
|
|
274
|
-
return () => {
|
|
275
|
-
AppState.removeEventListener('change', onFocusApp);
|
|
276
|
-
};
|
|
277
|
-
}, [])
|
|
278
|
-
|
|
279
|
-
|
|
280
261
|
return (
|
|
281
262
|
<OrderDetailsContainer keyboardShouldPersistTaps='handled'>
|
|
282
263
|
{order && order?.id && !error && !loading && (
|
|
@@ -400,6 +381,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
400
381
|
<InfoBlock>
|
|
401
382
|
<OText size={18} style={{ textAlign: 'left' }} >{order?.customer?.name} {order?.customer?.lastname}</OText>
|
|
402
383
|
<OText style={{ textAlign: 'left' }}>{order?.customer?.address}</OText>
|
|
384
|
+
{(!!order?.customer?.cellphone) && (
|
|
385
|
+
<OText size={18} style={{ textAlign: 'left' }}>
|
|
386
|
+
{(order?.customer?.country_phone_code) && `+${(order?.customer?.country_phone_code)} `}{(order?.customer?.cellphone)}
|
|
387
|
+
</OText>
|
|
388
|
+
)}
|
|
403
389
|
</InfoBlock>
|
|
404
390
|
</Customer>
|
|
405
391
|
{order?.delivery_option !== undefined && order?.delivery_type === 1 && (
|
|
@@ -102,46 +102,71 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
useEffect(() => {
|
|
105
|
+
const length = orders.filter((order : any) => orderStatus.includes(order.status)).length
|
|
106
|
+
|
|
105
107
|
setOrdersLength && setOrdersLength({
|
|
106
108
|
...ordersLength,
|
|
107
|
-
[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']:
|
|
109
|
+
[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']: length
|
|
108
110
|
})
|
|
109
|
-
|
|
111
|
+
ordersLength[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength'] = length
|
|
112
|
+
}, [orders])
|
|
110
113
|
|
|
111
114
|
useEffect(() => {
|
|
112
|
-
setOrdersFiltered(filterForOrders === 'preorders'
|
|
115
|
+
setOrdersFiltered(filterForOrders === 'preorders'
|
|
116
|
+
? orders.filter((order : any) => order.status === 13)
|
|
117
|
+
: orders.filter((order : any) => orderStatus.includes(order.status) && order.status !== 13)
|
|
118
|
+
)
|
|
113
119
|
}, [filterForOrders, orders])
|
|
114
120
|
|
|
115
121
|
return (
|
|
116
|
-
|
|
122
|
+
<View style={{ marginBottom: 20 }}>
|
|
117
123
|
<OptionTitle>
|
|
118
|
-
{(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
</OText>
|
|
132
|
-
</TouchableOpacity>
|
|
133
|
-
)}
|
|
134
|
-
</>
|
|
124
|
+
<TouchableOpacity onPress={() => setFilterForOrders('active-orders')}>
|
|
125
|
+
<OText size={16} color={filterForOrders === 'active-orders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} mRight={10} >
|
|
126
|
+
{titleContent || (activeOrders
|
|
127
|
+
? t('ACTIVE_ORDERS', 'Active Orders')
|
|
128
|
+
: t('PREVIOUS_ORDERS', 'Previous Orders'))}
|
|
129
|
+
</OText>
|
|
130
|
+
</TouchableOpacity>
|
|
131
|
+
{activeOrders && orders.filter((order : any) => order.status === 13)?.length > 0 && (
|
|
132
|
+
<TouchableOpacity onPress={() => setFilterForOrders('preorders')}>
|
|
133
|
+
<OText size={16} color={filterForOrders === 'preorders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} >
|
|
134
|
+
{t('PREORDERS', 'Preorders')}
|
|
135
|
+
</OText>
|
|
136
|
+
</TouchableOpacity>
|
|
135
137
|
)}
|
|
136
138
|
</OptionTitle>
|
|
137
|
-
{!loading && orders.length
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
{!loading && !error && orders.length > 0 && !isLoadingFirstRender && (
|
|
140
|
+
activeOrders ? (
|
|
141
|
+
<ActiveOrders
|
|
142
|
+
orders={ordersFiltered}
|
|
143
|
+
pagination={pagination}
|
|
144
|
+
loadMoreOrders={loadMoreOrders}
|
|
145
|
+
reorderLoading={reorderLoading}
|
|
146
|
+
customArray={customArray}
|
|
147
|
+
getOrderStatus={getOrderStatus}
|
|
148
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
149
|
+
setScreen={setScreen}
|
|
150
|
+
screen={screen}
|
|
151
|
+
isPreorders={filterForOrders === 'preorders'}
|
|
152
|
+
preordersLength={orders.filter((order : any) => order.status === 13)?.length}
|
|
153
|
+
/>
|
|
154
|
+
) : (
|
|
155
|
+
<PreviousOrders
|
|
156
|
+
reorderLoading={reorderLoading}
|
|
157
|
+
orders={ordersFiltered}
|
|
158
|
+
pagination={pagination}
|
|
159
|
+
loadMoreOrders={loadMoreOrders}
|
|
160
|
+
getOrderStatus={getOrderStatus}
|
|
161
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
162
|
+
handleReorder={handleReorder}
|
|
163
|
+
/>
|
|
164
|
+
)
|
|
143
165
|
)}
|
|
144
|
-
{!loading &&
|
|
166
|
+
{!loading &&
|
|
167
|
+
!isLoadingFirstRender &&
|
|
168
|
+
ordersLength[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength'] === 0 &&
|
|
169
|
+
(
|
|
145
170
|
<NotFoundSource
|
|
146
171
|
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
147
172
|
image={imageFails}
|
|
@@ -179,34 +204,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
179
204
|
)}
|
|
180
205
|
</>
|
|
181
206
|
)}
|
|
182
|
-
|
|
183
|
-
activeOrders ? (
|
|
184
|
-
<ActiveOrders
|
|
185
|
-
orders={ordersFiltered}
|
|
186
|
-
pagination={pagination}
|
|
187
|
-
loadMoreOrders={loadMoreOrders}
|
|
188
|
-
reorderLoading={reorderLoading}
|
|
189
|
-
customArray={customArray}
|
|
190
|
-
getOrderStatus={getOrderStatus}
|
|
191
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
192
|
-
setScreen={setScreen}
|
|
193
|
-
screen={screen}
|
|
194
|
-
isPreorders={filterForOrders === 'preorders'}
|
|
195
|
-
preordersLength={orders.filter((order : any) => order.status === 13)?.length}
|
|
196
|
-
/>
|
|
197
|
-
) : (
|
|
198
|
-
<PreviousOrders
|
|
199
|
-
reorderLoading={reorderLoading}
|
|
200
|
-
orders={ordersFiltered}
|
|
201
|
-
pagination={pagination}
|
|
202
|
-
loadMoreOrders={loadMoreOrders}
|
|
203
|
-
getOrderStatus={getOrderStatus}
|
|
204
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
205
|
-
handleReorder={handleReorder}
|
|
206
|
-
/>
|
|
207
|
-
)
|
|
208
|
-
)}
|
|
209
|
-
</>
|
|
207
|
+
</View>
|
|
210
208
|
)
|
|
211
209
|
}
|
|
212
210
|
|