ordering-ui-react-native 0.22.11 → 0.22.12

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.12",
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
 
@@ -66,17 +66,17 @@ export const usePrinterCommands = () => {
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))}\n`)
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')}:\n`, 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}\n` , 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}\n`, props: { fontSize: 10 } })
80
80
 
81
81
  option.suboptions?.map((suboption: any) => {
82
82
  const { quantity, name, position, price } = suboption
@@ -87,16 +87,16 @@ 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}\n`, 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')}\n`, props: { fontSize: 10 } })
96
+ list.push({ text: `\t\t ${product.comment}\n`, props: { fontSize: 10 } })
97
97
  }
98
98
 
99
- list.push('_separator_')
99
+ list.push('_separator_\n')
100
100
  })
101
101
  }
102
102
 
@@ -116,70 +116,72 @@ 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}\n`)
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
129
  const textProps = { fontSize: 12 }
130
130
 
131
131
  const appends: any = [
132
- { text: `${t('ORDER_NO', 'Order No.')} ${order.id}`, props: { fontSize: 16 } },
132
+ { text: `${t('ORDER_NO', 'Order No.')} ${order.id}\n`, props: { fontSize: 16 } },
133
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)}`,
139
- '_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}` : ''}`,
148
- '_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}` : ''}`,
156
- '_separator_',
157
- { text: `${t('ORDER_DETAILS', 'Order Details')}`, props: { fontSize: 14 } },
158
- `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}` : ''}`,
134
+ `${order.orderStatus}\n`,
135
+ { text: `${t('ORDER_TYPE', 'Order Type')}: ${deliveryStatus[order?.delivery_type]}\n`, props: { fontSize: 14 } },
136
+ { text: `${t(`PAYMENT_METHOD${paymethodsLength(order) > 1 ? 'S' : ''}`, `Payment method${paymethodsLength(order) > 1 ? 's' : ''}`)}: ${handlePaymethodsListString(order)}\n`, props: { fontSize: 14 } },
137
+ `${!!order?.delivery_option ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}\n` : '\n'}`,
138
+ `${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}\n`,
139
+ '_separator_\n',
140
+ { text: `${t('CUSTOMER_DETAILS', 'Customer details')}\n`, props: { fontSize: 14 } },
141
+ `${t('FULL_NAME', 'Full Name')}: ${customerName(order)}\n`,
142
+ `${t('EMAIL', 'Email')}: ${order?.customer?.email}\n`,
143
+ `${!!order?.customer?.cellphone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone}\n` : '\n'}`,
144
+ `${!!order?.customer?.phone ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone}\n` : '\n'}`,
145
+ `${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}\n`,
146
+ `${!!order?.customer?.internal_number ? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number}\n` : '\n'}`,
147
+ `${!!order?.customer?.zipcode ? `${t('ZIPCODE', 'Zipcode')}: ${order?.customer?.zipcode}\n` : '\n'}`,
148
+ '_separator_\n',
149
+ { text: `${t('BUSINESS_DETAILS', 'Business details')}\n`, props: { fontSize: 14 } },
150
+ `${order?.business?.name}\n`,
151
+ `${order?.business?.email}\n`,
152
+ `${!!order?.business?.cellphone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone}\n` : '\n'}`,
153
+ `${!!order?.business?.phone ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone}\n` : '\n'}`,
154
+ `${t('ADDRESS', 'Address')}: ${order?.business?.address}\n`,
155
+ `${!!order?.business?.address_notes ? `${t('SPECIAL_ADDRESS', 'Special Address')}: ${order?.business?.address_notes}\n` : '\n'}`,
156
+ '_separator_\n',
157
+ { text: `${t('ORDER_DETAILS', 'Order Details')}\n`, props: { fontSize: 14 } },
158
+ `${!!order?.comment ? `${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}\n` : '\n'}`,
159
159
  ...generateProductsText(order),
160
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)}`,
167
- '_separator_',
168
- `${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}`,
161
+ `${t('SUBTOTAL', 'Subtotal')} \t\t ${parsePrice(order.tax_type === 1 ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0 : order?.summary?.subtotal ?? 0)}\n`,
162
+ `${order?.summary?.discount > 0 ? `${order?.offer_type === 1 ? `${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)\n` : t('DISCOUNT', 'Discount')} \t\t ${parsePrice(order?.summary?.discount)}\n` : '\n'}`,
163
+ `${order?.tax_type !== 1 ? `${t('TAX', 'Tax')} (${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%) \t\t ${parsePrice(order?.summary?.tax ?? 0)}\n` : '\n'}`,
164
+ `${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ? `${t('DELIVERY_FEE', 'Delivery Fee')} \t\t ${parsePrice(order?.summary?.delivery_price ?? 0)}\n` : '\n'}`,
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)}\n` : '\n'}`,
166
+ `${order?.summary?.service_fee > 0 ? `${t('SERVICE_FEE', 'Service Fee')} (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%) \t\t ${parsePrice(order?.summary?.service_fee ?? 0)}\n` : '\n'}`,
167
+ '_separator_\n',
168
+ `${t('TOTAL', 'Total')} \t\t ${parsePrice(order?.summary?.total ?? 0)}\n`,
169
169
  ' ',
170
- `${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}` : ''}`,
170
+ `${order?.payment_events?.length > 0 ? `${t('PAYMENTS', 'Payments')}\n` : '\n'}`,
171
171
  ...paymethodsList(order),
172
172
  ' ',
173
+ '\n',
173
174
  ' ',
175
+ '\n',
174
176
  ]
175
177
 
176
178
  commands = [
177
179
  ...commands,
178
180
  ...appends.map((append: any) => {
179
181
  return append === '_separator_'
180
- ? { appendBitmapText: '---------------------------------------' }
182
+ ? { [printMode]: '---------------------------------------' }
181
183
  : {
182
- appendBitmapText: append?.text ?? append,
184
+ [printMode]: append?.text ?? append,
183
185
  ...textProps,
184
186
  ...append?.props
185
187
  }
@@ -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
  }