@denevads/dnv-smo 1.0.28 → 1.0.30

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.28",
3
+ "version": "1.0.30",
4
4
  "description": "SMO module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/smo.ts CHANGED
@@ -43,7 +43,7 @@ export class SMO {
43
43
  this.vars[decode(match[1])] = decode(match[2]);
44
44
  }
45
45
  // @ts-ignore
46
- if(window.objJS && window.self === window.top){
46
+ if(window.objJS != undefined && window !== window.parent && this.vars.ontop != undefined && this.vars.ontop != ""){
47
47
  // @ts-ignore
48
48
  console.log("Existe objJS en window -->" + JSON.stringify(window.objJS));
49
49
  // @ts-ignore
@@ -298,14 +298,14 @@ class smoCallBacks{
298
298
  target: "Dnv.smoCallbacks.onSmoLoad",
299
299
  objData: undefined,
300
300
  idSmo: this.smo.id
301
- }, "*");
301
+ }, this.smo.vars.idSmo);
302
302
  }
303
303
  public onSmoReady():void {
304
304
  this.smo.utils.sendToParent({
305
305
  target: "Dnv.smoCallbacks.onSmoReady",
306
306
  objData: undefined,
307
307
  idSmo: this.smo.id
308
- }, "*");
308
+ }, this.smo.vars.idSmo);
309
309
  }
310
310
  public smoLog(msn:string, level:LogLevel):void {
311
311
  if (level == undefined) {
@@ -332,7 +332,7 @@ class smoCallBacks{
332
332
  txt: msn
333
333
  },
334
334
  idSmo: this.smo.id
335
- }, "*");
335
+ }, this.smo.vars.idSmo);
336
336
  }
337
337
 
338
338
  }
@@ -344,7 +344,7 @@ class smoCallBacks{
344
344
  txt: msn
345
345
  },
346
346
  idSmo: this.smo.id
347
- }, "*");
347
+ }, this.smo.vars.idSmo);
348
348
  }
349
349
  public smoLogStash(msn:string):void {
350
350
  this.smo.utils.sendToParent({
@@ -353,14 +353,14 @@ class smoCallBacks{
353
353
  txt: msn
354
354
  },
355
355
  idSmo: this.smo.id
356
- }, "*");
356
+ }, this.smo.vars.idSmo);
357
357
  }
358
358
  public smoLogNowShowing(msn:any):void {
359
359
  this.smo.utils.sendToParent({
360
360
  target: "Dnv.smoCallbacks.smoNowShowing",
361
361
  objData: msn,
362
362
  idSmo: this.smo.id
363
- }, "*");
363
+ }, this.smo.vars.idSmo);
364
364
  }
365
365
  public reiniciarDispositivo(msn:string):void {
366
366
  //Permite reiniciar el player, proporcionando una razón para el reinicio. Solo Player HTML5
@@ -370,7 +370,7 @@ class smoCallBacks{
370
370
  txt: msn // Razón del reinicio
371
371
  },
372
372
  idSmo: this.smo.id
373
- }, "*");
373
+ }, this.smo.vars.idSmo);
374
374
  }
375
375
  urlNext():void {
376
376
  //Permite avanzar plantilla. Solo si Reloj Maestro activado.
@@ -378,7 +378,7 @@ class smoCallBacks{
378
378
  target: "Dnv.smoCallbacks.urlNext",
379
379
  objData: undefined,
380
380
  idSmo: this.smo.id
381
- }, "*");
381
+ }, this.smo.vars.idSmo);
382
382
  }
383
383
  exitInteractivity():void {
384
384
  //Para canales interactivos, vuelve al canal de reposo. Solo Android y Player PC.
@@ -386,7 +386,7 @@ class smoCallBacks{
386
386
  target: "Dnv.smoCallbacks.exitInteractivity",
387
387
  objData: undefined,
388
388
  idSmo: this.smo.id
389
- }, "*");
389
+ }, this.smo.vars.idSmo);
390
390
  }
391
391
  showBrowser():void {
392
392
  /* DEPRECATED NOT IMPLEMENTED */
@@ -405,7 +405,7 @@ class smoCallBacks{
405
405
  valor: valor
406
406
  },
407
407
  idSmo: this.smo.id
408
- }, "*");
408
+ }, this.smo.vars.idSmo);
409
409
  }
410
410
  getVariable(variable:string):void {
411
411
  this.smo.utils.sendToParent({
@@ -414,7 +414,7 @@ class smoCallBacks{
414
414
  variable: variable
415
415
  },
416
416
  idSmo: this.smo.id
417
- }, "*");
417
+ }, this.smo.vars.idSmo);
418
418
  /* MIRAR SMO.getVariable */
419
419
  }
420
420
 
@@ -423,7 +423,7 @@ class smoCallBacks{
423
423
  target: "Dnv.smoCallbacks.getFile",
424
424
  objData: file,
425
425
  idSmo: this.smo.id
426
- }, "*");
426
+ }, this.smo.vars.idSmo);
427
427
  }
428
428
  setLocalData(variable:string, valor:string):void {
429
429
  this.smo.utils.sendToParent({
@@ -433,14 +433,14 @@ class smoCallBacks{
433
433
  data: valor
434
434
  },
435
435
  idSmo: this.smo.id
436
- }, "*");
436
+ }, this.smo.vars.idSmo);
437
437
  }
438
438
  getLocalData(variable:string):void {
439
439
  this.smo.utils.sendToParent({
440
440
  target: "Dnv.smoCallbacks.getLocalData",
441
441
  objData: variable, // nameData
442
442
  idSmo: this.smo.id
443
- }, "*");
443
+ }, this.smo.vars.idSmo);
444
444
  /* MIRAR SMO.setDatasource */
445
445
  }
446
446
  getCurrentStream():void {
@@ -448,7 +448,7 @@ class smoCallBacks{
448
448
  target: "Dnv.smoCallbacks.getCurrentStream",
449
449
  objData: undefined,
450
450
  idSmo: this.smo.id
451
- }, "*");
451
+ }, this.smo.vars.idSmo);
452
452
  /* MIRAR SMO.setCurrentStream' */
453
453
  }
454
454
  finAviso(id:string):void {
@@ -456,21 +456,21 @@ class smoCallBacks{
456
456
  target: "Dnv.smoCallbacks.finAviso",
457
457
  objData: id, // id del aviso
458
458
  idSmo: this.smo.id
459
- }, "*");
459
+ }, this.smo.vars.idSmo);
460
460
  }
461
461
  refreshDatasource(codigo:string):void {
462
462
  this.smo.utils.sendToParent({
463
463
  target: "Dnv.smoCallbacks.refreshDatasource",
464
464
  objData: codigo, // Codigo del datasource
465
465
  idSmo: this.smo.id
466
- }, "*");
466
+ }, this.smo.vars.idSmo);
467
467
  }
468
468
  getLocation():void {
469
469
  this.smo.utils.sendToParent({
470
470
  target: "Dnv.smoCallbacks.getLocation",
471
471
  objData: undefined,
472
472
  idSmo: this.smo.id
473
- }, "*");
473
+ }, this.smo.vars.idSmo);
474
474
  /* MIRAR SMO.infoCurrentLocation */
475
475
  }
476
476
  getSalidaData(data:string):void {
@@ -478,7 +478,7 @@ class smoCallBacks{
478
478
  target: "Dnv.smoCallbacks.getSalidaData",
479
479
  objData: data, // Nombre del "data" que solicita. El player recibe ese string y hace un select case del mismo para devolver un json con datos al smo\html5 que le ha invocado.
480
480
  idSmo: this.smo.id
481
- }, "*");
481
+ }, this.smo.vars.idSmo);
482
482
  /* MIRAR SMO.setSalidaData */
483
483
  }
484
484
  ejecutaFuncion(data:ExecFunction):void {
@@ -490,7 +490,7 @@ class smoCallBacks{
490
490
  target: "Dnv.smoCallbacks.ejecutaFuncion",
491
491
  objData: data,
492
492
  idSmo: this.smo.id
493
- }, "*");
493
+ }, this.smo.vars.idSmo);
494
494
  }
495
495
  addObserver(data:string):void {
496
496
  /*data ="fruta"
@@ -499,7 +499,7 @@ class smoCallBacks{
499
499
  target: "Dnv.smoCallbacks.addObserver",
500
500
  objData: data,
501
501
  idSmo: this.smo.id
502
- }, "*");
502
+ }, this.smo.vars.idSmo);
503
503
  }
504
504
  notify(data:Notify):void {
505
505
  /*data ={
@@ -511,23 +511,23 @@ class smoCallBacks{
511
511
  objData: data,
512
512
  idSmo: this.smo.id
513
513
 
514
- }, "*");
514
+ }, this.smo.vars.idSmo);
515
515
  }
516
516
  playOnceChannelByTrigger(trigger:string):void {
517
517
  this.smo.utils.sendToParent({
518
518
  target: "Dnv.smoCallbacks.playOnceChannelByTrigger",
519
519
  objData: { triggerCanal: trigger },
520
520
  idSmo: this.smo.id
521
- }, "*");
521
+ }, this.smo.vars.idSmo);
522
522
  }
523
523
  stopPlayOnceChannelByTrigger():void {
524
- this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannelByTrigger", objData: {}, idSmo: this.smo.id }, "*");
524
+ this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannelByTrigger", objData: {}, idSmo: this.smo.id }, this.smo.vars.idSmo);
525
525
  }
526
526
  playOnceChannel(codigoCanal:string):void {
527
- this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.playOnceChannel", objData: { codigoCanal: codigoCanal, params: "PLAYONCE_CHANNEL|" + codigoCanal }, idSmo: this.smo.id }, "*");
527
+ this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.playOnceChannel", objData: { codigoCanal: codigoCanal, params: "PLAYONCE_CHANNEL|" + codigoCanal }, idSmo: this.smo.id }, this.smo.vars.idSmo);
528
528
  }
529
529
  stopPlayChannel():void {
530
- this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannel", objData: {}, idSmo: this.smo.id }, "*");
530
+ this.smo.utils.sendToParent({ target: "Dnv.smoCallbacks.stopPlayOnceChannel", objData: {}, idSmo: this.smo.id }, this.smo.vars.idSmo);
531
531
  }
532
532
  editWrapperStyle(obj: any):void{
533
533
  /*{"posX": "0px","posY": "0px","alto": "0px","ancho": "0px","overflow": "hidden","scale": 0.1,"zindex": 0.1,"opacidad": 0.1,"isMaestro": true,duracionTransition: "1s", transitionTiming: "lineal", css: string} */
@@ -535,7 +535,7 @@ class smoCallBacks{
535
535
  target: "Dnv.smoCallbacks.editWrapperStyle",
536
536
  objData: obj,
537
537
  idSmo: this.smo.id
538
- }, "*");
538
+ }, this.smo.vars.idSmo);
539
539
  }
540
540
  getRecursosByCodigo(codigos: any):void{
541
541
  /** ["123456","654321"] */
@@ -545,25 +545,25 @@ class smoCallBacks{
545
545
  recursos : codigos
546
546
  },
547
547
  idSmo: this.smo.id
548
- }, "*");
548
+ }, this.smo.vars.idSmo);
549
549
  }
550
550
  getRecursos():void{
551
551
  this.smo.utils.sendToParent({
552
552
  target: "Dnv.smoCallbacks.getRecursos",
553
553
  idSmo: this.smo.id
554
- }, "*");
554
+ }, this.smo.vars.idSmo);
555
555
  }
556
556
  getRecursosDefault():void{
557
557
  this.smo.utils.sendToParent({
558
558
  target: "Dnv.smoCallbacks.getRecursosDefault",
559
559
  idSmo: this.smo.id
560
- }, "*");
560
+ }, this.smo.vars.idSmo);
561
561
  }
562
562
  getRecursosRelleno():void{
563
563
  this.smo.utils.sendToParent({
564
564
  target: "Dnv.smoCallbacks.getRecursosRelleno",
565
565
  idSmo: this.smo.id
566
- }, "*");
566
+ }, this.smo.vars.idSmo);
567
567
  }
568
568
  setVariableStorage(variable:string, valor:string) {
569
569
  this.smo.utils.sendToParent({
@@ -573,7 +573,7 @@ class smoCallBacks{
573
573
  valor: valor
574
574
  },
575
575
  idSmo: this.smo.id
576
- }, "*");
576
+ }, this.smo.vars.idSmo);
577
577
  }
578
578
  getVariableStorage(variable:string):void {
579
579
  this.smo.utils.sendToParent({
@@ -582,7 +582,7 @@ class smoCallBacks{
582
582
  variable: variable
583
583
  },
584
584
  idSmo: this.smo.id
585
- }, "*");
585
+ }, this.smo.vars.idSmo);
586
586
  /* MIRAR SMO.getVariable */
587
587
  }
588
588
  printTextLine(txt:string):void{
@@ -592,7 +592,7 @@ class smoCallBacks{
592
592
  txt: txt
593
593
  },
594
594
  idSmo: this.smo.id
595
- }, "*");
595
+ }, this.smo.vars.idSmo);
596
596
  }
597
597
  printBarcode(code:string, width:number, height:number):void{
598
598
  this.smo.utils.sendToParent({
@@ -603,7 +603,7 @@ class smoCallBacks{
603
603
  height: height
604
604
  },
605
605
  idSmo: this.smo.id
606
- }, "*");
606
+ }, this.smo.vars.idSmo);
607
607
  }
608
608
  cutPaper(percent:number):void{
609
609
  this.smo.utils.sendToParent({
@@ -612,19 +612,19 @@ class smoCallBacks{
612
612
  percent: percent
613
613
  },
614
614
  idSmo: this.smo.id
615
- }, "*");
615
+ }, this.smo.vars.idSmo);
616
616
  }
617
617
  checkHealth(){
618
618
  this.smo.utils.sendToParent({
619
619
  target: "Dnv.smoCallbacks.checkHealth",
620
620
  idSmo: this.smo.id
621
- }, "*");
621
+ }, this.smo.vars.idSmo);
622
622
  }
623
623
  checkHealthPrinter(){
624
624
  this.smo.utils.sendToParent({
625
625
  target: "Dnv.smoCallbacks.checkHealthPrinter",
626
626
  idSmo: this.smo.id
627
- }, "*");
627
+ }, this.smo.vars.idSmo);
628
628
  }
629
629
  printImage(image:string):void{
630
630
  this.smo.utils.sendToParent({
@@ -633,7 +633,7 @@ class smoCallBacks{
633
633
  image: image
634
634
  },
635
635
  idSmo: this.smo.id
636
- }, "*");
636
+ }, this.smo.vars.idSmo);
637
637
  }
638
638
 
639
639
  }
@@ -662,7 +662,7 @@ class Utils{
662
662
  sendToParent(obj:any,dest:string){
663
663
  console.log('sendToParent->',JSON.stringify(obj));
664
664
  //@ts-ignore
665
- if(window.objJS){
665
+ if(window.objJS != undefined && window !== window.parent && this.vars.ontop != undefined && this.vars.ontop != ""){
666
666
  switch (obj.target) {
667
667
  case "Dnv.smoCallbacks.onSmoLoad":
668
668
  // @ts-ignore
@@ -746,10 +746,10 @@ class Utils{
746
746
 
747
747
  if (xml.nodeType == 1) { // Element
748
748
  if (xml.attributes.length > 0) {
749
- jsonObj["attributes"] = {};
749
+ jsonObj["ATTRIBUTES"] = {};
750
750
  for (let j = 0; j < xml.attributes.length; j++) {
751
751
  let attribute = xml.attributes.item(j);
752
- jsonObj["attributes"][attribute.nodeName] = attribute.nodeValue;
752
+ jsonObj["ATTRIBUTES"][attribute.nodeName] = attribute.nodeValue;
753
753
  }
754
754
  }
755
755
  } else if (xml.nodeType == 3) { // Text
@@ -766,7 +766,7 @@ class Utils{
766
766
  if (nodeName == "#text" && item.nodeType == 3) {
767
767
  jsonObj = item.nodeValue.trim();
768
768
  }else if (nodeName == "#cdata-section" && (item.nodeType == 4 || item.nodeType == 3)) { //Para que quede bonito
769
- jsonObj["cdata"] = this.setJsonObj(item);
769
+ jsonObj["CDATA"] = this.setJsonObj(item);
770
770
  } else if (typeof jsonObj[nodeName] === "undefined") {
771
771
  jsonObj[nodeName] = this.setJsonObj(item);
772
772
  } else {
package/dist/dist.rar DELETED
Binary file
package/dist/dist.zip DELETED
Binary file