@openkey/sdk 0.12.1-beta.0 → 0.12.1-beta.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.
package/dist/index.js CHANGED
@@ -403,6 +403,7 @@ var IframeModal = class {
403
403
  currentLayoutId = 0;
404
404
  displayedHeight = 0;
405
405
  hasDisplayedLayout = false;
406
+ revealTimer;
406
407
  constructor(opts) {
407
408
  this.host = opts.host;
408
409
  this.onClose = opts.onClose;
@@ -436,7 +437,9 @@ var IframeModal = class {
436
437
  this.card = document.createElement("div");
437
438
  this.card.className = "ok-card";
438
439
  if (opts.hideUntilLayout) {
439
- this.card.style.visibility = "hidden";
440
+ this.card.inert = true;
441
+ this.card.style.opacity = "0";
442
+ this.card.style.pointerEvents = "none";
440
443
  this.card.style.animation = "none";
441
444
  }
442
445
  if (isMobile) {
@@ -453,7 +456,10 @@ var IframeModal = class {
453
456
  this.iframe.src = opts.url;
454
457
  this.iframe.setAttribute("allow", "clipboard-write *; publickey-credentials-get *; publickey-credentials-create *");
455
458
  this.iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox");
456
- if (opts.hideUntilLayout) this.iframe.style.visibility = "hidden";
459
+ if (opts.hideUntilLayout) {
460
+ this.iframe.style.opacity = "0";
461
+ this.iframe.style.pointerEvents = "none";
462
+ }
457
463
  this.card.appendChild(this.iframe);
458
464
  backdrop.appendChild(this.card);
459
465
  this.shadow.appendChild(style);
@@ -479,8 +485,7 @@ var IframeModal = class {
479
485
  if (this.phaseV2) this.displayedHeight = h;
480
486
  }
481
487
  if (this.phaseV2) {
482
- this.iframe.style.visibility = "visible";
483
- this.card.style.visibility = "visible";
488
+ this.revealFrame();
484
489
  this.postMessage({
485
490
  type: "openkey:layout-applied",
486
491
  requestId: this.expectedRequestId,
@@ -506,14 +511,25 @@ var IframeModal = class {
506
511
  activatePhase(requestId, protocolVersion) {
507
512
  this.setExpectedCorrelation(requestId, protocolVersion);
508
513
  this.phaseV2 = true;
514
+ this.revealTimer = setTimeout(() => this.revealFrame(), 5e3);
509
515
  }
510
516
  isVersionedPhase() {
511
517
  return this.phaseV2;
512
518
  }
513
- revealLegacy() {
519
+ revealFrame() {
520
+ clearTimeout(this.revealTimer);
521
+ this.revealTimer = void 0;
522
+ this.card.inert = false;
523
+ this.iframe.style.opacity = "1";
524
+ this.iframe.style.pointerEvents = "auto";
525
+ this.card.style.opacity = "1";
526
+ this.card.style.pointerEvents = "auto";
514
527
  this.iframe.style.visibility = "visible";
515
528
  this.card.style.visibility = "visible";
516
529
  }
530
+ revealLegacy() {
531
+ this.revealFrame();
532
+ }
517
533
  hasDisplayedCurrentPhase() {
518
534
  return this.hasDisplayedLayout;
519
535
  }
@@ -536,6 +552,7 @@ var IframeModal = class {
536
552
  this.expectedProtocolVersion = protocolVersion;
537
553
  }
538
554
  destroy() {
555
+ clearTimeout(this.revealTimer);
539
556
  window.removeEventListener("message", this.messageHandler);
540
557
  this.root.remove();
541
558
  }