@nitra/zebra 6.1.5 → 6.1.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/dist/plugin.js +327 -114
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { WebPlugin, registerPlugin } from '@capacitor/core';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* ZebraPrinterWeb - Web implementation for development
|
|
5
|
+
*
|
|
6
|
+
* Uses local printer-server.js (TCP/IP) so developers can
|
|
7
|
+
* test the printer in the browser.
|
|
8
|
+
*
|
|
9
|
+
* Production (iOS) uses the native BLE implementation.
|
|
10
|
+
*/
|
|
3
11
|
/**
|
|
4
12
|
* @typedef {import('../definitions').EchoOptions} EchoOptions
|
|
5
13
|
* @typedef {import('../definitions').EchoResult} EchoResult
|
|
@@ -14,106 +22,297 @@ import { WebPlugin, registerPlugin } from '@capacitor/core';
|
|
|
14
22
|
* @typedef {import('../definitions').PermissionResult} PermissionResult
|
|
15
23
|
*/
|
|
16
24
|
|
|
25
|
+
const API_BASE = '/api/printer';
|
|
26
|
+
|
|
17
27
|
class ZebraPrinterWeb extends WebPlugin {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this.connectedPrinter = null;
|
|
31
|
+
this.serviceAvailable = null;
|
|
32
|
+
this.defaultSubnet = this._getDefaultSubnet();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Check if printer-server is reachable
|
|
37
|
+
* @returns {Promise<boolean>} True if reachable
|
|
38
|
+
*/
|
|
39
|
+
async _checkService() {
|
|
40
|
+
if (this.serviceAvailable !== null) {
|
|
41
|
+
return this.serviceAvailable;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(`${API_BASE}/status`, {
|
|
46
|
+
method: 'GET',
|
|
47
|
+
headers: { 'Content-Type': 'application/json' },
|
|
48
|
+
});
|
|
49
|
+
const data = await response.json();
|
|
50
|
+
this.serviceAvailable = data.success === true;
|
|
51
|
+
return this.serviceAvailable;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.warn('ZebraPrinter: service check failed', error);
|
|
54
|
+
this.serviceAvailable = false;
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Fetch wrapper with error handling
|
|
61
|
+
* @param {string} endpoint - API route
|
|
62
|
+
* @param {RequestInit} [options] - Fetch configuration
|
|
63
|
+
* @returns {Promise<any>} Response JSON
|
|
64
|
+
*/
|
|
65
|
+
async _fetch(endpoint, options = {}) {
|
|
66
|
+
try {
|
|
67
|
+
const response = await fetch(`${API_BASE}${endpoint}`, {
|
|
68
|
+
headers: { 'Content-Type': 'application/json' },
|
|
69
|
+
...options,
|
|
70
|
+
});
|
|
71
|
+
return await response.json();
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.warn(`ZebraPrinter Web: ${endpoint} failed -`, error.message);
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
error:
|
|
77
|
+
'Printer service is not available. Ensure Vite dev server runs with printer-server plugin.',
|
|
78
|
+
serviceUnavailable: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Derive default subnet from host IP, if possible
|
|
85
|
+
* @returns {string} Example: "192.168.1" or "10.0.0"
|
|
86
|
+
*/
|
|
87
|
+
_getDefaultSubnet() {
|
|
88
|
+
if (typeof window === 'undefined') return '192.168.1';
|
|
89
|
+
const host = window.location.hostname;
|
|
90
|
+
const ipMatch = host.match(
|
|
91
|
+
/^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.(\d+)\.(\d+)$/
|
|
92
|
+
);
|
|
93
|
+
if (ipMatch) {
|
|
94
|
+
return `${ipMatch[1]}.${ipMatch[3]}`;
|
|
95
|
+
}
|
|
96
|
+
return '192.168.1';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Wrap plain text into a basic ZPL label unless it already looks like ZPL
|
|
101
|
+
* @param {string} text - Input text or ZPL
|
|
102
|
+
* @returns {string} ZPL payload
|
|
103
|
+
*/
|
|
104
|
+
_wrapTextIfNeeded(text) {
|
|
105
|
+
const isZplLike =
|
|
106
|
+
typeof text === 'string' &&
|
|
107
|
+
/\^XA/i.test(text) &&
|
|
108
|
+
(/\^XZ/i.test(text) || /\^JUS/i.test(text));
|
|
109
|
+
if (isZplLike) {
|
|
110
|
+
return text;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const safeText = String(text ?? '').replaceAll(/\r?\n/g, String.raw`\&`);
|
|
114
|
+
return [
|
|
115
|
+
'^XA',
|
|
116
|
+
'^CI28',
|
|
117
|
+
'^FO50,50',
|
|
118
|
+
'^A0N,30,30',
|
|
119
|
+
`^FD${safeText}^FS`,
|
|
120
|
+
'^XZ',
|
|
121
|
+
].join('\n');
|
|
122
|
+
}
|
|
123
|
+
|
|
18
124
|
/**
|
|
19
125
|
* Echo a value
|
|
20
|
-
* @param {EchoOptions} options -
|
|
21
|
-
* @returns {Promise<EchoResult>}
|
|
126
|
+
* @param {EchoOptions} options - Input data
|
|
127
|
+
* @returns {Promise<EchoResult & {platform: string, serviceAvailable: boolean}>} Echo result with platform info
|
|
22
128
|
*/
|
|
23
|
-
// eslint-disable-next-line require-await
|
|
24
129
|
async echo(options) {
|
|
25
|
-
// eslint-disable-next-line no-console
|
|
26
130
|
console.log('ZebraPrinter: echo called with options:', options);
|
|
131
|
+
const serviceOk = await this._checkService();
|
|
27
132
|
return {
|
|
28
133
|
value: options.value,
|
|
134
|
+
platform: 'web',
|
|
135
|
+
serviceAvailable: serviceOk,
|
|
29
136
|
};
|
|
30
137
|
}
|
|
31
138
|
|
|
32
139
|
/**
|
|
33
140
|
* Check if required permissions are granted
|
|
34
|
-
* @returns {Promise<PermissionResult>}
|
|
141
|
+
* @returns {Promise<PermissionResult>} Permission status
|
|
35
142
|
*/
|
|
36
|
-
// eslint-disable-next-line require-await
|
|
37
143
|
async checkPermissions() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
144
|
+
const serviceOk = await this._checkService();
|
|
145
|
+
const hasNavigator = typeof navigator !== 'undefined';
|
|
146
|
+
const bleSupported = hasNavigator && navigator.bluetooth !== undefined;
|
|
147
|
+
|
|
148
|
+
if (!serviceOk) {
|
|
149
|
+
console.warn('ZebraPrinter: printer-server not available');
|
|
150
|
+
return {
|
|
151
|
+
hasPermissions: false,
|
|
152
|
+
missingPermissions: ['printer-server'],
|
|
153
|
+
bluetoothSupported: bleSupported,
|
|
154
|
+
bleSupported: bleSupported,
|
|
155
|
+
webMode: true,
|
|
156
|
+
serviceAvailable: false,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
42
160
|
return {
|
|
43
|
-
hasPermissions:
|
|
44
|
-
missingPermissions: [
|
|
45
|
-
bluetoothSupported:
|
|
46
|
-
bleSupported:
|
|
161
|
+
hasPermissions: true,
|
|
162
|
+
missingPermissions: [],
|
|
163
|
+
bluetoothSupported: bleSupported,
|
|
164
|
+
bleSupported: bleSupported,
|
|
165
|
+
webMode: true,
|
|
166
|
+
serviceAvailable: true,
|
|
47
167
|
};
|
|
48
168
|
}
|
|
49
169
|
|
|
50
170
|
/**
|
|
51
171
|
* Request required permissions
|
|
52
|
-
* @returns {Promise<PermissionResult>}
|
|
172
|
+
* @returns {Promise<PermissionResult>} Permission status
|
|
53
173
|
*/
|
|
54
|
-
// eslint-disable-next-line require-await
|
|
55
174
|
async requestPermissions() {
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
'ZebraPrinter: requestPermissions called on web platform - not supported'
|
|
59
|
-
);
|
|
60
|
-
return {
|
|
61
|
-
hasPermissions: false,
|
|
62
|
-
missingPermissions: ['bluetooth', 'location'],
|
|
63
|
-
bluetoothSupported: false,
|
|
64
|
-
bleSupported: false,
|
|
65
|
-
};
|
|
175
|
+
// Not needed on web - just check service
|
|
176
|
+
return await this.checkPermissions();
|
|
66
177
|
}
|
|
67
178
|
|
|
68
179
|
/**
|
|
69
180
|
* Print text to the connected printer
|
|
70
|
-
* @param {PrintTextOptions}
|
|
71
|
-
* @returns {Promise<PrintResult>}
|
|
181
|
+
* @param {PrintTextOptions} options - Parameters with ZPL text
|
|
182
|
+
* @returns {Promise<PrintResult>} Print result
|
|
72
183
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
184
|
+
async printText(options) {
|
|
185
|
+
const { text } = options || {};
|
|
186
|
+
|
|
187
|
+
if (!text) {
|
|
188
|
+
return {
|
|
189
|
+
success: false,
|
|
190
|
+
message: 'No text provided for printing',
|
|
191
|
+
error: 'Missing text parameter',
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const zplPayload = this._wrapTextIfNeeded(text);
|
|
196
|
+
|
|
197
|
+
const result = await this._fetch('/print', {
|
|
198
|
+
method: 'POST',
|
|
199
|
+
body: JSON.stringify({
|
|
200
|
+
zpl: zplPayload,
|
|
201
|
+
ip: this.connectedPrinter?.ip,
|
|
202
|
+
}),
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
if (result.success) {
|
|
206
|
+
return {
|
|
207
|
+
success: true,
|
|
208
|
+
message: 'Print successful',
|
|
209
|
+
zpl: `${zplPayload.slice(0, 100)}...`,
|
|
210
|
+
bytes: zplPayload.length,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
79
214
|
return {
|
|
80
215
|
success: false,
|
|
81
|
-
message:
|
|
82
|
-
|
|
83
|
-
error: 'Web platform not supported',
|
|
216
|
+
message: result.error || 'Print failed',
|
|
217
|
+
error: result.error,
|
|
84
218
|
};
|
|
85
219
|
}
|
|
86
220
|
|
|
87
221
|
/**
|
|
88
222
|
* Get printer status
|
|
89
|
-
* @returns {Promise<PrinterStatus>}
|
|
223
|
+
* @returns {Promise<PrinterStatus>} Printer status
|
|
90
224
|
*/
|
|
91
|
-
// eslint-disable-next-line require-await
|
|
92
225
|
async getStatus() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
226
|
+
if (!this.connectedPrinter) {
|
|
227
|
+
return {
|
|
228
|
+
connected: false,
|
|
229
|
+
status: 'disconnected',
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const result = await this._fetch('/check', {
|
|
234
|
+
method: 'POST',
|
|
235
|
+
body: JSON.stringify({ ip: this.connectedPrinter.ip }),
|
|
236
|
+
});
|
|
237
|
+
|
|
97
238
|
return {
|
|
98
|
-
connected:
|
|
99
|
-
status: 'disconnected',
|
|
239
|
+
connected: result.reachable === true,
|
|
240
|
+
status: result.reachable ? 'connected' : 'disconnected',
|
|
241
|
+
printerAddress: this.connectedPrinter.ip,
|
|
242
|
+
printerType: 'network',
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Check printer status with ZPL command
|
|
248
|
+
* @returns {Promise<PrinterStatusResult>} Status request result
|
|
249
|
+
*/
|
|
250
|
+
async checkPrinterStatus() {
|
|
251
|
+
if (!this.connectedPrinter) {
|
|
252
|
+
return {
|
|
253
|
+
success: false,
|
|
254
|
+
message: 'No printer connected',
|
|
255
|
+
error: 'Not connected',
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// On web we send ~HS command
|
|
260
|
+
const result = await this._fetch('/print', {
|
|
261
|
+
method: 'POST',
|
|
262
|
+
body: JSON.stringify({
|
|
263
|
+
zpl: '~HS',
|
|
264
|
+
ip: this.connectedPrinter.ip,
|
|
265
|
+
}),
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
success: result.success,
|
|
270
|
+
message: result.success ? 'Status command sent' : result.error,
|
|
271
|
+
command: '~HS',
|
|
100
272
|
};
|
|
101
273
|
}
|
|
102
274
|
|
|
103
275
|
/**
|
|
104
276
|
* Scan for available printers
|
|
105
|
-
* @
|
|
277
|
+
* @param {{subnet?: string}} [options] - Custom subnet (e.g., "192.168.0")
|
|
278
|
+
* @returns {Promise<ScanResult>} List of found printers
|
|
106
279
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
280
|
+
async scanForPrinters(options = {}) {
|
|
281
|
+
const serviceOk = await this._checkService();
|
|
282
|
+
|
|
283
|
+
if (!serviceOk) {
|
|
284
|
+
return {
|
|
285
|
+
success: false,
|
|
286
|
+
error:
|
|
287
|
+
'Printer service is not available. Add printer-server.js and vite-plugin-zebra-printer.js to your project.',
|
|
288
|
+
printers: [],
|
|
289
|
+
count: 0,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const subnet = options.subnet || this.defaultSubnet || '192.168.1';
|
|
294
|
+
|
|
295
|
+
// Scan the network (can be slow)
|
|
296
|
+
const result = await this._fetch(
|
|
297
|
+
`/scan?subnet=${encodeURIComponent(subnet)}`
|
|
112
298
|
);
|
|
299
|
+
|
|
300
|
+
if (result.success) {
|
|
301
|
+
return {
|
|
302
|
+
success: true,
|
|
303
|
+
printers: (result.printers || []).map((p) => ({
|
|
304
|
+
name: p.name || `Zebra @ ${p.ip}`,
|
|
305
|
+
address: p.ip || p.address,
|
|
306
|
+
type: 'network',
|
|
307
|
+
paired: false,
|
|
308
|
+
})),
|
|
309
|
+
count: result.printers?.length || 0,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
113
313
|
return {
|
|
114
314
|
success: false,
|
|
115
|
-
error:
|
|
116
|
-
'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',
|
|
315
|
+
error: result.error || 'Scan failed',
|
|
117
316
|
printers: [],
|
|
118
317
|
count: 0,
|
|
119
318
|
};
|
|
@@ -121,93 +320,107 @@ class ZebraPrinterWeb extends WebPlugin {
|
|
|
121
320
|
|
|
122
321
|
/**
|
|
123
322
|
* Connect to a printer
|
|
124
|
-
* @param {ConnectOptions}
|
|
125
|
-
* @returns {Promise<ConnectResult>}
|
|
323
|
+
* @param {ConnectOptions} options - Connection parameters
|
|
324
|
+
* @returns {Promise<ConnectResult>} Connection result
|
|
126
325
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
326
|
+
async connect(options) {
|
|
327
|
+
const { address, type } = options || {};
|
|
328
|
+
|
|
329
|
+
if (!address) {
|
|
330
|
+
return {
|
|
331
|
+
success: false,
|
|
332
|
+
connected: false,
|
|
333
|
+
error: 'Printer address (IP) not provided',
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// On web we support only network connections
|
|
338
|
+
if (type === 'bluetooth') {
|
|
339
|
+
return {
|
|
340
|
+
success: false,
|
|
341
|
+
connected: false,
|
|
342
|
+
error:
|
|
343
|
+
'Bluetooth is not available on web. Use IP address or test in the iOS app.',
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const result = await this._fetch('/connect', {
|
|
348
|
+
method: 'POST',
|
|
349
|
+
body: JSON.stringify({ ip: address }),
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
if (result.success) {
|
|
353
|
+
this.connectedPrinter = {
|
|
354
|
+
ip: address,
|
|
355
|
+
name: result.printer?.name || `Zebra @ ${address}`,
|
|
356
|
+
type: 'network',
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
return {
|
|
360
|
+
success: true,
|
|
361
|
+
connected: true,
|
|
362
|
+
address,
|
|
363
|
+
type: 'network',
|
|
364
|
+
message: 'Connected to printer',
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
|
|
133
368
|
return {
|
|
134
369
|
success: false,
|
|
135
370
|
connected: false,
|
|
136
|
-
error:
|
|
137
|
-
'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',
|
|
371
|
+
error: result.error || 'Connection failed',
|
|
138
372
|
};
|
|
139
373
|
}
|
|
140
374
|
|
|
141
375
|
/**
|
|
142
|
-
* Connect to printer by MAC address
|
|
143
|
-
* @param {ConnectOptions}
|
|
144
|
-
* @returns {Promise<ConnectResult>}
|
|
376
|
+
* Connect to printer by MAC address (web - redirect to IP)
|
|
377
|
+
* @param {ConnectOptions} options - Connection parameters
|
|
378
|
+
* @returns {Promise<ConnectResult>} Connection result
|
|
145
379
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
console.warn(
|
|
150
|
-
'ZebraPrinter: connectByAddress called on web platform - not supported'
|
|
151
|
-
);
|
|
152
|
-
return {
|
|
153
|
-
success: false,
|
|
154
|
-
connected: false,
|
|
155
|
-
error:
|
|
156
|
-
'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',
|
|
157
|
-
};
|
|
380
|
+
async connectByAddress(options) {
|
|
381
|
+
console.warn('ZebraPrinter Web: connectByAddress - use IP address on web');
|
|
382
|
+
return await this.connect(options);
|
|
158
383
|
}
|
|
159
384
|
|
|
160
385
|
/**
|
|
161
|
-
* Check device by
|
|
162
|
-
* @param {ConnectOptions}
|
|
163
|
-
* @returns {Promise<ConnectResult>}
|
|
386
|
+
* Check device by address
|
|
387
|
+
* @param {ConnectOptions} options - Parameters with address
|
|
388
|
+
* @returns {Promise<ConnectResult>} Reachability info
|
|
164
389
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
390
|
+
async checkDeviceByAddress(options) {
|
|
391
|
+
const { address } = options || {};
|
|
392
|
+
|
|
393
|
+
if (!address) {
|
|
394
|
+
return {
|
|
395
|
+
success: false,
|
|
396
|
+
error: 'Address not provided',
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const result = await this._fetch('/check', {
|
|
401
|
+
method: 'POST',
|
|
402
|
+
body: JSON.stringify({ ip: address }),
|
|
403
|
+
});
|
|
404
|
+
|
|
171
405
|
return {
|
|
172
|
-
success:
|
|
173
|
-
|
|
174
|
-
|
|
406
|
+
success: true,
|
|
407
|
+
reachable: result.reachable,
|
|
408
|
+
address,
|
|
175
409
|
};
|
|
176
410
|
}
|
|
177
411
|
|
|
178
412
|
/**
|
|
179
413
|
* Disconnect from the printer
|
|
180
|
-
* @returns {Promise<DisconnectResult>}
|
|
414
|
+
* @returns {Promise<DisconnectResult>} Disconnect result
|
|
181
415
|
*/
|
|
182
|
-
// eslint-disable-next-line require-await
|
|
183
416
|
async disconnect() {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
'ZebraPrinter: disconnect called on web platform - not supported'
|
|
187
|
-
);
|
|
417
|
+
this.connectedPrinter = null;
|
|
418
|
+
await Promise.resolve();
|
|
188
419
|
return {
|
|
189
420
|
success: true,
|
|
190
421
|
connected: false,
|
|
191
422
|
};
|
|
192
423
|
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Check printer status with ZPL command
|
|
196
|
-
* @returns {Promise<PrinterStatusResult>} Promise that resolves with printer status result
|
|
197
|
-
*/
|
|
198
|
-
// eslint-disable-next-line require-await
|
|
199
|
-
async checkPrinterStatus() {
|
|
200
|
-
// eslint-disable-next-line no-console
|
|
201
|
-
console.warn(
|
|
202
|
-
'ZebraPrinter: checkPrinterStatus called on web platform - not supported'
|
|
203
|
-
);
|
|
204
|
-
return {
|
|
205
|
-
success: false,
|
|
206
|
-
message:
|
|
207
|
-
'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',
|
|
208
|
-
error: 'Web platform not supported',
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
424
|
}
|
|
212
425
|
|
|
213
426
|
const ZebraPrinter = registerPlugin('ZebraPrinter', {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["../src/web/index.js","../src/index.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\n/**\n * @typedef {import('../definitions').EchoOptions} EchoOptions\n * @typedef {import('../definitions').EchoResult} EchoResult\n * @typedef {import('../definitions').PrintTextOptions} PrintTextOptions\n * @typedef {import('../definitions').PrintResult} PrintResult\n * @typedef {import('../definitions').PrinterStatus} PrinterStatus\n * @typedef {import('../definitions').PrinterStatusResult} PrinterStatusResult\n * @typedef {import('../definitions').ScanResult} ScanResult\n * @typedef {import('../definitions').ConnectOptions} ConnectOptions\n * @typedef {import('../definitions').ConnectResult} ConnectResult\n * @typedef {import('../definitions').DisconnectResult} DisconnectResult\n * @typedef {import('../definitions').PermissionResult} PermissionResult\n */\n\nexport class ZebraPrinterWeb extends WebPlugin {\n /**\n * Echo a value\n * @param {EchoOptions} options - Options containing the value to echo\n * @returns {Promise<EchoResult>} Promise that resolves with the echoed value\n */\n // eslint-disable-next-line require-await\n async echo(options) {\n // eslint-disable-next-line no-console\n console.log('ZebraPrinter: echo called with options:', options);\n return {\n value: options.value,\n };\n }\n\n /**\n * Check if required permissions are granted\n * @returns {Promise<PermissionResult>} Promise that resolves with permission status\n */\n // eslint-disable-next-line require-await\n async checkPermissions() {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: checkPermissions called on web platform - not supported'\n );\n return {\n hasPermissions: false,\n missingPermissions: ['bluetooth', 'location'],\n bluetoothSupported: false,\n bleSupported: false,\n };\n }\n\n /**\n * Request required permissions\n * @returns {Promise<PermissionResult>} Promise that resolves with permission status\n */\n // eslint-disable-next-line require-await\n async requestPermissions() {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: requestPermissions called on web platform - not supported'\n );\n return {\n hasPermissions: false,\n missingPermissions: ['bluetooth', 'location'],\n bluetoothSupported: false,\n bleSupported: false,\n };\n }\n\n /**\n * Print text to the connected printer\n * @param {PrintTextOptions} _options - Options containing the text to print\n * @returns {Promise<PrintResult>} Promise that resolves with print result\n */\n // eslint-disable-next-line require-await\n async printText(_options) {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: printText called on web platform - not supported'\n );\n return {\n success: false,\n message:\n 'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',\n error: 'Web platform not supported',\n };\n }\n\n /**\n * Get printer status\n * @returns {Promise<PrinterStatus>} Promise that resolves with printer status\n */\n // eslint-disable-next-line require-await\n async getStatus() {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: getStatus called on web platform - not supported'\n );\n return {\n connected: false,\n status: 'disconnected',\n };\n }\n\n /**\n * Scan for available printers\n * @returns {Promise<ScanResult>} Promise that resolves with scan results\n */\n // eslint-disable-next-line require-await\n async scanForPrinters() {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: scanForPrinters called on web platform - not supported'\n );\n return {\n success: false,\n error:\n 'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',\n printers: [],\n count: 0,\n };\n }\n\n /**\n * Connect to a printer\n * @param {ConnectOptions} _options - Connection options\n * @returns {Promise<ConnectResult>} Promise that resolves with connection result\n */\n // eslint-disable-next-line require-await\n async connect(_options) {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: connect called on web platform - not supported'\n );\n return {\n success: false,\n connected: false,\n error:\n 'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',\n };\n }\n\n /**\n * Connect to printer by MAC address\n * @param {ConnectOptions} _options - Connection options with address\n * @returns {Promise<ConnectResult>} Promise that resolves with connection result\n */\n // eslint-disable-next-line require-await\n async connectByAddress(_options) {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: connectByAddress called on web platform - not supported'\n );\n return {\n success: false,\n connected: false,\n error:\n 'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',\n };\n }\n\n /**\n * Check device by MAC address\n * @param {ConnectOptions} _options - Connection options with address\n * @returns {Promise<ConnectResult>} Promise that resolves with device info\n */\n // eslint-disable-next-line require-await\n async checkDeviceByAddress(_options) {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: checkDeviceByAddress called on web platform - not supported'\n );\n return {\n success: false,\n error:\n 'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',\n };\n }\n\n /**\n * Disconnect from the printer\n * @returns {Promise<DisconnectResult>} Promise that resolves with disconnection result\n */\n // eslint-disable-next-line require-await\n async disconnect() {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: disconnect called on web platform - not supported'\n );\n return {\n success: true,\n connected: false,\n };\n }\n\n /**\n * Check printer status with ZPL command\n * @returns {Promise<PrinterStatusResult>} Promise that resolves with printer status result\n */\n // eslint-disable-next-line require-await\n async checkPrinterStatus() {\n // eslint-disable-next-line no-console\n console.warn(\n 'ZebraPrinter: checkPrinterStatus called on web platform - not supported'\n );\n return {\n success: false,\n message:\n 'Zebra Printer Plugin is not available on web platform. Please use a native mobile device (iOS/Android).',\n error: 'Web platform not supported',\n };\n }\n}\n","import { registerPlugin } from '@capacitor/core';\n\nimport { ZebraPrinterWeb } from './web';\n\nconst ZebraPrinter = registerPlugin('ZebraPrinter', {\n web: () => new ZebraPrinterWeb(),\n // iOS and Android plugins will be auto-discovered via the Capacitor config\n});\n\nexport { ZebraPrinter };\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAM,eAAe,SAAS,SAAS,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE;AACtB;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,yCAAyC,EAAE,OAAO,CAAC;AACnE,IAAI,OAAO;AACX,MAAM,KAAK,EAAE,OAAO,CAAC,KAAK;AAC1B,KAAK;AACL,EAAE;;AAEF;AACA;A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;AACN,KAAK;AACL,IAAI,OAAO;AACX,MAAM,OAAO,EAAE,KAAK;AACpB,MAAM,OAAO;AACb,QAAQ,yGAAyG;AACjH,MAAM,KAAK,EAAE,4BAA4B;AACzC,KAAK;AACL,EAAE;AACF;;AC9MK,MAAC,YAAY,GAAG,cAAc,CAAC,cAAc,EAAE;AACpD,EAAE,GAAG,EAAE,MAAM,IAAI,eAAe,EAAE;AAClC;AACA,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../src/web/index.js","../src/index.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\n/**\n * ZebraPrinterWeb - Web implementation for development\n *\n * Uses local printer-server.js (TCP/IP) so developers can\n * test the printer in the browser.\n *\n * Production (iOS) uses the native BLE implementation.\n */\n/**\n * @typedef {import('../definitions').EchoOptions} EchoOptions\n * @typedef {import('../definitions').EchoResult} EchoResult\n * @typedef {import('../definitions').PrintTextOptions} PrintTextOptions\n * @typedef {import('../definitions').PrintResult} PrintResult\n * @typedef {import('../definitions').PrinterStatus} PrinterStatus\n * @typedef {import('../definitions').PrinterStatusResult} PrinterStatusResult\n * @typedef {import('../definitions').ScanResult} ScanResult\n * @typedef {import('../definitions').ConnectOptions} ConnectOptions\n * @typedef {import('../definitions').ConnectResult} ConnectResult\n * @typedef {import('../definitions').DisconnectResult} DisconnectResult\n * @typedef {import('../definitions').PermissionResult} PermissionResult\n */\n\nconst API_BASE = '/api/printer';\n\nexport class ZebraPrinterWeb extends WebPlugin {\n constructor() {\n super();\n this.connectedPrinter = null;\n this.serviceAvailable = null;\n this.defaultSubnet = this._getDefaultSubnet();\n }\n\n /**\n * Check if printer-server is reachable\n * @returns {Promise<boolean>} True if reachable\n */\n async _checkService() {\n if (this.serviceAvailable !== null) {\n return this.serviceAvailable;\n }\n\n try {\n const response = await fetch(`${API_BASE}/status`, {\n method: 'GET',\n headers: { 'Content-Type': 'application/json' },\n });\n const data = await response.json();\n this.serviceAvailable = data.success === true;\n return this.serviceAvailable;\n } catch (error) {\n console.warn('ZebraPrinter: service check failed', error);\n this.serviceAvailable = false;\n return false;\n }\n }\n\n /**\n * Fetch wrapper with error handling\n * @param {string} endpoint - API route\n * @param {RequestInit} [options] - Fetch configuration\n * @returns {Promise<any>} Response JSON\n */\n async _fetch(endpoint, options = {}) {\n try {\n const response = await fetch(`${API_BASE}${endpoint}`, {\n headers: { 'Content-Type': 'application/json' },\n ...options,\n });\n return await response.json();\n } catch (error) {\n console.warn(`ZebraPrinter Web: ${endpoint} failed -`, error.message);\n return {\n success: false,\n error:\n 'Printer service is not available. Ensure Vite dev server runs with printer-server plugin.',\n serviceUnavailable: true,\n };\n }\n }\n\n /**\n * Derive default subnet from host IP, if possible\n * @returns {string} Example: \"192.168.1\" or \"10.0.0\"\n */\n _getDefaultSubnet() {\n if (typeof window === 'undefined') return '192.168.1';\n const host = window.location.hostname;\n const ipMatch = host.match(\n /^(10|172\\.(1[6-9]|2[0-9]|3[0-1])|192\\.168)\\.(\\d+)\\.(\\d+)$/\n );\n if (ipMatch) {\n return `${ipMatch[1]}.${ipMatch[3]}`;\n }\n return '192.168.1';\n }\n\n /**\n * Wrap plain text into a basic ZPL label unless it already looks like ZPL\n * @param {string} text - Input text or ZPL\n * @returns {string} ZPL payload\n */\n _wrapTextIfNeeded(text) {\n const isZplLike =\n typeof text === 'string' &&\n /\\^XA/i.test(text) &&\n (/\\^XZ/i.test(text) || /\\^JUS/i.test(text));\n if (isZplLike) {\n return text;\n }\n\n const safeText = String(text ?? '').replaceAll(/\\r?\\n/g, String.raw`\\&`);\n return [\n '^XA',\n '^CI28',\n '^FO50,50',\n '^A0N,30,30',\n `^FD${safeText}^FS`,\n '^XZ',\n ].join('\\n');\n }\n\n /**\n * Echo a value\n * @param {EchoOptions} options - Input data\n * @returns {Promise<EchoResult & {platform: string, serviceAvailable: boolean}>} Echo result with platform info\n */\n async echo(options) {\n console.log('ZebraPrinter: echo called with options:', options);\n const serviceOk = await this._checkService();\n return {\n value: options.value,\n platform: 'web',\n serviceAvailable: serviceOk,\n };\n }\n\n /**\n * Check if required permissions are granted\n * @returns {Promise<PermissionResult>} Permission status\n */\n async checkPermissions() {\n const serviceOk = await this._checkService();\n const hasNavigator = typeof navigator !== 'undefined';\n const bleSupported = hasNavigator && navigator.bluetooth !== undefined;\n\n if (!serviceOk) {\n console.warn('ZebraPrinter: printer-server not available');\n return {\n hasPermissions: false,\n missingPermissions: ['printer-server'],\n bluetoothSupported: bleSupported,\n bleSupported: bleSupported,\n webMode: true,\n serviceAvailable: false,\n };\n }\n\n return {\n hasPermissions: true,\n missingPermissions: [],\n bluetoothSupported: bleSupported,\n bleSupported: bleSupported,\n webMode: true,\n serviceAvailable: true,\n };\n }\n\n /**\n * Request required permissions\n * @returns {Promise<PermissionResult>} Permission status\n */\n async requestPermissions() {\n // Not needed on web - just check service\n return await this.checkPermissions();\n }\n\n /**\n * Print text to the connected printer\n * @param {PrintTextOptions} options - Parameters with ZPL text\n * @returns {Promise<PrintResult>} Print result\n */\n async printText(options) {\n const { text } = options || {};\n\n if (!text) {\n return {\n success: false,\n message: 'No text provided for printing',\n error: 'Missing text parameter',\n };\n }\n\n const zplPayload = this._wrapTextIfNeeded(text);\n\n const result = await this._fetch('/print', {\n method: 'POST',\n body: JSON.stringify({\n zpl: zplPayload,\n ip: this.connectedPrinter?.ip,\n }),\n });\n\n if (result.success) {\n return {\n success: true,\n message: 'Print successful',\n zpl: `${zplPayload.slice(0, 100)}...`,\n bytes: zplPayload.length,\n };\n }\n\n return {\n success: false,\n message: result.error || 'Print failed',\n error: result.error,\n };\n }\n\n /**\n * Get printer status\n * @returns {Promise<PrinterStatus>} Printer status\n */\n async getStatus() {\n if (!this.connectedPrinter) {\n return {\n connected: false,\n status: 'disconnected',\n };\n }\n\n const result = await this._fetch('/check', {\n method: 'POST',\n body: JSON.stringify({ ip: this.connectedPrinter.ip }),\n });\n\n return {\n connected: result.reachable === true,\n status: result.reachable ? 'connected' : 'disconnected',\n printerAddress: this.connectedPrinter.ip,\n printerType: 'network',\n };\n }\n\n /**\n * Check printer status with ZPL command\n * @returns {Promise<PrinterStatusResult>} Status request result\n */\n async checkPrinterStatus() {\n if (!this.connectedPrinter) {\n return {\n success: false,\n message: 'No printer connected',\n error: 'Not connected',\n };\n }\n\n // On web we send ~HS command\n const result = await this._fetch('/print', {\n method: 'POST',\n body: JSON.stringify({\n zpl: '~HS',\n ip: this.connectedPrinter.ip,\n }),\n });\n\n return {\n success: result.success,\n message: result.success ? 'Status command sent' : result.error,\n command: '~HS',\n };\n }\n\n /**\n * Scan for available printers\n * @param {{subnet?: string}} [options] - Custom subnet (e.g., \"192.168.0\")\n * @returns {Promise<ScanResult>} List of found printers\n */\n async scanForPrinters(options = {}) {\n const serviceOk = await this._checkService();\n\n if (!serviceOk) {\n return {\n success: false,\n error:\n 'Printer service is not available. Add printer-server.js and vite-plugin-zebra-printer.js to your project.',\n printers: [],\n count: 0,\n };\n }\n\n const subnet = options.subnet || this.defaultSubnet || '192.168.1';\n\n // Scan the network (can be slow)\n const result = await this._fetch(\n `/scan?subnet=${encodeURIComponent(subnet)}`\n );\n\n if (result.success) {\n return {\n success: true,\n printers: (result.printers || []).map((p) => ({\n name: p.name || `Zebra @ ${p.ip}`,\n address: p.ip || p.address,\n type: 'network',\n paired: false,\n })),\n count: result.printers?.length || 0,\n };\n }\n\n return {\n success: false,\n error: result.error || 'Scan failed',\n printers: [],\n count: 0,\n };\n }\n\n /**\n * Connect to a printer\n * @param {ConnectOptions} options - Connection parameters\n * @returns {Promise<ConnectResult>} Connection result\n */\n async connect(options) {\n const { address, type } = options || {};\n\n if (!address) {\n return {\n success: false,\n connected: false,\n error: 'Printer address (IP) not provided',\n };\n }\n\n // On web we support only network connections\n if (type === 'bluetooth') {\n return {\n success: false,\n connected: false,\n error:\n 'Bluetooth is not available on web. Use IP address or test in the iOS app.',\n };\n }\n\n const result = await this._fetch('/connect', {\n method: 'POST',\n body: JSON.stringify({ ip: address }),\n });\n\n if (result.success) {\n this.connectedPrinter = {\n ip: address,\n name: result.printer?.name || `Zebra @ ${address}`,\n type: 'network',\n };\n\n return {\n success: true,\n connected: true,\n address,\n type: 'network',\n message: 'Connected to printer',\n };\n }\n\n return {\n success: false,\n connected: false,\n error: result.error || 'Connection failed',\n };\n }\n\n /**\n * Connect to printer by MAC address (web - redirect to IP)\n * @param {ConnectOptions} options - Connection parameters\n * @returns {Promise<ConnectResult>} Connection result\n */\n async connectByAddress(options) {\n console.warn('ZebraPrinter Web: connectByAddress - use IP address on web');\n return await this.connect(options);\n }\n\n /**\n * Check device by address\n * @param {ConnectOptions} options - Parameters with address\n * @returns {Promise<ConnectResult>} Reachability info\n */\n async checkDeviceByAddress(options) {\n const { address } = options || {};\n\n if (!address) {\n return {\n success: false,\n error: 'Address not provided',\n };\n }\n\n const result = await this._fetch('/check', {\n method: 'POST',\n body: JSON.stringify({ ip: address }),\n });\n\n return {\n success: true,\n reachable: result.reachable,\n address,\n };\n }\n\n /**\n * Disconnect from the printer\n * @returns {Promise<DisconnectResult>} Disconnect result\n */\n async disconnect() {\n this.connectedPrinter = null;\n await Promise.resolve();\n return {\n success: true,\n connected: false,\n };\n }\n}\n","import { registerPlugin } from '@capacitor/core';\n\nimport { ZebraPrinterWeb } from './web';\n\nconst ZebraPrinter = registerPlugin('ZebraPrinter', {\n web: () => new ZebraPrinterWeb(),\n // iOS and Android plugins will be auto-discovered via the Capacitor config\n});\n\nexport { ZebraPrinter };\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAM,QAAQ,GAAG,cAAc;;AAExB,MAAM,eAAe,SAAS,SAAS,CAAC;AAC/C,EAAE,WAAW,GAAG;AAChB,IAAI,KAAK,EAAE;AACX,IAAI,IAAI,CAAC,gBAAgB,GAAG,IAAI;AAChC,IAAI,IAAI,CAAC,gBAAgB,GAAG,IAAI;AA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