ordering-ui-react-native 0.17.56 → 0.17.58

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.56",
3
+ "version": "0.17.58",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -469,7 +469,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
469
469
  <HeaderWrapper
470
470
  source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
471
471
  style={{ paddingTop: top + 20 }}
472
- resizeMode='stretch'
472
+ resizeMode='cover'
473
473
  >
474
474
  {!auth && (
475
475
 
@@ -60,9 +60,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
60
60
 
61
61
  export const HeaderWrapper = styled.ImageBackground`
62
62
  width: 100%;
63
- height: 5%;
64
- min-height: 270px;
65
- max-height: 400px;
63
+ height: 270px;
66
64
  padding: 20px 40px;
67
65
  background-color: transparent;
68
66
  `;
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager } from 'react-native';
2
+ import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, Vibration } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
4
  import Picker from 'react-native-country-picker-modal';
5
5
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
@@ -87,7 +87,8 @@ const CheckoutUI = (props: any) => {
87
87
  instructionsOptions,
88
88
  handleChangeDeliveryOption,
89
89
  currency,
90
- merchantId
90
+ merchantId,
91
+ setPlaceSpotNumber
91
92
  } = props
92
93
 
93
94
  const theme = useTheme();
@@ -611,6 +612,7 @@ const CheckoutUI = (props: any) => {
611
612
  isInputMode
612
613
  cart={cart}
613
614
  spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
615
+ setPlaceSpotNumber={setPlaceSpotNumber}
614
616
  vehicleDefault={cart?.vehicle}
615
617
  />
616
618
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
@@ -758,7 +760,7 @@ const CheckoutUI = (props: any) => {
758
760
  </Container>
759
761
  {!cartState.loading && cart && cart?.status !== 2 && (
760
762
  <FloatingButton
761
- handleClick={() => handlePlaceOrder(null)}
763
+ handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
762
764
  isSecondaryBtn={isDisabledButtonPlace}
763
765
  disabled={isDisabledButtonPlace}
764
766
  btnText={subtotalWithTaxes >= cart?.minimum
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
- import { StyleSheet, View, Keyboard } from 'react-native';
2
+ import { StyleSheet, View, Keyboard, Vibration } from 'react-native';
3
3
  import Spinner from 'react-native-loading-spinner-overlay';
4
4
  import { useForm, Controller } from 'react-hook-form';
5
5
  import { PhoneInputNumber } from '../PhoneInputNumber';
@@ -165,6 +165,7 @@ const LoginFormUI = (props: LoginParams) => {
165
165
  if (loginTab === 'otp') {
166
166
  if (phoneInputData.error && (loginTab !== 'otp' || (otpType === 'cellphone' && loginTab === 'otp'))) {
167
167
  showToast(ToastType.Error, t('INVALID_PHONE_NUMBER', 'Invalid phone number'));
168
+ Vibration.vibrate()
168
169
  return
169
170
  }
170
171
  if (loginTab === 'otp') {
@@ -177,6 +178,7 @@ const LoginFormUI = (props: LoginParams) => {
177
178
  } else {
178
179
  if (phoneInputData.error) {
179
180
  showToast(ToastType.Error, phoneInputData.error);
181
+ Vibration.vibrate()
180
182
  return;
181
183
  }
182
184
  handleButtonLoginClick({
@@ -189,6 +191,7 @@ const LoginFormUI = (props: LoginParams) => {
189
191
  const handleVerifyCodeClick = () => {
190
192
  if (phoneInputData.error) {
191
193
  showToast(ToastType.Error, phoneInputData.error);
194
+ Vibration.vibrate()
192
195
  return;
193
196
  }
194
197
  if (
@@ -203,6 +206,7 @@ const LoginFormUI = (props: LoginParams) => {
203
206
  'The field Mobile phone is required.',
204
207
  ),
205
208
  );
209
+ Vibration.vibrate()
206
210
  return;
207
211
  }
208
212
  handleSendVerifyCode && handleSendVerifyCode(phoneInputData.phone);
@@ -224,10 +228,12 @@ const LoginFormUI = (props: LoginParams) => {
224
228
  setRecaptchaVerified(false)
225
229
  if (!recaptchaConfig?.siteKey) {
226
230
  showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
231
+ Vibration.vibrate()
227
232
  return
228
233
  }
229
234
  if (!recaptchaConfig?.baseUrl) {
230
235
  showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
236
+ Vibration.vibrate()
231
237
  return
232
238
  }
233
239
 
@@ -304,6 +310,7 @@ const LoginFormUI = (props: LoginParams) => {
304
310
  baseUrl: configs?.security_recaptcha_base_url?.value || null
305
311
  })
306
312
  showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
313
+ Vibration.vibrate()
307
314
  return
308
315
  }
309
316
  formState.result?.result &&
@@ -313,6 +320,7 @@ const LoginFormUI = (props: LoginParams) => {
313
320
  ? formState.result?.result
314
321
  : formState.result?.result[0],
315
322
  );
323
+ formState.result?.result && Vibration.vibrate()
316
324
  }
317
325
  }, [formState]);
318
326
 
@@ -324,6 +332,7 @@ const LoginFormUI = (props: LoginParams) => {
324
332
  ? verifyPhoneState?.result?.result
325
333
  : verifyPhoneState?.result?.result[0];
326
334
  verifyPhoneState.result?.result && showToast(ToastType.Error, message);
335
+ verifyPhoneState.result?.result && Vibration.vibrate();
327
336
  setIsLoadingVerifyModal(false);
328
337
  return;
329
338
  }
@@ -363,6 +372,10 @@ const LoginFormUI = (props: LoginParams) => {
363
372
  }
364
373
  }, [checkPhoneCodeState])
365
374
 
375
+ useEffect(() => {
376
+ if (!!Object.values(errors)?.length) Vibration.vibrate()
377
+ }, [errors])
378
+
366
379
  return (
367
380
  <Container>
368
381
  <NavBar
@@ -720,8 +733,8 @@ const LoginFormUI = (props: LoginParams) => {
720
733
 
721
734
  {configs && Object.keys(configs).length > 0 ? (
722
735
  (((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value && facebookLoginEnabled) ||
723
- ((configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled) ||
724
- ((configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled)) &&
736
+ ((configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled) ||
737
+ ((configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled)) &&
725
738
  (
726
739
  <>
727
740
  <View
@@ -749,7 +762,7 @@ const LoginFormUI = (props: LoginParams) => {
749
762
  facebookLoginEnabled && (
750
763
  <FacebookLogin
751
764
  notificationState={notificationState}
752
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
765
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
753
766
  handleLoading={(val: boolean) => setIsFBLoading(val)}
754
767
  handleSuccessFacebookLogin={handleSuccessFacebook}
755
768
  />
@@ -758,7 +771,7 @@ const LoginFormUI = (props: LoginParams) => {
758
771
  <GoogleLogin
759
772
  notificationState={notificationState}
760
773
  webClientId={configs?.google_login_client_id?.value}
761
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
774
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
762
775
  handleLoading={(val: boolean) => setIsFBLoading(val)}
763
776
  handleSuccessGoogleLogin={handleSuccessFacebook}
764
777
  />
@@ -766,7 +779,7 @@ const LoginFormUI = (props: LoginParams) => {
766
779
  {(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && appleLoginEnabled && (
767
780
  <AppleLogin
768
781
  notificationState={notificationState}
769
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
782
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
770
783
  handleLoading={(val: boolean) => setIsFBLoading(val)}
771
784
  handleSuccessAppleLogin={handleSuccessFacebook}
772
785
  />
@@ -23,13 +23,14 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
23
23
  isInputMode,
24
24
  setSpotNumber,
25
25
  setVehicle,
26
- handleChangeSpot
26
+ handleChangeSpot,
27
+ setPlaceSpotNumber
27
28
  } = props
28
29
 
29
30
  const theme = useTheme()
30
31
  const [, t] = useLanguage()
31
32
  const [orderState] = useOrder()
32
- const [, { showToast }] = useToast();
33
+ const [, { showToast }] = useToast();
33
34
 
34
35
  const [placeGroupSelected, setPlaceGroupSelected] = useState<any>(null)
35
36
  const vehicleInputAllowed = [4, 5]
@@ -135,10 +136,15 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
135
136
  useEffect(() => {
136
137
  if (spotState?.error?.length > 0) {
137
138
  const errorText = manageErrorsToShow(spotState?.error)
138
- showToast(ToastType.Error, errorText)
139
+ showToast(ToastType.Error, errorText)
139
140
  }
140
141
  }, [spotState?.error])
141
142
 
143
+ const onChangePlaceSpot = (value: string) => {
144
+ setSpotNumber(value)
145
+ setPlaceSpotNumber(value)
146
+ }
147
+
142
148
  return (
143
149
  <PlaceSpotContainer>
144
150
  {isInputMode ? (
@@ -220,12 +226,12 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
220
226
  value={spotNumber?.toString() ?? ''}
221
227
  placeholder={placeholderText}
222
228
  type='number-pad'
223
- onChange={(value: string) => setSpotNumber(value)}
229
+ onChange={(value: string) => onChangePlaceSpot(value)}
224
230
  style={{
225
231
  borderColor: theme.colors.border,
226
232
  borderRadius: 7.6
227
233
  }}
228
- inputStyle={{ fontSize: 12, color: theme.colors.textNormal }}
234
+ inputStyle={{ fontSize: 12, color: theme.colors.textNormal }}
229
235
  />
230
236
  <View style={{ alignItems: 'flex-start' }}>
231
237
  <OButton
@@ -278,7 +284,7 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
278
284
  onSelect={(place: any) => handlerChangePlace(place)}
279
285
  placeholder={t('SELECT_YOUR_SPOT', 'Select your spot')}
280
286
  options={getPlaces()}
281
- defaultValue={placesState?.places?.find((place : any) => place?.id === cart?.place_id)}
287
+ defaultValue={placesState?.places?.find((place: any) => place?.id === cart?.place_id)}
282
288
  isModal
283
289
  />
284
290
  </View>
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import { View, Pressable, StyleSheet, Linking, Platform, TouchableOpacity } from 'react-native';
2
+ import { View, Pressable, StyleSheet, Linking, Platform, TouchableOpacity, Vibration } 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';
@@ -245,6 +245,7 @@ const SignupFormUI = (props: SignupParams) => {
245
245
  const onSubmit = (values?: any) => {
246
246
  if (phoneInputData.error && signUpTab !== 'otpEmail') {
247
247
  showToast(ToastType.Error, phoneInputData.error);
248
+ Vibration.vibrate()
248
249
  return;
249
250
  }
250
251
  if (
@@ -262,6 +263,7 @@ const SignupFormUI = (props: SignupParams) => {
262
263
  'The field Mobile phone is required.',
263
264
  ),
264
265
  );
266
+ Vibration.vibrate()
265
267
  return;
266
268
  }
267
269
  if (signUpTab === 'otpEmail' || signUpTab === 'otpCellphone') {
@@ -330,6 +332,7 @@ const SignupFormUI = (props: SignupParams) => {
330
332
  await Linking.openURL(url);
331
333
  } else {
332
334
  showToast(ToastType.Error, t('VALIDATION_ERROR_ACTIVE_URL', 'The _attribute_ is not a valid URL.').replace('_attribute_', t('URL', 'URL')))
335
+ Vibration.vibrate()
333
336
  }
334
337
  }
335
338
 
@@ -337,10 +340,12 @@ const SignupFormUI = (props: SignupParams) => {
337
340
  setRecaptchaVerified(false)
338
341
  if (!recaptchaConfig?.siteKey) {
339
342
  showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
343
+ Vibration.vibrate()
340
344
  return
341
345
  }
342
346
  if (!recaptchaConfig?.baseUrl) {
343
347
  showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
348
+ Vibration.vibrate()
344
349
  return
345
350
  }
346
351
  recaptchaRef.current.open()
@@ -384,10 +389,11 @@ const SignupFormUI = (props: SignupParams) => {
384
389
  baseUrl: configs?.security_recaptcha_base_url?.value || null
385
390
  })
386
391
  showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
392
+ Vibration.vibrate()
387
393
  return
388
394
  }
389
- formState.result?.result &&
390
- showToast(ToastType.Error, formState.result?.result[0]);
395
+ formState.result?.result && showToast(ToastType.Error, formState.result?.result[0]);
396
+ formState.result?.result && Vibration.vibrate()
391
397
  setIsLoadingVerifyModal(false);
392
398
  }
393
399
  }, [formState]);
@@ -395,6 +401,7 @@ const SignupFormUI = (props: SignupParams) => {
395
401
  useEffect(() => {
396
402
  if (Object.keys(errors).length > 0) {
397
403
  setIsLoadingVerifyModal(false);
404
+ Vibration.vibrate()
398
405
  }
399
406
  }, [errors])
400
407
 
@@ -423,6 +430,7 @@ const SignupFormUI = (props: SignupParams) => {
423
430
  ? verifyPhoneState?.result?.result
424
431
  : verifyPhoneState?.result?.result[0];
425
432
  verifyPhoneState.result?.result && showToast(ToastType.Error, message);
433
+ verifyPhoneState.result?.result && Vibration.vibrate()
426
434
  setIsLoadingVerifyModal(false);
427
435
  return;
428
436
  }
@@ -918,7 +926,7 @@ const SignupFormUI = (props: SignupParams) => {
918
926
  (
919
927
  <FacebookLogin
920
928
  notificationState={notificationState}
921
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
929
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
922
930
  handleLoading={(val: boolean) => setIsFBLoading(val)}
923
931
  handleSuccessFacebookLogin={handleSuccessFacebook}
924
932
  />
@@ -927,7 +935,7 @@ const SignupFormUI = (props: SignupParams) => {
927
935
  <GoogleLogin
928
936
  notificationState={notificationState}
929
937
  webClientId={configs?.google_login_client_id?.value}
930
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
938
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
931
939
  handleLoading={(val: boolean) => setIsFBLoading(val)}
932
940
  handleSuccessGoogleLogin={handleSuccessFacebook}
933
941
  />
@@ -935,7 +943,7 @@ const SignupFormUI = (props: SignupParams) => {
935
943
  {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
936
944
  <AppleLogin
937
945
  notificationState={notificationState}
938
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
946
+ handleErrors={(err: any) => { showToast(ToastType.Error, err), Vibration.vibrate() }}
939
947
  handleLoading={(val: boolean) => setIsFBLoading(val)}
940
948
  handleSuccessAppleLogin={handleSuccessFacebook}
941
949
  />
@@ -163,7 +163,7 @@ const ProfileListUI = (props: ProfileParams) => {
163
163
  }, [removeAccountState])
164
164
 
165
165
  return (
166
- <View style={{ flex: 1, height: height - top - bottom - 42, paddingTop: 20 }}>
166
+ <View style={{ flex: 1, height: height - top - bottom, paddingTop: 20 }}>
167
167
  {/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
168
168
  {t('PROFILE', 'Profile')}
169
169
  </OText> */}
@@ -667,6 +667,7 @@ export interface PlaceSpotParams {
667
667
  vehicle?: any,
668
668
  setVehicle?: any,
669
669
  handleChangeSpot?: any
670
+ setPlaceSpotNumber?: any
670
671
  }
671
672
 
672
673
  export interface PromotionParams {
@@ -732,7 +733,7 @@ export interface PreviousBusinessOrderedParams {
732
733
  isBusinessesSearchList?: any,
733
734
  businessLoading?: boolean,
734
735
  businesses?: any
735
- handleUpdateBusinesses?: (businessId: number, changes: any) => {},
736
+ handleUpdateBusinesses?: (businessId: number, changes: any) => {},
736
737
  }
737
738
 
738
739
  export interface ServiceFormParams {