@denevads/dnv-smo 1.0.4 → 1.0.5

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.
@@ -31,3 +31,18 @@ export interface Notify {
31
31
  destion: string;
32
32
  value: any;
33
33
  }
34
+ export interface VideoClips {
35
+ codigo: number;
36
+ fechaInicio: Date;
37
+ fechaFin: Date;
38
+ recursos: Recurso[];
39
+ }
40
+ export interface VideoClipsRelleno {
41
+ codigo: number;
42
+ recursos: Recurso[];
43
+ }
44
+ export interface Recurso {
45
+ codigo: number;
46
+ url: string;
47
+ duracion: number;
48
+ }
package/dist/smo.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start } from "./interfaces/callbacks";
1
+ import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start, VideoClips, VideoClipsRelleno } from "./interfaces/callbacks";
2
2
  import { Subject } from 'rxjs';
3
3
  export declare class SMO {
4
4
  vars: any;
5
5
  id: string;
6
+ private intervalsubscriptionDataSource;
7
+ intervalDataSource$: import("rxjs").Observable<number>;
6
8
  smoCallBacks: smoCallBacks;
7
9
  utils: Utils;
8
10
  events: SmoEvents;
@@ -16,6 +18,9 @@ export declare class SMO {
16
18
  infoCurrentLocation(location: location): void;
17
19
  setSalidaData(data: DataSalida): void;
18
20
  updatefromsalida(data: any): void;
21
+ getVideoClips(data: VideoClips): void;
22
+ getVideosRelleno(data: VideoClipsRelleno): void;
23
+ getVariableStorage(variable: variable): void;
19
24
  }
20
25
  declare class SmoEvents {
21
26
  start: Subject<start>;
@@ -26,6 +31,9 @@ declare class SmoEvents {
26
31
  infoCurrentLocation: Subject<location>;
27
32
  setSalidaData: Subject<DataSalida>;
28
33
  updatefromsalida: Subject<any>;
34
+ getVideoClips: Subject<VideoClips>;
35
+ getVideosRelleno: Subject<VideoClipsRelleno>;
36
+ getVariableStorage: Subject<variable>;
29
37
  constructor(smo: SMO);
30
38
  }
31
39
  declare class smoCallBacks {
@@ -59,6 +67,10 @@ declare class smoCallBacks {
59
67
  playOnceChannel(codigoCanal: string): void;
60
68
  stopPlayChannel(): void;
61
69
  editWrapperStyle(obj: any): void;
70
+ getVideoClips(): void;
71
+ getVideosRelleno(): void;
72
+ setVariableStorage(variable: string, valor: string): void;
73
+ getVariableStorage(variable: string): void;
62
74
  }
63
75
  declare class Utils {
64
76
  smo: SMO;
@@ -68,8 +80,6 @@ declare class Utils {
68
80
  jsonToStr(js_obj: any): string;
69
81
  setJsonObj(xml: any): any;
70
82
  dataToJSON(data: setDatasource): any;
71
- getDatasource(): void;
72
- startCheckDatasource(timeout?: number): void;
73
83
  }
74
84
  export declare enum SMO_EVENT_TYPE {
75
85
  start = "start",
@@ -79,7 +89,10 @@ export declare enum SMO_EVENT_TYPE {
79
89
  infoCurrentLocation = "infoCurrentLocation",
80
90
  setSalidaData = "setSalidaData",
81
91
  updatefromsalida = "updatefromsalida",
82
- setDatasourceJson = "setDatasourceJson"
92
+ setDatasourceJson = "setDatasourceJson",
93
+ getVideoClips = "getVideoClips",
94
+ getVideosRelleno = "getVideosRelleno",
95
+ getVariableStorage = "getVariableStorage"
83
96
  }
84
97
  export declare enum LogLevel {
85
98
  Debug = 0,
package/dist/smo.js CHANGED
@@ -6,6 +6,7 @@ var SMO = /** @class */ (function () {
6
6
  function SMO() {
7
7
  this.vars = {};
8
8
  this.id = "";
9
+ this.intervalDataSource$ = (0, rxjs_1.interval)(5 * 60 * 1000);
9
10
  this.init();
10
11
  this.initOnMessage();
11
12
  this.smoCallBacks = new smoCallBacks(this);
@@ -13,6 +14,7 @@ var SMO = /** @class */ (function () {
13
14
  this.events = new SmoEvents(this);
14
15
  }
15
16
  SMO.prototype.init = function () {
17
+ var _this = this;
16
18
  var match, pl = /\+/g, search = /([^&=]+)=?([^&]*)/g, decode = function (s) {
17
19
  return decodeURIComponent(s.replace(pl, " "));
18
20
  }, query = window.location.search.substring(1);
@@ -27,10 +29,42 @@ var SMO = /** @class */ (function () {
27
29
  }*/
28
30
  if (this.vars.idSmo) {
29
31
  this.id = this.vars.idSmo;
30
- return;
32
+ if (this.vars["LowPower"] == "true" && (this.vars["url"] != undefined || this.vars["LocalData"] != undefined)) {
33
+ this.smoCallBacks.onSmoLoad();
34
+ return;
35
+ }
36
+ if (this.vars["url"] != undefined) {
37
+ this.smoCallBacks.getFile(this.vars["url"]);
38
+ this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(function () {
39
+ _this.smoCallBacks.getFile(_this.vars["url"]);
40
+ });
41
+ return;
42
+ }
43
+ if (this.vars["LocalData"] != undefined) {
44
+ this.smoCallBacks.getLocalData(this.vars["LocalData"]);
45
+ this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(function () {
46
+ _this.smoCallBacks.getLocalData(_this.vars["LocalData"]);
47
+ });
48
+ return;
49
+ }
31
50
  }
32
51
  console.warn("No idSmo found in URL");
33
52
  };
53
+ /*getDatasource():void{
54
+ if(this.smo.vars.url == undefined){
55
+ this.smoCallBacks.getFile(this.smo.vars.LocalData);
56
+ return;
57
+ }
58
+ this.smoCallBacks.getFile(this.smo.vars.url);
59
+
60
+ }
61
+ startCheckDatasource(timeout: number = 10):void{
62
+ this.getDatasource();
63
+ let self = this;
64
+ setInterval(function() {
65
+ self.getDatasource();
66
+ }, timeout * 1000);
67
+ }*/
34
68
  SMO.prototype.initOnMessage = function () {
35
69
  var selft = this;
36
70
  window.onmessage = function (e) {
@@ -65,6 +99,17 @@ var SMO = /** @class */ (function () {
65
99
  selft.updatefromsalida(e.data.objdata);
66
100
  return;
67
101
  }
102
+ if (func == SMO_EVENT_TYPE.getVideoClips) {
103
+ selft.getVideoClips(e.data.objData);
104
+ }
105
+ if (func == SMO_EVENT_TYPE.getVideosRelleno) {
106
+ selft.getVideosRelleno(e.data.objData);
107
+ return;
108
+ }
109
+ if (func == SMO_EVENT_TYPE.getVariableStorage) {
110
+ selft.getVariableStorage(e.data.objData);
111
+ return;
112
+ }
68
113
  console.warn("message not implemented!!" + func);
69
114
  }
70
115
  };
@@ -91,6 +136,15 @@ var SMO = /** @class */ (function () {
91
136
  SMO.prototype.updatefromsalida = function (data) {
92
137
  this.events.updatefromsalida.next(data);
93
138
  };
139
+ SMO.prototype.getVideoClips = function (data) {
140
+ this.events.getVideoClips.next(data);
141
+ };
142
+ SMO.prototype.getVideosRelleno = function (data) {
143
+ this.events.getVideosRelleno.next(data);
144
+ };
145
+ SMO.prototype.getVariableStorage = function (variable) {
146
+ this.events.getVariableStorage.next(variable);
147
+ };
94
148
  return SMO;
95
149
  }());
96
150
  exports.SMO = SMO;
@@ -104,6 +158,9 @@ var SmoEvents = /** @class */ (function () {
104
158
  this.infoCurrentLocation = new rxjs_1.Subject();
105
159
  this.setSalidaData = new rxjs_1.Subject();
106
160
  this.updatefromsalida = new rxjs_1.Subject();
161
+ this.getVideoClips = new rxjs_1.Subject();
162
+ this.getVideosRelleno = new rxjs_1.Subject();
163
+ this.getVariableStorage = new rxjs_1.Subject();
107
164
  }
108
165
  return SmoEvents;
109
166
  }());
@@ -336,6 +393,38 @@ var smoCallBacks = /** @class */ (function () {
336
393
  idSmo: this.smo.id
337
394
  }, "*");
338
395
  };
396
+ smoCallBacks.prototype.getVideoClips = function () {
397
+ parent.postMessage({
398
+ target: "Dnv.smoCallbacks.getVideoClips",
399
+ idSmo: this.smo.id
400
+ }, "*");
401
+ };
402
+ smoCallBacks.prototype.getVideosRelleno = function () {
403
+ parent.postMessage({
404
+ target: "Dnv.smoCallbacks.getVideosRelleno",
405
+ idSmo: this.smo.id
406
+ }, "*");
407
+ };
408
+ smoCallBacks.prototype.setVariableStorage = function (variable, valor) {
409
+ window.parent.postMessage({
410
+ target: "Dnv.smoCallbacks.setVariableStorage",
411
+ objData: {
412
+ variable: variable,
413
+ valor: valor
414
+ },
415
+ idSmo: this.smo.id
416
+ }, "*");
417
+ };
418
+ smoCallBacks.prototype.getVariableStorage = function (variable) {
419
+ window.parent.postMessage({
420
+ target: "Dnv.smoCallbacks.getVariableStorage",
421
+ objData: {
422
+ variable: variable
423
+ },
424
+ idSmo: this.smo.id
425
+ }, "*");
426
+ /* MIRAR SMO.getVariable */
427
+ };
339
428
  return smoCallBacks;
340
429
  }());
341
430
  var Utils = /** @class */ (function () {
@@ -404,21 +493,6 @@ var Utils = /** @class */ (function () {
404
493
  return {};
405
494
  }
406
495
  };
407
- Utils.prototype.getDatasource = function () {
408
- if (this.smo.vars.url == undefined) {
409
- this.smoCallBacks.getFile(this.smo.vars.LocalData);
410
- return;
411
- }
412
- this.smoCallBacks.getFile(this.smo.vars.url);
413
- };
414
- Utils.prototype.startCheckDatasource = function (timeout) {
415
- if (timeout === void 0) { timeout = 10; }
416
- this.getDatasource();
417
- var self = this;
418
- setInterval(function () {
419
- self.getDatasource();
420
- }, timeout * 1000);
421
- };
422
496
  return Utils;
423
497
  }());
424
498
  var SMO_EVENT_TYPE;
@@ -431,29 +505,10 @@ var SMO_EVENT_TYPE;
431
505
  SMO_EVENT_TYPE["setSalidaData"] = "setSalidaData";
432
506
  SMO_EVENT_TYPE["updatefromsalida"] = "updatefromsalida";
433
507
  SMO_EVENT_TYPE["setDatasourceJson"] = "setDatasourceJson";
508
+ SMO_EVENT_TYPE["getVideoClips"] = "getVideoClips";
509
+ SMO_EVENT_TYPE["getVideosRelleno"] = "getVideosRelleno";
510
+ SMO_EVENT_TYPE["getVariableStorage"] = "getVariableStorage";
434
511
  })(SMO_EVENT_TYPE = exports.SMO_EVENT_TYPE || (exports.SMO_EVENT_TYPE = {}));
435
- /* start():void{
436
- this.emit("start");
437
- }
438
- setDatasource(datasource:setDatasource):void {
439
- this.emit("setDatasource",datasource);
440
- }
441
- getVariable(variable:variable):void{
442
- this.emit("getVariable",variable);
443
- }
444
- setCurrentStream(stream:string):void{
445
- this.emit("setCurrentStream",stream);
446
- }
447
- infoCurrentLocation(location:location):void{
448
- this.emit("infoCurrentLocation",location);
449
- }
450
- setSalidaData(data:DataSalida):void{
451
- this.emit("setSalidaData",data);
452
- }
453
-
454
- updatefromsalida(data:any):void{
455
- this.emit("updatefromsalida",data);
456
- } */
457
512
  var LogLevel;
458
513
  (function (LogLevel) {
459
514
  LogLevel[LogLevel["Debug"] = 0] = "Debug";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denevads/dnv-smo",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "SMO module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -33,4 +33,22 @@ export interface ExecFunction{
33
33
  export interface Notify{
34
34
  destion:string,
35
35
  value:any
36
- }
36
+ }
37
+
38
+ export interface VideoClips {
39
+ codigo: number;
40
+ fechaInicio: Date;
41
+ fechaFin: Date;
42
+ recursos: Recurso[];
43
+ }
44
+ export interface VideoClipsRelleno {
45
+ codigo: number;
46
+ recursos: Recurso[];
47
+ }
48
+
49
+ export interface Recurso {
50
+ codigo: number;
51
+ url: string;
52
+ duracion: number;
53
+ }
54
+
package/src/smo.ts CHANGED
@@ -1,8 +1,19 @@
1
- import { setDatasource,variable,location,DataSalida, ExecFunction, Notify, start } from "./interfaces/callbacks";
2
- import { Subject} from 'rxjs';
1
+ import {
2
+ setDatasource,
3
+ variable,
4
+ location,
5
+ DataSalida,
6
+ ExecFunction,
7
+ Notify,
8
+ start,
9
+ VideoClips, VideoClipsRelleno
10
+ } from "./interfaces/callbacks";
11
+ import {interval, Subject, Subscription} from 'rxjs';
3
12
  export class SMO {
4
13
  public vars:any = {};
5
14
  public id:string = "";
15
+ private intervalsubscriptionDataSource!: Subscription;
16
+ intervalDataSource$ = interval(5 * 60 * 1000);
6
17
  public smoCallBacks:smoCallBacks;
7
18
  public utils:Utils;
8
19
  public events:SmoEvents;
@@ -32,10 +43,44 @@ export class SMO {
32
43
  }*/
33
44
  if (this.vars.idSmo) {
34
45
  this.id = this.vars.idSmo;
35
- return;
46
+ if(this.vars["LowPower"] == "true" && (this.vars["url"] != undefined || this.vars["LocalData"] != undefined)){
47
+ this.smoCallBacks.onSmoLoad();
48
+ return;
49
+ }
50
+ if(this.vars["url"] != undefined ){
51
+ this.smoCallBacks.getFile(this.vars["url"]);
52
+ this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(() => {
53
+ this.smoCallBacks.getFile(this.vars["url"]);
54
+ });
55
+ return;
56
+ }
57
+ if(this.vars["LocalData"] != undefined ){
58
+ this.smoCallBacks.getLocalData(this.vars["LocalData"]);
59
+ this.intervalsubscriptionDataSource = this.intervalDataSource$.subscribe(() => {
60
+ this.smoCallBacks.getLocalData(this.vars["LocalData"]);
61
+ });
62
+ return;
63
+ }
36
64
  }
37
65
  console.warn("No idSmo found in URL");
66
+
67
+
38
68
  }
69
+ /*getDatasource():void{
70
+ if(this.smo.vars.url == undefined){
71
+ this.smoCallBacks.getFile(this.smo.vars.LocalData);
72
+ return;
73
+ }
74
+ this.smoCallBacks.getFile(this.smo.vars.url);
75
+
76
+ }
77
+ startCheckDatasource(timeout: number = 10):void{
78
+ this.getDatasource();
79
+ let self = this;
80
+ setInterval(function() {
81
+ self.getDatasource();
82
+ }, timeout * 1000);
83
+ }*/
39
84
  initOnMessage():void{
40
85
  let selft = this;
41
86
  window.onmessage = function(e) {
@@ -70,6 +115,17 @@ export class SMO {
70
115
  selft.updatefromsalida(e.data.objdata);
71
116
  return;
72
117
  }
118
+ if(func == SMO_EVENT_TYPE.getVideoClips){
119
+ selft.getVideoClips(e.data.objData);
120
+ }
121
+ if(func == SMO_EVENT_TYPE.getVideosRelleno){
122
+ selft.getVideosRelleno(e.data.objData);
123
+ return;
124
+ }
125
+ if(func == SMO_EVENT_TYPE.getVariableStorage){
126
+ selft.getVariableStorage(e.data.objData);
127
+ return;
128
+ }
73
129
  console.warn("message not implemented!!" +func);
74
130
  }
75
131
  }
@@ -97,6 +153,15 @@ export class SMO {
97
153
  updatefromsalida(data:any):void{
98
154
  this.events.updatefromsalida.next(data);
99
155
  }
156
+ getVideoClips(data:VideoClips):void{
157
+ this.events.getVideoClips.next(data);
158
+ }
159
+ getVideosRelleno(data:VideoClipsRelleno):void{
160
+ this.events.getVideosRelleno.next(data);
161
+ }
162
+ getVariableStorage(variable:variable):void{
163
+ this.events.getVariableStorage.next(variable);
164
+ }
100
165
 
101
166
  }
102
167
 
@@ -109,6 +174,9 @@ class SmoEvents{
109
174
  public infoCurrentLocation: Subject<location> = new Subject<location>();
110
175
  public setSalidaData: Subject<DataSalida> = new Subject<DataSalida>();
111
176
  public updatefromsalida: Subject<any> = new Subject<any>();
177
+ public getVideoClips: Subject<VideoClips> = new Subject<VideoClips>();
178
+ public getVideosRelleno: Subject<VideoClipsRelleno> = new Subject<VideoClipsRelleno>();
179
+ public getVariableStorage: Subject<variable> = new Subject<variable>();
112
180
  constructor(smo:SMO){}
113
181
  }
114
182
  class smoCallBacks{
@@ -345,6 +413,40 @@ class smoCallBacks{
345
413
  idSmo: this.smo.id
346
414
  }, "*");
347
415
  }
416
+ getVideoClips():void{
417
+ parent.postMessage({
418
+ target: "Dnv.smoCallbacks.getVideoClips",
419
+ idSmo: this.smo.id
420
+ }, "*");
421
+ }
422
+ getVideosRelleno():void{
423
+ parent.postMessage({
424
+ target: "Dnv.smoCallbacks.getVideosRelleno",
425
+ idSmo: this.smo.id
426
+ }, "*");
427
+ }
428
+ setVariableStorage(variable:string, valor:string) {
429
+ window.parent.postMessage({
430
+ target: "Dnv.smoCallbacks.setVariableStorage",
431
+ objData: {
432
+ variable: variable,
433
+ valor: valor
434
+ },
435
+ idSmo: this.smo.id
436
+ }, "*");
437
+ }
438
+ getVariableStorage(variable:string):void {
439
+ window.parent.postMessage({
440
+ target: "Dnv.smoCallbacks.getVariableStorage",
441
+ objData: {
442
+ variable: variable
443
+ },
444
+ idSmo: this.smo.id
445
+ }, "*");
446
+ /* MIRAR SMO.getVariable */
447
+ }
448
+
449
+
348
450
  }
349
451
  class Utils{
350
452
  smo:SMO;
@@ -410,7 +512,7 @@ class Utils{
410
512
  return {};
411
513
  }
412
514
  }
413
- getDatasource():void{
515
+ /*getDatasource():void{
414
516
  if(this.smo.vars.url == undefined){
415
517
  this.smoCallBacks.getFile(this.smo.vars.LocalData);
416
518
  return;
@@ -424,7 +526,7 @@ class Utils{
424
526
  setInterval(function() {
425
527
  self.getDatasource();
426
528
  }, timeout * 1000);
427
- }
529
+ }*/
428
530
  }
429
531
  export enum SMO_EVENT_TYPE{
430
532
  start = "start",
@@ -434,30 +536,11 @@ export enum SMO_EVENT_TYPE{
434
536
  infoCurrentLocation = "infoCurrentLocation",
435
537
  setSalidaData ="setSalidaData",
436
538
  updatefromsalida = "updatefromsalida",
437
- setDatasourceJson = "setDatasourceJson"
539
+ setDatasourceJson = "setDatasourceJson",
540
+ getVideoClips = "getVideoClips",
541
+ getVideosRelleno = "getVideosRelleno",
542
+ getVariableStorage = "getVariableStorage"
438
543
  }
439
- /* start():void{
440
- this.emit("start");
441
- }
442
- setDatasource(datasource:setDatasource):void {
443
- this.emit("setDatasource",datasource);
444
- }
445
- getVariable(variable:variable):void{
446
- this.emit("getVariable",variable);
447
- }
448
- setCurrentStream(stream:string):void{
449
- this.emit("setCurrentStream",stream);
450
- }
451
- infoCurrentLocation(location:location):void{
452
- this.emit("infoCurrentLocation",location);
453
- }
454
- setSalidaData(data:DataSalida):void{
455
- this.emit("setSalidaData",data);
456
- }
457
-
458
- updatefromsalida(data:any):void{
459
- this.emit("updatefromsalida",data);
460
- } */
461
544
  export enum LogLevel {
462
545
  Debug= 0,
463
546
  Info= 1,