@openkey/sdk 0.12.1-beta.0 → 0.12.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.mjs CHANGED
@@ -368,6 +368,7 @@ var IframeModal = class {
368
368
  currentLayoutId = 0;
369
369
  displayedHeight = 0;
370
370
  hasDisplayedLayout = false;
371
+ revealTimer;
371
372
  constructor(opts) {
372
373
  this.host = opts.host;
373
374
  this.onClose = opts.onClose;
@@ -401,7 +402,9 @@ var IframeModal = class {
401
402
  this.card = document.createElement("div");
402
403
  this.card.className = "ok-card";
403
404
  if (opts.hideUntilLayout) {
404
- this.card.style.visibility = "hidden";
405
+ this.card.inert = true;
406
+ this.card.style.opacity = "0";
407
+ this.card.style.pointerEvents = "none";
405
408
  this.card.style.animation = "none";
406
409
  }
407
410
  if (isMobile) {
@@ -418,7 +421,10 @@ var IframeModal = class {
418
421
  this.iframe.src = opts.url;
419
422
  this.iframe.setAttribute("allow", "clipboard-write *; publickey-credentials-get *; publickey-credentials-create *");
420
423
  this.iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox");
421
- if (opts.hideUntilLayout) this.iframe.style.visibility = "hidden";
424
+ if (opts.hideUntilLayout) {
425
+ this.iframe.style.opacity = "0";
426
+ this.iframe.style.pointerEvents = "none";
427
+ }
422
428
  this.card.appendChild(this.iframe);
423
429
  backdrop.appendChild(this.card);
424
430
  this.shadow.appendChild(style);
@@ -444,8 +450,7 @@ var IframeModal = class {
444
450
  if (this.phaseV2) this.displayedHeight = h;
445
451
  }
446
452
  if (this.phaseV2) {
447
- this.iframe.style.visibility = "visible";
448
- this.card.style.visibility = "visible";
453
+ this.revealFrame();
449
454
  this.postMessage({
450
455
  type: "openkey:layout-applied",
451
456
  requestId: this.expectedRequestId,
@@ -471,14 +476,25 @@ var IframeModal = class {
471
476
  activatePhase(requestId, protocolVersion) {
472
477
  this.setExpectedCorrelation(requestId, protocolVersion);
473
478
  this.phaseV2 = true;
479
+ this.revealTimer = setTimeout(() => this.revealFrame(), 5e3);
474
480
  }
475
481
  isVersionedPhase() {
476
482
  return this.phaseV2;
477
483
  }
478
- revealLegacy() {
484
+ revealFrame() {
485
+ clearTimeout(this.revealTimer);
486
+ this.revealTimer = void 0;
487
+ this.card.inert = false;
488
+ this.iframe.style.opacity = "1";
489
+ this.iframe.style.pointerEvents = "auto";
490
+ this.card.style.opacity = "1";
491
+ this.card.style.pointerEvents = "auto";
479
492
  this.iframe.style.visibility = "visible";
480
493
  this.card.style.visibility = "visible";
481
494
  }
495
+ revealLegacy() {
496
+ this.revealFrame();
497
+ }
482
498
  hasDisplayedCurrentPhase() {
483
499
  return this.hasDisplayedLayout;
484
500
  }
@@ -501,6 +517,7 @@ var IframeModal = class {
501
517
  this.expectedProtocolVersion = protocolVersion;
502
518
  }
503
519
  destroy() {
520
+ clearTimeout(this.revealTimer);
504
521
  window.removeEventListener("message", this.messageHandler);
505
522
  this.root.remove();
506
523
  }