ordering-ui-react-native 0.22.11 → 0.22.13

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.22.11",
3
+ "version": "0.22.13",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -74,7 +74,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
74
74
  const [openModalForAccept, setOpenModalForAccept] = useState(false);
75
75
  const [openModalForMapView, setOpenModalForMapView] = useState(false);
76
76
  const [isDriverModalVisible, setIsDriverModalVisible] = useState(false);
77
- const [printerSettings, setPrinterSettings] = useState('')
77
+ const [printerSettings, setPrinterSettings] = useState<any>('')
78
78
  const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
79
79
 
80
80
  const orderToComplete = [4,20,21]
@@ -323,7 +323,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
323
323
  const commands: any = generateCommands({
324
324
  ...order,
325
325
  orderStatus: getOrderStatus(order?.status, t)?.value
326
- })
326
+ }, printerSettings?.printMode)
327
327
  commands.push({ appendCutPaper: StarPRNT.CutPaperAction.PartialCutWithFeed })
328
328
 
329
329
  printAction(printerSettings, commands)
@@ -135,12 +135,13 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
135
135
  }
136
136
 
137
137
  const deliveryDate = () => {
138
- const dateString = order?.delivery_datetime_utc ? order?.delivery_datetime_utc : order?.delivery_datetime
138
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
139
139
  const currentDate = new Date();
140
- const receivedDate: any = new Date(dateString.replace(/-/g, '/'));
140
+ const receivedDate: any = new Date(dateString);
141
+
141
142
  const formattedDate = receivedDate <= currentDate
142
- ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(receivedDate.toLocaleString(), { utc: !!order?.delivery_datetime_utc })})`
143
- : parseDate(receivedDate.toLocaleString(), { utc: !!order?.delivery_datetime_utc })
143
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
144
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
144
145
  return formattedDate
145
146
  }
146
147
 
@@ -61,22 +61,22 @@ export const usePrinterCommands = () => {
61
61
  return formattedDate
62
62
  }
63
63
 
64
- const generateProductsText = (order: any) => {
64
+ const generateProductsText = (order: any, { endLine }: any) => {
65
65
  const list: any = []
66
66
 
67
67
  if (order?.products.length) {
68
68
  order?.products.map((product: any) => {
69
- list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}`)
69
+ list.push(`${product?.quantity} ${product?.name} \t ${parsePrice(product.total ?? getProductPrice(product))}${endLine}`)
70
70
 
71
71
  if (product?.ingredients?.length) {
72
- list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:`, props: { fontSize: 10 } })
72
+ list.push({ text: `\t ${t('INGREDIENTS', 'Ingredients')}:${endLine}`, props: { fontSize: 10 } })
73
73
  product?.ingredients?.map((ingredient: any) => {
74
- list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}` , fontSize: 10 })
74
+ list.push({ text: `\t ${t('NO', 'No')} ${ingredient.name}${endLine}` , fontSize: 10 })
75
75
  })
76
76
  }
77
77
 
78
78
  product.options?.map((option: any) => {
79
- list.push({ text: `\t ${option.name}`, props: { fontSize: 10 } })
79
+ list.push({ text: `\t ${option.name}${endLine}`, props: { fontSize: 10 } })
80
80
 
81
81
  option.suboptions?.map((suboption: any) => {
82
82
  const { quantity, name, position, price } = suboption
@@ -87,13 +87,13 @@ export const usePrinterCommands = () => {
87
87
  : `${quantity} x ${name} +${parsePrice(price)}`
88
88
  : 'No'
89
89
 
90
- list.push({ text: `\t\t ${string}`, props: { fontSize: 10 } })
90
+ list.push({ text: `\t\t ${string}${endLine}`, props: { fontSize: 10 } })
91
91
  })
92
92
  })
93
93
 
94
94
  if (product.comment) {
95
- list.push({ text: `\t ${t('COMMENT', 'Comment')}`, props: { fontSize: 10 } })
96
- list.push({ text: `\t\t ${product.comment}`, props: { fontSize: 10 } })
95
+ list.push({ text: `\t ${t('COMMENT', 'Comment')}${endLine}`, props: { fontSize: 10 } })
96
+ list.push({ text: `\t\t ${product.comment}${endLine}`, props: { fontSize: 10 } })
97
97
  }
98
98
 
99
99
  list.push('_separator_')
@@ -103,7 +103,7 @@ export const usePrinterCommands = () => {
103
103
  return list
104
104
  }
105
105
 
106
- const paymethodsList = (order: any) => {
106
+ const paymethodsList = (order: any, { endLine }: any) => {
107
107
  const list: any = []
108
108
 
109
109
  if (order?.payment_events?.length > 0) {
@@ -116,70 +116,73 @@ export const usePrinterCommands = () => {
116
116
  ? parsePrice(order?.cash, { currency: order?.currency })
117
117
  : `-${parsePrice(event?.amount, { currency: order?.currency })}`
118
118
 
119
- list.push(`${payment} \t ${amount}`)
119
+ list.push(`${payment} \t ${amount}${endLine}`)
120
120
  })
121
121
  }
122
122
 
123
123
  return list
124
124
  }
125
125
 
126
- const generateCommands = (order: any) => {
126
+ const generateCommands = (order: any, printMode: string = 'append') => {
127
127
  let commands: any = [];
128
128
 
129
+ const isAppendMode = printMode === 'append'
130
+ const jumpLine = isAppendMode ? '\n' : ' '
131
+ const endLine = isAppendMode ? '\n' : ''
132
+
129
133
  const textProps = { fontSize: 12 }
130
134
 
131
135
  const appends: any = [
132
- { text: `${t('ORDER_NO', 'Order No.')} ${order.id}`, props: { fontSize: 16 } },
133
- ' ',
134
- order.orderStatus,
135
- { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}`, props: { fontSize: 14 } },
136
- { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}`, props: { fontSize: 14 } },
137
- `${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}` : ''}`,
138
- `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}`,
136
+ { text: `${t('ORDER_NO', 'Order No.')} ${order.id}${endLine}`, props: { fontSize: 16 } },
137
+ jumpLine,
138
+ `${order.orderStatus}${endLine}`,
139
+ { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}${endLine}`, props: { fontSize: 14 } },
140
+ { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}${endLine}`, props: { fontSize: 14 } },
141
+ `${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}${endLine}` : ''}`,
142
+ `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}${endLine}`,
139
143
  '_separator_',
140
- { text: `${t('CUSTOMER_DETAILS', 'Customer details')}`, props: { fontSize: 14 } },
141
- `${t('FULL_NAME', 'Full Name')}: ${customerName(order)}`,
142
- `${t('EMAIL', 'Email')}: ${order?.customer?.email}`,
143
- `${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}` : ''}`,
144
- `${!!order?.customer?.phone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone}` : ''}`,
145
- `${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}`,
146
- `${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}` : ''}`,
147
- `${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}` : ''}`,
144
+ { text: `${t('CUSTOMER_DETAILS', 'Customer details')}${endLine}`, props: { fontSize: 14 } },
145
+ `${t('FULL_NAME', 'Full Name')}: ${customerName(order)}${endLine}`,
146
+ `${t('EMAIL', 'Email')}: ${order?.customer?.email}${endLine}`,
147
+ `${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}${endLine}` : ''}`,
148
+ `${!!order?.customer?.phone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone}${endLine}` : ''}`,
149
+ `${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}${endLine}`,
150
+ `${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}${endLine}` : ''}`,
151
+ `${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}${endLine}` : ''}`,
148
152
  '_separator_',
149
- { text: `${t('BUSINESS_DETAILS', 'Business details')}`, props: { fontSize: 14 } },
150
- order?.business?.name,
151
- order?.business?.email,
152
- `${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}` : ''}`,
153
- `${!!order?.business?.phone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone}` : ''}`,
154
- `${t('ADDRESS', 'Address')}: ${order?.business?.address}`,
155
- `${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}` : ''}`,
153
+ { text: `${t('BUSINESS_DETAILS', 'Business details')}${endLine}`, props: { fontSize: 14 } },
154
+ `${order?.business?.name}${endLine}`,
155
+ `${order?.business?.email}${endLine}`,
156
+ `${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}${endLine}` : ''}`,
157
+ `${!!order?.business?.phone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone}${endLine}` : ''}`,
158
+ `${t('ADDRESS', 'Address')}: ${order?.business?.address}${endLine}`,
159
+ `${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}${endLine}` : ''}`,
156
160
  '_separator_',
157
- { text: `${t('ORDER_DETAILS', 'Order Details')}`, props: { fontSize: 14 } },
158
- `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}` : ''}`,
159
- ...generateProductsText(order),
160
- ' ',
161
- `${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}`,
162
- `${order?.summary?.discount > 0 ? `${order?.offer_type === 1 ? `${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)` : t('DISCOUNT', 'Discount')} \t\t ${parsePrice(order?.summary?.discount)}` : ''}`,
163
- `${order?.tax_type !== 1 ? `${t('TAX', 'Tax')} (${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%) \t\t ${parsePrice(order?.summary?.tax ?? 0)}` : ''}`,
164
- `${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ? `${t('DELIVERY_FEE', 'Delivery Fee')} \t\t ${parsePrice(order?.summary?.delivery_price ?? 0)}` : ''}`,
165
- `${(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 ? `${t('DRIVER_TIP', 'Driver tip')} ${percentTip(order) ? `(${percentTip(order)}%)` : ''} \t\t ${parsePrice(order?.summary?.driver_tip ?? 0)}` : ''}`,
166
- `${t('SERVICE_FEE', 'Service Fee')} (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%) \t\t ${parsePrice(order?.summary?.service_fee ?? 0)}`,
161
+ { text: `${t('ORDER_DETAILS', 'Order Details')}${endLine}`, props: { fontSize: 14 } },
162
+ `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}${endLine}` : ''}`,
163
+ ...generateProductsText(order, { endLine }),
164
+ `${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}${endLine}`,
165
+ `${order?.summary?.discount > 0 ? `${order?.offer_type === 1 ? `${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)${endLine}` : t('DISCOUNT', 'Discount')} \t\t ${parsePrice(order?.summary?.discount)}${endLine}` : ''}`,
166
+ `${order?.tax_type !== 1 ? `${t('TAX', 'Tax')} (${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%) \t\t ${parsePrice(order?.summary?.tax ?? 0)}${endLine}` : ''}`,
167
+ `${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ? `${t('DELIVERY_FEE', 'Delivery Fee')} \t\t ${parsePrice(order?.summary?.delivery_price ?? 0)}${endLine}` : ''}`,
168
+ `${(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 ? `${t('DRIVER_TIP', 'Driver tip')} ${percentTip(order) ? `(${percentTip(order)}%)` : ''} \t\t ${parsePrice(order?.summary?.driver_tip ?? 0)}${endLine}` : ''}`,
169
+ `${order?.summary?.service_fee > 0 ? `${t('SERVICE_FEE', 'Service Fee')} (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%) \t\t ${parsePrice(order?.summary?.service_fee ?? 0)}${endLine}` : ''}`,
167
170
  '_separator_',
168
- `${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}`,
169
- ' ',
170
- `${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}` : ''}`,
171
- ...paymethodsList(order),
172
- ' ',
173
- ' ',
171
+ `${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}${endLine}`,
172
+ jumpLine,
173
+ `${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}${endLine}` : ''}`,
174
+ ...paymethodsList(order, { endLine }),
175
+ jumpLine,
176
+ jumpLine,
174
177
  ]
175
178
 
176
179
  commands = [
177
180
  ...commands,
178
181
  ...appends.map((append: any) => {
179
182
  return append === '_separator_'
180
- ? { appendBitmapText: '---------------------------------------' }
183
+ ? { [printMode]: `---------------------------------------${endLine}` }
181
184
  : {
182
- appendBitmapText: append?.text ?? append,
185
+ [printMode]: append?.text ?? append,
183
186
  ...textProps,
184
187
  ...append?.props
185
188
  }
@@ -99,12 +99,13 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
99
99
  }
100
100
 
101
101
  const deliveryDate = (order: any) => {
102
- const dateString = order?.delivery_datetime_utc ? order?.delivery_datetime_utc : order?.delivery_datetime
102
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
103
103
  const currentDate = new Date();
104
- const receivedDate: any = new Date(dateString.replace(/-/g, '/'));
104
+ const receivedDate: any = new Date(dateString);
105
+
105
106
  const formattedDate = receivedDate <= currentDate
106
- ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(receivedDate.toLocaleString(), { utc: !!order?.delivery_datetime_utc })})`
107
- : parseDate(receivedDate.toLocaleString(), { utc: !!order?.delivery_datetime_utc })
107
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
108
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
108
109
  return formattedDate
109
110
  }
110
111
 
@@ -318,18 +319,19 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
318
319
 
319
320
  </div>
320
321
 
321
- <div style="display: flex">
322
+ ${order?.summary?.service_fee > 0 && `
323
+ <div style="display: flex">
324
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
325
+ ${t('SERVICE_FEE', 'Service Fee')}
326
+ (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)
327
+ </div>
322
328
 
323
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
324
- ${t('SERVICE_FEE', 'Service Fee')}
325
- (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)
326
- </div>
329
+ <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
330
+ ${parsePrice(order?.summary?.service_fee ?? 0)}
331
+ </div>
327
332
 
328
- <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
329
- ${parsePrice(order?.summary?.service_fee ?? 0)}
330
333
  </div>
331
-
332
- </div>
334
+ `}
333
335
 
334
336
  <div style="display: flex">
335
337
 
@@ -66,26 +66,27 @@ export const PrinterSettings = (props: any) => {
66
66
  })
67
67
 
68
68
  const printerList = [
69
- { model: 'mPOP', emulation: 'StarPRNT', portName1: 'BT:mPOP', type: 1, ip: '' },
70
- { model: 'FVP10', emulation: 'StarLine', portName1: 'BT:FVP10', type: 1, ip: '' },
71
- { model: 'TSP100', emulation: 'StarGraphic', portName1: 'BT:TSP100', type: 1, ip: '' },
72
- { model: 'TSP65011', emulation: 'StarLine', portName1: 'BT:TSP65011', type: 1, ip: '' },
73
- { model: 'TSP7001', emulation: 'StarLine', portName1: 'BT:TSP7001', type: 1, ip: '' },
74
- { model: 'TSP80011', emulation: 'StarLine', portName1: 'BT:TSP80011', type: 1, ip: '' },
75
- { model: 'SP700', emulation: 'StarDotimpact', portName1: 'BT:SP700', type: 1, ip: '' },
76
- { model: 'SM-S210i', emulation: 'EscPosMobile', portName1: 'BT:SMS210i', type: 1, ip: '' },
77
- { model: 'SM-S220i', emulation: 'EscPosMobile', portName1: 'BT:SMS220i', type: 1, ip: '' },
78
- { model: 'SM-S230i', emulation: 'EscosMobile', portName1: 'BT:SMS230i', type: 1, ip: '' },
79
- { model: 'SM-T300i/T300', emulation: 'EscPosMobile', portName1: 'BT:SMT300i/T300', type: 1, ip: '' },
80
- { model: 'SM-T400i', emulation: 'EscosMobile', portName1: 'BT:SMT400i', type: 1, ip: '' },
81
- { model: 'SM-L200', emulation: 'StarPRNT', portName1: 'BT:SML200', type: 1, ip: '' },
82
- { model: 'SM-L300', emulation: 'StarPRNT', portName1: 'BT:SML300', type: 1, ip: '' },
83
- { model: 'BSC10', emulation: 'EscPos', portName1: 'BT:BSC10', type: 1, ip: '' },
84
- { model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS210i', type: 1, ip: '' },
85
- { model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS220i', type: 1, ip: '' },
86
- { model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS230i', type: 1, ip: '' },
87
- { model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT300i', type: 1, ip: '' },
88
- { model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT400i', type: 1, ip: '' },
69
+ { model: 'mPOP', emulation: 'StarPRNT', portName1: 'BT:mPOP', type: 1, ip: '', printMode: 'append' },
70
+ { model: 'FVP10', emulation: 'StarLine', portName1: 'BT:FVP10', type: 1, ip: '', printMode: 'append' },
71
+ { model: 'TSP100', emulation: 'StarGraphic', portName1: 'BT:TSP100', type: 1, ip: '', printMode: 'appendBitmapText' },
72
+ { model: 'TSP100IV', emulation: 'StarLine', portName1: 'BT:TSP100iv', type: 1, ip: '', printMode: 'append' },
73
+ { model: 'TSP65011', emulation: 'StarLine', portName1: 'BT:TSP65011', type: 1, ip: '', printMode: 'append' },
74
+ { model: 'TSP7001', emulation: 'StarLine', portName1: 'BT:TSP7001', type: 1, ip: '', printMode: 'append' },
75
+ { model: 'TSP80011', emulation: 'StarLine', portName1: 'BT:TSP80011', type: 1, ip: '', printMode: 'append' },
76
+ { model: 'SP700', emulation: 'StarDotImpact', portName1: 'BT:SP700', type: 1, ip: '', printMode: 'append' },
77
+ { model: 'SM-S210i', emulation: 'EscPosMobile', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
78
+ { model: 'SM-S220i', emulation: 'EscPosMobile', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
79
+ { model: 'SM-S230i', emulation: 'EscosMobile', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
80
+ { model: 'SM-T300i/T300', emulation: 'EscPosMobile', portName1: 'BT:SMT300i/T300', type: 1, ip: '', printMode: 'append' },
81
+ { model: 'SM-T400i', emulation: 'EscosMobile', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
82
+ { model: 'SM-L200', emulation: 'StarPRNT', portName1: 'BT:SML200', type: 1, ip: '', printMode: 'append' },
83
+ { model: 'SM-L300', emulation: 'StarPRNT', portName1: 'BT:SML300', type: 1, ip: '', printMode: 'append' },
84
+ { model: 'BSC10', emulation: 'EscPos', portName1: 'BT:BSC10', type: 1, ip: '', printMode: 'append' },
85
+ { model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
86
+ { model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
87
+ { model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
88
+ { model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT300i', type: 1, ip: '', printMode: 'append' },
89
+ { model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
89
90
  ]
90
91
 
91
92
  const handleClick = async (item: any, type?: number, ip?: string) => {
@@ -95,9 +96,9 @@ export const PrinterSettings = (props: any) => {
95
96
  ...currentPrinter,
96
97
  ...item,
97
98
  type: type ?? currentPrinter?.type,
98
- ip: ip ?? currentPrinter?.ip,
99
+ ip: ip ?? currentPrinter?.ip ?? '',
99
100
  portName: (type ?? currentPrinter?.type) === 1 || !ip
100
- ? currentPrinter?.portName1 ?? item.portName1
101
+ ? item.portName1 ?? currentPrinter?.portName1
101
102
  : `TCP:${ip}`
102
103
  }
103
104
  }