@fedejm/capacitor-esc-pos-printer 0.1.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.
Files changed (57) hide show
  1. package/CapacitorEscPosPrinter.podspec +17 -0
  2. package/README.md +203 -0
  3. package/android/build.gradle +58 -0
  4. package/android/src/main/AndroidManifest.xml +21 -0
  5. package/android/src/main/java/com/getcapacitor/community/escposprinter/EscPosPrinterPlugin.java +353 -0
  6. package/android/src/main/java/com/getcapacitor/community/escposprinter/printers/BasePrinter.java +84 -0
  7. package/android/src/main/java/com/getcapacitor/community/escposprinter/printers/BluetoothLEPrinter.java +14 -0
  8. package/android/src/main/java/com/getcapacitor/community/escposprinter/printers/BluetoothPrinter.java +80 -0
  9. package/android/src/main/java/com/getcapacitor/community/escposprinter/printers/NetworkPrinter.java +12 -0
  10. package/android/src/main/java/com/getcapacitor/community/escposprinter/printers/UsbPrinter.java +14 -0
  11. package/android/src/main/java/com/getcapacitor/community/escposprinter/printers/constants/PrinterErrorCode.java +8 -0
  12. package/android/src/main/java/com/getcapacitor/community/escposprinter/printers/exceptions/PrinterException.java +19 -0
  13. package/dist/docs.json +281 -0
  14. package/dist/esm/definitions.d.ts +37 -0
  15. package/dist/esm/definitions.js +2 -0
  16. package/dist/esm/definitions.js.map +1 -0
  17. package/dist/esm/enums/index.d.ts +2 -0
  18. package/dist/esm/enums/index.js +3 -0
  19. package/dist/esm/enums/index.js.map +1 -0
  20. package/dist/esm/enums/printer-connection-type.d.ts +3 -0
  21. package/dist/esm/enums/printer-connection-type.js +5 -0
  22. package/dist/esm/enums/printer-connection-type.js.map +1 -0
  23. package/dist/esm/enums/printer-error-code.d.ts +6 -0
  24. package/dist/esm/enums/printer-error-code.js +8 -0
  25. package/dist/esm/enums/printer-error-code.js.map +1 -0
  26. package/dist/esm/errors/index.d.ts +1 -0
  27. package/dist/esm/errors/index.js +2 -0
  28. package/dist/esm/errors/index.js.map +1 -0
  29. package/dist/esm/errors/printer-error.d.ts +5 -0
  30. package/dist/esm/errors/printer-error.js +7 -0
  31. package/dist/esm/errors/printer-error.js.map +1 -0
  32. package/dist/esm/index.d.ts +5 -0
  33. package/dist/esm/index.js +6 -0
  34. package/dist/esm/index.js.map +1 -0
  35. package/dist/esm/plugin.d.ts +2 -0
  36. package/dist/esm/plugin.js +5 -0
  37. package/dist/esm/plugin.js.map +1 -0
  38. package/dist/esm/printers/base-printer.d.ts +13 -0
  39. package/dist/esm/printers/base-printer.js +97 -0
  40. package/dist/esm/printers/base-printer.js.map +1 -0
  41. package/dist/esm/printers/bluetooth-printer.d.ts +4 -0
  42. package/dist/esm/printers/bluetooth-printer.js +12 -0
  43. package/dist/esm/printers/bluetooth-printer.js.map +1 -0
  44. package/dist/esm/printers/capacitor-linked-printer.d.ts +9 -0
  45. package/dist/esm/printers/capacitor-linked-printer.js +30 -0
  46. package/dist/esm/printers/capacitor-linked-printer.js.map +1 -0
  47. package/dist/esm/printers/index.d.ts +2 -0
  48. package/dist/esm/printers/index.js +3 -0
  49. package/dist/esm/printers/index.js.map +1 -0
  50. package/dist/esm/web.d.ts +13 -0
  51. package/dist/esm/web.js +37 -0
  52. package/dist/esm/web.js.map +1 -0
  53. package/dist/plugin.cjs.js +207 -0
  54. package/dist/plugin.cjs.js.map +1 -0
  55. package/dist/plugin.js +210 -0
  56. package/dist/plugin.js.map +1 -0
  57. package/package.json +84 -0
package/dist/plugin.js ADDED
@@ -0,0 +1,210 @@
1
+ var capacitorEscPosPrinter = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ class PrinterError extends Error {
5
+ constructor(message, errorCode) {
6
+ super(message);
7
+ this.errorCode = errorCode;
8
+ }
9
+ }
10
+
11
+ const EscPosPrinter = core.registerPlugin('EscPosPrinter', {
12
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.EscPosPrinterWeb()),
13
+ });
14
+
15
+ class CapacitorLinkedPrinter {
16
+ constructor(createOptions) {
17
+ this.createOptions = createOptions;
18
+ }
19
+ isLinked() {
20
+ return !!this.internalHashKey;
21
+ }
22
+ async link() {
23
+ if (this.internalHashKey) {
24
+ // Prevent recreating new control in native hash map
25
+ return;
26
+ }
27
+ const { value } = await EscPosPrinter.createPrinter(this.createOptions);
28
+ this.internalHashKey = value;
29
+ }
30
+ async dispose() {
31
+ if (!this.internalHashKey) {
32
+ throw new Error('Printer not linked to native');
33
+ }
34
+ const { value } = await EscPosPrinter.disposePrinter({
35
+ hashKey: this.internalHashKey,
36
+ });
37
+ if (!value) {
38
+ throw new Error('Printer cannot be disposed');
39
+ }
40
+ this.internalHashKey = undefined;
41
+ }
42
+ }
43
+
44
+ class BasePrinter extends CapacitorLinkedPrinter {
45
+ async isConnected() {
46
+ if (!this.internalHashKey) {
47
+ throw new Error('Printer not linked to native');
48
+ }
49
+ if (!this.writeBuffer) {
50
+ return false;
51
+ }
52
+ const { value } = await EscPosPrinter.isPrinterConnected({
53
+ hashKey: this.internalHashKey,
54
+ });
55
+ return value;
56
+ }
57
+ async connect() {
58
+ if (!this.internalHashKey) {
59
+ throw new Error('Printer not linked to native');
60
+ }
61
+ try {
62
+ await EscPosPrinter.connectPrinter({
63
+ hashKey: this.internalHashKey,
64
+ });
65
+ this.writeBuffer = [];
66
+ }
67
+ catch (e) {
68
+ throw this.parseError(e);
69
+ }
70
+ }
71
+ async disconnect() {
72
+ if (!this.internalHashKey) {
73
+ throw new Error('Printer not linked to native');
74
+ }
75
+ await EscPosPrinter.disconnectPrinter({
76
+ hashKey: this.internalHashKey,
77
+ });
78
+ this.writeBuffer = undefined;
79
+ }
80
+ async write(data) {
81
+ if (!this.internalHashKey) {
82
+ throw new Error('Printer not linked to native');
83
+ }
84
+ if (!this.writeBuffer) {
85
+ throw new Error('Printer not connected');
86
+ }
87
+ const clampedBytes = new Uint8ClampedArray(data);
88
+ this.writeBuffer.push(...clampedBytes);
89
+ }
90
+ async send(timeOrData, waitingTime) {
91
+ if (!this.internalHashKey) {
92
+ throw new Error('Printer not linked to native');
93
+ }
94
+ if (!this.writeBuffer) {
95
+ throw new Error('Printer not connected');
96
+ }
97
+ if (Array.isArray(timeOrData)) {
98
+ const clampedBytes = new Uint8ClampedArray(timeOrData);
99
+ this.writeBuffer.push(...clampedBytes);
100
+ }
101
+ else if (typeof timeOrData === 'number') {
102
+ waitingTime = timeOrData;
103
+ }
104
+ try {
105
+ await EscPosPrinter.sendToPrinter({
106
+ hashKey: this.internalHashKey,
107
+ data: this.writeBuffer,
108
+ waitingTime,
109
+ });
110
+ this.writeBuffer = [];
111
+ }
112
+ catch (e) {
113
+ throw this.parseError(e);
114
+ }
115
+ }
116
+ async read() {
117
+ if (!this.internalHashKey) {
118
+ throw new Error('Printer not linked to native');
119
+ }
120
+ try {
121
+ const { value } = await EscPosPrinter.readFromPrinter({
122
+ hashKey: this.internalHashKey,
123
+ });
124
+ return value;
125
+ }
126
+ catch (e) {
127
+ throw this.parseError(e);
128
+ }
129
+ }
130
+ parseError(e) {
131
+ if (!e.data) {
132
+ return e;
133
+ }
134
+ return new PrinterError(e.message, e.data.code);
135
+ }
136
+ }
137
+
138
+ exports.PrinterConnectionType = void 0;
139
+ (function (PrinterConnectionType) {
140
+ PrinterConnectionType["Bluetooth"] = "bluetooth";
141
+ })(exports.PrinterConnectionType || (exports.PrinterConnectionType = {}));
142
+
143
+ class BluetoothPrinter extends BasePrinter {
144
+ constructor(address, secure) {
145
+ super({
146
+ connectionType: exports.PrinterConnectionType.Bluetooth,
147
+ address,
148
+ secure,
149
+ });
150
+ }
151
+ }
152
+
153
+ exports.PrinterErrorCode = void 0;
154
+ (function (PrinterErrorCode) {
155
+ PrinterErrorCode[PrinterErrorCode["Connect"] = 1] = "Connect";
156
+ PrinterErrorCode[PrinterErrorCode["NotConnected"] = 2] = "NotConnected";
157
+ PrinterErrorCode[PrinterErrorCode["Send"] = 3] = "Send";
158
+ PrinterErrorCode[PrinterErrorCode["Read"] = 4] = "Read";
159
+ })(exports.PrinterErrorCode || (exports.PrinterErrorCode = {}));
160
+
161
+ class EscPosPrinterWeb extends core.WebPlugin {
162
+ async requestBluetoothEnable() {
163
+ return { value: false };
164
+ }
165
+ async getBluetoothPrinterDevices() {
166
+ const devices = await navigator.bluetooth.getDevices();
167
+ console.log('getBluetoothPrinterDevices', devices);
168
+ return { devices: [] };
169
+ }
170
+ async createPrinter(options) {
171
+ console.log('createPrinter', JSON.stringify(options));
172
+ return { value: '' };
173
+ }
174
+ async disposePrinter(options) {
175
+ console.log('disposePrinter', JSON.stringify(options));
176
+ return { value: false };
177
+ }
178
+ async isPrinterConnected(options) {
179
+ console.log('isPrinterConnected', JSON.stringify(options));
180
+ return { value: false };
181
+ }
182
+ async connectPrinter(options) {
183
+ console.log('connectPrinter', JSON.stringify(options));
184
+ }
185
+ async disconnectPrinter(options) {
186
+ console.log('disconnectPrinter', JSON.stringify(options));
187
+ }
188
+ async sendToPrinter(options) {
189
+ console.log('sendToPrinter', JSON.stringify(options));
190
+ }
191
+ async readFromPrinter(options) {
192
+ console.log('readFromPrinter', JSON.stringify(options));
193
+ return { value: [] };
194
+ }
195
+ }
196
+
197
+ var web = /*#__PURE__*/Object.freeze({
198
+ __proto__: null,
199
+ EscPosPrinterWeb: EscPosPrinterWeb
200
+ });
201
+
202
+ exports.BasePrinter = BasePrinter;
203
+ exports.BluetoothPrinter = BluetoothPrinter;
204
+ exports.EscPosPrinter = EscPosPrinter;
205
+ exports.PrinterError = PrinterError;
206
+
207
+ return exports;
208
+
209
+ })({}, capacitorExports);
210
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/errors/printer-error.js","esm/plugin.js","esm/printers/capacitor-linked-printer.js","esm/printers/base-printer.js","esm/enums/printer-connection-type.js","esm/printers/bluetooth-printer.js","esm/enums/printer-error-code.js","esm/web.js"],"sourcesContent":["export class PrinterError extends Error {\r\n constructor(message, errorCode) {\r\n super(message);\r\n this.errorCode = errorCode;\r\n }\r\n}\r\n//# sourceMappingURL=printer-error.js.map","import { registerPlugin } from '@capacitor/core';\r\nexport const EscPosPrinter = registerPlugin('EscPosPrinter', {\r\n web: () => import('./web').then(m => new m.EscPosPrinterWeb()),\r\n});\r\n//# sourceMappingURL=plugin.js.map","import { EscPosPrinter } from '../plugin';\r\nexport class CapacitorLinkedPrinter {\r\n constructor(createOptions) {\r\n this.createOptions = createOptions;\r\n }\r\n isLinked() {\r\n return !!this.internalHashKey;\r\n }\r\n async link() {\r\n if (this.internalHashKey) {\r\n // Prevent recreating new control in native hash map\r\n return;\r\n }\r\n const { value } = await EscPosPrinter.createPrinter(this.createOptions);\r\n this.internalHashKey = value;\r\n }\r\n async dispose() {\r\n if (!this.internalHashKey) {\r\n throw new Error('Printer not linked to native');\r\n }\r\n const { value } = await EscPosPrinter.disposePrinter({\r\n hashKey: this.internalHashKey,\r\n });\r\n if (!value) {\r\n throw new Error('Printer cannot be disposed');\r\n }\r\n this.internalHashKey = undefined;\r\n }\r\n}\r\n//# sourceMappingURL=capacitor-linked-printer.js.map","import { PrinterError } from '../errors/printer-error';\r\nimport { EscPosPrinter } from '../plugin';\r\nimport { CapacitorLinkedPrinter } from './capacitor-linked-printer';\r\nexport class BasePrinter extends CapacitorLinkedPrinter {\r\n async isConnected() {\r\n if (!this.internalHashKey) {\r\n throw new Error('Printer not linked to native');\r\n }\r\n if (!this.writeBuffer) {\r\n return false;\r\n }\r\n const { value } = await EscPosPrinter.isPrinterConnected({\r\n hashKey: this.internalHashKey,\r\n });\r\n return value;\r\n }\r\n async connect() {\r\n if (!this.internalHashKey) {\r\n throw new Error('Printer not linked to native');\r\n }\r\n try {\r\n await EscPosPrinter.connectPrinter({\r\n hashKey: this.internalHashKey,\r\n });\r\n this.writeBuffer = [];\r\n }\r\n catch (e) {\r\n throw this.parseError(e);\r\n }\r\n }\r\n async disconnect() {\r\n if (!this.internalHashKey) {\r\n throw new Error('Printer not linked to native');\r\n }\r\n await EscPosPrinter.disconnectPrinter({\r\n hashKey: this.internalHashKey,\r\n });\r\n this.writeBuffer = undefined;\r\n }\r\n async write(data) {\r\n if (!this.internalHashKey) {\r\n throw new Error('Printer not linked to native');\r\n }\r\n if (!this.writeBuffer) {\r\n throw new Error('Printer not connected');\r\n }\r\n const clampedBytes = new Uint8ClampedArray(data);\r\n this.writeBuffer.push(...clampedBytes);\r\n }\r\n async send(timeOrData, waitingTime) {\r\n if (!this.internalHashKey) {\r\n throw new Error('Printer not linked to native');\r\n }\r\n if (!this.writeBuffer) {\r\n throw new Error('Printer not connected');\r\n }\r\n if (Array.isArray(timeOrData)) {\r\n const clampedBytes = new Uint8ClampedArray(timeOrData);\r\n this.writeBuffer.push(...clampedBytes);\r\n }\r\n else if (typeof timeOrData === 'number') {\r\n waitingTime = timeOrData;\r\n }\r\n try {\r\n await EscPosPrinter.sendToPrinter({\r\n hashKey: this.internalHashKey,\r\n data: this.writeBuffer,\r\n waitingTime,\r\n });\r\n this.writeBuffer = [];\r\n }\r\n catch (e) {\r\n throw this.parseError(e);\r\n }\r\n }\r\n async read() {\r\n if (!this.internalHashKey) {\r\n throw new Error('Printer not linked to native');\r\n }\r\n try {\r\n const { value } = await EscPosPrinter.readFromPrinter({\r\n hashKey: this.internalHashKey,\r\n });\r\n return value;\r\n }\r\n catch (e) {\r\n throw this.parseError(e);\r\n }\r\n }\r\n parseError(e) {\r\n if (!e.data) {\r\n return e;\r\n }\r\n return new PrinterError(e.message, e.data.code);\r\n }\r\n}\r\n//# sourceMappingURL=base-printer.js.map","export var PrinterConnectionType;\r\n(function (PrinterConnectionType) {\r\n PrinterConnectionType[\"Bluetooth\"] = \"bluetooth\";\r\n})(PrinterConnectionType || (PrinterConnectionType = {}));\r\n//# sourceMappingURL=printer-connection-type.js.map","import { PrinterConnectionType } from '../enums/printer-connection-type';\r\nimport { BasePrinter } from './base-printer';\r\nexport class BluetoothPrinter extends BasePrinter {\r\n constructor(address, secure) {\r\n super({\r\n connectionType: PrinterConnectionType.Bluetooth,\r\n address,\r\n secure,\r\n });\r\n }\r\n}\r\n//# sourceMappingURL=bluetooth-printer.js.map","export var PrinterErrorCode;\r\n(function (PrinterErrorCode) {\r\n PrinterErrorCode[PrinterErrorCode[\"Connect\"] = 1] = \"Connect\";\r\n PrinterErrorCode[PrinterErrorCode[\"NotConnected\"] = 2] = \"NotConnected\";\r\n PrinterErrorCode[PrinterErrorCode[\"Send\"] = 3] = \"Send\";\r\n PrinterErrorCode[PrinterErrorCode[\"Read\"] = 4] = \"Read\";\r\n})(PrinterErrorCode || (PrinterErrorCode = {}));\r\n//# sourceMappingURL=printer-error-code.js.map","import { WebPlugin } from '@capacitor/core';\r\nexport class EscPosPrinterWeb extends WebPlugin {\r\n async requestBluetoothEnable() {\r\n return { value: false };\r\n }\r\n async getBluetoothPrinterDevices() {\r\n const devices = await navigator.bluetooth.getDevices();\r\n console.log('getBluetoothPrinterDevices', devices);\r\n return { devices: [] };\r\n }\r\n async createPrinter(options) {\r\n console.log('createPrinter', JSON.stringify(options));\r\n return { value: '' };\r\n }\r\n async disposePrinter(options) {\r\n console.log('disposePrinter', JSON.stringify(options));\r\n return { value: false };\r\n }\r\n async isPrinterConnected(options) {\r\n console.log('isPrinterConnected', JSON.stringify(options));\r\n return { value: false };\r\n }\r\n async connectPrinter(options) {\r\n console.log('connectPrinter', JSON.stringify(options));\r\n }\r\n async disconnectPrinter(options) {\r\n console.log('disconnectPrinter', JSON.stringify(options));\r\n }\r\n async sendToPrinter(options) {\r\n console.log('sendToPrinter', JSON.stringify(options));\r\n }\r\n async readFromPrinter(options) {\r\n console.log('readFromPrinter', JSON.stringify(options));\r\n return { value: [] };\r\n }\r\n}\r\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","PrinterConnectionType","PrinterErrorCode","WebPlugin"],"mappings":";;;IAAO,MAAM,YAAY,SAAS,KAAK,CAAC;IACxC,IAAI,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE;IACpC,QAAQ,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,QAAQ,IAAI,CAAC,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"}
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@fedejm/capacitor-esc-pos-printer",
3
+ "version": "0.1.0",
4
+ "description": "CapacitorJS wrapper for ESC POS (native) printers.",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Plugin/",
14
+ "CapacitorEscPosPrinter.podspec"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "author": "",
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/soylomass/capacitor-esc-pos-printer.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/soylomass/capacitor-esc-pos-printer/issues"
27
+ },
28
+ "keywords": [
29
+ "capacitor",
30
+ "plugin",
31
+ "native"
32
+ ],
33
+ "scripts": {
34
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
35
+ "verify:ios": "xcodebuild -scheme EscPosPrinter -destination generic/platform=iOS",
36
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
37
+ "verify:web": "npm run build",
38
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
39
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
40
+ "eslint": "eslint . --ext ts",
41
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
42
+ "swiftlint": "node-swiftlint",
43
+ "docgen": "docgen --api EscPosPrinterPlugin --output-readme README.md --output-json dist/docs.json",
44
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
45
+ "clean": "rimraf ./dist",
46
+ "watch": "tsc --watch",
47
+ "prepublishOnly": "npm run build"
48
+ },
49
+ "devDependencies": {
50
+ "@capacitor/android": "^7.0.0",
51
+ "@capacitor/core": "^7.0.0",
52
+ "@capacitor/docgen": "^0.3.0",
53
+ "@capacitor/ios": "^7.0.0",
54
+ "@ionic/eslint-config": "^0.4.0",
55
+ "@ionic/prettier-config": "^4.0.0",
56
+ "@ionic/swiftlint-config": "^2.0.0",
57
+ "eslint": "^8.57.0",
58
+ "prettier": "^3.4.2",
59
+ "prettier-plugin-java": "^2.6.6",
60
+ "rimraf": "^6.0.1",
61
+ "rollup": "^4.30.1",
62
+ "swiftlint": "^2.0.0",
63
+ "typescript": "~4.1.5"
64
+ },
65
+ "peerDependencies": {
66
+ "@capacitor/core": ">=7.0.0"
67
+ },
68
+ "prettier": "@ionic/prettier-config",
69
+ "swiftlint": "@ionic/swiftlint-config",
70
+ "eslintConfig": {
71
+ "extends": "@ionic/eslint-config/recommended"
72
+ },
73
+ "capacitor": {
74
+ "ios": {
75
+ "src": "ios"
76
+ },
77
+ "android": {
78
+ "src": "android"
79
+ }
80
+ },
81
+ "dependencies": {
82
+ "@types/web-bluetooth": "^0.0.20"
83
+ }
84
+ }