ordering-ui-react-native 0.17.7-release → 0.17.8-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.7-release",
3
+ "version": "0.17.8-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import { View, Pressable, StyleSheet, Linking, Platform, TouchableOpacity, Vibration } from 'react-native';
2
+ import { View, Pressable, StyleSheet, Linking, Platform, TouchableOpacity } from 'react-native';
3
3
  import { useForm, Controller } from 'react-hook-form';
4
4
  import Spinner from 'react-native-loading-spinner-overlay';
5
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
@@ -37,7 +37,7 @@ import Alert from '../../../../../src/providers/AlertProvider'
37
37
  import { OText, OButton, OInput } from '../shared';
38
38
  import { OModal } from '../../../../../src/components/shared';
39
39
  import { SignupParams } from '../../types';
40
- import { sortInputFields } from '../../utils';
40
+ import { sortInputFields, vibrateApp } from '../../utils';
41
41
  import { GoogleLogin } from '../GoogleLogin';
42
42
  import { AppleLogin } from '../AppleLogin';
43
43
 
@@ -246,7 +246,7 @@ const SignupFormUI = (props: SignupParams) => {
246
246
  const onSubmit = (values?: any) => {
247
247
  if (phoneInputData.error && signUpTab !== 'otpEmail') {
248
248
  showToast(ToastType.Error, phoneInputData.error);
249
- Vibration.vibrate()
249
+ vibrateApp()
250
250
  return;
251
251
  }
252
252
  if (
@@ -264,7 +264,7 @@ const SignupFormUI = (props: SignupParams) => {
264
264
  'The field Mobile phone is required.',
265
265
  ),
266
266
  );
267
- Vibration.vibrate()
267
+ vibrateApp()
268
268
  return;
269
269
  }
270
270
  if (signUpTab === 'otpEmail' || signUpTab === 'otpCellphone') {
@@ -323,7 +323,7 @@ const SignupFormUI = (props: SignupParams) => {
323
323
  };
324
324
 
325
325
  const handleChangeInputEmail = (value: string, onChange: any) => {
326
- onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
326
+ onChange(value.toLowerCase().trim().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
327
327
  };
328
328
 
329
329
  const handleOpenTermsUrl = async (url: any) => {
@@ -333,7 +333,7 @@ const SignupFormUI = (props: SignupParams) => {
333
333
  await Linking.openURL(url);
334
334
  } else {
335
335
  showToast(ToastType.Error, t('VALIDATION_ERROR_ACTIVE_URL', 'The _attribute_ is not a valid URL.').replace('_attribute_', t('URL', 'URL')))
336
- Vibration.vibrate()
336
+ vibrateApp()
337
337
  }
338
338
  }
339
339
 
@@ -341,12 +341,12 @@ const SignupFormUI = (props: SignupParams) => {
341
341
  setRecaptchaVerified(false)
342
342
  if (!recaptchaConfig?.siteKey) {
343
343
  showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
344
- Vibration.vibrate()
344
+ vibrateApp()
345
345
  return
346
346
  }
347
347
  if (!recaptchaConfig?.baseUrl) {
348
348
  showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
349
- Vibration.vibrate()
349
+ vibrateApp()
350
350
  return
351
351
  }
352
352
  recaptchaRef.current.open()
@@ -390,11 +390,13 @@ const SignupFormUI = (props: SignupParams) => {
390
390
  baseUrl: configs?.security_recaptcha_base_url?.value || null
391
391
  })
392
392
  showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
393
- Vibration.vibrate()
393
+ vibrateApp()
394
394
  return
395
395
  }
396
- formState.result?.result && showToast(ToastType.Error, formState.result?.result[0]);
397
- formState.result?.result && Vibration.vibrate()
396
+ formState.result?.result && formState.result?.result[0]?.includes("_") ?
397
+ showToast(ToastType.Error, t(`${formState.result?.result[0]}`, 'Phone number already used')) :
398
+ showToast(ToastType.Error, formState.result?.result[0])
399
+ formState.result?.result && vibrateApp()
398
400
  setIsLoadingVerifyModal(false);
399
401
  }
400
402
  }, [formState]);
@@ -402,7 +404,7 @@ const SignupFormUI = (props: SignupParams) => {
402
404
  useEffect(() => {
403
405
  if (Object.keys(errors).length > 0) {
404
406
  setIsLoadingVerifyModal(false);
405
- Vibration.vibrate()
407
+ vibrateApp()
406
408
  }
407
409
  }, [errors])
408
410
 
@@ -431,7 +433,7 @@ const SignupFormUI = (props: SignupParams) => {
431
433
  ? verifyPhoneState?.result?.result
432
434
  : verifyPhoneState?.result?.result[0];
433
435
  verifyPhoneState.result?.result && showToast(ToastType.Error, message);
434
- verifyPhoneState.result?.result && Vibration.vibrate()
436
+ verifyPhoneState.result?.result && vibrateApp()
435
437
  setIsLoadingVerifyModal(false);
436
438
  return;
437
439
  }
@@ -930,7 +932,7 @@ const SignupFormUI = (props: SignupParams) => {
930
932
  (
931
933
  <FacebookLogin
932
934
  notificationState={notificationState}
933
- handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
935
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), vibrateApp() }}
934
936
  handleLoading={(val: boolean) => setIsFBLoading(val)}
935
937
  handleSuccessFacebookLogin={handleSuccessFacebook}
936
938
  />
@@ -939,7 +941,7 @@ const SignupFormUI = (props: SignupParams) => {
939
941
  <GoogleLogin
940
942
  notificationState={notificationState}
941
943
  webClientId={configs?.google_login_client_id?.value}
942
- handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
944
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), vibrateApp() }}
943
945
  handleLoading={(val: boolean) => setIsFBLoading(val)}
944
946
  handleSuccessGoogleLogin={handleSuccessFacebook}
945
947
  />
@@ -947,7 +949,7 @@ const SignupFormUI = (props: SignupParams) => {
947
949
  {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
948
950
  <AppleLogin
949
951
  notificationState={notificationState}
950
- handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
952
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), vibrateApp() }}
951
953
  handleLoading={(val: boolean) => setIsFBLoading(val)}
952
954
  handleSuccessAppleLogin={handleSuccessFacebook}
953
955
  />
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import { View, StyleSheet, ScrollView } from 'react-native';
3
3
  import {
4
4
  PaymentOptionStripe,
@@ -25,6 +25,7 @@ const StripeCardsListUI = (props: any) => {
25
25
  cardSelected,
26
26
  cardsList,
27
27
  handleCardClick,
28
+ setAddCardOpen
28
29
  } = props;
29
30
 
30
31
  const theme = useTheme();
@@ -37,6 +38,12 @@ const StripeCardsListUI = (props: any) => {
37
38
  onSelectCard(card);
38
39
  }
39
40
 
41
+ useEffect(() => {
42
+ if (!cardsList && !cardsList?.loading && cardsList?.cards?.length === 0) {
43
+ setAddCardOpen(true)
44
+ }
45
+ }, [cardsList?.loading])
46
+
40
47
  return (
41
48
  <>
42
49
  {token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (