ordering-ui-react-native 0.23.16 → 0.23.18

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.16",
3
+ "version": "0.23.18",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,3 +1,4 @@
1
+ import { Platform } from 'react-native'
1
2
  import { useConfig, useUtils, useLanguage} from 'ordering-components/native'
2
3
 
3
4
  import { verifyDecimals, getProductPrice } from '../../utils';
@@ -70,14 +71,14 @@ export const usePrinterCommands = () => {
70
71
  list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
71
72
 
72
73
  if (product?.ingredients?.length) {
73
- list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: 10 } })
74
+ list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
74
75
  product?.ingredients?.map((ingredient: any) => {
75
- list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: 10 })
76
+ list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: Platform.OS === 'ios' ? 10 : 18 })
76
77
  })
77
78
  }
78
79
 
79
80
  product.options?.map((option: any) => {
80
- list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: 10 } })
81
+ list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
81
82
 
82
83
  option.suboptions?.map((suboption: any) => {
83
84
  const { quantity, name, position, price } = suboption
@@ -88,13 +89,13 @@ export const usePrinterCommands = () => {
88
89
  : `${quantity} x ${name} +${parsePrice(price)}`
89
90
  : 'No'
90
91
 
91
- list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: 10 } })
92
+ list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
92
93
  })
93
94
  })
94
95
 
95
96
  if (product.comment) {
96
- list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: 10 } })
97
- list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: 10 } })
97
+ list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
98
+ list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 10 : 18 } })
98
99
  }
99
100
 
100
101
  list.push('_separator_')
@@ -154,18 +155,18 @@ export const usePrinterCommands = () => {
154
155
  const jumpLine = isAppendMode ? '\n' : ' '
155
156
  const endLine = isAppendMode ? '\n' : ''
156
157
 
157
- const textProps = { fontSize: 12 }
158
+ const textProps = { fontSize: 22 }
158
159
 
159
160
  const appends: any = [
160
- { text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: 16 } },
161
+ { text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 16 : 24 } },
161
162
  jumpLine,
162
163
  `${order.orderStatus}${endLine}`,
163
- { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: 14 } },
164
- { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: 14 } },
165
- `${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}` : ''}`,
166
- `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`,
164
+ { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
165
+ { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
166
+ `${!!order?.delivery_option ? { text: `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } } : ''}`,
167
+ { text: `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 22 } },
167
168
  '_separator_',
168
- { text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: 14 } },
169
+ { text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
169
170
  `${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
170
171
  `${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
171
172
  `${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
@@ -174,7 +175,7 @@ export const usePrinterCommands = () => {
174
175
  `${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
175
176
  `${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
176
177
  '_separator_',
177
- { text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: 14 } },
178
+ { text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
178
179
  `${order?.business?.name}${endLine}`,
179
180
  `${order?.business?.email}${endLine}`,
180
181
  `${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
@@ -182,7 +183,7 @@ export const usePrinterCommands = () => {
182
183
  `${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
183
184
  `${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
184
185
  '_separator_',
185
- { text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: 14 } },
186
+ { text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: Platform.OS === 'ios' ? 14 : 24 } },
186
187
  `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
187
188
  ...generateProductsText(order, { endLine }),
188
189
  `${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
@@ -204,7 +205,7 @@ export const usePrinterCommands = () => {
204
205
  ...commands,
205
206
  ...appends.map((append: any) => {
206
207
  return append === '_separator_'
207
- ? { [printMode]: `---------------------------------------${endLine}` }
208
+ ? { [printMode]: `-------------------------------------${endLine}` }
208
209
  : {
209
210
  [printMode]: replaceChars(append?.text ?? append),
210
211
  ...textProps,
@@ -102,7 +102,7 @@ export const PrinterSettings = (props: any) => {
102
102
  type: type ?? _currentPrinter?.type ?? 1,
103
103
  ip: ip ?? _currentPrinter?.ip ?? '',
104
104
  portName: (type ?? _currentPrinter?.type) === 1 || !ip
105
- ? item.portName1 ?? _currentPrinter?.portName1
105
+ ? item?.bt ?? item.portName1 ?? _currentPrinter?.portName1
106
106
  : `TCP:${ip}`
107
107
  }
108
108
  edit ? (_printers[idx] = _item) : _printers.push(_item)
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { useTheme } from 'styled-components/native'
3
3
  import { ScrollView, StyleSheet, View } from 'react-native'
4
- import { useLanguage, useUtils } from 'ordering-components/native'
4
+ import { useLanguage, useUtils, useConfig } from 'ordering-components/native'
5
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
6
  import { OText, OButton } from '../shared'
7
7
  import { formatSeconds } from '../../utils'
@@ -17,7 +17,9 @@ export const OrderHistory = (props: any) => {
17
17
 
18
18
  const [, t] = useLanguage()
19
19
  const [{ parseDate }] = useUtils()
20
+ const [{ configs }] = useConfig();
20
21
  const theme = useTheme()
22
+ const changeIdToExternalId = configs?.change_order_id?.value === '1'
21
23
 
22
24
  const styles = StyleSheet.create({
23
25
  historyItem: {
@@ -93,7 +95,7 @@ export const OrderHistory = (props: any) => {
93
95
  return (
94
96
  <ScrollView contentContainerStyle={styles.container}>
95
97
  <OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
96
- {t('DETAILS_OF_ORDER', 'Details of Order_NUMBER_').replace('_NUMBER_', ` # ${order?.id}`)}
98
+ {t('DETAILS_OF_ORDER', 'Details of Order_NUMBER_').replace('_NUMBER_', (changeIdToExternalId && order?.external_id) || `# ${order?.id}`)}
97
99
  </OText>
98
100
  {!messages?.loading && order && (
99
101
  <View style={styles.historyItem}>
@@ -149,6 +149,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
149
149
  const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
150
150
  const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
151
151
  const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
152
+ const changeIdToExternalId = configs?.change_order_id?.value === '1'
153
+
152
154
  const progressBarObjt = isPickup ? getOrderStatuPickUp : getOrderStatus
153
155
  const walletName: any = {
154
156
  cash: {
@@ -386,7 +388,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
386
388
  numberOfLines={2}
387
389
  ellipsizeMode='tail'
388
390
  >
389
- {`${t('ORDER', 'Order')} #${order?.id}`}
391
+ {`${t('ORDER', 'Order')} ${(changeIdToExternalId && order?.external_id) || `#${order?.id}`}`}
390
392
  </OText>
391
393
  )}
392
394
  </>
@@ -460,7 +462,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
460
462
  <Header>
461
463
  <NavBar
462
464
  hideArrowLeft
463
- title={`${t('ORDER', 'Order')} #${order?.id}`}
465
+ title={`${t('ORDER', 'Order')} ${(changeIdToExternalId && order?.external_id) || `#${order?.id}`}`}
464
466
  titleAlign={'left'}
465
467
  showCall={false}
466
468
  btnStyle={{ paddingLeft: 0 }}
@@ -3,7 +3,8 @@ import {
3
3
  SingleOrderCard as SingleOrderCardController,
4
4
  useUtils,
5
5
  useOrder,
6
- useLanguage
6
+ useLanguage,
7
+ useConfig
7
8
  } from 'ordering-components/native';
8
9
  import FastImage from 'react-native-fast-image'
9
10
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
@@ -45,6 +46,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
45
46
  const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
46
47
  const [, t] = useLanguage();
47
48
  const [{ carts }] = useOrder()
49
+ const [{ configs }] = useConfig()
48
50
  const theme = useTheme();
49
51
  const isFocused = useIsFocused();
50
52
 
@@ -54,6 +56,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
54
56
 
55
57
  const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12, 15];
56
58
  const isGiftCardOrder = !order?.business_id
59
+ const changeIdToExternalId = configs?.change_order_id?.value === '1'
57
60
 
58
61
  const styles = StyleSheet.create({
59
62
  container: {
@@ -333,7 +336,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
333
336
  lineHeight={15}
334
337
  numberOfLines={1}
335
338
  >
336
- {order?.business?.length > 1 ? order?.business?.length : (t('ORDER_NO', 'Order No') + '.')}
339
+ {order?.business?.length > 1 ? order?.business?.length : !(changeIdToExternalId && order?.external_id) && (t('ORDER_NO', 'Order No') + '.')}
337
340
  </OText>
338
341
  <OText
339
342
  size={10}
@@ -342,7 +345,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
342
345
  lineHeight={15}
343
346
  numberOfLines={1}
344
347
  >
345
- {order?.business?.length > 1 ? t('ORDERS', 'orders') + ' \u2022 ' : order.id + ` \u2022 `}
348
+ {order?.business?.length > 1 ? t('ORDERS', 'orders') + ' \u2022 ' : ((changeIdToExternalId && order?.external_id) || order.id) + ` \u2022 `}
346
349
  </OText>
347
350
  </>
348
351
  )}