ordering-ui-react-native 0.12.57 → 0.12.61

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.
Files changed (182) hide show
  1. package/package.json +1 -1
  2. package/src/components/AppleLogin/index.tsx +14 -8
  3. package/themes/doordash/src/components/Cart/index.tsx +1 -0
  4. package/themes/doordash/src/components/LastOrders/index.tsx +1 -1
  5. package/themes/doordash/src/components/OrderSummary/index.tsx +1 -0
  6. package/themes/instacart/src/components/OrderDetails/index.tsx +2 -2
  7. package/themes/single-business/src/components/Cart/index.tsx +127 -16
  8. package/themes/single-business/src/components/Cart/styles.tsx +39 -0
  9. package/themes/single-business/src/components/CartContent/index.tsx +56 -52
  10. package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
  11. package/themes/single-business/src/components/OrderDetails/index.tsx +724 -708
  12. package/themes/single-business/src/components/OrderSummary/index.tsx +189 -154
  13. package/themes/franchises/index.tsx +0 -111
  14. package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
  15. package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
  16. package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
  17. package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
  18. package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
  19. package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
  20. package/themes/franchises/src/components/AddressList/index.tsx +0 -338
  21. package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
  22. package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
  23. package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
  24. package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
  25. package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
  26. package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
  27. package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
  28. package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
  29. package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
  30. package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
  31. package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
  32. package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
  33. package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
  34. package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
  35. package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
  36. package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
  37. package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
  38. package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
  39. package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
  40. package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
  41. package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
  42. package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
  43. package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
  44. package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
  45. package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
  46. package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
  47. package/themes/franchises/src/components/Cart/index.tsx +0 -332
  48. package/themes/franchises/src/components/Cart/styles.tsx +0 -28
  49. package/themes/franchises/src/components/CartContent/index.tsx +0 -60
  50. package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
  51. package/themes/franchises/src/components/Checkout/index.tsx +0 -664
  52. package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
  53. package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
  54. package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
  55. package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
  56. package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
  57. package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
  58. package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
  59. package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
  60. package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
  61. package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
  62. package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
  63. package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
  64. package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
  65. package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
  66. package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
  67. package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
  68. package/themes/franchises/src/components/Help/index.tsx +0 -56
  69. package/themes/franchises/src/components/Help/styles.tsx +0 -11
  70. package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
  71. package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
  72. package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
  73. package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
  74. package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
  75. package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
  76. package/themes/franchises/src/components/Home/index.tsx +0 -102
  77. package/themes/franchises/src/components/Home/styles.tsx +0 -18
  78. package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
  79. package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
  80. package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
  81. package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
  82. package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
  83. package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
  84. package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
  85. package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
  86. package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
  87. package/themes/franchises/src/components/Messages/index.tsx +0 -359
  88. package/themes/franchises/src/components/Messages/styles.tsx +0 -20
  89. package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
  90. package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
  91. package/themes/franchises/src/components/NavBar/index.tsx +0 -129
  92. package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
  93. package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
  94. package/themes/franchises/src/components/Notifications/index.tsx +0 -120
  95. package/themes/franchises/src/components/Notifications/styles.ts +0 -21
  96. package/themes/franchises/src/components/OrderDetails/index.tsx +0 -828
  97. package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
  98. package/themes/franchises/src/components/OrderSummary/index.tsx +0 -266
  99. package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
  100. package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
  101. package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
  102. package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
  103. package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
  104. package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
  105. package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
  106. package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
  107. package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
  108. package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
  109. package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
  110. package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
  111. package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
  112. package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
  113. package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
  114. package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
  115. package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
  116. package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
  117. package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
  118. package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
  119. package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
  120. package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
  121. package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
  122. package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
  123. package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
  124. package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
  125. package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
  126. package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
  127. package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
  128. package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
  129. package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
  130. package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
  131. package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
  132. package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
  133. package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
  134. package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
  135. package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
  136. package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
  137. package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
  138. package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
  139. package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
  140. package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
  141. package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
  142. package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
  143. package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
  144. package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
  145. package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
  146. package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
  147. package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
  148. package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
  149. package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
  150. package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
  151. package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
  152. package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
  153. package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
  154. package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
  155. package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
  156. package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
  157. package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
  158. package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
  159. package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
  160. package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
  161. package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
  162. package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
  163. package/themes/franchises/src/components/shared/OButton.tsx +0 -132
  164. package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
  165. package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
  166. package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
  167. package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
  168. package/themes/franchises/src/components/shared/OInput.tsx +0 -113
  169. package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
  170. package/themes/franchises/src/components/shared/OModal.tsx +0 -172
  171. package/themes/franchises/src/components/shared/OText.tsx +0 -52
  172. package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
  173. package/themes/franchises/src/components/shared/OToast.tsx +0 -93
  174. package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
  175. package/themes/franchises/src/components/shared/index.tsx +0 -29
  176. package/themes/franchises/src/config/constants.tsx +0 -57
  177. package/themes/franchises/src/layouts/Container.tsx +0 -23
  178. package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
  179. package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
  180. package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
  181. package/themes/franchises/src/types/index.tsx +0 -445
  182. package/themes/franchises/src/utils/index.tsx +0 -222
@@ -1,512 +0,0 @@
1
- import React, { useEffect, useState, useRef } from 'react';
2
- import { Pressable, StyleSheet, View, Keyboard } from 'react-native';
3
- import Spinner from 'react-native-loading-spinner-overlay';
4
- import { useForm, Controller } from 'react-hook-form';
5
- import { PhoneInputNumber } from '../PhoneInputNumber';
6
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
7
-
8
- import {
9
- LoginForm as LoginFormController,
10
- useLanguage,
11
- useConfig,
12
- useSession,
13
- ToastType,
14
- useToast,
15
- } from 'ordering-components/native';
16
- import { useTheme } from 'styled-components/native';
17
- import { FacebookLogin } from '../FacebookLogin';
18
- import { VerifyPhone } from '../VerifyPhone';
19
-
20
- import {
21
- Container,
22
- ButtonsWrapper,
23
- LoginWith,
24
- FormSide,
25
- FormInput,
26
- OTabs,
27
- OTab,
28
- SocialButtons,
29
- OrSeparator,
30
- LineSeparator,
31
- SkeletonWrapper,
32
- } from './styles';
33
-
34
- import NavBar from '../NavBar';
35
-
36
- import { OText, OButton, OInput, OModal, OIcon } from '../shared';
37
- import { LoginParams } from '../../types';
38
- import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
39
- import { GoogleLogin } from '../GoogleLogin';
40
- import { AppleLogin } from '../AppleLogin';
41
-
42
- const LoginFormUI = (props: LoginParams) => {
43
- const {
44
- loginTab,
45
- formState,
46
- navigation,
47
- useLoginByEmail,
48
- useLoginByCellphone,
49
- loginButtonText,
50
- forgotButtonText,
51
- verifyPhoneState,
52
- checkPhoneCodeState,
53
- registerButtonText,
54
- setCheckPhoneCodeState,
55
- handleButtonLoginClick,
56
- handleSendVerifyCode,
57
- handleCheckPhoneCode,
58
- onNavigationRedirect,
59
- } = props;
60
-
61
- const [, { showToast }] = useToast();
62
- const [, t] = useLanguage();
63
- const [{ configs }] = useConfig();
64
- const [, { login }] = useSession();
65
- const { control, handleSubmit, errors } = useForm();
66
- const [passwordSee, setPasswordSee] = useState(false);
67
- const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
68
- const [isModalVisible, setIsModalVisible] = useState(false);
69
- const [isFBLoading, setIsFBLoading] = useState(false);
70
- const [phoneInputData, setPhoneInputData] = useState({
71
- error: '',
72
- phone: {
73
- country_phone_code: null,
74
- cellphone: null,
75
- },
76
- });
77
-
78
- const theme = useTheme();
79
-
80
- const loginStyle = StyleSheet.create({
81
- btnOutline: {
82
- backgroundColor: '#FFF',
83
- color: theme.colors.primary,
84
- borderRadius: 7.6,
85
- },
86
- inputStyle: {
87
- marginBottom: 28,
88
- borderWidth: 1,
89
- borderColor: theme.colors.border,
90
- borderRadius: 7.6,
91
- },
92
- line: {
93
- height: 1,
94
- backgroundColor: theme.colors.border,
95
- flexGrow: 1,
96
- marginBottom: 7,
97
- },
98
- });
99
-
100
- const inputRef = useRef<any>({});
101
-
102
- const handleChangeTab = (val: string) => {
103
- props.handleChangeTab(val);
104
- setPasswordSee(false);
105
- };
106
-
107
- const onSubmit = (values: any) => {
108
- Keyboard.dismiss();
109
- if (phoneInputData.error) {
110
- showToast(ToastType.Error, phoneInputData.error);
111
- return;
112
- }
113
- handleButtonLoginClick({
114
- ...values,
115
- ...phoneInputData.phone,
116
- });
117
- };
118
-
119
- const handleVerifyCodeClick = () => {
120
- if (phoneInputData.error) {
121
- showToast(ToastType.Error, phoneInputData.error);
122
- return;
123
- }
124
- if (
125
- !phoneInputData.error &&
126
- !phoneInputData.phone.country_phone_code &&
127
- !phoneInputData.phone.cellphone
128
- ) {
129
- showToast(
130
- ToastType.Error,
131
- t(
132
- 'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
133
- 'The field Mobile phone is required.',
134
- ),
135
- );
136
- return;
137
- }
138
- handleSendVerifyCode && handleSendVerifyCode(phoneInputData.phone);
139
- setIsLoadingVerifyModal(true);
140
- };
141
-
142
- const handleSuccessFacebook = (user: any) => {
143
- login({
144
- user,
145
- token: user.session.access_token,
146
- });
147
- };
148
-
149
- const handleChangeInputEmail = (value: string, onChange: any) => {
150
- onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
151
- };
152
-
153
- useEffect(() => {
154
- if (!formState.loading && formState.result?.error) {
155
- formState.result?.result &&
156
- showToast(
157
- ToastType.Error,
158
- typeof formState.result?.result === 'string'
159
- ? formState.result?.result
160
- : formState.result?.result[0],
161
- );
162
- }
163
- }, [formState]);
164
-
165
- useEffect(() => {
166
- if (verifyPhoneState && !verifyPhoneState?.loading) {
167
- if (verifyPhoneState.result?.error) {
168
- const message =
169
- typeof verifyPhoneState?.result?.result === 'string'
170
- ? verifyPhoneState?.result?.result
171
- : verifyPhoneState?.result?.result[0];
172
- verifyPhoneState.result?.result && showToast(ToastType.Error, message);
173
- setIsLoadingVerifyModal(false);
174
- return;
175
- }
176
-
177
- const okResult = verifyPhoneState.result?.result === 'OK';
178
- if (okResult) {
179
- !isModalVisible && setIsModalVisible(true);
180
- setIsLoadingVerifyModal(false);
181
- }
182
- }
183
- }, [verifyPhoneState]);
184
-
185
- useEffect(() => {
186
- if (Object.keys(errors).length > 0) {
187
- // Convert all errors in one string to show in toast provider
188
- const list = Object.values(errors);
189
- let stringError = '';
190
- if (phoneInputData.error) {
191
- list.unshift({ message: phoneInputData.error });
192
- }
193
- if (
194
- loginTab === 'cellphone' &&
195
- !phoneInputData.error &&
196
- !phoneInputData.phone.country_phone_code &&
197
- !phoneInputData.phone.cellphone
198
- ) {
199
- list.unshift({
200
- message: t(
201
- 'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
202
- 'The field Mobile phone is required.',
203
- ),
204
- });
205
- }
206
- list.map((item: any, i: number) => {
207
- stringError +=
208
- i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
209
- });
210
- showToast(ToastType.Error, stringError);
211
- }
212
- }, [errors]);
213
-
214
- return (
215
- <Container>
216
- <NavBar
217
- title={t('LOGIN', 'Login')}
218
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
219
- showCall={false}
220
- btnStyle={{ paddingLeft: 0 }}
221
- paddingTop={0}
222
- isVertical={true}
223
- />
224
- <FormSide>
225
- {useLoginByEmail && useLoginByCellphone && (
226
- <LoginWith>
227
- <OTabs>
228
- {useLoginByEmail && (
229
- <Pressable onPress={() => handleChangeTab('email')}>
230
- <OTab
231
- style={{
232
- borderBottomColor:
233
- loginTab === 'email'
234
- ? theme.colors.textNormal
235
- : theme.colors.border,
236
- }}>
237
- <OText
238
- size={14}
239
- color={
240
- loginTab === 'email'
241
- ? theme.colors.textNormal
242
- : theme.colors.disabled
243
- }
244
- weight={loginTab === 'email' ? 'bold' : 'normal'}>
245
- {t('BY_EMAIL', 'by Email')}
246
- </OText>
247
- </OTab>
248
- </Pressable>
249
- )}
250
- {useLoginByCellphone && (
251
- <Pressable onPress={() => handleChangeTab('cellphone')}>
252
- <OTab
253
- style={{
254
- borderBottomColor:
255
- loginTab === 'cellphone'
256
- ? theme.colors.textNormal
257
- : theme.colors.border,
258
- }}>
259
- <OText
260
- size={14}
261
- color={
262
- loginTab === 'cellphone'
263
- ? theme.colors.textNormal
264
- : theme.colors.disabled
265
- }
266
- weight={loginTab === 'cellphone' ? 'bold' : 'normal'}>
267
- {t('BY_PHONE', 'by Phone')}
268
- </OText>
269
- </OTab>
270
- </Pressable>
271
- )}
272
- </OTabs>
273
- </LoginWith>
274
- )}
275
-
276
- {(useLoginByCellphone || useLoginByEmail) && (
277
- <FormInput>
278
- {useLoginByEmail && loginTab === 'email' && (
279
- <Controller
280
- control={control}
281
- render={({ onChange, value }: any) => (
282
- <OInput
283
- placeholder={t('EMAIL', 'Email')}
284
- style={loginStyle.inputStyle}
285
- icon={theme.images.general.email}
286
- onChange={(e: any) => {
287
- handleChangeInputEmail(e, onChange);
288
- }}
289
- value={value}
290
- autoCapitalize="none"
291
- autoCorrect={false}
292
- type="email-address"
293
- autoCompleteType="email"
294
- returnKeyType="next"
295
- onSubmitEditing={() => inputRef.current?.focus()}
296
- blurOnSubmit={false}
297
- />
298
- )}
299
- name="email"
300
- rules={{
301
- required: t(
302
- 'VALIDATION_ERROR_EMAIL_REQUIRED',
303
- 'The field Email is required',
304
- ).replace('_attribute_', t('EMAIL', 'Email')),
305
- pattern: {
306
- value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
307
- message: t(
308
- 'INVALID_ERROR_EMAIL',
309
- 'Invalid email address',
310
- ).replace('_attribute_', t('EMAIL', 'Email')),
311
- },
312
- }}
313
- defaultValue=""
314
- />
315
- )}
316
- {useLoginByCellphone && loginTab === 'cellphone' && (
317
- <View style={{ marginBottom: 28 }}>
318
- <PhoneInputNumber
319
- data={phoneInputData}
320
- handleData={(val: any) => setPhoneInputData(val)}
321
- textInputProps={{
322
- returnKeyType: 'next',
323
- onSubmitEditing: () => inputRef?.current?.focus?.(),
324
- }}
325
- />
326
- </View>
327
- )}
328
-
329
- <Controller
330
- control={control}
331
- render={({ onChange, value }: any) => (
332
- <OInput
333
- isSecured={!passwordSee ? true : false}
334
- placeholder={t('PASSWORD', 'Password')}
335
- style={loginStyle.inputStyle}
336
- icon={theme.images.general.lock}
337
- iconCustomRight={
338
- !passwordSee ? (
339
- <MaterialCommunityIcons
340
- name="eye-outline"
341
- size={24}
342
- onPress={() => setPasswordSee(!passwordSee)}
343
- color={theme.colors.disabled}
344
- />
345
- ) : (
346
- <MaterialCommunityIcons
347
- name="eye-off-outline"
348
- size={24}
349
- onPress={() => setPasswordSee(!passwordSee)}
350
- color={theme.colors.disabled}
351
- />
352
- )
353
- }
354
- value={value}
355
- forwardRef={inputRef}
356
- onChange={(val: any) => onChange(val)}
357
- returnKeyType="done"
358
- onSubmitEditing={handleSubmit(onSubmit)}
359
- blurOnSubmit
360
- />
361
- )}
362
- name="password"
363
- rules={{
364
- required: t(
365
- 'VALIDATION_ERROR_PASSWORD_REQUIRED',
366
- 'The field Password is required',
367
- ).replace('_attribute_', t('PASSWORD', 'Password')),
368
- }}
369
- defaultValue=""
370
- />
371
- <OButton
372
- onClick={handleSubmit(onSubmit)}
373
- text={loginButtonText}
374
- bgColor={theme.colors.primary}
375
- borderColor={theme.colors.primary}
376
- textStyle={{ color: 'white' }}
377
- imgRightSrc={null}
378
- isLoading={formState.loading}
379
- style={{ borderRadius: 7.6, marginTop: 10 }}
380
- />
381
- </FormInput>
382
- )}
383
-
384
- {onNavigationRedirect && forgotButtonText && (
385
- <Pressable onPress={() => onNavigationRedirect('Forgot')}>
386
- <OText size={16} mBottom={18}>
387
- {forgotButtonText}
388
- </OText>
389
- </Pressable>
390
- )}
391
-
392
- {useLoginByCellphone &&
393
- loginTab === 'cellphone' &&
394
- configs &&
395
- Object.keys(configs).length > 0 &&
396
- (configs?.twilio_service_enabled?.value === 'true' ||
397
- configs?.twilio_service_enabled?.value === '1') && (
398
- <>
399
- <OrSeparator>
400
- <LineSeparator />
401
- <OText size={18} mRight={20} mLeft={20}>
402
- {t('OR', 'Or')}
403
- </OText>
404
- <LineSeparator />
405
- </OrSeparator>
406
-
407
- <ButtonsWrapper mBottom={20}>
408
- <OButton
409
- onClick={handleVerifyCodeClick}
410
- text={t('GET_VERIFY_CODE', 'Get Verify Code')}
411
- borderColor={theme.colors.primary}
412
- style={loginStyle.btnOutline}
413
- imgRightSrc={null}
414
- isLoading={isLoadingVerifyModal}
415
- indicatorColor={theme.colors.primary}
416
- />
417
- </ButtonsWrapper>
418
- </>
419
- )}
420
-
421
- <View
422
- style={{
423
- flexDirection: 'row',
424
- width: '100%',
425
- justifyContent: 'space-between',
426
- alignItems: 'center',
427
- marginVertical: 30
428
- }}>
429
- <View style={loginStyle.line} />
430
- <OText
431
- size={14}
432
- mBottom={10}
433
- style={{ paddingHorizontal: 19 }}
434
- color={theme.colors.disabled}>
435
- {t('OR', 'or')}
436
- </OText>
437
- <View style={loginStyle.line} />
438
- </View>
439
-
440
- {configs && Object.keys(configs).length > 0 ? (
441
- (configs?.facebook_login?.value === 'true' ||
442
- configs?.facebook_login?.value === '1') &&
443
- configs?.facebook_id?.value && (
444
- <ButtonsWrapper>
445
- <SocialButtons>
446
- <FacebookLogin
447
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
448
- handleLoading={(val: boolean) => setIsFBLoading(val)}
449
- handleSuccessFacebookLogin={handleSuccessFacebook}
450
- />
451
- <GoogleLogin
452
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
453
- handleLoading={(val: boolean) => setIsFBLoading(val)}
454
- handleSuccessFacebookLogin={handleSuccessFacebook}
455
- />
456
- <AppleLogin
457
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
458
- handleLoading={(val: boolean) => setIsFBLoading(val)}
459
- handleSuccessFacebookLogin={handleSuccessFacebook}
460
- />
461
- </SocialButtons>
462
- </ButtonsWrapper>
463
- )
464
- ) : (
465
- <SkeletonWrapper>
466
- <Placeholder Animation={Fade}>
467
- <PlaceholderLine
468
- height={20}
469
- style={{ marginBottom: 15, marginTop: 10 }}
470
- />
471
- <PlaceholderLine
472
- height={50}
473
- style={{ borderRadius: 25, marginBottom: 25 }}
474
- />
475
- </Placeholder>
476
- </SkeletonWrapper>
477
- )}
478
-
479
- {/* {onNavigationRedirect && registerButtonText && (
480
- <ButtonsWrapper>
481
- <OButton
482
- onClick={() => onNavigationRedirect('Signup')}
483
- text={registerButtonText}
484
- style={loginStyle.btnOutline}
485
- borderColor={theme.colors.primary}
486
- imgRightSrc={null}
487
- />
488
- </ButtonsWrapper>
489
- )} */}
490
- </FormSide>
491
- <OModal open={isModalVisible} onClose={() => setIsModalVisible(false)}>
492
- <VerifyPhone
493
- phone={phoneInputData.phone}
494
- verifyPhoneState={verifyPhoneState}
495
- checkPhoneCodeState={checkPhoneCodeState}
496
- handleCheckPhoneCode={handleCheckPhoneCode}
497
- setCheckPhoneCodeState={setCheckPhoneCodeState}
498
- handleVerifyCodeClick={handleVerifyCodeClick}
499
- />
500
- </OModal>
501
- <Spinner visible={isFBLoading} />
502
- </Container>
503
- );
504
- };
505
-
506
- export const LoginForm = (props: any) => {
507
- const loginProps = {
508
- ...props,
509
- UIComponent: LoginFormUI,
510
- };
511
- return <LoginFormController {...loginProps} />;
512
- };
@@ -1,77 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- padding-bottom: 40px;
5
- `
6
-
7
- export const FormSide = styled.View`
8
- display: flex;
9
- width: 100%;
10
- flex-direction: column;
11
- align-items: center;
12
- margin: auto;
13
- `;
14
-
15
- export const OTabs = styled.View`
16
- flex-direction: row;
17
- width: 100%;
18
- flex-wrap: wrap;
19
- justify-content: flex-start;
20
- margin-bottom: -1px;
21
- `;
22
-
23
- export const OTab = styled.View`
24
- padding-bottom: 10px;
25
- border-bottom-width: 1px;
26
- margin-end: 14px;
27
- `;
28
-
29
- export const LoginWith = styled.View`
30
- font-size: 14px;
31
- width: 100%;
32
- align-items: flex-start;
33
- border-bottom-width: 1px;
34
- border-bottom-color: ${(props: any) => props.theme.colors.border}
35
- `;
36
-
37
- export const FormInput = styled.View`
38
- display: flex;
39
- flex-direction: column;
40
- width: 100%;
41
- padding: 40px 0px 15px;
42
- `
43
-
44
- export const ButtonsWrapper = styled.View`
45
- margin: 10px 0px 0px;
46
- width: 100%;
47
- display: flex;
48
- flex-direction: column;
49
-
50
- ${(props: any) => props.mBottom && css`
51
- margin-bottom: ${props.mBottom}px;
52
- `}
53
- `
54
-
55
- export const SocialButtons = styled.View`
56
- width: 100%;
57
- margin: 0px auto 20px;
58
- `
59
-
60
- export const OrSeparator = styled.View`
61
- width: 90%;
62
- display: flex;
63
- flex-direction: row;
64
- justify-content: space-between;
65
- align-items: center;
66
- margin-bottom: 20px;
67
- `
68
-
69
- export const LineSeparator = styled.View`
70
- width: 40%;
71
- height: 1px;
72
- background-color: ${(props: any) => props.theme.colors.disabled};
73
- `
74
-
75
- export const SkeletonWrapper = styled.View`
76
- width: 90%;
77
- `
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { TouchableOpacity } from 'react-native';
3
- import { LogoutAction } from 'ordering-components/native';
4
- import { useTheme } from 'styled-components/native';
5
- import { OIcon, OText } from '../shared';
6
-
7
- const LogoutButtonUI = (props: any) => {
8
- const { handleLogoutClick, text, color } = props
9
- const theme = useTheme();
10
-
11
- return (
12
- <TouchableOpacity
13
- onPress={() => handleLogoutClick()}
14
- style={{ flexDirection: 'row', alignItems: 'center' }}
15
- >
16
- <OIcon
17
- src={theme.images.general.logout}
18
- width={17}
19
- color={color ? color : theme.colors.textNormal}
20
- style={{ marginEnd: 14 }}
21
- />
22
- {text ? <OText weight={'500'} color={color ? color : theme.colors.textNormal}>{text}</OText> : null}
23
- </TouchableOpacity>
24
- )
25
- }
26
-
27
- export const LogoutButton = (props: any) => {
28
- const logoutProps = {
29
- ...props,
30
- isNative: true,
31
- UIComponent: LogoutButtonUI
32
- }
33
- return (
34
- <LogoutAction {...logoutProps} />
35
- )
36
- }