@operato/scene-label 1.0.0-alpha.7 → 1.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +298 -7
  2. package/assets/favicon.ico +0 -0
  3. package/assets/images/spinner.png +0 -0
  4. package/dist/barcode-scanner.d.ts +3 -1
  5. package/dist/barcode-scanner.js +62 -10
  6. package/dist/barcode-scanner.js.map +1 -1
  7. package/dist/barcode.d.ts +1 -1
  8. package/dist/barcode.js +1 -1
  9. package/dist/barcode.js.map +1 -1
  10. package/dist/label-printer.d.ts +1 -1
  11. package/dist/label-printer.js +13 -7
  12. package/dist/label-printer.js.map +1 -1
  13. package/helps/scene/component/barcode-scanner.ko.md +19 -1
  14. package/helps/scene/component/barcode-scanner.md +18 -0
  15. package/helps/scene/component/barcode-scanner.zh.md +20 -2
  16. package/helps/scene/component/label-printer.ko.md +6 -4
  17. package/helps/scene/component/label-printer.md +11 -11
  18. package/helps/scene/component/label-printer.zh.md +15 -13
  19. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +25 -0
  20. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +30 -0
  21. package/logs/application-2022-06-13-11.log +19 -0
  22. package/logs/application-2022-06-20-09.log +4 -0
  23. package/logs/application-2022-06-20-11.log +4 -0
  24. package/logs/application-2022-06-20-12.log +4 -0
  25. package/logs/connections-2022-06-13-11.log +70 -0
  26. package/logs/connections-2022-06-20-09.log +35 -0
  27. package/logs/connections-2022-06-20-11.log +35 -0
  28. package/logs/connections-2022-06-20-12.log +35 -0
  29. package/package.json +7 -7
  30. package/src/barcode-scanner.ts +71 -10
  31. package/src/barcode.ts +1 -1
  32. package/src/label-printer.ts +14 -9
  33. package/translations/en.json +5 -1
  34. package/translations/ko.json +5 -1
  35. package/translations/ms.json +6 -2
  36. package/translations/zh.json +8 -4
  37. package/tsconfig.tsbuildinfo +1 -1
  38. package/dist/direct-print/browser-printer.d.ts +0 -5
  39. package/dist/direct-print/browser-printer.js +0 -23
  40. package/dist/direct-print/browser-printer.js.map +0 -1
  41. package/dist/direct-print/usb-printer.d.ts +0 -14
  42. package/dist/direct-print/usb-printer.js +0 -69
  43. package/dist/direct-print/usb-printer.js.map +0 -1
  44. package/src/direct-print/browser-printer.ts +0 -21
  45. package/src/direct-print/usb-printer.ts +0 -84
@@ -1,23 +0,0 @@
1
- import ZebraBrowserPrintWrapper from 'zebra-browser-print-wrapper';
2
- export class BrowserPrinter {
3
- constructor() {
4
- this.printer = new ZebraBrowserPrintWrapper();
5
- }
6
- async print(content) {
7
- try {
8
- const defaultPrinter = await this.printer.getDefaultPrinter();
9
- this.printer.setPrinter(defaultPrinter);
10
- const status = await this.printer.checkPrinterStatus();
11
- if (status.isReadyToPrint) {
12
- this.printer.print(content);
13
- }
14
- else {
15
- throw new Error(`Browser Printer is not ready to print (${status.errors})`);
16
- }
17
- }
18
- catch (error) {
19
- throw new Error(error);
20
- }
21
- }
22
- }
23
- //# sourceMappingURL=browser-printer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser-printer.js","sourceRoot":"","sources":["../../src/direct-print/browser-printer.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,6BAA6B,CAAA;AAElE,MAAM,OAAO,cAAc;IAA3B;QACE,YAAO,GAAG,IAAI,wBAAwB,EAAE,CAAA;IAiB1C,CAAC;IAfC,KAAK,CAAC,KAAK,CAAC,OAAe;QACzB,IAAI;YACF,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAA;YAC7D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;YAEvC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAA;YACtD,IAAI,MAAM,CAAC,cAAc,EAAE;gBACzB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;aAC5B;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,0CAA0C,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;aAC5E;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAe,CAAC,CAAA;SACjC;IACH,CAAC;CACF","sourcesContent":["import ZebraBrowserPrintWrapper from 'zebra-browser-print-wrapper'\n\nexport class BrowserPrinter {\n printer = new ZebraBrowserPrintWrapper()\n\n async print(content: string) {\n try {\n const defaultPrinter = await this.printer.getDefaultPrinter()\n this.printer.setPrinter(defaultPrinter)\n\n const status = await this.printer.checkPrinterStatus()\n if (status.isReadyToPrint) {\n this.printer.print(content)\n } else {\n throw new Error(`Browser Printer is not ready to print (${status.errors})`)\n }\n } catch (error) {\n throw new Error(error as string)\n }\n }\n}\n"]}
@@ -1,14 +0,0 @@
1
- export declare class USBPrinter {
2
- filters: {
3
- vendorId: number;
4
- }[];
5
- device: any;
6
- constructor(filters?: {
7
- vendorId: number;
8
- }[]);
9
- setup(): Promise<void>;
10
- read(): Promise<string>;
11
- _print(content: string): Promise<void>;
12
- connectAndPrint(content: string): Promise<void>;
13
- print(content: string): Promise<void>;
14
- }
@@ -1,69 +0,0 @@
1
- const DEFAULT_FILTERS = [
2
- {
3
- vendorId: 0x0a5f /* zebra */
4
- },
5
- {
6
- vendorId: 0x04f9 /* brother */
7
- },
8
- {
9
- vendorId: 0x0828 /* sato */
10
- }
11
- ];
12
- export class USBPrinter {
13
- constructor(filters = DEFAULT_FILTERS) {
14
- this.filters = DEFAULT_FILTERS;
15
- this.filters = filters;
16
- }
17
- async setup() {
18
- //@ts-ignore
19
- if (!navigator.usb) {
20
- throw new Error('Browser could not access USB device. You can print only https or localhost origin.');
21
- }
22
- //@ts-ignore
23
- var selectedDevice = await navigator.usb.requestDevice({
24
- filters: this.filters
25
- });
26
- this.device = selectedDevice;
27
- console.log(this.device);
28
- await this.device.open();
29
- if (!this.device.configuration) {
30
- await this.device.selectConfiguration(1);
31
- }
32
- await this.device.claimInterface(0);
33
- if (!this.device.configuration.interfaces[0].alternate) {
34
- await this.device.selectAlternateInterface(0, 0);
35
- }
36
- }
37
- async read() {
38
- const { endpointNumber } = this.device.configuration.interfaces[0].alternate.endpoints[0];
39
- var result = await this.device.transferIn(endpointNumber, 64);
40
- var textDecoder = new TextDecoder();
41
- return textDecoder.decode(result.data);
42
- }
43
- async _print(content) {
44
- var encoder = new TextEncoder();
45
- var data = encoder.encode(content);
46
- const { endpointNumber } = this.device.configuration.interfaces[0].alternate.endpoints[1];
47
- await this.device.transferOut(endpointNumber, data);
48
- }
49
- async connectAndPrint(content) {
50
- this.print(content);
51
- }
52
- async print(content) {
53
- try {
54
- if (!this.device) {
55
- await this.setup();
56
- await this._print(content);
57
- }
58
- else {
59
- await this._print(content);
60
- }
61
- }
62
- catch (e) {
63
- console.log(e);
64
- delete this.device;
65
- throw e;
66
- }
67
- }
68
- }
69
- //# sourceMappingURL=usb-printer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usb-printer.js","sourceRoot":"","sources":["../../src/direct-print/usb-printer.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG;IACtB;QACE,QAAQ,EAAE,MAAM,CAAC,WAAW;KAC7B;IACD;QACE,QAAQ,EAAE,MAAM,CAAC,aAAa;KAC/B;IACD;QACE,QAAQ,EAAE,MAAM,CAAC,UAAU;KAC5B;CACF,CAAA;AAED,MAAM,OAAO,UAAU;IAOrB,YAAY,OAAO,GAAG,eAAe;QANrC,YAAO,GAED,eAAe,CAAA;QAKnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,YAAY;QACZ,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;SACtG;QAED,YAAY;QACZ,IAAI,cAAc,GAAG,MAAM,SAAS,CAAC,GAAG,C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,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACzF,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,CAAA;IACrD,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAe;QACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAe;QACzB,IAAI;YACF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;gBAClB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;aAC3B;iBAAM;gBACL,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;aAC3B;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACd,OAAO,IAAI,CAAC,MAAM,CAAA;YAElB,MAAM,CAAC,CAAA;SACR;IACH,CAAC;CACF","sourcesContent":["const DEFAULT_FILTERS = [\n {\n vendorId: 0x0a5f /* zebra */\n },\n {\n vendorId: 0x04f9 /* brother */\n },\n {\n vendorId: 0x0828 /* sato */\n }\n]\n\nexport class USBPrinter {\n filters: {\n vendorId: number\n }[] = DEFAULT_FILTERS\n\n device: any\n\n constructor(filters = DEFAULT_FILTERS) {\n this.filters = filters\n }\n\n async setup() {\n //@ts-ignore\n if (!navigator.usb) {\n throw new Error('Browser could not access USB device. You can print only https or localhost origin.')\n }\n\n //@ts-ignore\n var selectedDevice = await navigator.usb.requestDevice({\n filters: this.filters\n })\n\n this.device = selectedDevice\n console.log(this.device)\n\n await this.device.open()\n if (!this.device.configuration) {\n await this.device.selectConfiguration(1)\n }\n await this.device.claimInterface(0)\n if (!this.device.configuration.interfaces[0].alternate) {\n await this.device.selectAlternateInterface(0, 0)\n }\n }\n\n async read() {\n const { endpointNumber } = this.device.configuration.interfaces[0].alternate.endpoints[0]\n\n var result = await this.device.transferIn(endpointNumber, 64)\n var textDecoder = new TextDecoder()\n\n return textDecoder.decode(result.data)\n }\n\n async _print(content: string) {\n var encoder = new TextEncoder()\n var data = encoder.encode(content)\n\n const { endpointNumber } = this.device.configuration.interfaces[0].alternate.endpoints[1]\n await this.device.transferOut(endpointNumber, data)\n }\n\n async connectAndPrint(content: string) {\n this.print(content)\n }\n\n async print(content: string) {\n try {\n if (!this.device) {\n await this.setup()\n await this._print(content)\n } else {\n await this._print(content)\n }\n } catch (e) {\n console.log(e)\n delete this.device\n\n throw e\n }\n }\n}\n"]}
@@ -1,21 +0,0 @@
1
- import ZebraBrowserPrintWrapper from 'zebra-browser-print-wrapper'
2
-
3
- export class BrowserPrinter {
4
- printer = new ZebraBrowserPrintWrapper()
5
-
6
- async print(content: string) {
7
- try {
8
- const defaultPrinter = await this.printer.getDefaultPrinter()
9
- this.printer.setPrinter(defaultPrinter)
10
-
11
- const status = await this.printer.checkPrinterStatus()
12
- if (status.isReadyToPrint) {
13
- this.printer.print(content)
14
- } else {
15
- throw new Error(`Browser Printer is not ready to print (${status.errors})`)
16
- }
17
- } catch (error) {
18
- throw new Error(error as string)
19
- }
20
- }
21
- }
@@ -1,84 +0,0 @@
1
- const DEFAULT_FILTERS = [
2
- {
3
- vendorId: 0x0a5f /* zebra */
4
- },
5
- {
6
- vendorId: 0x04f9 /* brother */
7
- },
8
- {
9
- vendorId: 0x0828 /* sato */
10
- }
11
- ]
12
-
13
- export class USBPrinter {
14
- filters: {
15
- vendorId: number
16
- }[] = DEFAULT_FILTERS
17
-
18
- device: any
19
-
20
- constructor(filters = DEFAULT_FILTERS) {
21
- this.filters = filters
22
- }
23
-
24
- async setup() {
25
- //@ts-ignore
26
- if (!navigator.usb) {
27
- throw new Error('Browser could not access USB device. You can print only https or localhost origin.')
28
- }
29
-
30
- //@ts-ignore
31
- var selectedDevice = await navigator.usb.requestDevice({
32
- filters: this.filters
33
- })
34
-
35
- this.device = selectedDevice
36
- console.log(this.device)
37
-
38
- await this.device.open()
39
- if (!this.device.configuration) {
40
- await this.device.selectConfiguration(1)
41
- }
42
- await this.device.claimInterface(0)
43
- if (!this.device.configuration.interfaces[0].alternate) {
44
- await this.device.selectAlternateInterface(0, 0)
45
- }
46
- }
47
-
48
- async read() {
49
- const { endpointNumber } = this.device.configuration.interfaces[0].alternate.endpoints[0]
50
-
51
- var result = await this.device.transferIn(endpointNumber, 64)
52
- var textDecoder = new TextDecoder()
53
-
54
- return textDecoder.decode(result.data)
55
- }
56
-
57
- async _print(content: string) {
58
- var encoder = new TextEncoder()
59
- var data = encoder.encode(content)
60
-
61
- const { endpointNumber } = this.device.configuration.interfaces[0].alternate.endpoints[1]
62
- await this.device.transferOut(endpointNumber, data)
63
- }
64
-
65
- async connectAndPrint(content: string) {
66
- this.print(content)
67
- }
68
-
69
- async print(content: string) {
70
- try {
71
- if (!this.device) {
72
- await this.setup()
73
- await this._print(content)
74
- } else {
75
- await this._print(content)
76
- }
77
- } catch (e) {
78
- console.log(e)
79
- delete this.device
80
-
81
- throw e
82
- }
83
- }
84
- }