@rehers/rehers-roleplay-sdk 2.5.4 → 2.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/roleplay-sdk.js +0 -58
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rehers/rehers-roleplay-sdk",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "description": "Seamless Roleplay SDK — embed roleplay call sessions via a modal + iframe",
5
5
  "main": "roleplay-sdk.js",
6
6
  "types": "index.d.ts",
package/roleplay-sdk.js CHANGED
@@ -50,17 +50,6 @@
50
50
  var dialogAddToScenarioPendingContacts = null;
51
51
  var dialogListener = null;
52
52
  var dialogCloseTeardownTimer = null;
53
- var dialogRevealTimer = null;
54
- var mountRevealTimer = null;
55
-
56
- // Max wait before we reveal the iframe even if it never sends ROLEPLAY_READY.
57
- // Prevents users from staring at an empty container if the hosted app is slow
58
- // or fails to signal. 3s is conservative; the handshake normally lands in < 500ms.
59
- var IFRAME_REVEAL_FALLBACK_MS = 3000;
60
-
61
- function revealIframe(iframeEl) {
62
- if (iframeEl) iframeEl.style.opacity = "1";
63
- }
64
53
 
65
54
  // ── Safe logging ──────────────────────────────────────────────────
66
55
 
@@ -238,10 +227,6 @@
238
227
  clearTimeout(dialogCloseTeardownTimer);
239
228
  dialogCloseTeardownTimer = null;
240
229
  }
241
- if (dialogRevealTimer) {
242
- clearTimeout(dialogRevealTimer);
243
- dialogRevealTimer = null;
244
- }
245
230
 
246
231
  if (dialogOverlay && dialogOverlay.parentNode) {
247
232
  dialogOverlay.parentNode.removeChild(dialogOverlay);
@@ -266,10 +251,6 @@
266
251
 
267
252
  function teardownMount() {
268
253
  try {
269
- if (mountRevealTimer) {
270
- clearTimeout(mountRevealTimer);
271
- mountRevealTimer = null;
272
- }
273
254
  if (mountIframe && mountIframe.parentNode) {
274
255
  mountIframe.parentNode.removeChild(mountIframe);
275
256
  }
@@ -340,11 +321,6 @@
340
321
 
341
322
  switch (data.type) {
342
323
  case "ROLEPLAY_READY":
343
- if (mountRevealTimer) {
344
- clearTimeout(mountRevealTimer);
345
- mountRevealTimer = null;
346
- }
347
- revealIframe(mountIframe);
348
324
  getSessionToken()
349
325
  .then(function (token) {
350
326
  dispatchInitToTarget(mountIframe, null, null);
@@ -383,11 +359,6 @@
383
359
 
384
360
  switch (data.type) {
385
361
  case "ROLEPLAY_READY":
386
- if (dialogRevealTimer) {
387
- clearTimeout(dialogRevealTimer);
388
- dialogRevealTimer = null;
389
- }
390
- revealIframe(dialogIframe);
391
362
  getSessionToken()
392
363
  .then(function (token) {
393
364
  dispatchInitToTarget(dialogIframe, dialogContactData, dialogAddToScenarioPendingContacts);
@@ -482,11 +453,6 @@
482
453
  iframeEl.style.height = "100%";
483
454
  iframeEl.style.border = "none";
484
455
  iframeEl.style.display = "block";
485
- // Start invisible. The host app flashes a brief unstyled loader before it's
486
- // ready; we reveal the iframe once ROLEPLAY_READY arrives (or after a
487
- // fallback timeout). See revealIframe() callers.
488
- iframeEl.style.opacity = "0";
489
- iframeEl.style.transition = "opacity 120ms ease-out";
490
456
  return iframeEl;
491
457
  }
492
458
 
@@ -649,13 +615,6 @@
649
615
  dialogOverlay = el;
650
616
  dialogIframe = iframeEl;
651
617
  document.body.appendChild(dialogOverlay);
652
-
653
- // Fallback: reveal the iframe even if ROLEPLAY_READY never arrives.
654
- if (dialogRevealTimer) clearTimeout(dialogRevealTimer);
655
- dialogRevealTimer = setTimeout(function () {
656
- revealIframe(dialogIframe);
657
- dialogRevealTimer = null;
658
- }, IFRAME_REVEAL_FALLBACK_MS);
659
618
  } catch (e) {
660
619
  logError("open", e);
661
620
  teardownDialog();
@@ -692,13 +651,6 @@
692
651
  var iframeEl = createIframe("/");
693
652
  mountIframe = iframeEl;
694
653
  container.appendChild(iframeEl);
695
-
696
- // Fallback: reveal the iframe even if ROLEPLAY_READY never arrives.
697
- if (mountRevealTimer) clearTimeout(mountRevealTimer);
698
- mountRevealTimer = setTimeout(function () {
699
- revealIframe(mountIframe);
700
- mountRevealTimer = null;
701
- }, IFRAME_REVEAL_FALLBACK_MS);
702
654
  } catch (e) {
703
655
  logError("mount", e);
704
656
  teardownMount();
@@ -789,9 +741,6 @@
789
741
  iframeEl.style.top = "0";
790
742
  iframeEl.style.left = "0";
791
743
  iframeEl.style.zIndex = "1";
792
- // Hide until ROLEPLAY_READY so we don't flash the host app's pre-init state.
793
- iframeEl.style.opacity = "0";
794
- iframeEl.style.transition = "opacity 120ms ease-out";
795
744
 
796
745
  var closeBtn = document.createElement("button");
797
746
  closeBtn.type = "button";
@@ -829,13 +778,6 @@
829
778
  dialogOverlay = el;
830
779
  dialogIframe = iframeEl;
831
780
  document.body.appendChild(dialogOverlay);
832
-
833
- // Fallback: reveal the iframe even if ROLEPLAY_READY never arrives.
834
- if (dialogRevealTimer) clearTimeout(dialogRevealTimer);
835
- dialogRevealTimer = setTimeout(function () {
836
- revealIframe(dialogIframe);
837
- dialogRevealTimer = null;
838
- }, IFRAME_REVEAL_FALLBACK_MS);
839
781
  } catch (e) {
840
782
  logError("addToScenario", e);
841
783
  teardownDialog();