@nitra/zebra 6.1.4 → 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.
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <plugins>
3
+ <plugin name="ZebraPrinter" class="com.nitra.zebra_printer_plugin.ZebraPrinter" />
4
+ </plugins>
@@ -0,0 +1,14 @@
1
+ ext {
2
+ minSdkVersion = 22
3
+ compileSdkVersion = 34
4
+ targetSdkVersion = 34
5
+ androidxActivityVersion = '1.8.2'
6
+ androidxAppCompatVersion = '1.6.1'
7
+ androidxCoordinatorLayoutVersion = '1.2.0'
8
+ androidxCoreVersion = '1.12.0'
9
+ androidxFragmentVersion = '1.6.2'
10
+ junitVersion = '4.13.2'
11
+ androidxJunitVersion = '1.1.5'
12
+ androidxEspressoCoreVersion = '3.5.1'
13
+ cordovaAndroidVersion = '12.0.0'
14
+ }
package/dist/plugin.js ADDED
@@ -0,0 +1,432 @@
1
+ import { WebPlugin, registerPlugin } from '@capacitor/core';
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
+ */
11
+ /**
12
+ * @typedef {import('../definitions').EchoOptions} EchoOptions
13
+ * @typedef {import('../definitions').EchoResult} EchoResult
14
+ * @typedef {import('../definitions').PrintTextOptions} PrintTextOptions
15
+ * @typedef {import('../definitions').PrintResult} PrintResult
16
+ * @typedef {import('../definitions').PrinterStatus} PrinterStatus
17
+ * @typedef {import('../definitions').PrinterStatusResult} PrinterStatusResult
18
+ * @typedef {import('../definitions').ScanResult} ScanResult
19
+ * @typedef {import('../definitions').ConnectOptions} ConnectOptions
20
+ * @typedef {import('../definitions').ConnectResult} ConnectResult
21
+ * @typedef {import('../definitions').DisconnectResult} DisconnectResult
22
+ * @typedef {import('../definitions').PermissionResult} PermissionResult
23
+ */
24
+
25
+ const API_BASE = '/api/printer';
26
+
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
+
124
+ /**
125
+ * Echo a value
126
+ * @param {EchoOptions} options - Input data
127
+ * @returns {Promise<EchoResult & {platform: string, serviceAvailable: boolean}>} Echo result with platform info
128
+ */
129
+ async echo(options) {
130
+ console.log('ZebraPrinter: echo called with options:', options);
131
+ const serviceOk = await this._checkService();
132
+ return {
133
+ value: options.value,
134
+ platform: 'web',
135
+ serviceAvailable: serviceOk,
136
+ };
137
+ }
138
+
139
+ /**
140
+ * Check if required permissions are granted
141
+ * @returns {Promise<PermissionResult>} Permission status
142
+ */
143
+ async checkPermissions() {
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
+
160
+ return {
161
+ hasPermissions: true,
162
+ missingPermissions: [],
163
+ bluetoothSupported: bleSupported,
164
+ bleSupported: bleSupported,
165
+ webMode: true,
166
+ serviceAvailable: true,
167
+ };
168
+ }
169
+
170
+ /**
171
+ * Request required permissions
172
+ * @returns {Promise<PermissionResult>} Permission status
173
+ */
174
+ async requestPermissions() {
175
+ // Not needed on web - just check service
176
+ return await this.checkPermissions();
177
+ }
178
+
179
+ /**
180
+ * Print text to the connected printer
181
+ * @param {PrintTextOptions} options - Parameters with ZPL text
182
+ * @returns {Promise<PrintResult>} Print result
183
+ */
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
+
214
+ return {
215
+ success: false,
216
+ message: result.error || 'Print failed',
217
+ error: result.error,
218
+ };
219
+ }
220
+
221
+ /**
222
+ * Get printer status
223
+ * @returns {Promise<PrinterStatus>} Printer status
224
+ */
225
+ async getStatus() {
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
+
238
+ return {
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',
272
+ };
273
+ }
274
+
275
+ /**
276
+ * Scan for available printers
277
+ * @param {{subnet?: string}} [options] - Custom subnet (e.g., "192.168.0")
278
+ * @returns {Promise<ScanResult>} List of found printers
279
+ */
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)}`
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
+
313
+ return {
314
+ success: false,
315
+ error: result.error || 'Scan failed',
316
+ printers: [],
317
+ count: 0,
318
+ };
319
+ }
320
+
321
+ /**
322
+ * Connect to a printer
323
+ * @param {ConnectOptions} options - Connection parameters
324
+ * @returns {Promise<ConnectResult>} Connection result
325
+ */
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
+
368
+ return {
369
+ success: false,
370
+ connected: false,
371
+ error: result.error || 'Connection failed',
372
+ };
373
+ }
374
+
375
+ /**
376
+ * Connect to printer by MAC address (web - redirect to IP)
377
+ * @param {ConnectOptions} options - Connection parameters
378
+ * @returns {Promise<ConnectResult>} Connection result
379
+ */
380
+ async connectByAddress(options) {
381
+ console.warn('ZebraPrinter Web: connectByAddress - use IP address on web');
382
+ return await this.connect(options);
383
+ }
384
+
385
+ /**
386
+ * Check device by address
387
+ * @param {ConnectOptions} options - Parameters with address
388
+ * @returns {Promise<ConnectResult>} Reachability info
389
+ */
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
+
405
+ return {
406
+ success: true,
407
+ reachable: result.reachable,
408
+ address,
409
+ };
410
+ }
411
+
412
+ /**
413
+ * Disconnect from the printer
414
+ * @returns {Promise<DisconnectResult>} Disconnect result
415
+ */
416
+ async disconnect() {
417
+ this.connectedPrinter = null;
418
+ await Promise.resolve();
419
+ return {
420
+ success: true,
421
+ connected: false,
422
+ };
423
+ }
424
+ }
425
+
426
+ const ZebraPrinter = registerPlugin('ZebraPrinter', {
427
+ web: () => new ZebraPrinterWeb(),
428
+ // iOS and Android plugins will be auto-discovered via the Capacitor config
429
+ });
430
+
431
+ export { ZebraPrinter };
432
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
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;AAChC,IAAI,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,iBAAiB,EAAE;AACjD,EAAE;;AAEF;AACA;AACA;AACA;AACA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MAAM,OAAO,CAAC,OAAO,EAAE;AAC3B,IAAI,OAAO;AACX,MAAM,OAAO,EAAE,IAAI;AACnB,MAAM,SAAS,EAAE,KAAK;AACtB,KAAK;AACL,EAAE;AACF;;ACnaK,MAAC,YAAY,GAAG,cAAc,CAAC,cAAc,EAAE;AACpD,EAAE,GAAG,EAAE,MAAM,IAAI,eAAe,EAAE;AAClC;AACA,CAAC;;;;"}
package/ios/Info.plist ADDED
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <!-- Bluetooth permissions for iOS 13+ -->
6
+ <key>NSBluetoothAlwaysUsageDescription</key>
7
+ <string>This app needs Bluetooth access to connect to Zebra printers for printing labels and
8
+ receipts.</string>
9
+
10
+ <!-- Legacy Bluetooth permissions for iOS 12 and earlier -->
11
+ <key>NSBluetoothPeripheralUsageDescription</key>
12
+ <string>This app needs Bluetooth access to connect to Zebra printers for printing labels and
13
+ receipts.</string>
14
+
15
+ <!-- Background modes for Bluetooth -->
16
+ <key>UIBackgroundModes</key>
17
+ <array>
18
+ <string>bluetooth-central</string>
19
+ </array>
20
+
21
+ <!-- Required device capabilities -->
22
+ <key>UIRequiredDeviceCapabilities</key>
23
+ <array>
24
+ <string>bluetooth-le</string>
25
+ </array>
26
+
27
+ <!-- Privacy usage descriptions for better permission handling -->
28
+ <key>NSLocationWhenInUseUsageDescription</key>
29
+ <string>This app needs location access to scan for nearby Bluetooth devices like Zebra
30
+ printers.</string>
31
+
32
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
33
+ <string>This app needs location access to scan for nearby Bluetooth devices like Zebra
34
+ printers.</string>
35
+ </dict>
36
+ </plist>
@@ -0,0 +1,16 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <Capacitor/Capacitor.h>
3
+
4
+ // Define the plugin using the CAP_PLUGIN macro
5
+ CAP_PLUGIN(ZebraPrinterPlugin, "ZebraPrinter",
6
+ CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
7
+ CAP_PLUGIN_METHOD(checkPermissions, CAPPluginReturnPromise);
8
+ CAP_PLUGIN_METHOD(requestPermissions, CAPPluginReturnPromise);
9
+ CAP_PLUGIN_METHOD(printText, CAPPluginReturnPromise);
10
+ CAP_PLUGIN_METHOD(getStatus, CAPPluginReturnPromise);
11
+ CAP_PLUGIN_METHOD(checkPrinterStatus, CAPPluginReturnPromise);
12
+ CAP_PLUGIN_METHOD(scanForPrinters, CAPPluginReturnPromise);
13
+ CAP_PLUGIN_METHOD(connect, CAPPluginReturnPromise);
14
+ CAP_PLUGIN_METHOD(disconnect, CAPPluginReturnPromise);
15
+ )
16
+