@denevads/dnv-smo 1.0.16 → 1.0.17

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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denevads/dnv-smo",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "SMO module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/smo.ts CHANGED
@@ -9,6 +9,12 @@ import {
9
9
  GetRecursos, GetRecursosRelleno
10
10
  } from "./interfaces/callbacks";
11
11
  import {interval, Subject, Subscription} from 'rxjs';
12
+ interface Window {
13
+ external:ObjJSType;
14
+ objJS:ObjJSType;
15
+ }
16
+ // @ts-ignore
17
+
12
18
  export class SMO {
13
19
  public vars:any = {};
14
20
  public id:string = "";
@@ -17,6 +23,7 @@ export class SMO {
17
23
  public smoCallBacks:smoCallBacks;
18
24
  public utils:Utils;
19
25
  public events:SmoEvents;
26
+
20
27
  constructor(){
21
28
 
22
29
  this.initOnMessage();
@@ -36,6 +43,126 @@ export class SMO {
36
43
  while (match = search.exec(query)) {
37
44
  this.vars[decode(match[1])] = decode(match[2]);
38
45
  }
46
+ // @ts-ignore
47
+ if(window.objJS){
48
+ // @ts-ignore
49
+ window.sendToIframefromNet = (target, iframeID, objData) => {
50
+ console.log("sendToIframefromNet->",target);
51
+ switch (target) {
52
+ case "SMO.setDatasource":
53
+ break;
54
+ case "SMO.checkHealthPrinter":
55
+ this.events.checkHealthPrinter.next(objData);
56
+ break;
57
+ }
58
+ // @ts-ignore
59
+ window.parent.postMessage = (target,objData,idSmo)=> {
60
+ switch (target.target) {
61
+ case "Dnv.smoCallbacks.onSmoLoad":
62
+ // @ts-ignore
63
+ window.objJS.onSmoLoad();
64
+ break;
65
+
66
+ case "Dnv.smoCallbacks.printTextLine":
67
+ // @ts-ignore
68
+ window.objJS.printTextLine(objData.txt);
69
+ break;
70
+ case "Dnv.smoCallbacks.printBarcode":
71
+ // @ts-ignore
72
+ window.objJS.printBarcode(objData.code, objData.width, objData.height);
73
+ break;
74
+ case "Dnv.smoCallbacks.cutPaper":
75
+ // @ts-ignore
76
+ window.objJS.cutPaper(objData.percent);
77
+ break;
78
+ case "Dnv.smoCallbacks.printImage":
79
+ // @ts-ignore
80
+ window.objJS.printImage(idSmo, objData.image);
81
+ break;
82
+ case "Dnv.smoCallbacks.checkHealthPrinter":
83
+ console.log('llamo a checkhealthprinter');
84
+ // @ts-ignore
85
+
86
+ window.objJS.checkHealthPrinter(idSmo);
87
+ break;
88
+ case "Dnv.smoCallbacks.checkHealth":
89
+ // @ts-ignore
90
+ window.objJS.checkHealth();
91
+ break;
92
+
93
+
94
+ }
95
+ }
96
+
97
+ }
98
+
99
+ window.external = {
100
+ // @ts-ignore
101
+ URLNext: window.objJS.urlNext,
102
+ // @ts-ignore
103
+ LimpiaCapa: window.objJS.limpiaCapa,
104
+ // @ts-ignore
105
+ LogFlash: window.objJS.logFlash,
106
+ // @ts-ignore
107
+ PageInit: window.objJS.pageInit,
108
+ // @ts-ignore
109
+ FinAviso: window.objJS.finAviso,
110
+ // @ts-ignore
111
+ ExitInteractivity: window.objJS.exitInteractivity,
112
+ // @ts-ignore
113
+ LogWeb: window.objJS.logWeb,
114
+ // @ts-ignore
115
+ RefreshPage: window.objJS.refreshPage,
116
+ // @ts-ignore
117
+ RefreshPageByError: window.objJS.refreshPageByError,
118
+ // @ts-ignore
119
+ RefreshPageByVideoEvent: window.objJS.refreshPageByVideoEvent,
120
+ // @ts-ignore
121
+ AuditarRecurso: window.objJS.auditarRecurso,
122
+ // @ts-ignore
123
+ InitSMO: window.objJS.initSMO,
124
+ // @ts-ignore
125
+ GetFile: window.objJS.getFile,
126
+ // @ts-ignore
127
+ ShowBrowser: window.objJS.showBrowser,
128
+ // @ts-ignore
129
+ closeBrowser: window.objJS.closeBrowser,
130
+ // @ts-ignore
131
+ RefreshDataSource: window.objJS.refreshDataSource,
132
+ // @ts-ignore
133
+ SetVariable: window.objJS.setVariable,
134
+ // @ts-ignore
135
+ GetVariable: window.objJS.getVariable,
136
+ // @ts-ignore
137
+ GetLocation: window.objJS.getLocation,
138
+ // @ts-ignore
139
+ SalirApp: window.objJS.salirApp,
140
+ // @ts-ignore
141
+ SetLocalData: window.objJS.setLocalData,
142
+ // @ts-ignore
143
+ GetLocalData: window.objJS.getLocalData,
144
+ // @ts-ignore
145
+ GetSalidaData: window.objJS.getSalidaData,
146
+ // @ts-ignore
147
+ EjecutaFuncion: window.objJS.ejecutaFuncion,
148
+ // @ts-ignore
149
+ AddObserver: window.objJS.addObserver,
150
+ // @ts-ignore
151
+ NotifyToObservers: window.objJS.notifyToObservers,
152
+ // @ts-ignore
153
+ PrintTextLine: window.objJS.printTextLine,
154
+ // @ts-ignore
155
+ PrintBarcode: window.objJS.printBarcode,
156
+ // @ts-ignore
157
+ CutPaper: window.objJS.cutPaper,
158
+ // @ts-ignore
159
+ PrintImage: window.objJS.printImage,
160
+ // @ts-ignore
161
+ CheckHealthPrinter: window.objJS.checkHealthPrinter,
162
+ // @ts-ignore
163
+ CheckHealth: window.objJS.checkHealth
164
+ };
165
+ }
39
166
  if (this.vars.idSmo) {
40
167
  this.id = this.vars.idSmo;
41
168
  if(this.vars["LowPower"] == "true" && (this.vars["url"] != undefined || this.vars["LocalData"] != undefined)){
@@ -186,7 +313,6 @@ class smoCallBacks{
186
313
  this.smo =_smo;
187
314
  }
188
315
  public onSmoLoad():void {
189
-
190
316
  window.parent.postMessage({
191
317
  target: "Dnv.smoCallbacks.onSmoLoad",
192
318
  objData: undefined,
@@ -630,3 +756,38 @@ Timeout= 3,
630
756
  Warning= 4,
631
757
  Error= 5
632
758
  }
759
+ export interface ObjJSType {
760
+ urlNext: () => void;
761
+ limpiaCapa: () => void;
762
+ logFlash: () => void;
763
+ pageInit: () => void;
764
+ finAviso: () => void;
765
+ exitInteractivity: () => void;
766
+ logWeb: () => void;
767
+ refreshPage: () => void;
768
+ refreshPageByError: () => void;
769
+ refreshPageByVideoEvent: () => void;
770
+ auditarRecurso: () => void;
771
+ initSMO: () => void;
772
+ getFile: () => void;
773
+ showBrowser: () => void;
774
+ closeBrowser: () => void;
775
+ refreshDataSource: () => void;
776
+ setVariable: () => void;
777
+ getVariable: () => void;
778
+ getLocation: () => void;
779
+ salirApp: () => void;
780
+ setLocalData: () => void;
781
+ getLocalData: () => void;
782
+ getSalidaData: () => void;
783
+ ejecutaFuncion: () => void;
784
+ addObserver: () => void;
785
+ notifyToObservers: () => void;
786
+ printTextLine: () => void;
787
+ printBarcode: () => void;
788
+ cutPaper: () => void;
789
+ printImage: () => void;
790
+ checkHealthPrinter: () => void;
791
+ checkHealth: () => void;
792
+ }
793
+