seven365-zyprinter 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Package.swift +43 -0
- package/README.md +186 -0
- package/Seven365Zyprinter.podspec +27 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/mycompany/plugins/example/Example.java +342 -0
- package/android/src/main/java/com/mycompany/plugins/example/ExamplePlugin.java +161 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +229 -0
- package/dist/esm/definitions.d.ts +56 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +49 -0
- package/dist/esm/web.js +40 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +54 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +57 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Seven365Zyprinter.podspec +28 -0
- package/ios/Sources/Plugin/ZyprintPlugin.swift +161 -0
- package/ios/Sources/Plugin/ZywellSDK.swift +358 -0
- package/ios/Sources/Seven365Zyprinter-Umbrella.h +16 -0
- package/ios/Sources/module.modulemap +12 -0
- package/ios/Sources/sources/BLEManager.h +658 -0
- package/ios/Sources/sources/BLEManager.m +2842 -0
- package/ios/Sources/sources/GCD/Documentation.html +47 -0
- package/ios/Sources/sources/GCD/GCDAsyncSocket.h +1226 -0
- package/ios/Sources/sources/GCD/GCDAsyncSocket.m +8560 -0
- package/ios/Sources/sources/GCD/GCDAsyncUdpSocket.h +1036 -0
- package/ios/Sources/sources/GCD/GCDAsyncUdpSocket.m +5632 -0
- package/ios/Sources/sources/GCD/PrinterManager.h +91 -0
- package/ios/Sources/sources/GCD/PrinterManager.m +513 -0
- package/ios/Sources/sources/GCD/WifiManager.h +91 -0
- package/ios/Sources/sources/GCD/WifiManager.m +510 -0
- package/ios/Sources/sources/ImageTranster.h +38 -0
- package/ios/Sources/sources/ImageTranster.m +389 -0
- package/ios/Sources/sources/POSBLEManager.h +759 -0
- package/ios/Sources/sources/POSBLEManager.m +834 -0
- package/ios/Sources/sources/POSSDK.h +93 -0
- package/ios/Sources/sources/POSWIFIManager.h +116 -0
- package/ios/Sources/sources/POSWIFIManager.m +260 -0
- package/ios/Sources/sources/POSWIFIManagerAsync.h +745 -0
- package/ios/Sources/sources/POSWIFIManagerAsync.m +1847 -0
- package/ios/Sources/sources/PosCommand.h +633 -0
- package/ios/Sources/sources/PosCommand.m +1019 -0
- package/ios/Sources/sources/TscCommand.h +723 -0
- package/ios/Sources/sources/TscCommand.m +566 -0
- package/ios/Tests/ExamplePluginTests/ExamplePluginTests.swift +15 -0
- package/package.json +339 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
package com.mycompany.plugins.example;
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.JSArray;
|
|
4
|
+
import com.getcapacitor.JSObject;
|
|
5
|
+
import com.getcapacitor.Plugin;
|
|
6
|
+
import com.getcapacitor.PluginCall;
|
|
7
|
+
import com.getcapacitor.PluginMethod;
|
|
8
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
9
|
+
|
|
10
|
+
@CapacitorPlugin(name = "Zyprint")
|
|
11
|
+
public class ZyprintPlugin extends Plugin {
|
|
12
|
+
|
|
13
|
+
private Zyprint implementation = new Zyprint();
|
|
14
|
+
|
|
15
|
+
@PluginMethod
|
|
16
|
+
public void echo(PluginCall call) {
|
|
17
|
+
String value = call.getString("value");
|
|
18
|
+
|
|
19
|
+
JSObject ret = new JSObject();
|
|
20
|
+
ret.put("value", implementation.echo(value));
|
|
21
|
+
call.resolve(ret);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@PluginMethod
|
|
25
|
+
public void discoverPrinters(PluginCall call) {
|
|
26
|
+
implementation.discoverPrinters(new Zyprint.PrinterDiscoveryCallback() {
|
|
27
|
+
@Override
|
|
28
|
+
public void onPrintersFound(JSArray printers) {
|
|
29
|
+
JSObject ret = new JSObject();
|
|
30
|
+
ret.put("printers", printers);
|
|
31
|
+
call.resolve(ret);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Override
|
|
35
|
+
public void onError(String error) {
|
|
36
|
+
call.reject(error);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@PluginMethod
|
|
42
|
+
public void connectToPrinter(PluginCall call) {
|
|
43
|
+
String identifier = call.getString("identifier");
|
|
44
|
+
if (identifier == null) {
|
|
45
|
+
call.reject("Missing identifier parameter");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
implementation.connectToPrinter(identifier, new Zyprint.ConnectionCallback() {
|
|
50
|
+
@Override
|
|
51
|
+
public void onConnected() {
|
|
52
|
+
JSObject ret = new JSObject();
|
|
53
|
+
ret.put("connected", true);
|
|
54
|
+
call.resolve(ret);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Override
|
|
58
|
+
public void onError(String error) {
|
|
59
|
+
call.reject(error);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@PluginMethod
|
|
65
|
+
public void disconnectFromPrinter(PluginCall call) {
|
|
66
|
+
String identifier = call.getString("identifier");
|
|
67
|
+
if (identifier == null) {
|
|
68
|
+
call.reject("Missing identifier parameter");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
implementation.disconnectFromPrinter(identifier, new Zyprint.DisconnectionCallback() {
|
|
73
|
+
@Override
|
|
74
|
+
public void onDisconnected() {
|
|
75
|
+
JSObject ret = new JSObject();
|
|
76
|
+
ret.put("disconnected", true);
|
|
77
|
+
call.resolve(ret);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public void onError(String error) {
|
|
82
|
+
call.reject(error);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@PluginMethod
|
|
88
|
+
public void printText(PluginCall call) {
|
|
89
|
+
String text = call.getString("text");
|
|
90
|
+
String identifier = call.getString("identifier");
|
|
91
|
+
|
|
92
|
+
if (text == null || identifier == null) {
|
|
93
|
+
call.reject("Missing required parameters");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
implementation.printText(text, identifier, new Zyprint.PrintCallback() {
|
|
98
|
+
@Override
|
|
99
|
+
public void onSuccess() {
|
|
100
|
+
JSObject ret = new JSObject();
|
|
101
|
+
ret.put("success", true);
|
|
102
|
+
call.resolve(ret);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@Override
|
|
106
|
+
public void onError(String error) {
|
|
107
|
+
call.reject(error);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@PluginMethod
|
|
113
|
+
public void printReceipt(PluginCall call) {
|
|
114
|
+
JSObject template = call.getObject("template");
|
|
115
|
+
String identifier = call.getString("identifier");
|
|
116
|
+
|
|
117
|
+
if (template == null || identifier == null) {
|
|
118
|
+
call.reject("Missing required parameters");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
implementation.printReceipt(template, identifier, new Zyprint.PrintCallback() {
|
|
123
|
+
@Override
|
|
124
|
+
public void onSuccess() {
|
|
125
|
+
JSObject ret = new JSObject();
|
|
126
|
+
ret.put("success", true);
|
|
127
|
+
call.resolve(ret);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@Override
|
|
131
|
+
public void onError(String error) {
|
|
132
|
+
call.reject(error);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@PluginMethod
|
|
138
|
+
public void getPrinterStatus(PluginCall call) {
|
|
139
|
+
String identifier = call.getString("identifier");
|
|
140
|
+
if (identifier == null) {
|
|
141
|
+
call.reject("Missing identifier parameter");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
implementation.getPrinterStatus(identifier, new Zyprint.StatusCallback() {
|
|
146
|
+
@Override
|
|
147
|
+
public void onStatus(String status, String paperStatus, boolean connected) {
|
|
148
|
+
JSObject ret = new JSObject();
|
|
149
|
+
ret.put("status", status);
|
|
150
|
+
ret.put("paperStatus", paperStatus);
|
|
151
|
+
ret.put("connected", connected);
|
|
152
|
+
call.resolve(ret);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@Override
|
|
156
|
+
public void onError(String error) {
|
|
157
|
+
call.reject(error);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
File without changes
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "ZyprintPlugin",
|
|
4
|
+
"slug": "zyprintplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "echo",
|
|
10
|
+
"signature": "(options: { value: string; }) => Promise<{ value: string; }>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "",
|
|
15
|
+
"type": "{ value: string; }"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<{ value: string; }>",
|
|
19
|
+
"tags": [],
|
|
20
|
+
"docs": "",
|
|
21
|
+
"complexTypes": [],
|
|
22
|
+
"slug": "echo"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "discoverPrinters",
|
|
26
|
+
"signature": "() => Promise<{ printers: ZyPrinter[]; }>",
|
|
27
|
+
"parameters": [],
|
|
28
|
+
"returns": "Promise<{ printers: ZyPrinter[]; }>",
|
|
29
|
+
"tags": [],
|
|
30
|
+
"docs": "",
|
|
31
|
+
"complexTypes": [
|
|
32
|
+
"ZyPrinter"
|
|
33
|
+
],
|
|
34
|
+
"slug": "discoverprinters"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "discoverBluetoothPrinters",
|
|
38
|
+
"signature": "() => Promise<{ printers: ZyPrinter[]; }>",
|
|
39
|
+
"parameters": [],
|
|
40
|
+
"returns": "Promise<{ printers: ZyPrinter[]; }>",
|
|
41
|
+
"tags": [],
|
|
42
|
+
"docs": "",
|
|
43
|
+
"complexTypes": [
|
|
44
|
+
"ZyPrinter"
|
|
45
|
+
],
|
|
46
|
+
"slug": "discoverbluetoothprinters"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "discoverWiFiPrinters",
|
|
50
|
+
"signature": "(options?: { networkRange?: string | undefined; } | undefined) => Promise<{ printers: ZyPrinter[]; }>",
|
|
51
|
+
"parameters": [
|
|
52
|
+
{
|
|
53
|
+
"name": "options",
|
|
54
|
+
"docs": "",
|
|
55
|
+
"type": "{ networkRange?: string | undefined; } | undefined"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"returns": "Promise<{ printers: ZyPrinter[]; }>",
|
|
59
|
+
"tags": [],
|
|
60
|
+
"docs": "",
|
|
61
|
+
"complexTypes": [
|
|
62
|
+
"ZyPrinter"
|
|
63
|
+
],
|
|
64
|
+
"slug": "discoverwifiprinters"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "connectToPrinter",
|
|
68
|
+
"signature": "(options: { identifier: string; }) => Promise<{ connected: boolean; }>",
|
|
69
|
+
"parameters": [
|
|
70
|
+
{
|
|
71
|
+
"name": "options",
|
|
72
|
+
"docs": "",
|
|
73
|
+
"type": "{ identifier: string; }"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"returns": "Promise<{ connected: boolean; }>",
|
|
77
|
+
"tags": [],
|
|
78
|
+
"docs": "",
|
|
79
|
+
"complexTypes": [],
|
|
80
|
+
"slug": "connecttoprinter"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "disconnectFromPrinter",
|
|
84
|
+
"signature": "(options: { identifier: string; }) => Promise<{ disconnected: boolean; }>",
|
|
85
|
+
"parameters": [
|
|
86
|
+
{
|
|
87
|
+
"name": "options",
|
|
88
|
+
"docs": "",
|
|
89
|
+
"type": "{ identifier: string; }"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"returns": "Promise<{ disconnected: boolean; }>",
|
|
93
|
+
"tags": [],
|
|
94
|
+
"docs": "",
|
|
95
|
+
"complexTypes": [],
|
|
96
|
+
"slug": "disconnectfromprinter"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "printText",
|
|
100
|
+
"signature": "(options: { text: string; identifier: string; }) => Promise<{ success: boolean; }>",
|
|
101
|
+
"parameters": [
|
|
102
|
+
{
|
|
103
|
+
"name": "options",
|
|
104
|
+
"docs": "",
|
|
105
|
+
"type": "{ text: string; identifier: string; }"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"returns": "Promise<{ success: boolean; }>",
|
|
109
|
+
"tags": [],
|
|
110
|
+
"docs": "",
|
|
111
|
+
"complexTypes": [],
|
|
112
|
+
"slug": "printtext"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "printReceipt",
|
|
116
|
+
"signature": "(options: { template: Record<string, any>; identifier: string; }) => Promise<{ success: boolean; }>",
|
|
117
|
+
"parameters": [
|
|
118
|
+
{
|
|
119
|
+
"name": "options",
|
|
120
|
+
"docs": "",
|
|
121
|
+
"type": "{ template: Record<string, any>; identifier: string; }"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"returns": "Promise<{ success: boolean; }>",
|
|
125
|
+
"tags": [],
|
|
126
|
+
"docs": "",
|
|
127
|
+
"complexTypes": [
|
|
128
|
+
"Record"
|
|
129
|
+
],
|
|
130
|
+
"slug": "printreceipt"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "getPrinterStatus",
|
|
134
|
+
"signature": "(options: { identifier: string; }) => Promise<{ status: string; paperStatus: string; connected: boolean; }>",
|
|
135
|
+
"parameters": [
|
|
136
|
+
{
|
|
137
|
+
"name": "options",
|
|
138
|
+
"docs": "",
|
|
139
|
+
"type": "{ identifier: string; }"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"returns": "Promise<{ status: string; paperStatus: string; connected: boolean; }>",
|
|
143
|
+
"tags": [],
|
|
144
|
+
"docs": "",
|
|
145
|
+
"complexTypes": [],
|
|
146
|
+
"slug": "getprinterstatus"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"properties": []
|
|
150
|
+
},
|
|
151
|
+
"interfaces": [
|
|
152
|
+
{
|
|
153
|
+
"name": "ZyPrinter",
|
|
154
|
+
"slug": "zyprinter",
|
|
155
|
+
"docs": "",
|
|
156
|
+
"tags": [],
|
|
157
|
+
"methods": [],
|
|
158
|
+
"properties": [
|
|
159
|
+
{
|
|
160
|
+
"name": "identifier",
|
|
161
|
+
"tags": [],
|
|
162
|
+
"docs": "",
|
|
163
|
+
"complexTypes": [],
|
|
164
|
+
"type": "string"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "model",
|
|
168
|
+
"tags": [],
|
|
169
|
+
"docs": "",
|
|
170
|
+
"complexTypes": [],
|
|
171
|
+
"type": "string"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "status",
|
|
175
|
+
"tags": [],
|
|
176
|
+
"docs": "",
|
|
177
|
+
"complexTypes": [],
|
|
178
|
+
"type": "string"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "connectionType",
|
|
182
|
+
"tags": [],
|
|
183
|
+
"docs": "",
|
|
184
|
+
"complexTypes": [],
|
|
185
|
+
"type": "'bluetooth' | 'wifi' | 'usb'"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "ipAddress",
|
|
189
|
+
"tags": [],
|
|
190
|
+
"docs": "",
|
|
191
|
+
"complexTypes": [],
|
|
192
|
+
"type": "string | undefined"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "port",
|
|
196
|
+
"tags": [],
|
|
197
|
+
"docs": "",
|
|
198
|
+
"complexTypes": [],
|
|
199
|
+
"type": "number | undefined"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "rssi",
|
|
203
|
+
"tags": [],
|
|
204
|
+
"docs": "",
|
|
205
|
+
"complexTypes": [],
|
|
206
|
+
"type": "number | undefined"
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"enums": [],
|
|
212
|
+
"typeAliases": [
|
|
213
|
+
{
|
|
214
|
+
"name": "Record",
|
|
215
|
+
"slug": "record",
|
|
216
|
+
"docs": "Construct a type with a set of properties K of type T",
|
|
217
|
+
"types": [
|
|
218
|
+
{
|
|
219
|
+
"text": "{\r\n [P in K]: T;\r\n}",
|
|
220
|
+
"complexTypes": [
|
|
221
|
+
"K",
|
|
222
|
+
"T"
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"pluginConfigs": []
|
|
229
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface ZyPrinter {
|
|
2
|
+
identifier: string;
|
|
3
|
+
model: string;
|
|
4
|
+
status: string;
|
|
5
|
+
connectionType: 'bluetooth' | 'wifi' | 'usb';
|
|
6
|
+
ipAddress?: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
rssi?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ZyprintPlugin {
|
|
11
|
+
echo(options: {
|
|
12
|
+
value: string;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
value: string;
|
|
15
|
+
}>;
|
|
16
|
+
discoverPrinters(): Promise<{
|
|
17
|
+
printers: ZyPrinter[];
|
|
18
|
+
}>;
|
|
19
|
+
discoverBluetoothPrinters(): Promise<{
|
|
20
|
+
printers: ZyPrinter[];
|
|
21
|
+
}>;
|
|
22
|
+
discoverWiFiPrinters(options?: {
|
|
23
|
+
networkRange?: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
printers: ZyPrinter[];
|
|
26
|
+
}>;
|
|
27
|
+
connectToPrinter(options: {
|
|
28
|
+
identifier: string;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
connected: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
disconnectFromPrinter(options: {
|
|
33
|
+
identifier: string;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
disconnected: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
printText(options: {
|
|
38
|
+
text: string;
|
|
39
|
+
identifier: string;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
printReceipt(options: {
|
|
44
|
+
template: Record<string, any>;
|
|
45
|
+
identifier: string;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
getPrinterStatus(options: {
|
|
50
|
+
identifier: string;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
status: string;
|
|
53
|
+
paperStatus: string;
|
|
54
|
+
connected: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
@@ -0,0 +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 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 \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: Record<string, any>; identifier: string }): Promise<{ success: boolean }>;\n \n // Printer Status\n getPrinterStatus(options: { identifier: string }): Promise<{ status: string; paperStatus: string; connected: boolean }>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CAC3D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { ZyprintPlugin } from './definitions';\n\nconst Zyprint = registerPlugin<ZyprintPlugin>('Zyprint', {\n web: () => import('./web').then((m) => new m.ZyprintWeb()),\n});\n\nexport * from './definitions';\nexport { Zyprint };\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { ZyprintPlugin, ZyPrinter } from './definitions';
|
|
3
|
+
export declare class ZyprintWeb extends WebPlugin implements ZyprintPlugin {
|
|
4
|
+
echo(options: {
|
|
5
|
+
value: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
value: string;
|
|
8
|
+
}>;
|
|
9
|
+
discoverPrinters(): Promise<{
|
|
10
|
+
printers: ZyPrinter[];
|
|
11
|
+
}>;
|
|
12
|
+
discoverBluetoothPrinters(): Promise<{
|
|
13
|
+
printers: ZyPrinter[];
|
|
14
|
+
}>;
|
|
15
|
+
discoverWiFiPrinters(_options?: {
|
|
16
|
+
networkRange?: string;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
printers: ZyPrinter[];
|
|
19
|
+
}>;
|
|
20
|
+
connectToPrinter(_options: {
|
|
21
|
+
identifier: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
connected: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
disconnectFromPrinter(_options: {
|
|
26
|
+
identifier: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
disconnected: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
printText(_options: {
|
|
31
|
+
text: string;
|
|
32
|
+
identifier: string;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
success: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
printReceipt(_options: {
|
|
37
|
+
template: Record<string, any>;
|
|
38
|
+
identifier: string;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
success: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
getPrinterStatus(_options: {
|
|
43
|
+
identifier: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
status: string;
|
|
46
|
+
paperStatus: string;
|
|
47
|
+
connected: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class ZyprintWeb extends WebPlugin {
|
|
3
|
+
async echo(options) {
|
|
4
|
+
console.log('ECHO', options);
|
|
5
|
+
return options;
|
|
6
|
+
}
|
|
7
|
+
async discoverPrinters() {
|
|
8
|
+
console.warn('Zyprint discovery is not available on web platform');
|
|
9
|
+
return { printers: [] };
|
|
10
|
+
}
|
|
11
|
+
async discoverBluetoothPrinters() {
|
|
12
|
+
console.warn('Zyprint Bluetooth discovery is not available on web platform');
|
|
13
|
+
return { printers: [] };
|
|
14
|
+
}
|
|
15
|
+
async discoverWiFiPrinters(_options) {
|
|
16
|
+
console.warn('Zyprint WiFi discovery is not available on web platform');
|
|
17
|
+
return { printers: [] };
|
|
18
|
+
}
|
|
19
|
+
async connectToPrinter(_options) {
|
|
20
|
+
console.warn('Zyprint connection is not available on web platform');
|
|
21
|
+
return { connected: false };
|
|
22
|
+
}
|
|
23
|
+
async disconnectFromPrinter(_options) {
|
|
24
|
+
console.warn('Zyprint disconnection is not available on web platform');
|
|
25
|
+
return { disconnected: false };
|
|
26
|
+
}
|
|
27
|
+
async printText(_options) {
|
|
28
|
+
console.warn('Zyprint printing is not available on web platform');
|
|
29
|
+
return { success: false };
|
|
30
|
+
}
|
|
31
|
+
async printReceipt(_options) {
|
|
32
|
+
console.warn('Zyprint receipt printing is not available on web platform');
|
|
33
|
+
return { success: false };
|
|
34
|
+
}
|
|
35
|
+
async getPrinterStatus(_options) {
|
|
36
|
+
console.warn('Zyprint status check is not available on web platform');
|
|
37
|
+
return { status: 'unknown', paperStatus: 'unknown', connected: false };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const Zyprint = core.registerPlugin('Zyprint', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.ZyprintWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class ZyprintWeb extends core.WebPlugin {
|
|
10
|
+
async echo(options) {
|
|
11
|
+
console.log('ECHO', options);
|
|
12
|
+
return options;
|
|
13
|
+
}
|
|
14
|
+
async discoverPrinters() {
|
|
15
|
+
console.warn('Zyprint discovery is not available on web platform');
|
|
16
|
+
return { printers: [] };
|
|
17
|
+
}
|
|
18
|
+
async discoverBluetoothPrinters() {
|
|
19
|
+
console.warn('Zyprint Bluetooth discovery is not available on web platform');
|
|
20
|
+
return { printers: [] };
|
|
21
|
+
}
|
|
22
|
+
async discoverWiFiPrinters(_options) {
|
|
23
|
+
console.warn('Zyprint WiFi discovery is not available on web platform');
|
|
24
|
+
return { printers: [] };
|
|
25
|
+
}
|
|
26
|
+
async connectToPrinter(_options) {
|
|
27
|
+
console.warn('Zyprint connection is not available on web platform');
|
|
28
|
+
return { connected: false };
|
|
29
|
+
}
|
|
30
|
+
async disconnectFromPrinter(_options) {
|
|
31
|
+
console.warn('Zyprint disconnection is not available on web platform');
|
|
32
|
+
return { disconnected: false };
|
|
33
|
+
}
|
|
34
|
+
async printText(_options) {
|
|
35
|
+
console.warn('Zyprint printing is not available on web platform');
|
|
36
|
+
return { success: false };
|
|
37
|
+
}
|
|
38
|
+
async printReceipt(_options) {
|
|
39
|
+
console.warn('Zyprint receipt printing is not available on web platform');
|
|
40
|
+
return { success: false };
|
|
41
|
+
}
|
|
42
|
+
async getPrinterStatus(_options) {
|
|
43
|
+
console.warn('Zyprint status check is not available on web platform');
|
|
44
|
+
return { status: 'unknown', paperStatus: 'unknown', connected: false };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
49
|
+
__proto__: null,
|
|
50
|
+
ZyprintWeb: ZyprintWeb
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
exports.Zyprint = Zyprint;
|
|
54
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +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;AACtC,QAAQ,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC;AACpF,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;AAC/B,IAAI;AACJ,IAAI,MAAM,oBAAoB,CAAC,QAAQ,EAAE;AACzC,QAAQ,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC;AAC/E,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;AAC/B,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC;AAC3E,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE;AACnC,IAAI;AACJ,IAAI,MAAM,qBAAqB,CAAC,QAAQ,EAAE;AAC1C,QAAQ,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC;AAC9E,QAAQ,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE;AACtC,IAAI;AACJ,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;AAC9B,QAAQ,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC;AACzE,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC;AACjF,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ,IAAI,MAAM,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;;;;;;;;;"}
|