ordering-ui-react-native 0.21.27-release → 0.21.28-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.21.27-release",
3
+ "version": "0.21.28-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -78,11 +78,8 @@ const ProfileUI = (props: ProfileParams) => {
78
78
  const allowDriverUpdateData = user?.level !== 4 || configs?.allow_driver_update_data?.value === "1"
79
79
  useEffect(() => {
80
80
  if (phoneInputData.phone.cellphone) {
81
- const codeNumberPhone = phoneInputData.phone.cellphone.slice(0, 3);
82
- const numberPhone = phoneInputData.phone.cellphone.slice(
83
- 3,
84
- phoneInputData.phone.cellphone?.length,
85
- );
81
+ const codeNumberPhone = phoneInputData.phone.country_phone_code
82
+ const numberPhone = phoneInputData.phone.cellphone
86
83
  setPhoneToShow(`(${codeNumberPhone}) ${numberPhone}`);
87
84
  }
88
85
  }, [phoneInputData.phone.cellphone]);
@@ -467,7 +464,6 @@ const ProfileUI = (props: ProfileParams) => {
467
464
  />
468
465
 
469
466
  <OText style={styles.label}>{t('PHONE', 'Phone')}</OText>
470
-
471
467
  <OInput
472
468
  isSecured={true}
473
469
  placeholder={
@@ -859,8 +859,9 @@ const AddressFormUI = (props: AddressFormParams) => {
859
859
  ) : (
860
860
  <OButton
861
861
  text={t('CANCEL', 'Cancel')}
862
- bgColor={theme.colors.white}
863
- borderColor={theme.colors.primary}
862
+ bgColor={theme.colors.secundary}
863
+ borderColor={theme.colors.secundary}
864
+ textStyle={{ color: theme.colors.black }}
864
865
  style={{ borderRadius: 7.6, borderWidth: 1, shadowOpacity: 0 }}
865
866
  onClick={() => navigation?.canGoBack() && navigation.goBack()}
866
867
  />
@@ -887,6 +888,8 @@ const AddressFormUI = (props: AddressFormParams) => {
887
888
  <OButton
888
889
  text={t('SAVE', 'Save')}
889
890
  textStyle={{ color: theme.colors.white }}
891
+ bgColor={theme.colors.primary}
892
+ borderColor={theme.colors.primary}
890
893
  imgRightSrc={null}
891
894
  style={{ marginHorizontal: 30, marginBottom: 10 }}
892
895
  onClick={() => setSaveMapLocation(true)}
@@ -26,7 +26,6 @@ import {
26
26
  SocialListWrapper
27
27
  } from './styles';
28
28
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
29
- const types = ['food', 'laundry', 'alcohol', 'groceries'];
30
29
 
31
30
  let BusinessInformation: null | React.ElementType = null
32
31
  let BusinessReviews: null | React.ElementType = null
@@ -36,6 +35,7 @@ export const BusinessBasicInformation = (
36
35
  ) => {
37
36
  const { navigation, businessState, isBusinessInfoShow, logo, header, isPreOrder } = props;
38
37
  const { business, loading } = businessState;
38
+ const types = business?.types && business?.types?.filter(({ enabled }) => (enabled)).map(({ name }) => (name))
39
39
 
40
40
  const theme = useTheme();
41
41
  const [orderState] = useOrder();
@@ -146,14 +146,11 @@ export const BusinessBasicInformation = (
146
146
  }
147
147
 
148
148
  const getBusinessType = () => {
149
- if (Object.keys(business || {}).length <= 0) return t('GENERAL', 'General');
149
+ if (!types) return t('GENERAL', 'General');
150
150
  const _types: any = [];
151
151
  types.forEach(
152
- (type) =>
153
- business[type] &&
154
- _types.push(
155
- t(`BUSINESS_TYPE_${type?.replace(/\s/g, '_')?.toUpperCase()}`, type),
156
- ),
152
+ (type: any) =>
153
+ _types.push(type)
157
154
  );
158
155
  return _types.join(', ');
159
156
  };
@@ -620,13 +620,15 @@ const CheckoutUI = (props: any) => {
620
620
  <OButton
621
621
  text={t('SIGN_UP', 'Sign up')}
622
622
  textStyle={{ color: theme.colors.white }}
623
+ bgColor={theme.colors.primary}
624
+ borderColor={theme.colors.primary}
623
625
  style={{ borderRadius: 7.6, marginTop: 20 }}
624
626
  onClick={() => setOpenModal({ ...openModal, signup: true })}
625
627
  />
626
628
  <OButton
627
629
  text={t('LOGIN', 'Login')}
628
- textStyle={{ color: theme.colors.primary }}
629
- bgColor={theme.colors.white}
630
+ textStyle={{ color: theme.colors.white }}
631
+ bgColor={theme.colors.primary}
630
632
  borderColor={theme.colors.primary}
631
633
  style={{ borderRadius: 7.6, marginTop: 20 }}
632
634
  onClick={() => setOpenModal({ ...openModal, login: true })}
@@ -108,7 +108,7 @@ const LoginFormUI = (props: LoginParams) => {
108
108
 
109
109
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
110
110
  const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
111
- const appleLoginEnabled = Platform.OS === 'ios' && configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
111
+ const appleLoginEnabled = Platform.OS === 'ios' && (configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled)
112
112
 
113
113
  const loginStyle = StyleSheet.create({
114
114
  btnOutline: {
@@ -802,7 +802,7 @@ const LoginFormUI = (props: LoginParams) => {
802
802
  handleSuccessGoogleLogin={handleSuccessFacebook}
803
803
  />
804
804
  )}
805
- {(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && appleLoginEnabled && (
805
+ {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
806
806
  <AppleLogin
807
807
  notificationState={notificationState}
808
808
  handleErrors={(err: any) => { showToast(ToastType.Error, err), vibrateApp() }}
@@ -127,12 +127,12 @@ const MessagesUI = (props: MessagesParams) => {
127
127
  return message.change?.attribute !== 'driver_id'
128
128
  ?
129
129
  `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
130
- ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
131
- : `${message.change?.attribute !== 'logistic_status'
132
- ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
133
- : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
134
- ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
135
- : getLogisticTag(message.change.new)}`
130
+ ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
131
+ : `${message.change?.attribute !== 'logistic_status'
132
+ ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
133
+ : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
134
+ ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
135
+ : getLogisticTag(message.change.new)}`
136
136
  }`
137
137
  : message.change.new
138
138
  ?
@@ -503,6 +503,7 @@ const MessagesUI = (props: MessagesParams) => {
503
503
  scrollToBottom
504
504
  renderAvatarOnTop
505
505
  renderUsernameOnMessage
506
+ renderAvatar={() => null}
506
507
  renderInputToolbar={renderInputToolbar}
507
508
  renderComposer={renderComposer}
508
509
  renderSend={renderSend}
@@ -5,7 +5,7 @@ import { TouchableOpacity, View } from 'react-native'
5
5
  import { OButton, OText } from '../shared';
6
6
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
7
7
 
8
- export const ActionButton = (props : any) => {
8
+ export const ActionButton = (props: any) => {
9
9
  const {
10
10
  navigation,
11
11
  isHaveWeight,
@@ -23,18 +23,20 @@ export const ActionButton = (props : any) => {
23
23
  handleUpdateGuest,
24
24
  actionStatus
25
25
  } = props
26
- const [,t] = useLanguage()
26
+ const [, t] = useLanguage()
27
27
  const [{ auth }] = useSession()
28
28
  const [orderState] = useOrder()
29
29
  const theme = useTheme()
30
- const [{ configs }] = useConfig()
30
+ const [{ configs }] = useConfig()
31
31
  const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
32
- const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
33
-
32
+ const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
34
33
  const saveErrors =
35
- orderState.loading ||
36
- maxProductQuantity === 0 ||
37
- Object.keys(errors)?.length > 0;
34
+ orderState.loading ||
35
+ maxProductQuantity === 0 ||
36
+ Object.keys(errors)?.length > 0;
37
+ const buttonColor = saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))
38
+
39
+
38
40
 
39
41
  return (
40
42
  <View
@@ -60,9 +62,9 @@ export const ActionButton = (props : any) => {
60
62
  color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
61
63
  fontSize: orderState.loading || editMode ? 10 : 14
62
64
  }}
65
+ bgColor={buttonColor ? theme.colors.lightGray : theme.colors.primary}
66
+ borderColor={!buttonColor ? theme.colors.white : theme.colors.primary}
63
67
  style={{
64
- backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
65
- borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
66
68
  opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
67
69
  borderRadius: 7.6,
68
70
  height: 44,
@@ -182,7 +182,7 @@ const PromotionsUI = (props: PromotionParams) => {
182
182
  title={``}
183
183
  onClose={() => setOpenModal(false)}
184
184
  >
185
- <View style={{ padding: 20 }}>
185
+ <ScrollView style={{ padding: 20 }}>
186
186
  <OText style={{ alignSelf: 'center', fontWeight: '700' }} mBottom={20}>
187
187
  {offerSelected?.name} / {t('VALUE_OF_OFFER', 'Value of offer')}: {offerSelected?.rate_type === 1 ? `${offerSelected?.rate}%` : `${parsePrice(offerSelected?.rate)}`}
188
188
  </OText>
@@ -210,10 +210,7 @@ const PromotionsUI = (props: PromotionParams) => {
210
210
  <OText style={{ marginTop: 10, marginBottom: 10 }}>
211
211
  {t('AVAILABLE_BUSINESSES_FOR_OFFER', 'Available businesses for this offer')}:
212
212
  </OText>
213
- <ScrollView
214
- showsVerticalScrollIndicator={false}
215
- style={{ height: '68%' }}
216
- >
213
+ <View style={{ marginBottom: 70 }}>
217
214
  {offerSelected?.businesses?.map((business: any) => {
218
215
  return (
219
216
  <SingleBusinessOffer key={business.id}>
@@ -244,8 +241,8 @@ const PromotionsUI = (props: PromotionParams) => {
244
241
  </SingleBusinessOffer>
245
242
  )
246
243
  })}
247
- </ScrollView>
248
- </View>
244
+ </View>
245
+ </ScrollView>
249
246
  </OModal>
250
247
  </PromotionsContainer>
251
248
  </Container>
@@ -155,7 +155,7 @@ const SignupFormUI = (props: SignupParams) => {
155
155
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
156
156
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
157
157
  const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
158
- const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
158
+ const appleLoginEnabled = Platform.OS === 'ios' && (configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled)
159
159
 
160
160
  const closeAlert = () => {
161
161
  setAlertState({
@@ -20,7 +20,7 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign';
20
20
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
21
21
  import { UpsellingLayout } from './UpsellingLayout';
22
22
 
23
- export const UpsellingContent = (props : any) => {
23
+ export const UpsellingContent = (props: any) => {
24
24
  const {
25
25
  onGoBack,
26
26
  handleUpsellingPage,
@@ -44,12 +44,10 @@ export const UpsellingContent = (props : any) => {
44
44
  const commentDelayTime = isChewLayout ? 500 : null
45
45
 
46
46
  const cartList = (carts && Object.values(carts).filter((_cart: any) => _cart?.products?.length > 0 && _cart.uuid !== cart?.uuid)) || []
47
-
47
+
48
48
  const styles = StyleSheet.create({
49
49
  closeUpsellingButton: {
50
50
  borderRadius: 7.6,
51
- borderColor: theme.colors.primary,
52
- backgroundColor: theme.colors.primary,
53
51
  borderWidth: 1,
54
52
  alignSelf: 'center',
55
53
  height: 44,
@@ -160,8 +158,10 @@ export const UpsellingContent = (props : any) => {
160
158
  <OButton
161
159
  imgRightSrc=''
162
160
  text={t('CHECKOUT', 'Checkout')}
163
- style={{ ...styles.closeUpsellingButton }}
164
161
  textStyle={{ color: theme.colors.white, fontSize: 14 }}
162
+ bgColor={theme.colors.primary}
163
+ borderColor={theme.colors.primary}
164
+ style={{ ...styles.closeUpsellingButton }}
165
165
  onClick={() => handleUpsellingPage(cart)}
166
166
  />
167
167
  </View>