ordering-ui-react-native 0.23.4 → 0.23.6

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.23.4",
3
+ "version": "0.23.6",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -159,7 +159,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
159
159
 
160
160
  ${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}
161
161
  </br>
162
- ${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${handlePaymethodsListString()}
162
+ ${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
163
163
  </p>
164
164
 
165
165
  <h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
@@ -488,7 +488,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
488
488
  {`${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}`}
489
489
  </OText>
490
490
 
491
- <OText style={{ marginBottom: 5 }}>{`${t(`${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${handlePaymethodsListString()}`}</OText>
491
+ <OText style={{ marginBottom: 5 }}>
492
+ {`${t(`${paymethodsLength > 1? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}`}
493
+ </OText>
492
494
 
493
495
  </OrderHeader>
494
496
 
@@ -16,6 +16,8 @@ import { ListItem } from '../UserProfile/styles';
16
16
  import moment from 'moment';
17
17
  import { DatePickerUI } from '../DatePicker';
18
18
 
19
+ const CONDITIONAL_CODES = ['PR']
20
+
19
21
  export const UserFormDetailsUI = (props: any) => {
20
22
  const {
21
23
  isEdit,
@@ -129,6 +131,16 @@ export const UserFormDetailsUI = (props: any) => {
129
131
  return rules;
130
132
  };
131
133
 
134
+ const cellphoneValue = () => {
135
+ let cellphone = user?.cellphone || null
136
+ if (cellphone && CONDITIONAL_CODES.includes(user?.country_code)) {
137
+ if (user?.country_code === 'PR') {
138
+ cellphone = user?.cellphone?.slice(3)
139
+ }
140
+ }
141
+ return cellphone
142
+ }
143
+
132
144
  const setUserCellPhone = (isEdit = false) => {
133
145
  if (userPhoneNumber && !userPhoneNumber.includes('null') && !isEdit) {
134
146
  setUserPhoneNumber(userPhoneNumber);
@@ -146,7 +158,7 @@ export const UserFormDetailsUI = (props: any) => {
146
158
  ...phoneInputData,
147
159
  phone: {
148
160
  country_phone_code: user?.country_phone_code || null,
149
- cellphone: user?.cellphone || null,
161
+ cellphone: cellphoneValue()
150
162
  },
151
163
  });
152
164
  return;
@@ -405,7 +417,7 @@ export const UserFormDetailsUI = (props: any) => {
405
417
  data={phoneInputData}
406
418
  handleData={(val: any) => handleChangePhoneNumber(val)}
407
419
  changeCountry={(val: any) => changeCountry(val)}
408
- defaultValue={phoneUpdate ? '' : user?.cellphone}
420
+ defaultValue={phoneUpdate ? '' : cellphoneValue()}
409
421
  defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
410
422
  boxStyle={styles.phoneSelect}
411
423
  inputStyle={styles.phoneInputStyle}
@@ -418,7 +430,7 @@ export const UserFormDetailsUI = (props: any) => {
418
430
  color={theme.colors.error}
419
431
  style={{ marginHorizontal: 10, textAlign: 'center' }}>
420
432
  {t('YOUR_PREVIOUS_CELLPHONE', 'Your previous cellphone')}:{' '}
421
- {user?.cellphone}
433
+ {cellphoneValue()}
422
434
  </OText>
423
435
  )}
424
436
  </WrapperPhone>