ordering-ui-react-native 0.15.84 → 0.15.85-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 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +1 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessInformation/index.tsx +14 -0
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +25 -3
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +24 -15
- package/src/components/LoginForm/index.tsx +120 -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/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 +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/StripeMethodForm/index.tsx +22 -24
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/index.tsx +2 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +28 -29
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +100 -60
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/Chat/index.tsx +51 -91
- package/themes/business/src/components/DriverMap/index.tsx +6 -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 +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +17 -7
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +26 -18
- package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
- package/themes/business/src/components/OrdersOption/index.tsx +16 -4
- package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
- 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/OModal.tsx +41 -38
- package/themes/business/src/types/index.tsx +13 -6
- 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 +25 -26
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +10 -11
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +55 -53
- package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/index.tsx +22 -0
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +7 -6
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +6 -8
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +291 -150
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +179 -96
- package/themes/original/src/components/BusinessController/styles.tsx +5 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +185 -120
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +23 -11
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +311 -176
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
- 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 +663 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +104 -462
- package/themes/original/src/components/Cart/index.tsx +83 -38
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +3 -3
- package/themes/original/src/components/Checkout/index.tsx +128 -67
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +13 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +11 -11
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/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/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/Messages/index.tsx +17 -17
- package/themes/original/src/components/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +132 -27
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/NavBar/index.tsx +11 -5
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +164 -81
- package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +73 -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 +2 -35
- package/themes/original/src/components/OrderTypeSelector/index.tsx +78 -35
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +138 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -22
- 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/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +714 -673
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
- package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/Promotions/index.tsx +22 -6
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/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 +13 -5
- package/themes/original/src/components/ServiceForm/index.tsx +579 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/SignupForm/index.tsx +237 -126
- package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +197 -95
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +7 -7
- package/themes/original/src/components/UserDetails/index.tsx +32 -18
- package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
- package/themes/original/src/components/UserProfile/index.tsx +5 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- 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 +177 -163
- 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/components/shared/OModal.tsx +4 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +212 -44
- package/themes/original/src/utils/index.tsx +94 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -18,10 +18,12 @@ import {
|
|
|
18
18
|
} from 'ordering-components/native';
|
|
19
19
|
import { useTheme } from 'styled-components/native';
|
|
20
20
|
import { FormSide, FormInput, SocialButtons } from './styles';
|
|
21
|
+
import { Otp } from '../LoginForm/Otp'
|
|
21
22
|
|
|
22
23
|
import {
|
|
23
24
|
ButtonsWrapper,
|
|
24
25
|
LoginWith as SignupWith,
|
|
26
|
+
TabBtn,
|
|
25
27
|
OTab,
|
|
26
28
|
OTabs,
|
|
27
29
|
RecaptchaButton
|
|
@@ -30,7 +32,9 @@ import {
|
|
|
30
32
|
import NavBar from '../NavBar';
|
|
31
33
|
import { VerifyPhone } from '../VerifyPhone';
|
|
32
34
|
|
|
33
|
-
import
|
|
35
|
+
import Alert from '../../../../../src/providers/AlertProvider'
|
|
36
|
+
import { OText, OButton, OInput } from '../shared';
|
|
37
|
+
import { OModal } from '../../../../../src/components/shared';
|
|
34
38
|
import { SignupParams } from '../../types';
|
|
35
39
|
import { sortInputFields } from '../../utils';
|
|
36
40
|
import { GoogleLogin } from '../GoogleLogin';
|
|
@@ -67,7 +71,18 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
67
71
|
notificationState,
|
|
68
72
|
handleChangePromotions,
|
|
69
73
|
enableReCaptcha,
|
|
70
|
-
handleReCaptcha
|
|
74
|
+
handleReCaptcha,
|
|
75
|
+
generateOtpCode,
|
|
76
|
+
numOtpInputs,
|
|
77
|
+
setWillVerifyOtpState,
|
|
78
|
+
handleChangeInput,
|
|
79
|
+
willVerifyOtpState,
|
|
80
|
+
setOtpState,
|
|
81
|
+
setSignUpTab,
|
|
82
|
+
signUpTab,
|
|
83
|
+
useSignUpFullDetails,
|
|
84
|
+
useSignUpOtpEmail,
|
|
85
|
+
useSignUpOtpCellphone
|
|
71
86
|
} = props;
|
|
72
87
|
|
|
73
88
|
const theme = useTheme();
|
|
@@ -104,15 +119,12 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
104
119
|
const [, t] = useLanguage();
|
|
105
120
|
const [, { login }] = useSession();
|
|
106
121
|
const [{ configs }] = useConfig();
|
|
107
|
-
const { control, handleSubmit, errors, register, setValue } = useForm();
|
|
122
|
+
const { control, handleSubmit, clearErrors, errors, register, unregister, setValue } = useForm();
|
|
108
123
|
|
|
109
124
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
110
125
|
const [formValues, setFormValues] = useState(null);
|
|
111
126
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
112
127
|
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
113
|
-
const [signupTab, setSignupTab] = useState(
|
|
114
|
-
useSignupByCellphone && !useSignupByEmail ? 'cellphone' : 'email',
|
|
115
|
-
);
|
|
116
128
|
const [isFBLoading, setIsFBLoading] = useState(false);
|
|
117
129
|
const [phoneInputData, setPhoneInputData] = useState({
|
|
118
130
|
error: '',
|
|
@@ -122,9 +134,12 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
122
134
|
country_code: null
|
|
123
135
|
},
|
|
124
136
|
});
|
|
137
|
+
const [alertState, setAlertState] = useState({ open: false, title: '', content: [] })
|
|
125
138
|
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
126
139
|
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
140
|
+
const [tabLayouts, setTabLayouts] = useState<any>({})
|
|
127
141
|
|
|
142
|
+
const tabsRef = useRef<any>(null)
|
|
128
143
|
const nameRef = useRef<any>(null);
|
|
129
144
|
const lastnameRef = useRef<any>(null);
|
|
130
145
|
const middleNameRef = useRef<any>(null);
|
|
@@ -135,6 +150,17 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
135
150
|
const recaptchaRef = useRef<any>({});
|
|
136
151
|
|
|
137
152
|
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
153
|
+
const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
|
|
154
|
+
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
|
|
155
|
+
const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
|
|
156
|
+
|
|
157
|
+
const closeAlert = () => {
|
|
158
|
+
setAlertState({
|
|
159
|
+
open: false,
|
|
160
|
+
title: '',
|
|
161
|
+
content: []
|
|
162
|
+
})
|
|
163
|
+
}
|
|
138
164
|
|
|
139
165
|
const handleRefs = (ref: any, code: string) => {
|
|
140
166
|
switch (code) {
|
|
@@ -160,6 +186,13 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
160
186
|
}
|
|
161
187
|
};
|
|
162
188
|
|
|
189
|
+
const handleOnLayout = (event: any, opc: string) => {
|
|
190
|
+
const _tabLayouts = { ...tabLayouts }
|
|
191
|
+
const categoryKey = opc
|
|
192
|
+
_tabLayouts[categoryKey] = event.nativeEvent.layout
|
|
193
|
+
setTabLayouts(_tabLayouts)
|
|
194
|
+
}
|
|
195
|
+
|
|
163
196
|
const handleFocusRef = (code: string) => {
|
|
164
197
|
switch (code) {
|
|
165
198
|
case 'name': {
|
|
@@ -203,13 +236,13 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
203
236
|
navigation.navigate('Home');
|
|
204
237
|
};
|
|
205
238
|
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
239
|
+
const handleSignUpTab = (tab: string) => {
|
|
240
|
+
setSignUpTab && setSignUpTab(tab)
|
|
241
|
+
clearErrors()
|
|
242
|
+
}
|
|
210
243
|
|
|
211
|
-
const onSubmit = (values
|
|
212
|
-
if (phoneInputData.error) {
|
|
244
|
+
const onSubmit = (values?: any) => {
|
|
245
|
+
if (phoneInputData.error && signUpTab !== 'otpEmail') {
|
|
213
246
|
showToast(ToastType.Error, phoneInputData.error);
|
|
214
247
|
return;
|
|
215
248
|
}
|
|
@@ -218,7 +251,8 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
218
251
|
!phoneInputData.phone.cellphone &&
|
|
219
252
|
((validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
220
253
|
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
221
|
-
configs?.verification_phone_required?.value === '1')
|
|
254
|
+
configs?.verification_phone_required?.value === '1') &&
|
|
255
|
+
signUpTab !== 'otpEmail'
|
|
222
256
|
) {
|
|
223
257
|
showToast(
|
|
224
258
|
ToastType.Error,
|
|
@@ -229,26 +263,29 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
229
263
|
);
|
|
230
264
|
return;
|
|
231
265
|
}
|
|
232
|
-
if (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
266
|
+
if (signUpTab === 'otpEmail' || signUpTab === 'otpCellphone') {
|
|
267
|
+
generateOtpCode && generateOtpCode({
|
|
268
|
+
...values,
|
|
269
|
+
...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && { ...phoneInputData.phone }),
|
|
270
|
+
country_code: phoneInputData.phone.country_code
|
|
271
|
+
})
|
|
272
|
+
return
|
|
273
|
+
}
|
|
274
|
+
handleButtonSignupClick &&
|
|
275
|
+
handleButtonSignupClick({
|
|
276
|
+
...values,
|
|
277
|
+
...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && { ...phoneInputData.phone }),
|
|
278
|
+
country_code: phoneInputData.phone.country_code
|
|
279
|
+
});
|
|
280
|
+
if (!formState.loading && formState.result.result && !formState.result.error) {
|
|
281
|
+
handleSuccessSignup && handleSuccessSignup(formState.result.result);
|
|
247
282
|
}
|
|
248
|
-
setFormValues(values);
|
|
249
|
-
handleVerifyCodeClick(values);
|
|
250
283
|
};
|
|
251
284
|
|
|
285
|
+
const handleSingUpOtp = (value: string) => {
|
|
286
|
+
setOtpState && setOtpState(value)
|
|
287
|
+
}
|
|
288
|
+
|
|
252
289
|
const handleVerifyCodeClick = (values: any) => {
|
|
253
290
|
const formData = values || formValues;
|
|
254
291
|
handleSendVerifyCode &&
|
|
@@ -310,7 +347,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
310
347
|
|
|
311
348
|
const onRecaptchaVerify = (token: any) => {
|
|
312
349
|
setRecaptchaVerified(true)
|
|
313
|
-
handleReCaptcha(token)
|
|
350
|
+
handleReCaptcha && handleReCaptcha(token)
|
|
314
351
|
}
|
|
315
352
|
|
|
316
353
|
useEffect(() => {
|
|
@@ -334,15 +371,19 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
334
371
|
if (Object.keys(errors).length > 0) {
|
|
335
372
|
setIsLoadingVerifyModal(false);
|
|
336
373
|
}
|
|
337
|
-
}, [errors])
|
|
374
|
+
}, [errors])
|
|
338
375
|
|
|
339
376
|
useEffect(() => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
377
|
+
if (signUpTab === 'default' || signUpTab === 'otpCellphone') {
|
|
378
|
+
register('cellphone', {
|
|
379
|
+
required: isRequiredField('cellphone')
|
|
380
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
381
|
+
: null
|
|
382
|
+
})
|
|
383
|
+
} else {
|
|
384
|
+
unregister('cellphone')
|
|
385
|
+
}
|
|
386
|
+
}, [signUpTab])
|
|
346
387
|
|
|
347
388
|
useEffect(() => {
|
|
348
389
|
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
@@ -379,6 +420,16 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
379
420
|
})
|
|
380
421
|
}, [configs])
|
|
381
422
|
|
|
423
|
+
useEffect(() => {
|
|
424
|
+
if (checkPhoneCodeState?.result?.error) {
|
|
425
|
+
setAlertState({
|
|
426
|
+
open: true,
|
|
427
|
+
title: (typeof checkPhoneCodeState?.result?.result === 'string' ? checkPhoneCodeState?.result?.result : checkPhoneCodeState?.result?.result[0].toString()) || t('ERROR', 'Error'),
|
|
428
|
+
content: []
|
|
429
|
+
})
|
|
430
|
+
}
|
|
431
|
+
}, [checkPhoneCodeState])
|
|
432
|
+
|
|
382
433
|
return (
|
|
383
434
|
<View>
|
|
384
435
|
<NavBar
|
|
@@ -392,47 +443,92 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
392
443
|
titleStyle={{ marginLeft: 0, marginRight: 0 }}
|
|
393
444
|
/>
|
|
394
445
|
<FormSide>
|
|
395
|
-
{
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
446
|
+
{((Number(useSignUpFullDetails) + Number(useSignUpOtpEmail) + Number(useSignUpOtpCellphone)) > 1) && (
|
|
447
|
+
<SignupWith>
|
|
448
|
+
<OTabs
|
|
449
|
+
horizontal
|
|
450
|
+
showsHorizontalScrollIndicator={false}
|
|
451
|
+
ref={tabsRef}
|
|
452
|
+
>
|
|
453
|
+
{useSignUpFullDetails && (
|
|
454
|
+
<TabBtn
|
|
455
|
+
onPress={() => handleSignUpTab('default')}
|
|
456
|
+
onLayout={(event: any) => handleOnLayout(event, 'default')}
|
|
457
|
+
>
|
|
458
|
+
<OTab
|
|
459
|
+
style={{
|
|
460
|
+
borderBottomColor:
|
|
461
|
+
signUpTab === 'default'
|
|
462
|
+
? theme.colors.textNormal
|
|
463
|
+
: theme.colors.border,
|
|
464
|
+
}}>
|
|
465
|
+
<OText
|
|
466
|
+
size={14}
|
|
467
|
+
color={
|
|
468
|
+
signUpTab === 'default'
|
|
469
|
+
? theme.colors.textNormal
|
|
470
|
+
: theme.colors.disabled
|
|
471
|
+
}
|
|
472
|
+
weight={signUpTab === 'default' ? 'bold' : 'normal'}>
|
|
473
|
+
{t('DEFAULT', 'Default')}
|
|
474
|
+
</OText>
|
|
475
|
+
</OTab>
|
|
476
|
+
</TabBtn>
|
|
477
|
+
)}
|
|
478
|
+
{useSignUpOtpEmail && (
|
|
479
|
+
<TabBtn
|
|
480
|
+
onPress={() => handleSignUpTab('otpEmail')}
|
|
481
|
+
onLayout={(event: any) => handleOnLayout(event, 'otpEmail')}
|
|
482
|
+
>
|
|
483
|
+
<OTab
|
|
484
|
+
style={{
|
|
485
|
+
borderBottomColor:
|
|
486
|
+
signUpTab === 'otpEmail'
|
|
487
|
+
? theme.colors.textNormal
|
|
488
|
+
: theme.colors.border,
|
|
489
|
+
}}>
|
|
490
|
+
<OText
|
|
491
|
+
size={14}
|
|
492
|
+
color={
|
|
493
|
+
signUpTab === 'otpEmail'
|
|
494
|
+
? theme.colors.textNormal
|
|
495
|
+
: theme.colors.disabled
|
|
496
|
+
}
|
|
497
|
+
weight={signUpTab === 'otpEmail' ? 'bold' : 'normal'}>
|
|
498
|
+
{t('BY_OTP_EMAIL', 'by Otp Email')}
|
|
499
|
+
</OText>
|
|
500
|
+
</OTab>
|
|
501
|
+
</TabBtn>
|
|
502
|
+
|
|
503
|
+
)}
|
|
504
|
+
{useSignUpOtpCellphone && (
|
|
505
|
+
<TabBtn
|
|
506
|
+
onPress={() => handleSignUpTab('otpCellphone')}
|
|
507
|
+
onLayout={(event: any) => handleOnLayout(event, 'otpCellphone')}
|
|
508
|
+
>
|
|
509
|
+
<OTab
|
|
510
|
+
style={{
|
|
511
|
+
borderBottomColor:
|
|
512
|
+
signUpTab === 'otpCellphone'
|
|
513
|
+
? theme.colors.textNormal
|
|
514
|
+
: theme.colors.border,
|
|
515
|
+
}}>
|
|
516
|
+
<OText
|
|
517
|
+
size={14}
|
|
518
|
+
color={
|
|
519
|
+
signUpTab === 'otpCellphone'
|
|
520
|
+
? theme.colors.textNormal
|
|
521
|
+
: theme.colors.disabled
|
|
522
|
+
}
|
|
523
|
+
weight={signUpTab === 'otpCellphone' ? 'bold' : 'normal'}>
|
|
524
|
+
{t('BY_OTP_CELLPHONE', 'by Otp Cellphone')}
|
|
525
|
+
</OText>
|
|
526
|
+
</OTab>
|
|
527
|
+
</TabBtn>
|
|
528
|
+
)}
|
|
529
|
+
</OTabs>
|
|
530
|
+
</SignupWith>
|
|
531
|
+
)}
|
|
436
532
|
<FormInput>
|
|
437
533
|
{!(useChekoutFileds && validationFields?.loading) ? (
|
|
438
534
|
<>
|
|
@@ -442,7 +538,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
442
538
|
(field: any, i: number) =>
|
|
443
539
|
!notValidationFields.includes(field.code) &&
|
|
444
540
|
showField &&
|
|
445
|
-
showField(field.code) &&
|
|
541
|
+
showField(field.code) &&
|
|
542
|
+
(signUpTab === 'default' ||
|
|
543
|
+
(signUpTab === 'otpEmail' && field.code === 'email')) && (
|
|
446
544
|
<React.Fragment key={field.id}>
|
|
447
545
|
{errors?.[`${field.code}`] && (
|
|
448
546
|
<OText
|
|
@@ -466,7 +564,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
466
564
|
value={value}
|
|
467
565
|
onChange={(val: any) =>
|
|
468
566
|
field.code !== 'email'
|
|
469
|
-
? onChange(val)
|
|
567
|
+
? (onChange(val))
|
|
470
568
|
: handleChangeInputEmail(val, onChange)
|
|
471
569
|
}
|
|
472
570
|
autoCapitalize={
|
|
@@ -498,7 +596,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
498
596
|
),
|
|
499
597
|
)}
|
|
500
598
|
|
|
501
|
-
{!!showInputPhoneNumber && (
|
|
599
|
+
{(!!showInputPhoneNumber && (signUpTab === 'default' || signUpTab === 'otpCellphone')) && (
|
|
502
600
|
<View style={{ marginBottom: 25 }}>
|
|
503
601
|
<PhoneInputNumber
|
|
504
602
|
data={phoneInputData}
|
|
@@ -561,34 +659,34 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
561
659
|
/>
|
|
562
660
|
</>
|
|
563
661
|
)}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
662
|
+
{(signUpTab === 'default') && (
|
|
663
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20 }}>
|
|
664
|
+
<Controller
|
|
665
|
+
control={control}
|
|
666
|
+
render={({ onChange, value }: any) => (
|
|
667
|
+
<CheckBox
|
|
668
|
+
value={value}
|
|
669
|
+
onValueChange={newValue => {
|
|
670
|
+
onChange(newValue)
|
|
671
|
+
handleChangePromotions()
|
|
672
|
+
}}
|
|
673
|
+
boxType={'square'}
|
|
674
|
+
tintColors={{
|
|
675
|
+
true: theme.colors.primary,
|
|
676
|
+
false: theme.colors.disabled
|
|
677
|
+
}}
|
|
678
|
+
tintColor={theme.colors.disabled}
|
|
679
|
+
onCheckColor={theme.colors.primary}
|
|
680
|
+
onTintColor={theme.colors.primary}
|
|
681
|
+
style={Platform.OS === 'ios' && style.checkBoxStyle}
|
|
682
|
+
/>
|
|
683
|
+
)}
|
|
684
|
+
name='promotions'
|
|
685
|
+
defaultValue={false}
|
|
686
|
+
/>
|
|
687
|
+
<OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
|
|
688
|
+
</View>
|
|
689
|
+
)}
|
|
592
690
|
{configs?.terms_and_conditions?.value === 'true' && (
|
|
593
691
|
<>
|
|
594
692
|
{errors?.termsAccept && (
|
|
@@ -640,7 +738,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
640
738
|
|
|
641
739
|
)}
|
|
642
740
|
|
|
643
|
-
{
|
|
741
|
+
{signUpTab === 'default' && (
|
|
644
742
|
<>
|
|
645
743
|
{errors?.password && (
|
|
646
744
|
<OText
|
|
@@ -712,9 +810,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
712
810
|
<Spinner visible />
|
|
713
811
|
)}
|
|
714
812
|
|
|
715
|
-
{
|
|
716
|
-
useSignupByEmail &&
|
|
717
|
-
useSignupByCellphone ? (
|
|
813
|
+
{(signUpTab === 'otpEmail' || signUpTab === 'otpCellphone') ? (
|
|
718
814
|
<OButton
|
|
719
815
|
onClick={handleSubmit(onSubmit)}
|
|
720
816
|
text={t('GET_VERIFY_CODE', 'Get Verify Code')}
|
|
@@ -779,7 +875,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
779
875
|
<ButtonsWrapper>
|
|
780
876
|
<SocialButtons>
|
|
781
877
|
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
782
|
-
configs?.facebook_id?.value &&
|
|
878
|
+
configs?.facebook_id?.value &&
|
|
879
|
+
facebookLoginEnabled &&
|
|
880
|
+
(
|
|
783
881
|
<FacebookLogin
|
|
784
882
|
notificationState={notificationState}
|
|
785
883
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -787,7 +885,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
787
885
|
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
788
886
|
/>
|
|
789
887
|
)}
|
|
790
|
-
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
|
|
888
|
+
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
|
|
791
889
|
<GoogleLogin
|
|
792
890
|
notificationState={notificationState}
|
|
793
891
|
webClientId={configs?.google_login_client_id?.value}
|
|
@@ -796,7 +894,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
796
894
|
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
797
895
|
/>
|
|
798
896
|
)}
|
|
799
|
-
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
|
|
897
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
|
|
800
898
|
<AppleLogin
|
|
801
899
|
notificationState={notificationState}
|
|
802
900
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -810,27 +908,40 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
810
908
|
)}
|
|
811
909
|
|
|
812
910
|
</FormSide>
|
|
813
|
-
<OModal
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
911
|
+
<OModal
|
|
912
|
+
open={willVerifyOtpState}
|
|
913
|
+
onClose={() => setWillVerifyOtpState && setWillVerifyOtpState(false)}
|
|
914
|
+
entireModal
|
|
915
|
+
title={t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
|
|
916
|
+
>
|
|
917
|
+
<Otp
|
|
918
|
+
pinCount={numOtpInputs || 6}
|
|
919
|
+
willVerifyOtpState={willVerifyOtpState || false}
|
|
920
|
+
setWillVerifyOtpState={() => setWillVerifyOtpState && setWillVerifyOtpState(false)}
|
|
921
|
+
handleLoginOtp={handleSingUpOtp}
|
|
922
|
+
onSubmit={onSubmit}
|
|
923
|
+
setAlertState={setAlertState}
|
|
822
924
|
/>
|
|
823
925
|
</OModal>
|
|
824
926
|
<Spinner
|
|
825
927
|
visible={formState.loading || validationFields.loading || isFBLoading}
|
|
826
928
|
/>
|
|
929
|
+
<Alert
|
|
930
|
+
open={alertState.open}
|
|
931
|
+
content={alertState.content}
|
|
932
|
+
title={alertState.title || ''}
|
|
933
|
+
onAccept={closeAlert}
|
|
934
|
+
onClose={closeAlert}
|
|
935
|
+
/>
|
|
827
936
|
</View>
|
|
828
937
|
);
|
|
829
938
|
};
|
|
830
939
|
|
|
831
940
|
export const SignupForm = (props: any) => {
|
|
941
|
+
const _numOtpInputs = 6
|
|
832
942
|
const signupProps = {
|
|
833
943
|
...props,
|
|
944
|
+
numOtpInputs: _numOtpInputs,
|
|
834
945
|
isRecaptchaEnable: true,
|
|
835
946
|
UIComponent: SignupFormUI,
|
|
836
947
|
};
|