ordering-ui-react-native 0.21.5 → 0.21.7

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.5",
3
+ "version": "0.21.7",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -80,6 +80,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
80
80
  !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
81
81
  verifyDecimals(order?.summary?.driver_tip, parseNumber);
82
82
 
83
+ const customerName = `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''
84
+ }`?.replace(' ', ' ')?.trim() ?? ''
85
+
83
86
  const orderSummary = () => {
84
87
  return `
85
88
  <div>
@@ -100,9 +103,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
100
103
  </p>
101
104
 
102
105
  <h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
103
- <p style="font-size: 27px"> ${t('FULL_NAME', 'Full Name')}: ${order?.customer?.name
104
- } ${order?.customer?.middle_name} ${order?.customer?.lastname} ${order?.customer?.second_lastname
105
- }
106
+ <p style="font-size: 27px"> ${t('FULL_NAME', 'Full Name')}: ${customerName}
106
107
  </br>
107
108
  ${t('EMAIL', 'Email')}: ${order?.customer?.email}
108
109
  </br>
@@ -339,9 +340,6 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
339
340
  }
340
341
  };
341
342
 
342
- const customerName = `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''
343
- }`?.replace(' ', ' ')?.trim() ?? ''
344
-
345
343
  return (
346
344
  <>
347
345
  <Content>
@@ -159,7 +159,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
159
159
 
160
160
  useEffect(() => {
161
161
  if (reorderState?.error) {
162
- showToast(ToastType.Error, reorderState?.result)
162
+ const errorMessage = (Array.isArray(reorderState?.result) || typeof reorderState?.result === 'string')
163
+ ? reorderState?.result
164
+ : t('CANT_REORDER_FOR_THIS_BUSINESS', 'Can’t reorder for this store, please create order manually.')
165
+ showToast(ToastType.Error, errorMessage)
163
166
  }
164
167
  }, [reorderState])
165
168