seven365-zyprinter 0.4.0 → 1.0.0
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/README.md +115 -17
- package/dist/docs.json +369 -24
- package/dist/esm/definitions.d.ts +65 -11
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +4 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +4 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/Plugin/ZyprintPlugin.swift +13 -0
- package/ios/Sources/Plugin/ZywellSDK.swift +462 -44
- package/package.json +1 -1
|
@@ -7,24 +7,75 @@ export interface ZyPrinter {
|
|
|
7
7
|
port?: number;
|
|
8
8
|
rssi?: number;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export declare type TSize = '1' | '2' | '3' | '4' | 'normal' | 'large' | 'xlarge';
|
|
11
|
+
export declare type TModifierStyle = 'standard' | 'minimal' | 'bullet' | 'arrow' | 'detailed';
|
|
12
|
+
export declare type TModifierIndent = 'small' | 'medium' | 'large';
|
|
13
|
+
export interface HeaderConfig {
|
|
14
|
+
restaurant_name?: string;
|
|
15
|
+
sub_header?: string;
|
|
16
|
+
prefix?: string;
|
|
17
|
+
gst_number?: string;
|
|
18
|
+
address?: string;
|
|
19
|
+
phone_number?: string;
|
|
20
|
+
size?: TSize;
|
|
21
|
+
bold?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface ItemConfig {
|
|
24
|
+
size?: TSize;
|
|
25
|
+
bold?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface ModifierConfig {
|
|
28
|
+
style?: TModifierStyle;
|
|
29
|
+
indent?: TModifierIndent;
|
|
30
|
+
size?: TSize;
|
|
31
|
+
}
|
|
32
|
+
export interface TotalConfig {
|
|
33
|
+
size?: TSize;
|
|
34
|
+
bold?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface FooterConfig {
|
|
37
|
+
message?: string;
|
|
38
|
+
date_format?: string;
|
|
39
|
+
time_format?: string;
|
|
40
|
+
size?: TSize;
|
|
41
|
+
bold?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface KitchenItem {
|
|
44
|
+
qty?: number;
|
|
45
|
+
name?: string;
|
|
46
|
+
menu?: {
|
|
47
|
+
_id?: string;
|
|
48
|
+
name: string;
|
|
49
|
+
price?: string;
|
|
50
|
+
categoryName?: string;
|
|
51
|
+
printer?: string;
|
|
52
|
+
};
|
|
53
|
+
quantity?: number;
|
|
54
|
+
price?: number;
|
|
55
|
+
total_price?: number;
|
|
56
|
+
modifiers?: Array<{
|
|
57
|
+
modifier?: string;
|
|
58
|
+
name: string;
|
|
59
|
+
qty?: number;
|
|
60
|
+
quantity?: number;
|
|
61
|
+
price?: number;
|
|
62
|
+
}>;
|
|
17
63
|
}
|
|
18
64
|
export interface ReceiptTemplate {
|
|
19
|
-
header?:
|
|
65
|
+
header?: HeaderConfig;
|
|
66
|
+
kitchen?: KitchenItem[];
|
|
20
67
|
items?: Array<{
|
|
21
68
|
name: string;
|
|
22
69
|
price: string;
|
|
23
70
|
}>;
|
|
24
|
-
kitchen?: Array<any>;
|
|
25
71
|
total?: string;
|
|
26
|
-
|
|
27
|
-
|
|
72
|
+
order_type?: string;
|
|
73
|
+
table_name?: string;
|
|
74
|
+
order_number?: string;
|
|
75
|
+
footer?: FooterConfig;
|
|
76
|
+
item?: ItemConfig;
|
|
77
|
+
total_config?: TotalConfig;
|
|
78
|
+
modifier?: ModifierConfig;
|
|
28
79
|
}
|
|
29
80
|
export interface ZyprintPlugin {
|
|
30
81
|
echo(options: {
|
|
@@ -43,6 +94,9 @@ export interface ZyprintPlugin {
|
|
|
43
94
|
}): Promise<{
|
|
44
95
|
printers: ZyPrinter[];
|
|
45
96
|
}>;
|
|
97
|
+
discoverUSBPrinters(): Promise<{
|
|
98
|
+
printers: ZyPrinter[];
|
|
99
|
+
}>;
|
|
46
100
|
connectToPrinter(options: {
|
|
47
101
|
identifier: string;
|
|
48
102
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["// Enhanced printer interface with connection type details\nexport interface ZyPrinter {\n identifier: string;\n model: string;\n status: string;\n connectionType: 'bluetooth' | 'wifi' | 'usb';\n ipAddress?: string;\n port?: number;\n rssi?: number;\n}\n\nexport
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["// Enhanced printer interface with connection type details\nexport interface ZyPrinter {\n identifier: string;\n model: string;\n status: string;\n connectionType: 'bluetooth' | 'wifi' | 'usb';\n ipAddress?: string;\n port?: number;\n rssi?: number;\n}\n\nexport type TSize = '1' | '2' | '3' | '4' | 'normal' | 'large' | 'xlarge';\nexport type TModifierStyle = 'standard' | 'minimal' | 'bullet' | 'arrow' | 'detailed';\nexport type TModifierIndent = 'small' | 'medium' | 'large';\n\nexport interface HeaderConfig {\n restaurant_name?: string;\n sub_header?: string;\n prefix?: string;\n gst_number?: string;\n address?: string;\n phone_number?: string;\n size?: TSize;\n bold?: boolean;\n}\n\nexport interface ItemConfig {\n size?: TSize;\n bold?: boolean;\n}\n\nexport interface ModifierConfig {\n style?: TModifierStyle;\n indent?: TModifierIndent;\n size?: TSize;\n}\n\nexport interface TotalConfig {\n size?: TSize;\n bold?: boolean;\n}\n\nexport interface FooterConfig {\n message?: string;\n date_format?: string;\n time_format?: string;\n size?: TSize;\n bold?: boolean;\n}\n\nexport interface KitchenItem {\n // Simple format (edit.vue)\n qty?: number;\n name?: string;\n \n // Complex format (zyprint-test.vue - from API/backend)\n menu?: {\n _id?: string;\n name: string;\n price?: string;\n categoryName?: string;\n printer?: string;\n };\n quantity?: number;\n price?: number;\n total_price?: number;\n \n // Shared properties\n modifiers?: Array<{ \n modifier?: string;\n name: string; \n qty?: number;\n quantity?: number;\n price?: number;\n }>;\n}\n\nexport interface ReceiptTemplate {\n header?: HeaderConfig;\n kitchen?: KitchenItem[];\n items?: Array<{ name: string; price: string }>; // Legacy support\n total?: string;\n order_type?: string;\n table_name?: string;\n order_number?: string;\n footer?: FooterConfig;\n item?: ItemConfig;\n total_config?: TotalConfig;\n modifier?: ModifierConfig;\n}\n\nexport interface ZyprintPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n \n // Enhanced Printer Discovery Methods\n discoverPrinters(): Promise<{ printers: ZyPrinter[] }>;\n discoverBluetoothPrinters(): Promise<{ printers: ZyPrinter[] }>;\n discoverWiFiPrinters(options?: { networkRange?: string }): Promise<{ printers: ZyPrinter[] }>;\n discoverUSBPrinters(): Promise<{ printers: ZyPrinter[] }>;\n \n // Connection Management\n connectToPrinter(options: { identifier: string }): Promise<{ connected: boolean }>;\n disconnectFromPrinter(options: { identifier: string }): Promise<{ disconnected: boolean }>;\n \n // Printing Methods\n printText(options: { text: string; identifier: string }): Promise<{ success: boolean }>;\n printReceipt(options: { template: ReceiptTemplate; identifier: string }): Promise<{ success: boolean }>;\n \n // Printer Status\n getPrinterStatus(options: { identifier: string }): Promise<{ status: string; paperStatus: string; connected: boolean }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export declare class ZyprintWeb extends WebPlugin implements ZyprintPlugin {
|
|
|
17
17
|
}): Promise<{
|
|
18
18
|
printers: ZyPrinter[];
|
|
19
19
|
}>;
|
|
20
|
+
discoverUSBPrinters(): Promise<{
|
|
21
|
+
printers: ZyPrinter[];
|
|
22
|
+
}>;
|
|
20
23
|
connectToPrinter(_options: {
|
|
21
24
|
identifier: string;
|
|
22
25
|
}): Promise<{
|
package/dist/esm/web.js
CHANGED
|
@@ -16,6 +16,10 @@ export class ZyprintWeb extends WebPlugin {
|
|
|
16
16
|
console.warn('Zyprint WiFi discovery is not available on web platform');
|
|
17
17
|
return { printers: [] };
|
|
18
18
|
}
|
|
19
|
+
async discoverUSBPrinters() {
|
|
20
|
+
console.warn('Zyprint USB discovery is not available on web platform');
|
|
21
|
+
return { printers: [] };
|
|
22
|
+
}
|
|
19
23
|
async connectToPrinter(_options) {
|
|
20
24
|
console.warn('Zyprint connection is not available on web platform');
|
|
21
25
|
return { connected: false };
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,UAAW,SAAQ,SAAS;IACvC,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;QACnE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,yBAAyB;QAC7B,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC7E,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,QAAoC;QAC7D,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;QACxE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAgC;QACrD,OAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QACpE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,QAAgC;QAC1D,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAA8C;QAC5D,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;QAClE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA+D;QAChF,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;QAC1E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAgC;QACrD,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;QACtE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACzE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { ZyprintPlugin, ZyPrinter } from './definitions';\n\nexport class ZyprintWeb extends WebPlugin implements ZyprintPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async discoverPrinters(): Promise<{ printers: ZyPrinter[] }> {\n console.warn('Zyprint discovery is not available on web platform');\n return { printers: [] };\n }\n\n async discoverBluetoothPrinters(): Promise<{ printers: ZyPrinter[] }> {\n console.warn('Zyprint Bluetooth discovery is not available on web platform');\n return { printers: [] };\n }\n\n async discoverWiFiPrinters(_options?: { networkRange?: string }): Promise<{ printers: ZyPrinter[] }> {\n console.warn('Zyprint WiFi discovery is not available on web platform');\n return { printers: [] };\n }\n\n async connectToPrinter(_options: { identifier: string }): Promise<{ connected: boolean }> {\n console.warn('Zyprint connection is not available on web platform');\n return { connected: false };\n }\n\n async disconnectFromPrinter(_options: { identifier: string }): Promise<{ disconnected: boolean }> {\n console.warn('Zyprint disconnection is not available on web platform');\n return { disconnected: false };\n }\n\n async printText(_options: { text: string; identifier: string }): Promise<{ success: boolean }> {\n console.warn('Zyprint printing is not available on web platform');\n return { success: false };\n }\n\n async printReceipt(_options: { template: Record<string, any>; identifier: string }): Promise<{ success: boolean }> {\n console.warn('Zyprint receipt printing is not available on web platform');\n return { success: false };\n }\n\n async getPrinterStatus(_options: { identifier: string }): Promise<{ status: string; paperStatus: string; connected: boolean }> {\n console.warn('Zyprint status check is not available on web platform');\n return { status: 'unknown', paperStatus: 'unknown', connected: false };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,UAAW,SAAQ,SAAS;IACvC,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;QACnE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,yBAAyB;QAC7B,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC7E,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,QAAoC;QAC7D,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;QACxE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAgC;QACrD,OAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QACpE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,QAAgC;QAC1D,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAA8C;QAC5D,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;QAClE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA+D;QAChF,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;QAC1E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAgC;QACrD,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;QACtE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACzE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { ZyprintPlugin, ZyPrinter } from './definitions';\n\nexport class ZyprintWeb extends WebPlugin implements ZyprintPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async discoverPrinters(): Promise<{ printers: ZyPrinter[] }> {\n console.warn('Zyprint discovery is not available on web platform');\n return { printers: [] };\n }\n\n async discoverBluetoothPrinters(): Promise<{ printers: ZyPrinter[] }> {\n console.warn('Zyprint Bluetooth discovery is not available on web platform');\n return { printers: [] };\n }\n\n async discoverWiFiPrinters(_options?: { networkRange?: string }): Promise<{ printers: ZyPrinter[] }> {\n console.warn('Zyprint WiFi discovery is not available on web platform');\n return { printers: [] };\n }\n\n async discoverUSBPrinters(): Promise<{ printers: ZyPrinter[] }> {\n console.warn('Zyprint USB discovery is not available on web platform');\n return { printers: [] };\n }\n\n async connectToPrinter(_options: { identifier: string }): Promise<{ connected: boolean }> {\n console.warn('Zyprint connection is not available on web platform');\n return { connected: false };\n }\n\n async disconnectFromPrinter(_options: { identifier: string }): Promise<{ disconnected: boolean }> {\n console.warn('Zyprint disconnection is not available on web platform');\n return { disconnected: false };\n }\n\n async printText(_options: { text: string; identifier: string }): Promise<{ success: boolean }> {\n console.warn('Zyprint printing is not available on web platform');\n return { success: false };\n }\n\n async printReceipt(_options: { template: Record<string, any>; identifier: string }): Promise<{ success: boolean }> {\n console.warn('Zyprint receipt printing is not available on web platform');\n return { success: false };\n }\n\n async getPrinterStatus(_options: { identifier: string }): Promise<{ status: string; paperStatus: string; connected: boolean }> {\n console.warn('Zyprint status check is not available on web platform');\n return { status: 'unknown', paperStatus: 'unknown', connected: false };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -23,6 +23,10 @@ class ZyprintWeb extends core.WebPlugin {
|
|
|
23
23
|
console.warn('Zyprint WiFi discovery is not available on web platform');
|
|
24
24
|
return { printers: [] };
|
|
25
25
|
}
|
|
26
|
+
async discoverUSBPrinters() {
|
|
27
|
+
console.warn('Zyprint USB discovery is not available on web platform');
|
|
28
|
+
return { printers: [] };
|
|
29
|
+
}
|
|
26
30
|
async connectToPrinter(_options) {
|
|
27
31
|
console.warn('Zyprint connection is not available on web platform');
|
|
28
32
|
return { connected: false };
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Zyprint = registerPlugin('Zyprint', {\n web: () => import('./web').then((m) => new m.ZyprintWeb()),\n});\nexport * from './definitions';\nexport { Zyprint };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ZyprintWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async discoverPrinters() {\n console.warn('Zyprint discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverBluetoothPrinters() {\n console.warn('Zyprint Bluetooth discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverWiFiPrinters(_options) {\n console.warn('Zyprint WiFi discovery is not available on web platform');\n return { printers: [] };\n }\n async connectToPrinter(_options) {\n console.warn('Zyprint connection is not available on web platform');\n return { connected: false };\n }\n async disconnectFromPrinter(_options) {\n console.warn('Zyprint disconnection is not available on web platform');\n return { disconnected: false };\n }\n async printText(_options) {\n console.warn('Zyprint printing is not available on web platform');\n return { success: false };\n }\n async printReceipt(_options) {\n console.warn('Zyprint receipt printing is not available on web platform');\n return { success: false };\n }\n async getPrinterStatus(_options) {\n console.warn('Zyprint status check is not available on web platform');\n return { status: 'unknown', paperStatus: 'unknown', connected: false };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;AAC1C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AAC9D,CAAC;;ACFM,MAAM,UAAU,SAASC,cAAS,CAAC;AAC1C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC;AAC1E,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;AAC/B,IAAI;AACJ,IAAI,MAAM,yBAAyB,GAAG;A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';\nconst Zyprint = registerPlugin('Zyprint', {\n web: () => import('./web').then((m) => new m.ZyprintWeb()),\n});\nexport * from './definitions';\nexport { Zyprint };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ZyprintWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async discoverPrinters() {\n console.warn('Zyprint discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverBluetoothPrinters() {\n console.warn('Zyprint Bluetooth discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverWiFiPrinters(_options) {\n console.warn('Zyprint WiFi discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverUSBPrinters() {\n console.warn('Zyprint USB discovery is not available on web platform');\n return { printers: [] };\n }\n async connectToPrinter(_options) {\n console.warn('Zyprint connection is not available on web platform');\n return { connected: false };\n }\n async disconnectFromPrinter(_options) {\n console.warn('Zyprint disconnection is not available on web platform');\n return { disconnected: false };\n }\n async printText(_options) {\n console.warn('Zyprint printing is not available on web platform');\n return { success: false };\n }\n async printReceipt(_options) {\n console.warn('Zyprint receipt printing is not available on web platform');\n return { success: false };\n }\n async getPrinterStatus(_options) {\n console.warn('Zyprint status check is not available on web platform');\n return { status: 'unknown', paperStatus: 'unknown', connected: false };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;AAC1C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AAC9D,CAAC;;ACFM,MAAM,UAAU,SAASC,cAAS,CAAC;AAC1C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAA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,gBAAgB,CAAC,QAAQ,EAAE;AACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC;AAC7E,QAAQ,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE;AAC9E,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -22,6 +22,10 @@ var capacitorExample = (function (exports, core) {
|
|
|
22
22
|
console.warn('Zyprint WiFi discovery is not available on web platform');
|
|
23
23
|
return { printers: [] };
|
|
24
24
|
}
|
|
25
|
+
async discoverUSBPrinters() {
|
|
26
|
+
console.warn('Zyprint USB discovery is not available on web platform');
|
|
27
|
+
return { printers: [] };
|
|
28
|
+
}
|
|
25
29
|
async connectToPrinter(_options) {
|
|
26
30
|
console.warn('Zyprint connection is not available on web platform');
|
|
27
31
|
return { connected: false };
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Zyprint = registerPlugin('Zyprint', {\n web: () => import('./web').then((m) => new m.ZyprintWeb()),\n});\nexport * from './definitions';\nexport { Zyprint };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ZyprintWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async discoverPrinters() {\n console.warn('Zyprint discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverBluetoothPrinters() {\n console.warn('Zyprint Bluetooth discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverWiFiPrinters(_options) {\n console.warn('Zyprint WiFi discovery is not available on web platform');\n return { printers: [] };\n }\n async connectToPrinter(_options) {\n console.warn('Zyprint connection is not available on web platform');\n return { connected: false };\n }\n async disconnectFromPrinter(_options) {\n console.warn('Zyprint disconnection is not available on web platform');\n return { disconnected: false };\n }\n async printText(_options) {\n console.warn('Zyprint printing is not available on web platform');\n return { success: false };\n }\n async printReceipt(_options) {\n console.warn('Zyprint receipt printing is not available on web platform');\n return { success: false };\n }\n async getPrinterStatus(_options) {\n console.warn('Zyprint status check is not available on web platform');\n return { status: 'unknown', paperStatus: 'unknown', connected: false };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;IAC1C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;IAC9D,CAAC;;ICFM,MAAM,UAAU,SAASC,cAAS,CAAC;IAC1C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC;IAC1E,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,yBAAyB,GAAG;IACtC,QAAQ,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC;IACpF,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,oBAAoB,CAAC,QAAQ,EAAE;IACzC,QAAQ,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC;IAC/E,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC;IAC3E,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,qBAAqB,CAAC,QAAQ,EAAE;IAC1C,QAAQ,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC;IAC9E,QAAQ,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE;IACtC,IAAI;IACJ,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;IAC9B,QAAQ,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC;IACzE,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC;IACjF,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC;IAC7E,QAAQ,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE;IAC9E,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Zyprint = registerPlugin('Zyprint', {\n web: () => import('./web').then((m) => new m.ZyprintWeb()),\n});\nexport * from './definitions';\nexport { Zyprint };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ZyprintWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async discoverPrinters() {\n console.warn('Zyprint discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverBluetoothPrinters() {\n console.warn('Zyprint Bluetooth discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverWiFiPrinters(_options) {\n console.warn('Zyprint WiFi discovery is not available on web platform');\n return { printers: [] };\n }\n async discoverUSBPrinters() {\n console.warn('Zyprint USB discovery is not available on web platform');\n return { printers: [] };\n }\n async connectToPrinter(_options) {\n console.warn('Zyprint connection is not available on web platform');\n return { connected: false };\n }\n async disconnectFromPrinter(_options) {\n console.warn('Zyprint disconnection is not available on web platform');\n return { disconnected: false };\n }\n async printText(_options) {\n console.warn('Zyprint printing is not available on web platform');\n return { success: false };\n }\n async printReceipt(_options) {\n console.warn('Zyprint receipt printing is not available on web platform');\n return { success: false };\n }\n async getPrinterStatus(_options) {\n console.warn('Zyprint status check is not available on web platform');\n return { status: 'unknown', paperStatus: 'unknown', connected: false };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;IAC1C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;IAC9D,CAAC;;ICFM,MAAM,UAAU,SAASC,cAAS,CAAC;IAC1C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC;IAC1E,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,yBAAyB,GAAG;IACtC,QAAQ,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC;IACpF,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,oBAAoB,CAAC,QAAQ,EAAE;IACzC,QAAQ,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC;IAC/E,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,mBAAmB,GAAG;IAChC,QAAQ,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC;IAC9E,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC;IAC3E,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,qBAAqB,CAAC,QAAQ,EAAE;IAC1C,QAAQ,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC;IAC9E,QAAQ,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE;IACtC,IAAI;IACJ,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;IAC9B,QAAQ,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC;IACzE,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC;IACjF,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC;IAC7E,QAAQ,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE;IAC9E,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -17,6 +17,7 @@ public class ZyprintPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
17
17
|
CAPPluginMethod(name: "discoverPrinters", returnType: CAPPluginReturnPromise),
|
|
18
18
|
CAPPluginMethod(name: "discoverBluetoothPrinters", returnType: CAPPluginReturnPromise),
|
|
19
19
|
CAPPluginMethod(name: "discoverWiFiPrinters", returnType: CAPPluginReturnPromise),
|
|
20
|
+
CAPPluginMethod(name: "discoverUSBPrinters", returnType: CAPPluginReturnPromise),
|
|
20
21
|
CAPPluginMethod(name: "connectToPrinter", returnType: CAPPluginReturnPromise),
|
|
21
22
|
CAPPluginMethod(name: "disconnectFromPrinter", returnType: CAPPluginReturnPromise),
|
|
22
23
|
CAPPluginMethod(name: "printText", returnType: CAPPluginReturnPromise),
|
|
@@ -70,6 +71,18 @@ public class ZyprintPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
@objc func discoverUSBPrinters(_ call: CAPPluginCall) {
|
|
75
|
+
implementation.discoverUSBPrinters { printers, error in
|
|
76
|
+
if let error = error {
|
|
77
|
+
call.reject(error)
|
|
78
|
+
} else {
|
|
79
|
+
call.resolve([
|
|
80
|
+
"printers": printers
|
|
81
|
+
])
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
73
86
|
@objc func connectToPrinter(_ call: CAPPluginCall) {
|
|
74
87
|
guard let identifier = call.getString("identifier") else {
|
|
75
88
|
call.reject("Missing identifier parameter")
|